LLVM  15.0.0git
llvm::UnsignedDivisonByConstantInfo Struct Reference

Magic data for optimising unsigned division by a constant. More...

#include "llvm/Support/DivisionByConstantInfo.h"

Collaboration diagram for llvm::UnsignedDivisonByConstantInfo:
[legend]

## Static Public Member Functions

static UnsignedDivisonByConstantInfo get (const APInt &D, unsigned LeadingZeros=0)
Calculate the magic numbers required to implement an unsigned integer division by a constant as a sequence of multiplies, adds and shifts. More...

## Public Attributes

APInt Magic
magic number More...

unsigned ShiftAmount
shift amount More...

## Detailed Description

Magic data for optimising unsigned division by a constant.

Definition at line 28 of file DivisionByConstantInfo.h.

## ◆ get()

 UnsignedDivisonByConstantInfo UnsignedDivisonByConstantInfo::get ( const APInt & D, unsigned LeadingZeros = 0 )
static

Calculate the magic numbers required to implement an unsigned integer division by a constant as a sequence of multiplies, adds and shifts.

Requires that the divisor not be 0. Taken from "Hacker's Delight", Henry S. Warren, Jr., chapter 10. LeadingZeros can be used to simplify the calculation if the upper bits of the divided value are known zero.

Definition at line 66 of file DivisionByConstantInfo.cpp.

Referenced by llvm::TargetLowering::BuildUDIV(), and llvm::CombinerHelper::buildUDivUsingMul().