> For the complete documentation index, see [llms.txt](https://docs.hylo-lang.org/hylo-ir/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hylo-lang.org/hylo-ir/concepts/lowered-functions.md).

# Lowered functions

A lowered function is a set of IR instructions packaged as a single unit of computation. A lowered function has a name that must be unique across all linked modules.

A lowered function has a signature describing the type and passing conventions of its inputs and outputs.

A lowered function may have a body defined as a set of one or more basic blocks, one of which is designated as the function entry. A lowered function that does not define a body is called a *stub* and denotes the API of a function defined in another module or the ABI of a function linked from a binary.

## Lowered function signatures

<mark style="color:orange;">TBD</mark>

## Basic blocks

A basic block is a non-empty sequence of [instructions](/hylo-ir/instructions/general.md). The first and last instructions of a basic block are called its entry and exit points, respectively. Control flow shall always enter at entry points and exit at exit points. The last instruction of a basic block shall be a [terminator instruction](/hylo-ir/instructions/general.md#terminator-instructions).

A basic block may accept arguments.

Given two basic blocks `bb1` and `bb2`, `bb1` is *successor* of `bb2` (or, equivalently, `bb2` is predecessor of `bb1`) if the exit point of `bb2` may cause control flow to jump to `bb1`.

A basic block is *reachable* if it is an entry point or a successor of a reachable block. All basic blocks of a function shall be reachable in legal or canonical IR.

Given two basic blocks `bb1` and `bb2`:

* `bb1` dominates `bb2` if control flow must go through `bb1` before it can reach `bb2` or if `bb1` is `bb2`;
* `bb1` *strictly dominates* `bb2` if it dominates `bb2` and it is not `bb2`;
* `bb1` *immediately dominates* `bb2` if it strictly dominates `bb2` and does not strictly dominate any other basic block that strictly dominates `bb2`.

{% hint style="info" %}
As every reachable basic block of a function except its entry point has exactly one immediate dominator, the dominance relation of a function may be represented as a tree whose nodes are basic blocks and each node's children are those nodes it immediately dominates.
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.hylo-lang.org/hylo-ir/concepts/lowered-functions.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
