Skip to content

Commit 1a77f8c

Browse files
author
Connor Harris
committed
I am going insane why did i decide to support mac
1 parent e13dbff commit 1a77f8c

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

src/llvm/core/llvm.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,22 @@ static LLVMTargetMachineRef create_target_machine(void) {
9292
return NULL;
9393
}
9494

95+
const char *cpu_name = "generic";
96+
const char *cpu_features = "";
97+
98+
#if !defined(__APPLE__)
9599
char *host_cpu = LLVMGetHostCPUName();
96100
char *host_features = LLVMGetHostCPUFeatures();
101+
if (host_cpu && strlen(host_cpu) > 0) {
102+
cpu_name = host_cpu;
103+
}
104+
if (host_features && strlen(host_features) > 0) {
105+
cpu_features = host_features;
106+
}
107+
#else
108+
cpu_name = "generic";
109+
cpu_features = "";
110+
#endif
97111

98112
#if defined(__APPLE__)
99113
LLVMCodeModel code_model = LLVMCodeModelDefault;
@@ -102,12 +116,14 @@ static LLVMTargetMachineRef create_target_machine(void) {
102116
#endif
103117

104118
LLVMTargetMachineRef machine = LLVMCreateTargetMachine(
105-
target, target_triple, host_cpu, host_features,
119+
target, target_triple, cpu_name, cpu_features,
106120
LLVMCodeGenLevelNone, // Fast compilation, no optimization
107121
LLVMRelocPIC, code_model);
108122

123+
#if !defined(__APPLE__)
109124
LLVMDisposeMessage(host_cpu);
110125
LLVMDisposeMessage(host_features);
126+
#endif
111127
LLVMDisposeMessage(target_triple);
112128

113129
return machine;

src/llvm/expr/expr.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1300,9 +1300,6 @@ LLVMValueRef codegen_expr_cast(CodeGenContext *ctx, AstNode *node) {
13001300

13011301
LLVMTypeKind source_kind = LLVMGetTypeKind(source_type);
13021302
LLVMTypeKind target_kind = LLVMGetTypeKind(target_type);
1303-
fprintf(stderr, "DEBUG cast: source_kind=%d (int=%d, ptr=%d), target_kind=%d (int=%d, ptr=%d)\n",
1304-
source_kind, LLVMIntegerTypeKind, LLVMPointerTypeKind,
1305-
target_kind, LLVMIntegerTypeKind, LLVMPointerTypeKind);
13061303

13071304
// If types are the same, no cast needed
13081305
if (source_type == target_type)

0 commit comments

Comments
 (0)