[LLVMdev] Upstreaming x32 ABI support

Steven Newbury steve at snewbury.org.uk
Thu Jul 3 00:57:47 PDT 2014


On Wed, 2014-07-02 at 18:59 +0400, Pavel Chupin wrote:
> Hi all,
>  
> We (Intel) would like to revive this thread on X32 ABI support
> upstreaming. X32 ABI homepage is here:
> https://sites.google.com/site/x32abi/
>  
> Currently x32 support is available in kernel/glibc/gcc/binutils and
> one can install for example Ubuntu 14 with extra x32 lib packages
> (apt-get install libc6-dev-x32) to evaluate x32-target code generated
> by GCC (gcc supports x32 on Ubuntu 14 out of box).
>  
> We are planning to contribute enabling patches in LLVM/Clang trees 
> and
> going to provide continuous support for this ABI in the future. Most
> of the changes obviously will be submitted to backend.
>  
> Our current work is based on:
>  
> * what’s currently done in trunk (some changes required for x32 are
> already there)
> * Michael Liao work done ~2 years ago and available here:
> http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120604/058450.html
>  
> What’s currently in trunk:
>  
> * Triplet x86_64-*-linux-gnux32 (command line support, 
> EnvironmentType
> enum to differentiate x32 from x86_64 by getTriple().getEnvironment()
> == llvm::Triple::GNUX32)
> https://github.com/llvm-mirror/llvm/commit/9dd2a3b1f2c253e20262535bb89b1ab6cc680ece
> * ILP32/LP64 differentiation for TargetMachine
> https://github.com/llvm-mirror/llvm/commit/a5597f0eaf1f93c6d0bc641a0cc54ecffb33955a
> * LEA tuning:
> https://github.com/llvm-mirror/llvm/commit/693c37aa86506be657dfaf8835845b0998531c3c
> * Bunch of tests (grep for gnux32):
> test/CodeGen/X86/imul64-lea.ll
> test/CodeGen/X86/stack-update-frame-opcode.ll
> test/CodeGen/X86/stack-update-frame-opcode.ll
> test/CodeGen/X86/x86-64-sret-return.ll
> test/CodeGen/X86/rip-rel-lea.ll
> test/CodeGen/X86/x86-64-sret-return-2.ll
> test/CodeGen/X86/x86-64-ptr-arg-simple.ll
> test/MC/X86/gnux32-dwarf-gen.s
>  
> What’s been done by Michael
> (http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20120604/058450.html)
> but not released in trunk:
>  
> * Clang Driver support (linker/libraries paths lookup, x32 specific
> flags, etc.). This change is rebased, modified and submitted here:
> http://reviews.llvm.org/D4180 . Welcome to review.
> * ELF support for x32. This change is rebased, modified and submitted
> here: http://reviews.llvm.org/D4181  . Welcome to review.
> * Use EBP/ESP as frame/stack pointer. This patch will be rebased
> modified and submitted soon.
> * Other cases which require introduction X32 specific instruction
> definitions such as JMPX32r/CALLX32r/CALLX32m.
> * X32 JIT support
> * I hope Michael correct me if I missed anything important
>  
> What’s still missing or experiencing issues (just something from the 
> top):
>  
> * New tests required and several existing tests fail when extending 
> to x32.
> * Pointer and struct return;
> * Cast int to pointer;
> * Function indirect calls;
> * TLS
> * Etc.
>  
> We don’t plan to introduce new backend from scratch. Major part of 
> the
> changes are incremental to X86 backend and extend cases such as
>  
> (64bits) ? do-64 : do-32
> with
> (64bits) ? ((LP64) ? do-64 : do-x32) : do-32
>  
> or some shorter form if x32 mimic x86 or x86_64. X32 ABI is very 
> close
> to x86-64 ABI.
>  
> Our plan is to start from basic stuff, focus on more tests adding and
> on stability issues, then continue with performance tuning. So the
> first 2 patches I submitted enable “Hello, world!” sample on Ubuntu
> 14. Patches are here:
>  
>                 http://reviews.llvm.org/D4180
>                 http://reviews.llvm.org/D4181
>  
> Next steps are to rebase and split Michael patch, cover with tests 
> and
> submit by chunks convenient for review. Then move to other discovered
> issues.
>  
> Any suggestions and patches review are welcome!
>  
This is terrific news! :) I tried to tackle it on my own before, it 
was just too much to take on; or rather, I didn't have the needed 
skill or experience to get it working alone.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: This is a digitally signed message part
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140703/f309aaf4/attachment.sig>


More information about the llvm-dev mailing list