Summary Files Commits Branches @commit @diff @stats
path: root / Year 2 / Implementation of Programming Languages / Transpiler / src / LLVMVisitor / Register.cpp
blob: f35229545b0fef5b77c30412a8c2e1a1b2a9ec42 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include "Register.h"

Register::Register() : counter(1) {}

Register& Register::operator++() {
	++counter;
	return *this;
}

Register Register::operator++(int) {
	Register old = *this;
	++(*this);
	return old;
}

std::string Register::operator*() {
	return "%" + std::to_string(counter);
}