FuncCallExprAST.py (10981:b300dcda5896) FuncCallExprAST.py (10984:a86f453a7caa)
1# Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
2# Copyright (c) 2009 The Hewlett-Packard Development Company
3# Copyright (c) 2013 Advanced Micro Devices, Inc.
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions are
8# met: redistributions of source code must retain the above copyright

--- 66 unchanged lines hidden (view full) ---

75 return self.symtab.find("void", Type)
76
77 # hack for adding comments to profileTransition
78 if self.proc_name == "APPEND_TRANSITION_COMMENT":
79 # FIXME - check for number of parameters
80 code("APPEND_TRANSITION_COMMENT($0)", self.exprs[0].inline())
81 return self.symtab.find("void", Type)
82
1# Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
2# Copyright (c) 2009 The Hewlett-Packard Development Company
3# Copyright (c) 2013 Advanced Micro Devices, Inc.
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions are
8# met: redistributions of source code must retain the above copyright

--- 66 unchanged lines hidden (view full) ---

75 return self.symtab.find("void", Type)
76
77 # hack for adding comments to profileTransition
78 if self.proc_name == "APPEND_TRANSITION_COMMENT":
79 # FIXME - check for number of parameters
80 code("APPEND_TRANSITION_COMMENT($0)", self.exprs[0].inline())
81 return self.symtab.find("void", Type)
82
83 func_name_args = self.proc_name
84
85 for expr in self.exprs:
86 actual_type,param_code = expr.inline(True)
87 func_name_args += "_" + str(actual_type.ident)
88
83 # Look up the function in the symbol table
89 # Look up the function in the symbol table
84 func = self.symtab.find(self.proc_name, Func)
90 func = self.symtab.find(func_name_args, Func)
85
86 # Check the types and get the code for the parameters
87 if func is None:
91
92 # Check the types and get the code for the parameters
93 if func is None:
88 self.error("Unrecognized function name: '%s'", self.proc_name)
94 self.error("Unrecognized function name: '%s'", func_name_args)
89
90 if len(self.exprs) != len(func.param_types):
91 self.error("Wrong number of arguments passed to function : '%s'" +\
92 " Expected %d, got %d", self.proc_name,
93 len(func.param_types), len(self.exprs))
94
95 cvec = []
96 type_vec = []

--- 91 unchanged lines hidden (view full) ---

188 if first_param:
189 params = str(param_code)
190 first_param = False
191 else:
192 params += ', '
193 params += str(param_code);
194
195 fix = code.nofix()
95
96 if len(self.exprs) != len(func.param_types):
97 self.error("Wrong number of arguments passed to function : '%s'" +\
98 " Expected %d, got %d", self.proc_name,
99 len(func.param_types), len(self.exprs))
100
101 cvec = []
102 type_vec = []

--- 91 unchanged lines hidden (view full) ---

194 if first_param:
195 params = str(param_code)
196 first_param = False
197 else:
198 params += ', '
199 params += str(param_code);
200
201 fix = code.nofix()
196 code('(${{func.c_ident}}($params))')
202 code('(${{func.c_name}}($params))')
197 code.fix(fix)
198
199 return func.return_type
203 code.fix(fix)
204
205 return func.return_type