LLVM 20.0.0git
|
#include "llvm/Transforms/Utils/IntegerDivision.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Intrinsics.h"
Go to the source code of this file.
Macros | |
#define | DEBUG_TYPE "integer-division" |
Functions | |
static Value * | generateSignedRemainderCode (Value *Dividend, Value *Divisor, IRBuilder<> &Builder) |
Generate code to compute the remainder of two signed integers. | |
static Value * | generatedUnsignedRemainderCode (Value *Dividend, Value *Divisor, IRBuilder<> &Builder) |
Generate code to compute the remainder of two unsigned integers. | |
static Value * | generateSignedDivisionCode (Value *Dividend, Value *Divisor, IRBuilder<> &Builder) |
Generate code to divide two signed integers. | |
static Value * | generateUnsignedDivisionCode (Value *Dividend, Value *Divisor, IRBuilder<> &Builder) |
Generates code to divide two unsigned scalar 32-bit or 64-bit integers. | |
#define DEBUG_TYPE "integer-division" |
Definition at line 24 of file IntegerDivision.cpp.
|
static |
Generate code to compute the remainder of two unsigned integers.
Returns the remainder. Builder's insert point should be pointing where the caller wants code generated, e.g. at the urem instruction. This will generate a udiv in the process, and Builder's insert point will be pointing at the udiv (if present, i.e. not folded), ready to be expanded if the user wishes
Definition at line 73 of file IntegerDivision.cpp.
References llvm::IRBuilderBase::CreateFreeze(), llvm::IRBuilderBase::CreateMul(), llvm::IRBuilderBase::CreateSub(), llvm::IRBuilderBase::CreateUDiv(), and llvm::IRBuilderBase::SetInsertPoint().
Referenced by llvm::expandRemainder().
|
static |
Generate code to divide two signed integers.
Returns the quotient, rounded towards 0. Builder's insert point should be pointing where the caller wants code generated, e.g. at the sdiv instruction. This will generate a udiv in the process, and Builder's insert point will be pointing at the udiv (if present, i.e. not folded), ready to be expanded if the user wishes.
Definition at line 99 of file IntegerDivision.cpp.
References llvm::BitWidth, llvm::IRBuilderBase::CreateAShr(), llvm::IRBuilderBase::CreateFreeze(), llvm::IRBuilderBase::CreateSub(), llvm::IRBuilderBase::CreateUDiv(), llvm::IRBuilderBase::CreateXor(), llvm::Type::getIntegerBitWidth(), llvm::IRBuilderBase::getIntN(), llvm::Value::getType(), and llvm::IRBuilderBase::SetInsertPoint().
Referenced by llvm::expandDivision().
|
static |
Generate code to compute the remainder of two signed integers.
Returns the remainder, which will have the sign of the dividend. Builder's insert point should be pointing where the caller wants code generated, e.g. at the srem instruction. This will generate a urem in the process, and Builder's insert point will be pointing at the uren (if present, i.e. not folded), ready to be expanded if the user wishes
Definition at line 32 of file IntegerDivision.cpp.
References llvm::BitWidth, llvm::IRBuilderBase::CreateAShr(), llvm::IRBuilderBase::CreateFreeze(), llvm::IRBuilderBase::CreateSub(), llvm::IRBuilderBase::CreateURem(), llvm::IRBuilderBase::CreateXor(), llvm::Type::getIntegerBitWidth(), llvm::IRBuilderBase::getIntN(), llvm::Value::getType(), and llvm::IRBuilderBase::SetInsertPoint().
Referenced by llvm::expandRemainder().
|
static |
Generates code to divide two unsigned scalar 32-bit or 64-bit integers.
Returns the quotient, rounded towards 0. Builder's insert point should point where the caller wants code generated, e.g. at the udiv instruction.
Definition at line 141 of file IntegerDivision.cpp.
References llvm::PHINode::addIncoming(), llvm::BitWidth, llvm::BasicBlock::Create(), llvm::IRBuilderBase::CreateAdd(), llvm::IRBuilderBase::CreateAnd(), llvm::IRBuilderBase::CreateAShr(), llvm::IRBuilderBase::CreateBr(), llvm::IRBuilderBase::CreateCall(), llvm::IRBuilderBase::CreateCondBr(), llvm::IRBuilderBase::CreateFreeze(), llvm::IRBuilderBase::CreateICmpEQ(), llvm::IRBuilderBase::CreateICmpUGT(), llvm::IRBuilderBase::CreateLogicalOr(), llvm::IRBuilderBase::CreateLShr(), llvm::IRBuilderBase::CreateOr(), llvm::IRBuilderBase::CreatePHI(), llvm::IRBuilderBase::CreateSelect(), llvm::IRBuilderBase::CreateShl(), llvm::IRBuilderBase::CreateSub(), End, llvm::Instruction::eraseFromParent(), F, llvm::IntegerType::getBitWidth(), llvm::IRBuilderBase::getContext(), llvm::Intrinsic::getDeclaration(), llvm::IRBuilderBase::GetInsertBlock(), llvm::IRBuilderBase::GetInsertPoint(), llvm::Value::getName(), llvm::BasicBlock::getParent(), llvm::ConstantInt::getSigned(), llvm::BasicBlock::getTerminator(), llvm::IRBuilderBase::getTrue(), llvm::Value::getType(), llvm::IRBuilderBase::SetInsertPoint(), llvm::Value::setName(), and llvm::BasicBlock::splitBasicBlock().
Referenced by llvm::expandDivision().