1 //=- LoongArchTargetMachine.h - Define TargetMachine for LoongArch -*- C++ -*-//
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
7 //===----------------------------------------------------------------------===//
9 // This file declares the LoongArch specific subclass of TargetMachine.
11 //===----------------------------------------------------------------------===//
13 #ifndef LLVM_LIB_TARGET_LOONGARCH_LOONGARCHTARGETMACHINE_H
14 #define LLVM_LIB_TARGET_LOONGARCH_LOONGARCHTARGETMACHINE_H
16 #include "LoongArchSubtarget.h"
17 #include "llvm/Target/TargetMachine.h"
22 class LoongArchTargetMachine : public LLVMTargetMachine {
23 std::unique_ptr<TargetLoweringObjectFile> TLOF;
24 mutable StringMap<std::unique_ptr<LoongArchSubtarget>> SubtargetMap;
27 LoongArchTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
28 StringRef FS, const TargetOptions &Options,
29 std::optional<Reloc::Model> RM,
30 std::optional<CodeModel::Model> CM, CodeGenOptLevel OL,
32 ~LoongArchTargetMachine() override;
34 TargetTransformInfo getTargetTransformInfo(const Function &F) const override;
35 const LoongArchSubtarget *getSubtargetImpl(const Function &F) const override;
36 const LoongArchSubtarget *getSubtargetImpl() const = delete;
38 // Pass Pipeline Configuration
39 TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
41 TargetLoweringObjectFile *getObjFileLowering() const override {
46 createMachineFunctionInfo(BumpPtrAllocator &Allocator, const Function &F,
47 const TargetSubtargetInfo *STI) const override;
49 // Addrspacecasts are always noops.
50 bool isNoopAddrSpaceCast(unsigned SrcAS, unsigned DestAS) const override {
55 } // end namespace llvm
57 #endif // LLVM_LIB_TARGET_LOONGARCH_LOONGARCHTARGETMACHINE_H