Thanks to visit codestin.com
Credit goes to llvm.org

LLVM 22.0.0git
IntegerDivision.h
Go to the documentation of this file.
1//===- llvm/Transforms/Utils/IntegerDivision.h ------------------*- 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 contains an implementation of 32bit and 64bit scalar integer
10// division for targets that don't have native support. It's largely derived
11// from compiler-rt's implementations of __udivsi3 and __udivmoddi4,
12// but hand-tuned for targets that prefer less control flow.
13//
14//===----------------------------------------------------------------------===//
15
16#ifndef LLVM_TRANSFORMS_UTILS_INTEGERDIVISION_H
17#define LLVM_TRANSFORMS_UTILS_INTEGERDIVISION_H
18
20
21namespace llvm {
22 class BinaryOperator;
23}
24
25namespace llvm {
26
27 /// Generate code to calculate the remainder of two integers, replacing Rem
28 /// with the generated code. This currently generates code using the udiv
29 /// expansion, but future work includes generating more specialized code,
30 /// e.g. when more information about the operands are known. Implements both
31 /// 32bit and 64bit scalar division.
32 ///
33 /// Replace Rem with generated code.
35
36/// Generate code to divide two integers, replacing Div with the generated
37/// code. This currently generates code similarly to compiler-rt's
38/// implementations, but future work includes generating more specialized code
39/// when more information about the operands are known. Implements both
40/// 32bit and 64bit scalar division.
41///
42/// Replace Div with generated code.
44
45/// Generate code to calculate the remainder of two integers, replacing Rem
46/// with the generated code. Uses ExpandReminder with a 32bit Rem which
47/// makes it useful for targets with little or no support for less than
48/// 32 bit arithmetic.
49///
50/// Replace Rem with generated code.
52
53/// Generate code to calculate the remainder of two integers, replacing Rem
54/// with the generated code. Uses ExpandReminder with a 64bit Rem.
55///
56/// Replace Rem with generated code.
58
59/// Generate code to divide two integers, replacing Div with the generated
60/// code. Uses ExpandDivision with a 32bit Div which makes it useful for
61/// targets with little or no support for less than 32 bit arithmetic.
62///
63/// Replace Rem with generated code.
65
66/// Generate code to divide two integers, replacing Div with the generated
67/// code. Uses ExpandDivision with a 64bit Div.
68///
69/// Replace Rem with generated code.
71
72} // End llvm namespace
73
74#endif
#define LLVM_ABI
Definition Compiler.h:213
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI bool expandDivision(BinaryOperator *Div)
Generate code to divide two integers, replacing Div with the generated code.
LLVM_ABI bool expandRemainderUpTo32Bits(BinaryOperator *Rem)
Generate code to calculate the remainder of two integers, replacing Rem with the generated code.
LLVM_ABI bool expandRemainderUpTo64Bits(BinaryOperator *Rem)
Generate code to calculate the remainder of two integers, replacing Rem with the generated code.
LLVM_ABI bool expandDivisionUpTo64Bits(BinaryOperator *Div)
Generate code to divide two integers, replacing Div with the generated code.
LLVM_ABI bool expandDivisionUpTo32Bits(BinaryOperator *Div)
Generate code to divide two integers, replacing Div with the generated code.
LLVM_ABI bool expandRemainder(BinaryOperator *Rem)
Generate code to calculate the remainder of two integers, replacing Rem with the generated code.