LLVM  3.7.0
PPCTargetMachine.h
Go to the documentation of this file.
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"
21 
22 namespace llvm {
23 
24 /// PPCTargetMachine - Common code between 32-bit and 64-bit PowerPC targets.
25 ///
27 public:
29 private:
30  std::unique_ptr<TargetLoweringObjectFile> TLOF;
31  PPCABI TargetABI;
32  PPCSubtarget Subtarget;
33 
34  mutable StringMap<std::unique_ptr<PPCSubtarget>> SubtargetMap;
35 
36 public:
37  PPCTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
40 
41  ~PPCTargetMachine() override;
42 
43  const PPCSubtarget *getSubtargetImpl(const Function &F) const override;
44 
45  // Pass Pipeline Configuration
46  TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
47 
49 
51  return TLOF.get();
52  }
53  bool isELFv2ABI() const { return TargetABI == PPC_ABI_ELFv2; }
54  bool isPPC64() const {
55  const Triple &TT = getTargetTriple();
56  return (TT.getArch() == Triple::ppc64 || TT.getArch() == Triple::ppc64le);
57  };
58 };
59 
60 /// PPC32TargetMachine - PowerPC 32-bit target machine.
61 ///
63  virtual void anchor();
64 public:
65  PPC32TargetMachine(const Target &T, const Triple &TT, StringRef CPU,
69 };
70 
71 /// PPC64TargetMachine - PowerPC 64-bit target machine.
72 ///
74  virtual void anchor();
75 public:
76  PPC64TargetMachine(const Target &T, const Triple &TT, StringRef CPU,
80 };
81 
82 } // end namespace llvm
83 
84 #endif
const PPCSubtarget * getSubtargetImpl(const Function &F) const override
Virtual method implemented by subclasses that returns a reference to that target's TargetSubtargetInf...
Analysis pass providing the TargetTransformInfo.
F(f)
const Triple & getTargetTriple() const
Target-Independent Code Generator Pass Configuration Options.
ArchType getArch() const
getArch - Get the parsed architecture type of this triple.
Definition: Triple.h:242
PPC64TargetMachine - PowerPC 64-bit target machine.
TargetLoweringObjectFile * getObjFileLowering() const override
This class describes a target machine that is implemented with the LLVM target-independent code gener...
TargetIRAnalysis getTargetIRAnalysis() override
Get a TargetIRAnalysis implementation for the target.
PPCTargetMachine - Common code between 32-bit and 64-bit PowerPC targets.
PPC32TargetMachine(const Target &T, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, Reloc::Model RM, CodeModel::Model CM, CodeGenOpt::Level OL)
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:44
TargetPassConfig * createPassConfig(PassManagerBase &PM) override
Create a pass configuration object to be used by addPassToEmitX methods for generating a pipeline of ...
StringMap - This is an unconventional map that is specialized for handling keys that are "strings"...
Definition: StringMap.h:214
Target - Wrapper for Target specific information.
PPC64TargetMachine(const Target &T, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, Reloc::Model RM, CodeModel::Model CM, CodeGenOpt::Level OL)
PPCTargetMachine(const Target &T, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, Reloc::Model RM, CodeModel::Model CM, CodeGenOpt::Level OL)
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:40
PPC32TargetMachine - PowerPC 32-bit target machine.