X86TargetMachine.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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/Optional.h"
  16. #include "llvm/ADT/StringMap.h"
  17. #include "llvm/Support/CodeGen.h"
  18. #include "llvm/Target/TargetMachine.h"
  19. #include <memory>
  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. Optional<Reloc::Model> RM, Optional<CodeModel::Model> CM,
  32. CodeGenOpt::Level OL, bool JIT);
  33. ~X86TargetMachine() override;
  34. const X86Subtarget *getSubtargetImpl(const Function &F) const override;
  35. // DO NOT IMPLEMENT: There is no such thing as a valid default subtarget,
  36. // subtargets are per-function entities based on the target-specific
  37. // attributes of each function.
  38. const X86Subtarget *getSubtargetImpl() const = delete;
  39. TargetTransformInfo getTargetTransformInfo(const Function &F) override;
  40. // Set up the pass pipeline.
  41. TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
  42. TargetLoweringObjectFile *getObjFileLowering() const override {
  43. return TLOF.get();
  44. }
  45. bool isJIT() const { return IsJIT; }
  46. bool isNoopAddrSpaceCast(unsigned SrcAS, unsigned DestAS) const override;
  47. };
  48. } // end namespace llvm
  49. #endif // LLVM_LIB_TARGET_X86_X86TARGETMACHINE_H