|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--comp.Assembler
An object that knows how to spit out (MIPS) assembly code. Should really be an interface, with a MIPS implementation, but that's taking things a little far right now.
Field Summary | |
static int |
ADD
Binary operators. |
static int |
AND
|
static int |
DIV
|
static int |
EQ
|
static int |
GT
|
static int |
GTE
|
static int |
LT
|
static int |
LTE
|
static int |
MOD
|
static int |
MULT
|
static int |
NEQ
|
static int |
OR
|
(package private) static java.io.PrintStream |
out
|
static int |
SLL
|
static int |
SRA
|
static int |
SRL
|
static int |
SUB
|
static int |
XOR
|
Constructor Summary | |
Assembler()
|
Method Summary | |
void |
addImm(java.lang.String dest,
java.lang.String reg,
int imm)
Add the immediate operand to reg, and place the result in dest. |
void |
binop(int op,
java.lang.String dest,
java.lang.String left,
java.lang.String right)
Emit a binary operation on the three given registers. |
void |
branchEq(java.lang.String r1,
java.lang.String r2,
java.lang.String label)
Branch to the given label if regs[r1] == regs[r2] |
void |
branchNe(java.lang.String r1,
java.lang.String r2,
java.lang.String label)
Branch to the given label if regs[r1] != regs[r2] |
void |
call(java.lang.String label)
Call the procedure. |
void |
comment(java.lang.String msg)
Issue a comment without newline. |
void |
commentln(java.lang.String msg)
Issue a comment on a line by itself. |
void |
dumpStrings(java.util.Map strings)
Dump a Map of static strings to the text region. |
void |
growStack(int bytes)
Grow the stack by the given number of bytes. |
void |
jump(java.lang.String label)
Unconditionally jump to the given label. |
void |
jumpReg(java.lang.String reg)
Jump to the address in the register. |
void |
label(java.lang.String label)
Issue a label, without a trailing newline. |
void |
labelln(java.lang.String label)
Issue a label on its own line. |
void |
loadAddress(java.lang.String dest,
java.lang.String label)
Load an address. |
void |
loadByte(java.lang.String dest,
int offset,
java.lang.String base)
Load a byte from the integer offset of base register into the dest. |
void |
loadByte(java.lang.String dest,
java.lang.String label,
java.lang.String base)
Load a byte from the labeled offset of base register. |
void |
loadImm(java.lang.String dest,
int imm)
Handles constants larger than |2^15| now |
void |
loadWord(java.lang.String dest,
int offset,
java.lang.String base)
Load a word from offset of base register into the dest register. |
void |
loadWord(java.lang.String dest,
java.lang.String label,
java.lang.String base)
Load a word from the labeled offset of base register into the dest. |
void |
move(java.lang.String dest,
java.lang.String src)
Move the value in the src register into the dest register. |
void |
nop()
Do nothing. |
void |
shrinkStack(int bytes)
Shrink the stack by the given number of bytes. |
void |
space(java.lang.String label,
int size)
Ask for size bytes of space. |
void |
startData()
Start the dtaa section. |
void |
startText()
Start the text section. |
void |
storeByte(java.lang.String src,
int offset,
java.lang.String base)
Store a byte to the integer offset of base register. |
void |
storeByte(java.lang.String src,
java.lang.String label,
java.lang.String base)
Store a byte to the labeled offset of base register |
void |
storeWord(java.lang.String src,
int offset,
java.lang.String base)
Store a word from offset of base register into the dest register. |
void |
storeWord(java.lang.String src,
java.lang.String label,
java.lang.String base)
Store a word into the labeled offset of base register |
void |
word(java.lang.String label,
int value)
Ask for a word size of space with the intial value. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
static java.io.PrintStream out
public static final int ADD
public static final int SUB
public static final int MOD
public static final int MULT
public static final int DIV
public static final int EQ
public static final int NEQ
public static final int LT
public static final int GT
public static final int LTE
public static final int GTE
public static final int SLL
public static final int SRL
public static final int SRA
public static final int AND
public static final int OR
public static final int XOR
Constructor Detail |
public Assembler()
Method Detail |
public void commentln(java.lang.String msg)
public void comment(java.lang.String msg)
public void label(java.lang.String label)
public void labelln(java.lang.String label)
public void dumpStrings(java.util.Map strings)
public void space(java.lang.String label, int size)
public void word(java.lang.String label, int value)
public void startData()
public void startText()
public void binop(int op, java.lang.String dest, java.lang.String left, java.lang.String right)
public void addImm(java.lang.String dest, java.lang.String reg, int imm)
public void loadWord(java.lang.String dest, int offset, java.lang.String base)
public void loadWord(java.lang.String dest, java.lang.String label, java.lang.String base)
public void storeWord(java.lang.String src, int offset, java.lang.String base)
public void storeWord(java.lang.String src, java.lang.String label, java.lang.String base)
public void loadByte(java.lang.String dest, int offset, java.lang.String base)
public void loadByte(java.lang.String dest, java.lang.String label, java.lang.String base)
public void storeByte(java.lang.String src, int offset, java.lang.String base)
public void storeByte(java.lang.String src, java.lang.String label, java.lang.String base)
public void loadImm(java.lang.String dest, int imm)
public void loadAddress(java.lang.String dest, java.lang.String label)
public void growStack(int bytes)
public void shrinkStack(int bytes)
public void move(java.lang.String dest, java.lang.String src)
public void branchEq(java.lang.String r1, java.lang.String r2, java.lang.String label)
public void branchNe(java.lang.String r1, java.lang.String r2, java.lang.String label)
public void jump(java.lang.String label)
public void jumpReg(java.lang.String reg)
public void call(java.lang.String label)
public void nop()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |