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 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
909 updateStats(Func, &I); | 909 updateStats(Func, &I); |
910 } | 910 } |
911 } | 911 } |
912 | 912 |
913 void CfgNode::dump(Cfg *Func) const { | 913 void CfgNode::dump(Cfg *Func) const { |
914 if (!ALLOW_DUMP) | 914 if (!ALLOW_DUMP) |
915 return; | 915 return; |
916 Func->setCurrentNode(this); | 916 Func->setCurrentNode(this); |
917 Ostream &Str = Func->getContext()->getStrDump(); | 917 Ostream &Str = Func->getContext()->getStrDump(); |
918 Liveness *Liveness = Func->getLiveness(); | 918 Liveness *Liveness = Func->getLiveness(); |
919 if (Func->getContext()->isVerbose(IceV_Instructions)) { | 919 if (Func->isVerbose(IceV_Instructions)) { |
920 Str << getName() << ":\n"; | 920 Str << getName() << ":\n"; |
921 } | 921 } |
922 // Dump list of predecessor nodes. | 922 // Dump list of predecessor nodes. |
923 if (Func->getContext()->isVerbose(IceV_Preds) && !InEdges.empty()) { | 923 if (Func->isVerbose(IceV_Preds) && !InEdges.empty()) { |
924 Str << " // preds = "; | 924 Str << " // preds = "; |
925 bool First = true; | 925 bool First = true; |
926 for (CfgNode *I : InEdges) { | 926 for (CfgNode *I : InEdges) { |
927 if (!First) | 927 if (!First) |
928 Str << ", "; | 928 Str << ", "; |
929 First = false; | 929 First = false; |
930 Str << "%" << I->getName(); | 930 Str << "%" << I->getName(); |
931 } | 931 } |
932 Str << "\n"; | 932 Str << "\n"; |
933 } | 933 } |
934 // Dump the live-in variables. | 934 // Dump the live-in variables. |
935 LivenessBV LiveIn; | 935 LivenessBV LiveIn; |
936 if (Liveness) | 936 if (Liveness) |
937 LiveIn = Liveness->getLiveIn(this); | 937 LiveIn = Liveness->getLiveIn(this); |
938 if (Func->getContext()->isVerbose(IceV_Liveness) && !LiveIn.empty()) { | 938 if (Func->isVerbose(IceV_Liveness) && !LiveIn.empty()) { |
939 Str << " // LiveIn:"; | 939 Str << " // LiveIn:"; |
940 for (SizeT i = 0; i < LiveIn.size(); ++i) { | 940 for (SizeT i = 0; i < LiveIn.size(); ++i) { |
941 if (LiveIn[i]) { | 941 if (LiveIn[i]) { |
942 Variable *Var = Liveness->getVariable(i, this); | 942 Variable *Var = Liveness->getVariable(i, this); |
943 Str << " %" << Var->getName(Func); | 943 Str << " %" << Var->getName(Func); |
944 if (Func->getContext()->isVerbose(IceV_RegOrigins) && Var->hasReg()) { | 944 if (Func->isVerbose(IceV_RegOrigins) && Var->hasReg()) { |
945 Str << ":" << Func->getTarget()->getRegName(Var->getRegNum(), | 945 Str << ":" << Func->getTarget()->getRegName(Var->getRegNum(), |
946 Var->getType()); | 946 Var->getType()); |
947 } | 947 } |
948 } | 948 } |
949 } | 949 } |
950 Str << "\n"; | 950 Str << "\n"; |
951 } | 951 } |
952 // Dump each instruction. | 952 // Dump each instruction. |
953 if (Func->getContext()->isVerbose(IceV_Instructions)) { | 953 if (Func->isVerbose(IceV_Instructions)) { |
954 for (const Inst &I : Phis) | 954 for (const Inst &I : Phis) |
955 I.dumpDecorated(Func); | 955 I.dumpDecorated(Func); |
956 for (const Inst &I : Insts) | 956 for (const Inst &I : Insts) |
957 I.dumpDecorated(Func); | 957 I.dumpDecorated(Func); |
958 } | 958 } |
959 // Dump the live-out variables. | 959 // Dump the live-out variables. |
960 LivenessBV LiveOut; | 960 LivenessBV LiveOut; |
961 if (Liveness) | 961 if (Liveness) |
962 LiveOut = Liveness->getLiveOut(this); | 962 LiveOut = Liveness->getLiveOut(this); |
963 if (Func->getContext()->isVerbose(IceV_Liveness) && !LiveOut.empty()) { | 963 if (Func->isVerbose(IceV_Liveness) && !LiveOut.empty()) { |
964 Str << " // LiveOut:"; | 964 Str << " // LiveOut:"; |
965 for (SizeT i = 0; i < LiveOut.size(); ++i) { | 965 for (SizeT i = 0; i < LiveOut.size(); ++i) { |
966 if (LiveOut[i]) { | 966 if (LiveOut[i]) { |
967 Variable *Var = Liveness->getVariable(i, this); | 967 Variable *Var = Liveness->getVariable(i, this); |
968 Str << " %" << Var->getName(Func); | 968 Str << " %" << Var->getName(Func); |
969 if (Func->getContext()->isVerbose(IceV_RegOrigins) && Var->hasReg()) { | 969 if (Func->isVerbose(IceV_RegOrigins) && Var->hasReg()) { |
970 Str << ":" << Func->getTarget()->getRegName(Var->getRegNum(), | 970 Str << ":" << Func->getTarget()->getRegName(Var->getRegNum(), |
971 Var->getType()); | 971 Var->getType()); |
972 } | 972 } |
973 } | 973 } |
974 } | 974 } |
975 Str << "\n"; | 975 Str << "\n"; |
976 } | 976 } |
977 // Dump list of successor nodes. | 977 // Dump list of successor nodes. |
978 if (Func->getContext()->isVerbose(IceV_Succs)) { | 978 if (Func->isVerbose(IceV_Succs)) { |
979 Str << " // succs = "; | 979 Str << " // succs = "; |
980 bool First = true; | 980 bool First = true; |
981 for (CfgNode *I : OutEdges) { | 981 for (CfgNode *I : OutEdges) { |
982 if (!First) | 982 if (!First) |
983 Str << ", "; | 983 Str << ", "; |
984 First = false; | 984 First = false; |
985 Str << "%" << I->getName(); | 985 Str << "%" << I->getName(); |
986 } | 986 } |
987 Str << "\n"; | 987 Str << "\n"; |
988 } | 988 } |
989 } | 989 } |
990 | 990 |
991 } // end of namespace Ice | 991 } // end of namespace Ice |
OLD | NEW |