mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-09-24 23:28:41 +00:00
remove constant terms
The delinearization is needed only to remove the non linearity induced by expressions involving multiplications of parameters and induction variables. There is no problem in dealing with constant times parameters, or constant times an induction variable. For this reason, the current patch discards all constant terms and multipliers before running the delinearization algorithm on the terms. The only thing remaining in the term expressions are parameters and multiply expressions of parameters: these simplified term expressions are passed to the array shape recognizer that will not recognize constant dimensions anymore: these will be recognized as different strides in parametric subscripts. The only important special case of a constant dimension is the size of elements. Instead of relying on the delinearization to infer the size of an element, compute the element size from the base address type. This is a much more precise way of computing the element size than before, as we would have mixed together the size of an element with the strides of the innermost dimension. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@209691 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -910,7 +910,8 @@ namespace llvm {
|
||||
const Constraint &CurConstraint) const;
|
||||
|
||||
bool tryDelinearize(const SCEV *SrcSCEV, const SCEV *DstSCEV,
|
||||
SmallVectorImpl<Subscript> &Pair) const;
|
||||
SmallVectorImpl<Subscript> &Pair,
|
||||
const SCEV *ElementSize) const;
|
||||
|
||||
public:
|
||||
static char ID; // Class identification, replacement for typeinfo
|
||||
|
@@ -894,10 +894,14 @@ namespace llvm {
|
||||
/// indirect operand.
|
||||
bool hasOperand(const SCEV *S, const SCEV *Op) const;
|
||||
|
||||
/// Return the size of an element read or written by Inst.
|
||||
const SCEV *getElementSize(Instruction *Inst);
|
||||
|
||||
/// Compute the array dimensions Sizes from the set of Terms extracted from
|
||||
/// the memory access function of this SCEVAddRecExpr.
|
||||
void findArrayDimensions(SmallVectorImpl<const SCEV *> &Terms,
|
||||
SmallVectorImpl<const SCEV *> &Sizes) const;
|
||||
SmallVectorImpl<const SCEV *> &Sizes,
|
||||
const SCEV *ElementSize) const;
|
||||
|
||||
bool runOnFunction(Function &F) override;
|
||||
void releaseMemory() override;
|
||||
|
@@ -434,7 +434,8 @@ namespace llvm {
|
||||
/// Overall, we have: A[][n][m], and the access function: A[j+k][2i][5i].
|
||||
const SCEV *delinearize(ScalarEvolution &SE,
|
||||
SmallVectorImpl<const SCEV *> &Subscripts,
|
||||
SmallVectorImpl<const SCEV *> &Sizes) const;
|
||||
SmallVectorImpl<const SCEV *> &Sizes,
|
||||
const SCEV *ElementSize) const;
|
||||
};
|
||||
|
||||
//===--------------------------------------------------------------------===//
|
||||
|
Reference in New Issue
Block a user