Update to work with latest llvmlite, which needs LLVM 3.6
This commit is contained in:
parent
f8002eb092
commit
54d82e9f37
5 changed files with 21 additions and 21 deletions
12
chapter6.py
12
chapter6.py
|
|
@ -555,7 +555,7 @@ class LLVMCodeGenerator(object):
|
|||
return getattr(self, method)(node)
|
||||
|
||||
def _codegen_NumberExprAST(self, node):
|
||||
return self.builder.constant(ir.DoubleType(), float(node.val))
|
||||
return ir.Constant(ir.DoubleType(), float(node.val))
|
||||
|
||||
def _codegen_VariableExprAST(self, node):
|
||||
return self.func_symtab[node.name]
|
||||
|
|
@ -588,7 +588,7 @@ class LLVMCodeGenerator(object):
|
|||
# Emit comparison value
|
||||
cond_val = self._codegen(node.cond_expr)
|
||||
cmp = self.builder.fcmp_ordered(
|
||||
'!=', cond_val, self.builder.constant(ir.DoubleType(), 0.0))
|
||||
'!=', cond_val, ir.Constant(ir.DoubleType(), 0.0))
|
||||
|
||||
# Create basic blocks to express the control flow, with a conditional
|
||||
# branch to either then_bb or else_bb depending on cmp. else_bb and
|
||||
|
|
@ -666,7 +666,7 @@ class LLVMCodeGenerator(object):
|
|||
body_val = self._codegen(node.body)
|
||||
|
||||
if node.step_expr is None:
|
||||
stepval = self.builder.constant(ir.DoubleType(), 1.0)
|
||||
stepval = ir.Constant(ir.DoubleType(), 1.0)
|
||||
else:
|
||||
stepval = self._codegen(node.step_expr)
|
||||
nextvar = self.builder.fadd(phi, stepval, 'nextvar')
|
||||
|
|
@ -674,7 +674,7 @@ class LLVMCodeGenerator(object):
|
|||
# Compute the end condition
|
||||
endcond = self._codegen(node.end_expr)
|
||||
cmp = self.builder.fcmp_ordered(
|
||||
'!=', endcond, self.builder.constant(ir.DoubleType(), 0.0),
|
||||
'!=', endcond, ir.Constant(ir.DoubleType(), 0.0),
|
||||
'loopcond')
|
||||
|
||||
# Create the 'after loop' block and insert it
|
||||
|
|
@ -698,7 +698,7 @@ class LLVMCodeGenerator(object):
|
|||
self.func_symtab[node.id_name] = oldval
|
||||
|
||||
# The 'for' expression always returns 0
|
||||
return self.builder.constant(ir.DoubleType(), 0.0)
|
||||
return ir.Constant(ir.DoubleType(), 0.0)
|
||||
|
||||
def _codegen_CallExprAST(self, node):
|
||||
callee_func = self.module.get_global(node.callee)
|
||||
|
|
@ -839,7 +839,7 @@ class KaleidoscopeEvaluator(object):
|
|||
irbuilder = ir.IRBuilder(putchard.append_basic_block('entry'))
|
||||
ival = irbuilder.fptoui(putchard.args[0], ir.IntType(32), 'intcast')
|
||||
irbuilder.call(putchar, [ival])
|
||||
irbuilder.ret(irbuilder.constant(ir.DoubleType(), 0))
|
||||
irbuilder.ret(ir.Constant(ir.DoubleType(), 0))
|
||||
|
||||
|
||||
#---- Some unit tests ----#
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue