rocq/backend/Emit.v
The code of a function from its plan: filc_amd64.pl's function//2 with every temporary in its stack slot, which is what --registers=stack selects there. The lines are the Prolog compiler's, one for one, which the backend's gate checks on the corpus (emit.sh).
What is not ported yet is a todo line (Layout.v).
The frame's entry and exit
As entry_regs_shift//1: a buffered return's entry has the buffer in %rdi and the thread in %rsi.
As lowers_zeroing//2: zero lowers[0..n), so that the collector sees no stale lower.
As incoming_word//4: a word of the fast convention from its location into its slot; an integer register goes straight there, the rest through %rax.
The entry of a function: native_frame, stack_check, save_thread, save_return, zero_roots, push_frame(c) and receive. There are no setjmp sites to snapshot.
As frame_pop//1: the thread's top frame back to this frame's parent.
The exception exit: pop_frame, then exception(Return), which sets has_exception in %al or in the return buffer.
Edges
As pollcheck//3: call the runtime if the thread's state asks.
As phi_read//5: the value a phi takes from the block from, into the phi's shadow slots.
As phi_writes//2: each phi's shadow into the phi.
As edge_moves//4: the parallel copy of the target's phis, then the pollcheck if the target asks for one.
As edge//4: the moves of the edge, then the jump.
Returns
As success(registers): has_exception = 0 in %al.
As ret_value//3: the returned value in %rdx, with its lower in %rcx for a pointer; a float in %xmm0.
A word of a returned tuple.
As typed_return_word/4: a pointer is its address and its lower.
The class of a word of a returned tuple.
As typed_return_loads//4 and typed_return_load//5: each word into the register result_registers/2 gives it, here by its short name.
As buffer_words//3: the words of a buffered return into the buffer at %rax, each a full eightbyte.
Jumps
As jump//3: the code that ends the block from.
Blocks
As block_code//3: a block's label, instructions and jump.
Branch selection
As the branch selection of filc_amd64.pl (docs/perf.md). A block whose last instruction is an integer comparison that only the block's branch reads branches on the comparison's flags. A branch whose edge has no phi copy and no poll jumps straight to its block. An edge to the next block falls through.
One more occurrence of the temporary n.
As temp_names//1: each occurrence of tmp(N) in the term t counted into m. The name N is not searched.
As branch_selection/3: how many times each temporary occurs in the blocks of the plan, its definition included.
As negated/2, on the comparison.
The jump to the label l when the flags hold the comparison c.
As integer_immediate/3: the signed 32-bit immediate that stands for the constant n: always at a word, and at a long only when sign extension gives n back.
As plain_edge/2: an edge to a block without phis, and without a poll.
Whether the edge goes to the next block.
As selected_edge//5: the edge without its jump when it goes to the next block.
As selected_branch//6: the flags hold c exactly when the branch goes to t.
As the compare clause of selected_jump//4: x and y compared at the class k, y as an immediate when it is a constant that fits one.
The instructions before the last, and the last.
As compare_branch/5: the instructions before a last integer comparison that only the block's branch reads, with the comparison and the two targets.
As block_code//3 with selected branches: next is the label of the block after b.
The code of the blocks: with selected branches, or as the reference, which stores a comparison's boolean, tests it and jumps on both arms.
The shared failure blocks
k into the sorted ks, once, as sort/2 orders k(Size, Write, Align).
As inst_check_kind/2: the kind of check an instruction's access needs, if it has one.
As access_check_kinds/2: the distinct kinds of a function, in order.
As check_fail_blocks//2: a failure block for each kind, which calls the runtime's reporter.
As not_function_block//2: where a call through a pointer that is not a function's goes.
As unreachable_block//2: filc_error(Message, Origin), as clang's code panics at a reached unreachable.
Origins
As function_origin//7: a function origin and the origin that points at it.
As check_origins//2: an origin for each kind of check.
As origins//3: the name's text, the catching and the plain function origin, and the check origins.
The function
As linkage_globl//2.
As function//2: the implementation (the entry, the blocks, the shared exception exit and the failure blocks), then the function object and the origins.
The reference: no branch is selected.