The default escaping variables analysis is very conservative and makes all variables escaping by annotating their declaration with Stack(x).

In order for your compiler to produce good code is necessary to put as many variables as possible into registers.

Extend module Tiger-VarEscape.r in directory tas2ir/ in the TigerTrans package to detect only really escaping variables.

Sketch of the algorithm

  • In principle every variable is non-escaping, i.e., its name x in its declaration should be transformed into Reg(x).

  • If a variable is used inside a function that is different than the function it is declared in, the variable is escaping and its name x in its declaration should be transformed into Stack(x).

The analysis can be very nicely expressed in a single traversal over the program tree using dynamic rules.

-- EelcoVisser - 16 Nov 2001

Revision: r1.1 - 16 Nov 2001 - 20:42 - EelcoVisser
Tiger > HpcAssignments > DetectEscapingVariables
Copyright © 1999-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback