From: John M. <ato...@gm...> - 2009-12-05 05:18:00
|
I had a pain free build using Visual Studio C++ 2008 express edition and CMake on Windows XP. C:\_projects_\build_llvm>cmake -G "Visual Studio 9 2008" -DLLVM_TARGETS_TO_BUILD="AVR" -DCMAKE_BUILD_TYPE=Debug -DLLVM_BUILD_TOOLS=ON -DLLVM_BUILD_EXAMPLES=OFF -DLLVM_ENABLE_THREADS=OFF ..\llvm ~~~~~ C:\_projects_\build_llvm\bin\Debug>llc.exe --version Low Level Virtual Machine (http://llvm.org/): llvm version 2.7svn DEBUG build with assertions. Built Dec 4 2009 (20:35:54). Host: i686-pc-win32 Host CPU: (unknown) Registered Targets: avr - AVR [experimental] C:\_projects_\build_llvm\bin\Debug>llc.exe -O0 -filetype=asm -mcpu=atmega128 reti8.ll -o - .file "reti8.ll" .text .align 16 .globl func .type func,@function func: # BB#0: ldi r24, #1 mov r24, r24 ret .size func, .-func |
From: Weddington, E. <Eri...@at...> - 2009-12-05 06:24:16
|
> -----Original Message----- > From: John Myers [mailto:ato...@gm...] > Sent: Friday, December 04, 2009 10:18 PM > To: avr...@li... > Subject: [avr-llvm-devel] Windows build > > > I had a pain free build using Visual Studio C++ 2008 express > edition and CMake on Windows XP. Congratulations! > C:\_projects_\build_llvm\bin\Debug>llc.exe -O0 -filetype=asm > -mcpu=atmega128 reti8.ll -o - > .file "reti8.ll" > > .text > .align 16 > .globl func Can we change the directive to be the full spelling?: .global > .type func,@function > func: > # BB#0: > ldi r24, #1 > mov r24, r24 What's up with the redundant mov? Or will future optimization take care of removing this? > ret > .size func, .-func > > |
From: John M. <ato...@gm...> - 2009-12-05 07:17:52
|
On Fri, Dec 4, 2009 at 10:23 PM, Weddington, Eric <Eri...@at... > wrote: > > > > -----Original Message----- > > From: John Myers [mailto:ato...@gm...] > > Sent: Friday, December 04, 2009 10:18 PM > > To: avr...@li... > > Subject: [avr-llvm-devel] Windows build > > > > > > I had a pain free build using Visual Studio C++ 2008 express > > edition and CMake on Windows XP. > > Congratulations! > > > C:\_projects_\build_llvm\bin\Debug>llc.exe -O0 -filetype=asm > > -mcpu=atmega128 reti8.ll -o - > > .file "reti8.ll" > > > > .text > > .align 16 > > .globl func > > Can we change the directive to be the full spelling?: .global > > Yeah, that's an easy change (it's in AsmPrinter\AVRAsmPrinter.cpp). > > .type func,@function > > func: > > # BB#0: > > ldi r24, #1 > > mov r24, r24 > > What's up with the redundant mov? Or will future optimization take care of > removing this? > > > ret > > .size func, .-func > > > > > Good question, I haven't looked into (with any detail) how LLVM IR is converted to native assembly. I will probable spend some time later this weekend checking that out. |
From: John M. <ato...@gm...> - 2009-12-09 01:52:05
|
On Fri, Dec 4, 2009 at 10:23 PM, Weddington, Eric <Eri...@at... > wrote: > .type func,@function > func: > # BB#0: > ldi r24, #1 > mov r24, r24 What's up with the redundant mov? Or will future optimization take care of > removing this? > > > ret > > .size func, .-func > > > > > The redudant mov is gone now. So it looks like whatever they changed in the LLVM trunk fixed it. C:\_projects_\build_llvm\bin\Debug>llc --version Low Level Virtual Machine (http://llvm.org/): llvm version 2.7svn DEBUG build with assertions. Built Dec 7 2009 (21:57:15). Host: i686-pc-win32 Host CPU: (unknown) Registered Targets: avr - AVR [experimental] C:\_projects_\build_llvm\bin\Debug>llc.exe -O0 -o - -filetype=asm -mcpu=atmega128 reti8.ll .file "reti8.ll" .text .align 16 .global func .type func,@function func: # BB#0: ldi r24, #1 ret .size func, .-func |
From: Weddington, E. <Eri...@at...> - 2009-12-09 03:04:47
|
> -----Original Message----- > From: John Myers [mailto:ato...@gm...] > Sent: Tuesday, December 08, 2009 6:46 PM > To: Weddington, Eric > Cc: avr...@li... > Subject: Re: [avr-llvm-devel] Windows build > > > > The redudant mov is gone now. So it looks like whatever they > changed in the LLVM trunk fixed it. That's great! Question: Is the assembler output of llvm supposed to closely match the assembler output of avr-gcc? Is that what we're aiming for? > C:\_projects_\build_llvm\bin\Debug>llc.exe -O0 -o - > -filetype=asm -mcpu=atmega128 reti8.ll > .file "reti8.ll" > > .text > .align 16 > .global func > .type func,@function > func: > # BB#0: > ldi r24, #1 > ret > .size func, .-func If so, then we need to drop the .align directive above. This is the equivalent from avr-gcc: .file "test.c" __SREG__ = 0x3f __SP_H__ = 0x3e __SP_L__ = 0x3d __CCP__ = 0x34 __tmp_reg__ = 0 __zero_reg__ = 1 .text .global func .type func, @function func: /* prologue: function */ /* frame size = 0 */ ldi r24,lo8(1) /* epilogue start */ ret .size func, .-func |
From: John M. <ato...@gm...> - 2009-12-09 03:30:14
|
On Tue, Dec 8, 2009 at 7:04 PM, Weddington, Eric <Eri...@at...>wrote: > > > > -----Original Message----- > > From: John Myers [mailto:ato...@gm...] > > Sent: Tuesday, December 08, 2009 6:46 PM > > To: Weddington, Eric > > Cc: avr...@li... > > Subject: Re: [avr-llvm-devel] Windows build > > > > > > > > The redudant mov is gone now. So it looks like whatever they > > changed in the LLVM trunk fixed it. > > That's great! > > Question: Is the assembler output of llvm supposed to closely match the > assembler output of avr-gcc? Is that what we're aiming for? > Yeah, it's suppose to be an assembly printer for gas / avr-gcc. Some targets actually produce multiple asm types for different assembler brands. > > > C:\_projects_\build_llvm\bin\Debug>llc.exe -O0 -o - > > -filetype=asm -mcpu=atmega128 reti8.ll > > .file "reti8.ll" > > > > .text > > .align 16 > > .global func > > .type func,@function > > func: > > # BB#0: > > ldi r24, #1 > > ret > > .size func, .-func > > If so, then we need to drop the .align directive above. This is the > equivalent from avr-gcc: > I'll try to find were the .align directive is printed to remove it. Will it mess things up if it's there? > > .file "test.c" > __SREG__ = 0x3f > __SP_H__ = 0x3e > __SP_L__ = 0x3d > __CCP__ = 0x34 > __tmp_reg__ = 0 > __zero_reg__ = 1 > .text > .global func > .type func, @function > func: > /* prologue: function */ > /* frame size = 0 */ > ldi r24,lo8(1) > /* epilogue start */ > ret > .size func, .-func > |
From: Weddington, E. <Eri...@at...> - 2009-12-09 03:35:36
|
> -----Original Message----- > From: John Myers [mailto:ato...@gm...] > Sent: Tuesday, December 08, 2009 8:30 PM > To: Weddington, Eric > Cc: avr...@li... > Subject: Re: [avr-llvm-devel] Windows build > > > > I'll try to find were the .align directive is printed to > remove it. Will it mess things up if it's there? > It might. I'm not sure if .align 16 is correct for the AVR target. Thanks for looking into this. AFAIK, the AVR default linker script for GNU ld take care of aligning the functions on a word (16-bit) boundary. |
From: Josef E. <za...@za...> - 2009-12-09 15:08:55
|
John Myers wrote: > What's up with the redundant mov? Or will future optimization take > care of removing this? > > > ret > > .size func, .-func > > > > > > The redudant mov is gone now. So it looks like whatever they changed in > the LLVM trunk fixed it. Nope. You fixed it in r53 ;)! The isMoveInstr() allows llvm to detect redundant MOVs. BTW: great work! Josef |
From: John M. <ato...@gm...> - 2009-12-09 19:43:55
|
LOL, I must have had a bad build after I added that because original I didn't see any changes. On Wed, Dec 9, 2009 at 7:08 AM, Josef Eisl <za...@za...> wrote: > John Myers wrote: > > What's up with the redundant mov? Or will future optimization take > > care of removing this? > > > > > ret > > > .size func, .-func > > > > > > > > > > The redudant mov is gone now. So it looks like whatever they changed in > > the LLVM trunk fixed it. > > Nope. You fixed it in r53 ;)! The isMoveInstr() allows llvm to detect > redundant MOVs. > BTW: great work! > > Josef > |