summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorPedro Artigas <partigas@apple.com>2012-12-06 00:50:55 +0000
committerPedro Artigas <partigas@apple.com>2012-12-06 00:50:55 +0000
commitbf7d3bab268b501d5187ef32e7c3aed8c5df3244 (patch)
tree80dc1e91f74a52f504e0356557637120be114183 /llvm/lib
parentab417b644c726a25d366c0f81d13bcf95608f572 (diff)
downloadbcm5719-llvm-bf7d3bab268b501d5187ef32e7c3aed8c5df3244.tar.gz
bcm5719-llvm-bf7d3bab268b501d5187ef32e7c3aed8c5df3244.zip
change MCContext to work on the doInitialization/doFinalization model
reviewed by Evan Cheng <evan.cheng@apple.com> llvm-svn: 169456
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/MachineModuleInfo.cpp5
-rw-r--r--llvm/lib/MC/MCContext.cpp37
2 files changed, 36 insertions, 6 deletions
diff --git a/llvm/lib/CodeGen/MachineModuleInfo.cpp b/llvm/lib/CodeGen/MachineModuleInfo.cpp
index 4fbbb05ee6b..c5fd4a17c27 100644
--- a/llvm/lib/CodeGen/MachineModuleInfo.cpp
+++ b/llvm/lib/CodeGen/MachineModuleInfo.cpp
@@ -270,6 +270,9 @@ MachineModuleInfo::~MachineModuleInfo() {
}
bool MachineModuleInfo::doInitialization(Module &M) {
+
+ Context.doInitialization();
+
ObjFileMMI = 0;
CompactUnwindEncoding = 0;
CurCallSite = 0;
@@ -291,6 +294,8 @@ bool MachineModuleInfo::doFinalization(Module &M) {
delete AddrLabelSymbols;
AddrLabelSymbols = 0;
+ Context.doFinalization();
+
return false;
}
diff --git a/llvm/lib/MC/MCContext.cpp b/llvm/lib/MC/MCContext.cpp
index dd9d956088a..cd95b1161a8 100644
--- a/llvm/lib/MC/MCContext.cpp
+++ b/llvm/lib/MC/MCContext.cpp
@@ -44,23 +44,48 @@ MCContext::MCContext(const MCAsmInfo &mai, const MCRegisterInfo &mri,
SecureLogFile = getenv("AS_SECURE_LOG_FILE");
SecureLog = 0;
SecureLogUsed = false;
+}
+
+MCContext::~MCContext() {
+ // NOTE: The symbols are all allocated out of a bump pointer allocator,
+ // we don't need to free them here.
+
+ // If the stream for the .secure_log_unique directive was created free it.
+ delete (raw_ostream*)SecureLog;
+}
+
+//===----------------------------------------------------------------------===//
+// Module Lifetime Management
+//===----------------------------------------------------------------------===//
+void MCContext::doInitialization() {
+ NextUniqueID = 0;
+ AllowTemporaryLabels = true;
DwarfLocSeen = false;
GenDwarfForAssembly = false;
GenDwarfFileNumber = 0;
}
-MCContext::~MCContext() {
- // NOTE: The symbols are all allocated out of a bump pointer allocator,
- // we don't need to free them here.
+void MCContext::doFinalization() {
+ UsedNames.clear();
+ Symbols.clear();
+ Allocator.Reset();
+ Instances.clear();
+ MCDwarfFiles.clear();
+ MCDwarfDirs.clear();
+ MCGenDwarfLabelEntries.clear();
+ DwarfDebugFlags = StringRef();
+ MCLineSections.clear();
+ MCLineSectionOrder.clear();
+ CurrentDwarfLoc = MCDwarfLoc(0,0,0,DWARF2_FLAG_IS_STMT,0,0);
// If we have the MachO uniquing map, free it.
delete (MachOUniqueMapTy*)MachOUniquingMap;
delete (ELFUniqueMapTy*)ELFUniquingMap;
delete (COFFUniqueMapTy*)COFFUniquingMap;
-
- // If the stream for the .secure_log_unique directive was created free it.
- delete (raw_ostream*)SecureLog;
+ MachOUniquingMap = 0;
+ ELFUniquingMap = 0;
+ COFFUniquingMap = 0;
}
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud