rdaly525 / coreir

BSD 3-Clause "New" or "Revised" License
101 stars 24 forks source link

Create an Instance Pass framework #50

Closed rdaly525 closed 7 years ago

rdaly525 commented 7 years ago

This should be a framework for iterating over all instances in the design and performing some set of actions on the instance.

An initial step would basically implement 1 to 1 replacement. A second step would be able to swap out multiple things.

rdaly525 commented 7 years ago

The way that LLVM does this is they have all the 'Uses' of a function within a LLVM::Module, and you have a command that just says replace all instances with this other instance.

I could do the same thing for CoreIR where I basically keep pointers to all instances (within a namespace) which use a specific Module. Then add a function from module that says replace all instnaces of this module with other module.

rdaly525 commented 7 years ago

Should have a function like:

Instantiable replaceAllUsesWith(Instantiable)

rdaly525 commented 7 years ago

This was already put in