Revision
1489
Author
lsansonetti@apple.com
Date
2009-04-24 21:21:25 -0700 (Fri, 24 Apr 2009)

Log Message

introduce the VM_DUMP_IR environment variable (set it to anything to dump the LLVM IR before exiting) + make sure we mark sret calls with the sret attribute, even if it doesn't seem necessary, but we never know with LLVM what can happen in the future, do we?

Modified Paths

Diff

Modified: MacRuby/branches/experimental/roxor.cpp (1488 => 1489)


--- MacRuby/branches/experimental/roxor.cpp	2009-04-25 04:13:51 UTC (rev 1488)
+++ MacRuby/branches/experimental/roxor.cpp	2009-04-25 04:21:25 UTC (rev 1489)
@@ -2,7 +2,6 @@
 
 #define ROXOR_COMPILER_DEBUG		0
 #define ROXOR_VM_DEBUG			0
-#define ROXOR_DUMP_IR_BEFORE_EXIT	0
 #define ROXOR_ULTRA_LAZY_JIT		1
 #define ROXOR_INTERPRET_EVAL		0
 
@@ -5727,6 +5726,7 @@
     // Compile retval.
     Value *retval;
     if (sret != NULL) {
+	imp_call->addAttribute(0, Attribute::StructRet);
 	retval = new LoadInst(sret, "", bb);
     }
     else {
@@ -9403,11 +9403,11 @@
 void
 rb_vm_finalize(void)
 {
-#if ROXOR_DUMP_IR_BEFORE_EXIT
-    printf("IR dump ----------------------------------------------\n");
-    RoxorCompiler::module->dump();
-    printf("------------------------------------------------------\n");
-#endif
+    if (getenv("VM_DUMP_IR") != NULL) {
+	printf("IR dump ----------------------------------------------\n");
+	RoxorCompiler::module->dump();
+	printf("------------------------------------------------------\n");
+    }
 #if ROXOR_VM_DEBUG
     printf("functions all=%ld compiled=%ld\n", RoxorCompiler::module->size(),
 	    GET_VM()->functions_compiled);