Reduce the number of emitted local variables in C

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 is contained in:
Pietro Fezzardi
2022-12-20 18:20:36 +01:00
parent c201990e5b
commit e9d84264ff
23 changed files with 484 additions and 897 deletions
@@ -413,7 +413,6 @@ static bool connect(TypeFlowNode *N1, TypeFlowNode *N2) {
// These opcodes are transparent
if (FunctionTags::Parentheses.isTagOf(Callee)
or FunctionTags::AssignmentMarker.isTagOf(Callee)
or FunctionTags::Copy.isTagOf(Callee))
return AddBidirectionalEdge(UseNode, ValNode, ALL_COLORS);
}