-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathlinker.h
More file actions
27 lines (23 loc) · 701 Bytes
/
Copy pathlinker.h
File metadata and controls
27 lines (23 loc) · 701 Bytes
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
#ifndef _LINKER_
#define _LINKER_
#include <iostream>
#include "codegenerator.h"
class Linker
{
public:
void link();
Linker *setDebugMode(bool isSilent);
Linker *withCode(std::vector<Instruction *> _code);
Linker *withDestMap(std::map<std::string, Instruction *> map);
Linker *withOriginMap(std::map<std::string, std::vector<BranchLabel *>> map);
Linker *withOffset(int value);
private:
int offset;
bool is_silent;
std::vector<Instruction *> code;
std::map<std::string, Instruction *> labelDestMap;
std::map<std::string, std::vector<BranchLabel *>> labelOriginMap;
void printEveryLabelLink();
void insertIndexInsideEveryInstruction();
};
#endif