Commit 13d33a4a authored by dbarbera's avatar dbarbera
Browse files

Added logic expressions generation

parent 4a1b820e
......@@ -299,7 +299,29 @@ def _assign(expr):
def _bitwise_operators(expr):
''' Logical operators '''
raise NotImplementedError
builder = LLVM['builder']
func = builder.basic_block.function
lefttmp = expression(expr.left)
righttmp = expression(expr.right)
ty = find_basic_type(expr.exprType)
if ty.kind != 'BooleanType':
raise NotImplementedError
# load the value of the expression if it is a pointer
if lefttmp.type.kind == core.TYPE_POINTER:
lefttmp = builder.load(lefttmp, 'lefttmp')
if righttmp.type.kind == core.TYPE_POINTER:
righttmp = builder.load(righttmp, 'lefttmp')
if expr.operand == '&&':
return builder.and_(lefttmp, righttmp, 'ortmp')
elif expr.operand == '||':
return builder.or_(lefttmp, righttmp, 'ortmp')
return builder.xor(lefttmp, righttmp, 'xortmp')
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment