summaryrefslogtreecommitdiffhomepage
path: root/CompilerDriver
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-01 13:50:03 +0100
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-01 13:50:03 +0100
commit6c29d80350582805e048ea843a189c85e24b5b45 (patch)
tree06a44a6b824f72857b7b98b605bd5f30904cf86a /CompilerDriver
parent9e64c8cef6addd30fc0931034f5514c2043dfa81 (diff)
masm/register: fixed a piece code which didn't count registers
correctly. masm/verbose: add more verbose log. Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'CompilerDriver')
-rw-r--r--CompilerDriver/masm.cxx15
1 files changed, 9 insertions, 6 deletions
diff --git a/CompilerDriver/masm.cxx b/CompilerDriver/masm.cxx
index 41cd7c9..0ad48e3 100644
--- a/CompilerDriver/masm.cxx
+++ b/CompilerDriver/masm.cxx
@@ -771,8 +771,10 @@ static void masm_read_instruction(std::string& line, const std::string& file)
std::string reg_str;
reg_str += line[line_index + 1];
- reg_str += line[line_index + 2];
+ if (isdigit(line[line_index + 2]))
+ reg_str += line[line_index + 2];
+
std::size_t reg_index = strtoq(
reg_str.c_str(),
nullptr,
@@ -784,12 +786,13 @@ static void masm_read_instruction(std::string& line, const std::string& file)
throw std::runtime_error("invalid_register_index");
}
- // if we found one
- if (ParserKit::find_word(line, register_syntax))
+ kBytes.emplace_back(reg_index);
+ ++found_some;
+
+ if (kVerbose)
{
- // emplace it.
- kBytes.emplace_back(reg_index);
- ++found_some;
+ kStdOut << "masm: Found register: " << register_syntax << "\n";
+ kStdOut << "masm: Register count: " << found_some << "\n";
}
}
}