[llvm-commits] CVS: llvm/utils/TableGen/Record.cpp Record.h
Chris Lattner
lattner at cs.uiuc.edu
Mon Apr 18 18:17:51 PDT 2005
Changes in directory llvm/utils/TableGen:
Record.cpp updated: 1.38 -> 1.39
Record.h updated: 1.45 -> 1.46
---
Log message:
implementing shifting of literal integers
---
Diffs of the changes: (+16 -0)
Record.cpp | 14 ++++++++++++++
Record.h | 2 ++
2 files changed, 16 insertions(+)
Index: llvm/utils/TableGen/Record.cpp
diff -u llvm/utils/TableGen/Record.cpp:1.38 llvm/utils/TableGen/Record.cpp:1.39
--- llvm/utils/TableGen/Record.cpp:1.38 Thu Nov 4 22:48:38 2004
+++ llvm/utils/TableGen/Record.cpp Mon Apr 18 20:17:34 2005
@@ -297,6 +297,20 @@
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());
Index: llvm/utils/TableGen/Record.h
diff -u llvm/utils/TableGen/Record.h:1.45 llvm/utils/TableGen/Record.h:1.46
--- llvm/utils/TableGen/Record.h:1.45 Mon Apr 18 20:11:03 2005
+++ llvm/utils/TableGen/Record.h Mon Apr 18 20:17:35 2005
@@ -567,6 +567,8 @@
}
virtual Init *convertInitializerBitRange(const std::vector<unsigned> &Bits);
+ virtual Init *getBinaryOp(BinaryOp Op, Init *RHS);
+
virtual void print(std::ostream &OS) const { OS << Value; }
};
More information about the llvm-commits
mailing list