Skip to content

Commit 135ab2b

Browse files
committed
[sil-opt] Add an option irgen-debuginfo-level to set the IRGen debug info level for IRGen passes.
This allows for IRGen passes to make decisions based off of the IRGen debug info level like they can when used by a swift-frontend invocation.
1 parent 6dde338 commit 135ab2b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tools/sil-opt/SILOpt.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,18 @@ static llvm::cl::opt<OptimizationMode> OptModeFlag(
296296
"ignore debug info, reduce runtime")),
297297
llvm::cl::init(OptimizationMode::NotSet));
298298

299+
static llvm::cl::opt<IRGenDebugInfoLevel> IRGenDebugInfoLevelArg(
300+
"irgen-debuginfo-level", llvm::cl::desc("IRGen debug info level"),
301+
llvm::cl::values(clEnumValN(IRGenDebugInfoLevel::None, "none",
302+
"No debug info"),
303+
clEnumValN(IRGenDebugInfoLevel::LineTables, "line-tables",
304+
"Line tables only"),
305+
clEnumValN(IRGenDebugInfoLevel::ASTTypes, "ast-types",
306+
"Line tables + AST type references"),
307+
clEnumValN(IRGenDebugInfoLevel::DwarfTypes, "dwarf-types",
308+
"Line tables + AST type refs + Dwarf types")),
309+
llvm::cl::init(IRGenDebugInfoLevel::ASTTypes));
310+
299311
static llvm::cl::opt<OptGroup> OptimizationGroup(
300312
llvm::cl::desc("Predefined optimization groups:"),
301313
llvm::cl::values(
@@ -684,6 +696,7 @@ int main(int argc, char **argv) {
684696
} else {
685697
IRGenOpts.OptMode = OptModeFlag;
686698
}
699+
IRGenOpts.DebugInfoLevel = IRGenDebugInfoLevelArg;
687700

688701
// Note: SILOpts, LangOpts, and IRGenOpts must be set before the
689702
// CompilerInstance is initializer below based on Invocation.

0 commit comments

Comments
 (0)