X86: Rework inline asm integer register specification.
authorMatthias Braun <matze@braunis.de>
Mon, 29 Jun 2015 21:35:51 +0000 (21:35 +0000)
committerMatthias Braun <matze@braunis.de>
Mon, 29 Jun 2015 21:35:51 +0000 (21:35 +0000)
commit7839b00d43d9163fe4f2c8e9a3b59965fcd8d600
tree6b71777ac77823eca916293b440ac1105d1cf2c6
parent93dd711033a224fb54de157fd5270967627affe5
X86: Rework inline asm integer register specification.

This is a new version of http://reviews.llvm.org/D10260.

It turned out that when you specify an integer register in inline asm on
x86 you get the register of the required type size back. That means that
X86TargetLowering::getRegForInlineAsmConstraint() has to accept any of
the integer registers and adapt its size to the given target size which
may be any 8/16/32/64 bit sized type. Surprisingly that means given a
constraint of "{ax}" and a type of MVT::F32 we need to return X86::EAX.

This change makes this face explicit, the previous code seemed like
working by accident because there it never returned an error once a
register was found. On the other hand this rewrite allows to actually
return errors for invalid situations like requesting an integer register
for an i128 type.

Related to rdar://21042280

Differential Revision: http://reviews.llvm.org/D10813

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241002 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86ISelLowering.cpp
lib/Target/X86/X86RegisterInfo.cpp
lib/Target/X86/X86RegisterInfo.h
test/CodeGen/X86/asm-mismatched-types.ll [new file with mode: 0644]
test/CodeGen/X86/asm-reject-reg-type-mismatch.ll [new file with mode: 0644]