[llvm-commits] CVS: llvm/lib/Target/Sparc/SparcAsmPrinter.cpp SparcTargetMachine.h

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



Changes in directory llvm/lib/Target/Sparc:

SparcAsmPrinter.cpp updated: 1.67 -> 1.68
SparcTargetMachine.h updated: 1.15 -> 1.16
---
Log message:

Make target asm info a property of the target machine.


---
Diffs of the changes:  (+6 -14)

 SparcAsmPrinter.cpp  |   16 ++--------------
 SparcTargetMachine.h |    4 ++++
 2 files changed, 6 insertions(+), 14 deletions(-)


Index: llvm/lib/Target/Sparc/SparcAsmPrinter.cpp
diff -u llvm/lib/Target/Sparc/SparcAsmPrinter.cpp:1.67 llvm/lib/Target/Sparc/SparcAsmPrinter.cpp:1.68
--- llvm/lib/Target/Sparc/SparcAsmPrinter.cpp:1.67	Wed Sep  6 13:34:40 2006
+++ llvm/lib/Target/Sparc/SparcAsmPrinter.cpp	Thu Sep  7 17:06:40 2006
@@ -37,19 +37,8 @@
 namespace {
   Statistic<> EmittedInsts("asm-printer", "Number of machine instrs printed");
 
-  struct VISIBILITY_HIDDEN SparcTargetAsmInfo : public TargetAsmInfo {
-    SparcTargetAsmInfo() {
-      Data16bitsDirective = "\t.half\t";
-      Data32bitsDirective = "\t.word\t";
-      Data64bitsDirective = 0;  // .xword is only supported by V9.
-      ZeroDirective = "\t.skip\t";
-      CommentString = "!";
-      ConstantPoolSection = "\t.section \".rodata\",#alloc\n";
-    }
-  };
-
   struct VISIBILITY_HIDDEN SparcAsmPrinter : public AsmPrinter {
-    SparcAsmPrinter(std::ostream &O, TargetMachine &TM, TargetAsmInfo *T)
+    SparcAsmPrinter(std::ostream &O, TargetMachine &TM, const TargetAsmInfo *T)
       : AsmPrinter(O, TM, T) {
     }
 
@@ -85,8 +74,7 @@
 ///
 FunctionPass *llvm::createSparcCodePrinterPass(std::ostream &o,
                                                TargetMachine &tm) {
-  SparcTargetAsmInfo *TAI = new SparcTargetAsmInfo();
-  return new SparcAsmPrinter(o, tm, TAI);
+  return new SparcAsmPrinter(o, tm, tm.getTargetAsmInfo());
 }
 
 /// runOnMachineFunction - This uses the printMachineInstruction()


Index: llvm/lib/Target/Sparc/SparcTargetMachine.h
diff -u llvm/lib/Target/Sparc/SparcTargetMachine.h:1.15 llvm/lib/Target/Sparc/SparcTargetMachine.h:1.16
--- llvm/lib/Target/Sparc/SparcTargetMachine.h:1.15	Sun Sep  3 23:14:57 2006
+++ llvm/lib/Target/Sparc/SparcTargetMachine.h	Thu Sep  7 17:06:40 2006
@@ -19,6 +19,7 @@
 #include "llvm/Target/TargetFrameInfo.h"
 #include "SparcInstrInfo.h"
 #include "SparcSubtarget.h"
+#include "SparcTargetAsmInfo.h"
 
 namespace llvm {
 
@@ -41,6 +42,9 @@
   virtual const TargetData       *getTargetData() const { return &DataLayout; }
   static unsigned getModuleMatchQuality(const Module &M);
 
+  virtual const TargetAsmInfo *createTargetAsmInfo() const {
+    return static_cast<const TargetAsmInfo *>(new SparcTargetAsmInfo(*this));
+  }
   
   // Pass Pipeline Configuration
   virtual bool addInstSelector(FunctionPassManager &PM, bool Fast);






More information about the llvm-commits mailing list