Skip to content

Commit

Permalink
[ doc ] document %cg pragma (#3217)
Browse files Browse the repository at this point in the history
* [ doc ] document %cg pragma

* [ doc ] add more detail to %cg documentation
  • Loading branch information
dunhamsteve committed Mar 17, 2024
1 parent 4a5259b commit 388fe83
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions docs/source/reference/pragmas.rst
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,27 @@ Set the expression search timeout in milliseconds. The default is 1000.
Set the maximum number of stuck applications allowed while unifying a meta. The
default value is 25.

``%cg``
--------------------

Codegen directives can be included in source code with the ``%cg`` pragma. For example, instead of
using ``--directive extraRuntime=mycode.ss`` on the command line for the chez backend, you can write:

.. code-block:: idris
%cg chez extraRuntime=mycode.ss
The ``%cg`` pragma is followed by the name of a codegen and a directive for that codegen, terminated by
newline. Directives from imported modules, including transitive imports, will aggregate. All of the
directives given in the source are stored in the module, but only the directives for the current codegen
are used at link time.

How directives are treated in aggregate depends on the codegen and directive. For example, the
``extraRuntime`` directive for the Chez codegen is deduplicated. And the javascript backend gives
the ``minimal`` directive priority over the ``compact`` directive if both are present.

See the section for each codegen under :ref:`sect-execs` for available directives.

Pragmas on declarations
=======================

Expand Down

0 comments on commit 388fe83

Please sign in to comment.