Commit 8b32241c by Jaydeep Patil Committed by Jim Stichnoth

Provide repointEdges for MIPS.

R=stichnot@chromium.org Review URL: https://codereview.chromium.org/2257043003 . Patch from Jaydeep Patil <jaydeep.patil@imgtec.com>.
parent b1a0fb13
...@@ -200,6 +200,19 @@ InstMIPS32Br::InstMIPS32Br(Cfg *Func, const CfgNode *TargetTrue, ...@@ -200,6 +200,19 @@ InstMIPS32Br::InstMIPS32Br(Cfg *Func, const CfgNode *TargetTrue,
addSource(Src1); addSource(Src1);
} }
bool InstMIPS32Br::repointEdges(CfgNode *OldNode, CfgNode *NewNode) {
bool Found = false;
if (TargetFalse == OldNode) {
TargetFalse = NewNode;
Found = true;
}
if (TargetTrue == OldNode) {
TargetTrue = NewNode;
Found = true;
}
return Found;
}
InstMIPS32Label::InstMIPS32Label(Cfg *Func, TargetMIPS32 *Target) InstMIPS32Label::InstMIPS32Label(Cfg *Func, TargetMIPS32 *Target)
: InstMIPS32(Func, InstMIPS32::Label, 0, nullptr), : InstMIPS32(Func, InstMIPS32::Label, 0, nullptr),
Number(Target->makeNextLabelNumber()) { Number(Target->makeNextLabelNumber()) {
......
...@@ -502,8 +502,7 @@ class InstMIPS32Load : public InstMIPS32 { ...@@ -502,8 +502,7 @@ class InstMIPS32Load : public InstMIPS32 {
public: public:
static InstMIPS32Load *create(Cfg *Func, Variable *Value, static InstMIPS32Load *create(Cfg *Func, Variable *Value,
OperandMIPS32Mem *Mem, OperandMIPS32Mem *Mem, RelocOp Reloc = RO_No) {
RelocOp Reloc = RO_No) {
return new (Func->allocate<InstMIPS32Load>()) return new (Func->allocate<InstMIPS32Load>())
InstMIPS32Load(Func, Value, Mem, Reloc); InstMIPS32Load(Func, Value, Mem, Reloc);
} }
...@@ -559,8 +558,7 @@ class InstMIPS32Store : public InstMIPS32 { ...@@ -559,8 +558,7 @@ class InstMIPS32Store : public InstMIPS32 {
public: public:
static InstMIPS32Store *create(Cfg *Func, Variable *Value, static InstMIPS32Store *create(Cfg *Func, Variable *Value,
OperandMIPS32Mem *Mem, OperandMIPS32Mem *Mem, RelocOp Reloc = RO_No) {
RelocOp Reloc = RO_No) {
return new (Func->allocate<InstMIPS32Store>()) return new (Func->allocate<InstMIPS32Store>())
InstMIPS32Store(Func, Value, Mem, Reloc); InstMIPS32Store(Func, Value, Mem, Reloc);
} }
...@@ -675,11 +673,7 @@ public: ...@@ -675,11 +673,7 @@ public:
bool isUnconditionalBranch() const override { bool isUnconditionalBranch() const override {
return Predicate == CondMIPS32::AL; return Predicate == CondMIPS32::AL;
} }
bool repointEdges(CfgNode *OldNode, CfgNode *NewNode) override { bool repointEdges(CfgNode *OldNode, CfgNode *NewNode) override;
(void)OldNode;
(void)NewNode;
return true;
};
void emit(const Cfg *Func) const override; void emit(const Cfg *Func) const override;
void emitIAS(const Cfg *Func) const override { (void)Func; }; void emitIAS(const Cfg *Func) const override { (void)Func; };
void dump(const Cfg *Func) const override; void dump(const Cfg *Func) const override;
......
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