Browse Source

Add -debug-compile parameter for llc

gingerBill 7 years ago
parent
commit
05c5f98e8e
2 changed files with 9 additions and 4 deletions
  1. 9 2
      src/build_settings.cpp
  2. 0 2
      src/main.cpp

+ 9 - 2
src/build_settings.cpp

@@ -490,12 +490,17 @@ void init_build_context(void) {
 		#define LINK_FLAG_X86 "-arch x86"
 	#endif
 
+	gbString llc_flags = gb_string_make_reserve(heap_allocator(), 64);
+	if (bc->ODIN_DEBUG) {
+		llc_flags = gb_string_appendc(llc_flags, "-debug-compile ");
+	}
 
 	if (bc->ODIN_ARCH == "amd64") {
 		bc->word_size = 8;
 		bc->max_align = 16;
 
-		bc->llc_flags = str_lit("-march=x86-64 ");
+		llc_flags = gb_string_appendc(llc_flags, "-march=x86-64 ");
+
 		if (str_eq_ignore_case(cross_compile_target, str_lit("Essence"))) {
 			bc->link_flags = str_lit(" ");
 		} else {
@@ -504,13 +509,15 @@ void init_build_context(void) {
 	} else if (bc->ODIN_ARCH == "x86") {
 		bc->word_size = 4;
 		bc->max_align = 8;
-		bc->llc_flags = str_lit("-march=x86 ");
+		llc_flags = gb_string_appendc(llc_flags, "-march=x86 ");
 		bc->link_flags = str_lit(LINK_FLAG_X86 " ");
 	} else {
 		gb_printf_err("This current architecture is not supported");
 		gb_exit(1);
 	}
 
+	bc->llc_flags = make_string_c(llc_flags);
+
 
 	isize opt_max = 1023;
 	char *opt_flags_string = gb_alloc_array(heap_allocator(), char, opt_max+1);

+ 0 - 2
src/main.cpp

@@ -683,7 +683,6 @@ i32 exec_llvm_llc(String output_base) {
 		"\"%.*sbin/llc\" \"%.*s.bc\" -filetype=obj -O%d "
 		"-o \"%.*s.obj\" "
 		"%.*s "
-		// "-debug-pass=Arguments "
 		"",
 		LIT(build_context.ODIN_ROOT),
 		LIT(output_base),
@@ -696,7 +695,6 @@ i32 exec_llvm_llc(String output_base) {
 	return system_exec_command_line_app("llc", false,
 		"llc \"%.*s.bc\" -filetype=obj -relocation-model=pic -O%d "
 		"%.*s "
-		// "-debug-pass=Arguments "
 		"%s"
 		"",
 		LIT(output_base),