Revert "Just get the value directly and store it in another global variable"

This reverts commit 190c3ab0cd.
This commit is contained in:
gingerBill
2022-09-14 17:57:12 +01:00
parent 3ea7af4c9c
commit a3c04db828
3 changed files with 8 additions and 33 deletions
+5 -10
View File
@@ -926,7 +926,11 @@ void lb_emit_store(lbProcedure *p, lbValue ptr, lbValue value) {
return;
} else if (LLVMIsConstant(value.value)) {
lbAddr addr = lb_add_global_generated(p->module, value.type, value, nullptr);
LLVMValueRef global_data = lb_make_global_truly_private(addr);
LLVMValueRef global_data = addr.addr.value;
// make it truly private data
LLVMSetLinkage(global_data, LLVMPrivateLinkage);
LLVMSetUnnamedAddress(global_data, LLVMGlobalUnnamedAddr);
LLVMSetGlobalConstant(global_data, true);
LLVMValueRef dst_ptr = ptr.value;
LLVMValueRef src_ptr = global_data;
@@ -2665,15 +2669,6 @@ lbValue lb_find_procedure_value_from_entity(lbModule *m, Entity *e) {
return {};
}
LLVMValueRef lb_make_global_truly_private(lbAddr const &addr) {
LLVMValueRef global_data = addr.addr.value;
// make it truly private data
LLVMSetLinkage(global_data, LLVMPrivateLinkage);
LLVMSetUnnamedAddress(global_data, LLVMGlobalUnnamedAddr);
LLVMSetGlobalConstant(global_data, true);
return global_data;
}
lbAddr lb_add_global_generated(lbModule *m, Type *type, lbValue value, Entity **entity_) {
GB_ASSERT(type != nullptr);
type = default_type(type);