Remove a couple of already-implemented notes.
[oota-llvm.git] / lib / Target / PIC16 / PIC16TargetMachine.cpp
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.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #include "PIC16.h"
15 #include "PIC16TargetAsmInfo.h"
16 #include "PIC16TargetMachine.h"
17 #include "llvm/Module.h"
18 #include "llvm/PassManager.h"
19 #include "llvm/CodeGen/Passes.h"
20 #include "llvm/Target/TargetAsmInfo.h"
21 #include "llvm/Target/TargetMachineRegistry.h"
22
23 using namespace llvm;
24
25 // Register the targets
26 static RegisterTarget<PIC16TargetMachine> 
27 X(ThePIC16Target, "pic16", "PIC16 14-bit [experimental].");
28
29 static RegisterTarget<CooperTargetMachine> 
30 Y(TheCooperTarget, "cooper", "PIC16 Cooper [experimental].");
31
32 // Force static initialization.
33 extern "C" void LLVMInitializePIC16Target() { 
34   TargetRegistry::RegisterAsmPrinter(ThePIC16Target,
35                                      &createPIC16CodePrinterPass);
36   TargetRegistry::RegisterAsmPrinter(TheCooperTarget,
37                                      &createPIC16CodePrinterPass);
38 }
39
40 // PIC16TargetMachine - Traditional PIC16 Machine.
41 PIC16TargetMachine::PIC16TargetMachine(const Target &T, const Module &M, 
42                                        const std::string &FS, bool Cooper)
43 : LLVMTargetMachine(T),
44   Subtarget(M, FS, Cooper),
45   DataLayout("e-p:16:8:8-i8:8:8-i16:8:8-i32:8:8"), 
46   InstrInfo(*this), TLInfo(*this),
47   FrameInfo(TargetFrameInfo::StackGrowsUp, 8, 0) { }
48
49 // CooperTargetMachine - Uses the same PIC16TargetMachine, but makes IsCooper
50 // as true.
51 CooperTargetMachine::CooperTargetMachine(const Target &T, const Module &M, 
52                                          const std::string &FS)
53   : PIC16TargetMachine(T, M, FS, true) {}
54
55
56 const TargetAsmInfo *PIC16TargetMachine::createTargetAsmInfo() const {
57   return new PIC16TargetAsmInfo(*this);
58 }
59
60 bool PIC16TargetMachine::addInstSelector(PassManagerBase &PM,
61                                          CodeGenOpt::Level OptLevel) {
62   // Install an instruction selector.
63   PM.add(createPIC16ISelDag(*this));
64   return false;
65 }
66
67 bool PIC16TargetMachine::addPostRegAlloc(PassManagerBase &PM, 
68                                          CodeGenOpt::Level OptLevel) {
69   PM.add(createPIC16MemSelOptimizerPass());
70   return true;  // -print-machineinstr should print after this.
71 }
72
73