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"
|
|
|
|
#include "PIC16TargetAsmInfo.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"
|
2008-05-13 09:02:57 +00:00
|
|
|
#include "llvm/Target/TargetAsmInfo.h"
|
|
|
|
|
|
|
|
using namespace llvm;
|
|
|
|
|
2008-11-19 11:00:54 +00:00
|
|
|
// PIC16TargetMachine - Traditional PIC16 Machine.
|
2009-08-02 23:37:13 +00:00
|
|
|
PIC16TargetMachine::PIC16TargetMachine(const Target &T, const std::string &TT,
|
2009-07-15 20:24:03 +00:00
|
|
|
const std::string &FS, bool Cooper)
|
2009-08-11 20:42:37 +00:00
|
|
|
: LLVMTargetMachine(T, TT),
|
2009-08-02 23:37:13 +00:00
|
|
|
Subtarget(TT, FS, Cooper),
|
2008-11-19 11:00:54 +00:00
|
|
|
DataLayout("e-p:16:8:8-i8:8:8-i16:8:8-i32:8:8"),
|
2008-05-13 09:02:57 +00:00
|
|
|
InstrInfo(*this), TLInfo(*this),
|
|
|
|
FrameInfo(TargetFrameInfo::StackGrowsUp, 8, 0) { }
|
|
|
|
|
2008-11-19 11:00:54 +00:00
|
|
|
// CooperTargetMachine - Uses the same PIC16TargetMachine, but makes IsCooper
|
|
|
|
// as true.
|
2009-08-02 23:37:13 +00:00
|
|
|
CooperTargetMachine::CooperTargetMachine(const Target &T, const std::string &TT,
|
2009-07-15 20:24:03 +00:00
|
|
|
const std::string &FS)
|
2009-08-02 23:37:13 +00:00
|
|
|
: PIC16TargetMachine(T, TT, FS, true) {}
|
2008-05-13 09:02:57 +00:00
|
|
|
|
2008-11-19 11:00:54 +00:00
|
|
|
|
|
|
|
const TargetAsmInfo *PIC16TargetMachine::createTargetAsmInfo() const {
|
2009-08-02 04:41:14 +00:00
|
|
|
return new PIC16TargetAsmInfo();
|
2008-05-13 09:02:57 +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
|
|
|
|