LLVM 15 compatibility fixes (#465)

More variant code. Fixes to typekind. Fixes to macro with failable returns. Remove use of LLVMConstInsert etc. Version 0.2.8
This commit is contained in:
Christoffer Lerno
2022-07-06 16:41:52 +02:00
committed by GitHub
parent bb28f6e61c
commit c8a614e43f
30 changed files with 1099 additions and 365 deletions

View File

@@ -7,8 +7,6 @@
const char* llvm_version = LLVM_VERSION_STRING;
const char* llvm_target = LLVM_DEFAULT_TARGET_TRIPLE;
void llvm_emit_local_global_variable_definition(GenContext *c, Decl *decl);
static void diagnostics_handler(LLVMDiagnosticInfoRef ref, void *context)
{
char *message = LLVMGetDiagInfoDescription(ref);
@@ -255,28 +253,6 @@ LLVMValueRef llvm_emit_const_initializer(GenContext *c, ConstInitializer *const_
}
void llvm_emit_local_global_variable_definition(GenContext *c, Decl *decl)
{
assert(decl->var.kind == VARDECL_GLOBAL || decl->var.kind == VARDECL_CONST);
// Skip real constants.
if (!decl->type) return;
if (decl->type != type_void)
{
decl->backend_ref = llvm_add_global_var(c, "tempglobal", decl->type, decl->alignment);
}
if (IS_FAILABLE(decl))
{
scratch_buffer_clear();
scratch_buffer_append(decl->extname);
scratch_buffer_append(".f");
decl->var.failable_ref = llvm_add_global_var(c, scratch_buffer_to_string(), type_anyerr, 0);
LLVMSetUnnamedAddress(decl->var.failable_ref, LLVMGlobalUnnamedAddr);
}
}
void llvm_emit_ptr_from_array(GenContext *c, BEValue *value)
{
switch (value->type->type_kind)