Chromium Code Reviews| Index: src/IceInst.cpp |
| diff --git a/src/IceInst.cpp b/src/IceInst.cpp |
| index 4aa6e6947fc030c5c14ba32faa8ee07b21c9b2c0..75360dce95ffaee27a770c17e8c14581f8c36aac 100644 |
| --- a/src/IceInst.cpp |
| +++ b/src/IceInst.cpp |
| @@ -135,12 +135,14 @@ void Inst::livenessLightweight(Cfg *Func, LivenessBV &Live) { |
| } |
| } |
| -void Inst::liveness(InstNumberT InstNumber, LivenessBV &Live, |
| +// Returns true if the instruction is tentatively retained, or false |
|
jvoung (off chromium)
2014/10/27 22:12:21
nit: Might be clearer if the return value is descr
Jim Stichnoth
2014/10/28 01:20:14
Tried to clarify the description (in the .h file).
|
| +// if the instruction is tentatively deleted. |
| +bool Inst::liveness(InstNumberT InstNumber, LivenessBV &Live, |
| Liveness *Liveness, LiveBeginEndMap *LiveBegin, |
| LiveBeginEndMap *LiveEnd) { |
| assert(!isDeleted()); |
| if (llvm::isa<InstFakeKill>(this)) |
| - return; |
| + return true; |
| Dead = false; |
| if (Dest) { |
| @@ -158,7 +160,7 @@ void Inst::liveness(InstNumberT InstNumber, LivenessBV &Live, |
| } |
| } |
| if (Dead) |
| - return; |
| + return false; |
| // Phi arguments only get added to Live in the predecessor node, but |
| // we still need to update LiveRangesEnded. |
| bool IsPhi = llvm::isa<InstPhi>(this); |
| @@ -202,6 +204,7 @@ void Inst::liveness(InstNumberT InstNumber, LivenessBV &Live, |
| } |
| } |
| } |
| + return true; |
| } |
| InstAlloca::InstAlloca(Cfg *Func, Operand *ByteCount, uint32_t AlignInBytes, |
| @@ -261,6 +264,17 @@ NodeList InstBr::getTerminatorEdges() const { |
| return OutEdges; |
| } |
| +bool InstBr::repointEdge(CfgNode *OldNode, CfgNode *NewNode) { |
| + if (TargetFalse == OldNode) { |
| + TargetFalse = NewNode; |
| + return true; |
| + } else if (TargetTrue == OldNode) { |
| + TargetTrue = NewNode; |
| + return true; |
| + } |
| + return false; |
|
jvoung (off chromium)
2014/10/27 22:12:21
Should this always succeed or no (only be one term
Jim Stichnoth
2014/10/28 01:20:14
It should fail (return false) only if something ge
|
| +} |
| + |
| InstCast::InstCast(Cfg *Func, OpKind CastKind, Variable *Dest, Operand *Source) |
| : InstHighLevel(Func, Inst::Cast, 1, Dest), CastKind(CastKind) { |
| addSource(Source); |
| @@ -410,6 +424,20 @@ NodeList InstSwitch::getTerminatorEdges() const { |
| return OutEdges; |
| } |
| +bool InstSwitch::repointEdge(CfgNode *OldNode, CfgNode *NewNode) { |
| + if (LabelDefault == OldNode) { |
| + LabelDefault = NewNode; |
| + return true; |
| + } |
| + for (SizeT I = 0; I < NumCases; ++I) { |
| + if (Labels[I] == OldNode) { |
| + Labels[I] = NewNode; |
| + return true; |
| + } |
| + } |
| + return false; |
| +} |
| + |
| InstUnreachable::InstUnreachable(Cfg *Func) |
| : InstHighLevel(Func, Inst::Unreachable, 0, NULL) {} |