Since when we added the -exit-ssa pass, allocas are never supposed to
reach the C backend anymore.
This commit drops the code that supports them, that was effectively dead
code since a quite long time.
This commit does various things oriented at reducing the number of local
variables emitted in C:
- MarkAssignments now know that @Copy and @Assign involving
@LocalVariable only have side effects that affect the local variable
itself; this enables to reduce the number of times we're forced to
emit a local variable due to interfering side effects
- Drop the @AssignmentMarker FunctionTag; AddAssignmentMarkerPass now
doesn't emit @AssignmentMarker anymore; instead it emits groups of
@LocalVariable, @Copy, and @Assign, which benefit from the previous
point
- Drop 2 MarkAssignments::Reasons: HasManyUses and HasUsesOutsideOfBB;
both these have now been aggregated into the AlwaysAssign reason for
simplicity, representing all reasons non involving side effects
- Update BeautifyGHAST and how it reasons about side effects when
beautifying; before this commit it used @AssignmentMarker, now it
looks at @Assign
- Simplify ExitSSA; before this commit it was trying hard to be smart on
where it emitted the store instructions representing the incoming
values of the PHI that was being destroyed; this seemed smart when we
originally did it but it generated C code that was not really better
to read, so this useless complexity is finally gone
This commit adds a new pass, PrettyIntFormatting, that injects calls to
decorator functions print_hex, print_char, and print_bool around
llvm::ConstantInt in various situations.
It also updates the rest of passes of the decompilation pipelin to
understand these new decorator functions and to properly emit decorated
integer literals in the decompiled C code.
The actual ptml::attributes::LocationDefinition for arguments is already
generated when emitting the prototype of the functions.
The removed calls were just serializing the location definition once
more and disposing of it without serializing it anywhere.
Before this commit, to emit field member accesses and array accesses in
C we performed a broken traversal of typedefs.
It was buggy since its inception but it was never triggered because no
typedefs actually reached this point.
This commit fixes that using the reworked peelConstAndTypedefs
machinery.
This commit removes the bugged addPointerQualifier helper function,
that was wrongly pushing the pointer qualifier at the end.
Instead, we now use the correct model::Binary::getPointerTo method.
In certain code paths, CCodeGenerator would trigger the emission of
`%[number]`, which is very expensive since it requires to assign an ID
to a large amount of `llvm::Value`.
This commit ensure this doesn't happen, unless a logger is active.