1 //===-- PIC16TargetMachine.h - Define TargetMachine for PIC16 ---*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file declares the PIC16 specific subclass of TargetMachine.
12 //===----------------------------------------------------------------------===//
15 #ifndef PIC16_TARGETMACHINE_H
16 #define PIC16_TARGETMACHINE_H
18 #include "PIC16InstrInfo.h"
19 #include "PIC16ISelLowering.h"
20 #include "PIC16RegisterInfo.h"
21 #include "PIC16Subtarget.h"
22 #include "llvm/Target/TargetData.h"
23 #include "llvm/Target/TargetFrameInfo.h"
24 #include "llvm/Target/TargetMachine.h"
28 /// PIC16TargetMachine
30 class PIC16TargetMachine
: public LLVMTargetMachine
{
31 PIC16Subtarget Subtarget
;
32 const TargetData DataLayout
; // Calculates type size & alignment
33 PIC16InstrInfo InstrInfo
;
34 PIC16TargetLowering TLInfo
;
36 // PIC16 does not have any call stack frame, therefore not having
37 // any PIC16 specific FrameInfo class.
38 TargetFrameInfo FrameInfo
;
41 virtual const TargetAsmInfo
*createTargetAsmInfo() const;
44 PIC16TargetMachine(const Module
&M
, const std::string
&FS
,
47 virtual const TargetFrameInfo
*getFrameInfo() const { return &FrameInfo
; }
48 virtual const PIC16InstrInfo
*getInstrInfo() const { return &InstrInfo
; }
49 virtual const TargetData
*getTargetData() const { return &DataLayout
;}
50 virtual const PIC16Subtarget
*getSubtargetImpl() const { return &Subtarget
; }
52 virtual const PIC16RegisterInfo
*getRegisterInfo() const {
53 return &(InstrInfo
.getRegisterInfo());
56 virtual PIC16TargetLowering
*getTargetLowering() const {
57 return const_cast<PIC16TargetLowering
*>(&TLInfo
);
60 virtual bool addInstSelector(PassManagerBase
&PM
,
61 CodeGenOpt::Level OptLevel
);
62 virtual bool addAssemblyEmitter(PassManagerBase
&PM
,
63 CodeGenOpt::Level OptLevel
,
64 bool Verbose
, raw_ostream
&Out
);
65 virtual bool addPostRegAlloc(PassManagerBase
&PM
, CodeGenOpt::Level OptLevel
);
66 }; // PIC16TargetMachine.
68 /// CooperTargetMachine
69 class CooperTargetMachine
: public PIC16TargetMachine
{
71 CooperTargetMachine(const Module
&M
, const std::string
&FS
);
72 }; // CooperTargetMachine.
74 } // end namespace llvm