Mercurial > hg > truffle
diff graal/com.oracle.max.cri/src/com/sun/cri/ci/CiValue.java @ 4169:f5328dda9714
Initial commit of SSA-based spill-all register assignment
author | Christian Wimmer <Christian.Wimmer@Oracle.com> |
---|---|
date | Wed, 28 Dec 2011 18:13:25 -0800 |
parents | bc8527f3071c |
children | de7b3e7ae528 |
line wrap: on
line diff
--- a/graal/com.oracle.max.cri/src/com/sun/cri/ci/CiValue.java Wed Dec 28 18:12:08 2011 -0800 +++ b/graal/com.oracle.max.cri/src/com/sun/cri/ci/CiValue.java Wed Dec 28 18:13:25 2011 -0800 @@ -24,8 +24,6 @@ import java.io.*; - - /** * Abstract base class for values manipulated by the compiler. All values have a {@linkplain CiKind kind} and are immutable. */ @@ -35,25 +33,13 @@ @SuppressWarnings("serial") public static CiValue IllegalValue = new CiValue(CiKind.Illegal) { @Override - public String name() { - return "<illegal>"; + public String toString() { + return "-"; } @Override public CiRegister asRegister() { return CiRegister.None; } - @Override - public int hashCode() { - return -1; - } - @Override - public boolean equals(Object obj) { - return obj == this; - } - @Override - public boolean equalsIgnoringKind(CiValue other) { - return other == this; - } }; /** @@ -110,52 +96,19 @@ return this instanceof CiConstant; } - /** - * Gets a string name for this value without indicating its {@linkplain #kind kind}. - */ - public abstract String name(); - - @Override - public abstract boolean equals(Object obj); - - public abstract boolean equalsIgnoringKind(CiValue other); + public boolean equalsIgnoringKind(CiValue other) { + // This is a suitable default implementation for several subclasses + return equals(other); + } @Override - public abstract int hashCode(); + public abstract String toString(); - @Override - public final String toString() { - return name() + kindSuffix(); - } - - public final String kindSuffix() { - if (kind == CiKind.Illegal) { - return ""; - } - return ":" + kind.typeChar; + protected final String kindSuffix() { + return "|" + kind.typeChar; } public final boolean isConstant0() { return isConstant() && ((CiConstant) this).asInt() == 0; } - - /** - * Utility for specializing how a {@linkplain CiValue LIR operand} is formatted to a string. - * The {@linkplain Formatter#DEFAULT default formatter} returns the value of - * {@link CiValue#toString()}. - */ - public static class Formatter { - public static final Formatter DEFAULT = new Formatter(); - - /** - * Formats a given operand as a string. - * - * @param operand the operand to format - * @return {@code operand} as a string - */ - public String format(CiValue operand) { - return operand.toString(); - } - } - }