1 //===-- ARMTargetMachine.h - Define TargetMachine for ARM -------*- 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 ARM specific subclass of TargetMachine.
12 //===----------------------------------------------------------------------===//
14 #ifndef ARMTARGETMACHINE_H
15 #define ARMTARGETMACHINE_H
17 #include "ARMFrameLowering.h"
18 #include "ARMISelLowering.h"
19 #include "ARMInstrInfo.h"
20 #include "ARMJITInfo.h"
21 #include "ARMSelectionDAGInfo.h"
22 #include "ARMSubtarget.h"
23 #include "Thumb1FrameLowering.h"
24 #include "Thumb1InstrInfo.h"
25 #include "Thumb2InstrInfo.h"
26 #include "llvm/ADT/OwningPtr.h"
27 #include "llvm/DataLayout.h"
28 #include "llvm/MC/MCStreamer.h"
29 #include "llvm/Target/TargetMachine.h"
30 #include "llvm/Target/TargetTransformImpl.h"
34 class ARMBaseTargetMachine : public LLVMTargetMachine {
36 ARMSubtarget Subtarget;
39 InstrItineraryData InstrItins;
42 ARMBaseTargetMachine(const Target &T, StringRef TT,
43 StringRef CPU, StringRef FS,
44 const TargetOptions &Options,
45 Reloc::Model RM, CodeModel::Model CM,
46 CodeGenOpt::Level OL);
48 virtual ARMJITInfo *getJITInfo() { return &JITInfo; }
49 virtual const ARMSubtarget *getSubtargetImpl() const { return &Subtarget; }
50 virtual const InstrItineraryData *getInstrItineraryData() const {
54 // Pass Pipeline Configuration
55 virtual TargetPassConfig *createPassConfig(PassManagerBase &PM);
57 virtual bool addCodeEmitter(PassManagerBase &PM, JITCodeEmitter &MCE);
60 /// ARMTargetMachine - ARM target machine.
62 class ARMTargetMachine : public ARMBaseTargetMachine {
63 virtual void anchor();
64 ARMInstrInfo InstrInfo;
65 const DataLayout DL; // Calculates type size & alignment
66 ARMTargetLowering TLInfo;
67 ARMSelectionDAGInfo TSInfo;
68 ARMFrameLowering FrameLowering;
69 ARMScalarTargetTransformImpl STTI;
70 VectorTargetTransformImpl VTTI;
72 ARMTargetMachine(const Target &T, StringRef TT,
73 StringRef CPU, StringRef FS,
74 const TargetOptions &Options,
75 Reloc::Model RM, CodeModel::Model CM,
76 CodeGenOpt::Level OL);
78 virtual const ARMRegisterInfo *getRegisterInfo() const {
79 return &InstrInfo.getRegisterInfo();
82 virtual const ARMTargetLowering *getTargetLowering() const {
86 virtual const ARMSelectionDAGInfo* getSelectionDAGInfo() const {
89 virtual const ARMFrameLowering *getFrameLowering() const {
90 return &FrameLowering;
92 virtual const ScalarTargetTransformInfo *getScalarTargetTransformInfo()const {
95 virtual const VectorTargetTransformInfo *getVectorTargetTransformInfo()const {
98 virtual const ARMInstrInfo *getInstrInfo() const { return &InstrInfo; }
99 virtual const DataLayout *getDataLayout() const { return &DL; }
102 /// ThumbTargetMachine - Thumb target machine.
103 /// Due to the way architectures are handled, this represents both
104 /// Thumb-1 and Thumb-2.
106 class ThumbTargetMachine : public ARMBaseTargetMachine {
107 virtual void anchor();
108 // Either Thumb1InstrInfo or Thumb2InstrInfo.
109 OwningPtr<ARMBaseInstrInfo> InstrInfo;
110 const DataLayout DL; // Calculates type size & alignment
111 ARMTargetLowering TLInfo;
112 ARMSelectionDAGInfo TSInfo;
113 // Either Thumb1FrameLowering or ARMFrameLowering.
114 OwningPtr<ARMFrameLowering> FrameLowering;
115 ARMScalarTargetTransformImpl STTI;
116 VectorTargetTransformImpl VTTI;
118 ThumbTargetMachine(const Target &T, StringRef TT,
119 StringRef CPU, StringRef FS,
120 const TargetOptions &Options,
121 Reloc::Model RM, CodeModel::Model CM,
122 CodeGenOpt::Level OL);
124 /// returns either Thumb1RegisterInfo or Thumb2RegisterInfo
125 virtual const ARMBaseRegisterInfo *getRegisterInfo() const {
126 return &InstrInfo->getRegisterInfo();
129 virtual const ARMTargetLowering *getTargetLowering() const {
133 virtual const ARMSelectionDAGInfo *getSelectionDAGInfo() const {
137 /// returns either Thumb1InstrInfo or Thumb2InstrInfo
138 virtual const ARMBaseInstrInfo *getInstrInfo() const {
139 return InstrInfo.get();
141 /// returns either Thumb1FrameLowering or ARMFrameLowering
142 virtual const ARMFrameLowering *getFrameLowering() const {
143 return FrameLowering.get();
145 virtual const ScalarTargetTransformInfo *getScalarTargetTransformInfo()const {
148 virtual const VectorTargetTransformInfo *getVectorTargetTransformInfo()const {
151 virtual const DataLayout *getDataLayout() const { return &DL; }
154 } // end namespace llvm