summaryrefslogtreecommitdiffhomepage
path: root/asm/intel64
diff options
context:
space:
mode:
Diffstat (limited to 'asm/intel64')
-rw-r--r--asm/intel64/encode.cpp8
1 files changed, 7 insertions, 1 deletions
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<int>(FlowGraph::BinaryOperationType::Multiply)));
} catch (const std::bad_cast& ex) {
std::runtime_error("ICE: Encoding: Unsupported node: "s + ex.what());