Hoopl advice: How to extend the graph?

Joachim Breitner mail at joachim-breitner.de
Thu Mar 5 22:24:41 UTC 2015


Hi,

Am Donnerstag, den 05.03.2015, 23:05 +0100 schrieb Jan Stolarek:
> > 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.

I had a look around, of course. CmmContFlowOpt is not quite a good
example, as it does not generate new blocks (quite obvious from the fact
that there is no UniqSM around to generate the new labels).

Looking at CmmUtils, I guess I could just use
	ofBlockList entry . concatMap myPerBlockOperation . toBlockList

I was expecting something a bit higher level, but maybe it’s that
simple :-)

Thanks!
Joachim
-- 
Joachim “nomeata” Breitner
  mail at joachim-breitner.dehttp://www.joachim-breitner.de/
  Jabber: nomeata at joachim-breitner.de  • GPG-Key: 0xF0FBF51F
  Debian Developer: nomeata at debian.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://mail.haskell.org/pipermail/ghc-devs/attachments/20150305/264f3e30/attachment.sig>


More information about the ghc-devs mailing list