-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* WIP: Z3 all the things * Fix bugs * Fix bug * Combine whiles * Improve simplification * Better condition generation. Still slow. * Revert to simple substitution * Refactor ZCS * Refactor NCP * Fix NCP bugs * Fix condition sharing bug * Fix CBR * Temporarily disable RBR * Improve `else-if` recognition * Improve switch conditions generation * Factor out `Sort` * Sort during simplification, use faster simplify * Improve NCP * Remove RBR * Fix bug * Try improve performance * Reintroduce RBR * Fix NCP * Remove `IsConstant` Too slow * Reactivate RBR * Remove ignored tests * Fix CBR & RBR * Factor out RBR lambda * CBR & RBR review * Cleanup * Remove `nc` from tools * Maybe this time `HeavySimplify` will work? * Rename "Provenance" to "DecompilationContext" * Remove temporary variables for `load`s * Rename `POISON_IDX` * Put all aliases inside `DecompilationContext` * Rename `Sort` to `OrderById` * Revert useless change * Simplify exit * Short-circuit slow condition * Add explanation * Add comments for `KnownExprs` * Map expression directly by id * Add small comment * Factor out CBR * Rename parameter for clarity * Factor out `ToExpr` * Early returns * More cleanup * More cleanup * Factor out stuff in NCP * Create wrapper method for Z3 expressions * Add comments for maps * Cleanup and comment `ConvertExpr` * More comments * Remove old comment * More comments
- Loading branch information
Showing
47 changed files
with
1,010 additions
and
2,570 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,8 @@ | ||
{ | ||
"tests.ignore": [ | ||
"amd64/linux/tools/perf/bench/extr_numa.c___bench_numa.bc", | ||
"amd64/SoftEtherVPN/src/See/extr_memory_t.h_SW_LONG_AT.bc", | ||
"arm64/linux/tools/perf/bench/extr_numa.c___bench_numa.bc", | ||
"arm64/SoftEtherVPN/src/See/extr_memory_t.h_SW_LONG_AT.bc", | ||
"armv7/linux/tools/perf/bench/extr_numa.c___bench_numa.bc", | ||
"armv7/SoftEtherVPN/src/See/extr_memory_t.h_SW_LONG_AT.bc", | ||
"x86/linux/tools/perf/bench/extr_numa.c___bench_numa.bc", | ||
"x86/SoftEtherVPN/src/See/extr_memory_t.h_SW_LONG_AT.bc" | ||
] | ||
} |
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
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
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,37 @@ | ||
/* | ||
* Copyright (c) 2021-present, Trail of Bits, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed in accordance with the terms specified in | ||
* the LICENSE file found in the root directory of this source tree. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <clang/AST/ASTContext.h> | ||
|
||
#include "rellic/AST/IRToASTVisitor.h" | ||
#include "rellic/AST/TransformVisitor.h" | ||
|
||
namespace rellic { | ||
|
||
/* | ||
* This pass substitutes the marker expression in loops and `if` statements for | ||
* their translation from Z3 formulas | ||
*/ | ||
class MaterializeConds : public TransformVisitor<MaterializeConds> { | ||
private: | ||
IRToASTVisitor ast_gen; | ||
|
||
protected: | ||
void RunImpl() override; | ||
|
||
public: | ||
MaterializeConds(DecompilationContext &dec_ctx, clang::ASTUnit &unit); | ||
|
||
bool VisitIfStmt(clang::IfStmt *stmt); | ||
bool VisitWhileStmt(clang::WhileStmt *loop); | ||
bool VisitDoStmt(clang::DoStmt *loop); | ||
}; | ||
|
||
} // namespace rellic |
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 was deleted.
Oops, something went wrong.
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
Oops, something went wrong.