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 // This file implements the CfgNode class, including the complexities | 10 // This file implements the CfgNode class, including the complexities |
(...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
813 bool First = true; | 813 bool First = true; |
814 Variable *Dest = Instr->getDest(); | 814 Variable *Dest = Instr->getDest(); |
815 if (Dest && Dest->hasReg()) | 815 if (Dest && Dest->hasReg()) |
816 ++LiveRegCount[Dest->getRegNum()]; | 816 ++LiveRegCount[Dest->getRegNum()]; |
817 for (SizeT I = 0; I < Instr->getSrcSize(); ++I) { | 817 for (SizeT I = 0; I < Instr->getSrcSize(); ++I) { |
818 Operand *Src = Instr->getSrc(I); | 818 Operand *Src = Instr->getSrc(I); |
819 SizeT NumVars = Src->getNumVars(); | 819 SizeT NumVars = Src->getNumVars(); |
820 for (SizeT J = 0; J < NumVars; ++J) { | 820 for (SizeT J = 0; J < NumVars; ++J) { |
821 const Variable *Var = Src->getVar(J); | 821 const Variable *Var = Src->getVar(J); |
822 if (Var->hasReg()) { | 822 if (Var->hasReg()) { |
823 if (Instr->isLastUse(Var) && | 823 if (Instr->isLastUse(Var) && --LiveRegCount[Var->getRegNum()] == 0) { |
824 --LiveRegCount[Var->getRegNum()] == 0) { | |
825 if (First) | 824 if (First) |
826 Str << " \t# END="; | 825 Str << " \t# END="; |
827 else | 826 else |
828 Str << ","; | 827 Str << ","; |
829 Var->emit(Func); | 828 Var->emit(Func); |
830 First = false; | 829 First = false; |
831 } | 830 } |
832 } | 831 } |
833 } | 832 } |
834 } | 833 } |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
936 LivenessBV LiveIn; | 935 LivenessBV LiveIn; |
937 if (Liveness) | 936 if (Liveness) |
938 LiveIn = Liveness->getLiveIn(this); | 937 LiveIn = Liveness->getLiveIn(this); |
939 if (Func->isVerbose(IceV_Liveness) && !LiveIn.empty()) { | 938 if (Func->isVerbose(IceV_Liveness) && !LiveIn.empty()) { |
940 Str << " // LiveIn:"; | 939 Str << " // LiveIn:"; |
941 for (SizeT i = 0; i < LiveIn.size(); ++i) { | 940 for (SizeT i = 0; i < LiveIn.size(); ++i) { |
942 if (LiveIn[i]) { | 941 if (LiveIn[i]) { |
943 Variable *Var = Liveness->getVariable(i, this); | 942 Variable *Var = Liveness->getVariable(i, this); |
944 Str << " %" << Var->getName(Func); | 943 Str << " %" << Var->getName(Func); |
945 if (Func->isVerbose(IceV_RegOrigins) && Var->hasReg()) { | 944 if (Func->isVerbose(IceV_RegOrigins) && Var->hasReg()) { |
946 Str << ":" << Func->getTarget()->getRegName(Var->getRegNum(), | 945 Str << ":" |
947 Var->getType()); | 946 << Func->getTarget()->getRegName(Var->getRegNum(), |
| 947 Var->getType()); |
948 } | 948 } |
949 } | 949 } |
950 } | 950 } |
951 Str << "\n"; | 951 Str << "\n"; |
952 } | 952 } |
953 // Dump each instruction. | 953 // Dump each instruction. |
954 if (Func->isVerbose(IceV_Instructions)) { | 954 if (Func->isVerbose(IceV_Instructions)) { |
955 for (const Inst &I : Phis) | 955 for (const Inst &I : Phis) |
956 I.dumpDecorated(Func); | 956 I.dumpDecorated(Func); |
957 for (const Inst &I : Insts) | 957 for (const Inst &I : Insts) |
958 I.dumpDecorated(Func); | 958 I.dumpDecorated(Func); |
959 } | 959 } |
960 // Dump the live-out variables. | 960 // Dump the live-out variables. |
961 LivenessBV LiveOut; | 961 LivenessBV LiveOut; |
962 if (Liveness) | 962 if (Liveness) |
963 LiveOut = Liveness->getLiveOut(this); | 963 LiveOut = Liveness->getLiveOut(this); |
964 if (Func->isVerbose(IceV_Liveness) && !LiveOut.empty()) { | 964 if (Func->isVerbose(IceV_Liveness) && !LiveOut.empty()) { |
965 Str << " // LiveOut:"; | 965 Str << " // LiveOut:"; |
966 for (SizeT i = 0; i < LiveOut.size(); ++i) { | 966 for (SizeT i = 0; i < LiveOut.size(); ++i) { |
967 if (LiveOut[i]) { | 967 if (LiveOut[i]) { |
968 Variable *Var = Liveness->getVariable(i, this); | 968 Variable *Var = Liveness->getVariable(i, this); |
969 Str << " %" << Var->getName(Func); | 969 Str << " %" << Var->getName(Func); |
970 if (Func->isVerbose(IceV_RegOrigins) && Var->hasReg()) { | 970 if (Func->isVerbose(IceV_RegOrigins) && Var->hasReg()) { |
971 Str << ":" << Func->getTarget()->getRegName(Var->getRegNum(), | 971 Str << ":" |
972 Var->getType()); | 972 << Func->getTarget()->getRegName(Var->getRegNum(), |
| 973 Var->getType()); |
973 } | 974 } |
974 } | 975 } |
975 } | 976 } |
976 Str << "\n"; | 977 Str << "\n"; |
977 } | 978 } |
978 // Dump list of successor nodes. | 979 // Dump list of successor nodes. |
979 if (Func->isVerbose(IceV_Succs)) { | 980 if (Func->isVerbose(IceV_Succs)) { |
980 Str << " // succs = "; | 981 Str << " // succs = "; |
981 bool First = true; | 982 bool First = true; |
982 for (CfgNode *I : OutEdges) { | 983 for (CfgNode *I : OutEdges) { |
983 if (!First) | 984 if (!First) |
984 Str << ", "; | 985 Str << ", "; |
985 First = false; | 986 First = false; |
986 Str << "%" << I->getName(); | 987 Str << "%" << I->getName(); |
987 } | 988 } |
988 Str << "\n"; | 989 Str << "\n"; |
989 } | 990 } |
990 } | 991 } |
991 | 992 |
992 } // end of namespace Ice | 993 } // end of namespace Ice |
OLD | NEW |