mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-26 07:29:55 +00:00
LSR: Compress a pair (and get rid of the DenseMapInfo for it).
Also convert a horrible hash function to use our hashing infrastructure. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@204008 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
8a8f5c396f
commit
14029414f5
@ -56,6 +56,7 @@
|
|||||||
#define DEBUG_TYPE "loop-reduce"
|
#define DEBUG_TYPE "loop-reduce"
|
||||||
#include "llvm/Transforms/Scalar.h"
|
#include "llvm/Transforms/Scalar.h"
|
||||||
#include "llvm/ADT/DenseSet.h"
|
#include "llvm/ADT/DenseSet.h"
|
||||||
|
#include "llvm/ADT/Hashing.h"
|
||||||
#include "llvm/ADT/STLExtras.h"
|
#include "llvm/ADT/STLExtras.h"
|
||||||
#include "llvm/ADT/SetVector.h"
|
#include "llvm/ADT/SetVector.h"
|
||||||
#include "llvm/ADT/SmallBitVector.h"
|
#include "llvm/ADT/SmallBitVector.h"
|
||||||
@ -1114,11 +1115,7 @@ struct UniquifierDenseMapInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static unsigned getHashValue(const SmallVector<const SCEV *, 4> &V) {
|
static unsigned getHashValue(const SmallVector<const SCEV *, 4> &V) {
|
||||||
unsigned Result = 0;
|
return static_cast<unsigned>(hash_combine_range(V.begin(), V.end()));
|
||||||
for (SmallVectorImpl<const SCEV *>::const_iterator I = V.begin(),
|
|
||||||
E = V.end(); I != E; ++I)
|
|
||||||
Result ^= DenseMapInfo<const SCEV *>::getHashValue(*I);
|
|
||||||
return Result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool isEqual(const SmallVector<const SCEV *, 4> &LHS,
|
static bool isEqual(const SmallVector<const SCEV *, 4> &LHS,
|
||||||
@ -1146,6 +1143,8 @@ public:
|
|||||||
// TODO: Add a generic icmp too?
|
// TODO: Add a generic icmp too?
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef PointerIntPair<const SCEV *, 2, KindType> SCEVUseKindPair;
|
||||||
|
|
||||||
KindType Kind;
|
KindType Kind;
|
||||||
Type *AccessTy;
|
Type *AccessTy;
|
||||||
|
|
||||||
@ -1492,30 +1491,6 @@ static bool isAlwaysFoldable(const TargetTransformInfo &TTI,
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
/// UseMapDenseMapInfo - A DenseMapInfo implementation for holding
|
|
||||||
/// DenseMaps and DenseSets of pairs of const SCEV* and LSRUse::Kind.
|
|
||||||
struct UseMapDenseMapInfo {
|
|
||||||
static std::pair<const SCEV *, LSRUse::KindType> getEmptyKey() {
|
|
||||||
return std::make_pair(reinterpret_cast<const SCEV *>(-1), LSRUse::Basic);
|
|
||||||
}
|
|
||||||
|
|
||||||
static std::pair<const SCEV *, LSRUse::KindType> getTombstoneKey() {
|
|
||||||
return std::make_pair(reinterpret_cast<const SCEV *>(-2), LSRUse::Basic);
|
|
||||||
}
|
|
||||||
|
|
||||||
static unsigned
|
|
||||||
getHashValue(const std::pair<const SCEV *, LSRUse::KindType> &V) {
|
|
||||||
unsigned Result = DenseMapInfo<const SCEV *>::getHashValue(V.first);
|
|
||||||
Result ^= DenseMapInfo<unsigned>::getHashValue(unsigned(V.second));
|
|
||||||
return Result;
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool isEqual(const std::pair<const SCEV *, LSRUse::KindType> &LHS,
|
|
||||||
const std::pair<const SCEV *, LSRUse::KindType> &RHS) {
|
|
||||||
return LHS == RHS;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/// IVInc - An individual increment in a Chain of IV increments.
|
/// IVInc - An individual increment in a Chain of IV increments.
|
||||||
/// Relate an IV user to an expression that computes the IV it uses from the IV
|
/// Relate an IV user to an expression that computes the IV it uses from the IV
|
||||||
/// used by the previous link in the Chain.
|
/// used by the previous link in the Chain.
|
||||||
@ -1644,9 +1619,7 @@ class LSRInstance {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Support for sharing of LSRUses between LSRFixups.
|
// Support for sharing of LSRUses between LSRFixups.
|
||||||
typedef DenseMap<std::pair<const SCEV *, LSRUse::KindType>,
|
typedef DenseMap<LSRUse::SCEVUseKindPair, size_t> UseMapTy;
|
||||||
size_t,
|
|
||||||
UseMapDenseMapInfo> UseMapTy;
|
|
||||||
UseMapTy UseMap;
|
UseMapTy UseMap;
|
||||||
|
|
||||||
bool reconcileNewOffset(LSRUse &LU, int64_t NewOffset, bool HasBaseReg,
|
bool reconcileNewOffset(LSRUse &LU, int64_t NewOffset, bool HasBaseReg,
|
||||||
@ -2217,7 +2190,7 @@ LSRInstance::getUse(const SCEV *&Expr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::pair<UseMapTy::iterator, bool> P =
|
std::pair<UseMapTy::iterator, bool> P =
|
||||||
UseMap.insert(std::make_pair(std::make_pair(Expr, Kind), 0));
|
UseMap.insert(std::make_pair(LSRUse::SCEVUseKindPair(Expr, Kind), 0));
|
||||||
if (!P.second) {
|
if (!P.second) {
|
||||||
// A use already existed with this base.
|
// A use already existed with this base.
|
||||||
size_t LUIdx = P.first->second;
|
size_t LUIdx = P.first->second;
|
||||||
|
Loading…
Reference in New Issue
Block a user