this is failing on linux hosts, force a triple.
[llvm/avr.git] / lib / Target / PIC16 / PIC16TargetMachine.cpp
blob08307e7cef3f31df2c4cc35cd2a728c208ad63b7
1 //===-- PIC16TargetMachine.cpp - Define TargetMachine for PIC16 -----------===//
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 PIC16 target.
12 //===----------------------------------------------------------------------===//
14 #include "PIC16.h"
15 #include "PIC16MCAsmInfo.h"
16 #include "PIC16TargetMachine.h"
17 #include "llvm/PassManager.h"
18 #include "llvm/CodeGen/Passes.h"
19 #include "llvm/Target/TargetRegistry.h"
21 using namespace llvm;
23 extern "C" void LLVMInitializePIC16Target() {
24 // Register the target. Curretnly the codegen works for
25 // enhanced pic16 mid-range.
26 RegisterTargetMachine<PIC16TargetMachine> X(ThePIC16Target);
27 RegisterAsmInfo<PIC16MCAsmInfo> A(ThePIC16Target);
31 // PIC16TargetMachine - Enhanced PIC16 mid-range Machine. May also represent
32 // a Traditional Machine if 'Trad' is true.
33 PIC16TargetMachine::PIC16TargetMachine(const Target &T, const std::string &TT,
34 const std::string &FS, bool Trad)
35 : LLVMTargetMachine(T, TT),
36 Subtarget(TT, FS, Trad),
37 DataLayout("e-p:16:8:8-i8:8:8-i16:8:8-i32:8:8"),
38 InstrInfo(*this), TLInfo(*this),
39 FrameInfo(TargetFrameInfo::StackGrowsUp, 8, 0) { }
42 bool PIC16TargetMachine::addInstSelector(PassManagerBase &PM,
43 CodeGenOpt::Level OptLevel) {
44 // Install an instruction selector.
45 PM.add(createPIC16ISelDag(*this));
46 return false;
49 bool PIC16TargetMachine::addPreEmitPass(PassManagerBase &PM,
50 CodeGenOpt::Level OptLevel) {
51 PM.add(createPIC16MemSelOptimizerPass());
52 return true; // -print-machineinstr should print after this.