LLVM
18.0.0git
include
llvm
Transforms
Scalar
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
17
#include "
llvm/ADT/EquivalenceClasses.h
"
18
#include "
llvm/ADT/MapVector.h
"
19
#include "
llvm/ADT/SetVector.h
"
20
#include "
llvm/IR/ConstantRange.h
"
21
#include "
llvm/IR/PassManager.h
"
22
23
namespace
llvm
{
24
class
DominatorTree;
25
class
Function
;
26
class
Instruction;
27
class
LLVMContext;
28
class
Type
;
29
class
Value
;
30
31
class
Float2IntPass
:
public
PassInfoMixin
<Float2IntPass> {
32
public
:
33
PreservedAnalyses
run
(
Function
&
F
,
FunctionAnalysisManager
&AM);
34
35
// Glue for old PM.
36
bool
runImpl
(
Function
&
F
,
const
DominatorTree
&DT);
37
38
private
:
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();
48
Value
*
convert
(
Instruction
*
I
,
Type
*ToTy);
49
void
cleanup();
50
51
MapVector<Instruction *, ConstantRange>
SeenInsts;
52
SmallSetVector<Instruction *, 8>
Roots;
53
EquivalenceClasses<Instruction *>
ECs;
54
MapVector<Instruction *, Value *>
ConvertedInsts;
55
LLVMContext
*Ctx;
56
};
57
}
58
#endif
// LLVM_TRANSFORMS_SCALAR_FLOAT2INT_H
Type
RelocType Type
Definition:
COFFYAML.cpp:391
ConstantRange.h
EquivalenceClasses.h
Generic implementation of equivalence classes through the use Tarjan's efficient union-find algorithm...
convert
expand large fp convert
Definition:
ExpandLargeFpConvert.cpp:667
F
#define F(x, y, z)
Definition:
MD5.cpp:55
I
#define I(x, y, z)
Definition:
MD5.cpp:58
MapVector.h
This file implements a map that provides insertion order iteration.
PassManager.h
This header defines various interfaces for pass management in LLVM.
SetVector.h
This file implements a set that has insertion order iteration characteristics.
llvm::AnalysisManager
A container for analyses that lazily runs them and caches their results.
Definition:
PassManager.h:649
llvm::ConstantRange
This class represents a range of values.
Definition:
ConstantRange.h:47
llvm::DominatorTree
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
Definition:
Dominators.h:165
llvm::EquivalenceClasses
EquivalenceClasses - This represents a collection of equivalence classes and supports three efficient...
Definition:
EquivalenceClasses.h:60
llvm::Float2IntPass
Definition:
Float2Int.h:31
llvm::Float2IntPass::runImpl
bool runImpl(Function &F, const DominatorTree &DT)
Definition:
Float2Int.cpp:479
llvm::Float2IntPass::run
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
Definition:
Float2Int.cpp:500
llvm::Function
Definition:
Function.h:62
llvm::Instruction
Definition:
Instruction.h:45
llvm::LLVMContext
This is an important class for using LLVM in a threaded context.
Definition:
LLVMContext.h:67
llvm::MapVector
This class implements a map that also provides access to all stored values in a deterministic order.
Definition:
MapVector.h:36
llvm::PreservedAnalyses
A set of analyses that are preserved following a run of a transformation pass.
Definition:
PassManager.h:172
llvm::SmallSetVector
A SetVector that performs no allocations if smaller than a certain size.
Definition:
SetVector.h:370
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition:
Type.h:45
llvm::Value
LLVM Value Representation.
Definition:
Value.h:74
llvm::TargetStackID::Value
Value
Definition:
TargetFrameLowering.h:28
llvm::codeview::PublicSymFlags::Function
@ Function
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition:
AddressRanges.h:18
llvm::PassInfoMixin
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition:
PassManager.h:391
Generated on Thu Nov 30 2023 00:08:00 for LLVM by
1.9.6