Skip to content

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
wants to merge 286 commits into
base: master
Choose a base branch
from

Conversation

jpivarski
Copy link

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 :

git clone https://github.com/jpivarski/qbe.git
git remote add latest git://c9x.me/qbe.git
git fetch latest
git checkout latest/master
git checkout -b jpivarski/update-GitHub
git push --set-upstream origin jpivarski/update-GitHub

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.

Quentin Carbonneaux and others added 30 commits January 4, 2017 19:22
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.
michaelforney and others added 30 commits February 17, 2022 22:35
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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.