Provide BB layout info externally in terms of code offsets.

This is sometimes useful when performing analyses on the generated
machine code: for example, some kinds of code verifiers will want to do
a control-flow analysis, and it is much easier to do this if one does
not have to recover the CFG from the machine code (doing so requires
heavyweight analysis when indirect branches are involved). If one trusts
the control-flow lowering and only needs to verify other properties of
the code, this can be very useful.
This commit is contained in:
Chris Fallin
2021-04-28 17:52:42 -07:00
committed by Chris Fallin
parent 76c6b83f6a
commit 11a2ef01e7
8 changed files with 81 additions and 7 deletions

View File

@@ -340,6 +340,12 @@ pub struct MachCompileResult {
pub value_labels_ranges: ValueLabelsRanges,
/// Debug info: stackslots to stack pointer offsets.
pub stackslot_offsets: PrimaryMap<StackSlot, u32>,
/// Basic-block layout info: block start offsets.
pub bb_starts: Vec<CodeOffset>,
/// Basic-block layout info: block edges. Each edge is `(from,
/// to)`, where `from` and `to` are basic-block start offsets of
/// the respective blocks.
pub bb_edges: Vec<(CodeOffset, CodeOffset)>,
}
impl MachCompileResult {