Misha Brukman | 5dfe3a9 | 2004-06-21 16:55:25 +0000 | [diff] [blame] | 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" |
Misha Brukman | e2eceb5 | 2004-07-23 16:08:20 +0000 | [diff] [blame] | 22 | #include <set> |
Misha Brukman | 5dfe3a9 | 2004-06-21 16:55:25 +0000 | [diff] [blame] | 23 | |
| 24 | namespace llvm { |
| 25 | |
Misha Brukman | e2eceb5 | 2004-07-23 16:08:20 +0000 | [diff] [blame] | 26 | class GlobalValue; |
Misha Brukman | 5dfe3a9 | 2004-06-21 16:55:25 +0000 | [diff] [blame] | 27 | class IntrinsicLowering; |
| 28 | |
| 29 | class PowerPCTargetMachine : public TargetMachine { |
| 30 | PowerPCInstrInfo InstrInfo; |
| 31 | TargetFrameInfo FrameInfo; |
| 32 | PowerPCJITInfo JITInfo; |
Misha Brukman | e2eceb5 | 2004-07-23 16:08:20 +0000 | [diff] [blame] | 33 | |
Misha Brukman | 5dfe3a9 | 2004-06-21 16:55:25 +0000 | [diff] [blame] | 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); |
Misha Brukman | 01eca8d | 2004-07-12 23:36:12 +0000 | [diff] [blame] | 56 | |
| 57 | static unsigned getModuleMatchQuality(const Module &M); |
| 58 | static unsigned getJITMatchQuality(); |
Misha Brukman | e2eceb5 | 2004-07-23 16:08:20 +0000 | [diff] [blame] | 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; |
Misha Brukman | 5dfe3a9 | 2004-06-21 16:55:25 +0000 | [diff] [blame] | 64 | }; |
| 65 | |
| 66 | } // end namespace llvm |
| 67 | |
| 68 | #endif |