Make target asm info a property of the target machine.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@30162 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/IA64/IA64AsmPrinter.cpp b/lib/Target/IA64/IA64AsmPrinter.cpp
index 1de1215..4a16777 100644
--- a/lib/Target/IA64/IA64AsmPrinter.cpp
+++ b/lib/Target/IA64/IA64AsmPrinter.cpp
@@ -23,8 +23,8 @@
#include "llvm/Assembly/Writer.h"
#include "llvm/CodeGen/AsmPrinter.h"
#include "llvm/CodeGen/MachineFunctionPass.h"
-#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetAsmInfo.h"
+#include "llvm/Target/TargetMachine.h"
#include "llvm/Support/Mangler.h"
#include "llvm/ADT/Statistic.h"
#include <iostream>
@@ -32,31 +32,11 @@
namespace {
Statistic<> EmittedInsts("asm-printer", "Number of machine instrs printed");
-
- struct VISIBILITY_HIDDEN IA64TargetAsmInfo : public TargetAsmInfo {
- IA64TargetAsmInfo() {
- CommentString = "//";
- Data8bitsDirective = "\tdata1\t"; // FIXME: check that we are
- Data16bitsDirective = "\tdata2.ua\t"; // disabling auto-alignment
- Data32bitsDirective = "\tdata4.ua\t"; // properly
- Data64bitsDirective = "\tdata8.ua\t";
- ZeroDirective = "\t.skip\t";
- AsciiDirective = "\tstring\t";
-
- GlobalVarAddrPrefix="";
- GlobalVarAddrSuffix="";
- FunctionAddrPrefix="@fptr(";
- FunctionAddrSuffix=")";
-
- // FIXME: would be nice to have rodata (no 'w') when appropriate?
- ConstantPoolSection = "\n\t.section .data, \"aw\", \"progbits\"\n";
- }
- };
struct IA64AsmPrinter : public AsmPrinter {
std::set<std::string> ExternalFunctionNames, ExternalObjectNames;
- IA64AsmPrinter(std::ostream &O, TargetMachine &TM, TargetAsmInfo *T)
+ IA64AsmPrinter(std::ostream &O, TargetMachine &TM, const TargetAsmInfo *T)
: AsmPrinter(O, TM, T) {
}
@@ -366,8 +346,7 @@
///
FunctionPass *llvm::createIA64CodePrinterPass(std::ostream &o,
IA64TargetMachine &tm) {
- IA64TargetAsmInfo *TAI = new IA64TargetAsmInfo();
- return new IA64AsmPrinter(o, tm, TAI);
+ return new IA64AsmPrinter(o, tm, tm.getTargetAsmInfo());
}
diff --git a/lib/Target/IA64/IA64TargetMachine.h b/lib/Target/IA64/IA64TargetMachine.h
index 5a4b6b6..61ac05f 100644
--- a/lib/Target/IA64/IA64TargetMachine.h
+++ b/lib/Target/IA64/IA64TargetMachine.h
@@ -19,6 +19,7 @@
#include "llvm/Target/TargetFrameInfo.h"
#include "IA64InstrInfo.h"
#include "IA64ISelLowering.h"
+#include "IA64TargetAsmInfo.h"
namespace llvm {
@@ -40,6 +41,10 @@
return &InstrInfo.getRegisterInfo();
}
virtual const TargetData *getTargetData() const { return &DataLayout; }
+
+ virtual const TargetAsmInfo *createTargetAsmInfo() const {
+ return static_cast<const TargetAsmInfo *>(new IA64TargetAsmInfo(*this));
+ }
static unsigned getModuleMatchQuality(const Module &M);