Commit b1f2b21d authored by 李晓奇's avatar 李晓奇

finish part

parent f26d91aa
......@@ -2,6 +2,7 @@ build
Documentations/1-parser/*.pdf
compile_commands.json
.cache
.vscode
todo.txt
tmp.cminus
......@@ -204,13 +204,15 @@ class UniqueExpression : public Expression {
}
virtual std::string print() { return "(UNIQUE " + instr_->print() + ")"; }
bool equiv(const UniqueExpression *other) const { return false; }
bool equiv(const UniqueExpression *other) const {
return instr_ == other->instr_;
}
UniqueExpression(Instruction *instr)
: Expression(e_unique), instr_(instr) {}
private:
std::shared_ptr<Instruction> instr_;
Instruction *instr_;
};
} // namespace GVNExpression
......@@ -277,7 +279,7 @@ class GVN : public Pass {
BasicBlock *bb);
std::shared_ptr<GVNExpression::Expression> valueExpr(
Instruction *instr,
partitions *part = nullptr);
const partitions &part);
std::shared_ptr<GVNExpression::Expression> getVN(
const partitions &pout,
std::shared_ptr<GVNExpression::Expression> ve);
......@@ -293,11 +295,6 @@ class GVN : public Pass {
return std::make_shared<CongruenceClass>(index);
}
// self add
//
std::uint64_t new_number() { return next_value_number_++; }
static int pretend_copy_stmt(Instruction *inst, BasicBlock *bb);
private:
bool dump_json_;
std::uint64_t next_value_number_ = 1;
......@@ -307,10 +304,24 @@ class GVN : public Pass {
std::unique_ptr<GVNExpression::ConstFolder> folder_;
std::unique_ptr<DeadCode> dce_;
// self add
// self add member
std::map<BasicBlock *, bool> _TOP;
partitions join_helper(BasicBlock *pre1, BasicBlock *pre2);
BasicBlock* curr_bb;
BasicBlock *curr_bb;
//
// self add function
//
std::uint64_t new_number() { return next_value_number_++; }
static int pretend_copy_stmt(Instruction *inst, BasicBlock *bb);
std::shared_ptr<GVNExpression::Expression> search_ve(
Value *v,
const partitions &part);
std::vector<std::shared_ptr<GVNExpression::Expression>> core_(
Instruction *instr,
const partitions &part,
size_t count,
bool fold_ = true);
};
bool operator==(const GVN::partitions &p1, const GVN::partitions &p2);
This diff is collapsed.
rm -rf *.ll
rm -rf gvn.json
rm -rf `ls | grep -v "\."`
rm -rf const-prop
rm -rf transpose
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment