Skip to content

Commit

Permalink
Removed outputs.
Browse files Browse the repository at this point in the history
  • Loading branch information
sifislag committed Jul 31, 2019
1 parent 1a35e7c commit 655cda8
Showing 1 changed file with 23 additions and 21 deletions.
44 changes: 23 additions & 21 deletions logic/functions.dl
Original file line number Diff line number Diff line change
@@ -1,6 +1,29 @@
#define MAX_FUNCTION_ARGS (MAX_STACK_HEIGHT/4)
#define FRESH_VARIABLE(var, stmt, stackIndex) (IRStatementNum((stmt), _stmtNum), var=-0xFFFF+_stmtNum*MAX_STACK_HEIGHT+(stackIndex))


#ifdef DEBUG
.output MaybeFunctionCallReturn // DEBUG
.output IsContext, CanReachUnderContext, CanReachUnderContextThroughBlock //DEBUG
.output PotentialCall // DEBUG
.output PossibleReturnAddress // DEBUG
.output IsFunctionCallReturn // DEBUG
.output IsFunctionEntry, IsFunctionCall, BlockToClone, MaybeInFunction // DEBUG
.output PossibleFunctionEdgePopAndStackDeltaBypassing
.output PossibleImpreciseNumberOfFunctionArguments

.output EdgePopDelta
.output EdgeStackDelta
.output PossibleFunctionEdgePopDelta
.output PossibleFunctionEdgeStackDelta
.output PossibleNumberOfFunctionArguments
.output PossibleNumberOfFunctionReturnArguments
.output PossibleCombinedNumberOfFunctionReturnsAndArguments
.output NumberOfFunctionArguments
.output NumberOfFunctionReturnArguments
#endif


/*****
* Function discovery logic
*****/
Expand Down Expand Up @@ -86,7 +109,6 @@ CanReachUnderContextThroughBlock(fromCtx, from, through, ctx, block) :-
CanReach(from, to) :-
CanReachUnderContext(_, from, _, to).

.output IsContext, CanReachUnderContext, CanReachUnderContextThroughBlock //DEBUG


/******
Expand All @@ -101,7 +123,6 @@ CanReach(from, to) :-
PotentialCall(block) :-
ImmediateBlockJumpTarget(block, _).

.output PotentialCall // DEBUG

// Call-return pattern:
// a) basic block jumps to a valid "non-locally-derived" address
Expand All @@ -119,7 +140,6 @@ OptNotImmediateBlockJumpTarget(retBlock, targetVariable, retTarget) :-
BlockJumpValidTarget(_, retBlock, targetVariable, retTarget),
!ImmediateBlockJumpTarget(retBlock, targetVariable).

.output PossibleReturnAddress // DEBUG

// Also match a subset of those with return addresses and full info. The
// function may not be the one containing the return, in case of complex
Expand All @@ -144,7 +164,6 @@ MaybeFunctionCallReturn(caller, func, retBlock, retTarget) :-
CanReach(caller, retTarget),
CanReach(func, retBlock).

.output MaybeFunctionCallReturn // DEBUG

// Seems pretty certain we found a return. In fact, at this point,
// with the above logic, we have detected all original return
Expand Down Expand Up @@ -199,7 +218,6 @@ IsFunctionCallReturn(caller, func, retBlock, retTarget) :-
!NotValidReturnBlock(func, retBlock),
!NotValidReturnEdge(retBlock, retTarget).

.output IsFunctionCallReturn // DEBUG


// NOTE the philosophy! MaybeFunctionCallReturn intends to be
Expand Down Expand Up @@ -276,8 +294,6 @@ BlockToClone(next, func) :-
next != func. // don't clone function entries, other functions will clone them


.output IsFunctionEntry, IsFunctionCall, BlockToClone, MaybeInFunction // DEBUG



/***********
Expand Down Expand Up @@ -699,7 +715,6 @@ StackSimulationLimit(depth) :-
// (EnableCostlyAlgorithms(), depth = MAX_STACK_HEIGHT);
// (!EnableCostlyAlgorithms(), depth = MAX_STACK_HEIGHT / 5).

.output PossibleFunctionEdgePopAndStackDeltaBypassing

.decl PossibleFunctionEdgePopDelta(func: IRFunction, to: IRBlock, delta: StackIndex)
.decl PossibleFunctionEdgeStackDelta(func: IRFunction, to: IRBlock, delta: StackIndex)
Expand Down Expand Up @@ -738,7 +753,6 @@ PossibleCombinedNumberOfFunctionReturnsAndArguments(func, terminal, numArg, numR
PossibleImpreciseNumberOfFunctionArguments(func, numArg) :-
PossibleCombinedNumberOfFunctionReturnsAndArguments(func, _, numArg, _).

.output PossibleImpreciseNumberOfFunctionArguments

// Our more precise inferences
.decl PossibleNumberOfFunctionArguments(func: IRFunction, num: StackIndex)
Expand Down Expand Up @@ -773,18 +787,6 @@ NumberOfFunctionReturnArguments(func, n) :-
n = max m : PossibleNumberOfFunctionReturnArguments(func, m).


/// DEBUG
.output EdgePopDelta
.output EdgeStackDelta
.output PossibleFunctionEdgePopDelta
.output PossibleFunctionEdgeStackDelta
.output PossibleNumberOfFunctionArguments
.output PossibleNumberOfFunctionReturnArguments
.output PossibleCombinedNumberOfFunctionReturnsAndArguments
.output NumberOfFunctionArguments
.output NumberOfFunctionReturnArguments




.decl Variable_String(var:Variable, var_rep:symbol)
Expand Down

0 comments on commit 655cda8

Please sign in to comment.