LLVM 20.0.0git
Float2Int.h
Go to the documentation of this file.
1//===-- Float2Int.h - Demote floating point ops to work on integers -------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This file provides the Float2Int pass, which aims to demote floating
10// point operations to work on integers, where that is losslessly possible.
11//
12//===----------------------------------------------------------------------===//
13
14#ifndef LLVM_TRANSFORMS_SCALAR_FLOAT2INT_H
15#define LLVM_TRANSFORMS_SCALAR_FLOAT2INT_H
16
18#include "llvm/ADT/MapVector.h"
19#include "llvm/ADT/SetVector.h"
21#include "llvm/IR/PassManager.h"
22
23namespace llvm {
24class DominatorTree;
25class Function;
26class Instruction;
27class LLVMContext;
28class Type;
29class Value;
30
31class Float2IntPass : public PassInfoMixin<Float2IntPass> {
32public:
34
35 // Glue for old PM.
36 bool runImpl(Function &F, const DominatorTree &DT);
37
38private:
39 void findRoots(Function &F, const DominatorTree &DT);
40 void seen(Instruction *I, ConstantRange R);
41 ConstantRange badRange();
42 ConstantRange unknownRange();
43 ConstantRange validateRange(ConstantRange R);
44 std::optional<ConstantRange> calcRange(Instruction *I);
45 void walkBackwards();
46 void walkForwards();
47 bool validateAndTransform(const DataLayout &DL);
48 Value *convert(Instruction *I, Type *ToTy);
49 void cleanup();
50
55 LLVMContext *Ctx;
56};
57}
58#endif // LLVM_TRANSFORMS_SCALAR_FLOAT2INT_H
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
RelocType Type
Definition: COFFYAML.cpp:410
Generic implementation of equivalence classes through the use Tarjan's efficient union-find algorithm...
expand large fp convert
This header defines various interfaces for pass management in LLVM.
#define F(x, y, z)
Definition: MD5.cpp:55
#define I(x, y, z)
Definition: MD5.cpp:58
This file implements a map that provides insertion order iteration.
This file implements a set that has insertion order iteration characteristics.
A container for analyses that lazily runs them and caches their results.
Definition: PassManager.h:253
This class represents a range of values.
Definition: ConstantRange.h:47
A parsed version of the target data layout string in and methods for querying it.
Definition: DataLayout.h:63
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
Definition: Dominators.h:162
EquivalenceClasses - This represents a collection of equivalence classes and supports three efficient...
bool runImpl(Function &F, const DominatorTree &DT)
Definition: Float2Int.cpp:481
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
Definition: Float2Int.cpp:503
This is an important class for using LLVM in a threaded context.
Definition: LLVMContext.h:67
This class implements a map that also provides access to all stored values in a deterministic order.
Definition: MapVector.h:36
A set of analyses that are preserved following a run of a transformation pass.
Definition: Analysis.h:111
A SetVector that performs no allocations if smaller than a certain size.
Definition: SetVector.h:370
The instances of the Type class are immutable: once they are created, they are never changed.
Definition: Type.h:45
LLVM Value Representation.
Definition: Value.h:74
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition: PassManager.h:69