1 //===-- CPPTargetMachine.h - TargetMachine for the C++ backend --*- C++ -*-===// 2 // 3 // The LLVM Compiler Infrastructure 4 // 5 // This file is distributed under the University of Illinois Open Source 6 // License. See LICENSE.TXT for details. 7 // 8 //===----------------------------------------------------------------------===// 9 // 10 // This file declares the TargetMachine that is used by the C++ backend. 11 // 12 //===----------------------------------------------------------------------===// 13 14 #ifndef LLVM_LIB_TARGET_CPPBACKEND_CPPTARGETMACHINE_H 15 #define LLVM_LIB_TARGET_CPPBACKEND_CPPTARGETMACHINE_H 16 17 #include "llvm/IR/DataLayout.h" 18 #include "llvm/Target/TargetMachine.h" 19 #include "llvm/Target/TargetSubtargetInfo.h" 20 21 namespace llvm { 22 23 class formatted_raw_ostream; 24 25 class CPPSubtarget : public TargetSubtargetInfo { 26 }; 27 28 struct CPPTargetMachine : public TargetMachine { CPPTargetMachineCPPTargetMachine29 CPPTargetMachine(const Target &T, StringRef TT, 30 StringRef CPU, StringRef FS, const TargetOptions &Options, 31 Reloc::Model RM, CodeModel::Model CM, 32 CodeGenOpt::Level OL) 33 : TargetMachine(T, TT, CPU, FS, Options), Subtarget() {} 34 private: 35 CPPSubtarget Subtarget; 36 37 public: getSubtargetImplCPPTargetMachine38 const CPPSubtarget *getSubtargetImpl() const override { return &Subtarget; } 39 bool addPassesToEmitFile(PassManagerBase &PM, formatted_raw_ostream &Out, 40 CodeGenFileType FileType, bool DisableVerify, 41 AnalysisID StartAfter, 42 AnalysisID StopAfter) override; 43 }; 44 45 extern Target TheCppBackendTarget; 46 47 } // End llvm namespace 48 49 50 #endif 51