aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
-rw-r--r--Documentation/api.rst3
-rw-r--r--Documentation/doc-guide.rst2
-rwxr-xr-xDocumentation/sphinx/cdoc.py5
-rw-r--r--flow.c7
-rw-r--r--flowgraph.h20
-rw-r--r--optimize.c8
-rw-r--r--ptrlist.c12
7 files changed, 49 insertions, 8 deletions
diff --git a/Documentation/api.rst b/Documentation/api.rst
index cb8a0982..22b7dfd2 100644
--- a/Documentation/api.rst
+++ b/Documentation/api.rst
@@ -10,6 +10,7 @@ Utilities
.. c:autodoc:: ptrlist.c
.. c:autodoc:: utils.h
+.. c:autodoc:: flowgraph.h
Parsing
~~~~~~~
@@ -24,4 +25,6 @@ Typing
Optimization
~~~~~~~~~~~~
+.. c:autodoc:: optimize.c
+.. c:autodoc:: flow.c
.. c:autodoc:: simplify.c
diff --git a/Documentation/doc-guide.rst b/Documentation/doc-guide.rst
index 29f39aab..fb4cb322 100644
--- a/Documentation/doc-guide.rst
+++ b/Documentation/doc-guide.rst
@@ -138,7 +138,7 @@ For example, a doc-block like::
will be displayed like this:
.. c:function:: int inc(int val)
- :noindex:
+ :noindexentry:
:param val: the value to increment
:return: the incremented value
diff --git a/Documentation/sphinx/cdoc.py b/Documentation/sphinx/cdoc.py
index 73c128cb..cca5ad28 100755
--- a/Documentation/sphinx/cdoc.py
+++ b/Documentation/sphinx/cdoc.py
@@ -228,8 +228,9 @@ def convert_to_rst(info):
if 'short' in info:
(n, l) = info['short']
l = l[0].capitalize() + l[1:].strip('.')
- l = '\t' + l + '.'
- lst.append((n, l + '\n'))
+ if l[-1] != '?':
+ l = l + '.'
+ lst.append((n, '\t' + l + '\n'))
if 'tags' in info:
for (n, name, l) in info.get('tags', []):
if name != 'return':
diff --git a/flow.c b/flow.c
index 2e20ab75..951241b5 100644
--- a/flow.c
+++ b/flow.c
@@ -1,10 +1,11 @@
/*
- * Flow - walk the linearized flowgraph, simplifying it as we
- * go along.
- *
* Copyright (C) 2004 Linus Torvalds
*/
+///
+// Flow simplification
+// -------------------
+
#include <string.h>
#include <stdarg.h>
#include <stdlib.h>
diff --git a/flowgraph.h b/flowgraph.h
index 7226c55f..5a9c2607 100644
--- a/flowgraph.h
+++ b/flowgraph.h
@@ -1,13 +1,33 @@
#ifndef FLOWGRAPH_H
#define FLOWGRAPH_H
+///
+// Utilities for flowgraphs
+// ------------------------
+
#include <stdbool.h>
struct entrypoint;
struct basic_block;
+///
+// Set the BB's reverse postorder links
+// Each BB will also have its 'order number' set.
int cfg_postorder(struct entrypoint *ep);
+
+///
+// Build the dominance tree.
+// Each BB will then have:
+// - a link to its immediate dominator (::idom)
+// - the list of BB it immediately dominates (::doms)
+// - its level in the dominance tree (::dom_level)
void domtree_build(struct entrypoint *ep);
+
+///
+// Test the dominance between two basic blocks.
+// @a: the basic block expected to dominate
+// @b: the basic block expected to be dominated
+// @return: ``true`` if @a dominates @b, ``false`` otherwise.
bool domtree_dominates(struct basic_block *a, struct basic_block *b);
#endif
diff --git a/optimize.c b/optimize.c
index 338714c7..00595414 100644
--- a/optimize.c
+++ b/optimize.c
@@ -1,10 +1,12 @@
// SPDX-License-Identifier: MIT
//
-// optimize.c - main optimization loop
-//
// Copyright (C) 2004 Linus Torvalds
// Copyright (C) 2004 Christopher Li
+///
+// Optimization main loop
+// ----------------------
+
#include <assert.h>
#include "optimize.h"
#include "flowgraph.h"
@@ -45,6 +47,8 @@ static void clean_up_insns(struct entrypoint *ep)
} END_FOR_EACH_PTR(bb);
}
+///
+// optimization main loop
void optimize(struct entrypoint *ep)
{
if (fdump_ir & PASS_LINEARIZE)
diff --git a/ptrlist.c b/ptrlist.c
index 3af0b2c5..0f0b3f6d 100644
--- a/ptrlist.c
+++ b/ptrlist.c
@@ -7,6 +7,18 @@
///
// Pointer list manipulation
// -------------------------
+//
+// The data structure handled here is designed to hold pointers
+// but two special cases need to be avoided or need special care:
+// * NULL is used by {PREPARE,NEXT}_PTR_LIST() to indicate the end-of-list.
+// Thus, NULL can't be stored in lists using this API but is fine to
+// use with FOR_EACH_PTR() and its variants.
+// * VOID is used to replace a removed pseudo 'usage'. Since phi-nodes
+// (OP_PHI) use a list to store their operands, a VOID in a phi-node
+// list must be ignored since it represents a removed operand. As
+// consequence, VOIDs must never be used as phi-node operand.
+// This is fine since phi-nodes make no sense with void values
+// but VOID is also used for invalid types and in case of errors.
#include <stdlib.h>
#include <string.h>