blob: f68b80d6ea5773773d370b88e192961510ec66fc (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
|
#include "LLVMVisitor.h"
LLVMVisitor::LLVMVisitor(const char* fileName) : outFile(std::ofstream(fileName)), reg() {
if (!outFile.is_open())
throw std::runtime_error("Couldn't open file for writing!");
}
std::string LLVMVisitor::Visit(const Integer& vint) {
std::string valRegister = *(reg++);
outFile << valRegister + " = " + std::to_string(vint.get_value()) + "\n";
return valRegister;
}
|