Added getTargetLowering() to TargetMachine. Refactored targets to support this.
[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 IntrinsicLowering;
27 class GlobalValue;
28 class IntrinsicLowering;
29
30 class PPCTargetMachine : public TargetMachine {
31   PPCInstrInfo           InstrInfo;
32   PPCSubtarget           Subtarget;
33   PPCFrameInfo           FrameInfo;
34   PPCJITInfo             JITInfo;
35   PPCTargetLowering      TLInfo;
36   InstrItineraryData     InstrItins;
37 public:
38   PPCTargetMachine(const Module &M, IntrinsicLowering *IL,
39                    const std::string &FS);
40
41   virtual const PPCInstrInfo     *getInstrInfo() const { return &InstrInfo; }
42   virtual const TargetFrameInfo  *getFrameInfo() const { return &FrameInfo; }
43   virtual       TargetJITInfo    *getJITInfo()         { return &JITInfo; }
44   virtual const TargetSubtarget  *getSubtargetImpl() const{ return &Subtarget; }
45   virtual       PPCTargetLowering *getTargetLowering() { return &TLInfo; }
46   virtual const MRegisterInfo    *getRegisterInfo() const {
47     return &InstrInfo.getRegisterInfo();
48   }
49   virtual const InstrItineraryData getInstrItineraryData() const {  
50     return InstrItins;
51   }
52   
53
54   static unsigned getJITMatchQuality();
55
56   static unsigned getModuleMatchQuality(const Module &M);
57   
58   virtual bool addPassesToEmitFile(PassManager &PM, std::ostream &Out,
59                                    CodeGenFileType FileType, bool Fast);
60   
61   bool addPassesToEmitMachineCode(FunctionPassManager &PM,
62                                   MachineCodeEmitter &MCE);
63 };
64   
65 } // end namespace llvm
66
67 #endif