blob: 8b7a8db30033c24d661d9570c130a456d864a84c [file] [log] [blame]
Chris Lattner5ad021c2004-07-16 07:11:15 +00001//===-- SkeletonTargetMachine.cpp - Define TargetMachine for Skeleton -----===//
Misha Brukmanb5f662f2005-04-21 23:30:14 +00002//
Chris Lattner5ad021c2004-07-16 07:11:15 +00003// 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.
Misha Brukmanb5f662f2005-04-21 23:30:14 +00007//
Chris Lattner5ad021c2004-07-16 07:11:15 +00008//===----------------------------------------------------------------------===//
Misha Brukmanb5f662f2005-04-21 23:30:14 +00009//
Chris Lattner5ad021c2004-07-16 07:11:15 +000010//
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"
21using namespace llvm;
22
23namespace {
24 // Register the target.
25 RegisterTarget<SkeletonTargetMachine> X("skeleton",
26 " Target Skeleton (unusable)");
27}
28
29/// SkeletonTargetMachine ctor - Create an ILP32 architecture model
30///
31SkeletonTargetMachine::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
Chris Lattner0431c962005-06-25 02:48:37 +000037/// addPassesToEmitFile - Add passes to the specified pass manager
Chris Lattner5ad021c2004-07-16 07:11:15 +000038/// to implement a static compiler for this target.
39///
Chris Lattner0431c962005-06-25 02:48:37 +000040bool SkeletonTargetMachine::addPassesToEmitFile(PassManager &PM,
41 std::ostream &Out,
42 CodeGenFileType FileType) {
43 if (FileType != TargetMachine::AssemblyFile) return true;
Chris Lattner5ad021c2004-07-16 07:11:15 +000044 // <insert instruction selector passes here>
45 PM.add(createRegisterAllocator());
46 PM.add(createPrologEpilogCodeInserter());
47 // <insert assembly code output passes here>
48 PM.add(createMachineCodeDeleter());
49 return true; // change to `return false' when this actually works.
50}
51
52/// addPassesToJITCompile - Add passes to the specified pass manager to
53/// implement a fast dynamic compiler for this target.
54///
55void SkeletonJITInfo::addPassesToJITCompile(FunctionPassManager &PM) {
56 // <insert instruction selector passes here>
57 PM.add(createRegisterAllocator());
58 PM.add(createPrologEpilogCodeInserter());
59}
60