Skip to content

Commit 982ed06

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 e13a614 commit 982ed06

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
@@ -228,6 +228,9 @@ EmitVerboseSIL("emit-verbose-sil",
228228
static llvm::cl::opt<bool>
229229
EmitSIB("emit-sib", llvm::cl::desc("Emit serialized AST + SIL file(s)"));
230230

231+
static llvm::cl::opt<bool>
232+
Serialize("serialize", llvm::cl::desc("Emit serialized AST + SIL file(s)"));
233+
231234
static llvm::cl::opt<std::string>
232235
ModuleCachePath("module-cache-path", llvm::cl::desc("Clang module cache path"));
233236

@@ -564,7 +567,7 @@ int main(int argc, char **argv) {
564567
}
565568
}
566569

567-
if (EmitSIB) {
570+
if (EmitSIB || Serialize) {
568571
llvm::SmallString<128> OutputFile;
569572
if (OutputFilename.size()) {
570573
OutputFile = OutputFilename;
@@ -580,8 +583,8 @@ int main(int argc, char **argv) {
580583

581584
SerializationOptions serializationOpts;
582585
serializationOpts.OutputPath = OutputFile.c_str();
583-
serializationOpts.SerializeAllSIL = true;
584-
serializationOpts.IsSIB = true;
586+
serializationOpts.SerializeAllSIL = EmitSIB;
587+
serializationOpts.IsSIB = EmitSIB;
585588

586589
serialize(CI.getMainModule(), serializationOpts, SILMod.get());
587590
} else {

0 commit comments

Comments
 (0)