diff options
author | Jacques Lucke <jacques@blender.org> | 2021-09-11 12:43:59 +0300 |
---|---|---|
committer | Jacques Lucke <jacques@blender.org> | 2021-09-11 12:43:59 +0300 |
commit | aeeffb935e9406fa2cdcb84828aa0e498b2df664 (patch) | |
tree | 338e0e5e153415b7f93846ac024ecea9bb925781 /source/blender/functions/intern/multi_function_procedure_builder.cc | |
parent | 6ae8de474299ec4c7c5bf2439e97998779ed4221 (diff) |
Functions: store cursors to previous instructions
Now an instruction knows the cursors where it is inserted instead
of just the instruction that references it. This has two benefits:
* An instruction knows when it is the entry instruction.
* The cursor can contain more information, e.g. if it is linked to the
true or false branch of a branch instruction.
This also simplifies updating the procedure in future optimization
passes.
Diffstat (limited to 'source/blender/functions/intern/multi_function_procedure_builder.cc')
-rw-r--r-- | source/blender/functions/intern/multi_function_procedure_builder.cc | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/source/blender/functions/intern/multi_function_procedure_builder.cc b/source/blender/functions/intern/multi_function_procedure_builder.cc index 3c088776bea..d30e6c0e14a 100644 --- a/source/blender/functions/intern/multi_function_procedure_builder.cc +++ b/source/blender/functions/intern/multi_function_procedure_builder.cc @@ -18,50 +18,6 @@ namespace blender::fn { -void MFInstructionCursor::insert(MFProcedure &procedure, MFInstruction *new_instruction) -{ - if (instruction_ == nullptr) { - if (is_entry_) { - procedure.set_entry(*new_instruction); - } - else { - /* The cursors points at nothing, nothing to do. */ - } - } - else { - switch (instruction_->type()) { - case MFInstructionType::Call: { - static_cast<MFCallInstruction *>(instruction_)->set_next(new_instruction); - break; - } - case MFInstructionType::Branch: { - MFBranchInstruction &branch_instruction = *static_cast<MFBranchInstruction *>( - instruction_); - if (branch_output_) { - branch_instruction.set_branch_true(new_instruction); - } - else { - branch_instruction.set_branch_false(new_instruction); - } - break; - } - case MFInstructionType::Destruct: { - static_cast<MFDestructInstruction *>(instruction_)->set_next(new_instruction); - break; - } - case MFInstructionType::Dummy: { - static_cast<MFDummyInstruction *>(instruction_)->set_next(new_instruction); - break; - } - case MFInstructionType::Return: { - /* It shouldn't be possible to build a cursor that points to a return instruction. */ - BLI_assert_unreachable(); - break; - } - } - } -} - void MFProcedureBuilder::add_destruct(MFVariable &variable) { MFDestructInstruction &instruction = procedure_->new_destruct_instruction(); |