From 64c29bcfa68cb80a4624db9a612207963d15a280 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sat, 6 Sep 2014 19:02:09 +0800 Subject: [PATCH] py2llvm/values: support 'not' on VInt --- artiq/py2llvm/values.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/artiq/py2llvm/values.py b/artiq/py2llvm/values.py index 4dfdc20bc..3ecdf94ec 100644 --- a/artiq/py2llvm/values.py +++ b/artiq/py2llvm/values.py @@ -96,16 +96,19 @@ class VInt(_Value): def set_const_value(self, builder, n): self.set_ssa_value(builder, lc.Constant.int(self.get_llvm_type(), n)) - def o_bool(self, builder): + def o_bool(self, builder, inv=False): r = VBool() if builder is not None: r.set_ssa_value( builder, builder.icmp( - lc.ICMP_NE, + lc.ICMP_EQ if inv else lc.ICMP_NE, self.get_ssa_value(builder), lc.Constant.int(self.get_llvm_type(), 0))) return r + def o_not(self, builder): + return self.o_bool(builder, True) + def o_intx(self, target_bits, builder): r = VInt(target_bits) if builder is not None: