-
Notifications
You must be signed in to change notification settings - Fork 19
Update GitHub from git://c9x.me/qbe.git #3
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
Open
jpivarski
wants to merge
286
commits into
8l:master
Choose a base branch
from
jpivarski:jpivarski/update-GitHub
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This makes it possible to call it several times in a row.
When an edge is deleted, the phis and predecessors of the destination block have to be updated. This is what blkdel() was doing, but at a level too coarse. The new function edgedel() allows to remove a single edge (and takes care of multiple edges).
This change is backward compatible, calls to "variadic" functions (like printf) must now be annotated (with ...).
We conservatively assume all functions have variable argument lists.
Compiling languages with closures often requires passing an extra environment parameter to the called function. One solution is to use a convention, and reserve, say, the first argument for that purpose. However, that makes binding to C a little less smooth. Alternatively, QBE now provides a way to remain fully ABI compatible with C by having a "hidden" environment argument (marked with the keyword 'env'). Calling a function expecting an environment from C will make the contents of the environment undefined, but the normal arguments will be passed without alteration. Conversely, calling a C function like it is a closure by passing it an environemnt will work smoothly.
While I was at it I also refreshed some bits in the instruction selection.
While a minimal dead store elimination is not implemented, the generated code looks quite a bit better with them enabled. It also is quite cheap.
This condition should match any jump with two successors. This is needed on riscv64, where there is no flags register, so Jjnz is used all the way to emit().
It is mostly complete, but still has a few ABI bugs when passing floats in structs, or when structs are passed partly in register, and partly on stack.
This enables the example to be compiled and run as-is, without any additional modification.
The risc-v abi needs to know if a type is defined as a union or not. We cannot use nunion to obtain this information because the risc-v abi made the unfortunate decision of treating union { int i; } differently from int i; So, instead, I introduce a single bit flag 'isunion'.
They are meant to exercise the hardware floating-point calling convention of the risc-v target.
Many things got fixed, but the most notable change is the proper support of floating point types in aggregates. Minor fixes: - selpar() did not deal correctly with Cfpint - typclass() was reading out of bounds in the gp/fp arrays - support for env calls
The riscv test abi8.ssa caught a bug in the arm backend. It turns out we were using the wrong class when loading pointers to aggregates from the stack. The fix is simple and mirrors what is done in the riscv abi.
That is not available on osx so I tweaked the gas.c api a little to conditionally output the two directives.
I also moved some isel logic that would have been repeated a third time in util.c.
The x9 register is used for the env parameter.
The recent changes in arm and riscv typclass() set ngp to 1 when a struct is returned via a caller-provided buffer. This interacts bogusly with selret() that ends up declaring a gp register live when none is set in the returning sequence. The fix is simply to set cty to zero (all registers dead) in case a caller- provided buffer is used.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is to address issue #2, bringing the GitHub https://github.com/8l/qbe.git up-to-date with git://c9x.me/qbe.git (though that may be temporary; it may have to happen again later).
What I did, after forking https://github.com/8l/qbe.git :
My intention is to carry all of the history from git://c9x.me/qbe.git into https://github.com/8l/qbe.git . I'm a little concerned about the "can't automatically merge" message, as I thought this would bring in all of the commits (and I'm assuming that git://c9x.me/qbe.git has a superset of commits in https://github.com/8l/qbe.git ; that it is strictly a continuation of it).
If you're in favor of this update, but I got my git commands wrong, please let me know and I'll fix it.