# HG changeset patch # User Doug Simon # Date 1349350532 -7200 # Node ID 53006ba078d4270bc016b6376acb2d99da1a10b9 # Parent 305b9166b455b885e240976b8cb90741710d1289 refined the API for CallingConvention diff -r 305b9166b455 -r 53006ba078d4 graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CallingConvention.java --- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CallingConvention.java Thu Oct 04 11:22:09 2012 +0200 +++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CallingConvention.java Thu Oct 04 13:35:32 2012 +0200 @@ -30,7 +30,7 @@ /** * A calling convention describes the locations in which the arguments for a call are placed, * the location in which the return value is placed if the call is not void and any - * temporary locations used (and killed) by the call. + * {@linkplain #getTemporaries() extra} locations used (and killed) by the call. */ public class CallingConvention { @@ -79,20 +79,34 @@ private final Value returnLocation; /** - * The locations in which the arguments are placed. This array ordered by argument index. + * The ordered locations in which the arguments are placed. */ private final Value[] argumentLocations; /** - * The locations used by the call in addition to the arguments are placed. - * From the perspective of register allocation, these locations are killed by the call. + * The locations used (and killed) by the call in addition to the arguments. */ private final Value[] temporaryLocations; + /** + * Creates a description of the registers and stack locations used by a call. + * + * @param stackSize amount of stack space (in bytes) required for the stack-based arguments of the call + * @param returnLocation the location for the return value or {@link Value#IllegalValue} if a void call + * @param argumentLocations the ordered locations in which the arguments are placed + */ public CallingConvention(int stackSize, Value returnLocation, Value... argumentLocations) { this(Value.NONE, stackSize, returnLocation, argumentLocations); } + /** + * Creates a description of the registers and stack locations used by a call. + * + * @param temporaryLocations the locations used (and killed) by the call in addition to {@code arguments} + * @param stackSize amount of stack space (in bytes) required for the stack-based arguments of the call + * @param returnLocation the location for the return value or {@link Value#IllegalValue} if a void call + * @param argumentLocations the ordered locations in which the arguments are placed + */ public CallingConvention(Value[] temporaryLocations, int stackSize, Value returnLocation, Value... argumentLocations) { assert argumentLocations != null; assert temporaryLocations != null; @@ -105,52 +119,35 @@ } /** - * @return the location for the return value or {@link Value#IllegalValue} if a void call + * Gets the location for the return value or {@link Value#IllegalValue} if a void call. */ public Value getReturn() { return returnLocation; } /** - * @return the location for the {@code index}'th argument + * Gets the location for the {@code index}'th argument. */ public Value getArgument(int index) { return argumentLocations[index]; } /** - * @return the amount of stack space (in bytes) required for the stack-based arguments of the call. + * Gets the amount of stack space (in bytes) required for the stack-based arguments of the call. */ public int getStackSize() { return stackSize; } /** - * @return the number of locations required for the arguments + * Gets the number of locations required for the arguments. */ public int getArgumentCount() { return argumentLocations.length; } /** - * Gets a location used by the call in addition to the arguments are placed. - * From the perspective of register allocation, these locations are killed by the call. - * - * @return the {@code index}'th temporary location used by the call - */ - public Value getTemporary(int index) { - return temporaryLocations[index]; - } - - /** - * @return the number of temporary locations used by the call - */ - public int getTemporaryCount() { - return temporaryLocations.length; - } - - /** - * Gets the temporary locations used (and killed) by the call. + * Gets the locations used (and killed) by the call apart from the {@linkplain #getArgument(int) arguments}. */ public Value[] getTemporaries() { if (temporaryLocations.length == 0) {