<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Function should store Arguments contiguously not in an iplist"
   href="http://llvm.org/bugs/show_bug.cgi?id=16536">16536</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Function should store Arguments contiguously not in an iplist
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Core LLVM classes
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>nlewycky@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Functions are created separately from their Argument list, which is stored as a
linked list. The Argument list is inseparably tied to the type of the function,
which is an immutable property of the function when created. We aren't
benefiting from giving Argument lists efficient insertion you need to destroy
and recreate the whole Function regardless.

Instead, we should contiguously allocate the space for the arguments and
construct them when the function is created, and destroy them when the function
is destroyed.

Pros:
 - Efficient random access to the n-th Argument*.
 - One fewer allocation for the function and arguments.
 - Saves two pointers per Argument, since there's no more ilist_node<> for each
one.
 - Argument::getArgNo() could be reimplemented as O(1) using pointer
subtraction instead of the present O(n) list walk.

Cons:
 - No longer be efficient to swap two same-typed arguments.
 - No longer lazily create the argument list.
 - No longer support polymorphic Arguments (in case we do already).

This gives us the nice property that we could walk from a callsite parameter
operand number to a function's n-th argument in constant time.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>