diff options
Diffstat (limited to 'cpp.cpp')
-rw-r--r-- | cpp.cpp | 11 |
1 files changed, 3 insertions, 8 deletions
@@ -562,7 +562,7 @@ void CPP::getValueOfNode(index_t index) size_t num_childs {m_nodes[index].child_ids.size()}; if (mValues.size() < num_childs) - throw std::runtime_error("ICE: Expected num_childs elements on Values stack at "s + locationOfNode(index)); + throw std::runtime_error("ICE: Expected num_childs elements on values stack at "s + locationOfNode(index)); auto function_it{node_eval_map.find(m_nodes[index].type)}; std::any result; @@ -587,6 +587,7 @@ void CPP::getValueOfToken(index_t index) FlowGraph::Graph graph{{std::make_shared<FlowGraph::DataNode>(data)}}; mValues.push_back(graph); } else { + //throw std::runtime_error("ICE: Unsupported token: "s + m_tokens[index].type); mValues.push_back(std::any{}); } } @@ -629,13 +630,7 @@ void CPP::link() // mSegment -> elf - mCode = std::vector<uint8_t>{ - 0x48, 0xc7, 0xc0, 0x3c, 0x00, 0x00, 0x00, // mov $0x3c,%rax # syscall 60 - 0x48, 0x31, 0xff, // xor %rdi,%rdi # exit code 0 - } + mSegment.getCode() + std::vector<uint8_t>{ // # leave exit code in edi - 0x0f, 0x05, // syscall - } - ; + mCode = mSegment.getCode(); } // phases of translation, according to standard |