aboutsummaryrefslogtreecommitdiffstats
path: root/utils/TableGen/Record.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-04-19 01:17:35 +0000
committerChris Lattner <sabre@nondot.org>2005-04-19 01:17:35 +0000
commit577057faaa714b5edabc6730f4d96a608a8b94c4 (patch)
tree59bb8b668beb557c51496b3f96e99548e8e6b6eb /utils/TableGen/Record.cpp
parentb9266f880a1978e60a0457743d873dd03c3f2034 (diff)
downloadexternal_llvm-577057faaa714b5edabc6730f4d96a608a8b94c4.zip
external_llvm-577057faaa714b5edabc6730f4d96a608a8b94c4.tar.gz
external_llvm-577057faaa714b5edabc6730f4d96a608a8b94c4.tar.bz2
implementing shifting of literal integers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21336 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/Record.cpp')
-rw-r--r--utils/TableGen/Record.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/utils/TableGen/Record.cpp b/utils/TableGen/Record.cpp
index 8c8e7b9..d2422ff 100644
--- a/utils/TableGen/Record.cpp
+++ b/utils/TableGen/Record.cpp
@@ -297,6 +297,20 @@ Init *BitsInit::resolveReferences(Record &R) {
return this;
}
+Init *IntInit::getBinaryOp(BinaryOp Op, Init *RHS) {
+ IntInit *RHSi = dynamic_cast<IntInit*>(RHS);
+ if (RHSi == 0) return 0;
+
+ int NewValue;
+ switch (Op) {
+ case SHL: NewValue = Value << RHSi->getValue(); break;
+ case SRA: NewValue = Value >> RHSi->getValue(); break;
+ case SRL: NewValue = (unsigned)Value >> (unsigned)RHSi->getValue(); break;
+ }
+ return new IntInit(NewValue);
+}
+
+
Init *IntInit::convertInitializerBitRange(const std::vector<unsigned> &Bits) {
BitsInit *BI = new BitsInit(Bits.size());