LLVM API Documentation
00001 //===-- PIC16TargetMachine.cpp - Define TargetMachine for PIC16 -----------===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file is distributed under the University of Illinois Open Source 00006 // License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // Top-level implementation for the PIC16 target. 00011 // 00012 //===----------------------------------------------------------------------===// 00013 00014 #include "PIC16.h" 00015 #include "PIC16TargetAsmInfo.h" 00016 #include "PIC16TargetMachine.h" 00017 #include "llvm/Module.h" 00018 #include "llvm/PassManager.h" 00019 #include "llvm/CodeGen/Passes.h" 00020 #include "llvm/Target/TargetAsmInfo.h" 00021 #include "llvm/Target/TargetMachineRegistry.h" 00022 00023 using namespace llvm; 00024 00025 /// PIC16TargetMachineModule - Note that this is used on hosts that 00026 /// cannot link in a library unless there are references into the 00027 /// library. In particular, it seems that it is not possible to get 00028 /// things to work on Win32 without this. Though it is unused, do not 00029 /// remove it. 00030 extern "C" int PIC16TargetMachineModule; 00031 int PIC16TargetMachineModule = 0; 00032 00033 00034 // Register the targets 00035 static RegisterTarget<PIC16TargetMachine> 00036 X("pic16", "PIC16 14-bit [experimental]."); 00037 static RegisterTarget<CooperTargetMachine> 00038 Y("cooper", "PIC16 Cooper [experimental]."); 00039 00040 // PIC16TargetMachine - Traditional PIC16 Machine. 00041 PIC16TargetMachine::PIC16TargetMachine(const Module &M, const std::string &FS, 00042 bool Cooper) 00043 : Subtarget(M, FS, Cooper), 00044 DataLayout("e-p:16:8:8-i8:8:8-i16:8:8-i32:8:8"), 00045 InstrInfo(*this), TLInfo(*this), 00046 FrameInfo(TargetFrameInfo::StackGrowsUp, 8, 0) { } 00047 00048 // CooperTargetMachine - Uses the same PIC16TargetMachine, but makes IsCooper 00049 // as true. 00050 CooperTargetMachine::CooperTargetMachine(const Module &M, const std::string &FS) 00051 : PIC16TargetMachine(M, FS, true) {} 00052 00053 00054 const TargetAsmInfo *PIC16TargetMachine::createTargetAsmInfo() const { 00055 return new PIC16TargetAsmInfo(*this); 00056 } 00057 00058 bool PIC16TargetMachine::addInstSelector(PassManagerBase &PM, bool Fast) { 00059 // Install an instruction selector. 00060 PM.add(createPIC16ISelDag(*this)); 00061 return false; 00062 } 00063 00064 bool PIC16TargetMachine:: 00065 addAssemblyEmitter(PassManagerBase &PM, bool Fast, raw_ostream &Out) { 00066 // Output assembly language. 00067 PM.add(createPIC16CodePrinterPass(Out, *this)); 00068 return false; 00069 } 00070 00071
This web site is hosted by the Computer Science Department at the University of Illinois at Urbana-Champaign.