From fe063834e53e856823b9a42ad3a5e04153446849 Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Mon, 9 Nov 2020 16:41:07 +0100 Subject: Support multiply (WIP) --- asm/intel64/encode.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'asm') diff --git a/asm/intel64/encode.cpp b/asm/intel64/encode.cpp index 8bf33c0..702efaf 100644 --- a/asm/intel64/encode.cpp +++ b/asm/intel64/encode.cpp @@ -58,7 +58,13 @@ void Asm::toMachineCode(const FlowGraph::Graph& graph, Segment& segment) segment.push_back(makeOp("mov", args1)); Asm::Args args2{{Asm::Args::Register32("edi"), Asm::Args::Immediate32(immediate2)}}; - segment.push_back(makeOp("add", args2)); + + if (op.type() == FlowGraph::BinaryOperationType::Add) + segment.push_back(makeOp("add", args2)); + else if (op.type() == FlowGraph::BinaryOperationType::Multiply) + segment.push_back(makeOp("mul", args2)); + else + throw std::runtime_error("ICE: Asm: Unsupported binary operation type: "s + std::to_string(static_cast(FlowGraph::BinaryOperationType::Multiply))); } catch (const std::bad_cast& ex) { std::runtime_error("ICE: Encoding: Unsupported node: "s + ex.what()); -- cgit v1.2.3