LLVM  15.0.0git
Static Public Member Functions | Public Attributes | List of all members
llvm::SignedDivisionByConstantInfo Struct Reference

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

#include "llvm/Support/DivisionByConstantInfo.h"

Collaboration diagram for llvm::SignedDivisionByConstantInfo:
Collaboration graph
[legend]

Static Public Member Functions

static SignedDivisionByConstantInfo get (const APInt &D)
 Calculate the magic numbers required to implement a signed 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 signed division by a constant.

Definition at line 21 of file DivisionByConstantInfo.h.

Member Function Documentation

◆ get()

SignedDivisionByConstantInfo SignedDivisionByConstantInfo::get ( const APInt D)
static

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

Requires that the divisor not be 0, 1, or -1. Taken from "Hacker's Delight", Henry S. Warren, Jr., Chapter 10.

Definition at line 21 of file DivisionByConstantInfo.cpp.

References D, llvm::APInt::getSignedMinValue(), Magic, P, R2, ShiftAmount, llvm::APInt::udiv(), llvm::APInt::uge(), and llvm::APInt::ult().

Referenced by llvm::TargetLowering::BuildSDIV().

Member Data Documentation

◆ Magic

APInt llvm::SignedDivisionByConstantInfo::Magic

magic number

Definition at line 23 of file DivisionByConstantInfo.h.

Referenced by llvm::TargetLowering::BuildSDIV(), and get().

◆ ShiftAmount

unsigned llvm::SignedDivisionByConstantInfo::ShiftAmount

shift amount

Definition at line 24 of file DivisionByConstantInfo.h.

Referenced by llvm::TargetLowering::BuildSDIV(), and get().


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