kanga.meta
Enum KangaReg

java.lang.Object
  extended by java.lang.Enum<KangaReg>
      extended by kanga.meta.KangaReg
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<KangaReg>

public enum KangaReg
extends java.lang.Enum<KangaReg>

This enum class represents a Reg object (immutable) that can be used in the creation of Kanga syntaxtree node.

Author:
Santoso Wijaya

Enum Constant Summary
A0
          the a0 register
A1
          the a1 register
A2
          the a2 register
A3
          the a3 register
S0
          the s0 register
S1
          the s1 register
S2
          the s2 register
S3
          the s3 register
S4
          the s4 register
S5
          the s5 register
S6
          the s6 register
S7
          the s7 register
T0
          the t0 register
T1
          the t1 register
T2
          the t2 register
T3
          the t3 register
T4
          the t4 register
T5
          the t5 register
T6
          the t6 register
T7
          the t7 register
T8
          the t8 register
T9
          the t9 register
V0
          the v0 register
V1
          the v1 register
 
Field Summary
static KangaReg[] ARGUMENTS
          The designated registers to store arguments to procedure calls.
static java.util.Set<KangaReg> CALLEE_SAVED
          Defines the set of registers that, by convention, are "callee-saved." These include all of the s registers.
static java.util.Set<KangaReg> CALLER_SAVED
          Defines the set of registers that, by convention, are "caller-saved." These include all of the t registers and a registers.
static KangaReg SCRATCH_0
          The designated "scratch" register.
static KangaReg SCRATCH_1
          The designated "scratch" register.
 
Method Summary
static Reg createRegNode(KangaReg reg)
          Creates and return a Kanga syntaxtree node that represents a Reg.
 java.lang.String getName()
          Returns the register name.
 boolean isCalleeSaved()
          Returns true if this register is a callee-saved register.
 boolean isCallerSaved()
          Returns true if this register is a caller-saved register.
static KangaReg valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static KangaReg[] values()
          Returns an array containing the constants of this enum type, in the order they're declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

A0

public static final KangaReg A0
the a0 register


A1

public static final KangaReg A1
the a1 register


A2

public static final KangaReg A2
the a2 register


A3

public static final KangaReg A3
the a3 register


T0

public static final KangaReg T0
the t0 register


T1

public static final KangaReg T1
the t1 register


T2

public static final KangaReg T2
the t2 register


T3

public static final KangaReg T3
the t3 register


T4

public static final KangaReg T4
the t4 register


T5

public static final KangaReg T5
the t5 register


T6

public static final KangaReg T6
the t6 register


T7

public static final KangaReg T7
the t7 register


S0

public static final KangaReg S0
the s0 register


S1

public static final KangaReg S1
the s1 register


S2

public static final KangaReg S2
the s2 register


S3

public static final KangaReg S3
the s3 register


S4

public static final KangaReg S4
the s4 register


S5

public static final KangaReg S5
the s5 register


S6

public static final KangaReg S6
the s6 register


S7

public static final KangaReg S7
the s7 register


T8

public static final KangaReg T8
the t8 register


T9

public static final KangaReg T9
the t9 register


V0

public static final KangaReg V0
the v0 register


V1

public static final KangaReg V1
the v1 register

Field Detail

SCRATCH_0

public static final KangaReg SCRATCH_0
The designated "scratch" register. (Implementation detail: this is the v0 register).


SCRATCH_1

public static final KangaReg SCRATCH_1
The designated "scratch" register. (Implementation detail: this is the v1 register).


ARGUMENTS

public static final KangaReg[] ARGUMENTS
The designated registers to store arguments to procedure calls. (Implementation detail: these are the a registers).


CALLER_SAVED

public static final java.util.Set<KangaReg> CALLER_SAVED
Defines the set of registers that, by convention, are "caller-saved." These include all of the t registers and a registers.


CALLEE_SAVED

public static final java.util.Set<KangaReg> CALLEE_SAVED
Defines the set of registers that, by convention, are "callee-saved." These include all of the s registers.

Method Detail

values

public static final KangaReg[] values()
Returns an array containing the constants of this enum type, in the order they're declared. This method may be used to iterate over the constants as follows:
for(KangaReg c : KangaReg.values())
        System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they're declared

valueOf

public static KangaReg valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name

getName

public java.lang.String getName()
Returns the register name.

Returns:
the register name

isCallerSaved

public boolean isCallerSaved()
Returns true if this register is a caller-saved register.

Returns:
true if this register is a caller-saved register

isCalleeSaved

public boolean isCalleeSaved()
Returns true if this register is a callee-saved register.

Returns:
true if this register is a callee-saved register

createRegNode

public static Reg createRegNode(KangaReg reg)
Creates and return a Kanga syntaxtree node that represents a Reg.

Parameters:
reg - the Reg object
Returns:
a spiglet syntaxtree node (JTB) that represents a Reg