예제 #1
0
파일: compile.py 프로젝트: xx312022850/pypy
 def _generate_len_gep(self, array_ref, ty, const_index_length):
     array = llvm_rffi.LLVMBuildBitCast(self.builder,
                                        array_ref, ty, "")
     indices = lltype.malloc(rffi.CArray(llvm_rffi.LLVMValueRef), 2,
                             flavor='raw')
     indices[0] = self.cpu.const_zero
     indices[1] = const_index_length
     loc = llvm_rffi.LLVMBuildGEP(self.builder, array, indices, 2, "")
     lltype.free(indices, flavor='raw')
     return loc
예제 #2
0
파일: compile.py 프로젝트: xx312022850/pypy
 def _generate_gep(self, op, ty, const_index_array):
     array = llvm_rffi.LLVMBuildBitCast(self.builder,
                                        self.getptrarg(op.args[0]),
                                        ty, "")
     indices = lltype.malloc(rffi.CArray(llvm_rffi.LLVMValueRef), 3,
                             flavor='raw')
     indices[0] = self.cpu.const_zero
     indices[1] = const_index_array
     indices[2] = self.getintarg(op.args[1])
     location = llvm_rffi.LLVMBuildGEP(self.builder, array, indices, 3, "")
     lltype.free(indices, flavor='raw')
     return location
예제 #3
0
파일: compile.py 프로젝트: xx312022850/pypy
 def _generate_field_gep(self, v_structure, fielddescr):
     assert isinstance(fielddescr, FieldDescr)
     indices = lltype.malloc(rffi.CArray(llvm_rffi.LLVMValueRef), 1,
                             flavor='raw')
     indices[0] = self.cpu._make_const_int(fielddescr.offset)
     location = llvm_rffi.LLVMBuildGEP(self.builder,
                                       self.getptrarg(v_structure),
                                       indices, 1, "")
     lltype.free(indices, flavor='raw')
     ty = self.cpu.types_ptr_by_index[fielddescr.size_index]
     location = llvm_rffi.LLVMBuildBitCast(self.builder, location, ty, "")
     return location