mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-10-25 10:27:04 +00:00
MergeFunctions: FunctionPtr has been renamed to FunctionNode.
It's supposed to store additional pass information for current function here. That was the reason for name change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217483 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -392,15 +392,15 @@ private:
|
|||||||
DenseMap<const Value*, int> sn_mapL, sn_mapR;
|
DenseMap<const Value*, int> sn_mapL, sn_mapR;
|
||||||
};
|
};
|
||||||
|
|
||||||
class FunctionPtr {
|
class FunctionNode {
|
||||||
AssertingVH<Function> F;
|
AssertingVH<Function> F;
|
||||||
const DataLayout *DL;
|
const DataLayout *DL;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FunctionPtr(Function *F, const DataLayout *DL) : F(F), DL(DL) {}
|
FunctionNode(Function *F, const DataLayout *DL) : F(F), DL(DL) {}
|
||||||
Function *getFunc() const { return F; }
|
Function *getFunc() const { return F; }
|
||||||
void release() { F = 0; }
|
void release() { F = 0; }
|
||||||
bool operator<(const FunctionPtr &RHS) const {
|
bool operator<(const FunctionNode &RHS) const {
|
||||||
return (FunctionComparator(DL, F, RHS.getFunc()).compare()) == -1;
|
return (FunctionComparator(DL, F, RHS.getFunc()).compare()) == -1;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -1077,7 +1077,7 @@ public:
|
|||||||
bool runOnModule(Module &M) override;
|
bool runOnModule(Module &M) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef std::set<FunctionPtr> FnTreeType;
|
typedef std::set<FunctionNode> FnTreeType;
|
||||||
|
|
||||||
/// A work queue of functions that may have been modified and should be
|
/// A work queue of functions that may have been modified and should be
|
||||||
/// analyzed again.
|
/// analyzed again.
|
||||||
@@ -1420,14 +1420,14 @@ void MergeFunctions::mergeTwoFunctions(Function *F, Function *G) {
|
|||||||
// that was already inserted.
|
// that was already inserted.
|
||||||
bool MergeFunctions::insert(Function *NewFunction) {
|
bool MergeFunctions::insert(Function *NewFunction) {
|
||||||
std::pair<FnTreeType::iterator, bool> Result =
|
std::pair<FnTreeType::iterator, bool> Result =
|
||||||
FnTree.insert(FunctionPtr(NewFunction, DL));
|
FnTree.insert(FunctionNode(NewFunction, DL));
|
||||||
|
|
||||||
if (Result.second) {
|
if (Result.second) {
|
||||||
DEBUG(dbgs() << "Inserting as unique: " << NewFunction->getName() << '\n');
|
DEBUG(dbgs() << "Inserting as unique: " << NewFunction->getName() << '\n');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const FunctionPtr &OldF = *Result.first;
|
const FunctionNode &OldF = *Result.first;
|
||||||
|
|
||||||
// Don't merge tiny functions, since it can just end up making the function
|
// Don't merge tiny functions, since it can just end up making the function
|
||||||
// larger.
|
// larger.
|
||||||
@@ -1457,7 +1457,7 @@ bool MergeFunctions::insert(Function *NewFunction) {
|
|||||||
void MergeFunctions::remove(Function *F) {
|
void MergeFunctions::remove(Function *F) {
|
||||||
// We need to make sure we remove F, not a function "equal" to F per the
|
// We need to make sure we remove F, not a function "equal" to F per the
|
||||||
// function equality comparator.
|
// function equality comparator.
|
||||||
FnTreeType::iterator found = FnTree.find(FunctionPtr(F, DL));
|
FnTreeType::iterator found = FnTree.find(FunctionNode(F, DL));
|
||||||
size_t Erased = 0;
|
size_t Erased = 0;
|
||||||
if (found != FnTree.end() && found->getFunc() == F) {
|
if (found != FnTree.end() && found->getFunc() == F) {
|
||||||
Erased = 1;
|
Erased = 1;
|
||||||
|
|||||||
Reference in New Issue
Block a user