Update comments.
[llvm/msp430.git] / lib / Target / PIC16 / PIC16TargetMachine.cpp
bloba8d92490e7b84423c34dc5b637c3cbba34c80b96
1 //===-- 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.
12 //===----------------------------------------------------------------------===//
14 #include "PIC16.h"
15 #include "PIC16TargetAsmInfo.h"
16 #include "PIC16TargetMachine.h"
17 #include "llvm/Module.h"
18 #include "llvm/PassManager.h"
19 #include "llvm/CodeGen/Passes.h"
20 #include "llvm/Target/TargetAsmInfo.h"
21 #include "llvm/Target/TargetMachineRegistry.h"
23 using namespace llvm;
25 /// PIC16TargetMachineModule - Note that this is used on hosts that
26 /// cannot link in a library unless there are references into the
27 /// library. In particular, it seems that it is not possible to get
28 /// things to work on Win32 without this. Though it is unused, do not
29 /// remove it.
30 extern "C" int PIC16TargetMachineModule;
31 int PIC16TargetMachineModule = 0;
34 // Register the targets
35 static RegisterTarget<PIC16TargetMachine>
36 X("pic16", "PIC16 14-bit [experimental].");
37 static RegisterTarget<CooperTargetMachine>
38 Y("cooper", "PIC16 Cooper [experimental].");
40 // PIC16TargetMachine - Traditional PIC16 Machine.
41 PIC16TargetMachine::PIC16TargetMachine(const Module &M, const std::string &FS,
42 bool Cooper)
43 : Subtarget(M, FS, Cooper),
44 DataLayout("e-p:16:8:8-i8:8:8-i16:8:8-i32:8:8"),
45 InstrInfo(*this), TLInfo(*this),
46 FrameInfo(TargetFrameInfo::StackGrowsUp, 8, 0) { }
48 // CooperTargetMachine - Uses the same PIC16TargetMachine, but makes IsCooper
49 // as true.
50 CooperTargetMachine::CooperTargetMachine(const Module &M, const std::string &FS)
51 : PIC16TargetMachine(M, FS, true) {}
54 const TargetAsmInfo *PIC16TargetMachine::createTargetAsmInfo() const {
55 return new PIC16TargetAsmInfo(*this);
58 bool PIC16TargetMachine::addInstSelector(PassManagerBase &PM, bool Fast) {
59 // Install an instruction selector.
60 PM.add(createPIC16ISelDag(*this));
61 return false;
64 bool PIC16TargetMachine::
65 addAssemblyEmitter(PassManagerBase &PM, bool Fast, bool Verbose,
66 raw_ostream &Out) {
67 // Output assembly language.
68 PM.add(createPIC16CodePrinterPass(Out, *this, Fast, Verbose));
69 return false;