Create the specified TargetObjInfo and use it.
[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 #include "llvm/Target/TargetData.h"
24
25 namespace llvm {
26 class PassManager;
27 class GlobalValue;
28
29 /// PPCTargetMachine - Common code between 32-bit and 64-bit PowerPC targets.
30 ///
31 class PPCTargetMachine : public LLVMTargetMachine {
32   PPCSubtarget        Subtarget;
33   const TargetData    DataLayout;       // Calculates type size & alignment
34   PPCInstrInfo        InstrInfo;
35   PPCFrameInfo        FrameInfo;
36   PPCJITInfo          JITInfo;
37   PPCTargetLowering   TLInfo;
38   InstrItineraryData  InstrItins;
39   
40 protected:
41   virtual const TargetAsmInfo *createTargetAsmInfo() const;
42   virtual const TargetObjInfo *createTargetObjInfo() const;
43   
44 public:
45   PPCTargetMachine(const Module &M, const std::string &FS, bool is64Bit);
46
47   virtual const PPCInstrInfo     *getInstrInfo() const { return &InstrInfo; }
48   virtual const TargetFrameInfo  *getFrameInfo() const { return &FrameInfo; }
49   virtual       TargetJITInfo    *getJITInfo()         { return &JITInfo; }
50   virtual       PPCTargetLowering *getTargetLowering() const { 
51    return const_cast<PPCTargetLowering*>(&TLInfo); 
52   }
53   virtual const MRegisterInfo    *getRegisterInfo() const {
54     return &InstrInfo.getRegisterInfo();
55   }
56   
57   virtual const TargetData    *getTargetData() const    { return &DataLayout; }
58   virtual const PPCSubtarget  *getSubtargetImpl() const { return &Subtarget; }
59   virtual const InstrItineraryData getInstrItineraryData() const {  
60     return InstrItins;
61   }
62   
63   // Pass Pipeline Configuration
64   virtual bool addInstSelector(FunctionPassManager &PM, bool Fast);
65   virtual bool addPreEmitPass(FunctionPassManager &PM, bool Fast);
66   virtual bool addAssemblyEmitter(FunctionPassManager &PM, bool Fast, 
67                                   std::ostream &Out);
68   virtual bool addObjectWriter(FunctionPassManager &PM, bool Fast,
69                                std::ostream &Out);
70   virtual bool addCodeEmitter(FunctionPassManager &PM, bool Fast,
71                               MachineCodeEmitter &MCE);
72 };
73
74 /// PPC32TargetMachine - PowerPC 32-bit target machine.
75 ///
76 class PPC32TargetMachine : public PPCTargetMachine {
77 public:
78   PPC32TargetMachine(const Module &M, const std::string &FS);
79   
80   static unsigned getJITMatchQuality();
81   static unsigned getModuleMatchQuality(const Module &M);
82 };
83
84 /// PPC64TargetMachine - PowerPC 64-bit target machine.
85 ///
86 class PPC64TargetMachine : public PPCTargetMachine {
87 public:
88   PPC64TargetMachine(const Module &M, const std::string &FS);
89   
90   static unsigned getJITMatchQuality();
91   static unsigned getModuleMatchQuality(const Module &M);
92 };
93
94 } // end namespace llvm
95
96 #endif