@@ -24,7 +24,7 @@ def allocate(self, builder, size):
2424
2525 mod = builder .module
2626 fnty = ir .FunctionType (cgutils .voidptr_t , [cgutils .intp_t ])
27- fn = mod .get_or_insert_function (fnty , name = "NRT_Allocate" )
27+ fn = cgutils .get_or_insert_function (mod , fnty , "NRT_Allocate" )
2828 fn .return_value .add_attribute ("noalias" )
2929 return builder .call (fn , [size ])
3030
@@ -36,7 +36,7 @@ def free(self, builder, ptr):
3636
3737 mod = builder .module
3838 fnty = ir .FunctionType (ir .VoidType (), [cgutils .voidptr_t ])
39- fn = mod .get_or_insert_function (fnty , name = "NRT_Free" )
39+ fn = cgutils .get_or_insert_function (mod , fnty , "NRT_Free" )
4040 return builder .call (fn , [ptr ])
4141
4242 def meminfo_alloc (self , builder , size ):
@@ -49,7 +49,7 @@ def meminfo_alloc(self, builder, size):
4949
5050 mod = builder .module
5151 fnty = ir .FunctionType (cgutils .voidptr_t , [cgutils .intp_t ])
52- fn = mod .get_or_insert_function (fnty , name = "NRT_MemInfo_alloc_safe" )
52+ fn = cgutils .get_or_insert_function (mod , fnty , "NRT_MemInfo_alloc_safe" )
5353 fn .return_value .add_attribute ("noalias" )
5454 return builder .call (fn , [size ])
5555
@@ -59,8 +59,8 @@ def meminfo_alloc_dtor(self, builder, size, dtor):
5959 mod = builder .module
6060 fnty = ir .FunctionType (cgutils .voidptr_t ,
6161 [cgutils .intp_t , cgutils .voidptr_t ])
62- fn = mod .get_or_insert_function (fnty ,
63- name = "NRT_MemInfo_alloc_dtor_safe" )
62+ fn = cgutils .get_or_insert_function (mod , fnty ,
63+ "NRT_MemInfo_alloc_dtor_safe" )
6464 fn .return_value .add_attribute ("noalias" )
6565 return builder .call (fn , [size ,
6666 builder .bitcast (dtor , cgutils .voidptr_t )])
@@ -78,8 +78,8 @@ def meminfo_alloc_aligned(self, builder, size, align):
7878 mod = builder .module
7979 u32 = ir .IntType (32 )
8080 fnty = ir .FunctionType (cgutils .voidptr_t , [cgutils .intp_t , u32 ])
81- fn = mod .get_or_insert_function (fnty ,
82- name = "NRT_MemInfo_alloc_safe_aligned" )
81+ fn = cgutils .get_or_insert_function (mod , fnty ,
82+ "NRT_MemInfo_alloc_safe_aligned" )
8383 fn .return_value .add_attribute ("noalias" )
8484 if isinstance (align , int ):
8585 align = self ._context .get_constant (types .uint32 , align )
@@ -99,7 +99,8 @@ def meminfo_new_varsize(self, builder, size):
9999
100100 mod = builder .module
101101 fnty = ir .FunctionType (cgutils .voidptr_t , [cgutils .intp_t ])
102- fn = mod .get_or_insert_function (fnty , name = "NRT_MemInfo_new_varsize" )
102+ fn = cgutils .get_or_insert_function (mod , fnty ,
103+ "NRT_MemInfo_new_varsize" )
103104 fn .return_value .add_attribute ("noalias" )
104105 return builder .call (fn , [size ])
105106
@@ -113,8 +114,8 @@ def meminfo_new_varsize_dtor(self, builder, size, dtor):
113114 mod = builder .module
114115 fnty = ir .FunctionType (cgutils .voidptr_t ,
115116 [cgutils .intp_t , cgutils .voidptr_t ])
116- fn = mod .get_or_insert_function (
117- fnty , name = "NRT_MemInfo_new_varsize_dtor" )
117+ fn = cgutils .get_or_insert_function (
118+ mod , fnty , "NRT_MemInfo_new_varsize_dtor" )
118119 return builder .call (fn , [size , dtor ])
119120
120121 def meminfo_varsize_alloc (self , builder , meminfo , size ):
@@ -149,7 +150,8 @@ def meminfo_varsize_free(self, builder, meminfo, ptr):
149150 mod = builder .module
150151 fnty = ir .FunctionType (ir .VoidType (),
151152 [cgutils .voidptr_t , cgutils .voidptr_t ])
152- fn = mod .get_or_insert_function (fnty , name = "NRT_MemInfo_varsize_free" )
153+ fn = cgutils .get_or_insert_function (mod , fnty ,
154+ "NRT_MemInfo_varsize_free" )
153155 return builder .call (fn , (meminfo , ptr ))
154156
155157 def _call_varsize_alloc (self , builder , meminfo , size , funcname ):
@@ -158,7 +160,7 @@ def _call_varsize_alloc(self, builder, meminfo, size, funcname):
158160 mod = builder .module
159161 fnty = ir .FunctionType (cgutils .voidptr_t ,
160162 [cgutils .voidptr_t , cgutils .intp_t ])
161- fn = mod .get_or_insert_function (fnty , name = funcname )
163+ fn = cgutils .get_or_insert_function (mod , fnty , funcname )
162164 fn .return_value .add_attribute ("noalias" )
163165 return builder .call (fn , [meminfo , size ])
164166
@@ -173,8 +175,8 @@ def meminfo_data(self, builder, meminfo):
173175 from numba .core .runtime .nrtdynmod import meminfo_data_ty
174176
175177 mod = builder .module
176- fn = mod .get_or_insert_function (meminfo_data_ty ,
177- name = "NRT_MemInfo_data_fast" )
178+ fn = cgutils .get_or_insert_function (mod , meminfo_data_ty ,
179+ "NRT_MemInfo_data_fast" )
178180 return builder .call (fn , [meminfo ])
179181
180182 def get_meminfos (self , builder , ty , val ):
@@ -204,7 +206,8 @@ def _call_incref_decref(self, builder, typ, value, funcname):
204206 meminfos = self .get_meminfos (builder , typ , value )
205207 for _ , mi in meminfos :
206208 mod = builder .module
207- fn = mod .get_or_insert_function (incref_decref_ty , name = funcname )
209+ fn = cgutils .get_or_insert_function (mod , incref_decref_ty ,
210+ funcname )
208211 # XXX "nonnull" causes a crash in test_dyn_array: can this
209212 # function be called with a NULL pointer?
210213 fn .args [0 ].add_attribute ("noalias" )
@@ -230,7 +233,7 @@ def get_nrt_api(self, builder):
230233
231234 fnty = ir .FunctionType (cgutils .voidptr_t , ())
232235 mod = builder .module
233- fn = mod .get_or_insert_function (fnty , name = "NRT_get_api" )
236+ fn = cgutils .get_or_insert_function (mod , fnty , "NRT_get_api" )
234237 return builder .call (fn , ())
235238
236239 def eh_check (self , builder ):
0 commit comments