|
|
|||
File indexing completed on 2026-05-10 08:44:43
0001 //===- llvm/Transforms/Utils/IntegerDivision.h ------------------*- C++ -*-===// 0002 // 0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 0004 // See https://llvm.org/LICENSE.txt for license information. 0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 0006 // 0007 //===----------------------------------------------------------------------===// 0008 // 0009 // This file contains an implementation of 32bit and 64bit scalar integer 0010 // division for targets that don't have native support. It's largely derived 0011 // from compiler-rt's implementations of __udivsi3 and __udivmoddi4, 0012 // but hand-tuned for targets that prefer less control flow. 0013 // 0014 //===----------------------------------------------------------------------===// 0015 0016 #ifndef LLVM_TRANSFORMS_UTILS_INTEGERDIVISION_H 0017 #define LLVM_TRANSFORMS_UTILS_INTEGERDIVISION_H 0018 0019 namespace llvm { 0020 class BinaryOperator; 0021 } 0022 0023 namespace llvm { 0024 0025 /// Generate code to calculate the remainder of two integers, replacing Rem 0026 /// with the generated code. This currently generates code using the udiv 0027 /// expansion, but future work includes generating more specialized code, 0028 /// e.g. when more information about the operands are known. Implements both 0029 /// 32bit and 64bit scalar division. 0030 /// 0031 /// Replace Rem with generated code. 0032 bool expandRemainder(BinaryOperator *Rem); 0033 0034 /// Generate code to divide two integers, replacing Div with the generated 0035 /// code. This currently generates code similarly to compiler-rt's 0036 /// implementations, but future work includes generating more specialized code 0037 /// when more information about the operands are known. Implements both 0038 /// 32bit and 64bit scalar division. 0039 /// 0040 /// Replace Div with generated code. 0041 bool expandDivision(BinaryOperator* Div); 0042 0043 /// Generate code to calculate the remainder of two integers, replacing Rem 0044 /// with the generated code. Uses ExpandReminder with a 32bit Rem which 0045 /// makes it useful for targets with little or no support for less than 0046 /// 32 bit arithmetic. 0047 /// 0048 /// Replace Rem with generated code. 0049 bool expandRemainderUpTo32Bits(BinaryOperator *Rem); 0050 0051 /// Generate code to calculate the remainder of two integers, replacing Rem 0052 /// with the generated code. Uses ExpandReminder with a 64bit Rem. 0053 /// 0054 /// Replace Rem with generated code. 0055 bool expandRemainderUpTo64Bits(BinaryOperator *Rem); 0056 0057 /// Generate code to divide two integers, replacing Div with the generated 0058 /// code. Uses ExpandDivision with a 32bit Div which makes it useful for 0059 /// targets with little or no support for less than 32 bit arithmetic. 0060 /// 0061 /// Replace Rem with generated code. 0062 bool expandDivisionUpTo32Bits(BinaryOperator *Div); 0063 0064 /// Generate code to divide two integers, replacing Div with the generated 0065 /// code. Uses ExpandDivision with a 64bit Div. 0066 /// 0067 /// Replace Rem with generated code. 0068 bool expandDivisionUpTo64Bits(BinaryOperator *Div); 0069 0070 } // End llvm namespace 0071 0072 #endif
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|