gh-112519: Make it possible to specify instruction flags for pseudo instructions in bytecodes.c (#112520)

This commit is contained in:
Irit Katriel 2023-11-30 11:03:30 +00:00 committed by GitHub
parent 7eeea13403
commit 07ebd46f9e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 76 additions and 12 deletions

View file

@ -466,6 +466,44 @@ class TestGeneratedCases(unittest.TestCase):
"""
self.run_cases_test(input, output)
def test_pseudo_instruction_no_flags(self):
input = """
pseudo(OP) = {
OP1,
};
inst(OP1, (--)) {
}
"""
output = """
TARGET(OP1) {
frame->instr_ptr = next_instr;
next_instr += 1;
INSTRUCTION_STATS(OP1);
DISPATCH();
}
"""
self.run_cases_test(input, output)
def test_pseudo_instruction_with_flags(self):
input = """
pseudo(OP, (HAS_ARG, HAS_JUMP)) = {
OP1,
};
inst(OP1, (--)) {
}
"""
output = """
TARGET(OP1) {
frame->instr_ptr = next_instr;
next_instr += 1;
INSTRUCTION_STATS(OP1);
DISPATCH();
}
"""
self.run_cases_test(input, output)
def test_array_input(self):
input = """
inst(OP, (below, values[oparg*2], above --)) {