py2llvm: support 'neg' on VInt

This commit is contained in:
Sebastien Bourdeauducq 2014-09-08 18:25:04 +08:00
parent 3d8159ceb5
commit 1133308dd5
1 changed files with 9 additions and 0 deletions

View File

@ -74,6 +74,15 @@ class VInt(VGeneric):
def o_not(self, builder):
return self.o_bool(builder, True)
def o_neg(self, builder):
r = VInt(self.nbits)
if builder is not None:
r.set_ssa_value(
builder, builder.mul(
self.get_ssa_value(builder),
lc.Constant.int(self.get_llvm_type(), -1)))
return r
def o_intx(self, target_bits, builder):
r = VInt(target_bits)
if builder is not None: