Skip to content

Expression expansion doesn't reuse local registers after completed #49

@kobbled

Description

@kobbled

e.g.:

local := R[50..90]
a = x1 * (y2 - y3) - y1 * (x2 - x3) + x2 * y3 - x3 * y2
b = (Mth::pow(x1, 2) + Mth::pow(y1, 2)) * (y3 - y2)
c = (Mth::pow(x1, 2) + Mth::pow(y1, 2)) * (x2 - x3)
d = (Mth::pow(x3, 2) + Mth::pow(y3, 2)) * (x2 * y1 - x1 * y2)

expands to this in LS:

 : R[50:a]=(AR[1]*(AR[5]-AR[8])-AR[2]*(AR[4]-AR[7])+AR[4]*AR[8]-AR[7]*AR[5]) ;
 : CALL MTH_POW(AR[1],2,57) ;
 : CALL MTH_POW(AR[2],2,58) ;
 : R[51:b]=((R[57:dvar1]+R[58:dvar2])*(AR[8]-AR[5])) ;
 : CALL MTH_POW(AR[1],2,59) ;
 : CALL MTH_POW(AR[2],2,60) ;
 : R[52:c]=((R[59:dvar3]+R[60:dvar4])*(AR[4]-AR[7])) ;
 : CALL MTH_POW(AR[7],2,61) ;
 : CALL MTH_POW(AR[8],2,62) ;
 : R[53:d]=((R[61:dvar5]+R[62:dvar6])*(AR[4]*AR[2]-AR[1]*AR[5])) ;

After the evaluation of b, the stack counter should be reset to 57. This can be achieved by doing $stack.push/$stack.pop before/after each expression expansion.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions