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