llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT--> @llvm/pr-subscribers-clang Author: Matt Arsenault (arsenm) <details> <summary>Changes</summary> Avoids more Triple->string->Triple round trip. This is a continuation of f137c3d592e96330e450a8fd63ef7e8877fc1908 --- Patch is 80.19 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/157321.diff 46 Files Affected: - (modified) bolt/lib/Core/BinaryContext.cpp (+3-3) - (modified) clang/lib/Parse/ParseStmtAsm.cpp (+5-4) - (modified) clang/tools/driver/cc1as_main.cpp (+10-7) - (modified) llvm/include/llvm/MC/TargetRegistry.h (+49-12) - (modified) llvm/lib/CodeGen/CodeGenTargetMachineImpl.cpp (+5-5) - (modified) llvm/lib/DWARFLinker/Classic/DWARFStreamer.cpp (+3-3) - (modified) llvm/lib/DWARFLinker/Parallel/DWARFEmitterImpl.cpp (+3-3) - (modified) llvm/lib/DWARFLinker/Parallel/DebugLineSectionEmitter.h (+3-3) - (modified) llvm/lib/DebugInfo/LogicalView/Readers/LVBinaryReader.cpp (+8-7) - (modified) llvm/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp (+3-3) - (modified) llvm/lib/MC/MCDisassembler/Disassembler.cpp (+9-6) - (modified) llvm/lib/Object/ModuleSymbolTable.cpp (+3-4) - (modified) llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp (+1-1) - (modified) llvm/lib/Target/Mips/MipsAsmPrinter.cpp (+1-2) - (modified) llvm/tools/llvm-cfi-verify/lib/FileAnalysis.cpp (+5-3) - (modified) llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp (+1-1) - (modified) llvm/tools/llvm-dwp/llvm-dwp.cpp (+4-3) - (modified) llvm/tools/llvm-exegesis/lib/DisassemblerHelper.cpp (+2-2) - (modified) llvm/tools/llvm-exegesis/lib/LlvmState.cpp (+1-1) - (modified) llvm/tools/llvm-jitlink/llvm-jitlink.cpp (+3-3) - (modified) llvm/tools/llvm-mc/Disassembler.cpp (+11-10) - (modified) llvm/tools/llvm-mc/Disassembler.h (+3-3) - (modified) llvm/tools/llvm-mc/llvm-mc.cpp (+5-6) - (modified) llvm/tools/llvm-mca/llvm-mca.cpp (+3-3) - (modified) llvm/tools/llvm-ml/Disassembler.cpp (+3-2) - (modified) llvm/tools/llvm-ml/llvm-ml.cpp (+4-6) - (modified) llvm/tools/llvm-objdump/MachODump.cpp (+24-21) - (modified) llvm/tools/llvm-objdump/llvm-objdump.cpp (+19-18) - (modified) llvm/tools/llvm-profgen/ProfiledBinary.cpp (+12-12) - (modified) llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp (+5-5) - (modified) llvm/tools/sancov/sancov.cpp (+3-3) - (modified) llvm/unittests/DebugInfo/DWARF/DWARFExpressionCompactPrinterTest.cpp (+1-1) - (modified) llvm/unittests/DebugInfo/DWARF/DWARFExpressionCopyBytesTest.cpp (+7-5) - (modified) llvm/unittests/DebugInfo/DWARF/DwarfGenerator.cpp (+3-3) - (modified) llvm/unittests/MC/AMDGPU/Disassembler.cpp (+18-16) - (modified) llvm/unittests/MC/DwarfLineTableHeaders.cpp (+10-10) - (modified) llvm/unittests/MC/DwarfLineTables.cpp (+7-6) - (modified) llvm/unittests/MC/MCInstPrinter.cpp (+6-5) - (modified) llvm/unittests/MC/SystemZ/SystemZAsmLexerTest.cpp (+7-8) - (modified) llvm/unittests/MC/SystemZ/SystemZMCDisassemblerTest.cpp (+7-7) - (modified) llvm/unittests/MC/X86/X86MCDisassemblerTest.cpp (+8-7) - (modified) llvm/unittests/tools/llvm-exegesis/AArch64/TargetTest.cpp (+4-2) - (modified) llvm/unittests/tools/llvm-exegesis/PowerPC/AnalysisTest.cpp (+4-2) - (modified) llvm/unittests/tools/llvm-exegesis/PowerPC/TargetTest.cpp (+4-2) - (modified) llvm/unittests/tools/llvm-mca/MCATestBase.cpp (+3-5) - (modified) mlir/lib/Target/LLVM/ROCDL/Target.cpp (+3-4) ``````````diff diff --git a/bolt/lib/Core/BinaryContext.cpp b/bolt/lib/Core/BinaryContext.cpp index dd0d041692484..23a5a65c2c5f0 100644 --- a/bolt/lib/Core/BinaryContext.cpp +++ b/bolt/lib/Core/BinaryContext.cpp @@ -207,7 +207,7 @@ Expected<std::unique_ptr<BinaryContext>> BinaryContext::createBinaryContext( Twine("BOLT-ERROR: ", Error)); std::unique_ptr<const MCRegisterInfo> MRI( - TheTarget->createMCRegInfo(TripleName)); + TheTarget->createMCRegInfo(TheTriple)); if (!MRI) return createStringError( make_error_code(std::errc::not_supported), @@ -215,7 +215,7 @@ Expected<std::unique_ptr<BinaryContext>> BinaryContext::createBinaryContext( // Set up disassembler. std::unique_ptr<MCAsmInfo> AsmInfo( - TheTarget->createMCAsmInfo(*MRI, TripleName, MCTargetOptions())); + TheTarget->createMCAsmInfo(*MRI, TheTriple, MCTargetOptions())); if (!AsmInfo) return createStringError( make_error_code(std::errc::not_supported), @@ -227,7 +227,7 @@ Expected<std::unique_ptr<BinaryContext>> BinaryContext::createBinaryContext( AsmInfo->setAllowAtInName(true); std::unique_ptr<const MCSubtargetInfo> STI( - TheTarget->createMCSubtargetInfo(TripleName, "", FeaturesStr)); + TheTarget->createMCSubtargetInfo(TheTriple, "", FeaturesStr)); if (!STI) return createStringError( make_error_code(std::errc::not_supported), diff --git a/clang/lib/Parse/ParseStmtAsm.cpp b/clang/lib/Parse/ParseStmtAsm.cpp index c679aa6fe7b27..48338566e789d 100644 --- a/clang/lib/Parse/ParseStmtAsm.cpp +++ b/clang/lib/Parse/ParseStmtAsm.cpp @@ -543,7 +543,8 @@ StmtResult Parser::ParseMicrosoftAsmStatement(SourceLocation AsmLoc) { std::string FeaturesStr = llvm::join(TO.Features.begin(), TO.Features.end(), ","); - std::unique_ptr<llvm::MCRegisterInfo> MRI(TheTarget->createMCRegInfo(TT)); + std::unique_ptr<llvm::MCRegisterInfo> MRI( + TheTarget->createMCRegInfo(TheTriple)); if (!MRI) { Diag(AsmLoc, diag::err_msasm_unable_to_create_target) << "target MC unavailable"; @@ -552,11 +553,11 @@ StmtResult Parser::ParseMicrosoftAsmStatement(SourceLocation AsmLoc) { // FIXME: init MCOptions from sanitizer flags here. llvm::MCTargetOptions MCOptions; std::unique_ptr<llvm::MCAsmInfo> MAI( - TheTarget->createMCAsmInfo(*MRI, TT, MCOptions)); + TheTarget->createMCAsmInfo(*MRI, TheTriple, MCOptions)); // Get the instruction descriptor. std::unique_ptr<llvm::MCInstrInfo> MII(TheTarget->createMCInstrInfo()); std::unique_ptr<llvm::MCSubtargetInfo> STI( - TheTarget->createMCSubtargetInfo(TT, TO.CPU, FeaturesStr)); + TheTarget->createMCSubtargetInfo(TheTriple, TO.CPU, FeaturesStr)); // Target MCTargetDesc may not be linked in clang-based tools. if (!MAI || !MII || !STI) { @@ -591,7 +592,7 @@ StmtResult Parser::ParseMicrosoftAsmStatement(SourceLocation AsmLoc) { } std::unique_ptr<llvm::MCInstPrinter> IP( - TheTarget->createMCInstPrinter(llvm::Triple(TT), 1, *MAI, *MII, *MRI)); + TheTarget->createMCInstPrinter(TheTriple, 1, *MAI, *MII, *MRI)); // Change to the Intel dialect. Parser->setAssemblerDialect(1); diff --git a/clang/tools/driver/cc1as_main.cpp b/clang/tools/driver/cc1as_main.cpp index dda601c46472c..5c30de33c7b46 100644 --- a/clang/tools/driver/cc1as_main.cpp +++ b/clang/tools/driver/cc1as_main.cpp @@ -71,8 +71,8 @@ struct AssemblerInvocation { /// @name Target Options /// @{ - /// The name of the target triple to assemble for. - std::string Triple; + /// The target triple to assemble for. + llvm::Triple Triple; /// If given, the name of the target CPU to determine which instructions /// are legal. @@ -192,9 +192,12 @@ struct AssemblerInvocation { std::string AsSecureLogFile; /// @} + void setTriple(llvm::StringRef Str) { + Triple = llvm::Triple(llvm::Triple::normalize(Str)); + } + public: AssemblerInvocation() { - Triple = ""; NoInitialTextSection = 0; InputFile = "-"; OutputPath = "-"; @@ -261,7 +264,7 @@ bool AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts, // Construct the invocation. // Target Options - Opts.Triple = llvm::Triple::normalize(Args.getLastArgValue(OPT_triple)); + Opts.setTriple(Args.getLastArgValue(OPT_triple)); if (Arg *A = Args.getLastArg(options::OPT_darwin_target_variant_triple)) Opts.DarwinTargetVariantTriple = llvm::Triple(A->getValue()); if (Arg *A = Args.getLastArg(OPT_darwin_target_variant_sdk_version_EQ)) { @@ -278,7 +281,7 @@ bool AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts, // Use the default target triple if unspecified. if (Opts.Triple.empty()) - Opts.Triple = llvm::sys::getDefaultTargetTriple(); + Opts.setTriple(llvm::sys::getDefaultTargetTriple()); // Language Options Opts.IncludePaths = Args.getAllArgValues(OPT_I); @@ -419,7 +422,7 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts, std::string Error; const Target *TheTarget = TargetRegistry::lookupTarget(Opts.Triple, Error); if (!TheTarget) - return Diags.Report(diag::err_target_unknown_triple) << Opts.Triple; + return Diags.Report(diag::err_target_unknown_triple) << Opts.Triple.str(); ErrorOr<std::unique_ptr<MemoryBuffer>> Buffer = MemoryBuffer::getFileOrSTDIN(Opts.InputFile, /*IsText=*/true); @@ -604,7 +607,7 @@ static bool ExecuteAssemblerImpl(AssemblerInvocation &Opts, std::unique_ptr<MCTargetAsmParser> TAP( TheTarget->createMCAsmParser(*STI, *Parser, *MCII, MCOptions)); if (!TAP) - Failed = Diags.Report(diag::err_target_unknown_triple) << Opts.Triple; + Failed = Diags.Report(diag::err_target_unknown_triple) << Opts.Triple.str(); // Set values for symbols, if any. for (auto &S : Opts.SymbolDefs) { diff --git a/llvm/include/llvm/MC/TargetRegistry.h b/llvm/include/llvm/MC/TargetRegistry.h index efff08d7f8ea5..019ee602975f7 100644 --- a/llvm/include/llvm/MC/TargetRegistry.h +++ b/llvm/include/llvm/MC/TargetRegistry.h @@ -389,18 +389,26 @@ class Target { /// @name Feature Constructors /// @{ - /// createMCAsmInfo - Create a MCAsmInfo implementation for the specified + [[deprecated("Use overload accepting Triple instead")]] + MCAsmInfo *createMCAsmInfo(const MCRegisterInfo &MRI, StringRef TheTriple, + const MCTargetOptions &Options) const { + if (!MCAsmInfoCtorFn) + return nullptr; + return MCAsmInfoCtorFn(MRI, Triple(TheTriple), Options); + } + + /// Create a MCAsmInfo implementation for the specified /// target triple. /// /// \param TheTriple This argument is used to determine the target machine /// feature set; it should always be provided. Generally this should be /// either the target triple from the module, or the target triple of the /// host if that does not exist. - MCAsmInfo *createMCAsmInfo(const MCRegisterInfo &MRI, StringRef TheTriple, + MCAsmInfo *createMCAsmInfo(const MCRegisterInfo &MRI, const Triple &TheTriple, const MCTargetOptions &Options) const { if (!MCAsmInfoCtorFn) return nullptr; - return MCAsmInfoCtorFn(MRI, Triple(TheTriple), Options); + return MCAsmInfoCtorFn(MRI, TheTriple, Options); } /// Create a MCObjectFileInfo implementation for the specified target @@ -432,14 +440,28 @@ class Target { return MCInstrAnalysisCtorFn(Info); } - /// createMCRegInfo - Create a MCRegisterInfo implementation. - /// + [[deprecated("Use overload accepting Triple instead")]] MCRegisterInfo *createMCRegInfo(StringRef TT) const { if (!MCRegInfoCtorFn) return nullptr; return MCRegInfoCtorFn(Triple(TT)); } + /// Create a MCRegisterInfo implementation. + MCRegisterInfo *createMCRegInfo(const Triple &TT) const { + if (!MCRegInfoCtorFn) + return nullptr; + return MCRegInfoCtorFn(TT); + } + + [[deprecated("Use overload accepting Triple instead")]] + MCSubtargetInfo *createMCSubtargetInfo(StringRef TheTriple, StringRef CPU, + StringRef Features) const { + if (!MCSubtargetInfoCtorFn) + return nullptr; + return MCSubtargetInfoCtorFn(Triple(TheTriple), CPU, Features); + } + /// createMCSubtargetInfo - Create a MCSubtargetInfo implementation. /// /// \param TheTriple This argument is used to determine the target machine @@ -449,11 +471,11 @@ class Target { /// \param CPU This specifies the name of the target CPU. /// \param Features This specifies the string representation of the /// additional target features. - MCSubtargetInfo *createMCSubtargetInfo(StringRef TheTriple, StringRef CPU, + MCSubtargetInfo *createMCSubtargetInfo(const Triple &TheTriple, StringRef CPU, StringRef Features) const { if (!MCSubtargetInfoCtorFn) return nullptr; - return MCSubtargetInfoCtorFn(Triple(TheTriple), CPU, Features); + return MCSubtargetInfoCtorFn(TheTriple, CPU, Features); } /// createTargetMachine - Create a target specific machine implementation @@ -577,15 +599,31 @@ class Target { return nullptr; } + [[deprecated("Use overload accepting Triple instead")]] + MCRelocationInfo *createMCRelocationInfo(StringRef TT, MCContext &Ctx) const { + return createMCRelocationInfo(Triple(TT), Ctx); + } + /// createMCRelocationInfo - Create a target specific MCRelocationInfo. /// /// \param TT The target triple. /// \param Ctx The target context. - MCRelocationInfo *createMCRelocationInfo(StringRef TT, MCContext &Ctx) const { + MCRelocationInfo *createMCRelocationInfo(const Triple &TT, + MCContext &Ctx) const { MCRelocationInfoCtorTy Fn = MCRelocationInfoCtorFn ? MCRelocationInfoCtorFn : llvm::createMCRelocationInfo; - return Fn(Triple(TT), Ctx); + return Fn(TT, Ctx); + } + + [[deprecated("Use overload accepting Triple instead")]] + MCSymbolizer * + createMCSymbolizer(StringRef TT, LLVMOpInfoCallback GetOpInfo, + LLVMSymbolLookupCallback SymbolLookUp, void *DisInfo, + MCContext *Ctx, + std::unique_ptr<MCRelocationInfo> &&RelInfo) const { + return createMCSymbolizer(Triple(TT), GetOpInfo, SymbolLookUp, DisInfo, Ctx, + std::move(RelInfo)); } /// createMCSymbolizer - Create a target specific MCSymbolizer. @@ -601,14 +639,13 @@ class Target { /// \param RelInfo The relocation information for this target. Takes /// ownership. MCSymbolizer * - createMCSymbolizer(StringRef TT, LLVMOpInfoCallback GetOpInfo, + createMCSymbolizer(const Triple &TT, LLVMOpInfoCallback GetOpInfo, LLVMSymbolLookupCallback SymbolLookUp, void *DisInfo, MCContext *Ctx, std::unique_ptr<MCRelocationInfo> &&RelInfo) const { MCSymbolizerCtorTy Fn = MCSymbolizerCtorFn ? MCSymbolizerCtorFn : llvm::createMCSymbolizer; - return Fn(Triple(TT), GetOpInfo, SymbolLookUp, DisInfo, Ctx, - std::move(RelInfo)); + return Fn(TT, GetOpInfo, SymbolLookUp, DisInfo, Ctx, std::move(RelInfo)); } /// createCustomBehaviour - Create a target specific CustomBehaviour. diff --git a/llvm/lib/CodeGen/CodeGenTargetMachineImpl.cpp b/llvm/lib/CodeGen/CodeGenTargetMachineImpl.cpp index 442ec38409307..5d7e2b59c2047 100644 --- a/llvm/lib/CodeGen/CodeGenTargetMachineImpl.cpp +++ b/llvm/lib/CodeGen/CodeGenTargetMachineImpl.cpp @@ -45,7 +45,7 @@ static cl::opt<bool> EnableNoTrapAfterNoreturn( "after noreturn calls, even if --trap-unreachable is set.")); void CodeGenTargetMachineImpl::initAsmInfo() { - MRI.reset(TheTarget.createMCRegInfo(getTargetTriple().str())); + MRI.reset(TheTarget.createMCRegInfo(getTargetTriple())); assert(MRI && "Unable to create reg info"); MII.reset(TheTarget.createMCInstrInfo()); assert(MII && "Unable to create instruction info"); @@ -53,12 +53,12 @@ void CodeGenTargetMachineImpl::initAsmInfo() { // to some backends having subtarget feature dependent module level // code generation. This is similar to the hack in the AsmPrinter for // module level assembly etc. - STI.reset(TheTarget.createMCSubtargetInfo( - getTargetTriple().str(), getTargetCPU(), getTargetFeatureString())); + STI.reset(TheTarget.createMCSubtargetInfo(getTargetTriple(), getTargetCPU(), + getTargetFeatureString())); assert(STI && "Unable to create subtarget info"); - MCAsmInfo *TmpAsmInfo = TheTarget.createMCAsmInfo( - *MRI, getTargetTriple().str(), Options.MCOptions); + MCAsmInfo *TmpAsmInfo = + TheTarget.createMCAsmInfo(*MRI, getTargetTriple(), Options.MCOptions); // TargetSelect.h moved to a different directory between LLVM 2.9 and 3.0, // and if the old one gets included then MCAsmInfo will be NULL and // we'll crash later. diff --git a/llvm/lib/DWARFLinker/Classic/DWARFStreamer.cpp b/llvm/lib/DWARFLinker/Classic/DWARFStreamer.cpp index 4e4d86e5cb8d1..1c0ddc8e1ca30 100644 --- a/llvm/lib/DWARFLinker/Classic/DWARFStreamer.cpp +++ b/llvm/lib/DWARFLinker/Classic/DWARFStreamer.cpp @@ -55,7 +55,7 @@ Error DwarfStreamer::init(Triple TheTriple, TripleName = TheTriple.getTriple(); // Create all the MC Objects. - MRI.reset(TheTarget->createMCRegInfo(TripleName)); + MRI.reset(TheTarget->createMCRegInfo(TheTriple)); if (!MRI) return createStringError(std::errc::invalid_argument, "no register info for target %s", @@ -64,12 +64,12 @@ Error DwarfStreamer::init(Triple TheTriple, MCTargetOptions MCOptions = mc::InitMCTargetOptionsFromFlags(); MCOptions.AsmVerbose = true; MCOptions.MCUseDwarfDirectory = MCTargetOptions::EnableDwarfDirectory; - MAI.reset(TheTarget->createMCAsmInfo(*MRI, TripleName, MCOptions)); + MAI.reset(TheTarget->createMCAsmInfo(*MRI, TheTriple, MCOptions)); if (!MAI) return createStringError(std::errc::invalid_argument, "no asm info for target %s", TripleName.c_str()); - MSTI.reset(TheTarget->createMCSubtargetInfo(TripleName, "", "")); + MSTI.reset(TheTarget->createMCSubtargetInfo(TheTriple, "", "")); if (!MSTI) return createStringError(std::errc::invalid_argument, "no subtarget info for target %s", diff --git a/llvm/lib/DWARFLinker/Parallel/DWARFEmitterImpl.cpp b/llvm/lib/DWARFLinker/Parallel/DWARFEmitterImpl.cpp index 379f60b0bfb96..9222235d7a41e 100644 --- a/llvm/lib/DWARFLinker/Parallel/DWARFEmitterImpl.cpp +++ b/llvm/lib/DWARFLinker/Parallel/DWARFEmitterImpl.cpp @@ -35,7 +35,7 @@ Error DwarfEmitterImpl::init(Triple TheTriple, TripleName = TheTriple.getTriple(); // Create all the MC Objects. - MRI.reset(TheTarget->createMCRegInfo(TripleName)); + MRI.reset(TheTarget->createMCRegInfo(TheTriple)); if (!MRI) return createStringError(std::errc::invalid_argument, "no register info for target %s", @@ -44,12 +44,12 @@ Error DwarfEmitterImpl::init(Triple TheTriple, MCTargetOptions MCOptions = mc::InitMCTargetOptionsFromFlags(); MCOptions.AsmVerbose = true; MCOptions.MCUseDwarfDirectory = MCTargetOptions::EnableDwarfDirectory; - MAI.reset(TheTarget->createMCAsmInfo(*MRI, TripleName, MCOptions)); + MAI.reset(TheTarget->createMCAsmInfo(*MRI, TheTriple, MCOptions)); if (!MAI) return createStringError(std::errc::invalid_argument, "no asm info for target %s", TripleName.c_str()); - MSTI.reset(TheTarget->createMCSubtargetInfo(TripleName, "", "")); + MSTI.reset(TheTarget->createMCSubtargetInfo(TheTriple, "", "")); if (!MSTI) return createStringError(std::errc::invalid_argument, "no subtarget info for target %s", diff --git a/llvm/lib/DWARFLinker/Parallel/DebugLineSectionEmitter.h b/llvm/lib/DWARFLinker/Parallel/DebugLineSectionEmitter.h index b035c4b1d6c30..03c0566f58f82 100644 --- a/llvm/lib/DWARFLinker/Parallel/DebugLineSectionEmitter.h +++ b/llvm/lib/DWARFLinker/Parallel/DebugLineSectionEmitter.h @@ -73,19 +73,19 @@ class DebugLineSectionEmitter { TripleName = TheTriple.getTriple(); // Create all the MC Objects. - MRI.reset(TheTarget->createMCRegInfo(TripleName)); + MRI.reset(TheTarget->createMCRegInfo(TheTriple)); if (!MRI) return createStringError(std::errc::invalid_argument, "no register info for target %s", TripleName.c_str()); MCTargetOptions MCOptions = mc::InitMCTargetOptionsFromFlags(); - MAI.reset(TheTarget->createMCAsmInfo(*MRI, TripleName, MCOptions)); + MAI.reset(TheTarget->createMCAsmInfo(*MRI, TheTriple, MCOptions)); if (!MAI) return createStringError(std::errc::invalid_argument, "no asm info for target %s", TripleName.c_str()); - MSTI.reset(TheTarget->createMCSubtargetInfo(TripleName, "", "")); + MSTI.reset(TheTarget->createMCSubtargetInfo(TheTriple, "", "")); if (!MSTI) return createStringError(std::errc::invalid_argument, "no subtarget info for target %s", diff --git a/llvm/lib/DebugInfo/LogicalView/Readers/LVBinaryReader.cpp b/llvm/lib/DebugInfo/LogicalView/Readers/LVBinaryReader.cpp index 0df9137a3bd37..0d0383158dd48 100644 --- a/llvm/lib/DebugInfo/LogicalView/Readers/LVBinaryReader.cpp +++ b/llvm/lib/DebugInfo/LogicalView/Readers/LVBinaryReader.cpp @@ -274,9 +274,10 @@ void LVBinaryReader::mapVirtualAddress(const object::COFFObjectFile &COFFObj) { }); } -Error LVBinaryReader::loadGenericTargetInfo(StringRef TheTriple, +Error LVBinaryReader::loadGenericTargetInfo(StringRef TripleName, StringRef TheFeatures, StringRef TheCPU) { + Triple TheTriple(TripleName); std::string TargetLookupError; const Target *TheTarget = TargetRegistry::lookupTarget(TheTriple, TargetLookupError); @@ -287,7 +288,7 @@ Error LVBinaryReader::loadGenericTargetInfo(StringRef TheTriple, MCRegisterInfo *RegisterInfo = TheTarget->createMCRegInfo(TheTriple); if (!RegisterInfo) return createStringError(errc::invalid_argument, - "no register info for target " + TheTriple); + "no register info for target " + TripleName); MRI.reset(RegisterInfo); // Assembler properties and features. @@ -295,7 +296,7 @@ Error LVBinaryReader::loadGenericTargetInfo(StringRef TheTriple, MCAsmInfo *AsmInfo(TheTarget->createMCAsmInfo(*MRI, TheTriple, MCOptions)); if (!AsmInfo) return createStringError(errc::invalid_argument, - "no assembly info for target " + TheTriple); + "no assembly info for target " + TripleName); MAI.reset(AsmInfo); // Target subtargets. @@ -303,14 +304,14 @@ Error LVBinaryReader::loadGenericTargetInfo(StringRef TheTriple, TheTarget->createMCSubtargetInfo(TheTriple, TheCPU, TheFeatures)); if (!SubtargetInfo) return createStringError(errc::invalid_argument, - "no subtarget info for target " + TheTriple); + "no subtarget info for target " + TripleName); STI.reset(SubtargetInfo); // Instructions Info. MCInstrInfo *InstructionInfo(TheTarget->createMCInstrInfo()); if (!InstructionInfo) return createStringError(errc::invalid_argument, - "no instruction info for target " + TheTriple); + "no instruction info for target " + TripleName); MII.reset(InstructionInfo); MC = std::make_unique<MCContext>(Triple(TheTriple), MAI.get(), MRI.get(), @@ -320,7 +321,7 @@ Error LVBinaryReader::loadGenericTargetInfo(StringRef TheTriple, MCDisassembler *DisAsm(TheTarget->createMCDisassembler(*STI, *MC)); if (!DisAsm) return createStringError(errc::invalid_argument, - "no disassembler for target " + TheTriple); + "no disassembler for target " + TripleName); MD.reset(DisAsm); MCInstPrinter *InstructionPrinter(TheTarget->createMCInstPrinter( @@ -328,7 +329,7 @@ Error LVBinary... [truncated] `````````` </details> https://github.com/llvm/llvm-project/pull/157321 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits