diff options
author | Roland Reichwein <mail@reichwein.it> | 2020-11-09 16:41:07 +0100 |
---|---|---|
committer | Roland Reichwein <mail@reichwein.it> | 2020-11-09 16:41:07 +0100 |
commit | fe063834e53e856823b9a42ad3a5e04153446849 (patch) | |
tree | 6ea84c1274e52bf5a07d7fcb8dbb64ceb6fc7a47 /asm | |
parent | fc1461874a6bcecc919f650d1bfb6bf37161c413 (diff) |
Support multiply (WIP)
Diffstat (limited to 'asm')
-rw-r--r-- | asm/intel64/encode.cpp | 8 |
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()); |