1234353Sdim//===-- PPCTargetMachine.h - Define TargetMachine for PowerPC ---*- C++ -*-===// 2193323Sed// 3353358Sdim// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4353358Sdim// See https://llvm.org/LICENSE.txt for license information. 5353358Sdim// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6193323Sed// 7193323Sed//===----------------------------------------------------------------------===// 8193323Sed// 9193323Sed// This file declares the PowerPC specific subclass of TargetMachine. 10193323Sed// 11193323Sed//===----------------------------------------------------------------------===// 12193323Sed 13280031Sdim#ifndef LLVM_LIB_TARGET_POWERPC_PPCTARGETMACHINE_H 14280031Sdim#define LLVM_LIB_TARGET_POWERPC_PPCTARGETMACHINE_H 15193323Sed 16249423Sdim#include "PPCInstrInfo.h" 17249423Sdim#include "PPCSubtarget.h" 18249423Sdim#include "llvm/IR/DataLayout.h" 19193323Sed#include "llvm/Target/TargetMachine.h" 20193323Sed 21193323Sednamespace llvm { 22193323Sed 23309124Sdim/// Common code between 32-bit and 64-bit PowerPC targets. 24193323Sed/// 25321369Sdimclass PPCTargetMachine final : public LLVMTargetMachine { 26288943Sdimpublic: 27288943Sdim enum PPCABI { PPC_ABI_UNKNOWN, PPC_ABI_ELFv1, PPC_ABI_ELFv2 }; 28288943Sdimprivate: 29280031Sdim std::unique_ptr<TargetLoweringObjectFile> TLOF; 30288943Sdim PPCABI TargetABI; 31193323Sed 32280031Sdim mutable StringMap<std::unique_ptr<PPCSubtarget>> SubtargetMap; 33280031Sdim 34193323Sedpublic: 35288943Sdim PPCTargetMachine(const Target &T, const Triple &TT, StringRef CPU, 36309124Sdim StringRef FS, const TargetOptions &Options, 37327952Sdim Optional<Reloc::Model> RM, Optional<CodeModel::Model> CM, 38327952Sdim CodeGenOpt::Level OL, bool JIT); 39193323Sed 40280031Sdim ~PPCTargetMachine() override; 41234353Sdim 42280031Sdim const PPCSubtarget *getSubtargetImpl(const Function &F) const override; 43327952Sdim // DO NOT IMPLEMENT: There is no such thing as a valid default subtarget, 44327952Sdim // subtargets are per-function entities based on the target-specific 45327952Sdim // attributes of each function. 46321369Sdim const PPCSubtarget *getSubtargetImpl() const = delete; 47193323Sed 48193323Sed // Pass Pipeline Configuration 49276479Sdim TargetPassConfig *createPassConfig(PassManagerBase &PM) override; 50249423Sdim 51327952Sdim TargetTransformInfo getTargetTransformInfo(const Function &F) override; 52288943Sdim 53280031Sdim TargetLoweringObjectFile *getObjFileLowering() const override { 54280031Sdim return TLOF.get(); 55280031Sdim } 56288943Sdim bool isELFv2ABI() const { return TargetABI == PPC_ABI_ELFv2; } 57288943Sdim bool isPPC64() const { 58288943Sdim const Triple &TT = getTargetTriple(); 59288943Sdim return (TT.getArch() == Triple::ppc64 || TT.getArch() == Triple::ppc64le); 60288943Sdim }; 61193323Sed}; 62193323Sed} // end namespace llvm 63193323Sed 64193323Sed#endif 65