This commit teaches getExpectedModelType about the fact that various
bitwise operations are only allowed to have integer operands.
It also updates VMA, which uses getExpectedModelType, to take this
into account.
This commit introduces modelType, which supersedes `llvmIntToModelType`
in order to better handle translation of LLVM types into model types
after introduction of opaque pointer types. The main differences is
that `modelType` accepts the `Value` (instead of just the `Type`), so it
can better handle `AllocaInst` and `GlobalVariable`, which provide
information about the pointee.
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
Before this commit, the code was assuming that we only passed stack
arguments to fuctions with RawFunction type. This is not true anymore.
This commit adds support to getStrongModelInfo for when we are passing
stack arguments to CABIFunctionType.
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 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.
Change company name to "rev.ng Labs Srl" in all license headers
to reflect changed company name and legal status
Add missing license headers to files that didn't have one
Separate `ModelToHeader.cpp` into 3 different files:
1. DependencyGraph, used to calculate the precedence between
type declarations
2. ModelTypeNames, that holds all the naming logic, whose
primitives are accessible from other modules through a
public header
3. ModelToHeader, that now contains only the logic to print
out declarations and definitions
Also add a compilation test for the headers generated by this pass.