Initialize MMI
authorDevang Patel <dpatel@apple.com>
Sat, 20 Jun 2009 01:00:07 +0000 (01:00 +0000)
committerDevang Patel <dpatel@apple.com>
Sat, 20 Jun 2009 01:00:07 +0000 (01:00 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73813 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/PowerPC/AsmPrinter/PPCAsmPrinter.cpp
lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.h

index 08ae3bf943b06cad04aaa746be1553bc98926905..c7bfb6d1a1a34bb483fadd25a16d68a8f2ed3828 100644 (file)
@@ -647,6 +647,8 @@ bool PPCLinuxAsmPrinter::runOnMachineFunction(MachineFunction &MF) {
 bool PPCLinuxAsmPrinter::doInitialization(Module &M) {
   bool Result = AsmPrinter::doInitialization(M);
   DW = getAnalysisIfAvailable<DwarfWriter>();
+  MMI = getAnalysisIfAvailable<MachineModuleInfo>();
+  assert(MMI);
   SwitchToSection(TAI->getTextSection());
   return Result;
 }
@@ -865,6 +867,8 @@ bool PPCDarwinAsmPrinter::doInitialization(Module &M) {
 
   bool Result = AsmPrinter::doInitialization(M);
   DW = getAnalysisIfAvailable<DwarfWriter>();
+  MMI = getAnalysisIfAvailable<MachineModuleInfo>();
+  assert(MMI);
 
   // Prime text sections so they are adjacent.  This reduces the likelihood a
   // large data or debug section causes a branch to exceed 16M limit.
index 44d817de0228103baf74cd4d9b7456aa9dff466d..a34b67503320e271e78b9e83ebccd6650c13d7ae 100644 (file)
@@ -803,6 +803,13 @@ void X86ATTAsmPrinter::printMachineInstruction(const MachineInstr *MI) {
   printInstruction(MI);
 }
 
+/// doInitialization
+bool X86ATTAsmPrinter::doInitialization(Module &M) {
+  if (TAI->doesSupportDebugInformation() || TAI->doesSupportExceptionHandling()) 
+    MMI = getAnalysisIfAvailable<MachineModuleInfo>();
+  return AsmPrinter::doInitialization(M);
+}
+
 void X86ATTAsmPrinter::printModuleLevelGV(const GlobalVariable* GVar) {
   const TargetData *TD = TM.getTargetData();
 
index 31c7a1f044e1fc51fbbbfcee480db237696cf18c..fb3a354ec5859bdc51eb23672353e8c7c996f5c4 100644 (file)
@@ -55,6 +55,7 @@ class VISIBILITY_HIDDEN X86ATTAsmPrinter : public AsmPrinter {
     AsmPrinter::getAnalysisUsage(AU);
   }
 
+  bool doInitialization(Module &M);
   bool doFinalization(Module &M);
 
   /// printInstruction - This method is automatically generated by tablegen