summary refs log tree commit diff
path: root/parse.c
AgeCommit message (Collapse)Author
2021-03-02add data $name = section "section" ...Drew DeVault
This allows you to explicitly specify the section to emit the data directive for, allowing for sections other than .data: for example, .bss or .init_array.
2020-08-06Move NPred in parse.c and decrease itMichael Forney
This now only limits the number of arguments when parsing the input SSA, which is usually a small fixed size (depending on the frontend).
2020-08-06Use a dynamic array for phi argumentsMichael Forney
2019-05-15Allow specifying literal global namesMichael Forney
2019-03-14Rearrange the fields in Ins so the bit-fields get packed togetherMichael Forney
2019-03-08use a hash table to parse temporariesQuentin Carbonneaux
2018-04-26more compiler warnings...Quentin Carbonneaux
2018-04-26Fix compiler warnings.Emil Skoeldberg
Compiler warned about comparison between signed and unsigned values.
2017-05-17free the typ vector at the end of parse()Quentin Carbonneaux
2017-05-17intern symbol namesQuentin Carbonneaux
Symbols in the source file are still limited in length because the rest of the code assumes that strings always fit in NString bytes. Regardless, there is already a benefit because comparing/copying symbol names does not require using strcmp()/strcpy() anymore.
2017-04-16minor changes for env parameterQuentin Carbonneaux
Since the environment can only be of type `l`, do not require to write it down. I also tightened the type information of the `pare` and `arge` instructions.
2017-04-08new arm64 backend, yeepeeQuentin Carbonneaux
2017-04-08rework storage of typesQuentin Carbonneaux
The arm64 ABI needs to know precisely what floating point types are being used, so we need to store that information. I also made typ[] a dynamic array.
2017-04-08prepare for multi-targetQuentin Carbonneaux
This big diff does multiple changes to allow the addition of new targets to qbe. The changes are listed below in decreasing order of impact. 1. Add a new Target structure. To add support for a given target, one has to implement all the members of the Target structure. All the source files where changed to use this interface where needed. 2. Single out amd64-specific code. In this commit, the amd64 target T_amd64_sysv is the only target available, it is implemented in the amd64/ directory. All the non-static items in this directory are prefixed with either amd64_ or amd64_sysv (for items that are specific to the System V ABI). 3. Centralize Ops information. There is now a file 'ops.h' that must be used to store all the available operations together with their metadata. The various targets will only select what they need; but it is beneficial that there is only *one* place to change to add a new instruction. One good side effect of this change is that any operation 'xyz' in the IL now as a corresponding 'Oxyz' in the code. 4. Misc fixes. One notable change is that instruction selection now generates generic comparison operations and the lowering to the target's comparisons is done in the emitter. GAS directives for data are the same for many targets, so data emission was extracted in a file 'gas.c'. 5. Modularize the Makefile. The Makefile now has a list of C files that are target-independent (SRC), and one list of C files per target. Each target can also use its own 'all.h' header (for example to define registers).
2017-04-08fix bug in union size computationQuentin Carbonneaux
The size of a union is the size of the largest element aligned with the largest alignment. For example, the size of the following union is 16, not 13 (as returned before this patch). union { char c[13]; int i; };
2017-02-27fix int parsingQuentin Carbonneaux
The spec says that numbers can be arbitrarily big, and only the last 64 bits will be taken into consideration. Calling sscanf does not implement this, so I wrote an ad-hoc function.
2017-02-17stricter class constraints for store & vastartQuentin Carbonneaux
2017-02-15add support for closure callsQuentin Carbonneaux
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.
2017-02-14minor cleanup in all.hQuentin Carbonneaux
2017-02-10support variable argument listsQuentin Carbonneaux
This change is backward compatible, calls to "variadic" functions (like printf) must now be annotated (with ...).
2017-01-12use a less obtuse api for vnew()Quentin Carbonneaux
2017-01-04more performance improvements in the parserQuentin Carbonneaux
2016-12-31use a perfect hash for lexingQuentin Carbonneaux
2016-12-28fix escapes handling (patch from ac)Quentin Carbonneaux
2016-09-27accept "ret" for functions with a return typeQuentin Carbonneaux
This happens to be needed for C. The standard mandates that a return value is used if the caller uses it. Surprisingly, if the return "value" is not used, the callee can use "return;". A better solution is to add an "undef" value and return it, "undef" would also have other use cases for compiling C.
2016-08-16add support for unions in sysv abiQuentin Carbonneaux
2016-08-16parse union typesQuentin Carbonneaux
2016-08-15specify the allocation function in vnewQuentin Carbonneaux
2016-08-14couple of case fixes in tokensQuentin Carbonneaux
2016-08-14use an enum for aggregate segmentsQuentin Carbonneaux
2016-04-25fix type size computations in parserQuentin Carbonneaux
The type sizes are important to get right because the ABI relies on them when it emits memory blits to pass/return structs.
2016-04-22refine fp conversion instructionsQuentin Carbonneaux
2016-04-22make sure type sizes never overflowQuentin Carbonneaux
2016-04-20disallow phi nodes in the start blockQuentin Carbonneaux
AFL found this bug.
2016-04-20support calls with no returnQuentin Carbonneaux
I thought it would be harder (and maybe it is). My fear was that a call must be always followed by a parallel move from machine registers (this is an assumption in both spill and rega). This however remains true, because the ABI code generates a dummy "copy RAX" by accident!
2016-04-20normalize case in token namesQuentin Carbonneaux
2016-04-20match jumps/ops with il textQuentin Carbonneaux
2016-04-18factor some subtyping logic in clsmerge()Quentin Carbonneaux
2016-04-16support trailing , in types/args/paramsOri Bernstein
2016-04-16fix relic error messageQuentin Carbonneaux
2016-04-13check types on assignmentsQuentin Carbonneaux
2016-04-12bug in checking of multiple definitionsQuentin Carbonneaux
2016-04-12add missing idiv in opdesc[]Quentin Carbonneaux
2016-04-12avoid a few hangs in parsing codeQuentin Carbonneaux
2016-04-12check invalid instruction typesQuentin Carbonneaux
2016-04-12add simple il validationQuentin Carbonneaux
2016-04-07add a canfold field to opdescQuentin Carbonneaux
2016-04-04fat il!Quentin Carbonneaux
2016-03-31move abi code in a new fileQuentin Carbonneaux
2016-03-31cleanup error handlingQuentin Carbonneaux