blob: 2be0afb723a21f499aabab6cf9a74d2cf7bfcef9 [file] [log] [blame]
Sanjiv Gupta0e687712008-05-13 09:02:57 +00001//===-- 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 "PIC16TargetMachine.h"
16#include "PIC16TargetAsmInfo.h"
17#include "llvm/Module.h"
18#include "llvm/PassManager.h"
19#include "llvm/Target/TargetMachineRegistry.h"
20#include "llvm/Target/TargetAsmInfo.h"
21
22using namespace llvm;
23
24namespace {
25 // Register the targets
26 RegisterTarget<PIC16TargetMachine> X("pic16", " PIC16 14-bit");
27}
28
29PIC16TargetMachine::
30PIC16TargetMachine(const Module &M, const std::string &FS) :
31 Subtarget(*this, M, FS), DataLayout("e-p:16:8:8-i8:8:8-i16:8:8-i32:8:8"),
32 InstrInfo(*this), TLInfo(*this),
33 FrameInfo(TargetFrameInfo::StackGrowsUp, 8, 0) { }
34
35
36const TargetAsmInfo *PIC16TargetMachine::
37createTargetAsmInfo() const
38{
39 return new PIC16TargetAsmInfo(*this);
40}
41
42//===----------------------------------------------------------------------===//
43// Pass Pipeline Configuration
44//===----------------------------------------------------------------------===//
45
46bool PIC16TargetMachine::
47addInstSelector(PassManagerBase &PM, bool Fast)
48{
49 // Install an instruction selector.
50 PM.add(createPIC16ISelDag(*this));
51 return false;
52}
53
54bool PIC16TargetMachine::
55addPrologEpilogInserter(PassManagerBase &PM, bool Fast)
56{
57 return false;
58}
59
60bool PIC16TargetMachine:: addPreEmitPass(PassManagerBase &PM, bool Fast)
61{
62 return true;
63}
64
65bool PIC16TargetMachine::
66addAssemblyEmitter(PassManagerBase &PM, bool Fast, std::ostream &Out)
67{
68 // Output assembly language.
69 PM.add(createPIC16CodePrinterPass(Out, *this));
70 return false;
71}
72