summaryrefslogtreecommitdiffstats
path: root/llvm/utils/TableGen/CodeGenInstruction.cpp
diff options
context:
space:
mode:
authorPete Cooper <peter_cooper@apple.com>2014-08-07 05:47:04 +0000
committerPete Cooper <peter_cooper@apple.com>2014-08-07 05:47:04 +0000
commit2cfdfe5882b53acf548b6aad8f7f16e6dc5b322b (patch)
treed09a2e8340f63dcd53fac224138d32c9788f5ead /llvm/utils/TableGen/CodeGenInstruction.cpp
parent2597764ad95e1972d071ca89f0366277bcb56b9a (diff)
downloadbcm5719-llvm-2cfdfe5882b53acf548b6aad8f7f16e6dc5b322b.tar.gz
bcm5719-llvm-2cfdfe5882b53acf548b6aad8f7f16e6dc5b322b.zip
Change BitsInit to inherit from TypedInit.
This is useful in a later patch where binary literals such as 0b000 will become BitsInit values instead of IntInit values. llvm-svn: 215085
Diffstat (limited to 'llvm/utils/TableGen/CodeGenInstruction.cpp')
-rw-r--r--llvm/utils/TableGen/CodeGenInstruction.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/llvm/utils/TableGen/CodeGenInstruction.cpp b/llvm/utils/TableGen/CodeGenInstruction.cpp
index 2577ad4d919..1e8daf5b09b 100644
--- a/llvm/utils/TableGen/CodeGenInstruction.cpp
+++ b/llvm/utils/TableGen/CodeGenInstruction.cpp
@@ -520,6 +520,21 @@ bool CodeGenInstAlias::tryAliasOpMatch(DagInit *Result, unsigned AliasOpNo,
return true;
}
+ // Bits<n> (also used for 0bxx literals)
+ if (BitsInit *BI = dyn_cast<BitsInit>(Arg)) {
+ if (hasSubOps || !InstOpRec->isSubClassOf("Operand"))
+ return false;
+ if (!BI->isComplete())
+ return false;
+ // Convert the bits init to an integer and use that for the result.
+ IntInit *II =
+ dyn_cast_or_null<IntInit>(BI->convertInitializerTo(IntRecTy::get()));
+ if (!II)
+ return false;
+ ResOp = ResultOperand(II->getValue());
+ return true;
+ }
+
// If both are Operands with the same MVT, allow the conversion. It's
// up to the user to make sure the values are appropriate, just like
// for isel Pat's.
OpenPOWER on IntegriCloud