Mercurial > lcfOS
diff python/ppci/codegen/canon.py @ 364:c49459768aaa
Work on globals
author | Windel Bouwman |
---|---|
date | Wed, 19 Mar 2014 20:24:03 +0100 |
parents | 5477e499b039 |
children | 988f3fb861e4 |
line wrap: on
line diff
--- a/python/ppci/codegen/canon.py Sun Mar 16 11:28:47 2014 +0100 +++ b/python/ppci/codegen/canon.py Wed Mar 19 20:24:03 2014 +0100 @@ -61,6 +61,9 @@ elif isinstance(exp, ir.LocalVariable): offset = frame.allocVar(exp) return ir.Add(frame.fp, ir.Const(offset)) + elif isinstance(exp, ir.GlobalVariable): + #frame.load_global_address(ir.label_name(exp)) + return exp elif isinstance(exp, ir.Mem): exp.e = rewriteExp(exp.e, frame) return exp @@ -74,7 +77,7 @@ return ir.Eseq(ir.Move(t, exp), t) else: raise NotImplementedError('NI: {}, {}'.format(exp, type(exp))) - + # The flatten functions pull out seq instructions to the sequence list. def flattenExp(exp): @@ -89,6 +92,8 @@ elif isinstance(exp, ir.Mem): exp.e, s = flattenExp(exp.e) return exp, s + elif isinstance(exp, ir.GlobalVariable): + return exp, [] elif isinstance(exp, ir.Addr): exp.e, s = flattenExp(exp.e) return exp, s