2009-05-03 12:57:15 +00:00
|
|
|
//===-- MSP430TargetMachine.cpp - Define TargetMachine for MSP430 ---------===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
//
|
|
|
|
// Top-level implementation for the MSP430 target.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "MSP430.h"
|
2009-08-22 20:48:53 +00:00
|
|
|
#include "MSP430MCAsmInfo.h"
|
2009-05-03 12:57:15 +00:00
|
|
|
#include "MSP430TargetMachine.h"
|
|
|
|
#include "llvm/PassManager.h"
|
|
|
|
#include "llvm/CodeGen/Passes.h"
|
2009-08-22 20:48:53 +00:00
|
|
|
#include "llvm/MC/MCAsmInfo.h"
|
2009-08-14 19:06:50 +00:00
|
|
|
#include "llvm/Target/TargetRegistry.h"
|
2009-05-03 12:57:15 +00:00
|
|
|
using namespace llvm;
|
|
|
|
|
2009-08-14 19:06:50 +00:00
|
|
|
extern "C" void LLVMInitializeMSP430Target() {
|
|
|
|
// Register the target.
|
|
|
|
RegisterTargetMachine<MSP430TargetMachine> X(TheMSP430Target);
|
2009-08-22 20:48:53 +00:00
|
|
|
RegisterAsmInfo<MSP430MCAsmInfo> Z(TheMSP430Target);
|
2009-08-14 19:06:50 +00:00
|
|
|
}
|
|
|
|
|
2009-07-15 20:24:03 +00:00
|
|
|
MSP430TargetMachine::MSP430TargetMachine(const Target &T,
|
2009-08-02 23:37:13 +00:00
|
|
|
const std::string &TT,
|
2009-05-03 12:57:15 +00:00
|
|
|
const std::string &FS) :
|
2009-08-11 20:42:37 +00:00
|
|
|
LLVMTargetMachine(T, TT),
|
2009-08-02 23:37:13 +00:00
|
|
|
Subtarget(TT, FS),
|
2009-05-03 12:58:05 +00:00
|
|
|
// FIXME: Check TargetData string.
|
2009-11-07 19:07:32 +00:00
|
|
|
DataLayout("e-p:16:16:16-i8:8:8-i16:16:16-i32:16:32-n8:16"),
|
2010-05-11 17:31:57 +00:00
|
|
|
InstrInfo(*this), TLInfo(*this), TSInfo(*this),
|
2009-05-03 13:11:20 +00:00
|
|
|
FrameInfo(TargetFrameInfo::StackGrowsDown, 2, -2) { }
|
2009-05-03 12:57:15 +00:00
|
|
|
|
|
|
|
|
2009-05-03 13:19:42 +00:00
|
|
|
bool MSP430TargetMachine::addInstSelector(PassManagerBase &PM,
|
|
|
|
CodeGenOpt::Level OptLevel) {
|
2009-05-03 12:57:15 +00:00
|
|
|
// Install an instruction selector.
|
2009-05-03 13:19:42 +00:00
|
|
|
PM.add(createMSP430ISelDag(*this, OptLevel));
|
2009-05-03 12:57:15 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2010-01-15 21:19:05 +00:00
|
|
|
bool MSP430TargetMachine::addPreEmitPass(PassManagerBase &PM,
|
|
|
|
CodeGenOpt::Level OptLevel) {
|
|
|
|
// Must run branch selection immediately preceding the asm printer.
|
|
|
|
PM.add(createMSP430BranchSelectionPass());
|
|
|
|
return false;
|
|
|
|
}
|