-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathargument.h
55 lines (37 loc) · 1.1 KB
/
argument.h
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
50
51
52
53
54
55
//
// Created by michal on 16.09.17.
//
#ifndef PROJECT_ARGUMENT_H
#define PROJECT_ARGUMENT_H
#include <memory>
#include "registers.h"
#include "memory.h"
enum ArgType {
RegisterType,
MemoryType
};
class ArgumentRegister {
public:
ArgumentRegister() = default;
explicit ArgumentRegister(int reg_id) : reg_id(reg_id) {}
int reg_id;
private:
};
class ArgumentMemory {
public:
ArgumentMemory() = default;
explicit ArgumentMemory(DataType data_type, int offset) : data_type(data_type), offset(offset) {}
DataType data_type;
int offset;
private:
};
class Argument : public ArgumentMemory, public ArgumentRegister {
public:
explicit Argument(int reg_id, int64_t value) : ArgumentRegister(reg_id), value(value), arg_type(RegisterType), ArgumentMemory() {}
explicit Argument(DataType data_type, int offset, int64_t value) : ArgumentMemory(data_type, offset),
value(value), arg_type(MemoryType), ArgumentRegister() {}
int64_t value;
ArgType arg_type;
private:
};
#endif //PROJECT_ARGUMENT_H