Skip to content

Improve basic block structure - #505

Open
zherczeg wants to merge 1 commit into
Samsung:mainfrom
zherczeg:cond_branch
Open

zherczeg wants to merge 1 commit into
Samsung:mainfrom
zherczeg:cond_branch

Conversation

@zherczeg

@zherczeg zherczeg commented Sep 24, 2026 •

Copy link
Copy Markdown
Collaborator

Add jumps after conditional branches if not present
Add several asserts to check the instruction stream integrity

@zherczeg

Copy link
Copy Markdown
Collaborator Author

@makachanm with this patch basic blocks should not have branches inside them. Furthermore the function return is automatically generated after the last EndOpcode, regardless where its block is moved.

SingleJump block sequences are "connected" together to be a single block (easier to skip them, no need a loop).

Hopefully with this patch the basic blocks are correct, and can be moved anywhere. They have m_prevInstr (the instruction before the block) / m_lastInstr (the last instruction of a block) members.

I think the block order should be determined by a single algorithm, which uses branch hints (taken / not-taken).

@makachanm

makachanm commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

@makachanm with this patch basic blocks should not have branches inside them. Furthermore the function return is automatically generated after the last EndOpcode, regardless where its block is moved.

SingleJump block sequences are "connected" together to be a single block (easier to skip them, no need a loop).

Hopefully with this patch the basic blocks are correct, and can be moved anywhere. They have m_prevInstr (the instruction before the block) / m_lastInstr (the last instruction of a block) members.

I think the block order should be determined by a single algorithm, which uses branch hints (taken / not-taken).

Thanks for working for this. I'll check it and rework from this.

@zherczeg
zherczeg marked this pull request as draft September 25, 2026 07:11
Add jumps after conditional branches if not present
Add several asserts to check the instruction stream integrity

Signed-off-by: Zoltan Herczeg zherczeg.u-szeged@partner.samsung.com
@zherczeg
zherczeg marked this pull request as ready for review September 25, 2026 10:11
@zherczeg

Copy link
Copy Markdown
Collaborator Author

I think the patch is done. It adds a lot of small reworks, but still keep the instruction list order.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants