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
11
votes
3 answers

Building a Control-flow Graph using results from Objdump

I'm attempting to build a control-flow graph of the assembly results that are returned via a call to objdump -d . Currently the best method I've come up with is to put each line of the result into a linked list, and separate out the memory address,…
Sam
  • 278
  • 3
  • 9
10
votes
1 answer

Understand control flow graph in lcov branch coverage output

I am trying to improve my unit tests by inspecting my current code coverage percentage. I am using gcov and lcov to produce a HTML report of the coverage results. However, I am having problems understanding some of the output. I know that a +…
sigy
  • 2,408
  • 1
  • 24
  • 55
9
votes
3 answers

How to draw a Control Flow Graph from this code?

int main() { int i, grade = 0; printf (" Enter points: \n"); scanf ("%d", &i); if (i >= 50 && i <= 60) grade = 5; else if (i > 50 && i <= 60) grade = 6; else if (i > 60 && i <= 70) grade = 7; else if (i > 70 && i <= 80)…
LearningMath
  • 851
  • 4
  • 15
  • 38
9
votes
1 answer

Can I translate an AST to SSA, or do I need to translate to a CFG then to SSA?

Can I translate an Abstract Syntax Tree directly into SSA form, or will I need to create a control flow graph and then create the Static Single Assignment form from said CFG? And in the context of a control flow graph: how do I represent this for a…
8
votes
2 answers

Control Flow Graph generator for code in C++

I'm looking for Control Flow Graph generator for source code written in C++. Do you know any open-source, static generator? I would like to use it in my graduation project to generate control flow graph and highlight paths which has been executed…
8
votes
1 answer

Dataflow processing

I have a class of computations that seems to naturally take a graph structure. The graph is far from linear, as there are multiple inputs as well as nodes that fan out and nodes that require the result of several other nodes. In all of these…
em70
  • 6,088
  • 6
  • 48
  • 80
7
votes
0 answers

Control Flow Graphs - find all linearly independent paths

I want to find all the possible linearly independent paths in a CFG. As per my limited knowledge of algorithms, a CFG would essentially be a directed graph containing cycles. The formula for cyclomatic complexity is simple. I was wondering if there…
neoprogrammer
  • 91
  • 1
  • 6
6
votes
1 answer

generating CFG for whole source code with LLVM

Does anyone from LLVM community know if there is a way to generate CFG for the whole input source code using opt -dot-cfg foo.ll(.bc) ? as this one generates the CFG per function thus the connections between functions will be ignored. It seems that…
Amir
  • 1,348
  • 3
  • 21
  • 44
6
votes
1 answer

Display CFG from llvm in xvcg

There is -view-cfg option (doc) in llvm's opt program, which enables me to view the Control Flow Graph via dot program. But the CFG in too big to be rendered as postscript from dot. I know that there is the xvcg utiity capable of displaying complex…
osgx
  • 90,338
  • 53
  • 357
  • 513
5
votes
3 answers

Java Control Flow Graphs Library

I need to manipulate control flow graphs for Java code in a project. What might be a good java library to generate control flow graphs in Java. So far I have found a couple eclipse plugins (heavily dependent on eclipse APIs) and standalone tools…
Midhat
  • 17,454
  • 22
  • 87
  • 114
5
votes
2 answers

control flow graph of a c program to find worst possible path

Are there any tools, libraries, or frameworks to get the control flow graph of a C program, and find the worst possible path a program can take? When I read the other questions related to control flow graphs, I came across a few tools which can…
Hari Krishna
  • 551
  • 6
  • 21
5
votes
2 answers

Control flow graph of a program

I'm taking a compiler class right now and we're at the point where we have to build a CFG in order to implement optimizations. One thing I can't figure out is how many CFGs are there for a program? Every example I ever see seems to be the CGF of a…
5
votes
2 answers

How to extract from source code a Control Flow Graph by using Clang?

For the past 5 years I have been using Gnu Compiler Collection (gcc/g++),so I'm a newbie for clang and I would like to generate a control flow graph for C/Objective C/C++ source code. Thankfully I have read here and here and found out I can get…
5
votes
3 answers

Create control flow graph from assembly file

I would like to create control flow graph(CFG) from assembly file using C language. I have been thinking about it and these are my ideas: 1. create blocks - process assembly file line by line - find important instructions like function name, block…
Paul
  • 49
  • 1
  • 7
5
votes
1 answer

How to get the interprocedural Control Flow Graph of one program and do data flow analysis on it using llvm?

In llvm, I know the CFG(Control flow graph) of every function has been constructed and CFG is represented by relationships among basic blocks of funciton. BUt I want to traverse the global CFG of one program which include many functions in llvm.…
1
2 3
9 10