LLVM: include/llvm/Analysis/TargetFolder.h Source File (original) (raw)

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18#ifndef LLVM_ANALYSIS_TARGETFOLDER_H

19#define LLVM_ANALYSIS_TARGETFOLDER_H

20

28

29namespace llvm {

30

34

35

38

39

42 }

43

45

46public:

48

49

50

51

52

53

54

55

60 if (LC && RC) {

64 }

65 return nullptr;

66 }

67

69 bool IsExact) const override {

72 if (LC && RC) {

77 }

78 return nullptr;

79 }

80

82 bool HasNUW, bool HasNSW) const override {

85 if (LC && RC) {

87 unsigned Flags = 0;

88 if (HasNUW)

90 if (HasNSW)

93 }

95 }

96 return nullptr;

97 }

98

103

107 if (LC && RC)

109 return nullptr;

110 }

111

116 return nullptr;

117 }

118

122 return nullptr;

123

125

127 return nullptr;

129 }

130 return nullptr;

131 }

132

137 if (CC && TC && FC)

139

140 return nullptr;

141 }

142

147 return nullptr;

148 };

149

154 if (CAgg && CVal)

156 return nullptr;

157 }

158

162 if (CVec && CIdx)

164 return nullptr;

165 }

166

168 Value *Idx) const override {

172 if (CVec && CNewElt && CIdx)

174 return nullptr;

175 }

176

181 if (C1 && C2)

183 return nullptr;

184 }

185

187 Type *DestTy) const override {

190 return nullptr;

191 }

192

197 if (C1 && C2)

199 return nullptr;

200 }

201

202

203

204

205

207 if (C->getType() == DestTy)

208 return C;

210 }

211

213 Type *DestTy) const override {

214 if (C->getType() == DestTy)

215 return C;

217 }

218};

219}

220

221#endif

#define LLVM_DECLARE_VIRTUAL_ANCHOR_FUNCTION()

\macro LLVM_VIRTUAL_ANCHOR_FUNCTION This macro is used to adhere to LLVM's policy that each class wit...

This file contains the declarations for the subclasses of Constant, which represent the different fla...

ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...

Predicate

This enumeration lists the possible predicates for CmpInst subclasses.

static LLVM_ABI Constant * getExtractElement(Constant *Vec, Constant *Idx, Type *OnlyIfReducedTy=nullptr)

static LLVM_ABI Constant * getPointerCast(Constant *C, Type *Ty)

Create a BitCast, AddrSpaceCast, or a PtrToInt cast constant expression.

static LLVM_ABI Constant * getPointerBitCastOrAddrSpaceCast(Constant *C, Type *Ty)

Create a BitCast or AddrSpaceCast for a pointer type depending on the address space.

static LLVM_ABI Constant * getInsertElement(Constant *Vec, Constant *Elt, Constant *Idx, Type *OnlyIfReducedTy=nullptr)

static LLVM_ABI Constant * getShuffleVector(Constant *V1, Constant *V2, ArrayRef< int > Mask, Type *OnlyIfReducedTy=nullptr)

static bool isSupportedGetElementPtr(const Type *SrcElemTy)

Whether creating a constant expression for this getelementptr type is supported.

static LLVM_ABI Constant * get(unsigned Opcode, Constant *C1, Constant *C2, unsigned Flags=0, Type *OnlyIfReducedTy=nullptr)

get - Return a binary or shift operator constant expression, folding if possible.

static LLVM_ABI bool isDesirableBinOp(unsigned Opcode)

Whether creating a constant expression for this binary operator is desirable.

static Constant * getGetElementPtr(Type *Ty, Constant *C, ArrayRef< Constant * > IdxList, GEPNoWrapFlags NW=GEPNoWrapFlags::none(), std::optional< ConstantRange > InRange=std::nullopt, Type *OnlyIfReducedTy=nullptr)

Getelementptr form.

This is an important base class in LLVM.

A parsed version of the target data layout string in and methods for querying it.

This provides a helper for copying FMF from an instruction or setting specified flags.

Convenience struct for specifying and reasoning about fast-math flags.

Represents flags for the getelementptr instruction/expression.

IRBuilderFolder - Interface for constant folding in IRBuilder.

Constant * CreatePointerCast(Constant *C, Type *DestTy) const override

Definition TargetFolder.h:206

Value * FoldShuffleVector(Value *V1, Value *V2, ArrayRef< int > Mask) const override

Definition TargetFolder.h:177

TargetFolder(const DataLayout &DL)

Definition TargetFolder.h:47

Value * FoldInsertElement(Value *Vec, Value *NewElt, Value *Idx) const override

Definition TargetFolder.h:167

Value * FoldSelect(Value *C, Value *True, Value *False) const override

Definition TargetFolder.h:133

Value * FoldExtractValue(Value *Agg, ArrayRef< unsigned > IdxList) const override

Definition TargetFolder.h:143

Value * FoldExactBinOp(Instruction::BinaryOps Opc, Value *LHS, Value *RHS, bool IsExact) const override

Definition TargetFolder.h:68

Constant * CreatePointerBitCastOrAddrSpaceCast(Constant *C, Type *DestTy) const override

Definition TargetFolder.h:212

Value * FoldUnOpFMF(Instruction::UnaryOps Opc, Value *V, FastMathFlags FMF) const override

Definition TargetFolder.h:112

Value * FoldCmp(CmpInst::Predicate P, Value *LHS, Value *RHS) const override

Definition TargetFolder.h:104

Value * FoldGEP(Type *Ty, Value *Ptr, ArrayRef< Value * > IdxList, GEPNoWrapFlags NW) const override

Definition TargetFolder.h:119

Value * FoldNoWrapBinOp(Instruction::BinaryOps Opc, Value *LHS, Value *RHS, bool HasNUW, bool HasNSW) const override

Definition TargetFolder.h:81

Value * FoldBinOp(Instruction::BinaryOps Opc, Value *LHS, Value *RHS) const override

Definition TargetFolder.h:56

Value * FoldBinOpFMF(Instruction::BinaryOps Opc, Value *LHS, Value *RHS, FastMathFlags FMF) const override

Definition TargetFolder.h:99

Value * FoldInsertValue(Value *Agg, Value *Val, ArrayRef< unsigned > IdxList) const override

Definition TargetFolder.h:150

Value * FoldExtractElement(Value *Vec, Value *Idx) const override

Definition TargetFolder.h:159

Value * FoldCast(Instruction::CastOps Op, Value *V, Type *DestTy) const override

Definition TargetFolder.h:186

Value * FoldBinaryIntrinsic(Intrinsic::ID ID, Value *LHS, Value *RHS, Type *Ty, Instruction *FMFSource) const override

Definition TargetFolder.h:193

The instances of the Type class are immutable: once they are created, they are never changed.

LLVM Value Representation.

unsigned ID

LLVM IR allows to use arbitrary numbers as calling convention identifiers.

@ C

The default llvm calling convention, compatible with C.

This is an optimization pass for GlobalISel generic memory operations.

LLVM_ABI Constant * ConstantFoldBinaryIntrinsic(Intrinsic::ID ID, Constant *LHS, Constant *RHS, Type *Ty, Instruction *FMFSource)

LLVM_ABI Constant * ConstantFoldSelectInstruction(Constant *Cond, Constant *V1, Constant *V2)

Attempt to constant fold a select instruction with the specified operands.

decltype(auto) dyn_cast(const From &Val)

dyn_cast - Return the argument parameter cast to the specified type.

LLVM_ABI Constant * ConstantFoldCompareInstOperands(unsigned Predicate, Constant *LHS, Constant *RHS, const DataLayout &DL, const TargetLibraryInfo *TLI=nullptr, const Instruction *I=nullptr)

Attempt to constant fold a compare instruction (icmp/fcmp) with the specified operands.

LLVM_ABI Constant * ConstantFoldExtractValueInstruction(Constant *Agg, ArrayRef< unsigned > Idxs)

Attempt to constant fold an extractvalue instruction with the specified operands and indices.

LLVM_ABI Constant * ConstantFoldConstant(const Constant *C, const DataLayout &DL, const TargetLibraryInfo *TLI=nullptr)

ConstantFoldConstant - Fold the constant using the specified DataLayout.

bool any_of(R &&range, UnaryPredicate P)

Provide wrappers to std::any_of which take ranges instead of having to pass begin/end explicitly.

LLVM_ABI Constant * ConstantFoldUnaryOpOperand(unsigned Opcode, Constant *Op, const DataLayout &DL)

Attempt to constant fold a unary operation with the specified operand.

LLVM_ABI Constant * ConstantFoldCastOperand(unsigned Opcode, Constant *C, Type *DestTy, const DataLayout &DL)

Attempt to constant fold a cast with the specified operand.

bool isa(const From &Val)

isa - Return true if the parameter to the template is an instance of one of the template type argu...

LLVM_ABI Constant * ConstantFoldBinaryOpOperands(unsigned Opcode, Constant *LHS, Constant *RHS, const DataLayout &DL)

Attempt to constant fold a binary operation with the specified operands.

DWARFExpression::Operation Op

LLVM_ABI Constant * ConstantFoldInsertValueInstruction(Constant *Agg, Constant *Val, ArrayRef< unsigned > Idxs)

Attempt to constant fold an insertvalue instruction with the specified operands and indices.