10b57cec5SDimitry Andric //===-- X86TargetMachine.h - Define TargetMachine for the X86 ---*- C++ -*-===// 20b57cec5SDimitry Andric // 30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information. 50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 60b57cec5SDimitry Andric // 70b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 80b57cec5SDimitry Andric // 90b57cec5SDimitry Andric // This file declares the X86 specific subclass of TargetMachine. 100b57cec5SDimitry Andric // 110b57cec5SDimitry Andric //===----------------------------------------------------------------------===// 120b57cec5SDimitry Andric 130b57cec5SDimitry Andric #ifndef LLVM_LIB_TARGET_X86_X86TARGETMACHINE_H 140b57cec5SDimitry Andric #define LLVM_LIB_TARGET_X86_X86TARGETMACHINE_H 150b57cec5SDimitry Andric 160b57cec5SDimitry Andric #include "X86Subtarget.h" 170b57cec5SDimitry Andric #include "llvm/ADT/StringMap.h" 180b57cec5SDimitry Andric #include "llvm/Support/CodeGen.h" 190b57cec5SDimitry Andric #include "llvm/Target/TargetMachine.h" 200b57cec5SDimitry Andric #include <memory> 21bdd1243dSDimitry Andric #include <optional> 220b57cec5SDimitry Andric 230b57cec5SDimitry Andric namespace llvm { 240b57cec5SDimitry Andric 250b57cec5SDimitry Andric class StringRef; 268bcb0991SDimitry Andric class TargetTransformInfo; 270b57cec5SDimitry Andric 280b57cec5SDimitry Andric class X86TargetMachine final : public LLVMTargetMachine { 290b57cec5SDimitry Andric std::unique_ptr<TargetLoweringObjectFile> TLOF; 300b57cec5SDimitry Andric mutable StringMap<std::unique_ptr<X86Subtarget>> SubtargetMap; 31d65cd7a5SDimitry Andric // True if this is used in JIT. 32d65cd7a5SDimitry Andric bool IsJIT; 330b57cec5SDimitry Andric 340b57cec5SDimitry Andric public: 350b57cec5SDimitry Andric X86TargetMachine(const Target &T, const Triple &TT, StringRef CPU, 360b57cec5SDimitry Andric StringRef FS, const TargetOptions &Options, 37bdd1243dSDimitry Andric std::optional<Reloc::Model> RM, 385f757f3fSDimitry Andric std::optional<CodeModel::Model> CM, CodeGenOptLevel OL, 39bdd1243dSDimitry Andric bool JIT); 400b57cec5SDimitry Andric ~X86TargetMachine() override; 410b57cec5SDimitry Andric 420b57cec5SDimitry Andric const X86Subtarget *getSubtargetImpl(const Function &F) const override; 430b57cec5SDimitry Andric // DO NOT IMPLEMENT: There is no such thing as a valid default subtarget, 440b57cec5SDimitry Andric // subtargets are per-function entities based on the target-specific 450b57cec5SDimitry Andric // attributes of each function. 460b57cec5SDimitry Andric const X86Subtarget *getSubtargetImpl() const = delete; 470b57cec5SDimitry Andric 4881ad6265SDimitry Andric TargetTransformInfo getTargetTransformInfo(const Function &F) const override; 490b57cec5SDimitry Andric 500b57cec5SDimitry Andric // Set up the pass pipeline. 510b57cec5SDimitry Andric TargetPassConfig *createPassConfig(PassManagerBase &PM) override; 520b57cec5SDimitry Andric 530b57cec5SDimitry Andric TargetLoweringObjectFile *getObjFileLowering() const override { 540b57cec5SDimitry Andric return TLOF.get(); 550b57cec5SDimitry Andric } 56d65cd7a5SDimitry Andric 57bdd1243dSDimitry Andric MachineFunctionInfo * 58bdd1243dSDimitry Andric createMachineFunctionInfo(BumpPtrAllocator &Allocator, const Function &F, 59bdd1243dSDimitry Andric const TargetSubtargetInfo *STI) const override; 60bdd1243dSDimitry Andric 61*0fca6ea1SDimitry Andric yaml::MachineFunctionInfo *createDefaultFuncInfoYAML() const override; 62*0fca6ea1SDimitry Andric yaml::MachineFunctionInfo * 63*0fca6ea1SDimitry Andric convertFuncInfoToYAML(const MachineFunction &MF) const override; 64*0fca6ea1SDimitry Andric bool parseMachineFunctionInfo(const yaml::MachineFunctionInfo &, 65*0fca6ea1SDimitry Andric PerFunctionMIParsingState &PFS, 66*0fca6ea1SDimitry Andric SMDiagnostic &Error, 67*0fca6ea1SDimitry Andric SMRange &SourceRange) const override; 68*0fca6ea1SDimitry Andric 69*0fca6ea1SDimitry Andric void registerPassBuilderCallbacks(PassBuilder &PB) override; 70*0fca6ea1SDimitry Andric 71*0fca6ea1SDimitry Andric Error buildCodeGenPipeline(ModulePassManager &, raw_pwrite_stream &, 72*0fca6ea1SDimitry Andric raw_pwrite_stream *, CodeGenFileType, 73*0fca6ea1SDimitry Andric const CGPassBuilderOption &, 747a6dacacSDimitry Andric PassInstrumentationCallbacks *) override; 757a6dacacSDimitry Andric 76d65cd7a5SDimitry Andric bool isJIT() const { return IsJIT; } 77e8d8bef9SDimitry Andric 78e8d8bef9SDimitry Andric bool isNoopAddrSpaceCast(unsigned SrcAS, unsigned DestAS) const override; 790b57cec5SDimitry Andric }; 800b57cec5SDimitry Andric 810b57cec5SDimitry Andric } // end namespace llvm 820b57cec5SDimitry Andric 830b57cec5SDimitry Andric #endif // LLVM_LIB_TARGET_X86_X86TARGETMACHINE_H 84