blob: cf4464d8aa9c37c785ea6fc81250bc30f8c7c286 [file] [log] [blame]
Anton Korobeynikovf2c3e172009-05-03 12:57:15 +00001//===-- 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"
21#include "llvm/Target/TargetMachineRegistry.h"
22
23using namespace llvm;
24
25/// MSP430TargetMachineModule - Note that this is used on hosts that
26/// cannot link in a library unless there are references into the
27/// library. In particular, it seems that it is not possible to get
28/// things to work on Win32 without this. Though it is unused, do not
29/// remove it.
30extern "C" int MSP430TargetMachineModule;
31int MSP430TargetMachineModule = 0;
32
33
34// Register the targets
35static RegisterTarget<MSP430TargetMachine>
36X("msp430", "MSP430 [experimental]");
37
38MSP430TargetMachine::MSP430TargetMachine(const Module &M,
39 const std::string &FS) :
40 Subtarget(*this, M, FS),
Anton Korobeynikovfe3fc5a2009-05-03 12:58:05 +000041 // FIXME: Check TargetData string.
Anton Korobeynikovf2c3e172009-05-03 12:57:15 +000042 DataLayout("e-p:16:8:8-i8:8:8-i16:8:8-i32:8:8"),
43 InstrInfo(*this), TLInfo(*this),
44 FrameInfo(TargetFrameInfo::StackGrowsUp, 8, 0) { }
45
46
47const TargetAsmInfo *MSP430TargetMachine::createTargetAsmInfo() const {
48 return new MSP430TargetAsmInfo(*this);
49}
50
51bool MSP430TargetMachine::addInstSelector(PassManagerBase &PM, bool Fast) {
52 // Install an instruction selector.
53 PM.add(createMSP430ISelDag(*this));
54 return false;
55}
56
57bool MSP430TargetMachine::
58addAssemblyEmitter(PassManagerBase &PM, bool Fast, bool Verbose,
59 raw_ostream &Out) {
60 // Output assembly language.
61 PM.add(createMSP430CodePrinterPass(Out, *this, Fast, Verbose));
62 return false;
63}