agx: Track block offsets
For fixing branch offsets. Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11023>
This commit is contained in:
@@ -303,6 +303,9 @@ typedef struct agx_block {
|
||||
/* Liveness analysis results */
|
||||
BITSET_WORD *live_in;
|
||||
BITSET_WORD *live_out;
|
||||
|
||||
/* Offset of the block in the emitted binary */
|
||||
off_t offset;
|
||||
} agx_block;
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -552,6 +552,13 @@ agx_pack_instr(struct util_dynarray *emission, agx_instr *I)
|
||||
void
|
||||
agx_pack(agx_context *ctx, struct util_dynarray *emission)
|
||||
{
|
||||
agx_foreach_instr_global(ctx, ins)
|
||||
agx_pack_instr(emission, ins);
|
||||
agx_foreach_block(ctx, block) {
|
||||
/* Relative to the start of the binary, the block begins at the current
|
||||
* number of bytes emitted */
|
||||
block->offset = emission->size;
|
||||
|
||||
agx_foreach_instr_in_block(block, ins) {
|
||||
agx_pack_instr(emission, ins);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user