[Python-Dev] Rattlesnake progress (original) (raw)
Skip Montanaro skip@pobox.com
Mon, 25 Feb 2002 10:45:17 -0600
- Previous message: [Python-Dev] Rattlesnake progress
- Next message: [Python-Dev] new property factory arguments
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Tim> Excellent advice that almost nobody follows <0.5 wink>: choose a
Tim> flexible intermediate representation, then structure all your
Tim> transformations as independent passes, such that the output of
Tim> every pass is acceptable as the input to every pass.
I did this with my peephole optimizer. It worked great. Each peephole optimization is a very simple subclass of an OptimizeFilter base class. The IR is essentially the bytecode split into basic blocks, with each basic block a list of (opcode argument) tuples. Jump targets are represented as simple indexes into the block list. (In fact, my Rattlesnake converter was just a "peephole optimizer" named InstructionSetConverter.) As Tim mentioned about KISS, this means you sometimes have to run particular optimizations or groups of optimizations multiple times.
I want to get it checked into the sandbox where others can play with it, but time has shifted its foundation a tad and a couple optimizations don't work any longer.
Skip
- Previous message: [Python-Dev] Rattlesnake progress
- Next message: [Python-Dev] new property factory arguments
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]