gccint: Temporaries
1
1 12.5 Temporaries
1 ================
1
1 When gimplification encounters a subexpression that is too complex, it
1 creates a new temporary variable to hold the value of the subexpression,
1 and adds a new statement to initialize it before the current statement.
1 These special temporaries are known as 'expression temporaries', and are
1 allocated using 'get_formal_tmp_var'. The compiler tries to always
1 evaluate identical expressions into the same temporary, to simplify
1 elimination of redundant calculations.
1
1 We can only use expression temporaries when we know that it will not be
1 reevaluated before its value is used, and that it will not be otherwise
1 modified(1). Other temporaries can be allocated using
1 'get_initialized_tmp_var' or 'create_tmp_var'.
1
1 Currently, an expression like 'a = b + 5' is not reduced any further.
1 We tried converting it to something like
1 T1 = b + 5;
1 a = T1;
1 but this bloated the representation for minimal benefit. However, a
1 variable which must live in memory cannot appear in an expression; its
1 value is explicitly loaded into a temporary first. Similarly, storing
1 the value of an expression to a memory variable goes through a
1 temporary.
1
1 ---------- Footnotes ----------
1
1 (1) These restrictions are derived from those in Morgan 4.8.
1