From fdec17d475045a5d9651465bd04eca153281cd6f Mon Sep 17 00:00:00 2001 From: Oliver Scherer Date: Fri, 14 Dec 2018 16:58:19 +0100 Subject: [PATCH] Add graphs that I forgot to push in the original PR --- src/mir/construction.md | 7 + src/mir/mir_detailed.dot | 27 ++++ src/mir/mir_detailed.svg | 300 +++++++++++++++++++++++++++++++++++++++ src/mir/mir_overview.dot | 10 ++ src/mir/mir_overview.svg | 103 ++++++++++++++ 5 files changed, 447 insertions(+) create mode 100644 src/mir/mir_detailed.dot create mode 100644 src/mir/mir_detailed.svg create mode 100644 src/mir/mir_overview.dot create mode 100644 src/mir/mir_overview.svg diff --git a/src/mir/construction.md b/src/mir/construction.md index f0e3cf76..0e0bf35e 100644 --- a/src/mir/construction.md +++ b/src/mir/construction.md @@ -92,6 +92,13 @@ There are essentially four kinds of representations one might want of an express * `Operand` is an argument to e.g. a `+` operation or a function call * a temporary variable containing a copy of the value +These following image depicts a general overview of the interactions between the +representations: + + + +[Click here for a more detailed view](mir_detailed.svg) + We start out with lowering the function body to an `Rvalue` so we can create an assignment to `RETURN_PLACE`, This `Rvalue` lowering will in turn trigger lowering to `Operand` for its arguments (if any). `Operand` lowering either produces a `const` diff --git a/src/mir/mir_detailed.dot b/src/mir/mir_detailed.dot new file mode 100644 index 00000000..1494f4f0 --- /dev/null +++ b/src/mir/mir_detailed.dot @@ -0,0 +1,27 @@ +digraph G { + Operand -> Constant + Operand -> Place [taillabel="read"] + Place -> Projection + Projection -> Place + Place -> LocalId + Rvalue -> "Rvalue\nAggregate" + Rvalue -> "Rvalue\nBinaryOp" + Rvalue -> "Rvalue\nUnaryOp" + Rvalue -> "Rvalue\n..." + "Rvalue\nAggregate" -> Operand [headlabel="*"] + "Rvalue\nBinaryOp" -> Operand [headlabel="2"] + "Rvalue\nUnaryOp" -> Operand + "Statement\nAssignment" -> Place [taillabel="write"] + "Statement\nAssignment" -> Rvalue + Statement -> "Statement\nAssignment" + Statement -> "Statement\n..." + Block -> Statement [headlabel="*"] + Block -> Terminator + Terminator -> "Terminator\nSwitchInt" + "Terminator\nSwitchInt" -> Operand + "Terminator\nSwitchInt" -> Constant [headlabel="*"] + "Terminator\nSwitchInt" -> BlockId [headlabel="*"] + Terminator -> "Terminator\n..." + Mir -> Block [headlabel="*"] + Mir -> Local [headlabel="*"] +} \ No newline at end of file diff --git a/src/mir/mir_detailed.svg b/src/mir/mir_detailed.svg new file mode 100644 index 00000000..771e9e5d --- /dev/null +++ b/src/mir/mir_detailed.svg @@ -0,0 +1,300 @@ + + + + + + +G + + + +Operand + +Operand + + + +Constant + +Constant + + + +Operand->Constant + + + + + +Place + +Place + + + +Operand->Place + + +read + + + +Projection + +Projection + + + +Place->Projection + + + + + +LocalId + +LocalId + + + +Place->LocalId + + + + + +Projection->Place + + + + + +Rvalue + +Rvalue + + + +Rvalue\nAggregate + +Rvalue +Aggregate + + + +Rvalue->Rvalue\nAggregate + + + + + +Rvalue\nBinaryOp + +Rvalue +BinaryOp + + + +Rvalue->Rvalue\nBinaryOp + + + + + +Rvalue\nUnaryOp + +Rvalue +UnaryOp + + + +Rvalue->Rvalue\nUnaryOp + + + + + +Rvalue\n... + +Rvalue +... + + + +Rvalue->Rvalue\n... + + + + + +Rvalue\nAggregate->Operand + + +* + + + +Rvalue\nBinaryOp->Operand + + +2 + + + +Rvalue\nUnaryOp->Operand + + + + + +Statement\nAssignment + +Statement +Assignment + + + +Statement\nAssignment->Place + + +write + + + +Statement\nAssignment->Rvalue + + + + + +Statement + +Statement + + + +Statement->Statement\nAssignment + + + + + +Statement\n... + +Statement +... + + + +Statement->Statement\n... + + + + + +Block + +Block + + + +Block->Statement + + +* + + + +Terminator + +Terminator + + + +Block->Terminator + + + + + +Terminator\nSwitchInt + +Terminator +SwitchInt + + + +Terminator->Terminator\nSwitchInt + + + + + +Terminator\n... + +Terminator +... + + + +Terminator->Terminator\n... + + + + + +Terminator\nSwitchInt->Operand + + + + + +Terminator\nSwitchInt->Constant + + +* + + + +BlockId + +BlockId + + + +Terminator\nSwitchInt->BlockId + + +* + + + +Mir + +Mir + + + +Mir->Block + + +* + + + +Local + +Local + + + +Mir->Local + + +* + + + diff --git a/src/mir/mir_overview.dot b/src/mir/mir_overview.dot new file mode 100644 index 00000000..c0b51674 --- /dev/null +++ b/src/mir/mir_overview.dot @@ -0,0 +1,10 @@ +digraph G { + Operand -> Constant + Operand -> Place + Place -> Projection + Projection -> Place + Place -> Local + Rvalue -> Operand + Assignment -> Place + Assignment -> Operand +} \ No newline at end of file diff --git a/src/mir/mir_overview.svg b/src/mir/mir_overview.svg new file mode 100644 index 00000000..b8f092cd --- /dev/null +++ b/src/mir/mir_overview.svg @@ -0,0 +1,103 @@ + + + + + + +G + + + +Operand + +Operand + + + +Constant + +Constant + + + +Operand->Constant + + + + + +Place + +Place + + + +Operand->Place + + + + + +Projection + +Projection + + + +Place->Projection + + + + + +Local + +Local + + + +Place->Local + + + + + +Projection->Place + + + + + +Rvalue + +Rvalue + + + +Rvalue->Operand + + + + + +Assignment + +Assignment + + + +Assignment->Operand + + + + + +Assignment->Place + + + + +