summaryrefslogtreecommitdiff
path: root/sources/scalac/atree/APrimitive.java
diff options
context:
space:
mode:
authorpaltherr <paltherr@epfl.ch>2003-11-05 15:43:04 +0000
committerpaltherr <paltherr@epfl.ch>2003-11-05 15:43:04 +0000
commit6be0cda04aab98ce53e578b5c8cda7b7895a3c7d (patch)
treea007b7946dbad5ae65c33966b1b9bc48d65d4266 /sources/scalac/atree/APrimitive.java
parente592008b31f66bc809caeec102d24438be6ccfa1 (diff)
downloadscala-6be0cda04aab98ce53e578b5c8cda7b7895a3c7d.tar.gz
scala-6be0cda04aab98ce53e578b5c8cda7b7895a3c7d.tar.bz2
scala-6be0cda04aab98ce53e578b5c8cda7b7895a3c7d.zip
- Added atree/APrimitive.java
Diffstat (limited to 'sources/scalac/atree/APrimitive.java')
-rw-r--r--sources/scalac/atree/APrimitive.java72
1 files changed, 72 insertions, 0 deletions
diff --git a/sources/scalac/atree/APrimitive.java b/sources/scalac/atree/APrimitive.java
new file mode 100644
index 0000000000..90d9ca516d
--- /dev/null
+++ b/sources/scalac/atree/APrimitive.java
@@ -0,0 +1,72 @@
+/* ____ ____ ____ ____ ______ *\
+** / __// __ \/ __// __ \/ ____/ SOcos COmpiles Scala **
+** __\_ \/ /_/ / /__/ /_/ /\_ \ (c) 2002, LAMP/EPFL **
+** /_____/\____/\___/\____/____/ **
+\* */
+
+// $Id$
+
+package scalac.atree;
+
+/** This class represents a primitive operation. */
+public class APrimitive {
+
+ //########################################################################
+ // Public Cases
+
+ // type : (type) => type
+ // range: type <- { BOOL, Ix, Ux, Rx }
+ // jvm : {i, l, f, d}neg
+ public case Negation(ATypeKind type);
+
+ // type : zero ? (type) => BOOL : (type,type) => BOOL
+ // range: type <- { BOOL, Ix, Ux, Rx, REF }
+ // jvm : if{eq, ne, lt, ge, le, gt}, if{null, nonnull}
+ // if_icmp{eq, ne, lt, ge, le, gt}, if_acmp{eq,ne}
+ public case Test(ATestOp op, ATypeKind type, boolean zero);
+
+ // type : (type,type) => I4
+ // range: type <- { Ix, Ux, Rx }
+ // jvm : lcmp, {f, d}cmp{l, g}
+ public case Comparison(AComparisonOp op, ATypeKind type);
+
+ // type : (type,type) => type
+ // range: type <- { Ix, Ux, Rx }
+ // jvm : {i, l, f, d}{add, sub, mul, div, rem}
+ public case Arithmetic(AArithmeticOp op, ATypeKind type);
+
+ // type : (type,type) => type
+ // range: type <- { BOOL, Ix, Ux }
+ // jvm : {i, l}{and, or, xor}
+ public case Logical(ALogicalOp op, ATypeKind type);
+
+ // type : (type,I4) => type
+ // range: type <- { Ix, Ux }
+ // jvm : {i, l}{shl, ushl, shr}
+ public case Shift(AShiftOp op, ATypeKind type);
+
+ // type : (src) => dst
+ // range: src,dst <- { Ix, Ux, Rx }
+ // jvm : i2{l, f, d}, l2{i, f, d}, f2{i, l, d}, d2{i, l, f}, i2{b, c, s}
+ public case Conversion(ATypeKind src, ATypeKind dst);
+
+ // type : (Array[REF]) => I4
+ // range: type <- { BOOL, Ix, Ux, Rx, REF }
+ // jvm : arraylength
+ public case ArrayLength(ATypeKind type);
+
+ // type : (lf,rg) => STR
+ // range: lf,rg <- { BOOL, Ix, Ux, Rx, REF, STR }
+ // jvm : -
+ public case StringConcat(ATypeKind lf, ATypeKind rg);
+
+ //########################################################################
+ // Public Methods
+
+ /** Returns a string representation of this primitive. */
+ public String toString() {
+ return new ATreePrinter().printPrimitive(this).toString();
+ }
+
+ //########################################################################
+}