MCRegister getX86SubSuperRegister*(MCRegister Reg, unsigned Size, bool High = false);
A strange behavior of the functions getX86SubSuperRegister* was
introduced by llvm-svn:145579: The returned register may not
match the parameters when a 8-bit high register is required.
And llvm-svn: 175762 refined the code and dropped the comments, then we
knew nothing happened there from the code :-(
These two functions are only called with Size=8 and High=true in two places.
One is in X86FixupBWInsts.cpp for liveness of registers and the other is in
X86AsmPrinter.cpp for inline asm.
For the first one, we provide an alternative in this patch.
For the second one, the strange behaviour caused a bug that an erorr was not reported for mismatched modifier.
void f() { char x; asm volatile ("mov %%ah, %h0" :"=r"(x)::"%eax", "%ebx", "%ecx", "%edx", "edi", "esi"); }
$ gcc -S test.c error: extended registers have no high halves
$ clang -S test.c no error
so we fix the bug in this patch.
getX86SubSuperRegister is just a wrapper of getX86SubSuperRegisterOrZero with a assert.
I belive we should remove the latter.
Didn't the old name more accurately describe this function?