LLVM
10.0.0
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/IR/ConstantRange.h
"
20
#include "
llvm/IR/Dominators.h
"
21
#include "
llvm/IR/Function.h
"
22
#include "
llvm/IR/PassManager.h
"
23
24
namespace
llvm
{
25
class
Float2IntPass
:
public
PassInfoMixin
<Float2IntPass> {
26
public
:
27
PreservedAnalyses
run
(
Function
&
F
,
FunctionAnalysisManager
&AM);
28
29
// Glue for old PM.
30
bool
runImpl
(
Function
&F,
const
DominatorTree
&DT);
31
32
private
:
33
void
findRoots(
Function
&F,
const
DominatorTree
&DT,
34
SmallPtrSet<Instruction *, 8>
&Roots);
35
void
seen(
Instruction
*
I
,
ConstantRange
R);
36
ConstantRange
badRange();
37
ConstantRange
unknownRange();
38
ConstantRange
validateRange(
ConstantRange
R);
39
void
walkBackwards(
const
SmallPtrSetImpl<Instruction *>
&Roots);
40
void
walkForwards();
41
bool
validateAndTransform();
42
Value
*convert(
Instruction
*I,
Type
*ToTy);
43
void
cleanup();
44
45
MapVector<Instruction *, ConstantRange>
SeenInsts;
46
SmallPtrSet<Instruction *, 8>
Roots;
47
EquivalenceClasses<Instruction *>
ECs;
48
MapVector<Instruction *, Value *>
ConvertedInsts;
49
LLVMContext
*Ctx;
50
};
51
}
52
#endif // LLVM_TRANSFORMS_SCALAR_FLOAT2INT_H
MapVector.h
llvm
This class represents lattice values for constants.
Definition:
AllocatorList.h:23
llvm::MapVector
This class implements a map that also provides access to all stored values in a deterministic order...
Definition:
MapVector.h:37
F
F(f)
llvm::Function
Definition:
Function.h:59
llvm::Float2IntPass
Definition:
Float2Int.h:25
llvm::SmallPtrSetImpl< Instruction * >
EquivalenceClasses.h
llvm::Instruction
Definition:
Instruction.h:43
Dominators.h
llvm::PassInfoMixin
A CRTP mix-in to automatically provide informational APIs needed for passes.
Definition:
PassManager.h:373
llvm::DominatorTree
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree...
Definition:
Dominators.h:144
llvm::PreservedAnalyses
A set of analyses that are preserved following a run of a transformation pass.
Definition:
PassManager.h:154
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed...
Definition:
Type.h:46
llvm::LLVMContext
This is an important class for using LLVM in a threaded context.
Definition:
LLVMContext.h:63
llvm::EquivalenceClasses
EquivalenceClasses - This represents a collection of equivalence classes and supports three efficient...
Definition:
EquivalenceClasses.h:58
ConstantRange.h
llvm::SmallPtrSet
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
Definition:
SmallPtrSet.h:443
llvm::Float2IntPass::run
PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM)
Definition:
Float2Int.cpp:542
llvm::ConstantRange
This class represents a range of values.
Definition:
ConstantRange.h:47
Function.h
I
#define I(x, y, z)
Definition:
MD5.cpp:58
llvm::Value
LLVM Value Representation.
Definition:
Value.h:74
llvm::Float2IntPass::runImpl
bool runImpl(Function &F, const DominatorTree &DT)
Definition:
Float2Int.cpp:518
llvm::AnalysisManager
A container for analyses that lazily runs them and caches their results.
Definition:
InstructionSimplify.h:41
PassManager.h
This header defines various interfaces for pass management in LLVM.
Generated on Tue Mar 24 2020 13:08:34 for LLVM by
1.8.13