blob: 7b3814b9e008122828b99dd3a84a424688cd8e62 [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"
Sanjiv Gupta0e687712008-05-13 09:02:57 +000015#include "PIC16TargetAsmInfo.h"
Sanjiv Gupta2010b3e2008-05-14 11:31:39 +000016#include "PIC16TargetMachine.h"
Sanjiv Gupta0e687712008-05-13 09:02:57 +000017#include "llvm/Module.h"
18#include "llvm/PassManager.h"
Sanjiv Gupta0e687712008-05-13 09:02:57 +000019#include "llvm/Target/TargetAsmInfo.h"
Sanjiv Gupta2010b3e2008-05-14 11:31:39 +000020#include "llvm/Target/TargetMachineRegistry.h"
Sanjiv Gupta0e687712008-05-13 09:02:57 +000021
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
Sanjiv Gupta2010b3e2008-05-14 11:31:39 +000036const TargetAsmInfo *PIC16TargetMachine::createTargetAsmInfo() const
Sanjiv Gupta0e687712008-05-13 09:02:57 +000037{
38 return new PIC16TargetAsmInfo(*this);
39}
40
41//===----------------------------------------------------------------------===//
42// Pass Pipeline Configuration
43//===----------------------------------------------------------------------===//
44
Sanjiv Gupta2010b3e2008-05-14 11:31:39 +000045bool PIC16TargetMachine::addInstSelector(PassManagerBase &PM, bool Fast)
Sanjiv Gupta0e687712008-05-13 09:02:57 +000046{
47 // Install an instruction selector.
48 PM.add(createPIC16ISelDag(*this));
49 return false;
50}
51
52bool PIC16TargetMachine::
53addPrologEpilogInserter(PassManagerBase &PM, bool Fast)
54{
55 return false;
56}
57
Sanjiv Gupta2010b3e2008-05-14 11:31:39 +000058bool PIC16TargetMachine::addPreEmitPass(PassManagerBase &PM, bool Fast)
Sanjiv Gupta0e687712008-05-13 09:02:57 +000059{
60 return true;
61}
62
63bool PIC16TargetMachine::
64addAssemblyEmitter(PassManagerBase &PM, bool Fast, std::ostream &Out)
65{
66 // Output assembly language.
67 PM.add(createPIC16CodePrinterPass(Out, *this));
68 return false;
69}
70