mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-26 04:32:44 +01:00
[llc] Initialize TargetOptions after Triple is available
Some targets have different defaults. This patch defers initialization of `TargetOptions` so that a future patch can pass `TargetOptions` to `InitTargetOptionsFromCodeGenFlags` Reviewed By: jasonliu Differential Revision: https://reviews.llvm.org/D88748
This commit is contained in:
parent
a827dbae48
commit
3f6a90dc9a
@ -424,14 +424,17 @@ static int compileModule(char **argv, LLVMContext &Context) {
|
||||
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 = [&](const 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 @@ static int compileModule(char **argv, LLVMContext &Context) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
InitializeOptions(TheTriple);
|
||||
Target = std::unique_ptr<TargetMachine>(TheTarget->createTargetMachine(
|
||||
TheTriple.getTriple(), CPUStr, FeaturesStr, Options, RM,
|
||||
codegen::getExplicitCodeModel(), OLvl));
|
||||
@ -510,6 +514,7 @@ static int compileModule(char **argv, LLVMContext &Context) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
InitializeOptions(TheTriple);
|
||||
Target = std::unique_ptr<TargetMachine>(TheTarget->createTargetMachine(
|
||||
TheTriple.getTriple(), CPUStr, FeaturesStr, Options, RM,
|
||||
codegen::getExplicitCodeModel(), OLvl));
|
||||
|
Loading…
Reference in New Issue
Block a user