--- /dev/null
+package IR.Flat;
+import IR.TypeDescriptor;
+
+public class FlatInstanceOfNode extends FlatNode {
+ TempDescriptor src;
+ TempDescriptor dst;
+ TypeDescriptor t;
+
+ public FlatInstanceOfNode(TypeDescriptor t, TempDescriptor src, TempDescriptor dst) {
+ this.t=t;
+ this.src=src;
+ this.dst=dst;
+ }
+
+ public TypeDescriptor getType() {
+ return t;
+ }
+
+ public TempDescriptor getSrc() {
+ return src;
+ }
+
+ public TempDescriptor getDst() {
+ return dst;
+ }
+
+ public String toString() {
+ return "FlatInstanceNode_"+dst.toString()+"="+src.toString()+".instanceof "+t.getSymbol();
+ }
+
+ public int kind() {
+ return FKind.FlatInstanceOfNode;
+ }
+
+ public TempDescriptor [] writesTemps() {
+ return new TempDescriptor[] {dst};
+ }
+
+ public TempDescriptor [] readsTemps() {
+ return new TempDescriptor[] {src};
+ }
+}
--- /dev/null
+package IR.Tree;
+import IR.TypeDescriptor;
+import IR.TypeUtil;
+
+public class InstanceOfNode extends ExpressionNode {
+ ExpressionNode e;
+ TypeDescriptor t;
+
+ public InstanceOfNode(ExpressionNode e, TypeDescriptor t) {
+ this.e=e;
+ this.t=t;
+ }
+
+ public String printNode(int indent) {
+ return (e.printNode(indent)+" instanceof "+t.toString());
+ }
+
+ public ExpressionNode getExpr() {
+ return e;
+ }
+
+ public TypeDescriptor getExprType() {
+ return t;
+ }
+
+ public TypeDescriptor getType() {
+ return new TypeDescriptor(TypeDescriptor.BOOLEAN);
+ }
+
+ public int kind() {
+ return Kind.InstanceOfNode;
+ }
+}