Advertisement
Zelatrix

Untitled

Jul 26th, 2022
899
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.84 KB | None | 0 0
  1. """
  2.    THIS FUNCTION TAKES A VALUE, AND WRAPS IT IN AN LLVM OBJECT OF THE
  3.    TYPE DETECTED IN THE FUNCTION SIGNATURE  
  4.    """
  5.  
  6.     # Visitor for functions with >= 1 argument
  7.     def visit_call_args(self, fn_name, fn_args):
  8.        
  9.         """
  10.        This function wraps a given value in an LLVM type
  11.  
  12.        Declaring the function inside another function means that
  13.        this function is accessible withi the scope of the outer
  14.        function
  15.        """
  16.         def type_arg(value: int, typ):
  17.             return typ(value)
  18.        
  19.         fun = self.fun_headers[fn_name]  # Retrieving the function header
  20.         arg_list = [i.value for i in fn_args] # Retrieving the function arguments
  21.         print(arg_list)
  22.  
  23.         typed = [type_arg(n, ir.DoubleType()) for n in arg_list]    
  24.         self.builder.call(fun, (typed))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement