[llvm-commits] CVS: llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp

Jim Laskey jlaskey at apple.com
Wed Sep 6 11:35:05 PDT 2006



Changes in directory llvm/lib/Target/Alpha:

AlphaAsmPrinter.cpp updated: 1.46 -> 1.47
---
Log message:

Separate target specific asm properties from the asm printers.


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

 AlphaAsmPrinter.cpp |   21 ++++++++++++++-------
 1 files changed, 14 insertions(+), 7 deletions(-)


Index: llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp
diff -u llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.46 llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.47
--- llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp:1.46	Mon Jul  3 12:57:34 2006
+++ llvm/lib/Target/Alpha/AlphaAsmPrinter.cpp	Wed Sep  6 13:34:40 2006
@@ -19,6 +19,7 @@
 #include "llvm/Type.h"
 #include "llvm/Assembly/Writer.h"
 #include "llvm/CodeGen/AsmPrinter.h"
+#include "llvm/Target/TargetAsmInfo.h"
 #include "llvm/Target/TargetMachine.h"
 #include "llvm/Support/Mangler.h"
 #include "llvm/ADT/Statistic.h"
@@ -27,17 +28,22 @@
 
 namespace {
   Statistic<> EmittedInsts("asm-printer", "Number of machine instrs printed");
+  
+  struct VISIBILITY_HIDDEN AlphaTargetAsmInfo : public TargetAsmInfo {
+    AlphaTargetAsmInfo() {
+      AlignmentIsInBytes = false;
+      PrivateGlobalPrefix = "$";
+    }
+  };
 
-  struct AlphaAsmPrinter : public AsmPrinter {
+  struct VISIBILITY_HIDDEN AlphaAsmPrinter : public AsmPrinter {
 
     /// Unique incrementer for label values for referencing Global values.
     ///
     unsigned LabelNumber;
 
-     AlphaAsmPrinter(std::ostream &o, TargetMachine &tm)
-       : AsmPrinter(o, tm), LabelNumber(0) {
-      AlignmentIsInBytes = false;
-      PrivateGlobalPrefix = "$";
+    AlphaAsmPrinter(std::ostream &o, TargetMachine &tm, TargetAsmInfo *T)
+       : AsmPrinter(o, tm, T), LabelNumber(0) {
     }
 
     /// We name each basic block in a Function with a unique number, so
@@ -76,7 +82,8 @@
 ///
 FunctionPass *llvm::createAlphaCodePrinterPass (std::ostream &o,
                                                   TargetMachine &tm) {
-  return new AlphaAsmPrinter(o, tm);
+  AlphaTargetAsmInfo *TAI = new AlphaTargetAsmInfo();
+  return new AlphaAsmPrinter(o, tm, TAI);
 }
 
 #include "AlphaGenAsmWriter.inc"
@@ -115,7 +122,7 @@
     return;
 
   case MachineOperand::MO_ConstantPoolIndex:
-    O << PrivateGlobalPrefix << "CPI" << getFunctionNumber() << "_"
+    O << TAI->getPrivateGlobalPrefix() << "CPI" << getFunctionNumber() << "_"
       << MO.getConstantPoolIndex();
     return;
 






More information about the llvm-commits mailing list