Hoopl advice: How to extend the graph?
jan.stolarek at p.lodz.pl
Thu Mar 5 22:05:26 UTC 2015
> What function I should reach for when I want to look at each block (or
> each Last node) in an CmmGraph, possibly modifying it and possibly
> adding auxillary nodes on the way?
Take a look at Compiler.Hoopl.Block in hoopl library - it has some useful functions for working on
blocks. blockSplitTail might be what you're looking for if you want to look at the last block. If
you want to look at each block in a graph you most likely need postorderDfs from CmmUtils. I
suggest studying one of existing Cmm passes to see how to traverse a Cmm graph and operate on it.
CmmContFlowOpt seems to be a good candidate - good comments, fairly short, uses many functions
that you should learn if you want to work with Cmm.
> It seems that one could use dataflowPassFwd for it, but
> * I could not find any use of it, and
> * I do not need to run an analysis along, I just want to rewrite
> the blocks,
> so I am not sure if this is the right thing.
You most likely don't want to use Hoopl's machinery for doing analyses and optimisation passes.
From what I know Hoopl is very slow compared to hand-written graph traversals and
transformations - Edward's CmmRewriteAssignments is a good example here .
Does that help?
Lodz University of Technology
Treść tej wiadomości zawiera informacje przeznaczone tylko dla adresata.
Jeżeli nie jesteście Państwo jej adresatem, bądź otrzymaliście ją przez pomyłkę
prosimy o powiadomienie o tym nadawcy oraz trwałe jej usunięcie.
This email contains information intended solely for the use of the individual to whom it is addressed.
If you are not the intended recipient or if you have received this message in error,
please notify the sender and delete it from your system.
More information about the ghc-devs