LLVM  15.0.0git
DivisionByConstantInfo.h
Go to the documentation of this file.
1 //===- llvm/Support/DivisionByConstantInfo.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 implements support for optimizing divisions by a constant
10 ///
11 //===----------------------------------------------------------------------===//
12 
13 #ifndef LLVM_SUPPORT_DIVISIONBYCONSTANTINFO_H
14 #define LLVM_SUPPORT_DIVISIONBYCONSTANTINFO_H
15 
16 #include "llvm/ADT/APInt.h"
17 
18 namespace llvm {
19 
20 /// Magic data for optimising signed division by a constant.
22  static SignedDivisionByConstantInfo get(const APInt &D);
23  APInt Magic; ///< magic number
24  unsigned ShiftAmount; ///< shift amount
25 };
26 
27 /// Magic data for optimising unsigned division by a constant.
30  unsigned LeadingZeros = 0);
31  APInt Magic; ///< magic number
32  bool IsAdd; ///< add indicator
33  unsigned ShiftAmount; ///< shift amount
34 };
35 
36 } // namespace llvm
37 
38 #endif
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:17
APInt.h
llvm::UnsignedDivisionByConstantInfo::get
static UnsignedDivisionByConstantInfo get(const APInt &D, unsigned LeadingZeros=0)
Calculate the magic numbers required to implement an unsigned integer division by a constant as a seq...
Definition: DivisionByConstantInfo.cpp:66
llvm::UnsignedDivisionByConstantInfo::Magic
APInt Magic
magic number
Definition: DivisionByConstantInfo.h:31
llvm::SignedDivisionByConstantInfo::ShiftAmount
unsigned ShiftAmount
shift amount
Definition: DivisionByConstantInfo.h:24
D
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
llvm::SignedDivisionByConstantInfo::get
static SignedDivisionByConstantInfo get(const APInt &D)
Calculate the magic numbers required to implement a signed integer division by a constant as a sequen...
Definition: DivisionByConstantInfo.cpp:21
llvm::APInt
Class for arbitrary precision integers.
Definition: APInt.h:75
llvm::UnsignedDivisionByConstantInfo::IsAdd
bool IsAdd
add indicator
Definition: DivisionByConstantInfo.h:32
llvm::UnsignedDivisionByConstantInfo
Magic data for optimising unsigned division by a constant.
Definition: DivisionByConstantInfo.h:28
llvm::SignedDivisionByConstantInfo::Magic
APInt Magic
magic number
Definition: DivisionByConstantInfo.h:23
llvm::SignedDivisionByConstantInfo
Magic data for optimising signed division by a constant.
Definition: DivisionByConstantInfo.h:21
llvm::UnsignedDivisionByConstantInfo::ShiftAmount
unsigned ShiftAmount
shift amount
Definition: DivisionByConstantInfo.h:33