diff --git a/chapter6.py b/chapter6.py index 1229fb4..1a1e703 100644 --- a/chapter6.py +++ b/chapter6.py @@ -562,7 +562,7 @@ class LLVMCodeGenerator(object): def _codegen_UnaryExprAST(self, node): operand = self._codegen(node.operand) - func = self.module.get_global('unary{0}'.format(node.op)) + func = self.module.globals.get('unary{0}'.format(node.op)) return self.builder.call(func, [operand], 'unop') def _codegen_BinaryExprAST(self, node): @@ -581,7 +581,7 @@ class LLVMCodeGenerator(object): else: # Note one of predefined operator, so it must be a user-defined one. # Emit a call to it. - func = self.module.get_global('binary{0}'.format(node.op)) + func = self.module.globals.get('binary{0}'.format(node.op)) return self.builder.call(func, [lhs, rhs], 'binop') def _codegen_IfExprAST(self, node): diff --git a/chapter7.py b/chapter7.py index 72dd3e9..3948fe2 100644 --- a/chapter7.py +++ b/chapter7.py @@ -625,7 +625,7 @@ class LLVMCodeGenerator(object): def _codegen_UnaryExprAST(self, node): operand = self._codegen(node.operand) - func = self.module.get_global('unary{0}'.format(node.op)) + func = self.module.globals.get('unary{0}'.format(node.op)) return self.builder.call(func, [operand], 'unop') def _codegen_BinaryExprAST(self, node): @@ -654,7 +654,7 @@ class LLVMCodeGenerator(object): else: # Note one of predefined operator, so it must be a user-defined one. # Emit a call to it. - func = self.module.get_global('binary{0}'.format(node.op)) + func = self.module.globals.get('binary{0}'.format(node.op)) return self.builder.call(func, [lhs, rhs], 'binop') def _codegen_IfExprAST(self, node):