Add a func.inst_offsets() iterator.
This Function method can be used after the final code layout has been computed. It returns all the instructions in an EBB along with their encoded size and offset from the beginning of the function. This is useful for extracting additional metadata about trapping instructions and other things that may be needed by a VM.
This commit is contained in:
@@ -211,7 +211,8 @@ impl SubTest for TestBinEmit {
|
||||
"Inconsistent {} header offset",
|
||||
ebb
|
||||
);
|
||||
for inst in func.layout.ebb_insts(ebb) {
|
||||
for (offset, inst, enc_bytes) in func.inst_offsets(ebb, &encinfo) {
|
||||
assert_eq!(sink.offset, offset);
|
||||
sink.text.clear();
|
||||
let enc = func.encodings[inst];
|
||||
|
||||
@@ -234,7 +235,7 @@ impl SubTest for TestBinEmit {
|
||||
// Verify the encoding recipe sizes against the ISAs emit_inst implementation.
|
||||
assert_eq!(
|
||||
emitted,
|
||||
encinfo.bytes(enc),
|
||||
enc_bytes,
|
||||
"Inconsistent size for [{}] {}",
|
||||
encinfo.display(enc),
|
||||
func.dfg.display_inst(inst, isa)
|
||||
|
||||
Reference in New Issue
Block a user