aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/Sparc
diff options
context:
space:
mode:
authorJim Laskey <jlaskey@mac.com>2006-09-06 18:34:40 +0000
committerJim Laskey <jlaskey@mac.com>2006-09-06 18:34:40 +0000
commit563321a2582851c653d0863e8e0bba3d483734f9 (patch)
treef6466bafbfa2fd2800a0fd0c457c39521217c706 /lib/Target/Sparc
parentb52b54d4af18ca3cbfa56361aea94635b2a6919e (diff)
Separate target specific asm properties from the asm printers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30126 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Sparc')
-rw-r--r--lib/Target/Sparc/SparcAsmPrinter.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/Target/Sparc/SparcAsmPrinter.cpp b/lib/Target/Sparc/SparcAsmPrinter.cpp
index 0de7fb032b..2bc6f6332e 100644
--- a/lib/Target/Sparc/SparcAsmPrinter.cpp
+++ b/lib/Target/Sparc/SparcAsmPrinter.cpp
@@ -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 @@ using namespace llvm;
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 @@ namespace {
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 @@ namespace {
///
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 @@ void SparcAsmPrinter::printOperand(const MachineInstr *MI, int opNum) {
O << MO.getSymbolName();
break;
case MachineOperand::MO_ConstantPoolIndex:
- O << PrivateGlobalPrefix << "CPI" << getFunctionNumber() << "_"
+ O << TAI->getPrivateGlobalPrefix() << "CPI" << getFunctionNumber() << "_"
<< MO.getConstantPoolIndex();
break;
default: