summaryrefslogtreecommitdiff
path: root/lib/Target/XCore
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-07-15 23:17:20 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-07-15 23:17:20 +0000
commit1e1f8ba28cc05212dfd347be219daa698d7294a5 (patch)
treef7633721aea9c1fc92a560c755e8ce7c3f4beb9e /lib/Target/XCore
parentfea4ec6dff9634ff134911369f3853bf6bc85dc5 (diff)
downloadllvm-1e1f8ba28cc05212dfd347be219daa698d7294a5.tar.gz
llvm-1e1f8ba28cc05212dfd347be219daa698d7294a5.tar.bz2
llvm-1e1f8ba28cc05212dfd347be219daa698d7294a5.tar.xz
Register AsmPrinter for XCore, MSP430, and PIC16 targets.
- Switch to standard addAssemblyEmitter logic. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75854 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/XCore')
-rw-r--r--lib/Target/XCore/XCore.h2
-rw-r--r--lib/Target/XCore/XCoreAsmPrinter.cpp6
-rw-r--r--lib/Target/XCore/XCoreTargetMachine.cpp11
3 files changed, 12 insertions, 7 deletions
diff --git a/lib/Target/XCore/XCore.h b/lib/Target/XCore/XCore.h
index abc69b7fa9..75aa4fd971 100644
--- a/lib/Target/XCore/XCore.h
+++ b/lib/Target/XCore/XCore.h
@@ -25,7 +25,7 @@ namespace llvm {
FunctionPass *createXCoreISelDag(XCoreTargetMachine &TM);
FunctionPass *createXCoreCodePrinterPass(formatted_raw_ostream &OS,
- XCoreTargetMachine &TM,
+ TargetMachine &TM,
bool Verbose);
} // end namespace llvm;
diff --git a/lib/Target/XCore/XCoreAsmPrinter.cpp b/lib/Target/XCore/XCoreAsmPrinter.cpp
index 213039f58b..218b21d093 100644
--- a/lib/Target/XCore/XCoreAsmPrinter.cpp
+++ b/lib/Target/XCore/XCoreAsmPrinter.cpp
@@ -52,10 +52,10 @@ namespace {
DwarfWriter *DW;
const XCoreSubtarget &Subtarget;
public:
- explicit XCoreAsmPrinter(formatted_raw_ostream &O, XCoreTargetMachine &TM,
+ explicit XCoreAsmPrinter(formatted_raw_ostream &O, TargetMachine &TM,
const TargetAsmInfo *T, bool V)
: AsmPrinter(O, TM, T, V), DW(0),
- Subtarget(*TM.getSubtargetImpl()) {}
+ Subtarget(TM.getSubtarget<XCoreSubtarget>()) {}
virtual const char *getPassName() const {
return "XCore Assembly Printer";
@@ -98,7 +98,7 @@ namespace {
/// regardless of whether the function is in SSA form.
///
FunctionPass *llvm::createXCoreCodePrinterPass(formatted_raw_ostream &o,
- XCoreTargetMachine &tm,
+ TargetMachine &tm,
bool verbose) {
return new XCoreAsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose);
}
diff --git a/lib/Target/XCore/XCoreTargetMachine.cpp b/lib/Target/XCore/XCoreTargetMachine.cpp
index 7fc869495a..857d412593 100644
--- a/lib/Target/XCore/XCoreTargetMachine.cpp
+++ b/lib/Target/XCore/XCoreTargetMachine.cpp
@@ -33,7 +33,10 @@ namespace {
}
// Force static initialization.
-extern "C" void LLVMInitializeXCoreTarget() { }
+extern "C" void LLVMInitializeXCoreTarget() {
+ TargetRegistry::RegisterAsmPrinter(TheXCoreTarget,
+ &createXCoreCodePrinterPass);
+}
const TargetAsmInfo *XCoreTargetMachine::createTargetAsmInfo() const {
return new XCoreTargetAsmInfo(*this);
@@ -62,7 +65,9 @@ bool XCoreTargetMachine::addAssemblyEmitter(PassManagerBase &PM,
CodeGenOpt::Level OptLevel,
bool Verbose,
formatted_raw_ostream &Out) {
- // Output assembly language.
- PM.add(createXCoreCodePrinterPass(Out, *this, Verbose));
+ FunctionPass *Printer = getTarget().createAsmPrinter(Out, *this, Verbose);
+ if (!Printer)
+ llvm_report_error("unable to create assembly printer");
+ PM.add(Printer);
return false;
}