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