* Codegen of GEPs dramatically improved by folding multiplies and adds
[oota-llvm.git] / lib / Target / PowerPC / PowerPCTargetMachine.h
1 //===-- PowerPCTargetMachine.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 POWERPCTARGETMACHINE_H
15 #define POWERPCTARGETMACHINE_H
16
17 #include "llvm/Target/TargetMachine.h"
18 #include "llvm/Target/TargetFrameInfo.h"
19 #include "llvm/PassManager.h"
20 #include "PowerPCInstrInfo.h"
21 #include "PowerPCJITInfo.h"
22 #include <set>
23
24 namespace llvm {
25
26 class GlobalValue;
27 class IntrinsicLowering;
28
29 class PowerPCTargetMachine : public TargetMachine {
30   PowerPCInstrInfo InstrInfo;
31   TargetFrameInfo FrameInfo;
32   PowerPCJITInfo JITInfo;
33
34 public:
35   PowerPCTargetMachine(const Module &M, IntrinsicLowering *IL);
36
37   virtual const PowerPCInstrInfo *getInstrInfo() const { return &InstrInfo; }
38   virtual const TargetFrameInfo  *getFrameInfo() const { return &FrameInfo; }
39   virtual const MRegisterInfo *getRegisterInfo() const {
40     return &InstrInfo.getRegisterInfo();
41   }
42   virtual TargetJITInfo *getJITInfo() {
43     return &JITInfo;
44   }
45
46   /// addPassesToEmitMachineCode - Add passes to the specified pass manager to
47   /// get machine code emitted.  This uses a MachineCodeEmitter object to handle
48   /// actually outputting the machine code and resolving things like the address
49   /// of functions.  This method should returns true if machine code emission is
50   /// not supported.
51   ///
52   virtual bool addPassesToEmitMachineCode(FunctionPassManager &PM,
53                                           MachineCodeEmitter &MCE);
54   
55   virtual bool addPassesToEmitAssembly(PassManager &PM, std::ostream &Out);
56
57   static unsigned getModuleMatchQuality(const Module &M);
58   static unsigned getJITMatchQuality();
59
60   // Two shared sets between the instruction selector and the printer allow for
61   // correct linkage on Darwin
62   std::set<GlobalValue*> CalledFunctions;
63   std::set<GlobalValue*> AddressTaken;
64 };
65
66 } // end namespace llvm
67
68 #endif