I am writing code to generate call graphs for a specific intermediate representation without executing it by static scanning of the IR code . The IR code itself is not too complicated, and I understand well what function call sequences look like this, so all I need to do is track calls. I am currently doing this as follows:
- Keep track of where we are
- If we meet a function call, go to this place, execute and return
- While branching places an edge between the caller and the callee
I am pleased with where I am, but I want to make sure that I do not reinvent the wheel here and do not encounter angular matters. I am wondering if there are any acceptable good algorithms (and / or design patterns) that do this efficiently?
UPDATE:
IR code is a disassembler with byte code in a Java language like Java, and looks like a Jasmine specification .
source
share