Subversion Repositories QNX 8.QNX8 LLVM/Clang compiler suite

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
14 pmbaty 1
//===- llvm/Analysis/ScalarEvolutionDivision.h - See below ------*- C++ -*-===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
//
9
// This file defines the class that knows how to divide SCEV's.
10
//
11
//===----------------------------------------------------------------------===//
12
 
13
#ifndef LLVM_ANALYSIS_SCALAREVOLUTIONDIVISION_H
14
#define LLVM_ANALYSIS_SCALAREVOLUTIONDIVISION_H
15
 
16
#include "llvm/Analysis/ScalarEvolutionExpressions.h"
17
 
18
namespace llvm {
19
 
20
class SCEV;
21
 
22
class ScalarEvolution;
23
 
24
struct SCEVCouldNotCompute;
25
 
26
struct SCEVDivision : public SCEVVisitor<SCEVDivision, void> {
27
public:
28
  // Computes the Quotient and Remainder of the division of Numerator by
29
  // Denominator.
30
  static void divide(ScalarEvolution &SE, const SCEV *Numerator,
31
                     const SCEV *Denominator, const SCEV **Quotient,
32
                     const SCEV **Remainder);
33
 
34
  // Except in the trivial case described above, we do not know how to divide
35
  // Expr by Denominator for the following functions with empty implementation.
36
  void visitPtrToIntExpr(const SCEVPtrToIntExpr *Numerator) {}
37
  void visitTruncateExpr(const SCEVTruncateExpr *Numerator) {}
38
  void visitZeroExtendExpr(const SCEVZeroExtendExpr *Numerator) {}
39
  void visitSignExtendExpr(const SCEVSignExtendExpr *Numerator) {}
40
  void visitUDivExpr(const SCEVUDivExpr *Numerator) {}
41
  void visitSMaxExpr(const SCEVSMaxExpr *Numerator) {}
42
  void visitUMaxExpr(const SCEVUMaxExpr *Numerator) {}
43
  void visitSMinExpr(const SCEVSMinExpr *Numerator) {}
44
  void visitUMinExpr(const SCEVUMinExpr *Numerator) {}
45
  void visitSequentialUMinExpr(const SCEVSequentialUMinExpr *Numerator) {}
46
  void visitUnknown(const SCEVUnknown *Numerator) {}
47
  void visitCouldNotCompute(const SCEVCouldNotCompute *Numerator) {}
48
 
49
  void visitConstant(const SCEVConstant *Numerator);
50
 
51
  void visitAddRecExpr(const SCEVAddRecExpr *Numerator);
52
 
53
  void visitAddExpr(const SCEVAddExpr *Numerator);
54
 
55
  void visitMulExpr(const SCEVMulExpr *Numerator);
56
 
57
private:
58
  SCEVDivision(ScalarEvolution &S, const SCEV *Numerator,
59
               const SCEV *Denominator);
60
 
61
  // Convenience function for giving up on the division. We set the quotient to
62
  // be equal to zero and the remainder to be equal to the numerator.
63
  void cannotDivide(const SCEV *Numerator);
64
 
65
  ScalarEvolution &SE;
66
  const SCEV *Denominator, *Quotient, *Remainder, *Zero, *One;
67
};
68
 
69
} // end namespace llvm
70
 
71
#endif // LLVM_ANALYSIS_SCALAREVOLUTIONDIVISION_H