Skip to content

Commit 61cc7a6

Browse files
committed
sil-opt: add an option "-serialize" for testing serialization.
This is similar to the existing -emit-sib, except that not everything is serialized, but only functions which are marked as "serializable".
1 parent 9a75847 commit 61cc7a6

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tools/sil-opt/SILOpt.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,9 @@ EmitVerboseSIL("emit-verbose-sil",
241241
static llvm::cl::opt<bool>
242242
EmitSIB("emit-sib", llvm::cl::desc("Emit serialized AST + SIL file(s)"));
243243

244+
static llvm::cl::opt<bool>
245+
Serialize("serialize", llvm::cl::desc("Emit serialized AST + SIL file(s)"));
246+
244247
static llvm::cl::opt<std::string>
245248
ModuleCachePath("module-cache-path", llvm::cl::desc("Clang module cache path"));
246249

@@ -605,7 +608,7 @@ int main(int argc, char **argv) {
605608
}
606609
}
607610

608-
if (EmitSIB) {
611+
if (EmitSIB || Serialize) {
609612
llvm::SmallString<128> OutputFile;
610613
if (OutputFilename.size()) {
611614
OutputFile = OutputFilename;
@@ -621,8 +624,8 @@ int main(int argc, char **argv) {
621624

622625
SerializationOptions serializationOpts;
623626
serializationOpts.OutputPath = OutputFile.c_str();
624-
serializationOpts.SerializeAllSIL = true;
625-
serializationOpts.IsSIB = true;
627+
serializationOpts.SerializeAllSIL = EmitSIB;
628+
serializationOpts.IsSIB = EmitSIB;
626629

627630
serialize(CI.getMainModule(), serializationOpts, SILMod.get());
628631
} else {

0 commit comments

Comments
 (0)