diff options
author | Eric Christopher <echristo@apple.com> | 2011-06-30 23:23:01 +0000 |
---|---|---|
committer | Eric Christopher <echristo@apple.com> | 2011-06-30 23:23:01 +0000 |
commit | 73744df0c467895bac9e25d5c62f34a0a8fcc4f9 (patch) | |
tree | b5809de3f1c4490adc633974fe03ddb4a4e3230a | |
parent | 5cd2791513919ee7504c309151321e4e37a05a58 (diff) | |
download | llvm-73744df0c467895bac9e25d5c62f34a0a8fcc4f9.tar.gz llvm-73744df0c467895bac9e25d5c62f34a0a8fcc4f9.tar.bz2 llvm-73744df0c467895bac9e25d5c62f34a0a8fcc4f9.tar.xz |
Add support for the 'h' constraint.
Part of rdar://9119939
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134203 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/Target/ARM/ARMISelLowering.cpp | 8 | ||||
-rw-r--r-- | lib/Target/ARM/ARMRegisterInfo.td | 3 | ||||
-rw-r--r-- | test/CodeGen/Thumb/inlineasm-thumb.ll | 7 |
3 files changed, 17 insertions, 1 deletions
diff --git a/lib/Target/ARM/ARMISelLowering.cpp b/lib/Target/ARM/ARMISelLowering.cpp index 092ff17edc..1b9bcc9966 100644 --- a/lib/Target/ARM/ARMISelLowering.cpp +++ b/lib/Target/ARM/ARMISelLowering.cpp @@ -7482,6 +7482,7 @@ ARMTargetLowering::getConstraintType(const std::string &Constraint) const { default: break; case 'l': return C_RegisterClass; case 'w': return C_RegisterClass; + case 'h': return C_RegisterClass; } } else if (Constraint.size() == 2) { switch (Constraint[0]) { @@ -7534,11 +7535,16 @@ ARMTargetLowering::getRegForInlineAsmConstraint(const std::string &Constraint, if (Constraint.size() == 1) { // GCC ARM Constraint Letters switch (Constraint[0]) { - case 'l': + case 'l': // Low regs or general regs. if (Subtarget->isThumb()) return Pair(0U, ARM::tGPRRegisterClass); else 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': return Pair(0U, ARM::GPRRegisterClass); case 'w': diff --git a/lib/Target/ARM/ARMRegisterInfo.td b/lib/Target/ARM/ARMRegisterInfo.td index 77414108aa..76eb496bde 100644 --- a/lib/Target/ARM/ARMRegisterInfo.td +++ b/lib/Target/ARM/ARMRegisterInfo.td @@ -228,6 +228,9 @@ def rGPR : RegisterClass<"ARM", [i32], 32, (sub GPR, SP, PC)> { // the general GPR register class above (MOV, e.g.) 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 // to the saved value before the tail call, which would clobber a call address. // Note, getMinimalPhysRegClass(R0) returns tGPR because of the names of diff --git a/test/CodeGen/Thumb/inlineasm-thumb.ll b/test/CodeGen/Thumb/inlineasm-thumb.ll new file mode 100644 index 0000000000..f2683c8dd8 --- /dev/null +++ b/test/CodeGen/Thumb/inlineasm-thumb.ll @@ -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 +} |