The following test case crashes the X86 backend. target endian = little target pointersize = 32 target triple = "i686-pc-linux-gnu" %str = external global [12 x sbyte] ; <[12 x sbyte]*> [#uses=1] implementation ; Functions: void %unknown_bootoption() { entry: call void asm sideeffect "ud2\0A\09.word ${0:c}\0A\09.long ${1:c}\0A", "i,i,~{dirflag},~{fpsr},~{flags}"( int 235, sbyte* getelementptr ([12 x sbyte]* %str, int 0, uint 0) ) ret void }
Evan, this is a bug in the bottom-up selection code. The problem is that X86GenDAGISel.inc calls SelectInlineAsmMemoryOperands on line 23765. This method (in SelectionDAGISel.cpp) calls SelectInlineAsmMemoryOperand on memops. However, these operands are not getting added to the selection queue, so the X86ISD::Wrapper object never gets selected. If you won't get to this before you leave, please reassign it back to me. -Chris
Looks like there is another bug: Operand 4 of the inline asm node is an immediate 11. That means operand 5 is expected to be an immediate as well. But it is a X86ISD::Wrapper of TargetGlobalAddress <[12 x sbyte]* %str> which would select to a X86::MOVri. This would still fail.
Implemented. Testcase here: CodeGen/X86/asm-global-imm.ll There are several patches, so not listing here. -Chris