Retourner au contenu associé (journal : LLVM dans un gestionnaire de paquets ?)
Posté par steckdenis le 01 septembre 2009 à 17:41. En réponse au journal LLVM dans un gestionnaire de paquets ?. Évalué à 2.
$ llc -o - bc.bc -march=ppc32
.file "bc.bc" .text .global main .type main, @function .align 2 main: mflr 0 stw 0, 4(1) stwu 1, -16(1) lis 3, .L.str@ha la 3, .L.str@l(3) creqv 0, 0, 0 cror 6, 0, 0 bl printf li 3, 0 addi 1, 1, 16 lwz 0, 4(1) mtlr 0 blr .size main,.-main .section .rodata.str1.1,"aMS",@progbits,1 .L.str: # '@.str' .asciz "Salut !"
.file "bc.bc" .eabi_attribute 20, 1 .eabi_attribute 21, 1 .eabi_attribute 23, 3 .eabi_attribute 24, 1 .eabi_attribute 25, 1 .text .globl main .align 2 main: str lr, [sp, #-4]! ldr r0, .LCPI1_0 bl printf mov r0, #0 ldr lr, [sp], #+4 bx lr .LBB1_1: .LCPI1_0: .long .L.str .size main, .-main .type .L.str,%object .section .rodata.str1.1,"aMS",%progbits,1 .L.str: @ @.str .size .L.str, 8 .asciz "Salut !"
.file "bc.bc" .text .align 16 .globl main .type main,@function main: # @main .LBB1_0: # %entry subq 8,ドル %rsp movl $.L.str, %edi xorb %al, %al call printf xorl %eax, %eax addq 8,ドル %rsp ret .size main, .-main .type .L.str,@object .section .rodata.str1.1,"aMS",@progbits,1 .L.str: # @.str .asciz "Salut !" .size .L.str, 8 .section .note.GNU-stack,"",@progbits
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
[^] # Re: LLVM IR n'est pas portable
Posté par steckdenis . En réponse au journal LLVM dans un gestionnaire de paquets ?. Évalué à 2.
C'est possible, mais alors ceci m'étonne :
$ llc -o - bc.bc -march=ppc32
Donc en ppc32 :
.file "bc.bc"
.text
.global main
.type main, @function
.align 2
main:
mflr 0
stw 0, 4(1)
stwu 1, -16(1)
lis 3, .L.str@ha
la 3, .L.str@l(3)
creqv 0, 0, 0
cror 6, 0, 0
bl printf
li 3, 0
addi 1, 1, 16
lwz 0, 4(1)
mtlr 0
blr
.size main,.-main
.section .rodata.str1.1,"aMS",@progbits,1
.L.str: # '@.str'
.asciz "Salut !"
Maintenant, testons l'ARM, avec le même fichier :
.file "bc.bc"
.eabi_attribute 20, 1
.eabi_attribute 21, 1
.eabi_attribute 23, 3
.eabi_attribute 24, 1
.eabi_attribute 25, 1
.text
.globl main
.align 2
main:
str lr, [sp, #-4]!
ldr r0, .LCPI1_0
bl printf
mov r0, #0
ldr lr, [sp], #+4
bx lr
.LBB1_1:
.LCPI1_0:
.long .L.str
.size main, .-main
.type .L.str,%object
.section .rodata.str1.1,"aMS",%progbits,1
.L.str: @ @.str
.size .L.str, 8
.asciz "Salut !"
et pour finir, le x86_64
.file "bc.bc"
.text
.align 16
.globl main
.type main,@function
main: # @main
.LBB1_0: # %entry
subq 8,ドル %rsp
movl $.L.str, %edi
xorb %al, %al
call printf
xorl %eax, %eax
addq 8,ドル %rsp
ret
.size main, .-main
.type .L.str,@object
.section .rodata.str1.1,"aMS",@progbits,1
.L.str: # @.str
.asciz "Salut !"
.size .L.str, 8
.section .note.GNU-stack,"",@progbits
Pour un truc pas portable, ça passe assez bien. À mon avis, cette en-tête est plutôt là pour dire «J'ai été compilé sur cette arch, donc je risque d'être dépendant de ça. Tu connais les différences entre les deux, corrige-les».