source: liacs/coco/assignment4/AssemblerCode.h@ 144

Last change on this file since 144 was 2, checked in by Rick van der Zwet, 15 years ago

Initial import of data of old repository ('data') worth keeping (e.g. tracking
means of URL access statistics)

File size: 1.1 KB
Line 
1/*
2 * File: AssemblerCode.h
3 * Author: rick
4 *
5 * Created on November 19, 2008, 1:20 AM
6 */
7
8#ifndef _ASSEMBLERCODE_H
9#define _ASSEMBLERCODE_H
10
11#include <cstdio>
12#include <vector>
13#include "MStatement.h"
14
15
16using namespace std;
17
18// This class stores a linear list of assember statements and provides
19// operations to modify that list.
20class AssemblerCode {
21 public:
22 // Constructor/destructor
23 AssemblerCode();
24 ~AssemblerCode();
25
26
27 // Returns the number of statements
28 unsigned int GetStatementCount() const;
29
30 // Gets the i-th statement
31 MStatement *GetStatement(unsigned int i);
32
33 // Appends a statement
34 void AppendStatement(MStatement *stmt);
35
36 // Inserts a statement before the i-th statement
37 void InsertStatement(MStatement *stmt, unsigned int i);
38
39 // Removes the i-th statement
40 void RemoveStatement(unsigned int i);
41
42 // Dump
43 void Dump(FILE *file);
44
45 private:
46 vector<MStatement*> statements;
47 string MOperandToString(MOperand *operand);
48 const char *MRegisterTypeToString(MRegisterType op);
49};
50
51#endif /* _ASSEMBLERCODE_H */
52
Note: See TracBrowser for help on using the repository browser.