agentleFS
rainoftimerainoftime/pl-skills/control-flow-analysis/SKILL.md

control-flow-analysis

Skill17 starsChanged 9 months agoApache-2.0View on GitHub

A skill for performing control flow analysis on programs to understand execution paths, loop structures, and program structure.

The file

Files
SKILL.md

Control Flow Analysis

Domain: Static Analysis / Programming Languages

Overview

A skill for performing control flow analysis on programs to understand execution paths, loop structures, and program structure.

Capabilities

  • Build control flow graphs (CFGs) from source code
  • Identify basic blocks and control flow transitions
  • Detect loops, branches, and jumps
  • Perform reachability analysis
  • Find dominators and post-dominators

Techniques

  • Control Flow Graph Construction: Nodes for statements, edges for jumps
  • Dominator Analysis: Find control dependencies
  • Loop Detection: Natural loops, back edges
  • Data Flow Analysis: Forward/backward analysis frameworks

Use Cases

  • Compiler optimization
  • Program understanding
  • Bug detection (unreachable code, infinite loops)
  • Security analysis

References

See: ../dataflow-analysis-framework, ../ssa-constructor, ../abstract-interpretation-engine

Research Tools & Artifacts

Real-world control flow analysis tools:

ToolWhy It Matters
LLVM pass infrastructureProduction CFG construction
SootJava bytecode CFG analysis
WALAJava analysis framework
Frama-CC CFG construction
GCC GIMPLEGCC intermediate CFG

Key Systems

  • LLVM: Dominator tree, loop analysis
  • Spark (Apache): Program analysis infrastructure

Research Frontiers

Current CFA research:

DirectionKey PapersChallenge
Interprocedural"Interprocedural CFA" (1990)Call site sensitivity
Context-sensitive"k-CFA" (1998)Precision vs cost
Object-oriented"Object-sensitive CFA" (2009)Virtual dispatch
Binary analysis"Control Flow in Binaries" (2015)No source

Hot Topics

  1. AI for CFA: Learning flow analysis
  2. Quantum CFG: Control flow for quantum programs

Implementation Pitfalls

Common CFA bugs:

PitfallReal ExamplePrevention
Missing edgesIndirect jumpsHandle computed gotos
Exception pathsJava exception edgesModel exceptional flow
CallbacksFunction pointersPoints-to analysis
Virtual dispatchVTable callsDevirtualization

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.