xref: /freebsd/contrib/llvm-project/llvm/lib/Target/LoongArch/LoongArchTargetMachine.h (revision e6bfd18d21b225af6a0ed67ceeaf1293b7b9eba5)
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 
13 #ifndef LLVM_LIB_TARGET_LOONGARCH_LOONGARCHTARGETMACHINE_H
14 #define LLVM_LIB_TARGET_LOONGARCH_LOONGARCHTARGETMACHINE_H
15 
16 #include "LoongArchSubtarget.h"
17 #include "llvm/Target/TargetMachine.h"
18 
19 namespace llvm {
20 
21 class LoongArchTargetMachine : public LLVMTargetMachine {
22   std::unique_ptr<TargetLoweringObjectFile> TLOF;
23   mutable StringMap<std::unique_ptr<LoongArchSubtarget>> SubtargetMap;
24 
25 public:
26   LoongArchTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
27                          StringRef FS, const TargetOptions &Options,
28                          Optional<Reloc::Model> RM,
29                          Optional<CodeModel::Model> CM, CodeGenOpt::Level OL,
30                          bool JIT);
31   ~LoongArchTargetMachine() override;
32 
33   const LoongArchSubtarget *getSubtargetImpl(const Function &F) const override;
34   const LoongArchSubtarget *getSubtargetImpl() const = delete;
35 
36   // Pass Pipeline Configuration
37   TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
38 
39   TargetLoweringObjectFile *getObjFileLowering() const override {
40     return TLOF.get();
41   }
42 };
43 
44 } // end namespace llvm
45 
46 #endif // LLVM_LIB_TARGET_LOONGARCH_LOONGARCHTARGETMACHINE_H
47