2009-05-03 20:57:15 +08: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"
|
|
|
|
#include "MSP430TargetAsmInfo.h"
|
|
|
|
#include "MSP430TargetMachine.h"
|
|
|
|
#include "llvm/Module.h"
|
|
|
|
#include "llvm/PassManager.h"
|
|
|
|
#include "llvm/CodeGen/Passes.h"
|
|
|
|
#include "llvm/Target/TargetAsmInfo.h"
|
|
|
|
using namespace llvm;
|
|
|
|
|
2009-07-16 04:24:03 +08:00
|
|
|
MSP430TargetMachine::MSP430TargetMachine(const Target &T,
|
|
|
|
const Module &M,
|
2009-05-03 20:57:15 +08:00
|
|
|
const std::string &FS) :
|
2009-07-16 04:24:03 +08:00
|
|
|
LLVMTargetMachine(T),
|
2009-05-03 20:57:15 +08:00
|
|
|
Subtarget(*this, M, FS),
|
2009-05-03 20:58:05 +08:00
|
|
|
// FIXME: Check TargetData string.
|
2009-05-03 20:57:15 +08:00
|
|
|
DataLayout("e-p:16:8:8-i8:8:8-i16:8:8-i32:8:8"),
|
|
|
|
InstrInfo(*this), TLInfo(*this),
|
2009-05-03 21:11:20 +08:00
|
|
|
FrameInfo(TargetFrameInfo::StackGrowsDown, 2, -2) { }
|
2009-05-03 20:57:15 +08:00
|
|
|
|
|
|
|
const TargetAsmInfo *MSP430TargetMachine::createTargetAsmInfo() const {
|
|
|
|
return new MSP430TargetAsmInfo(*this);
|
|
|
|
}
|
|
|
|
|
2009-05-03 21:19:42 +08:00
|
|
|
bool MSP430TargetMachine::addInstSelector(PassManagerBase &PM,
|
|
|
|
CodeGenOpt::Level OptLevel) {
|
2009-05-03 20:57:15 +08:00
|
|
|
// Install an instruction selector.
|
2009-05-03 21:19:42 +08:00
|
|
|
PM.add(createMSP430ISelDag(*this, OptLevel));
|
2009-05-03 20:57:15 +08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|