1 //===-- PPCTargetMachine.h - Define TargetMachine for PowerPC -----*- C++ -*-=//
3 // The LLVM Compiler Infrastructure
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.
8 //===----------------------------------------------------------------------===//
10 // This file declares the PowerPC specific subclass of TargetMachine.
12 //===----------------------------------------------------------------------===//
14 #ifndef PPC_TARGETMACHINE_H
15 #define PPC_TARGETMACHINE_H
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"
29 /// PPCTargetMachine - Common code between 32-bit and 64-bit PowerPC targets.
31 class PPCTargetMachine : public TargetMachine {
32 PPCSubtarget Subtarget;
33 const TargetData DataLayout; // Calculates type size & alignment
34 PPCInstrInfo InstrInfo;
35 PPCFrameInfo FrameInfo;
37 PPCTargetLowering TLInfo;
38 InstrItineraryData InstrItins;
40 PPCTargetMachine(const Module &M, const std::string &FS, bool is64Bit);
42 virtual const PPCInstrInfo *getInstrInfo() const { return &InstrInfo; }
43 virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; }
44 virtual TargetJITInfo *getJITInfo() { return &JITInfo; }
45 virtual PPCTargetLowering *getTargetLowering() const {
46 return const_cast<PPCTargetLowering*>(&TLInfo);
48 virtual const MRegisterInfo *getRegisterInfo() const {
49 return &InstrInfo.getRegisterInfo();
52 virtual const TargetData *getTargetData() const { return &DataLayout; }
53 virtual const PPCSubtarget *getSubtargetImpl() const { return &Subtarget; }
54 virtual const InstrItineraryData getInstrItineraryData() const {
59 virtual bool addPassesToEmitFile(PassManager &PM, std::ostream &Out,
60 CodeGenFileType FileType, bool Fast);
62 bool addPassesToEmitMachineCode(FunctionPassManager &PM,
63 MachineCodeEmitter &MCE);
66 /// PPC32TargetMachine - PowerPC 32-bit target machine.
68 class PPC32TargetMachine : public PPCTargetMachine {
70 PPC32TargetMachine(const Module &M, const std::string &FS);
72 static unsigned getJITMatchQuality();
73 static unsigned getModuleMatchQuality(const Module &M);
76 /// PPC64TargetMachine - PowerPC 64-bit target machine.
78 class PPC64TargetMachine : public PPCTargetMachine {
80 PPC64TargetMachine(const Module &M, const std::string &FS);
82 static unsigned getJITMatchQuality();
83 static unsigned getModuleMatchQuality(const Module &M);
86 } // end namespace llvm