More codegen cleanup.

This commit is contained in:
Christoffer Lerno
2022-08-13 00:19:09 +02:00
parent d93c7090f6
commit 7805fb8d1c
7 changed files with 129 additions and 70 deletions

View File

@@ -1080,11 +1080,9 @@ LLVMValueRef llvm_emit_zstring_named(GenContext *c, const char *str, const char
LLVMValueRef global_string = llvm_add_global_raw(c, extname, char_array_type, 0);
llvm_set_internal_linkage(global_string);
LLVMSetGlobalConstant(global_string, 1);
LLVMSetInitializer(global_string, LLVMConstStringInContext(c->context, str, len, 0));
LLVMSetInitializer(global_string, llvm_get_zstring(c, str, len));
AlignSize alignment;
// TODO alignment
LLVMValueRef string = llvm_emit_array_gep_raw(c, global_string, char_array_type, 0,
1, &alignment);
LLVMValueRef string = llvm_emit_array_gep_raw(c, global_string, char_array_type, 0, 1, &alignment);
return llvm_emit_bitcast_ptr(c, string, type_char);
}