Add ODIN_LLVM_MINIMUM_VERSION_12

This commit is contained in:
gingerBill
2021-10-25 16:05:22 +01:00
parent 7ac156755b
commit 7d715fe113
3 changed files with 16 additions and 8 deletions
+3 -7
View File
@@ -21,12 +21,6 @@
#include "llvm_backend_stmt.cpp"
#include "llvm_backend_proc.cpp"
#if LLVM_VERSION_MAJOR < 11
#error "LLVM Version 11 is the minimum required"
#elif LLVM_VERSION_MAJOR == 12 && !(LLVM_VERSION_MINOR > 0 || LLVM_VERSION_PATCH > 0)
#error "If LLVM Version 12.x.y is wanted, at least LLVM 12.0.1 is required"
#endif
void lb_add_foreign_library_path(lbModule *m, Entity *e) {
if (e == nullptr) {
@@ -1214,7 +1208,9 @@ void lb_generate_code(lbGenerator *gen) {
// x86-64-v2: (close to Nehalem) CMPXCHG16B, LAHF-SAHF, POPCNT, SSE3, SSE4.1, SSE4.2, SSSE3
// x86-64-v3: (close to Haswell) AVX, AVX2, BMI1, BMI2, F16C, FMA, LZCNT, MOVBE, XSAVE
// x86-64-v4: AVX512F, AVX512BW, AVX512CD, AVX512DQ, AVX512VL
llvm_cpu = "x86-64-v2";
if (ODIN_LLVM_MINIMUM_VERSION_12) {
llvm_cpu = "x86-64-v2";
}
}
// GB_ASSERT_MSG(LLVMTargetHasAsmBackend(target));
+12
View File
@@ -30,6 +30,18 @@
#include <llvm-c/Transforms/Vectorize.h>
#endif
#if LLVM_VERSION_MAJOR < 11
#error "LLVM Version 11 is the minimum required"
#elif LLVM_VERSION_MAJOR == 12 && !(LLVM_VERSION_MINOR > 0 || LLVM_VERSION_PATCH > 0)
#error "If LLVM Version 12.x.y is wanted, at least LLVM 12.0.1 is required"
#endif
#if LLVM_VERSION_MAJOR > 12 || (LLVM_VERSION_MAJOR == 12 && LLVM_VERSION_MINOR >= 0 && LLVM_VERSION_PATCH > 0)
#define ODIN_LLVM_MINIMUM_VERSION_12 1
#else
#define ODIN_LLVM_MINIMUM_VERSION_12 0
#endif
struct lbProcedure;
struct lbValue {
+1 -1
View File
@@ -2065,7 +2065,7 @@ LLVMAttributeRef lb_create_enum_attribute_with_type(LLVMContextRef ctx, char con
unsigned kind = 0;
String s = make_string_c(name);
#if (LLVM_VERSION_MAJOR > 12 || (LLVM_VERSION_MAJOR == 12 && (LLVM_VERSION_MINOR > 0 || LLVM_VERSION_PATCH >= 1)))
#if ODIN_LLVM_MINIMUM_VERSION_12
kind = LLVMGetEnumAttributeKindForName(name, s.len);
GB_ASSERT_MSG(kind != 0, "unknown attribute: %s", name);
return LLVMCreateTypeAttribute(ctx, kind, type);