OLD | NEW |
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 865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
876 namespace { | 876 namespace { |
877 | 877 |
878 // Helper functions for emit(). | 878 // Helper functions for emit(). |
879 | 879 |
880 void emitRegisterUsage(Ostream &Str, const Cfg *Func, const CfgNode *Node, | 880 void emitRegisterUsage(Ostream &Str, const Cfg *Func, const CfgNode *Node, |
881 bool IsLiveIn, CfgVector<SizeT> &LiveRegCount) { | 881 bool IsLiveIn, CfgVector<SizeT> &LiveRegCount) { |
882 if (!BuildDefs::dump()) | 882 if (!BuildDefs::dump()) |
883 return; | 883 return; |
884 Liveness *Liveness = Func->getLiveness(); | 884 Liveness *Liveness = Func->getLiveness(); |
885 const LivenessBV *Live; | 885 const LivenessBV *Live; |
| 886 const int32_t StackReg = Func->getTarget()->getStackReg(); |
| 887 const int32_t FrameOrStackReg = Func->getTarget()->getFrameOrStackReg(); |
886 if (IsLiveIn) { | 888 if (IsLiveIn) { |
887 Live = &Liveness->getLiveIn(Node); | 889 Live = &Liveness->getLiveIn(Node); |
888 Str << "\t\t\t\t# LiveIn="; | 890 Str << "\t\t\t\t# LiveIn="; |
889 } else { | 891 } else { |
890 Live = &Liveness->getLiveOut(Node); | 892 Live = &Liveness->getLiveOut(Node); |
891 Str << "\t\t\t\t# LiveOut="; | 893 Str << "\t\t\t\t# LiveOut="; |
892 } | 894 } |
893 if (!Live->empty()) { | 895 if (!Live->empty()) { |
894 CfgVector<Variable *> LiveRegs; | 896 CfgVector<Variable *> LiveRegs; |
895 for (SizeT i = 0; i < Live->size(); ++i) { | 897 for (SizeT i = 0; i < Live->size(); ++i) { |
896 if ((*Live)[i]) { | 898 if (!(*Live)[i]) |
897 Variable *Var = Liveness->getVariable(i, Node); | 899 continue; |
898 if (Var->hasReg()) { | 900 Variable *Var = Liveness->getVariable(i, Node); |
899 if (IsLiveIn) | 901 if (!Var->hasReg()) |
900 ++LiveRegCount[Var->getRegNum()]; | 902 continue; |
901 LiveRegs.push_back(Var); | 903 const int32_t RegNum = Var->getRegNum(); |
902 } | 904 if (RegNum == StackReg || RegNum == FrameOrStackReg) |
903 } | 905 continue; |
| 906 if (IsLiveIn) |
| 907 ++LiveRegCount[RegNum]; |
| 908 LiveRegs.push_back(Var); |
904 } | 909 } |
905 // Sort the variables by regnum so they are always printed in a familiar | 910 // Sort the variables by regnum so they are always printed in a familiar |
906 // order. | 911 // order. |
907 std::sort(LiveRegs.begin(), LiveRegs.end(), | 912 std::sort(LiveRegs.begin(), LiveRegs.end(), |
908 [](const Variable *V1, const Variable *V2) { | 913 [](const Variable *V1, const Variable *V2) { |
909 return V1->getRegNum() < V2->getRegNum(); | 914 return V1->getRegNum() < V2->getRegNum(); |
910 }); | 915 }); |
911 bool First = true; | 916 bool First = true; |
912 for (Variable *Var : LiveRegs) { | 917 for (Variable *Var : LiveRegs) { |
913 if (!First) | 918 if (!First) |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1368 InstIntrinsicCall *Inst = InstIntrinsicCall::create( | 1373 InstIntrinsicCall *Inst = InstIntrinsicCall::create( |
1369 Func, 5, Func->makeVariable(IceType_i64), RMWI64Name, Info->Info); | 1374 Func, 5, Func->makeVariable(IceType_i64), RMWI64Name, Info->Info); |
1370 Inst->addArg(AtomicRMWOp); | 1375 Inst->addArg(AtomicRMWOp); |
1371 Inst->addArg(Counter); | 1376 Inst->addArg(Counter); |
1372 Inst->addArg(One); | 1377 Inst->addArg(One); |
1373 Inst->addArg(OrderAcquireRelease); | 1378 Inst->addArg(OrderAcquireRelease); |
1374 Insts.push_front(Inst); | 1379 Insts.push_front(Inst); |
1375 } | 1380 } |
1376 | 1381 |
1377 } // end of namespace Ice | 1382 } // end of namespace Ice |
OLD | NEW |