From: Clement Courbet Date: Wed, 9 Oct 2019 12:37:56 +0000 (+0000) Subject: [llvm-exegesis] Fix r374158 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8c2f32ef9c3f804d5870c1159f64b7f5f273967b;p=llvm [llvm-exegesis] Fix r374158 Some bots complain about missing 'class': LlvmState.h:70:40: error: declaration of ‘std::unique_ptr llvm::exegesis::LLVMState::TargetMachine’ [-fpermissive] std::unique_ptr TargetMachine; git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@374162 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/tools/llvm-exegesis/lib/LlvmState.cpp b/tools/llvm-exegesis/lib/LlvmState.cpp index 2c9d63fdd76..5ca5de176fc 100644 --- a/tools/llvm-exegesis/lib/LlvmState.cpp +++ b/tools/llvm-exegesis/lib/LlvmState.cpp @@ -27,10 +27,10 @@ LLVMState::LLVMState(const std::string &Triple, const std::string &CpuName, const Target *const TheTarget = TargetRegistry::lookupTarget(Triple, Error); assert(TheTarget && "unknown target for host"); const TargetOptions Options; - TargetMachine.reset( + TheTargetMachine.reset( static_cast(TheTarget->createTargetMachine( Triple, CpuName, Features, Options, Reloc::Model::Static))); - TheExegesisTarget = ExegesisTarget::lookup(TargetMachine->getTargetTriple()); + TheExegesisTarget = ExegesisTarget::lookup(TheTargetMachine->getTargetTriple()); if (!TheExegesisTarget) { errs() << "no exegesis target for " << Triple << ", using default\n"; TheExegesisTarget = &ExegesisTarget::getDefault(); @@ -51,26 +51,26 @@ LLVMState::LLVMState(const std::string &CpuName) std::unique_ptr LLVMState::createTargetMachine() const { return std::unique_ptr(static_cast( - TargetMachine->getTarget().createTargetMachine( - TargetMachine->getTargetTriple().normalize(), - TargetMachine->getTargetCPU(), - TargetMachine->getTargetFeatureString(), TargetMachine->Options, + TheTargetMachine->getTarget().createTargetMachine( + TheTargetMachine->getTargetTriple().normalize(), + TheTargetMachine->getTargetCPU(), + TheTargetMachine->getTargetFeatureString(), TheTargetMachine->Options, Reloc::Model::Static))); } bool LLVMState::canAssemble(const MCInst &Inst) const { MCObjectFileInfo ObjectFileInfo; - MCContext Context(TargetMachine->getMCAsmInfo(), - TargetMachine->getMCRegisterInfo(), &ObjectFileInfo); + MCContext Context(TheTargetMachine->getMCAsmInfo(), + TheTargetMachine->getMCRegisterInfo(), &ObjectFileInfo); std::unique_ptr CodeEmitter( - TargetMachine->getTarget().createMCCodeEmitter( - *TargetMachine->getMCInstrInfo(), *TargetMachine->getMCRegisterInfo(), + TheTargetMachine->getTarget().createMCCodeEmitter( + *TheTargetMachine->getMCInstrInfo(), *TheTargetMachine->getMCRegisterInfo(), Context)); SmallVector Tmp; raw_svector_ostream OS(Tmp); SmallVector Fixups; CodeEmitter->encodeInstruction(Inst, OS, Fixups, - *TargetMachine->getMCSubtargetInfo()); + *TheTargetMachine->getMCSubtargetInfo()); return Tmp.size() > 0; } diff --git a/tools/llvm-exegesis/lib/LlvmState.h b/tools/llvm-exegesis/lib/LlvmState.h index ee6fbf3f4c5..e660a9f56b4 100644 --- a/tools/llvm-exegesis/lib/LlvmState.h +++ b/tools/llvm-exegesis/lib/LlvmState.h @@ -42,7 +42,7 @@ public: const std::string &CpuName, const std::string &Features = ""); // For tests. - const TargetMachine &getTargetMachine() const { return *TargetMachine; } + const TargetMachine &getTargetMachine() const { return *TheTargetMachine; } std::unique_ptr createTargetMachine() const; const ExegesisTarget &getExegesisTarget() const { return *TheExegesisTarget; } @@ -51,13 +51,13 @@ public: // For convenience: const MCInstrInfo &getInstrInfo() const { - return *TargetMachine->getMCInstrInfo(); + return *TheTargetMachine->getMCInstrInfo(); } const MCRegisterInfo &getRegInfo() const { - return *TargetMachine->getMCRegisterInfo(); + return *TheTargetMachine->getMCRegisterInfo(); } const MCSubtargetInfo &getSubtargetInfo() const { - return *TargetMachine->getMCSubtargetInfo(); + return *TheTargetMachine->getMCSubtargetInfo(); } const RegisterAliasingTrackerCache &getRATC() const { return *RATC; } @@ -67,7 +67,7 @@ public: private: const ExegesisTarget *TheExegesisTarget; - std::unique_ptr TargetMachine; + std::unique_ptr TheTargetMachine; std::unique_ptr RATC; std::unique_ptr IC; const PfmCountersInfo *PfmCounters;