Skip to content

Commit

Permalink
[sil-opt] Add a new option -disable-sil-linking to dump swiftmodules …
Browse files Browse the repository at this point in the history
…"as is"

Usually, if you use `sil-opt my.swiftmodule` it would dump a lot of SIL, because it would try to link external SIL functions linked by the module (e.g. functions from the standard library) and dump them as well.

The new option allows for dumping only the SIL contained in the swiftmodule. This is very useful if you want to inspect the content of a swiftmodule.
  • Loading branch information
swiftix committed Mar 24, 2017
1 parent cc5ece7 commit c01a953
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tools/sil-opt/SILOpt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ static llvm::cl::opt<unsigned>
AssertConfId("assert-conf-id", llvm::cl::Hidden,
llvm::cl::init(0));

static llvm::cl::opt<bool>
DisableSILLinking("disable-sil-linking",
llvm::cl::desc("Disable SIL linking"));

static llvm::cl::opt<int>
SILInlineThreshold("sil-inline-threshold", llvm::cl::Hidden,
llvm::cl::init(-1));
Expand Down Expand Up @@ -324,7 +328,7 @@ int main(int argc, char **argv) {
std::unique_ptr<SerializedSILLoader> SL = SerializedSILLoader::create(
CI.getASTContext(), CI.getSILModule(), nullptr);

if (extendedInfo.isSIB())
if (extendedInfo.isSIB() || DisableSILLinking)
SL->getAllForModule(CI.getMainModule()->getName(), nullptr);
else
SL->getAll();
Expand Down

0 comments on commit c01a953

Please sign in to comment.