#NEWLINE# def insert_addrspace_conv( lmod , elemtype , addrspace ) : #NEWLINE# #INDENT# addrspacename = { #NEWLINE# #INDENT# nvvm . ADDRSPACE_SHARED : 'shared' , #NEWLINE# nvvm . ADDRSPACE_LOCAL : 'local' , #NEWLINE# nvvm . ADDRSPACE_CONSTANT : 'constant' , #NEWLINE# #UNINDENT# } [ elemtype ] #NEWLINE# tyname = str ( elemtype ) #NEWLINE# tyname = { #NEWLINE# #INDENT# 'float' : 'f32' , #NEWLINE# 'double' : 'f64' , #NEWLINE# #UNINDENT# } . get ( tyname , tyname ) #NEWLINE# s2g_name_fmt = ( ( 'llvm.nvvm.ptr.' + addrspacename ) + '.to.gen.p0%s.p%d%s' ) #NEWLINE# s2g_name = ( s2g_name_fmt % ( tyname , addrspace , tyname ) ) #NEWLINE# elem_ptr_ty = lc . Type . pointer ( elemtype ) #NEWLINE# elem_ptr_ty_addrspace = lc . Type . pointer ( elemtype , addrspace ) #NEWLINE# s2g_fnty = lc . Type . function ( elem_ptr_ty , [ elem_ptr_ty_addrspace ] ) #NEWLINE# return lmod . get_or_insert_function ( s2g_fnty , s2g_name )