brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.1 KiB · acd3a4a Raw
58 lines · c
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-exception6//7//===----------------------------------------------------------------------===//8//9// This file declares the LoongArch specific subclass of TargetMachine.10//11//===----------------------------------------------------------------------===//12 13#ifndef LLVM_LIB_TARGET_LOONGARCH_LOONGARCHTARGETMACHINE_H14#define LLVM_LIB_TARGET_LOONGARCH_LOONGARCHTARGETMACHINE_H15 16#include "LoongArchSubtarget.h"17#include "llvm/CodeGen/CodeGenTargetMachineImpl.h"18#include <optional>19 20namespace llvm {21 22class LoongArchTargetMachine : public CodeGenTargetMachineImpl {23  std::unique_ptr<TargetLoweringObjectFile> TLOF;24  mutable StringMap<std::unique_ptr<LoongArchSubtarget>> SubtargetMap;25 26public: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,31                         bool JIT);32  ~LoongArchTargetMachine() override;33 34  TargetTransformInfo getTargetTransformInfo(const Function &F) const override;35  const LoongArchSubtarget *getSubtargetImpl(const Function &F) const override;36  const LoongArchSubtarget *getSubtargetImpl() const = delete;37 38  // Pass Pipeline Configuration39  TargetPassConfig *createPassConfig(PassManagerBase &PM) override;40 41  TargetLoweringObjectFile *getObjFileLowering() const override {42    return TLOF.get();43  }44 45  MachineFunctionInfo *46  createMachineFunctionInfo(BumpPtrAllocator &Allocator, const Function &F,47                            const TargetSubtargetInfo *STI) const override;48 49  // Addrspacecasts are always noops.50  bool isNoopAddrSpaceCast(unsigned SrcAS, unsigned DestAS) const override {51    return true;52  }53};54 55} // end namespace llvm56 57#endif // LLVM_LIB_TARGET_LOONGARCH_LOONGARCHTARGETMACHINE_H58