2009-04-20 Zoltan Varga <vargaz@gmail.com>
authorZoltan Varga <vargaz@gmail.com>
Mon, 20 Apr 2009 15:51:09 +0000 (15:51 -0000)
committerZoltan Varga <vargaz@gmail.com>
Mon, 20 Apr 2009 15:51:09 +0000 (15:51 -0000)
* mini-llvm-cpp.cpp (mono_llvm_dump_value): New helper function to print
a Value to stdout.

* mini-llvm.c (mono_llvm_emit_method): Use it.

svn path=/trunk/mono/; revision=132183

mono/mini/ChangeLog
mono/mini/mini-llvm-cpp.cpp
mono/mini/mini-llvm-cpp.h
mono/mini/mini-llvm.c

index 174663f6ec5d419445bfc49bba15aed960712428..0af228a7976e560d5b26fe541c3b1b13424d433e 100644 (file)
@@ -1,5 +1,10 @@
 2009-04-20  Zoltan Varga  <vargaz@gmail.com>
 
+       * mini-llvm-cpp.cpp (mono_llvm_dump_value): New helper function to print
+       a Value to stdout.
+
+       * mini-llvm.c (mono_llvm_emit_method): Use it.
+       
        * mini-llvm.c (type_to_llvm_type): Fix the mapping of enums.
        (mono_llvm_emit_method): Add support for CAS. Fix handling of CSET opcodes
        on volatile values.
index 237d853b06c5b7356104de196a44cbc9676af85f..41708454ebabc2c7c673994ddb67440639ef88d7 100644 (file)
@@ -180,6 +180,13 @@ mono_llvm_optimize_method (LLVMValueRef method)
        fpm->run (*unwrap<Function> (method));
 }
 
+void
+mono_llvm_dump_value (LLVMValueRef value)
+{
+       /* Same as LLVMDumpValue (), but print to stdout */
+       cout << (*unwrap<Value> (value));
+}
+
 /* Missing overload for building an alloca with an alignment */
 LLVMValueRef
 mono_llvm_build_alloca (LLVMBuilderRef builder, LLVMTypeRef Ty, 
index 5080df23093863e16a79ea56d7597e017c27ec87..46c48990c0678ccc4a3282820ddd8b6fec5929aa 100644 (file)
@@ -27,6 +27,9 @@ mono_llvm_create_ee (LLVMModuleProviderRef MP, AllocCodeMemoryCb *alloc_cb, Func
 void
 mono_llvm_optimize_method (LLVMValueRef method);
 
+void
+mono_llvm_dump_value (LLVMValueRef value);
+
 LLVMValueRef
 mono_llvm_build_alloca (LLVMBuilderRef builder, LLVMTypeRef Ty, 
                                                LLVMValueRef ArraySize,
index bbba39559d15a62a10aa1c37eb6af1d1b8aa516e..9798acb85eeb40b3326c252b7466494ddf4118d4 100644 (file)
@@ -680,6 +680,11 @@ mono_llvm_emit_method (MonoCompile *cfg)
        method_type = sig_to_llvm_sig (ctx, sig, cfg->vret_addr != NULL);
        CHECK_FAILURE (ctx);
 
+       for (i = 0; i < sig->param_count; ++i) {
+               if (MONO_TYPE_ISSTRUCT (sig->params [i]))
+                       LLVM_FAILURE (ctx, "vtype param");
+       }
+
        method_name = mono_method_full_name (cfg->method, TRUE);
        method = LLVMAddFunction (module, method_name, method_type);
        ctx->lmethod = method;
@@ -1909,15 +1914,15 @@ mono_llvm_emit_method (MonoCompile *cfg)
        }
 
        if (last)
-               LLVMDumpValue (method);
+               mono_llvm_dump_value (method);
 
        if (cfg->verbose_level > 1)
-               LLVMDumpValue (method);
+               mono_llvm_dump_value (method);
 
        mono_llvm_optimize_method (method);
 
        if (cfg->verbose_level > 1)
-               LLVMDumpValue (method);
+               mono_llvm_dump_value (method);
 
        cfg->native_code = LLVMGetPointerToGlobal (ee, method);