X86TargetMachine.h 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. //===-- X86TargetMachine.h - Define TargetMachine for the X86 ---*- 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 X86 specific subclass of TargetMachine.
  10. //
  11. //===----------------------------------------------------------------------===//
  12. #ifndef LLVM_LIB_TARGET_X86_X86TARGETMACHINE_H
  13. #define LLVM_LIB_TARGET_X86_X86TARGETMACHINE_H
  14. #include "X86Subtarget.h"
  15. #include "llvm/ADT/StringMap.h"
  16. #include "llvm/Support/CodeGen.h"
  17. #include "llvm/Target/TargetMachine.h"
  18. #include <memory>
  19. #include <optional>
  20. namespace llvm {
  21. class StringRef;
  22. class TargetTransformInfo;
  23. class X86TargetMachine final : public LLVMTargetMachine {
  24. std::unique_ptr<TargetLoweringObjectFile> TLOF;
  25. mutable StringMap<std::unique_ptr<X86Subtarget>> SubtargetMap;
  26. // True if this is used in JIT.
  27. bool IsJIT;
  28. public:
  29. X86TargetMachine(const Target &T, const Triple &TT, StringRef CPU,
  30. StringRef FS, const TargetOptions &Options,
  31. std::optional<Reloc::Model> RM,
  32. std::optional<CodeModel::Model> CM, CodeGenOpt::Level OL,
  33. bool JIT);
  34. ~X86TargetMachine() override;
  35. const X86Subtarget *getSubtargetImpl(const Function &F) const override;
  36. // DO NOT IMPLEMENT: There is no such thing as a valid default subtarget,
  37. // subtargets are per-function entities based on the target-specific
  38. // attributes of each function.
  39. const X86Subtarget *getSubtargetImpl() const = delete;
  40. TargetTransformInfo getTargetTransformInfo(const Function &F) const override;
  41. // Set up the pass pipeline.
  42. TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
  43. TargetLoweringObjectFile *getObjFileLowering() const override {
  44. return TLOF.get();
  45. }
  46. MachineFunctionInfo *
  47. createMachineFunctionInfo(BumpPtrAllocator &Allocator, const Function &F,
  48. const TargetSubtargetInfo *STI) const override;
  49. bool isJIT() const { return IsJIT; }
  50. bool isNoopAddrSpaceCast(unsigned SrcAS, unsigned DestAS) const override;
  51. };
  52. } // end namespace llvm
  53. #endif // LLVM_LIB_TARGET_X86_X86TARGETMACHINE_H