Hi Cristianno,<br><br>Great to know it works for you! Btw it would be very nice if someone could help cleaning these fixes from CUDA/OpenCL stuff and contribute patch to trunk, finally, with some tests.<br><br>> the global variable was created with
both modifiers: static and extern.<br><br>Oh, right, this is wrong in general, was there just to unify behavior with the cudafe source preprocessor, which does the same thing, since on GPU global variables could not be shared between compilation units.<br>
<br>- D.<br><br><div class="gmail_quote">2012/3/5 Cristianno Martins <span dir="ltr"><<a href="mailto:cristiannomartins@gmail.com">cristiannomartins@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello again,<br>
<br>
Thanks for the responses =)<br>
<br>
Dmitry, I have two points to comment:<br>
- First, I applied these two patches, and the .cbe.c file came out ok,<br>
except for one little thing -- the global variable was created with<br>
both modifiers: static and extern. Then, I just added a single guard<br>
to prevent this to happen (in a case of a variable having local<br>
linkage, the "extern" part was not printed to file).<br>
- Second, I created the patch appended in this email, but instead of<br>
representing only the "guard-adding" part, this patch is a union of<br>
this change, and the others two patches you sent to me.<br>
<br>
Thanks again,<br>
<div class="im HOEnZb"><br>
--<br>
Cristianno Martins<br>
PhD Student of Computer Science<br>
University of Campinas<br>
<a href="mailto:cmartins@ic.unicamp.br">cmartins@ic.unicamp.br</a><br>
<br>
<br>
<br>
</div><div class="HOEnZb"><div class="h5">On Mon, Mar 5, 2012 at 6:19 AM, Dmitry N. Mikushin <<a href="mailto:maemarcus@gmail.com">maemarcus@gmail.com</a>> wrote:<br>
> Hi Cristianno,<br>
><br>
> This problem has been around for a while, ourselves we solve it with the<br>
> following patches:<br>
><br>
> <a href="https://hpcforge.org/scm/viewvc.php/trunk/patches/llvm.gpu.patch?root=kernelgen&view=markup" target="_blank">https://hpcforge.org/scm/viewvc.php/trunk/patches/llvm.gpu.patch?root=kernelgen&view=markup</a><br>
><br>
> <a href="https://hpcforge.org/scm/viewvc.php/trunk/patches/llvm.patch?revision=591&root=kernelgen&view=markup" target="_blank">https://hpcforge.org/scm/viewvc.php/trunk/patches/llvm.patch?revision=591&root=kernelgen&view=markup</a><br>
><br>
> Please feel free to apply them, they *should* work for you even with the<br>
> latest llvm 3.1. Also please feel free to ping me in case of any troubles.<br>
><br>
> - D.<br>
><br>
><br>
><br>
> ----- Original message -----<br>
>> Hello everyone,<br>
>><br>
>> I've been trying to generate a C file using the llc tool, but I'm<br>
>> having a problem. I'm using a single Hello World program in C, and<br>
>> executing the following passes:<br>
>><br>
>> clang -emit-llvm -c -o hello.bc hello.c # getting the bit code of<br>
>> hello.c llc -march=c hello.bc # generating the<br>
>> hello.cbe.c file using the llvm C backend<br>
>><br>
>> So far, nothing weird happened. The problem occurs once I try to<br>
>> compile the hello.cbe.c: gcc, and even clang, show me some warning and<br>
>> error messages.<br>
>> Cheking in hello.cbe.c, I could see that the problem was related with<br>
>> the structs declarations and initialization. There, they appears to be<br>
>> something like<br>
>><br>
>> /* Global Variable Declarations */<br>
>> static _OC_str { unsigned char array[13]; };<br>
>><br>
>> /* Global Variable Definitions and Initialization */<br>
>> static _OC_str { unsigned char array[13]; } = { "Hello<br>
>> World\n"<br>
>> };<br>
>><br>
>> when they should be like<br>
>><br>
>> /* Global Variable Declarations */<br>
>> static struct type_OC_str { unsigned char array[13]; };<br>
>><br>
>> /* Global Variable Definitions and Initialization */<br>
>> static struct type_OC_str _OC_str = { "Hello World\n" };<br>
>><br>
>> It is a known problem, or am I doing something wrong?<br>
>><br>
>> Thks in advance,<br>
>><br>
>> --<br>
>> Cristianno Martins<br>
>> PhD Student of Computer Science<br>
>> University of Campinas<br>
>> <a href="mailto:cmartins@ic.unicamp.br">cmartins@ic.unicamp.br</a><br>
>><br>
>> _______________________________________________<br>
>> LLVM Developers mailing list<br>
>> <a href="mailto:LLVMdev@cs.uiuc.edu">LLVMdev@cs.uiuc.edu</a> <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a><br>
>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a><br>
><br>
</div></div></blockquote></div><br>