Skip to content

Function field of instructiont and inlining #295

Closed
@danpoe

Description

@danpoe

An instructiont has a field function which contains the name of the function it is part of. When inlining a function, the inlined instructions retain the original value in the function field. I guess the reason for this mainly has to do with loops, as a loop id is function+"."+loop_number. Then even after the partial inlining step the loops still have the same loop id, and thus if we specify, e.g., --unwindset "func.0:10" and func is inlined then loop 0 in it can still be recognized and unwound 10 times as requested.

How about we change this behavior to make the function field always contain the function the instruction is currently in? Then things like it1->function== it2->function to check if two instructions are in the same function, or goto_functions.function_map[it->function] to get the goto_functiont the instruction is in would work as expected.

To still be able to recognize loops an additional field loop_function could be added to instructiont which together with loop_number forms the loop id. Then when calling compute_loop_ids() the loop_function field would be set to the current function field, and the loop numbers would also be recomputed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions