ir_text.pl
IR text: a module written as Prolog clauses, one func/5 or data/4 term (ir.pl) per item in module order, and read back with read_term/3.
An IR file may also state runFn, Args: a call of Fn on the integer Args that difftest and the tests run. A small file:
The printer is ours rather than writeq/1, so the text is the same on both hosts and the layout stays stable:
- a function's blocks, phis and instructions are one per line, and any other item is one line;
- an atom is bare when it is a lowercase identifier, else quoted;
- a list of characters in
str/1is a string (double_quotes is chars on both hosts).
Module is the module(Items) of the IR clauses in File and Runs their run(Fn, Args) terms, each in file order. Throws nanofil_error(Msg) for a clause that is not an item or a run, or not ground. The module is not validated; see ir:valid_module/1.
T adds itself to the items or the runs, as difference lists.
Print the text of Module on the current output.
the text of the ground term T, which read_term/3 reads back as T.
A bare when it is a lowercase identifier, else quoted.
Cs inside quotes Q, with Q, backslash and control characters escaped.