LLVM API Documentation
00001 //===-- SkeletonTargetMachine.cpp - Define TargetMachine for Skeleton -----===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file was developed by the LLVM research group and is distributed under 00006 // the University of Illinois Open Source License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // 00011 //===----------------------------------------------------------------------===// 00012 00013 #include "SkeletonTargetMachine.h" 00014 #include "Skeleton.h" 00015 #include "llvm/Module.h" 00016 #include "llvm/PassManager.h" 00017 #include "llvm/Target/TargetOptions.h" 00018 #include "llvm/Target/TargetMachineRegistry.h" 00019 #include "llvm/CodeGen/MachineFunction.h" 00020 #include "llvm/CodeGen/Passes.h" 00021 using namespace llvm; 00022 00023 namespace { 00024 // Register the target. 00025 RegisterTarget<SkeletonTargetMachine> X("skeleton", 00026 " Target Skeleton (unusable)"); 00027 } 00028 00029 /// SkeletonTargetMachine ctor - Create an ILP32 architecture model 00030 /// 00031 SkeletonTargetMachine::SkeletonTargetMachine(const Module &M, 00032 IntrinsicLowering *IL) 00033 : TargetMachine("Skeleton", IL, true, 4, 4, 4, 4, 4), 00034 FrameInfo(TargetFrameInfo::StackGrowsDown, 8, -4), JITInfo(*this) { 00035 } 00036 00037 /// addPassesToEmitAssembly - Add passes to the specified pass manager 00038 /// to implement a static compiler for this target. 00039 /// 00040 bool SkeletonTargetMachine::addPassesToEmitAssembly(PassManager &PM, 00041 std::ostream &Out) { 00042 // <insert instruction selector passes here> 00043 PM.add(createRegisterAllocator()); 00044 PM.add(createPrologEpilogCodeInserter()); 00045 // <insert assembly code output passes here> 00046 PM.add(createMachineCodeDeleter()); 00047 return true; // change to `return false' when this actually works. 00048 } 00049 00050 /// addPassesToJITCompile - Add passes to the specified pass manager to 00051 /// implement a fast dynamic compiler for this target. 00052 /// 00053 void SkeletonJITInfo::addPassesToJITCompile(FunctionPassManager &PM) { 00054 // <insert instruction selector passes here> 00055 PM.add(createRegisterAllocator()); 00056 PM.add(createPrologEpilogCodeInserter()); 00057 } 00058