[llvm-commits] [llvm] r120225 - in /llvm/trunk: lib/Target/X86/X86ISelLowering.cpp lib/Target/X86/X86ISelLowering.h lib/Target/X86/X86InstrCompiler.td test/CodeGen/X86/2009-04-24.ll test/CodeGen/X86/2009-12-11-TLSNoRedZone.ll test/CodeGen/X86/tls-pic.ll

Chris Lattner clattner at apple.com
Sun Nov 28 11:16:10 PST 2010


On Nov 27, 2010, at 12:43 PM, Rafael Espindola wrote:

> Author: rafael
> Date: Sat Nov 27 14:43:02 2010
> New Revision: 120225
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=120225&view=rev
> Log:
> Lower TLS_addr32 and TLS_addr64.

Very nice Rafael,

One possible concern though:

> 
> +    BuildMI(*BB, MI, DL, TII->get(X86::DATA16_PREFIX));
> +    BuildMI(*BB, MI, DL, TII->get(X86::DATA16_PREFIX));
> +    BuildMI(*BB, MI, DL, TII->get(X86::REX64_PREFIX));
> +    BuildMI(*BB, MI, DL, TII->get(X86::CALL64pcrel32))
> +      .addExternalSymbol("__tls_get_addr",  X86II::MO_PLT)
> +      .addReg(X86::RDI, RegState::Implicit);

My understanding of ELF TLS is that the ABI requires a very specific series of machine instructions to be emitted.  If this is true, I'm concerned that some random codegen changes (e.g. live range splitting in regalloc) could cause spills or other instructions to be inserted into the middle of this carefully crafted sequence.

If this is a real issue, the best approach is to have a pseudo instruction that is lowered at MCInstLowering time into the right sequence of MCInsts.

-Chris





More information about the llvm-commits mailing list