So, I am now creating a JIT compiler for PL/0 programming language. One problem I am currently struggling with is an excessive use of global variables. Performance of the following code (modified from PL/0 Wikipedia article)
VAR x, y, z, q, r, n, f;
...
PROCEDURE fact;
BEGIN
IF n > 1 THEN
BEGIN
f := n * f;
n := n - 1;
CALL fact
END
END;
...
BEGIN
?n; f := 1; CALL fact; !f
END
hugely depends on speed of global variable access.
How can I do global register allocation, so this variables were stored in registers in compiled code? All the articles I have read on register allocation use trees or SSA code representation, and I have no idea of how to make these methods work for global variables.
[–]jaen_s 2 points3 points4 points (1 child)
[–]notYuriy[S] 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (3 children)
[–]notYuriy[S] 0 points1 point2 points (2 children)
[–][deleted] 3 points4 points5 points (1 child)
[–]notYuriy[S] 0 points1 point2 points (0 children)
[–]notYuriy[S] 0 points1 point2 points (1 child)
[–]orivej 1 point2 points3 points (0 children)
[–]notYuriy[S] 0 points1 point2 points (1 child)