1 //===-- MSP430TargetMachine.cpp - Define TargetMachine for MSP430 ---------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // Top-level implementation for the MSP430 target.
12 //===----------------------------------------------------------------------===//
15 #include "MSP430TargetAsmInfo.h"
16 #include "MSP430TargetMachine.h"
17 #include "llvm/Module.h"
18 #include "llvm/PassManager.h"
19 #include "llvm/CodeGen/Passes.h"
20 #include "llvm/Target/TargetAsmInfo.h"
21 #include "llvm/Target/TargetMachineRegistry.h"
25 // Register the targets
26 extern Target TheMSP430Target;
27 static RegisterTarget<MSP430TargetMachine>
28 X(TheMSP430Target, "msp430", "MSP430 [experimental]");
30 // Force static initialization.
31 extern "C" void LLVMInitializeMSP430Target() {
32 TargetRegistry::RegisterAsmPrinter(TheMSP430Target,
33 &createMSP430CodePrinterPass);
36 MSP430TargetMachine::MSP430TargetMachine(const Target &T,
38 const std::string &FS) :
40 Subtarget(*this, M, FS),
41 // FIXME: Check TargetData string.
42 DataLayout("e-p:16:8:8-i8:8:8-i16:8:8-i32:8:8"),
43 InstrInfo(*this), TLInfo(*this),
44 FrameInfo(TargetFrameInfo::StackGrowsDown, 2, -2) { }
46 const TargetAsmInfo *MSP430TargetMachine::createTargetAsmInfo() const {
47 return new MSP430TargetAsmInfo(*this);
50 bool MSP430TargetMachine::addInstSelector(PassManagerBase &PM,
51 CodeGenOpt::Level OptLevel) {
52 // Install an instruction selector.
53 PM.add(createMSP430ISelDag(*this, OptLevel));