cproc/qbe.c -rw-r--r-- 31.6 KiB
qbe: Omit unnecessary add to help QBE's memopt pass
qbe: Make non-constant initializer expression a proper error
Fix links to issue tracker
Remove comment for completed TODO
Specify function name in error message
qbe: Handle K&R function definition argument promotion

Parameters for K&R function definitions that are affected by default
argument promotion are passed as their promoted type, so need to be
converted back before storing into memory allocated for the parameter.
qbe: Separate out value conversion from funcexpr
Move some functions around
qbe: Fix switch statements with 64-bit controlling expression
Temporarily avoid %a when printing floating constants

This is C99, but is not supported by fscanf in OpenBSD, so floating
constants can't be read back in by QBE.
qbe: Fix error check for invalid object

The result of funcexpr might be NULL if we are in a dead branch, but
this doesn't mean that we had an invalid object.
Implement asm labels
eval: Keep track of kind of constant expression we are evaluating

When we are evaluating an arithmetic constant expression, we don't want
to indroduce static data definitions for string or compound literals.

Fixes #59.
qbe: Fix QBE types for structs containing bit-fields
Sign-extend result of bit-field assignments

Fixes #51.

Thanks to Andrew Chambers for the bug report and test case.
qbe: Error out when va_arg is called with non-scalar type
Use a common member for expression base
Use a common member for expression op
Free function call argument lists
Free functions when we're done with them
qbe: Make sure generated code doesn't depend on argument evaluation order

It would be correct in any order, but this is a bit simpler and guarantees
the same output.