Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need some constant folding in GlobalAnalysis #124

Closed
sifislag opened this issue Jan 18, 2024 · 3 comments
Closed

Need some constant folding in GlobalAnalysis #124

sifislag opened this issue Jan 18, 2024 · 3 comments
Assignees

Comments

@sifislag
Copy link
Collaborator

We currently only perform constant folding at local.dl:

https://github.com/nevillegrech/gigahorse-toolchain/blob/2c3994b1390aba93ee87922d35bb1acce618ba42/logic/local.dl#L118C1-L135C56

There are cases in which this isn't enough. Relevant snippet:

    Begin block 0x4aaa0xb67
    prev=[0x39db0xb67], succ=[0x4eb10xb67]
    =================================
    0x4aab0xb67: vb674aab(0x4abe) = CONST 
    0x4ab10xb67: vb674ab1(0x4e60) = CONST 
    0x4ab40xb67: vb674ab4(0x555f) = CONST 
    0x4ab70xb67: vb674ab7(0x5586) = CONST 
    0x4aba0xb67: vb674aba(0x4eb1) = CONST 
    0x4abd0xb67: JUMP vb674aba(0x4eb1)

    Begin block 0x4eb10xb67
    prev=[0x4aaa0xb67], succ=[]
    =================================
    0x4eb20xb67: vb674eb2(0x4ebf) = CONST 
    0x4eb80xb67: vb674eb8(0xffffffff) = CONST 
    0x4ebd0xb67: vb674ebd = AND vb674eb8(0xffffffff), vb674ab1(0x4e60)
    0x4ebe0xb67: JUMP vb674ebd

Will tackle soon, will have some difficulty.

@sifislag sifislag self-assigned this Jan 18, 2024
@iliastsa
Copy link
Collaborator

Would merging basic blocks when there are "chains" (A has B as the only successor block, B has A as the only predecessor block) help?

@sifislag
Copy link
Collaborator Author

Not really, it would be a shallow fix. I tried that at some point last year and it didn't give much benefit so I paused it. I think the fix for the current issue will not be too much work, but I need to test it thoroughly.

@sifislag
Copy link
Collaborator Author

Closed by #136

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

No branches or pull requests

2 participants