[LLVMdev] Problem with PTX assembly printing (NVPTX backend)

nkavv at physics.auth.gr nkavv at physics.auth.gr
Mon Feb 4 11:04:40 PST 2013


Hi,

> Can you post the llc command line you're using?  Can you post an LLVM IR
> file that causes this behavior?

yes:

${LLVM_PATH}/bin/llc -o helloworld.s -march=nvptx helloworld.ll

where LLVM_PATH my local installation path for LLVM.

Also attaching helloworld.c:

#include <stdio.h>

int main(void) {
   printf("Hello World!\n");
   return 0;
}



and helloworld.ll:

; ModuleID = 'helloworld.c'
target datalayout =  
"e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-f80:128:128-v64:64:64-v128:128:128-a0:0:64-f80:32:32-n8:16:32-S32"
target triple = "i686-w64-mingw32"

@str = private unnamed_addr constant [13 x i8] c"Hello World!\00"

define i32 @main() nounwind {
   %puts = tail call i32 @puts(i8* getelementptr inbounds ([13 x i8]*  
@str, i32 0, i32 0))
   ret i32 0
}

declare i32 @puts(i8* nocapture) nounwind


For instance, the "mips" target produces this:

	.section .mdebug.abi32
	.previous
	.file	"helloworld.ll"
	.text
	.globl	main
	.align	2
	.type	main, at function
	.set	nomips16                # @main
	.ent	main
main:
	.frame	$sp,24,$ra
	.mask 	0x80000000,-4
	.fmask	0x00000000,0
	.set	noreorder
	.set	nomacro
	.set	noat
# BB#0:
	lui	$2, %hi(_gp_disp)
	addiu	$2, $2, %lo(_gp_disp)
	addiu	$sp, $sp, -24
	sw	$ra, 20($sp)            # 4-byte Folded Spill
	addu	$gp, $2, $25
	lw	$1, %got($str)($gp)
	lw	$25, %call16(puts)($gp)
	jalr	$25
	addiu	$4, $1, %lo($str)
	addiu	$2, $zero, 0
	lw	$ra, 20($sp)            # 4-byte Folded Reload
	jr	$ra
	addiu	$sp, $sp, 24
	.set	at
	.set	macro
	.set	reorder
	.end	main
$tmp2:
	.size	main, ($tmp2)-main

	.type	$str, at object            # @str
	.section	.rodata.str1.4,"aMS", at progbits,1
	.align	2
$str:
	.asciz	 "Hello World!"
	.size	$str, 13





Best regards
Nikolaos Kavvadias


>>  BTW I've built LLVM with mingw (strange mixture of gcc-3.4.5 and
>>>> g++-4.6.1). Native compilation, MIPS backend and other things that i've
>>>> tested, all work properly.
>>>>
>>>
>>> Perhaps this "strange mixture" is causing some symbol errors somewhere.
>>> Can you post the exact sequence of steps you used to build LLVM, along
>>> with
>>> the llc command-line that fails for you?
>>>
>>
>> My configuration options were:
>>
>> --prefix=/my/local/path/or/so --enable-shared --enable-targets=all
>> --enable-optimized --disable-libffi --disable-debug-runtime
>> --disable-assertions --disable-expensive-checks
>>
>> Following configuration i did the typical make and make install (to a
>> selected path by --prefix.
>>
>>
>> Best regards
>> Nikolaos Kavvadias
>>
>>
>>
>>>
>>>
>>>> Any help is appreciated.
>>>>
>>>> Best regards,
>>>> Nikolaos Kavvadias
>>>>
>>>>
>>>>
>>>> ______________________________****_________________
>>>>
>>>> LLVM Developers mailing list
>>>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>>>> http://lists.cs.uiuc.edu/****mailman/listinfo/llvmdev<http://lists.cs.uiuc.edu/**mailman/listinfo/llvmdev>
>>>> <http:**//lists.cs.uiuc.edu/mailman/**listinfo/llvmdev<http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev>
>>>> >
>>>>
>>>>
>>>
>>>
>>> --
>>>
>>> Thanks,
>>>
>>> Justin Holewinski
>>>
>>>
>>
>>
>>
>
>
> --
>
> Thanks,
>
> Justin Holewinski
>






More information about the llvm-dev mailing list