[LLVMdev] Custom GEP lowering

Scott Michel scottm at aero.org
Mon Aug 27 19:26:55 PDT 2007


It looks like I need to be able to intercept GEP lowering (in  
SelectionDAGLowering::visitGetElementPtr) and insert something else  
other than the shifts and adds. The basic problem is that CellSPU  
loads and stores on 16-byte boundaries. Consequently, the SPU backend  
has to do the load or store differently than most normal  
architectures that have byte-addressable operations.

Unfortunately, detecting whether an add is really an add or whether  
it was generated by a GEP lowering is ambiguous. Hence, the need to  
custom lower GEP.

 From reading the code, hijacking  
SelectionDAGLowering::visitGetElementPtr() appears to be the only way  
to pull this off. Is there a better way?

If not, how receptive would the community be to:
a) Creating a GEP DAG node
b) Sending the new GEP node through legalize/custom/promote switch

I'm sure that this will spark a raging debate, with a few comments  
about how to refactor the whole legalize/custom/promote switch, etc.  
But all I really want to do it customize GEP processing for Cell.


-scooter



More information about the llvm-dev mailing list