forked from OSchip/llvm-project
Add support for the 'h' constraint.
Part of rdar://9119939 llvm-svn: 134203
This commit is contained in:
parent
b403f0c4ed
commit
f45daac30f
|
@ -7482,6 +7482,7 @@ ARMTargetLowering::getConstraintType(const std::string &Constraint) const {
|
||||||
default: break;
|
default: break;
|
||||||
case 'l': return C_RegisterClass;
|
case 'l': return C_RegisterClass;
|
||||||
case 'w': return C_RegisterClass;
|
case 'w': return C_RegisterClass;
|
||||||
|
case 'h': return C_RegisterClass;
|
||||||
}
|
}
|
||||||
} else if (Constraint.size() == 2) {
|
} else if (Constraint.size() == 2) {
|
||||||
switch (Constraint[0]) {
|
switch (Constraint[0]) {
|
||||||
|
@ -7534,11 +7535,16 @@ ARMTargetLowering::getRegForInlineAsmConstraint(const std::string &Constraint,
|
||||||
if (Constraint.size() == 1) {
|
if (Constraint.size() == 1) {
|
||||||
// GCC ARM Constraint Letters
|
// GCC ARM Constraint Letters
|
||||||
switch (Constraint[0]) {
|
switch (Constraint[0]) {
|
||||||
case 'l':
|
case 'l': // Low regs or general regs.
|
||||||
if (Subtarget->isThumb())
|
if (Subtarget->isThumb())
|
||||||
return Pair(0U, ARM::tGPRRegisterClass);
|
return Pair(0U, ARM::tGPRRegisterClass);
|
||||||
else
|
else
|
||||||
return Pair(0U, ARM::GPRRegisterClass);
|
return Pair(0U, ARM::GPRRegisterClass);
|
||||||
|
case 'h': // High regs or no regs.
|
||||||
|
if (Subtarget->isThumb())
|
||||||
|
return Pair(0U, ARM::hGPRRegisterClass);
|
||||||
|
else
|
||||||
|
return Pair(0u, static_cast<const TargetRegisterClass*>(0));
|
||||||
case 'r':
|
case 'r':
|
||||||
return Pair(0U, ARM::GPRRegisterClass);
|
return Pair(0U, ARM::GPRRegisterClass);
|
||||||
case 'w':
|
case 'w':
|
||||||
|
|
|
@ -228,6 +228,9 @@ def rGPR : RegisterClass<"ARM", [i32], 32, (sub GPR, SP, PC)> {
|
||||||
// the general GPR register class above (MOV, e.g.)
|
// the general GPR register class above (MOV, e.g.)
|
||||||
def tGPR : RegisterClass<"ARM", [i32], 32, (trunc GPR, 8)>;
|
def tGPR : RegisterClass<"ARM", [i32], 32, (trunc GPR, 8)>;
|
||||||
|
|
||||||
|
// The high registers in thumb mode, R8-R15.
|
||||||
|
def hGPR : RegisterClass<"ARM", [i32], 32, (sub GPR, tGPR)>;
|
||||||
|
|
||||||
// For tail calls, we can't use callee-saved registers, as they are restored
|
// For tail calls, we can't use callee-saved registers, as they are restored
|
||||||
// to the saved value before the tail call, which would clobber a call address.
|
// to the saved value before the tail call, which would clobber a call address.
|
||||||
// Note, getMinimalPhysRegClass(R0) returns tGPR because of the names of
|
// Note, getMinimalPhysRegClass(R0) returns tGPR because of the names of
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
; RUN: llc < %s -march=thumb | FileCheck %s
|
||||||
|
define i32 @t1(i32 %x, i32 %y) nounwind {
|
||||||
|
entry:
|
||||||
|
; CHECK: mov r0, r12
|
||||||
|
%0 = tail call i32 asm "mov $0, $1", "=l,h"(i32 %y) nounwind
|
||||||
|
ret i32 %0
|
||||||
|
}
|
Loading…
Reference in New Issue