LLVM  13.0.0git
PPCTargetMachine.h
Go to the documentation of this file.
1 //===-- PPCTargetMachine.h - Define TargetMachine for PowerPC ---*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file declares the PowerPC specific subclass of TargetMachine.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_LIB_TARGET_POWERPC_PPCTARGETMACHINE_H
14 #define LLVM_LIB_TARGET_POWERPC_PPCTARGETMACHINE_H
15 
16 #include "PPCInstrInfo.h"
17 #include "PPCSubtarget.h"
18 #include "llvm/IR/DataLayout.h"
20 
21 namespace llvm {
22 
23 /// Common code between 32-bit and 64-bit PowerPC targets.
24 ///
25 class PPCTargetMachine final : public LLVMTargetMachine {
26 public:
29 
30 private:
31  std::unique_ptr<TargetLoweringObjectFile> TLOF;
32  PPCABI TargetABI;
33  Endian Endianness = Endian::NOT_DETECTED;
34 
35  mutable StringMap<std::unique_ptr<PPCSubtarget>> SubtargetMap;
36 
37 public:
38  PPCTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
41  CodeGenOpt::Level OL, bool JIT);
42 
43  ~PPCTargetMachine() override;
44 
45  const PPCSubtarget *getSubtargetImpl(const Function &F) const override;
46  // DO NOT IMPLEMENT: There is no such thing as a valid default subtarget,
47  // subtargets are per-function entities based on the target-specific
48  // attributes of each function.
49  const PPCSubtarget *getSubtargetImpl() const = delete;
50 
51  // Pass Pipeline Configuration
53 
55 
57  return TLOF.get();
58  }
59  bool isELFv2ABI() const { return TargetABI == PPC_ABI_ELFv2; }
60  bool isPPC64() const {
61  const Triple &TT = getTargetTriple();
62  return (TT.getArch() == Triple::ppc64 || TT.getArch() == Triple::ppc64le);
63  };
64 
65  bool isNoopAddrSpaceCast(unsigned SrcAS, unsigned DestAS) const override {
66  // Addrspacecasts are always noops.
67  return true;
68  }
69 
70  bool isLittleEndian() const;
71 };
72 } // end namespace llvm
73 
74 #endif
llvm::PPCTargetMachine::~PPCTargetMachine
~PPCTargetMachine() override
llvm::PPCTargetMachine::PPCABI
PPCABI
Definition: PPCTargetMachine.h:27
llvm
Definition: AllocatorList.h:23
llvm::TargetOptions
Definition: TargetOptions.h:115
llvm::PPCTargetMachine::PPCTargetMachine
PPCTargetMachine(const Target &T, const Triple &TT, StringRef CPU, StringRef FS, const TargetOptions &Options, Optional< Reloc::Model > RM, Optional< CodeModel::Model > CM, CodeGenOpt::Level OL, bool JIT)
Definition: PPCTargetMachine.cpp:313
llvm::Function
Definition: Function.h:61
llvm::Target
Target - Wrapper for Target specific information.
Definition: TargetRegistry.h:124
llvm::TargetTransformInfo
This pass provides access to the codegen interfaces that are needed for IR-level transformations.
Definition: TargetTransformInfo.h:167
llvm::PPCTargetMachine::PPC_ABI_ELFv2
@ PPC_ABI_ELFv2
Definition: PPCTargetMachine.h:27
llvm::Triple
Triple - Helper class for working with autoconf configuration names.
Definition: Triple.h:45
llvm::PPCTargetMachine::isLittleEndian
bool isLittleEndian() const
Definition: PPCTargetMachine.cpp:547
llvm::TargetMachine::RM
Reloc::Model RM
Definition: TargetMachine.h:100
llvm::Optional< Reloc::Model >
llvm::PPCTargetMachine::LITTLE
@ LITTLE
Definition: PPCTargetMachine.h:28
llvm::PPCTargetMachine::PPC_ABI_UNKNOWN
@ PPC_ABI_UNKNOWN
Definition: PPCTargetMachine.h:27
llvm::X86AS::FS
@ FS
Definition: X86.h:188
F
#define F(x, y, z)
Definition: MD5.cpp:56
llvm::PPCTargetMachine::createPassConfig
TargetPassConfig * createPassConfig(PassManagerBase &PM) override
Create a pass configuration object to be used by addPassToEmitX methods for generating a pipeline of ...
Definition: PPCTargetMachine.cpp:418
llvm::TargetLoweringObjectFile
Definition: TargetLoweringObjectFile.h:43
PPCSubtarget.h
TargetMachine.h
llvm::PPCSubtarget
Definition: PPCSubtarget.h:71
llvm::Triple::ppc64
@ ppc64
Definition: Triple.h:69
llvm::PPCTargetMachine::PPC_ABI_ELFv1
@ PPC_ABI_ELFv1
Definition: PPCTargetMachine.h:27
llvm::StringMap
StringMap - This is an unconventional map that is specialized for handling keys that are "strings",...
Definition: StringMap.h:108
llvm::PPCTargetMachine::Endian
Endian
Definition: PPCTargetMachine.h:28
llvm::TargetPassConfig
Target-Independent Code Generator Pass Configuration Options.
Definition: TargetPassConfig.h:84
llvm::PPCTargetMachine::getSubtargetImpl
const PPCSubtarget * getSubtargetImpl() const =delete
llvm::Triple::ppc64le
@ ppc64le
Definition: Triple.h:70
llvm::EngineKind::JIT
@ JIT
Definition: ExecutionEngine.h:525
PPCInstrInfo.h
llvm::TargetMachine::Options
TargetOptions Options
Definition: TargetMachine.h:115
llvm::PPCTargetMachine::NOT_DETECTED
@ NOT_DETECTED
Definition: PPCTargetMachine.h:28
llvm::PPCTargetMachine::isNoopAddrSpaceCast
bool isNoopAddrSpaceCast(unsigned SrcAS, unsigned DestAS) const override
Returns true if a cast between SrcAS and DestAS is a noop.
Definition: PPCTargetMachine.h:65
DataLayout.h
llvm::StringRef
StringRef - Represent a constant reference to a string, i.e.
Definition: StringRef.h:57
llvm::PPCTargetMachine::BIG
@ BIG
Definition: PPCTargetMachine.h:28
llvm::PPCTargetMachine::isPPC64
bool isPPC64() const
Definition: PPCTargetMachine.h:60
llvm::CodeGenOpt::Level
Level
Definition: CodeGen.h:52
llvm::PPCTargetMachine::getObjFileLowering
TargetLoweringObjectFile * getObjFileLowering() const override
Definition: PPCTargetMachine.h:56
llvm::LLVMTargetMachine
This class describes a target machine that is implemented with the LLVM target-independent code gener...
Definition: TargetMachine.h:385
llvm::PPCTargetMachine
Common code between 32-bit and 64-bit PowerPC targets.
Definition: PPCTargetMachine.h:25
llvm::PPCTargetMachine::isELFv2ABI
bool isELFv2ABI() const
Definition: PPCTargetMachine.h:59
llvm::TargetMachine::getTargetTriple
const Triple & getTargetTriple() const
Definition: TargetMachine.h:123
llvm::legacy::PassManagerBase
PassManagerBase - An abstract interface to allow code to add passes to a pass manager without having ...
Definition: LegacyPassManager.h:39
llvm::PPCTargetMachine::getTargetTransformInfo
TargetTransformInfo getTargetTransformInfo(const Function &F) override
Get a TargetTransformInfo implementation for the target.
Definition: PPCTargetMachine.cpp:543