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