Mercurial > lcfOS
diff python/target/arminstructionselector.py @ 336:d1ecc493384e
Added spiffy armtoken class for bit fiddeling. Added cool test that checks for build repeatability
author | Windel Bouwman |
---|---|
date | Wed, 19 Feb 2014 22:32:15 +0100 |
parents | e9fe6988497c |
children | 4d204f6f7d4e |
line wrap: on
line diff
--- a/python/target/arminstructionselector.py Mon Feb 17 20:41:30 2014 +0100 +++ b/python/target/arminstructionselector.py Wed Feb 19 22:32:15 2014 +0100 @@ -1,5 +1,5 @@ import os -from ppci import ir +from ppci import ir, same_dir from ppci.irmach import AbstractInstruction as makeIns from ppci.ir2tree import makeTree import pyburg @@ -12,7 +12,7 @@ from .basetarget import Imm8, Imm7, Imm3 # Import BURG spec for arm: -spec_file = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'arm.brg') +spec_file = same_dir(__file__, 'arm.brg') arm_matcher = pyburg.load_as_module(spec_file) @@ -75,16 +75,16 @@ self.emit(Nop(), src=[x]) elif isinstance(s, ir.Jump): tgt = self.targets[s.target] - self.emit(B(LabelRef(s.target.name)), jumps=[tgt]) + self.emit(B(LabelRef(ir.label_name(s.target))), jumps=[tgt]) elif isinstance(s, ir.CJump): a = self.munchExpr(s.a) b = self.munchExpr(s.b) self.emit(Cmp, src=[a, b]) ntgt = self.targets[s.lab_no] ytgt = self.targets[s.lab_yes] - jmp_ins = makeIns(B(LabelRef(s.lab_no.name)), jumps=[ntgt]) + jmp_ins = makeIns(B(LabelRef(ir.label_name(s.lab_no))), jumps=[ntgt]) opnames = {'<': Blt, '>':Bgt, '==':Beq, '!=':Bne} - op = opnames[s.cond](LabelRef(s.lab_yes.name)) + op = opnames[s.cond](LabelRef(ir.label_name(s.lab_yes))) self.emit(op, jumps=[ytgt, jmp_ins]) # Explicitely add fallthrough self.emit2(jmp_ins) else: