[llvm-commits] CVS: llvm/lib/Target/Sparc/SparcAsmPrinter.cpp
Jim Laskey
jlaskey at apple.com
Wed Sep 6 11:35:06 PDT 2006
Changes in directory llvm/lib/Target/Sparc:
SparcAsmPrinter.cpp updated: 1.66 -> 1.67
---
Log message:
Separate target specific asm properties from the asm printers.
---
Diffs of the changes: (+12 -4)
SparcAsmPrinter.cpp | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
Index: llvm/lib/Target/Sparc/SparcAsmPrinter.cpp
diff -u llvm/lib/Target/Sparc/SparcAsmPrinter.cpp:1.66 llvm/lib/Target/Sparc/SparcAsmPrinter.cpp:1.67
--- llvm/lib/Target/Sparc/SparcAsmPrinter.cpp:1.66 Fri May 12 01:33:48 2006
+++ llvm/lib/Target/Sparc/SparcAsmPrinter.cpp Wed Sep 6 13:34:40 2006
@@ -22,6 +22,7 @@
#include "llvm/CodeGen/MachineFunctionPass.h"
#include "llvm/CodeGen/MachineConstantPool.h"
#include "llvm/CodeGen/MachineInstr.h"
+#include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Target/TargetData.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Support/Mangler.h"
@@ -36,8 +37,8 @@
namespace {
Statistic<> EmittedInsts("asm-printer", "Number of machine instrs printed");
- struct SparcAsmPrinter : public AsmPrinter {
- SparcAsmPrinter(std::ostream &O, TargetMachine &TM) : AsmPrinter(O, TM) {
+ struct VISIBILITY_HIDDEN SparcTargetAsmInfo : public TargetAsmInfo {
+ SparcTargetAsmInfo() {
Data16bitsDirective = "\t.half\t";
Data32bitsDirective = "\t.word\t";
Data64bitsDirective = 0; // .xword is only supported by V9.
@@ -45,6 +46,12 @@
CommentString = "!";
ConstantPoolSection = "\t.section \".rodata\",#alloc\n";
}
+ };
+
+ struct VISIBILITY_HIDDEN SparcAsmPrinter : public AsmPrinter {
+ SparcAsmPrinter(std::ostream &O, TargetMachine &TM, TargetAsmInfo *T)
+ : AsmPrinter(O, TM, T) {
+ }
/// We name each basic block in a Function with a unique number, so
/// that we can consistently refer to them later. This is cleared
@@ -78,7 +85,8 @@
///
FunctionPass *llvm::createSparcCodePrinterPass(std::ostream &o,
TargetMachine &tm) {
- return new SparcAsmPrinter(o, tm);
+ SparcTargetAsmInfo *TAI = new SparcTargetAsmInfo();
+ return new SparcAsmPrinter(o, tm, TAI);
}
/// runOnMachineFunction - This uses the printMachineInstruction()
@@ -167,7 +175,7 @@
O << MO.getSymbolName();
break;
case MachineOperand::MO_ConstantPoolIndex:
- O << PrivateGlobalPrefix << "CPI" << getFunctionNumber() << "_"
+ O << TAI->getPrivateGlobalPrefix() << "CPI" << getFunctionNumber() << "_"
<< MO.getConstantPoolIndex();
break;
default:
More information about the llvm-commits
mailing list