xref: /freebsd-src/contrib/llvm-project/llvm/lib/Target/CSKY/CSKYTargetMachine.h (revision 349cc55c9796c4596a5b9904cd3281af295f878f)
1e8d8bef9SDimitry Andric //===--- CSKYTargetMachine.h - Define TargetMachine for CSKY ----*- C++ -*-===//
2e8d8bef9SDimitry Andric //
3e8d8bef9SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4e8d8bef9SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
5e8d8bef9SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6e8d8bef9SDimitry Andric //
7e8d8bef9SDimitry Andric //===----------------------------------------------------------------------===//
8e8d8bef9SDimitry Andric //
9e8d8bef9SDimitry Andric // This file declares the CSKY specific subclass of TargetMachine.
10e8d8bef9SDimitry Andric //
11e8d8bef9SDimitry Andric //===----------------------------------------------------------------------===//
12e8d8bef9SDimitry Andric 
13e8d8bef9SDimitry Andric #ifndef LLVM_LIB_TARGET_CSKY_CSKYTARGETMACHINE_H
14e8d8bef9SDimitry Andric #define LLVM_LIB_TARGET_CSKY_CSKYTARGETMACHINE_H
15e8d8bef9SDimitry Andric 
16*349cc55cSDimitry Andric #include "CSKYSubtarget.h"
17e8d8bef9SDimitry Andric #include "llvm/IR/DataLayout.h"
18e8d8bef9SDimitry Andric #include "llvm/Target/TargetMachine.h"
19e8d8bef9SDimitry Andric 
20e8d8bef9SDimitry Andric namespace llvm {
21e8d8bef9SDimitry Andric 
22e8d8bef9SDimitry Andric class CSKYTargetMachine : public LLVMTargetMachine {
23e8d8bef9SDimitry Andric   std::unique_ptr<TargetLoweringObjectFile> TLOF;
24*349cc55cSDimitry Andric   mutable StringMap<std::unique_ptr<CSKYSubtarget>> SubtargetMap;
25e8d8bef9SDimitry Andric 
26e8d8bef9SDimitry Andric public:
27e8d8bef9SDimitry Andric   CSKYTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
28e8d8bef9SDimitry Andric                     StringRef FS, const TargetOptions &Options,
29e8d8bef9SDimitry Andric                     Optional<Reloc::Model> RM, Optional<CodeModel::Model> CM,
30e8d8bef9SDimitry Andric                     CodeGenOpt::Level OL, bool JIT);
31e8d8bef9SDimitry Andric 
32e8d8bef9SDimitry Andric   TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
33e8d8bef9SDimitry Andric 
34*349cc55cSDimitry Andric   const CSKYSubtarget *getSubtargetImpl(const Function &F) const override;
35*349cc55cSDimitry Andric   // DO NOT IMPLEMENT: There is no such thing as a valid default subtarget,
36*349cc55cSDimitry Andric   // subtargets are per-function entities based on the target-specific
37*349cc55cSDimitry Andric   // attributes of each function.
38*349cc55cSDimitry Andric   const CSKYSubtarget *getSubtargetImpl() const = delete;
39*349cc55cSDimitry Andric 
40e8d8bef9SDimitry Andric   TargetLoweringObjectFile *getObjFileLowering() const override {
41e8d8bef9SDimitry Andric     return TLOF.get();
42e8d8bef9SDimitry Andric   }
43e8d8bef9SDimitry Andric };
44e8d8bef9SDimitry Andric } // namespace llvm
45e8d8bef9SDimitry Andric 
46e8d8bef9SDimitry Andric #endif
47