summaryrefslogtreecommitdiff
path: root/src/jit/gentree.cpp
diff options
context:
space:
mode:
authormikedn <onemihaid@hotmail.com>2019-05-29 20:37:25 +0300
committerCarol Eidt <carol.eidt@microsoft.com>2019-05-29 10:37:25 -0700
commit2eeeac5b0239cc619c1d71dc33896fa2bdced12c (patch)
treebe10c6d712822992cfe16ba8b9a2c92069f4e1fa /src/jit/gentree.cpp
parent90e7b68a9616b7c643a3e0e0e918102d94e527a2 (diff)
downloadcoreclr-2eeeac5b0239cc619c1d71dc33896fa2bdced12c.tar.gz
coreclr-2eeeac5b0239cc619c1d71dc33896fa2bdced12c.tar.bz2
coreclr-2eeeac5b0239cc619c1d71dc33896fa2bdced12c.zip
Change binary op tree display (#20045)
Diffstat (limited to 'src/jit/gentree.cpp')
-rw-r--r--src/jit/gentree.cpp100
1 files changed, 38 insertions, 62 deletions
diff --git a/src/jit/gentree.cpp b/src/jit/gentree.cpp
index 856ea3a891..420e87c7e5 100644
--- a/src/jit/gentree.cpp
+++ b/src/jit/gentree.cpp
@@ -53,7 +53,6 @@ enum IndentChars
ICTop,
ICMiddle,
ICDash,
- ICEmbedded,
ICTerminal,
ICError,
IndentCharCount
@@ -61,9 +60,9 @@ enum IndentChars
// clang-format off
// Sets of strings for different dumping options vert bot top mid dash embedded terminal error
-static const char* emptyIndents[IndentCharCount] = { " ", " ", " ", " ", " ", "{", "", "?" };
-static const char* asciiIndents[IndentCharCount] = { "|", "\\", "/", "+", "-", "{", "*", "?" };
-static const char* unicodeIndents[IndentCharCount] = { "\xe2\x94\x82", "\xe2\x94\x94", "\xe2\x94\x8c", "\xe2\x94\x9c", "\xe2\x94\x80", "{", "\xe2\x96\x8c", "?" };
+static const char* emptyIndents[IndentCharCount] = { " ", " ", " ", " ", " ", "", "?" };
+static const char* asciiIndents[IndentCharCount] = { "|", "\\", "/", "+", "-", "*", "?" };
+static const char* unicodeIndents[IndentCharCount] = { "\xe2\x94\x82", "\xe2\x94\x94", "\xe2\x94\x8c", "\xe2\x94\x9c", "\xe2\x94\x80", "\xe2\x96\x8c", "?" };
// clang-format on
typedef ArrayStack<Compiler::IndentInfo> IndentInfoStack;
@@ -115,9 +114,6 @@ struct IndentStack
case Compiler::IndentInfo::IINone:
printf(" ");
break;
- case Compiler::IndentInfo::IIEmbedded:
- printf("%s ", indents[ICEmbedded]);
- break;
case Compiler::IndentInfo::IIArc:
if (index == 0)
{
@@ -10592,10 +10588,6 @@ void Compiler::gtDispTree(GenTree* tree,
indentStack->Push(IINone);
lowerArc = IIArc;
break;
- case IIEmbedded:
- indentStack->Push(IIEmbedded);
- lowerArc = IIEmbedded;
- break;
case IINone:
indentStack->Push(IINone);
lowerArc = IINone;
@@ -10606,53 +10598,12 @@ void Compiler::gtDispTree(GenTree* tree,
}
}
- // Special case formatting for PHI nodes -- arg lists like calls.
-
- if (tree->OperGet() == GT_PHI)
- {
- gtDispNode(tree, indentStack, msg, isLIR);
- gtDispCommonEndLine(tree);
-
- if (!topOnly)
- {
- if (tree->gtOp.gtOp1 != nullptr)
- {
- IndentInfo arcType = IIArcTop;
- for (GenTreeArgList* args = tree->gtOp.gtOp1->AsArgList(); args != nullptr; args = args->Rest())
- {
- if (args->Rest() == nullptr)
- {
- arcType = IIArcBottom;
- }
- gtDispChild(args->Current(), indentStack, arcType);
- arcType = IIArc;
- }
- }
- }
- return;
- }
-
/* Is it a 'simple' unary/binary operator? */
const char* childMsg = nullptr;
if (tree->OperIsSimple())
{
- if (!topOnly)
- {
- if (tree->gtGetOp2IfPresent())
- {
- // Label the childMsgs of the GT_COLON operator
- // op2 is the then part
-
- if (tree->gtOper == GT_COLON)
- {
- childMsg = "then";
- }
- gtDispChild(tree->gtOp.gtOp2, indentStack, IIArcTop, childMsg, topOnly);
- }
- }
-
// Now, get the right type of arc for this node
if (myArc != IINone)
{
@@ -10854,21 +10805,46 @@ void Compiler::gtDispTree(GenTree* tree,
gtDispCommonEndLine(tree);
- if (!topOnly && tree->gtOp.gtOp1)
+ if (!topOnly)
{
-
- // Label the child of the GT_COLON operator
- // op1 is the else part
-
- if (tree->gtOper == GT_COLON)
+ if (tree->gtOp.gtOp1 != nullptr)
{
- childMsg = "else";
+ if (tree->OperIs(GT_PHI))
+ {
+ for (GenTreeArgList* args = tree->gtGetOp1()->AsArgList(); args != nullptr; args = args->Rest())
+ {
+ gtDispChild(args->Current(), indentStack, (args->Rest() == nullptr) ? IIArcBottom : IIArc);
+ }
+ }
+ else
+ {
+ // Label the child of the GT_COLON operator
+ // op1 is the else part
+
+ if (tree->gtOper == GT_COLON)
+ {
+ childMsg = "else";
+ }
+ else if (tree->gtOper == GT_QMARK)
+ {
+ childMsg = " if";
+ }
+ gtDispChild(tree->gtOp.gtOp1, indentStack,
+ (tree->gtGetOp2IfPresent() == nullptr) ? IIArcBottom : IIArc, childMsg, topOnly);
+ }
}
- else if (tree->gtOper == GT_QMARK)
+
+ if (tree->gtGetOp2IfPresent())
{
- childMsg = " if";
+ // Label the childMsgs of the GT_COLON operator
+ // op2 is the then part
+
+ if (tree->gtOper == GT_COLON)
+ {
+ childMsg = "then";
+ }
+ gtDispChild(tree->gtOp.gtOp2, indentStack, IIArcBottom, childMsg, topOnly);
}
- gtDispChild(tree->gtOp.gtOp1, indentStack, IIArcBottom, childMsg, topOnly);
}
return;