[PATCH] D88748: [llc] Initialize TargetOptions after Triple is available
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 2 10:32:03 PDT 2020
MaskRay created this revision.
MaskRay added reviewers: jasonliu, hubert.reinterpretcast.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
MaskRay requested review of this revision.
Some targets have different defaults.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D88748
Files:
llvm/tools/llc/llc.cpp
Index: llvm/tools/llc/llc.cpp
===================================================================
--- llvm/tools/llc/llc.cpp
+++ llvm/tools/llc/llc.cpp
@@ -424,14 +424,17 @@
case '3': OLvl = CodeGenOpt::Aggressive; break;
}
- TargetOptions Options = codegen::InitTargetOptionsFromCodeGenFlags();
- Options.DisableIntegratedAS = NoIntegratedAssembler;
- Options.MCOptions.ShowMCEncoding = ShowMCEncoding;
- Options.MCOptions.MCUseDwarfDirectory = EnableDwarfDirectory;
- Options.MCOptions.AsmVerbose = AsmVerbose;
- Options.MCOptions.PreserveAsmComments = PreserveComments;
- Options.MCOptions.IASSearchPaths = IncludeDirs;
- Options.MCOptions.SplitDwarfFile = SplitDwarfFile;
+ TargetOptions Options;
+ auto InitializeOptions = [&](Triple &TheTriple) {
+ Options = codegen::InitTargetOptionsFromCodeGenFlags();
+ Options.DisableIntegratedAS = NoIntegratedAssembler;
+ Options.MCOptions.ShowMCEncoding = ShowMCEncoding;
+ Options.MCOptions.MCUseDwarfDirectory = EnableDwarfDirectory;
+ Options.MCOptions.AsmVerbose = AsmVerbose;
+ Options.MCOptions.PreserveAsmComments = PreserveComments;
+ Options.MCOptions.IASSearchPaths = IncludeDirs;
+ Options.MCOptions.SplitDwarfFile = SplitDwarfFile;
+ };
Optional<Reloc::Model> RM = codegen::getExplicitRelocModel();
@@ -466,6 +469,7 @@
exit(1);
}
+ InitializeOptions(TheTriple);
Target = std::unique_ptr<TargetMachine>(TheTarget->createTargetMachine(
TheTriple.getTriple(), CPUStr, FeaturesStr, Options, RM,
codegen::getExplicitCodeModel(), OLvl));
@@ -510,6 +514,7 @@
return 1;
}
+ InitializeOptions(TheTriple);
Target = std::unique_ptr<TargetMachine>(TheTarget->createTargetMachine(
TheTriple.getTriple(), CPUStr, FeaturesStr, Options, RM,
codegen::getExplicitCodeModel(), OLvl));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D88748.295866.patch
Type: text/x-patch
Size: 1867 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201002/834fa06f/attachment.bin>
More information about the llvm-commits
mailing list