I investigated the MachineFunctionPass (that is runOnMachineFunction, I believe). In my experimentation it didn't seem that the MachineFrameInfo was populated (it consistently said that the stack depth was 0, for example). I might have been doing something wrong? <br>
<br><div class="gmail_quote">On Fri, Jul 8, 2011 at 5:21 PM, John Criswell <span dir="ltr"><<a href="mailto:criswell@illinois.edu">criswell@illinois.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">

  
    
  
  <div bgcolor="#FFFFFF" text="#000000"><div><div></div><div class="h5">
    On 7/8/11 4:09 PM, Andrew Ruef wrote:
    <blockquote type="cite">
      
      Hi list, 
      <div><br>
      </div>
      <div>I am trying to implement the technique outlined in the
        following paper: <a href="http://www.cs.umd.edu/%7Emwh/papers/martin10ownership.html" target="_blank">http://www.cs.umd.edu/~mwh/papers/martin10ownership.html</a> in
        LLVM. My approach so far involves the use of an IR level
        transform (via runOnFunction) to identify memory loads and
        stores. One thing I need to do (I am pretty sure I need to do it
        at least) is automatically mark each stack frame as "owned" by
        the current thread. </div>
      <div><br>
      </div>
      <div>I'm not sure where the best place in the LLVM architecture to
        do this is. As I currently understand it, the concept of a stack
        frame appears pretty late in target code generation. I've hacked
        in a hook for this in X86FrameLowering.cpp in the emitPrologue
        and emitEpilogue methods. </div>
      <div><br>
      </div>
      <div>Is there a cleaner way I can do this? Is there a way I can
        subclass the X86 code generator to "hook" those two methods and
        insert my instrumentation? Is there something I'm missing with
        runOnMachineFunction? <br>
      </div>
    </blockquote>
    <br></div></div>
    I'm stepping beyond what I know a little bit, but have you looked at
    writing a MachineFunctionPass?  A student here at Illinois wrote a
    MachineFunctionPass to insert additional epilogue code into
    functions.  Assuming that it's possible, putting your functionality
    into a MachineFunctionPass should be cleaner than modifying the code
    generator directly (MachineFunctionPass'es may even be load-able
    into llc).<br>
    <br>
    Check out the doxygen docs for MachineFunctionPass
    (<a href="http://llvm.org/doxygen/classllvm_1_1MachineFunctionPass.html" target="_blank">http://llvm.org/doxygen/classllvm_1_1MachineFunctionPass.html</a>),
    MachineFunction
    (<a href="http://llvm.org/doxygen/classllvm_1_1MachineFunction.html" target="_blank">http://llvm.org/doxygen/classllvm_1_1MachineFunction.html</a>), and
    MachineFrameInfo
    (<a href="http://llvm.org/doxygen/classllvm_1_1MachineFrameInfo.html" target="_blank">http://llvm.org/doxygen/classllvm_1_1MachineFrameInfo.html</a>).<br>
    <br>
    -- John T.<br>
    <br>
    <blockquote type="cite">
      <div><br>
      </div>
      <div>Thank you, <br>
        <div><br>
        </div>
        <div>Andrew</div>
      </div>
      <br>
      <fieldset></fieldset>
      <br>
      <pre>_______________________________________________
LLVM Developers mailing list
<a href="mailto:LLVMdev@cs.uiuc.edu" target="_blank">LLVMdev@cs.uiuc.edu</a>         <a href="http://llvm.cs.uiuc.edu" target="_blank">http://llvm.cs.uiuc.edu</a>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev</a>
</pre>
    </blockquote>
    <br>
  </div>

</blockquote></div><br>