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.
Before this commit, the code assumed that whenever we had multiple
return types on the model we had an aggregate return type also in LLVM
IR. This is not true anymore with CABIFunctionType, where many model
types can be stuffed into a single wide integer in LLVM IR.
This commit fixes the code to be able to handle that situation.
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.
1. Add a common helper to traverse ModelGEPs (`traverseModelGEP`)
2. Add a centralized way to deduce the model type of values that
have strong model information attached to them (e.g. isolated
functions and ModelGEPs)
3. Add a similar helper for deducing formal types of operands in known
cases
A simple pass that maps LLVM IR instructions to C operators,
taking into account their precedence and associativity to
emit nice-looking parenthesized expressions.
A pass that strips the casts off from some instructions, including
`ModelGEP`s, general function calls, return and store ones, and
embeds the cast into new dedicated `ModelCast` function calls.
This library replaces the old AddIRSerializationMarkers, cleaning up a
lot of historcal baggage, merging Liveness and MarkAnalysis, and
adopting a more accurate naming across all the codebase.