Skip to content
This repository has been archived by the owner on Jun 26, 2020. It is now read-only.

Control flow graph #1

Closed
stoklund opened this issue Jul 6, 2016 · 5 comments
Closed

Control flow graph #1

stoklund opened this issue Jul 6, 2016 · 5 comments

Comments

@stoklund
Copy link
Contributor

stoklund commented Jul 6, 2016

Cretonne's in-memory representation needs a control flow graph analysis. This would record for each EBB:

  • A set of predecessors, where a predecessor is an (EBB, Inst) pair identifying a basic block in an EBB.
  • A set of successor EBBs. This may not be worthwhile caching since it is easily derived from the branch instructions in the EBB.

The control flow graph is easily computed from the code, so we don't want to represent it in the textual IR. It would be useful if the iteration order of the predecessor set were stable so it doesn't change when saving out the IR and reloading it.

@stoklund stoklund mentioned this issue Jul 6, 2016
@ghost
Copy link

ghost commented Jul 11, 2016

A very ugly WIP. https://github.com/mrrrgn/cretonne/commit/19ef16e508df28b916cb8a45490368dd58bfaeff

todo:

  • Code cleanup and restructuring: moving from the predecessors field on EbbData to a CFG struct attached to Function.
  • Tests!
  • Generating prettier graphviz graphs.

@ghost
Copy link

ghost commented Jul 12, 2016

A new approach which moves the CFG into its own data structure. This is tidier and easier to test IMO. Speaking of tests, writing them now. https://github.com/mrrrgn/cretonne/commit/977d11046dcb4383f59a4d3bc9e9a448dbe28c65

The graph printing is still ugly/basic. Thinking about the parser interface as I proceed with that.

@ghost
Copy link

ghost commented Jul 13, 2016

#6
#7

@ghost ghost closed this as completed Jul 13, 2016
@ghost
Copy link

ghost commented Jul 13, 2016

Let's add some tests for the print-cfg command before closing this.

@ghost ghost reopened this Jul 13, 2016
@ghost
Copy link

ghost commented Jul 14, 2016

#8

This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant