Refactor TargetMachine, pushing handling of TargetData into the target-specific subcl...
[oota-llvm.git] / lib / Target / PowerPC / PPCTargetMachine.h
1 //===-- PPCTargetMachine.h - Define TargetMachine for PowerPC -----*- C++ -*-=//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file declares the PowerPC specific subclass of TargetMachine.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef PPC_TARGETMACHINE_H
15 #define PPC_TARGETMACHINE_H
16
17 #include "PPCFrameInfo.h"
18 #include "PPCSubtarget.h"
19 #include "PPCJITInfo.h"
20 #include "PPCInstrInfo.h"
21 #include "PPCISelLowering.h"
22 #include "llvm/Target/TargetMachine.h"
23
24 namespace llvm {
25 class PassManager;
26 class GlobalValue;
27
28 class PPCTargetMachine : public TargetMachine {
29   const TargetData DataLayout;       // Calculates type size & alignment
30   PPCInstrInfo           InstrInfo;
31   PPCSubtarget           Subtarget;
32   PPCFrameInfo           FrameInfo;
33   PPCJITInfo             JITInfo;
34   PPCTargetLowering      TLInfo;
35   InstrItineraryData     InstrItins;
36 public:
37   PPCTargetMachine(const Module &M, const std::string &FS);
38
39   virtual const PPCInstrInfo     *getInstrInfo() const { return &InstrInfo; }
40   virtual const TargetFrameInfo  *getFrameInfo() const { return &FrameInfo; }
41   virtual       TargetJITInfo    *getJITInfo()         { return &JITInfo; }
42   virtual const TargetSubtarget  *getSubtargetImpl() const{ return &Subtarget; }
43   virtual       PPCTargetLowering *getTargetLowering() { return &TLInfo; }
44   virtual const MRegisterInfo    *getRegisterInfo() const {
45     return &InstrInfo.getRegisterInfo();
46   }
47   virtual const TargetData       *getTargetData() const { return &DataLayout; }
48   virtual const InstrItineraryData getInstrItineraryData() const {  
49     return InstrItins;
50   }
51   
52
53   static unsigned getJITMatchQuality();
54
55   static unsigned getModuleMatchQuality(const Module &M);
56   
57   virtual bool addPassesToEmitFile(PassManager &PM, std::ostream &Out,
58                                    CodeGenFileType FileType, bool Fast);
59   
60   bool addPassesToEmitMachineCode(FunctionPassManager &PM,
61                                   MachineCodeEmitter &MCE);
62 };
63   
64 } // end namespace llvm
65
66 #endif