-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disable iterative matching when proof hints are enabled (#887)
When proof hint generation is enabled, we want to be able to emit every intermediate configuration into the trace; the current implementation only does so when we are at a rewrite step that has not used iterative compilation to merge two decision tree matrices. This PR disables the use of iterative compilation and residuals when generating code with trace instrumentation. Doing so has no effect on the soundness of the generated code; iterative compilation is a rarely-used optimization. The first 3 commits in this PR are a slight refactoring of our usage of command-line options when running code generation.
- Loading branch information
Showing
8 changed files
with
117 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#ifndef CODEGEN_OPTIONS_H | ||
#define CODEGEN_OPTIONS_H | ||
|
||
#include "llvm/Support/CommandLine.h" | ||
|
||
enum class opt_level { O0, O1, O2, O3 }; | ||
|
||
extern llvm::cl::OptionCategory CodegenLibCat; | ||
|
||
extern llvm::cl::opt<bool> Debug; | ||
extern llvm::cl::opt<bool> NoOptimize; | ||
extern llvm::cl::opt<bool> EmitObject; | ||
extern llvm::cl::opt<bool> BinaryIR; | ||
extern llvm::cl::opt<bool> ForceBinary; | ||
extern llvm::cl::opt<bool> ProofHintInstrumentation; | ||
extern llvm::cl::opt<bool> KeepFramePointer; | ||
extern llvm::cl::opt<opt_level> OptimizationLevel; | ||
|
||
namespace kllvm { | ||
|
||
void validate_codegen_args(bool is_tty); | ||
|
||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
#include <kllvm/codegen/Options.h> | ||
|
||
using namespace llvm; | ||
|
||
cl::OptionCategory CodegenLibCat("Internal codegen options"); | ||
|
||
cl::opt<bool> ProofHintInstrumentation( | ||
"proof-hint-instrumentation", | ||
llvm::cl::desc("Enable instrumentation for generation of proof hints"), | ||
llvm::cl::cat(CodegenLibCat)); | ||
|
||
cl::opt<bool> KeepFramePointer( | ||
"fno-omit-frame-pointer", | ||
cl::desc("Keep frame pointer in compiled code for debugging purposes"), | ||
cl::cat(CodegenLibCat)); | ||
|
||
cl::opt<opt_level> OptimizationLevel( | ||
cl::desc("Choose optimization level"), | ||
cl::values( | ||
clEnumVal(opt_level::O0, "No optimizations"), | ||
clEnumVal(opt_level::O1, "Enable trivial optimizations"), | ||
clEnumVal(opt_level::O2, "Enable default optimizations"), | ||
clEnumVal(opt_level::O3, "Enable expensive optimizations")), | ||
cl::cat(CodegenLibCat)); | ||
|
||
cl::opt<bool> Debug( | ||
"debug", cl::desc("Enable debug information"), cl::ZeroOrMore, | ||
cl::cat(CodegenLibCat)); | ||
|
||
cl::opt<bool> NoOptimize( | ||
"no-optimize", | ||
cl::desc("Don't run optimization passes before producing output"), | ||
cl::cat(CodegenLibCat)); | ||
|
||
cl::opt<bool> EmitObject( | ||
"emit-object", | ||
cl::desc("Directly emit an object file to avoid separately invoking llc"), | ||
cl::cat(CodegenLibCat)); | ||
|
||
cl::opt<bool> BinaryIR( | ||
"binary-ir", cl::desc("Emit binary IR rather than text"), | ||
cl::cat(CodegenLibCat)); | ||
|
||
cl::opt<bool> ForceBinary( | ||
"f", cl::desc("Force binary bitcode output to stdout"), cl::Hidden, | ||
cl::cat(CodegenLibCat)); | ||
|
||
namespace kllvm { | ||
|
||
void validate_codegen_args(bool is_tty) { | ||
if (EmitObject && (BinaryIR || NoOptimize)) { | ||
throw std::runtime_error( | ||
"Cannot specify --emit-object with --binary-ir or --no-optimize"); | ||
} | ||
|
||
if ((EmitObject || BinaryIR) && is_tty && !ForceBinary) { | ||
throw std::runtime_error( | ||
"Not printing binary file to stdout; use -o to specify output path " | ||
"or force binary with -f\n"); | ||
} | ||
} | ||
|
||
} // namespace kllvm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters