|
LLVM 24.0.0git
|
#include "llvm/Analysis/ConstantFolding.h"#include "llvm/ADT/APFloat.h"#include "llvm/ADT/APInt.h"#include "llvm/ADT/APSInt.h"#include "llvm/ADT/ArrayRef.h"#include "llvm/ADT/DenseMap.h"#include "llvm/ADT/STLExtras.h"#include "llvm/ADT/SmallBitVector.h"#include "llvm/ADT/SmallVector.h"#include "llvm/ADT/StringRef.h"#include "llvm/Analysis/TargetFolder.h"#include "llvm/Analysis/TargetLibraryInfo.h"#include "llvm/Analysis/ValueTracking.h"#include "llvm/Analysis/VectorUtils.h"#include "llvm/Config/config.h"#include "llvm/IR/Constant.h"#include "llvm/IR/ConstantFold.h"#include "llvm/IR/Constants.h"#include "llvm/IR/DataLayout.h"#include "llvm/IR/DerivedTypes.h"#include "llvm/IR/Function.h"#include "llvm/IR/GlobalValue.h"#include "llvm/IR/GlobalVariable.h"#include "llvm/IR/InstrTypes.h"#include "llvm/IR/Instruction.h"#include "llvm/IR/Instructions.h"#include "llvm/IR/IntrinsicInst.h"#include "llvm/IR/Intrinsics.h"#include "llvm/IR/IntrinsicsAArch64.h"#include "llvm/IR/IntrinsicsAMDGPU.h"#include "llvm/IR/IntrinsicsARM.h"#include "llvm/IR/IntrinsicsNVPTX.h"#include "llvm/IR/IntrinsicsWebAssembly.h"#include "llvm/IR/IntrinsicsX86.h"#include "llvm/IR/NVVMIntrinsicUtils.h"#include "llvm/IR/Operator.h"#include "llvm/IR/Type.h"#include "llvm/IR/Value.h"#include "llvm/Support/Casting.h"#include "llvm/Support/ErrorHandling.h"#include "llvm/Support/KnownBits.h"#include "llvm/Support/MathExtras.h"#include <cassert>#include <cerrno>#include <cfenv>#include <cmath>#include <cstdint>Go to the source code of this file.
Functions | |
| Constant * | getConstantAtOffset (Constant *Base, APInt Offset, const DataLayout &DL) |
| If this Offset points exactly to the start of an aggregate element, return that element, otherwise return nullptr. | |
| static ConstantFP * | flushDenormalConstant (Type *Ty, const APFloat &APF, DenormalMode::DenormalModeKind Mode) |
| static DenormalMode | getInstrDenormalMode (const Instruction *CtxI, Type *Ty) |
Return the denormal mode that can be assumed when executing a floating point operation at CtxI. | |
| static ConstantFP * | flushDenormalConstantFP (ConstantFP *CFP, const Instruction *Inst, bool IsOutput) |
| static bool | canConstantFoldIntrinsic (Intrinsic::ID ID, bool IsStrictFP) |
Returns true if the intrinsic can be constant folded, given IsStrictFP. | |
| static bool | anyTypeContainsFP (Type *RetTy, ArrayRef< Value * > Ops) |
| Given a function's return type and its operands, determine if any of them of of floating-point type. | |
Variables | |
| static cl::opt< bool > | DisableFPCallFolding ("disable-fp-call-folding", cl::desc("Disable constant-folding of FP intrinsics and libcalls."), cl::init(false), cl::Hidden) |
Given a function's return type and its operands, determine if any of them of of floating-point type.
Definition at line 2098 of file ConstantFolding.cpp.
References AbstractManglingParser< Derived, Alloc >::Ops, llvm::any_of(), and llvm::Type::isFloatingPointTy().
Referenced by llvm::canConstantFoldCallTo(), and llvm::ConstantFoldIntrinsic().
|
static |
Returns true if the intrinsic can be constant folded, given IsStrictFP.
Definition at line 1734 of file ConstantFolding.cpp.
Referenced by llvm::canConstantFoldCallTo(), and llvm::ConstantFoldIntrinsic().
|
static |
Definition at line 1465 of file ConstantFolding.cpp.
References llvm::DenormalMode::Dynamic, llvm::APFloat::getSemantics(), llvm::APFloat::getZero(), llvm::DenormalMode::IEEE, llvm::APFloat::isNegative(), llvm_unreachable, Mode, llvm::DenormalMode::PositiveZero, and llvm::DenormalMode::PreserveSign.
Referenced by flushDenormalConstantFP(), and llvm::FlushFPConstant().
|
static |
Definition at line 1493 of file ConstantFolding.cpp.
References flushDenormalConstant(), getInstrDenormalMode(), llvm::Value::getType(), llvm::ConstantFP::getValueAPF(), llvm::APFloat::isDenormal(), and Mode.
Referenced by llvm::FlushFPConstant().
| Constant * getConstantAtOffset | ( | Constant * | Base, |
| APInt | Offset, | ||
| const DataLayout & | DL ) |
If this Offset points exactly to the start of an aggregate element, return that element, otherwise return nullptr.
Definition at line 820 of file ConstantFolding.cpp.
References llvm::sampleprof::Base, C(), DL, llvm::drop_begin(), llvm::isa(), and llvm::Offset.
Referenced by llvm::ConstantFoldLoadFromConst().
|
static |
Return the denormal mode that can be assumed when executing a floating point operation at CtxI.
Definition at line 1486 of file ConstantFolding.cpp.
References llvm::Function::getDenormalMode(), llvm::DenormalMode::getDynamic(), llvm::Instruction::getFunction(), and llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent().
Referenced by flushDenormalConstantFP(), and llvm::FlushFPConstant().
|
static |
Referenced by llvm::canConstantFoldCallTo(), and llvm::ConstantFoldIntrinsic().