<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
  </head>
  <body text="#000000" bgcolor="#ffffff">
    <font size="+1">I am currently building a BasicBlock pass which
      requires to run -reg2mem before it, and need to run -mem2reg after
      it to clean up.<br>
      <br>
      So, I want to specify -reg2mem as one of the pre-requisite passes
      to it, as:<br>
      <br>
      <br>
      class MyPass: public BasicBlockPass{<br>
      <br>
        virtual void getAnalysisUsage(AnalysisUsage &AU){<br>
          ...<br>
          <font color="#ff0000">AU.addRequired<RegToMem>();</font><br>
          ...<br>
        }<br>
    </font><span class="Apple-style-span" style="border-collapse:
      separate; color: rgb(0, 0, 0); font-family: 'Times New Roman';
      font-style: normal; font-variant: normal; font-weight: normal;
      letter-spacing: normal; line-height: normal; orphans: 2;
      text-indent: 0px; text-transform: none; white-space: normal;
      widows: 2; word-spacing: 0px; font-size: medium;"><span
        class="Apple-style-span" style="text-align: left;"></span></span><font
      size="+1"><br>
      };<br>
      <br>
      <br>
      I searched all passes under the lib/Transform directory, but
      didn't find a single case of my expected usage.<br>
      Though I know opt takes both -reg2mem and -mem2reg as valid
      arguments and does the proper transformation, I didn't figure out
      how it is being done.<br>
      <br>
      <br>
      What is the right way of doing this?<br>
      (Or, is there a different way doing it?)<br>
      <br>
      <br>
      Thank you very  much<br>
      <br>
      <br>
      Chuck<br>
      <br>
    </font>
  </body>
</html>