Questions tagged [control-flow-graph]

A control flow graph (CFG) in computer science is a representation, using graph notation, of all paths that might be traversed through a program during its execution.

A control flow graph (CFG) in computer science is a representation, using graph notation, of all paths that might be traversed through a program during its execution.
In a control flow graph each node in the graph represents a basic block, i.e. a straight-line piece of code without any jumps or jump targets; jump targets start a block, and jumps end a block. Directed edges are used to represent jumps in the control flow. There are, in most presentations, two specially designated blocks: the entry block, through which control enters into the flow graph, and the exit block, through which all control flow leaves.

Reference

138 questions
2
votes
2 answers

How to programatically parse a java code (method) into control flow graph

Is there any API or reference library available to parse a java code or java method into control flow graph (CFG). I tried to convert AST into CFG but couldn't do it using AST Parser but didnt find any way to do so. I am working on Eclipse IDE JAVA…
asad
  • 23
  • 7
2
votes
2 answers

Call Graphs or Control-Flow-Graph for Objective-C (iOS app)

Are there any Call-Graph and/or Control-Flow-Graph generators for Objective-C for iOS apps? Call Graph - http://en.wikipedia.org/wiki/Call_graph Call Graphs gives an inter-procedural view of a program. In a call graph, an edge between two nodes f…
ramo
  • 609
  • 2
  • 8
  • 14
2
votes
2 answers

Can all control flow graphs be translated back using if and while?

I was wondering if all control flow graphs obtained from a typical JVM bytecode (see how to) of a single method (no recursion allowed) could be translated back to equivalent ifs and whiles code. If not, what is the smallest JVM bytecode sequence…
Mikaël Mayer
  • 10,425
  • 6
  • 64
  • 101
2
votes
1 answer

How to find the successor ID of a basic block in LLVM?

I am trying a traversal of sorts over all the basic blocks in a function. However, I need to find the unique identifier for each basic block so that I can reference it later. Is there an LLVM API that gives the name/ID of a block? Thanks
user2058668
  • 231
  • 1
  • 3
  • 12
2
votes
0 answers

Traversing CFG and calculating Running Average of Paths

I'm doing analysis on the LLVM machinecode CFG (CFG with Back-Edges removed), for each Instruction at the CFG I have attached at value (lets call it Cost), I would like to calculate the running average of the CFG paths Total Cost with averaging…
2
votes
1 answer

How to generate a Control Flow Graph from Assembly?

For context, I'm attempting to write a decompiler from AVM2 (ActionScript Virtual machine 2) bytecode/assembly to high-level ActionScript 3 code. As far as I am aware, this requires me to analyze the assembly and generate resulting Control Flow…
2
votes
1 answer

How to make Control Flow Graph of a user defined code at run time

Suppose User write some code in edit text (TextBox or else) and program recognize all definitions and uses . Now program wants to show Control Flow Graph using ability of Eclipse of making CFG. Is it possible ? Can we Use some other Tool Built in…
Charlie
  • 4,827
  • 2
  • 31
  • 55
2
votes
1 answer

Control Flow Graph of a for-loop

I am working on a python library that turns python source code in to a control flow graph (CFG). As an intermediate step, I have converted the source code into an xml representation. For example, the following source code: def bar(): # line 32 a…
inspectorG4dget
  • 110,290
  • 27
  • 149
  • 241
1
vote
4 answers

Flattening a control flow graph to structured code

I would like to render a control flow graph (CFG) out to high-level code. Normally this is very easy; walk the tree, render each basic block in turn, glue it all together with gotos. Unfortunately, gotos are out of fashion these days, and most…
1
vote
0 answers

It is possible to generate CFG + Callgraph in one file?

The Requirement: I want a CFG + Callgraph per-module like: https://github.com/rust-lang/rustc-dev-guide/blob/master/src/mir/mir_cfg.svg What Have I Tried? I discovered that opt could generate a Callgraph and a CFG from LLVM-IR using two -dot-cfg…
Ghasem Ramezani
  • 2,683
  • 1
  • 13
  • 32
1
vote
0 answers

how to generate a control flow graph from Python jupyter notebook?

Is there an automated way to generate a control flow graph from Python jupyter lab notebook? I see some other solutions like py2cfg and staticfg but they require a *.py file. I suppose I could copy and paste into a *.py but figured it's worth…
Chuck
  • 1,061
  • 1
  • 20
  • 45
1
vote
2 answers

What is the difference between wala and soot?

I need to chose a framework for following tasks in Java: extract control flow graph interprocedural and intraprocedural analysis dataflow analysis PDG different souce code analysis tasks (like method body extraction, test code extraction) Which…
Exploring
  • 2,493
  • 11
  • 56
  • 97
1
vote
1 answer

Is my construction of SSA correct? (Renaming)

I've been learning about ssa (static single assignment form), and I was given the following graph with phi functions inserted, but the graph hasn't been renamed: I had to rename the variables, and this is what I got: I am very unsure that this is…
1
vote
0 answers

Local variable is not assigned before used with exceptions

I'm surprised that, if I remove the first assignment, I get a compilation error. The code is the following one: public void antlr(String fullyQualifiedFilename) { String path = null; try { path = new…
1
vote
0 answers

Cyclomatic Complexity - Control Flow Graph

I am a newbie. Could you please explain what would happen if a control flow graph consists of multiple start and/or stop nodes? I searched for the answer but was not able to find a proper one Thank You in advance
Prasadika
  • 897
  • 2
  • 20
  • 36