generated from RayKlefstad/GEN
-
Notifications
You must be signed in to change notification settings - Fork 0
/
testInst.cpp
49 lines (46 loc) · 1.17 KB
/
testInst.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <iostream>
using namespace std;
#include "error.h"
#include "Inst.h"
#include "tokens.h"
#include "registers.h"
int lineNumber = 1;
int main()
{
Oper fp = new RegisterOper(FP_REG);
Oper r = new RegisterOper(1);
Oper t = new SelectedOper(fp, -8);
Oper d = new IndirectedOper(t);
Oper s = new RegisterOper(2);
Oper o = d;
Oper l = new TempLabelOper();
Oper nl = new NamedLabelOper("foo");
Oper i = new IndexedOper(l,r);
Oper c = new ConstOper(50);
Oper v = new ImmediateOper(c);
BeginFileInst :: make();
BeginSubpInst :: make(nl);
EnterInst :: make( 20, 2 );
NegateInst :: make(o);
DecrInst :: make(o);
IncrInst :: make(o);
LabelInst :: make( l );
PlusInst :: make( s, d );
MinusInst :: make( v, d );
MultInst :: make( s, d );
DivInst :: make( s, d );
MoveInst :: make( i, d );
AddressInst:: make( s, d );
JumpInst :: make( l );
CompareAndJumpInst :: make( LE, s, d, l ); // if s <= d goto l
CallInst:: make( nl );
BeginDataInst :: make(l);
ConstWordInst :: make( c );
EndDataInst :: make();
LeaveInst :: make( 20, 2, 4);
ReturnInst :: make();
EndSubpInst :: make();
BeginVTableInst :: make( l );
VTableEntryInst :: make(nl);
EndVTableInst :: make();
}