LLVM: llvm::UnsignedDivisionByConstantInfo Struct Reference (original) (raw)

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

#include "[llvm/Support/DivisionByConstantInfo.h](DivisionByConstantInfo%5F8h%5Fsource.html)"

Public Attributes
APInt Magic
magic number
bool IsAdd
add indicator
unsigned PostShift
post-shift amount
unsigned PreShift
pre-shift amount

Magic data for optimising unsigned division by a constant.

Definition at line 29 of file DivisionByConstantInfo.h.

get()

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 74 of file DivisionByConstantInfo.cpp.

References llvm::AllOnes, assert(), D(), get(), llvm::APInt::getLowBitsSet(), llvm::APInt::getSignedMaxValue(), llvm::APInt::getSignedMinValue(), IsAdd, llvm::APInt::isZero(), Magic, NC, P, PostShift, PreShift, R2, llvm::APInt::udivrem(), llvm::APInt::uge(), and llvm::APInt::ult().

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

IsAdd

bool llvm::UnsignedDivisionByConstantInfo::IsAdd

Magic

APInt llvm::UnsignedDivisionByConstantInfo::Magic

PostShift

unsigned llvm::UnsignedDivisionByConstantInfo::PostShift

PreShift

unsigned llvm::UnsignedDivisionByConstantInfo::PreShift


The documentation for this struct was generated from the following files: