LLVM API Documentation

MSP430TargetMachine.cpp

Go to the documentation of this file.
00001 //===-- MSP430TargetMachine.cpp - Define TargetMachine for MSP430 ---------===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 //
00010 // Top-level implementation for the MSP430 target.
00011 //
00012 //===----------------------------------------------------------------------===//
00013 
00014 #include "MSP430.h"
00015 #include "MSP430TargetAsmInfo.h"
00016 #include "MSP430TargetMachine.h"
00017 #include "llvm/PassManager.h"
00018 #include "llvm/CodeGen/Passes.h"
00019 #include "llvm/Target/TargetAsmInfo.h"
00020 #include "llvm/Target/TargetRegistry.h"
00021 using namespace llvm;
00022 
00023 extern "C" void LLVMInitializeMSP430Target() {
00024   // Register the target.
00025   RegisterTargetMachine<MSP430TargetMachine> X(TheMSP430Target);
00026   RegisterAsmInfo<MSP430TargetAsmInfo> Z(TheMSP430Target);
00027 }
00028 
00029 MSP430TargetMachine::MSP430TargetMachine(const Target &T,
00030                                          const std::string &TT,
00031                                          const std::string &FS) :
00032   LLVMTargetMachine(T, TT),
00033   Subtarget(TT, FS),
00034   // FIXME: Check TargetData string.
00035   DataLayout("e-p:16:8:8-i8:8:8-i16:8:8-i32:8:8"),
00036   InstrInfo(*this), TLInfo(*this),
00037   FrameInfo(TargetFrameInfo::StackGrowsDown, 2, -2) { }
00038 
00039 
00040 bool MSP430TargetMachine::addInstSelector(PassManagerBase &PM,
00041                                           CodeGenOpt::Level OptLevel) {
00042   // Install an instruction selector.
00043   PM.add(createMSP430ISelDag(*this, OptLevel));
00044   return false;
00045 }
00046