LoongArchTargetMachine.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. //=- LoongArchTargetMachine.h - Define TargetMachine for LoongArch -*- 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 LoongArch specific subclass of TargetMachine.
  10. //
  11. //===----------------------------------------------------------------------===//
  12. #ifndef LLVM_LIB_TARGET_LOONGARCH_LOONGARCHTARGETMACHINE_H
  13. #define LLVM_LIB_TARGET_LOONGARCH_LOONGARCHTARGETMACHINE_H
  14. #include "LoongArchSubtarget.h"
  15. #include "llvm/Target/TargetMachine.h"
  16. #include <optional>
  17. namespace llvm {
  18. class LoongArchTargetMachine : public LLVMTargetMachine {
  19. std::unique_ptr<TargetLoweringObjectFile> TLOF;
  20. mutable StringMap<std::unique_ptr<LoongArchSubtarget>> SubtargetMap;
  21. public:
  22. LoongArchTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
  23. StringRef FS, const TargetOptions &Options,
  24. std::optional<Reloc::Model> RM,
  25. std::optional<CodeModel::Model> CM,
  26. CodeGenOpt::Level OL, bool JIT);
  27. ~LoongArchTargetMachine() override;
  28. const LoongArchSubtarget *getSubtargetImpl(const Function &F) const override;
  29. const LoongArchSubtarget *getSubtargetImpl() const = delete;
  30. // Pass Pipeline Configuration
  31. TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
  32. TargetLoweringObjectFile *getObjFileLowering() const override {
  33. return TLOF.get();
  34. }
  35. MachineFunctionInfo *
  36. createMachineFunctionInfo(BumpPtrAllocator &Allocator, const Function &F,
  37. const TargetSubtargetInfo *STI) const override;
  38. };
  39. } // end namespace llvm
  40. #endif // LLVM_LIB_TARGET_LOONGARCH_LOONGARCHTARGETMACHINE_H