Auto-generate boilerplate for 'impl InstructionData'.

Accessors for shared fields and multiple results can be generated automatically.

Add a 'boxed_storage' flag to the instruction format definitions to enable
generated code to access 'data'.
This commit is contained in:
Jakob Stoklund Olesen
2016-05-19 10:16:40 -07:00
parent b06f5ef72f
commit 6d0486cced
4 changed files with 93 additions and 82 deletions

View File

@@ -23,11 +23,12 @@ Binary = InstructionFormat(value, value)
BinaryImm = InstructionFormat(value, imm64)
BinaryImmRev = InstructionFormat(imm64, value)
Jump = InstructionFormat(ebb, variable_args)
Branch = InstructionFormat(value, ebb, variable_args)
Jump = InstructionFormat(ebb, variable_args, boxed_storage=True)
Branch = InstructionFormat(value, ebb, variable_args, boxed_storage=True)
BranchTable = InstructionFormat(value, jump_table)
Call = InstructionFormat(function, variable_args, multiple_results=True)
Call = InstructionFormat(
function, variable_args, multiple_results=True, boxed_storage=True)
# Finally extract the names of global variables in this module.
InstructionFormat.extract_names(globals())