File indexing completed on 2026-05-10 08:43:57
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021 #ifndef LLVM_IR_CONSTANTFOLD_H
0022 #define LLVM_IR_CONSTANTFOLD_H
0023
0024 #include "llvm/IR/InstrTypes.h"
0025 #include <optional>
0026
0027 namespace llvm {
0028 template <typename T> class ArrayRef;
0029 class Value;
0030 class Constant;
0031 class Type;
0032
0033
0034 Constant *ConstantFoldCastInstruction(
0035 unsigned opcode,
0036 Constant *V,
0037 Type *DestTy
0038 );
0039 Constant *ConstantFoldSelectInstruction(Constant *Cond,
0040 Constant *V1, Constant *V2);
0041 Constant *ConstantFoldExtractElementInstruction(Constant *Val, Constant *Idx);
0042 Constant *ConstantFoldInsertElementInstruction(Constant *Val, Constant *Elt,
0043 Constant *Idx);
0044 Constant *ConstantFoldShuffleVectorInstruction(Constant *V1, Constant *V2,
0045 ArrayRef<int> Mask);
0046 Constant *ConstantFoldExtractValueInstruction(Constant *Agg,
0047 ArrayRef<unsigned> Idxs);
0048 Constant *ConstantFoldInsertValueInstruction(Constant *Agg, Constant *Val,
0049 ArrayRef<unsigned> Idxs);
0050 Constant *ConstantFoldUnaryInstruction(unsigned Opcode, Constant *V);
0051 Constant *ConstantFoldBinaryInstruction(unsigned Opcode, Constant *V1,
0052 Constant *V2);
0053 Constant *ConstantFoldCompareInstruction(CmpInst::Predicate Predicate,
0054 Constant *C1, Constant *C2);
0055 Constant *ConstantFoldGetElementPtr(Type *Ty, Constant *C,
0056 std::optional<ConstantRange> InRange,
0057 ArrayRef<Value *> Idxs);
0058 }
0059
0060 #endif