|
|||||||||
上一个类 下一个类 | 框架 无框架 | ||||||||
摘要: 嵌套 | 字段 | 构造函数 | 方法 | 详细信息: 字段 | 构造函数 | 方法 |
java.lang.Objectedu.ustc.cs.compile.arch.AssemblyElement
public abstract class AssemblyElement
The root class of the assembly element hierarchy.
A complete assembly language program consists of three kinds of assembly elements: the directive (represented byDirective
),
the label (represented by Label
), and the
instruct (represented by Instruct
).
.text
.align 2
.globl main
.ent main
main:
add $sp,$sp,-8
// create an AssemblySequence object
AssemblySequence
sequence = new AssemblySequence();
// .text
Directive
direct = new Directive(MIPSDirector.TEXT
, null);
sequence.add(direct);
// .align 2
ArrayList<Directive.Argument
> args = new ArrayList();
args.add(new Directive.Argument(new Integer(2)));
direct = new Directive(MIPSDirector.ALIGN
, args);
sequence.add(direct);
// .globl main
args = new ArrayList();
args.add(new Directive.Argument(new Label
("main")));
direct = new Directive(MIPSDirector.GLOBL
, args);
sequence.add(direct);
// .ent main
args = new ArrayList();
args.add(new Directive.Argument(new Label("main")));
direct = new Directive(MIPSDirector.ENT
, args);
sequence.add(direct);
// main:
Label label = new Label("main");
sequence.add(label);
// add $sp,$sp,-8
ArrayList<Instruct.Operand
> operands = new ArrayList();
operands.add(new Instruct.Operand(MIPSRegister.SP
));
operands.add(new Instruct.Operand(MIPSRegister.SP
));
operands.add(new Instruct.Operand(new Integer(-8)));
Instruct
inst = new Instruct(MIPSOpcode.ADD
, operands);
sequence.add(inst);
构造函数摘要 | |
---|---|
AssemblyElement()
|
方法摘要 |
---|
从类 java.lang.Object 继承的方法 |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
构造函数详细信息 |
---|
public AssemblyElement()
|
|||||||||
上一个类 下一个类 | 框架 无框架 | ||||||||
摘要: 嵌套 | 字段 | 构造函数 | 方法 | 详细信息: 字段 | 构造函数 | 方法 |