[LLVMdev] Polly test and example

MORIYAMA Tomohiro moriyama at isit.or.jp
Sun Jun 12 19:31:51 PDT 2011


(2011/06/11 0:01), Tobias Grosser wrote:
> On 06/10/2011 08:38 AM, MORIYAMA Tomohiro wrote:
>> hi, James.
>> Thanks for your advice.
>>
>> "James Molloy" wrote.
>> (Fri, 10 Jun 2011 08:38:44 +0100)
>>> Hi,
>>>
>>>> out.s: Assembler messages:
>>>> out.s:8: Error: bad register name `%rsp'
>>>> out.s:9: Error: bad register name `%rsp)'
>>>> out.s:12: Error: invalid instruction suffix for `call'
>>>> out.s:14: Error: bad register name `%rax'
>>>> out.s:18: Error: bad register name `%rcx'
>>>> out.s:22: Error: bad register name `%rcx)'
>>>> out.s:23: Error: bad register name `%rsp,%rcx,4)'
>>>> out.s:24: Error: bad register name `%rdx'
>>>> out.s:29: Error: bad register name `%rax'
>>>> out.s:36: Error: bad register name `%rsp,%rax,4)'
>>>> out.s:39: Error: bad register name `%rsp)'
>>>> out.s:42: Error: bad register name `%rsp)'
>>>> out.s:44: Error: bad register name `%rsp)'
>>>> out.s:45: Error: bad register name `%rsp'
>>>> tomohiro at ubuntu:~$
>>>
>>> llc compiled the test for 64-bit X86, and you're assembling with a 
>>> 32-bit
>>> assembler. Try the -m32 option.
>>
>> I tried this option with 'llc -march=x86' as follows,
>>
>> tomohiro at ubuntu:~/llvm/tools/polly/test/CodeGen$ opt -load 
>> /home/tomohiro/build/
>> lib/LLVMPolly.so \
>>    -basicaa -polly-prepare -polly-region-simplify -scev-aa \
>>     -polly-codegen \
>>     /home/tomohiro/llvm/tools/polly/test/CodeGen/single_loop.ll \
>>      | llc -march=x86 -o out.s&&  gcc -m32  out.s&&  ./a.out
>> tomohiro at ubuntu:~/build$
>>
>>
>> then it successfully ran.
>> So, on compiling llvm with Polly, is the suite of the tests are built 
>> as 64bit
>> files as the default?
>
> Mh. We built several test cases from C files on an amd64 machine. 
> Because of this the amd64 target triple is at the top of the several 
> of the .ll files. Have a look at single_loop.ll:
>
> target datalayout = 
> "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64"
> target triple = "x86_64-unknown-linux-gnu"
>
> As I believe there should not yet be any target specific stuff in the 
> .ll files, you may try to just remove those two lines from the .ll 
> file and run the test case again. Without the amd64 target triple it 
> should be built automatically for the native architecture.

I removed these two lines and run the test.
It ended with an error as follows:

tomohiro at ubuntu:~/llvm/tools/polly/test/CodeGen$ opt -load 
/home/tomohiro/build/lib/LLVMPolly.so \
 >    -basicaa -polly-prepare -polly-region-simplify -scev-aa \
 >     -polly-codegen \
 >     /home/tomohiro/llvm/tools/polly/test/CodeGen/single_loop.ll \
 >      | llc -o out.s&&  gcc out.s&&  ./a.out
LLVM ERROR: Bad TargetData ctor used.  Tool did not specify a TargetData 
to use?
/usr/lib/i386-linux-gnu/gcc/i686-linux-gnu/4.5.2/../../../crt1.o: In 
function `_start':
(.text+0x18): undefined reference to `main'
collect2: ld returned 1 exit status
tomohiro at ubuntu:~/llvm/tools/polly/test/CodeGen$


> Cheers
> Tobi
>
>

Thanks.

-- 
tomohiro
moriyama at isit.or.jp





More information about the llvm-dev mailing list