File indexing completed on 2026-05-10 08:44:41
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 #ifndef LLVM_TRANSFORMS_SCALAR_FLOAT2INT_H
0015 #define LLVM_TRANSFORMS_SCALAR_FLOAT2INT_H
0016
0017 #include "llvm/ADT/EquivalenceClasses.h"
0018 #include "llvm/ADT/MapVector.h"
0019 #include "llvm/ADT/SetVector.h"
0020 #include "llvm/IR/ConstantRange.h"
0021 #include "llvm/IR/PassManager.h"
0022
0023 namespace llvm {
0024 class DominatorTree;
0025 class Function;
0026 class Instruction;
0027 class LLVMContext;
0028 class Type;
0029 class Value;
0030
0031 class Float2IntPass : public PassInfoMixin<Float2IntPass> {
0032 public:
0033 PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
0034
0035
0036 bool runImpl(Function &F, const DominatorTree &DT);
0037
0038 private:
0039 void findRoots(Function &F, const DominatorTree &DT);
0040 void seen(Instruction *I, ConstantRange R);
0041 ConstantRange badRange();
0042 ConstantRange unknownRange();
0043 ConstantRange validateRange(ConstantRange R);
0044 std::optional<ConstantRange> calcRange(Instruction *I);
0045 void walkBackwards();
0046 void walkForwards();
0047 bool validateAndTransform(const DataLayout &DL);
0048 Value *convert(Instruction *I, Type *ToTy);
0049 void cleanup();
0050
0051 MapVector<Instruction *, ConstantRange> SeenInsts;
0052 SmallSetVector<Instruction *, 8> Roots;
0053 EquivalenceClasses<Instruction *> ECs;
0054 MapVector<Instruction *, Value *> ConvertedInsts;
0055 LLVMContext *Ctx;
0056 };
0057 }
0058 #endif