summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/MSP430
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-07-25 06:49:55 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-07-25 06:49:55 +0000
commit5680b4f285402e7cf1dc6aa7e5527ca8270a55a7 (patch)
tree8ef1bb8de5dddc88860992616994fb07efd8de1f /llvm/lib/Target/MSP430
parentd43b86d4a45f4cfc5b1e27d62ace35940a52e82b (diff)
downloadbcm5719-llvm-5680b4f285402e7cf1dc6aa7e5527ca8270a55a7.tar.gz
bcm5719-llvm-5680b4f285402e7cf1dc6aa7e5527ca8270a55a7.zip
Add new helpers for registering targets.
- Less boilerplate == good. llvm-svn: 77052
Diffstat (limited to 'llvm/lib/Target/MSP430')
-rw-r--r--llvm/lib/Target/MSP430/MSP430.h3
-rw-r--r--llvm/lib/Target/MSP430/MSP430AsmPrinter.cpp20
-rw-r--r--llvm/lib/Target/MSP430/MSP430TargetMachine.cpp12
3 files changed, 8 insertions, 27 deletions
diff --git a/llvm/lib/Target/MSP430/MSP430.h b/llvm/lib/Target/MSP430/MSP430.h
index 6251a42f904..d9f5f862954 100644
--- a/llvm/lib/Target/MSP430/MSP430.h
+++ b/llvm/lib/Target/MSP430/MSP430.h
@@ -24,9 +24,6 @@ namespace llvm {
FunctionPass *createMSP430ISelDag(MSP430TargetMachine &TM,
CodeGenOpt::Level OptLevel);
- FunctionPass *createMSP430CodePrinterPass(formatted_raw_ostream &o,
- TargetMachine &tm,
- bool verbose);
extern Target TheMSP430Target;
diff --git a/llvm/lib/Target/MSP430/MSP430AsmPrinter.cpp b/llvm/lib/Target/MSP430/MSP430AsmPrinter.cpp
index 4905f25ceb8..bb112bc2550 100644
--- a/llvm/lib/Target/MSP430/MSP430AsmPrinter.cpp
+++ b/llvm/lib/Target/MSP430/MSP430AsmPrinter.cpp
@@ -1,4 +1,4 @@
-//===-- MSP430AsmPrinter.cpp - MSP430 LLVM assembly writer ------------------===//
+//===-- MSP430AsmPrinter.cpp - MSP430 LLVM assembly writer ----------------===//
//
// The LLVM Compiler Infrastructure
//
@@ -27,6 +27,7 @@
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/Target/TargetAsmInfo.h"
#include "llvm/Target/TargetData.h"
+#include "llvm/Target/TargetRegistry.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/FormattedStream.h"
@@ -72,17 +73,6 @@ namespace {
#include "MSP430GenAsmWriter.inc"
-/// createMSP430CodePrinterPass - Returns a pass that prints the MSP430
-/// assembly code for a MachineFunction to the given output stream,
-/// using the given target machine description. This should work
-/// regardless of whether the function is in SSA form.
-///
-FunctionPass *llvm::createMSP430CodePrinterPass(formatted_raw_ostream &o,
- TargetMachine &tm,
- bool verbose) {
- return new MSP430AsmPrinter(o, tm, tm.getTargetAsmInfo(), verbose);
-}
-
void MSP430AsmPrinter::emitFunctionHeader(const MachineFunction &MF) {
const Function *F = MF.getFunction();
@@ -255,3 +245,9 @@ void MSP430AsmPrinter::printCCOperand(const MachineInstr *MI, int OpNum) {
break;
}
}
+
+extern "C" void LLVMInitializeMSP430Target() {
+ // Register the target.
+ RegisterTargetMachine<MSP430TargetMachine> X(TheMSP430Target);
+ RegisterAsmPrinter<MSP430AsmPrinter> Y(TheMSP430Target);
+}
diff --git a/llvm/lib/Target/MSP430/MSP430TargetMachine.cpp b/llvm/lib/Target/MSP430/MSP430TargetMachine.cpp
index ffd93da921a..d77b26b56c6 100644
--- a/llvm/lib/Target/MSP430/MSP430TargetMachine.cpp
+++ b/llvm/lib/Target/MSP430/MSP430TargetMachine.cpp
@@ -18,20 +18,8 @@
#include "llvm/PassManager.h"
#include "llvm/CodeGen/Passes.h"
#include "llvm/Target/TargetAsmInfo.h"
-#include "llvm/Target/TargetMachineRegistry.h"
-
using namespace llvm;
-// Register the targets
-static RegisterTarget<MSP430TargetMachine>
-X(TheMSP430Target, "msp430", "MSP430 [experimental]");
-
-// Force static initialization.
-extern "C" void LLVMInitializeMSP430Target() {
- TargetRegistry::RegisterAsmPrinter(TheMSP430Target,
- &createMSP430CodePrinterPass);
-}
-
MSP430TargetMachine::MSP430TargetMachine(const Target &T,
const Module &M,
const std::string &FS) :
OpenPOWER on IntegriCloud