Chromium Code Reviews| Index: src/IceTargetLowering.cpp |
| diff --git a/src/IceTargetLowering.cpp b/src/IceTargetLowering.cpp |
| index 05ae1216547b4f6d7fe2d30d5f0d1ba1cb0d3555..f3eccc499858f5d23b2a81717d0bba1c61ca9a21 100644 |
| --- a/src/IceTargetLowering.cpp |
| +++ b/src/IceTargetLowering.cpp |
| @@ -26,7 +26,8 @@ namespace Ice { |
| void LoweringContext::init(CfgNode *N) { |
| Node = N; |
| - Cur = getNode()->getInsts().begin(); |
| + Begin = getNode()->getInsts().begin(); |
| + Cur = Begin; |
| End = getNode()->getInsts().end(); |
| skipDeleted(Cur); |
| Next = Cur; |
| @@ -50,6 +51,19 @@ void LoweringContext::advance(InstList::iterator &I) { |
| } |
| } |
| +void LoweringContext::rewind(InstList::iterator &I) const { |
| + assert(I != Begin); |
| + --I; |
|
Jim Stichnoth
2014/07/29 17:54:09
do {
--I;
} while (I != Begin && (*I)->isDeleted
jvoung (off chromium)
2014/07/30 15:17:13
Done.
|
| + while (I != Begin && (*I)->isDeleted()) |
| + --I; |
| +} |
| + |
| +Inst *LoweringContext::getLastInserted() const { |
| + InstList::iterator Cursor = Next; |
| + rewind(Cursor); |
| + return *Cursor; |
| +} |
| + |
| TargetLowering *TargetLowering::createLowering(TargetArch Target, Cfg *Func) { |
| // These statements can be #ifdef'd to specialize the code generator |
| // to a subset of the available targets. TODO: use CRTP. |