MSP430TargetMachine.cpp revision 3be03406c9c3b2075d5ae416499af2f15f703d6f
1//===-- MSP430TargetMachine.cpp - Define TargetMachine for MSP430 ---------===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// Top-level implementation for the MSP430 target.
11//
12//===----------------------------------------------------------------------===//
13
14#include "MSP430.h"
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"
21using namespace llvm;
22
23MSP430TargetMachine::MSP430TargetMachine(const Target &T,
24                                         const Module &M,
25                                         const std::string &FS) :
26  LLVMTargetMachine(T),
27  Subtarget(M.getTargetTriple(), FS),
28  // FIXME: Check TargetData string.
29  DataLayout("e-p:16:8:8-i8:8:8-i16:8:8-i32:8:8"),
30  InstrInfo(*this), TLInfo(*this),
31  FrameInfo(TargetFrameInfo::StackGrowsDown, 2, -2) { }
32
33const TargetAsmInfo *MSP430TargetMachine::createTargetAsmInfo() const {
34  return new MSP430TargetAsmInfo();
35}
36
37bool MSP430TargetMachine::addInstSelector(PassManagerBase &PM,
38                                          CodeGenOpt::Level OptLevel) {
39  // Install an instruction selector.
40  PM.add(createMSP430ISelDag(*this, OptLevel));
41  return false;
42}
43
44