1 //===- ARCTargetMachine.h - Define TargetMachine for ARC --------*- 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 ARC specific subclass of TargetMachine.
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_LIB_TARGET_ARC_ARCTARGETMACHINE_H
14 #define LLVM_LIB_TARGET_ARC_ARCTARGETMACHINE_H
15 
16 #include "ARCSubtarget.h"
17 #include "llvm/Target/TargetMachine.h"
18 
19 namespace llvm {
20 
21 class TargetPassConfig;
22 
23 class ARCTargetMachine : public LLVMTargetMachine {
24   std::unique_ptr<TargetLoweringObjectFile> TLOF;
25   ARCSubtarget Subtarget;
26 
27 public:
28   ARCTargetMachine(const Target &T, const Triple &TT, StringRef CPU,
29                    StringRef FS, const TargetOptions &Options,
30                    Optional<Reloc::Model> RM, Optional<CodeModel::Model> CM,
31                    CodeGenOpt::Level OL, bool JIT);
32   ~ARCTargetMachine() override;
33 
34   const ARCSubtarget *getSubtargetImpl() const { return &Subtarget; }
35   const ARCSubtarget *getSubtargetImpl(const Function &) const override {
36     return &Subtarget;
37   }
38 
39   // Pass Pipeline Configuration
40   TargetPassConfig *createPassConfig(PassManagerBase &PM) override;
41 
42   TargetTransformInfo getTargetTransformInfo(const Function &F) override;
43   TargetLoweringObjectFile *getObjFileLowering() const override {
44     return TLOF.get();
45   }
46 };
47 
48 } // end namespace llvm
49 
50 #endif // LLVM_LIB_TARGET_ARC_ARCTARGETMACHINE_H
51