1f4a2713aSLionel Sambuc //===-- PPCTargetMachine.h - Define TargetMachine for PowerPC ---*- C++ -*-===// 2f4a2713aSLionel Sambuc // 3f4a2713aSLionel Sambuc // The LLVM Compiler Infrastructure 4f4a2713aSLionel Sambuc // 5f4a2713aSLionel Sambuc // This file is distributed under the University of Illinois Open Source 6f4a2713aSLionel Sambuc // License. See LICENSE.TXT for details. 7f4a2713aSLionel Sambuc // 8f4a2713aSLionel Sambuc //===----------------------------------------------------------------------===// 9f4a2713aSLionel Sambuc // 10f4a2713aSLionel Sambuc // This file declares the PowerPC specific subclass of TargetMachine. 11f4a2713aSLionel Sambuc // 12f4a2713aSLionel Sambuc //===----------------------------------------------------------------------===// 13f4a2713aSLionel Sambuc 14*0a6a1f1dSLionel Sambuc #ifndef LLVM_LIB_TARGET_POWERPC_PPCTARGETMACHINE_H 15*0a6a1f1dSLionel Sambuc #define LLVM_LIB_TARGET_POWERPC_PPCTARGETMACHINE_H 16f4a2713aSLionel Sambuc 17f4a2713aSLionel Sambuc #include "PPCInstrInfo.h" 18f4a2713aSLionel Sambuc #include "PPCSubtarget.h" 19f4a2713aSLionel Sambuc #include "llvm/IR/DataLayout.h" 20f4a2713aSLionel Sambuc #include "llvm/Target/TargetMachine.h" 21f4a2713aSLionel Sambuc 22f4a2713aSLionel Sambuc namespace llvm { 23f4a2713aSLionel Sambuc 24f4a2713aSLionel Sambuc /// PPCTargetMachine - Common code between 32-bit and 64-bit PowerPC targets. 25f4a2713aSLionel Sambuc /// 26f4a2713aSLionel Sambuc class PPCTargetMachine : public LLVMTargetMachine { 27*0a6a1f1dSLionel Sambuc std::unique_ptr<TargetLoweringObjectFile> TLOF; 28f4a2713aSLionel Sambuc PPCSubtarget Subtarget; 29*0a6a1f1dSLionel Sambuc 30*0a6a1f1dSLionel Sambuc mutable StringMap<std::unique_ptr<PPCSubtarget>> SubtargetMap; 31f4a2713aSLionel Sambuc 32f4a2713aSLionel Sambuc public: 33f4a2713aSLionel Sambuc PPCTargetMachine(const Target &T, StringRef TT, 34f4a2713aSLionel Sambuc StringRef CPU, StringRef FS, const TargetOptions &Options, 35f4a2713aSLionel Sambuc Reloc::Model RM, CodeModel::Model CM, 36*0a6a1f1dSLionel Sambuc CodeGenOpt::Level OL); 37f4a2713aSLionel Sambuc 38*0a6a1f1dSLionel Sambuc ~PPCTargetMachine() override; 39f4a2713aSLionel Sambuc getSubtargetImpl()40*0a6a1f1dSLionel Sambuc const PPCSubtarget *getSubtargetImpl() const override { return &Subtarget; } 41*0a6a1f1dSLionel Sambuc const PPCSubtarget *getSubtargetImpl(const Function &F) const override; 42f4a2713aSLionel Sambuc 43f4a2713aSLionel Sambuc // Pass Pipeline Configuration 44*0a6a1f1dSLionel Sambuc TargetPassConfig *createPassConfig(PassManagerBase &PM) override; 45f4a2713aSLionel Sambuc 46f4a2713aSLionel Sambuc /// \brief Register PPC analysis passes with a pass manager. 47*0a6a1f1dSLionel Sambuc void addAnalysisPasses(PassManagerBase &PM) override; getObjFileLowering()48*0a6a1f1dSLionel Sambuc TargetLoweringObjectFile *getObjFileLowering() const override { 49*0a6a1f1dSLionel Sambuc return TLOF.get(); 50*0a6a1f1dSLionel Sambuc } 51f4a2713aSLionel Sambuc }; 52f4a2713aSLionel Sambuc 53f4a2713aSLionel Sambuc /// PPC32TargetMachine - PowerPC 32-bit target machine. 54f4a2713aSLionel Sambuc /// 55f4a2713aSLionel Sambuc class PPC32TargetMachine : public PPCTargetMachine { 56f4a2713aSLionel Sambuc virtual void anchor(); 57f4a2713aSLionel Sambuc public: 58f4a2713aSLionel Sambuc PPC32TargetMachine(const Target &T, StringRef TT, 59f4a2713aSLionel Sambuc StringRef CPU, StringRef FS, const TargetOptions &Options, 60f4a2713aSLionel Sambuc Reloc::Model RM, CodeModel::Model CM, 61f4a2713aSLionel Sambuc CodeGenOpt::Level OL); 62f4a2713aSLionel Sambuc }; 63f4a2713aSLionel Sambuc 64f4a2713aSLionel Sambuc /// PPC64TargetMachine - PowerPC 64-bit target machine. 65f4a2713aSLionel Sambuc /// 66f4a2713aSLionel Sambuc class PPC64TargetMachine : public PPCTargetMachine { 67f4a2713aSLionel Sambuc virtual void anchor(); 68f4a2713aSLionel Sambuc public: 69f4a2713aSLionel Sambuc PPC64TargetMachine(const Target &T, StringRef TT, 70f4a2713aSLionel Sambuc StringRef CPU, StringRef FS, const TargetOptions &Options, 71f4a2713aSLionel Sambuc Reloc::Model RM, CodeModel::Model CM, 72f4a2713aSLionel Sambuc CodeGenOpt::Level OL); 73f4a2713aSLionel Sambuc }; 74f4a2713aSLionel Sambuc 75f4a2713aSLionel Sambuc } // end namespace llvm 76f4a2713aSLionel Sambuc 77f4a2713aSLionel Sambuc #endif 78