Commit 6993a9bb authored by Eduardo Souza's avatar Eduardo Souza

Applied rustfmt and commented casting references stored in globals.

parent bf9e0f98
Pipeline #5682 failed with stages
in 56 minutes and 59 seconds
......@@ -1665,27 +1665,27 @@ pub unsafe fn gen_instr_get_field_iref(
// when getting a field of a global variable that is a pointer, do an
// addrspacecast
let is_global = LLVMIsAGlobalObject(*ptr);
let is_global = LLVMPrintValueToString(is_global);
let is_global = CString::from_raw(is_global);
let is_global = String::from(is_global.to_str().unwrap());
let get_elem_ptr_type = LLVMTypeOf(get_elem_ptr);
let internal_type = LLVMGetElementType(get_elem_ptr_type);
let addrspace = LLVMGetPointerAddressSpace(internal_type);
if addrspace == 1 && is_global.contains("external global") {
let internal_type_elem = LLVMGetElementType(internal_type);
let new_type_internal = LLVMPointerType(internal_type_elem, 0);
let new_type_get_elem_pointer = LLVMPointerType(new_type_internal, 0);
let name = format!("{}_a0\0", ins_value.get(0).unwrap().hdr.name());
get_elem_ptr = LLVMBuildBitCast(
llvm_internal_context.builder,
get_elem_ptr,
new_type_get_elem_pointer,
name.as_str().as_ptr() as *const c_char
);
}
// let is_global = LLVMIsAGlobalObject(*ptr);
// let is_global = LLVMPrintValueToString(is_global);
// let is_global = CString::from_raw(is_global);
// let is_global = String::from(is_global.to_str().unwrap());
//
// let get_elem_ptr_type = LLVMTypeOf(get_elem_ptr);
// let internal_type = LLVMGetElementType(get_elem_ptr_type);
// let addrspace = LLVMGetPointerAddressSpace(internal_type);
//
// if addrspace == 1 && is_global.contains("external global") {
// let internal_type_elem = LLVMGetElementType(internal_type);
// let new_type_internal = LLVMPointerType(internal_type_elem, 0);
// let new_type_get_elem_pointer = LLVMPointerType(new_type_internal, 0);
// let name = format!("{}_a0\0", ins_value.get(0).unwrap().hdr.name());
// get_elem_ptr = LLVMBuildBitCast(
// llvm_internal_context.builder,
// get_elem_ptr,
// new_type_get_elem_pointer,
// name.as_str().as_ptr() as *const c_char
// );
// }
store.insert(id, get_elem_ptr);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment