X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FCodeGen%2FMachineModuleInfo.cpp;h=8af9d053b12a266d55422697543e35f28c82d690;hb=46abfcf4187432da728cbe452c32143da077e07f;hp=7cd8f61c45c9122e28de8580f55e981669fca6c9;hpb=49eb628c21b358380b76df82aa3dfe0baab4c6ec;p=oota-llvm.git diff --git a/lib/CodeGen/MachineModuleInfo.cpp b/lib/CodeGen/MachineModuleInfo.cpp index 7cd8f61c45c..8af9d053b12 100644 --- a/lib/CodeGen/MachineModuleInfo.cpp +++ b/lib/CodeGen/MachineModuleInfo.cpp @@ -13,12 +13,12 @@ #include "llvm/CodeGen/MachineFunction.h" #include "llvm/CodeGen/MachineFunctionPass.h" #include "llvm/CodeGen/Passes.h" -#include "llvm/Constants.h" -#include "llvm/DerivedTypes.h" -#include "llvm/GlobalVariable.h" +#include "llvm/IR/Constants.h" +#include "llvm/IR/DerivedTypes.h" +#include "llvm/IR/GlobalVariable.h" +#include "llvm/IR/Module.h" #include "llvm/MC/MCObjectFileInfo.h" #include "llvm/MC/MCSymbol.h" -#include "llvm/Module.h" #include "llvm/Support/Dwarf.h" #include "llvm/Support/ErrorHandling.h" using namespace llvm; @@ -253,15 +253,8 @@ void MMIAddrLabelMapCallbackPtr::allUsesReplacedWith(Value *V2) { MachineModuleInfo::MachineModuleInfo(const MCAsmInfo &MAI, const MCRegisterInfo &MRI, const MCObjectFileInfo *MOFI) - : ImmutablePass(ID), Context(MAI, MRI, MOFI), - ObjFileMMI(0), CompactUnwindEncoding(0), CurCallSite(0), CallsEHReturn(0), - CallsUnwindInit(0), DbgInfoAvailable(false), - UsesVAFloatArgument(false) { + : ImmutablePass(ID), Context(MAI, MRI, MOFI, 0, false) { initializeMachineModuleInfoPass(*PassRegistry::getPassRegistry()); - // Always emit some info, by default "no personality" info. - Personalities.push_back(NULL); - AddrLabelSymbols = 0; - TheModule = 0; } MachineModuleInfo::MachineModuleInfo() @@ -273,12 +266,37 @@ MachineModuleInfo::MachineModuleInfo() } MachineModuleInfo::~MachineModuleInfo() { - delete ObjFileMMI; +} + +bool MachineModuleInfo::doInitialization(Module &M) { + + ObjFileMMI = 0; + CompactUnwindEncoding = 0; + CurCallSite = 0; + CallsEHReturn = 0; + CallsUnwindInit = 0; + DbgInfoAvailable = UsesVAFloatArgument = false; + // Always emit some info, by default "no personality" info. + Personalities.push_back(NULL); + AddrLabelSymbols = 0; + TheModule = 0; + + return false; +} + +bool MachineModuleInfo::doFinalization(Module &M) { + + Personalities.clear(); - // FIXME: Why isn't doFinalization being called?? - //assert(AddrLabelSymbols == 0 && "doFinalization not called"); delete AddrLabelSymbols; AddrLabelSymbols = 0; + + Context.reset(); + + delete ObjFileMMI; + ObjFileMMI = 0; + + return false; } /// EndFunction - Discard function meta information. @@ -308,8 +326,7 @@ void MachineModuleInfo::AnalyzeModule(const Module &M) { if (!GV || !GV->hasInitializer()) return; // Should be an array of 'i8*'. - const ConstantArray *InitList = dyn_cast(GV->getInitializer()); - if (InitList == 0) return; + const ConstantArray *InitList = cast(GV->getInitializer()); for (unsigned i = 0, e = InitList->getNumOperands(); i != e; ++i) if (const Function *F =