]> git.proxmox.com Git - rustc.git/blame - src/llvm/include/llvm/Transforms/Utils/IntegerDivision.h
Imported Upstream version 1.0.0+dfsg1
[rustc.git] / src / llvm / include / llvm / Transforms / Utils / IntegerDivision.h
CommitLineData
223e47cc
LB
1//===- llvm/Transforms/Utils/IntegerDivision.h ------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
1a4d82fc
JJ
10// This file contains an implementation of 32bit and 64bit scalar integer
11// division for targets that don't have native support. It's largely derived
12// from compiler-rt's implementations of __udivsi3 and __udivmoddi4,
13// but hand-tuned for targets that prefer less control flow.
223e47cc
LB
14//
15//===----------------------------------------------------------------------===//
16
970d7e83
LB
17#ifndef LLVM_TRANSFORMS_UTILS_INTEGERDIVISION_H
18#define LLVM_TRANSFORMS_UTILS_INTEGERDIVISION_H
223e47cc
LB
19
20namespace llvm {
21 class BinaryOperator;
22}
23
24namespace llvm {
25
26 /// Generate code to calculate the remainder of two integers, replacing Rem
27 /// with the generated code. This currently generates code using the udiv
28 /// expansion, but future work includes generating more specialized code,
1a4d82fc
JJ
29 /// e.g. when more information about the operands are known. Implements both
30 /// 32bit and 64bit scalar division.
223e47cc
LB
31 ///
32 /// @brief Replace Rem with generated code.
33 bool expandRemainder(BinaryOperator *Rem);
34
35 /// Generate code to divide two integers, replacing Div with the generated
36 /// code. This currently generates code similarly to compiler-rt's
37 /// implementations, but future work includes generating more specialized code
1a4d82fc
JJ
38 /// when more information about the operands are known. Implements both
39 /// 32bit and 64bit scalar division.
223e47cc
LB
40 ///
41 /// @brief Replace Div with generated code.
42 bool expandDivision(BinaryOperator* Div);
43
970d7e83 44 /// Generate code to calculate the remainder of two integers, replacing Rem
1a4d82fc
JJ
45 /// with the generated code. Uses ExpandReminder with a 32bit Rem which
46 /// makes it useful for targets with little or no support for less than
47 /// 32 bit arithmetic.
970d7e83
LB
48 ///
49 /// @brief Replace Rem with generated code.
50 bool expandRemainderUpTo32Bits(BinaryOperator *Rem);
51
1a4d82fc
JJ
52 /// Generate code to calculate the remainder of two integers, replacing Rem
53 /// with the generated code. Uses ExpandReminder with a 64bit Rem.
54 ///
55 /// @brief Replace Rem with generated code.
56 bool expandRemainderUpTo64Bits(BinaryOperator *Rem);
57
58 /// Generate code to divide two integers, replacing Div with the generated
59 /// code. Uses ExpandDivision with a 32bit Div which makes it useful for
60 /// targets with little or no support for less than 32 bit arithmetic.
61 ///
970d7e83
LB
62 /// @brief Replace Rem with generated code.
63 bool expandDivisionUpTo32Bits(BinaryOperator *Div);
64
1a4d82fc
JJ
65 /// Generate code to divide two integers, replacing Div with the generated
66 /// code. Uses ExpandDivision with a 64bit Div.
67 ///
68 /// @brief Replace Rem with generated code.
69 bool expandDivisionUpTo64Bits(BinaryOperator *Div);
70
223e47cc
LB
71} // End llvm namespace
72
73#endif