2008-05-13 09:02:57 +00:00
|
|
|
//===-- PIC16TargetMachine.cpp - Define TargetMachine for PIC16 -----------===//
|
|
|
|
//
|
|
|
|
// 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 PIC16 target.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
|
|
|
#include "PIC16.h"
|
2009-08-22 20:48:53 +00:00
|
|
|
#include "PIC16MCAsmInfo.h"
|
2008-05-14 11:31:39 +00:00
|
|
|
#include "PIC16TargetMachine.h"
|
2008-05-13 09:02:57 +00:00
|
|
|
#include "llvm/PassManager.h"
|
2008-11-19 11:00:54 +00:00
|
|
|
#include "llvm/CodeGen/Passes.h"
|
2009-08-13 17:08:54 +00:00
|
|
|
#include "llvm/Target/TargetRegistry.h"
|
2008-05-13 09:02:57 +00:00
|
|
|
|
|
|
|
using namespace llvm;
|
|
|
|
|
2009-08-13 17:08:54 +00:00
|
|
|
extern "C" void LLVMInitializePIC16Target() {
|
|
|
|
// Register the target. Curretnly the codegen works for
|
|
|
|
// enhanced pic16 mid-range.
|
|
|
|
RegisterTargetMachine<PIC16TargetMachine> X(ThePIC16Target);
|
2009-08-22 20:48:53 +00:00
|
|
|
RegisterAsmInfo<PIC16MCAsmInfo> A(ThePIC16Target);
|
2009-08-13 17:08:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// PIC16TargetMachine - Enhanced PIC16 mid-range Machine. May also represent
|
|
|
|
// a Traditional Machine if 'Trad' is true.
|
2009-08-02 23:37:13 +00:00
|
|
|
PIC16TargetMachine::PIC16TargetMachine(const Target &T, const std::string &TT,
|
2009-08-13 17:08:54 +00:00
|
|
|
const std::string &FS, bool Trad)
|
2009-08-11 20:42:37 +00:00
|
|
|
: LLVMTargetMachine(T, TT),
|
2009-08-13 17:08:54 +00:00
|
|
|
Subtarget(TT, FS, Trad),
|
2009-11-07 19:07:32 +00:00
|
|
|
DataLayout("e-p:16:8:8-i8:8:8-i16:8:8-i32:8:8-n8"),
|
2010-05-11 17:31:57 +00:00
|
|
|
InstrInfo(*this), TLInfo(*this), TSInfo(*this),
|
2008-05-13 09:02:57 +00:00
|
|
|
FrameInfo(TargetFrameInfo::StackGrowsUp, 8, 0) { }
|
|
|
|
|
2008-11-19 11:00:54 +00:00
|
|
|
|
2009-04-29 00:15:41 +00:00
|
|
|
bool PIC16TargetMachine::addInstSelector(PassManagerBase &PM,
|
2009-04-29 23:29:43 +00:00
|
|
|
CodeGenOpt::Level OptLevel) {
|
2008-05-13 09:02:57 +00:00
|
|
|
// Install an instruction selector.
|
|
|
|
PM.add(createPIC16ISelDag(*this));
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2009-08-07 05:44:27 +00:00
|
|
|
bool PIC16TargetMachine::addPreEmitPass(PassManagerBase &PM,
|
2009-05-06 08:02:01 +00:00
|
|
|
CodeGenOpt::Level OptLevel) {
|
|
|
|
PM.add(createPIC16MemSelOptimizerPass());
|
|
|
|
return true; // -print-machineinstr should print after this.
|
|
|
|
}
|
|
|
|
|
2008-11-19 11:00:54 +00:00
|
|
|
|