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