I'm working on a target for the intermediate language of another compiler (so it can benifit from LLVM's optimization stages). I'm working on LLVM 3.1 for now.  I started the translater as a copy of the MIPS target so that I can just modify it to produce the correct output.<br>
<br>I basically want to replace all of the local variables and incoming parameters with values that look like this: LOC[i] (where i is the number of the parameter). This can be done pretty easily if I want it to apply to everything.  However, outgoing parameters shouldn't be replaced by the LOC[i] notation.  I've seen that stack locations that are used for parameters are sometimes also used for local variables.<br>
<br>So here's my question:  Is there a way for me to modify my target to ensure that no location on the stack will be used for both outgoing parameters and other stack objects within a single function, and make it easy to differentiate between outgoing parameters and other local variables?<br>
<br>I see that in the LowerCall function in ISelLowering.cpp, there's this code (From the MIPS target):<br><br>
<i> // Create the frame index object for this incoming parameter<br>
    LastFI = MFI->CreateFixedObject(ValVT.getSizeInBits()/8,<br>
                                    VA.getLocMemOffset(), true);<br>
    SDValue PtrOff = DAG.getFrameIndex(LastFI, getPointerTy());</i><br>
<br>
This looks like what I might want to change, but I'm not sure what's the right thing to do.  Here's what I tried to change it to:<br><i><br>    LastFI = MFI->CreateStackObject(ValVT.getSizeInBits()/8,<br>

                               VA.getLocMemOffset(), false);<br>

    SDValue PtrOff = DAG.getFrameIndex(LastFI, getPointerTy());</i><br><br>If I did this, the parameters 
didn't collide with other local variables anymore, but it ruined the original calculated offset and allignment (it started at $sp+0 instead of 16 and the arguments ended up aligned at 8 instead of 4).  <br>
<br>
Is there a way to do something like this without the stack object being 
put in a different place, and perhaps leave a way for me to find out 
from the MachineFrameInfo later that this offset is for outgoing 
parameters?<br>