LLVM 22.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"
18
19namespace llvm {
20
21/// Magic data for optimising signed division by a constant.
24 APInt Magic; ///< magic number
25 unsigned ShiftAmount; ///< shift amount
26};
27
28/// Magic data for optimising unsigned division by a constant.
31 get(const APInt &D, unsigned LeadingZeros = 0,
32 bool AllowEvenDivisorOptimization = true);
33 APInt Magic; ///< magic number
34 bool IsAdd; ///< add indicator
35 unsigned PostShift; ///< post-shift amount
36 unsigned PreShift; ///< pre-shift amount
37};
38
39} // namespace llvm
40
41#endif
This file implements a class to represent arbitrary precision integral constant values and operations...
static GCRegistry::Add< StatepointGC > D("statepoint-example", "an example strategy for statepoint")
#define LLVM_ABI
Definition: Compiler.h:213
Class for arbitrary precision integers.
Definition: APInt.h:78
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
Magic data for optimising signed division by a constant.
static LLVM_ABI SignedDivisionByConstantInfo get(const APInt &D)
Calculate the magic numbers required to implement a signed integer division by a constant as a sequen...
Magic data for optimising unsigned division by a constant.
static LLVM_ABI UnsignedDivisionByConstantInfo get(const APInt &D, unsigned LeadingZeros=0, bool AllowEvenDivisorOptimization=true)
Calculate the magic numbers required to implement an unsigned integer division by a constant as a seq...