123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- #ifndef LLVM_LIB_TRANSFORMS_AGGRESSIVEINSTCOMBINE_COMBINEINTERNAL_H
- #define LLVM_LIB_TRANSFORMS_AGGRESSIVEINSTCOMBINE_COMBINEINTERNAL_H
- #include "llvm/ADT/MapVector.h"
- #include "llvm/ADT/SmallVector.h"
- using namespace llvm;
- namespace llvm {
- class DataLayout;
- class DominatorTree;
- class Function;
- class Instruction;
- class TargetLibraryInfo;
- class TruncInst;
- class Type;
- class Value;
- class TruncInstCombine {
- TargetLibraryInfo &TLI;
- const DataLayout &DL;
- const DominatorTree &DT;
-
- SmallVector<TruncInst *, 4> Worklist;
-
- TruncInst *CurrentTruncInst;
-
- struct Info {
-
- unsigned ValidBitWidth = 0;
-
- unsigned MinBitWidth = 0;
-
- Value *NewValue = nullptr;
- };
-
-
-
-
- MapVector<Instruction *, Info> InstInfoMap;
- public:
- TruncInstCombine(TargetLibraryInfo &TLI, const DataLayout &DL,
- const DominatorTree &DT)
- : TLI(TLI), DL(DL), DT(DT), CurrentTruncInst(nullptr) {}
-
- bool run(Function &F);
- private:
-
-
-
-
- bool buildTruncExpressionDag();
-
-
-
-
-
- unsigned getMinBitWidth();
-
-
-
-
-
-
- Type *getBestTruncatedType();
-
-
-
-
-
-
- Value *getReducedOperand(Value *V, Type *SclTy);
-
-
-
-
-
- void ReduceExpressionDag(Type *SclTy);
- };
- }
- #endif
|