summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/WebAssembly
diff options
context:
space:
mode:
authorDan Gohman <dan433584@gmail.com>2015-12-05 20:03:44 +0000
committerDan Gohman <dan433584@gmail.com>2015-12-05 20:03:44 +0000
commit284384b64090931c793fba3b52e8372c8f0b48ce (patch)
treefcd5aa01f3291bc98ec24ef5716cc4841dd7da23 /llvm/lib/Target/WebAssembly
parent1c7692b88188d155eba845838393edb0a3e9435b (diff)
downloadbcm5719-llvm-284384b64090931c793fba3b52e8372c8f0b48ce.tar.gz
bcm5719-llvm-284384b64090931c793fba3b52e8372c8f0b48ce.zip
[WebAssembly] Support inline asm constraints of type i16 and similar.
llvm-svn: 254861
Diffstat (limited to 'llvm/lib/Target/WebAssembly')
-rw-r--r--llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
index baefd8d0758..6e1283b4d33 100644
--- a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
+++ b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp
@@ -228,10 +228,13 @@ WebAssemblyTargetLowering::getRegForInlineAsmConstraint(
if (Constraint.size() == 1) {
switch (Constraint[0]) {
case 'r':
- if (VT == MVT::i32)
- return std::make_pair(0U, &WebAssembly::I32RegClass);
- if (VT == MVT::i64)
- return std::make_pair(0U, &WebAssembly::I64RegClass);
+ assert(VT != MVT::iPTR && "Pointer MVT not expected here");
+ if (VT.isInteger() && !VT.isVector()) {
+ if (VT.getSizeInBits() <= 32)
+ return std::make_pair(0U, &WebAssembly::I32RegClass);
+ if (VT.getSizeInBits() <= 64)
+ return std::make_pair(0U, &WebAssembly::I64RegClass);
+ }
break;
default:
break;
OpenPOWER on IntegriCloud