summaryrefslogtreecommitdiff
path: root/BCT/BytecodeTranslator
diff options
context:
space:
mode:
authorGravatar t-espave <unknown>2011-07-26 17:06:08 -0700
committerGravatar t-espave <unknown>2011-07-26 17:06:08 -0700
commitff37a1041f2a8f5d22771ebe1a4e4a33d595c27a (patch)
tree5e2619aa1fa4be361d6bed763200af2dad37b0d8 /BCT/BytecodeTranslator
parent582f56b7d7892cfbd04b5a7322a213e627b049ca (diff)
parent6cee837b0cf8aeda041633e760b2b9b33d16c675 (diff)
Merge
Diffstat (limited to 'BCT/BytecodeTranslator')
-rw-r--r--BCT/BytecodeTranslator/ExpressionTraverser.cs23
-rw-r--r--BCT/BytecodeTranslator/HeapFactory.cs4
2 files changed, 27 insertions, 0 deletions
diff --git a/BCT/BytecodeTranslator/ExpressionTraverser.cs b/BCT/BytecodeTranslator/ExpressionTraverser.cs
index 7c550269..0f7ee250 100644
--- a/BCT/BytecodeTranslator/ExpressionTraverser.cs
+++ b/BCT/BytecodeTranslator/ExpressionTraverser.cs
@@ -1188,6 +1188,29 @@ namespace BytecodeTranslator
TranslatedExpressions.Push(Bpl.Expr.Binary(Bpl.BinaryOperator.Opcode.Neq, lexp, rexp));
}
+ public override void Visit(IRightShift rightShift) {
+ base.Visit(rightShift);
+ Bpl.Expr rexp = TranslatedExpressions.Pop();
+ Bpl.Expr lexp = TranslatedExpressions.Pop();
+ Bpl.Expr e = new Bpl.NAryExpr(
+ rightShift.Token(),
+ new Bpl.FunctionCall(this.sink.Heap.RightShift),
+ new Bpl.ExprSeq(lexp, rexp)
+ );
+ TranslatedExpressions.Push(e);
+ }
+
+ public override void Visit(ILeftShift leftShift) {
+ base.Visit(leftShift);
+ Bpl.Expr rexp = TranslatedExpressions.Pop();
+ Bpl.Expr lexp = TranslatedExpressions.Pop();
+ Bpl.Expr e = new Bpl.NAryExpr(
+ leftShift.Token(),
+ new Bpl.FunctionCall(this.sink.Heap.LeftShift),
+ new Bpl.ExprSeq(lexp, rexp)
+ );
+ TranslatedExpressions.Push(e);
+ }
/// <summary>
/// There aren't any logical-and expressions or logical-or expressions in CCI.
/// Instead they are encoded as "x ? y : 0" for "x && y" and "x ? 1 : y"
diff --git a/BCT/BytecodeTranslator/HeapFactory.cs b/BCT/BytecodeTranslator/HeapFactory.cs
index c656a21e..27c510e6 100644
--- a/BCT/BytecodeTranslator/HeapFactory.cs
+++ b/BCT/BytecodeTranslator/HeapFactory.cs
@@ -221,6 +221,10 @@ namespace BytecodeTranslator {
public Bpl.Function BitwiseExclusiveOr = null;
[RepresentationFor("BitwiseNegation", "function BitwiseNegation(int): int;")]
public Bpl.Function BitwiseNegation = null;
+ [RepresentationFor("RightShift", "function RightShift(int): int;")]
+ public Bpl.Function RightShift = null;
+ [RepresentationFor("LeftShift", "function LeftShift(int): int;")]
+ public Bpl.Function LeftShift = null;
#endregion
#endregion