Commit Graph

8 Commits

Author SHA1 Message Date
Pietro Fezzardi 5aaff6a524 AddSCEVBarrierPass: handle barriers on struct ptrs 2021-04-28 18:14:41 +02:00
Pietro Fezzardi 36a525314a Detect isolated functions using FunctionTags 2021-04-27 21:19:06 +02:00
Alessandro Di Federico 690e5fd9bd Update LoadModelPass usage 2021-03-16 12:01:15 +01:00
Pietro Fezzardi e95c21db25 Use Model to detect isolated functions 2021-02-23 10:39:05 +01:00
Pietro Fezzardi 4767fa63c3 Fixed emission for local_sp and scev_barrier
This commit fixes a bug due to interacting behaviors between
MarkForSerialization, AddSCEVBarrierPass, and the emission in C of calls
to revng_init_local_sp.

These interacting behaviors caused the following quirks:
- At the beginning of Functions that contained a call to
  `revng_init_local_sp()`, that call was actually emitted twice.
  The first time was due to the actual call to `revng_init_local_sp()`,
  while the second was due to the first call being wrapped from a call
  to `revng_scev_barrier_*`.
  Now we properly emit only one call.
- The original call to `revng_init_local_sp()` was supposed to generate
  a local variable, to be used in various places across the function.
  However, due to the fact that the call was not properly labeled by
  MarkForSerialization, there was no local variable, causing calls to
  `revng_init_local_sp()` to be scattered around the body of the
  functions, follwed by various arithmetic operations.
  This behavior has been fixed as well, and we now emit the local
  variable correctly.
2021-02-02 11:23:53 +01:00
Pietro Fezzardi 3f1ee6ea64 Stub of DLA integration in Clang AST emission 2021-02-02 11:23:53 +01:00
Pietro Fezzardi 3b3dbc3a8b Add end-to-end tests for AddSCEVBarrierPass 2021-02-02 11:23:53 +01:00
Pietro Fezzardi 3cbd8f2254 Create AddSCEVBarrierPass
This `FunctionPass` uses the results of `MarkForSerializationPass`, if
present, to wrap some instructions into calls to `revng_scev_barrier_*`
functions.

`revng_scev_barrier_*` functions have names that are deterministically
constructed from the type they wrap.
They have the semantics of an identity function, but we don't provide
the body, so that LLVM's ScalarEvolution Analysis cannot see through
them.

At the moment, the inserted function calls are not manipulated anywhere
else in the codebase, but we plan to use this mechanism in the
decompilation pass to prune the expressions that are converted to
pointer arithmetic.
2021-02-02 11:23:53 +01:00