[SPIRV] Do not include input file in DebugEntryPoint args (#4650)
This commit is contained in:
Родитель
3eb2fa5b26
Коммит
8d34bcf59d
|
@ -92,8 +92,9 @@ struct SpirvCodeGenOptions {
|
|||
|
||||
bool printAll; // Dump SPIR-V module before each pass and after the last one.
|
||||
|
||||
// String representation of all command line options.
|
||||
// String representation of all command line options and input file.
|
||||
std::string clOptions;
|
||||
std::string inputFile;
|
||||
};
|
||||
|
||||
} // namespace spirv
|
||||
|
|
|
@ -649,9 +649,10 @@ SpirvEmitter::SpirvEmitter(CompilerInstance &ci)
|
|||
|
||||
// Emit OpModuleProcessed to indicate the command line options that were
|
||||
// used to generate this module.
|
||||
if (!spirvOptions.clOptions.empty()) {
|
||||
if (!spirvOptions.inputFile.empty() || !spirvOptions.clOptions.empty()) {
|
||||
// Using this format: "dxc-cl-option: XXXXXX"
|
||||
std::string clOptionStr = "dxc-cl-option:" + spirvOptions.clOptions;
|
||||
std::string clOptionStr =
|
||||
"dxc-cl-option: " + spirvOptions.inputFile + spirvOptions.clOptions;
|
||||
spvBuilder.addModuleProcessed(clOptionStr);
|
||||
}
|
||||
}
|
||||
|
@ -1306,14 +1307,11 @@ void SpirvEmitter::doFunctionDecl(const FunctionDecl *decl) {
|
|||
return;
|
||||
// Generate DebugEntryPoint if function definition
|
||||
if (spirvOptions.debugInfoVulkan && debugFunction) {
|
||||
std::string commitHash = clang::getGitCommitHash();
|
||||
std::string clOptionStr;
|
||||
if (!spirvOptions.clOptions.empty())
|
||||
clOptionStr = spirvOptions.clOptions;
|
||||
auto *cu = dyn_cast<SpirvDebugCompilationUnit>(outer_scope);
|
||||
assert(cu && "expected DebugCompilationUnit");
|
||||
spvBuilder.createDebugEntryPoint(debugFunction, cu, commitHash,
|
||||
clOptionStr);
|
||||
spvBuilder.createDebugEntryPoint(debugFunction, cu,
|
||||
clang::getGitCommitHash(),
|
||||
spirvOptions.clOptions);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
// CHECK: [[fooName:%\d+]] = OpString "foo"
|
||||
// CHECK: [[emptyStr:%\d+]] = OpString ""
|
||||
// CHECK: [[mainName:%\d+]] = OpString "main"
|
||||
// CHECK: [[clOpts:%\d+]] = OpString " -E main -T ps_6_0 -spirv -fcgl -Vd -fspv-debug=vulkan -Qembed_debug"
|
||||
|
||||
// CHECK: [[int:%\d+]] = OpExtInst %void [[set]] DebugTypeBasic {{%\d+}} %uint_32 %uint_4 %uint_0
|
||||
// CHECK: [[float:%\d+]] = OpExtInst %void [[set]] DebugTypeBasic {{%\d+}} %uint_32 %uint_3 %uint_0
|
||||
|
@ -16,12 +17,12 @@
|
|||
|
||||
// Check DebugFunction instructions
|
||||
//
|
||||
// CHECK: {{%\d+}} = OpExtInst %void [[set]] DebugFunction [[fooName]] [[fooFnType]] [[source]] %uint_34 %uint_1 [[compilationUnit]] [[emptyStr]] %uint_3 %uint_35
|
||||
// CHECK: {{%\d+}} = OpExtInst %void [[set]] DebugFunction [[fooName]] [[fooFnType]] [[source]] %uint_35 %uint_1 [[compilationUnit]] [[emptyStr]] %uint_3 %uint_36
|
||||
|
||||
// CHECK: [[float4:%\d+]] = OpExtInst %void [[set]] DebugTypeVector [[float]] %uint_4
|
||||
// CHECK: [[mainFnType:%\d+]] = OpExtInst %void [[set]] DebugTypeFunction %uint_3 [[float4]] [[float4]]
|
||||
// CHECK: [[mainDbgFn:%\d+]] = OpExtInst %void [[set]] DebugFunction [[mainName]] [[mainFnType]] [[source]] %uint_39 %uint_1 [[compilationUnit]] [[emptyStr]] %uint_3 %uint_40
|
||||
// CHECK: [[mainDbgEp:%\d+]] = OpExtInst %void [[set]] DebugEntryPoint [[mainDbgFn]] [[compilationUnit]] {{%\d+}} {{%\d+}}
|
||||
// CHECK: [[mainDbgFn:%\d+]] = OpExtInst %void [[set]] DebugFunction [[mainName]] [[mainFnType]] [[source]] %uint_40 %uint_1 [[compilationUnit]] [[emptyStr]] %uint_3 %uint_41
|
||||
// CHECK: [[mainDbgEp:%\d+]] = OpExtInst %void [[set]] DebugEntryPoint [[mainDbgFn]] [[compilationUnit]] {{%\d+}} [[clOpts]]
|
||||
|
||||
// Check DebugFunctionDefintion is in main
|
||||
//
|
||||
|
|
|
@ -1019,10 +1019,16 @@ public:
|
|||
opts.SpirvOptions.codeGenHighLevel = opts.CodeGenHighLevel;
|
||||
opts.SpirvOptions.defaultRowMajor = opts.DefaultRowMajor;
|
||||
opts.SpirvOptions.disableValidation = opts.DisableValidation;
|
||||
// Store a string representation of command line options.
|
||||
if (opts.DebugInfo)
|
||||
for (auto opt : mainArgs.getArrayRef())
|
||||
// Save a string representation of command line options and
|
||||
// input file name.
|
||||
if (opts.DebugInfo) {
|
||||
opts.SpirvOptions.inputFile = opts.InputFile;
|
||||
for (auto opt : mainArgs.getArrayRef()) {
|
||||
if (opts.InputFile.compare(opt) != 0) {
|
||||
opts.SpirvOptions.clOptions += " " + std::string(opt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
compiler.getCodeGenOpts().SpirvOptions = opts.SpirvOptions;
|
||||
clang::EmitSpirvAction action;
|
||||
|
|
Загрузка…
Ссылка в новой задаче