[llvm-commits] CVS: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp PPCTargetMachine.h

Jim Laskey jlaskey at apple.com
Thu Sep 7 15:07:09 PDT 2006



Changes in directory llvm/lib/Target/PowerPC:

PPCAsmPrinter.cpp updated: 1.193 -> 1.194
PPCTargetMachine.h updated: 1.23 -> 1.24
---
Log message:

Make target asm info a property of the target machine.


---
Diffs of the changes:  (+8 -40)

 PPCAsmPrinter.cpp  |   44 ++++----------------------------------------
 PPCTargetMachine.h |    4 ++++
 2 files changed, 8 insertions(+), 40 deletions(-)


Index: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp
diff -u llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.193 llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.194
--- llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:1.193	Wed Sep  6 13:34:40 2006
+++ llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp	Thu Sep  7 17:06:40 2006
@@ -50,7 +50,7 @@
   struct VISIBILITY_HIDDEN PPCAsmPrinter : public AsmPrinter {
     std::set<std::string> FnStubs, GVStubs;
     
-    PPCAsmPrinter(std::ostream &O, TargetMachine &TM, TargetAsmInfo *T)
+    PPCAsmPrinter(std::ostream &O, TargetMachine &TM, const TargetAsmInfo *T)
       : AsmPrinter(O, TM, T) {}
 
     virtual const char *getPassName() const {
@@ -239,49 +239,14 @@
     
   };
 
-  struct VISIBILITY_HIDDEN DarwinTargetAsmInfo : public TargetAsmInfo {
-    DarwinTargetAsmInfo(PPCTargetMachine &TM) {
-      bool isPPC64 = TM.getSubtargetImpl()->isPPC64();
-
-      CommentString = ";";
-      GlobalPrefix = "_";
-      PrivateGlobalPrefix = "L";
-      ZeroDirective = "\t.space\t";
-      SetDirective = "\t.set";
-      Data64bitsDirective = isPPC64 ? ".quad\t" : 0;  
-      AlignmentIsInBytes = false;
-      ConstantPoolSection = "\t.const\t";
-      JumpTableDataSection = ".const";
-      JumpTableTextSection = "\t.text";
-      LCOMMDirective = "\t.lcomm\t";
-      StaticCtorsSection = ".mod_init_func";
-      StaticDtorsSection = ".mod_term_func";
-      InlineAsmStart = "# InlineAsm Start";
-      InlineAsmEnd = "# InlineAsm End";
-      
-      NeedsSet = true;
-      AddressSize = isPPC64 ? 8 : 4;
-      DwarfAbbrevSection = ".section __DWARF,__debug_abbrev";
-      DwarfInfoSection = ".section __DWARF,__debug_info";
-      DwarfLineSection = ".section __DWARF,__debug_line";
-      DwarfFrameSection = ".section __DWARF,__debug_frame";
-      DwarfPubNamesSection = ".section __DWARF,__debug_pubnames";
-      DwarfPubTypesSection = ".section __DWARF,__debug_pubtypes";
-      DwarfStrSection = ".section __DWARF,__debug_str";
-      DwarfLocSection = ".section __DWARF,__debug_loc";
-      DwarfARangesSection = ".section __DWARF,__debug_aranges";
-      DwarfRangesSection = ".section __DWARF,__debug_ranges";
-      DwarfMacInfoSection = ".section __DWARF,__debug_macinfo";
-    }
-  };
-
   /// DarwinAsmPrinter - PowerPC assembly printer, customized for Darwin/Mac OS
   /// X
   struct VISIBILITY_HIDDEN DarwinAsmPrinter : public PPCAsmPrinter {
   
     DwarfWriter DW;
 
-    DarwinAsmPrinter(std::ostream &O, PPCTargetMachine &TM, TargetAsmInfo *T)
+    DarwinAsmPrinter(std::ostream &O, PPCTargetMachine &TM,
+                     const TargetAsmInfo *T)
       : PPCAsmPrinter(O, TM, T), DW(O, this, T) {
       bool isPPC64 = TM.getSubtargetImpl()->isPPC64();
     }
@@ -309,8 +274,7 @@
 ///
 FunctionPass *llvm::createDarwinCodePrinterPass(std::ostream &o,
                                                 PPCTargetMachine &tm) {
-  TargetAsmInfo *TAI = new DarwinTargetAsmInfo(tm);
-  return new DarwinAsmPrinter(o, tm, TAI);
+  return new DarwinAsmPrinter(o, tm, tm.getTargetAsmInfo());
 }
 
 // Include the auto-generated portion of the assembly writer


Index: llvm/lib/Target/PowerPC/PPCTargetMachine.h
diff -u llvm/lib/Target/PowerPC/PPCTargetMachine.h:1.23 llvm/lib/Target/PowerPC/PPCTargetMachine.h:1.24
--- llvm/lib/Target/PowerPC/PPCTargetMachine.h:1.23	Sun Sep  3 23:14:57 2006
+++ llvm/lib/Target/PowerPC/PPCTargetMachine.h	Thu Sep  7 17:06:40 2006
@@ -19,6 +19,7 @@
 #include "PPCJITInfo.h"
 #include "PPCInstrInfo.h"
 #include "PPCISelLowering.h"
+#include "PPCTargetAsmInfo.h"
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Target/TargetData.h"
 
@@ -55,6 +56,9 @@
     return InstrItins;
   }
   
+  virtual const TargetAsmInfo *createTargetAsmInfo() const {
+    return static_cast<const TargetAsmInfo *>(new DarwinTargetAsmInfo(*this));
+  }
   
   // Pass Pipeline Configuration
   virtual bool addInstSelector(FunctionPassManager &PM, bool Fast);






More information about the llvm-commits mailing list