Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(494)

Side by Side Diff: src/IceCfgNode.cpp

Issue 1273823003: Subzero: Completely remove tracking of stack pointer live range. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Reformat Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/IceLiveness.cpp » ('j') | src/IceLiveness.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceCfgNode.cpp - Basic block (node) implementation -----===// 1 //===- subzero/src/IceCfgNode.cpp - Basic block (node) implementation -----===//
2 // 2 //
3 // The Subzero Code Generator 3 // The Subzero Code Generator
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 /// 9 ///
10 /// \file 10 /// \file
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after
660 TimerMarker T1(TimerStack::TT_liveRange, Func); 660 TimerMarker T1(TimerStack::TT_liveRange, Func);
661 661
662 SizeT NumVars = Liveness->getNumVarsInNode(this); 662 SizeT NumVars = Liveness->getNumVarsInNode(this);
663 LivenessBV &LiveIn = Liveness->getLiveIn(this); 663 LivenessBV &LiveIn = Liveness->getLiveIn(this);
664 LivenessBV &LiveOut = Liveness->getLiveOut(this); 664 LivenessBV &LiveOut = Liveness->getLiveOut(this);
665 LiveBeginEndMap &MapBegin = *Liveness->getLiveBegin(this); 665 LiveBeginEndMap &MapBegin = *Liveness->getLiveBegin(this);
666 LiveBeginEndMap &MapEnd = *Liveness->getLiveEnd(this); 666 LiveBeginEndMap &MapEnd = *Liveness->getLiveEnd(this);
667 std::sort(MapBegin.begin(), MapBegin.end()); 667 std::sort(MapBegin.begin(), MapBegin.end());
668 std::sort(MapEnd.begin(), MapEnd.end()); 668 std::sort(MapEnd.begin(), MapEnd.end());
669 // Verify there are no duplicates. 669 // Verify there are no duplicates.
670 struct ComparePair { 670 auto ComparePair =
671 bool operator()(const LiveBeginEndMapEntry &A, 671 [](const LiveBeginEndMapEntry &A, const LiveBeginEndMapEntry &B) {
672 const LiveBeginEndMapEntry &B) { 672 return A.first == B.first;
673 return A.first == B.first; 673 };
674 } 674 assert(std::adjacent_find(MapBegin.begin(), MapBegin.end(), ComparePair) ==
675 };
676 assert(std::adjacent_find(MapBegin.begin(), MapBegin.end(), ComparePair()) ==
677 MapBegin.end()); 675 MapBegin.end());
678 assert(std::adjacent_find(MapEnd.begin(), MapEnd.end(), ComparePair()) == 676 assert(std::adjacent_find(MapEnd.begin(), MapEnd.end(), ComparePair) ==
679 MapEnd.end()); 677 MapEnd.end());
680 678
681 LivenessBV LiveInAndOut = LiveIn; 679 LivenessBV LiveInAndOut = LiveIn;
682 LiveInAndOut &= LiveOut; 680 LiveInAndOut &= LiveOut;
683 681
684 // Iterate in parallel across the sorted MapBegin[] and MapEnd[]. 682 // Iterate in parallel across the sorted MapBegin[] and MapEnd[].
685 auto IBB = MapBegin.begin(), IEB = MapEnd.begin(); 683 auto IBB = MapBegin.begin(), IEB = MapEnd.begin();
686 auto IBE = MapBegin.end(), IEE = MapEnd.end(); 684 auto IBE = MapBegin.end(), IEE = MapEnd.end();
687 while (IBB != IBE || IEB != IEE) { 685 while (IBB != IBE || IEB != IEE) {
688 SizeT i1 = IBB == IBE ? NumVars : IBB->first; 686 SizeT i1 = IBB == IBE ? NumVars : IBB->first;
689 SizeT i2 = IEB == IEE ? NumVars : IEB->first; 687 SizeT i2 = IEB == IEE ? NumVars : IEB->first;
690 SizeT i = std::min(i1, i2); 688 SizeT i = std::min(i1, i2);
691 // i1 is the Variable number of the next MapBegin entry, and i2 is 689 // i1 is the Variable number of the next MapBegin entry, and i2 is
692 // the Variable number of the next MapEnd entry. If i1==i2, then 690 // the Variable number of the next MapEnd entry. If i1==i2, then
693 // the Variable's live range begins and ends in this block. If 691 // the Variable's live range begins and ends in this block. If
694 // i1<i2, then i1's live range begins at instruction IBB->second 692 // i1<i2, then i1's live range begins at instruction IBB->second
695 // and extends through the end of the block. If i1>i2, then i2's 693 // and extends through the end of the block. If i1>i2, then i2's
696 // live range begins at the first instruction of the block and 694 // live range begins at the first instruction of the block and
697 // ends at IEB->second. In any case, we choose the lesser of i1 695 // ends at IEB->second. In any case, we choose the lesser of i1
698 // and i2 and proceed accordingly. 696 // and i2 and proceed accordingly.
699 InstNumberT LB = i == i1 ? IBB->second : FirstInstNum; 697 InstNumberT LB = i == i1 ? IBB->second : FirstInstNum;
700 InstNumberT LE = i == i2 ? IEB->second : LastInstNum + 1; 698 InstNumberT LE = i == i2 ? IEB->second : LastInstNum + 1;
701 699
702 Variable *Var = Liveness->getVariable(i, this); 700 Variable *Var = Liveness->getVariable(i, this);
703 // TODO(stichnot): Push getIgnoreLiveness() into the initialization of 701 if (LB > LE) {
704 // Liveness::RangeMask so that LiveBegin and LiveEnd never even reference 702 Var->addLiveRange(FirstInstNum, LE, 1);
705 // such variables. 703 Var->addLiveRange(LB, LastInstNum + 1, 1);
706 if (!Var->getIgnoreLiveness()) { 704 // Assert that Var is a global variable by checking that its
707 if (LB > LE) { 705 // liveness index is less than the number of globals. This
708 Var->addLiveRange(FirstInstNum, LE, 1); 706 // ensures that the LiveInAndOut[] access is valid.
709 Var->addLiveRange(LB, LastInstNum + 1, 1); 707 assert(i < Liveness->getNumGlobalVars());
710 // Assert that Var is a global variable by checking that its 708 LiveInAndOut[i] = false;
711 // liveness index is less than the number of globals. This 709 } else {
712 // ensures that the LiveInAndOut[] access is valid. 710 Var->addLiveRange(LB, LE, 1);
713 assert(i < Liveness->getNumGlobalVars());
714 LiveInAndOut[i] = false;
715 } else {
716 Var->addLiveRange(LB, LE, 1);
717 }
718 } 711 }
719 if (i == i1) 712 if (i == i1)
720 ++IBB; 713 ++IBB;
721 if (i == i2) 714 if (i == i2)
722 ++IEB; 715 ++IEB;
723 } 716 }
724 // Process the variables that are live across the entire block. 717 // Process the variables that are live across the entire block.
725 for (int i = LiveInAndOut.find_first(); i != -1; 718 for (int i = LiveInAndOut.find_first(); i != -1;
726 i = LiveInAndOut.find_next(i)) { 719 i = LiveInAndOut.find_next(i)) {
727 Variable *Var = Liveness->getVariable(i, this); 720 Variable *Var = Liveness->getVariable(i, this);
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
1283 InstIntrinsicCall *Inst = InstIntrinsicCall::create( 1276 InstIntrinsicCall *Inst = InstIntrinsicCall::create(
1284 Func, 5, Func->makeVariable(IceType_i64), RMWI64Name, Info->Info); 1277 Func, 5, Func->makeVariable(IceType_i64), RMWI64Name, Info->Info);
1285 Inst->addArg(AtomicRMWOp); 1278 Inst->addArg(AtomicRMWOp);
1286 Inst->addArg(Counter); 1279 Inst->addArg(Counter);
1287 Inst->addArg(One); 1280 Inst->addArg(One);
1288 Inst->addArg(OrderAcquireRelease); 1281 Inst->addArg(OrderAcquireRelease);
1289 Insts.push_front(Inst); 1282 Insts.push_front(Inst);
1290 } 1283 }
1291 1284
1292 } // end of namespace Ice 1285 } // end of namespace Ice
OLDNEW
« no previous file with comments | « no previous file | src/IceLiveness.cpp » ('j') | src/IceLiveness.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698