diff options
Diffstat (limited to 'asm/intel64/encode.cpp')
-rw-r--r-- | asm/intel64/encode.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/asm/intel64/encode.cpp b/asm/intel64/encode.cpp index b26bf9c..123dff2 100644 --- a/asm/intel64/encode.cpp +++ b/asm/intel64/encode.cpp @@ -96,8 +96,16 @@ void Asm::toMachineCode(const FlowGraph::Graph& graph, Segment& segment) else throw std::runtime_error("ICE: Asm: Unsupported binary operation type: "s + std::to_string(static_cast<int>(op.type()))); + } else if (typeid(node_deref) == typeid(FlowGraph::CreateScopeOp)) { + //FlowGraph::CreateScopeOp& op {dynamic_cast<FlowGraph::CreateScopeOp&>(*node)}; + segment.push_back(makeOp("push", Asm::Args{{Asm::Args::Register64("rbp")}})); + segment.push_back(makeOp("mov", Asm::Args{{Asm::Args::Register64("rbp"), Asm::Args::Register64("rsp")}})); + + } else if (typeid(node_deref) == typeid(FlowGraph::DestroyScopeOp)) { + //FlowGraph::DestroyScopeOp& op {dynamic_cast<FlowGraph::DestroyScopeOp&>(*node)}; + segment.push_back(makeOp("pop", Asm::Args{{Asm::Args::Register64("rbp")}})); } else { - throw std::runtime_error("ICE: Encoding: Unsupported node"); + throw std::runtime_error("ICE: Encoding: Unsupported node: "s + demangle(typeid(node_deref))); } } else { throw std::runtime_error("ICE: encode: flowgraph node is null"); |