f26c85bd739272e655975bc56d62625fa0ba16ab
[oota-llvm.git] / lib / Target / Skeleton / SkeletonTargetMachine.cpp
1 //===-- SkeletonTargetMachine.cpp - Define TargetMachine for Skeleton -----===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 //
11 //===----------------------------------------------------------------------===//
12
13 #include "SkeletonTargetMachine.h"
14 #include "Skeleton.h"
15 #include "llvm/Module.h"
16 #include "llvm/PassManager.h"
17 #include "llvm/Target/TargetOptions.h"
18 #include "llvm/Target/TargetMachineRegistry.h"
19 #include "llvm/CodeGen/MachineFunction.h"
20 #include "llvm/CodeGen/Passes.h"
21 using namespace llvm;
22
23 namespace {
24   // Register the target.
25   RegisterTarget<SkeletonTargetMachine> X("skeleton",
26                                           "  Target Skeleton (unusable)");
27 }
28
29 /// SkeletonTargetMachine ctor - Create an ILP32 architecture model
30 ///
31 SkeletonTargetMachine::SkeletonTargetMachine(const Module &M,
32                                            IntrinsicLowering *IL)
33   : TargetMachine("Skeleton", IL, true, 4, 4, 4, 4, 4),
34     FrameInfo(TargetFrameInfo::StackGrowsDown, 8, -4), JITInfo(*this) {
35 }
36
37 /// addPassesToEmitAssembly - Add passes to the specified pass manager
38 /// to implement a static compiler for this target.
39 ///
40 bool SkeletonTargetMachine::addPassesToEmitAssembly(PassManager &PM,
41                                                std::ostream &Out) {
42   // <insert instruction selector passes here>
43   PM.add(createRegisterAllocator());
44   PM.add(createPrologEpilogCodeInserter());
45   // <insert assembly code output passes here>
46   PM.add(createMachineCodeDeleter());
47   return true; // change to `return false' when this actually works.
48 }
49
50 /// addPassesToJITCompile - Add passes to the specified pass manager to
51 /// implement a fast dynamic compiler for this target.
52 ///
53 void SkeletonJITInfo::addPassesToJITCompile(FunctionPassManager &PM) {
54   // <insert instruction selector passes here>
55   PM.add(createRegisterAllocator());
56   PM.add(createPrologEpilogCodeInserter());
57 }
58