aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2019-02-22Implement __builtin_nanf for empty string literalsMichael Forney
2019-02-22Separate out built-in handling from postfixexprMichael Forney
2019-02-22Implement __builtin_inffMichael Forney
2019-02-22Keep track of built-in kind in declarationMichael Forney
Also, populate filescope with builtins outside of main.
2019-02-22Only need to emit tentative definitions when compilingMichael Forney
2019-02-22Simplify handling of arguments to cc-qbe a bitMichael Forney
2019-02-22Implement __builtin_allocaMichael Forney
2019-02-22Fix adding integer to pointerMichael Forney
2019-02-21driver: Create output files in current directoryMichael Forney
2019-02-21Emit complete union type definitions instead of just using the first memberMichael Forney
2019-02-21Always expect at least one struct decl.Andrew Chambers
2019-02-21driver: Fix -o -Michael Forney
We need to distinguish between no output specified, and output specified to be standard out.
2019-02-21Fix decay on qualified array typesMichael Forney
2019-02-20Use name parameter instead of tok.litMichael Forney
This was only called with tok.lit, so it didn't matter in practice.
2019-02-20Remove some unused variablesMichael Forney
2019-02-20driver: Various improvementsMichael Forney
Use an input struct to keep track of information about an input. When creating an output name from an input with no extension, make sure to add a `.`. When linking, write intermediate objects to temporary files and remove them afterwards. Allow specifying language of input using `-x` flag. Allow reading from standard input by passing `-`.
2019-02-20Fix emittype for unionsMichael Forney
Thanks to Andrew Chambers for the bug report.
2019-02-20eval: Handle nested offset address constantsMichael Forney
2019-02-20Fix definitions for nested structsMichael Forney
The QBE documentation suggested that the subtypes in an aggregate must be simple types, but they can actually be any type (this is necessary for getting the alignment and padding right between fields adjacent to the nested struct).
2019-02-19Implement __builtin_va_copyMichael Forney
2019-02-19Slight reorganization in expr.cMichael Forney
2019-02-19Add mkunaryexpr helperMichael Forney
2019-02-19Add missing lvalue conversionsMichael Forney
typeintpromote and typeargpromote assume they are dealing with an unqualified type, and return an incorrect result if they are given a qualified one. So, add an assert here. This was causing const integer types to get promoted to themselves due to missing lvalue conversions. Thanks to Andrew Chambers for the bug report and test case.
2019-02-19Check that left hand side of assignment expression is an lvalueMichael Forney
2019-02-18Pointer operands to + and - must be complete object typesMichael Forney
Also clean up a little and give some better error messages.
2019-02-18void is an incomplete typeMichael Forney
2019-02-18Simplify test added in 9f964b7281Michael Forney
2019-02-18Fix compatible check for basic typesMichael Forney
This check was only supposed to return true for enum types and their corresponding integer type. However, it had the side effect of making 'int' compatible with 'unsigned'. To fix this, introduce a new basic type kind for enums with the same rank as 'int', that is only compatible with itself and the 'int' type with the matching sign. Thanks to Andrew Chambers for the bug report.
2019-02-17Make enum types compatible with their corresponding integer type (int)Michael Forney
2019-02-17Fix sizeof with unparenthesized postfix or compound literal expressionMichael Forney
Determining whether it is a typename or unparenthesized expression requires consuming the '(', so we need to call postfixexpr/parseinit ourselves.
2019-02-17Allow computing address of non-lvalue structs/unionsMichael Forney
We currently compile '.' member access as taking the address of the struct, adding the offset, and then dereferencing as the member type. However, the '.' operator is allowed on non-lvalues, even though the '&' operator is not. So, we need to handle arbitrary struct/union expressions in objectaddr by just compiling them normally, then converting them to regular pointers (since struct/union values are just pointers with additional type information).
2019-02-17Fix returning struct/union typesMichael Forney
2019-02-17Disallow functions returning array or functionMichael Forney
2019-02-17Only parse function definitions for function declarationsMichael Forney
2019-02-17Only need to read parameter declarations when identifier list is non-emptyMichael Forney
2019-02-17Ensure right number of arguments to non-prototype function definitionsMichael Forney
2019-02-17Improve old-style function declaration supportMichael Forney
Implement typecompatible for types created with non-prototype function declarations. Require a function definition with parameter declaration list after a declaration with a non-empty identifier list. Detect function definitions with parameter declaration lists containing types incompatible with the promoted types, and report an error for now.
2019-02-16Extend char/short types before comparingMichael Forney
Thanks to Andrew Chambers for reporting the issue.
2019-02-16Allow labels with same name as typedefMichael Forney
2019-02-16Fix casts from integer types less than 32 bits wideMichael Forney
2019-02-15Make sure that aggregates and pointers to aggregates are passed/return correctlyMichael Forney
2019-02-15Some small cleanupsMichael Forney
2019-02-15Handle main with no returnMichael Forney
2019-02-15Fix backwards constant evaluation of float-int castsMichael Forney
2019-02-15Don't embed anonymous struct members into parentMichael Forney
While this works nicely for structs, when unions are involved it makes it impossible to find the next member to initialize without keeping track of extra data per member.
2019-02-15Use bool typedef in .c filesMichael Forney
2019-02-15Rename emit.h -> backend.hMichael Forney
2019-02-15Use consume in a couple placesMichael Forney
2019-02-15Rearrange some fields in function typesMichael Forney
2019-02-15Remove a dead conditional in ftouMichael Forney