mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-12 13:38:21 +00:00
Fold a loop for array processing in ComputeLinearIndex
When processing an array, every Elt has the same layout, it is useless to recursively call each ComputeLinearIndex on each element. Just do it once and multiply by the number of elements. Differential Revision: http://reviews.llvm.org/D6832 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@225949 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -31,10 +31,21 @@ class SDValue;
|
||||
class SelectionDAG;
|
||||
struct EVT;
|
||||
|
||||
/// ComputeLinearIndex - Given an LLVM IR aggregate type and a sequence
|
||||
/// of insertvalue or extractvalue indices that identify a member, return
|
||||
/// the linearized index of the start of the member.
|
||||
/// \brief Compute the linearized index of a member in a nested
|
||||
/// aggregate/struct/array.
|
||||
///
|
||||
/// Given an LLVM IR aggregate type and a sequence of insertvalue or
|
||||
/// extractvalue indices that identify a member, return the linearized index of
|
||||
/// the start of the member, i.e the number of element in memory before the
|
||||
/// seeked one. This is disconnected from the number of bytes.
|
||||
///
|
||||
/// \param Ty is the type indexed by \p Indices.
|
||||
/// \param Indices is an optional pointer in the indices list to the current
|
||||
/// index.
|
||||
/// \param IndicesEnd is the end of the indices list.
|
||||
/// \param CurIndex is the current index in the recursion.
|
||||
///
|
||||
/// \returns \p CurIndex plus the linear index in \p Ty the indices list.
|
||||
unsigned ComputeLinearIndex(Type *Ty,
|
||||
const unsigned *Indices,
|
||||
const unsigned *IndicesEnd,
|
||||
|
Reference in New Issue
Block a user