summary refs log tree commit diff
path: root/all.h
AgeCommit message (Collapse)Author
2017-06-06isreg() does not need to be inlinedQuentin 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-05-16new hinting in the register allocatorQuentin Carbonneaux
The previous heuristics were ad hoc and it was hard to understand why they worked at all. This patch can be summarized in three points: 1. When a register is freed (an instruction assigns it), we try to find if a temporary would like to be in it, and if we find one, we move it in the newly freed register. I call this an "eager move". 2. Temporaries now remember in what register they were last allocated; this information is stored in the field Tmp.visit, and prevails on the field Tmp.hint when it is set. (This makes having the same hint for interfering temporaries not so disastrous.) 3. Blocks are now allocated in "onion" order, from the innermost loop to the outermost. This is the change I am the least sure about; it should be evaluated thorougly.
2017-04-10bump the size of the instruction bufferQuentin Carbonneaux
Ori needs this. It should not cost much more memory at runtime, only a minimal amount of address space.
2017-04-10simplify slot logic in alias analysisQuentin Carbonneaux
The previous code was buggy. It would put a stack pointer on the heap when handling "add $foo, 42". The new code is more straightforward and hopefully more correct. Only temporaries with a "stack" alias class will have a slot pointer.
2017-04-08misc fixes for osxQuentin Carbonneaux
With the default toolchain, it looks like we have to make sure all symbols are loaded using rip-relative addressing.
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-02-27scrub assembly outputQuentin Carbonneaux
Notably, this adds a new pass to get rid of jumps on jumps.
2017-02-25do sign/zero extensions removal in copy.cQuentin Carbonneaux
2017-02-24start a new simplification passQuentin Carbonneaux
2017-02-24fix pretty bad bug in alias analysisQuentin Carbonneaux
When a temporary marked local is escaping, the whole slot must be marked as such. To solve this, Alias now holds a pointer to the alias information of the slot. For simplicity of the code, this pointer is always valid and fetching ->type out of it is meaningful.
2017-02-24deduplicate loadsz & storeszQuentin 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-02-08make rsp and rbp globally liveQuentin Carbonneaux
2017-02-06fix edge deletion bug in sccpQuentin Carbonneaux
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).
2017-02-06use uint for block idsQuentin Carbonneaux
2017-01-12use a less obtuse api for vnew()Quentin Carbonneaux
2016-12-21schedule loop nesting computations earlierQuentin Carbonneaux
2016-12-12implement a simple load elimination passQuentin Carbonneaux
2016-12-12implement a simple alias analysisQuentin Carbonneaux
2016-12-12create cfg.c for cfg-related functionsQuentin Carbonneaux
2016-08-17silent a few warningsQuentin Carbonneaux
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-14use an enum for aggregate segmentsQuentin Carbonneaux
2016-08-14get rid of old Alt enumQuentin 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-22use short for classes (so it is signed for sure)Quentin Carbonneaux
2016-04-22refine fp conversion instructionsQuentin Carbonneaux
2016-04-21cosmetics in all.hQuentin Carbonneaux
2016-04-20match jumps/ops with il textQuentin Carbonneaux
2016-04-18factor some subtyping logic in clsmerge()Quentin Carbonneaux
2016-04-16use unsigned long long for bitsQuentin Carbonneaux
2016-04-13hack an ssa validator (likely buggy)Quentin Carbonneaux
2016-04-12fix wrong isext() macroQuentin Carbonneaux
2016-04-09enable constant foldingQuentin Carbonneaux
2016-04-09add a proper block deletion routineQuentin Carbonneaux
2016-04-07add a canfold field to opdescQuentin Carbonneaux
2016-04-04fat il!Quentin Carbonneaux
2016-04-04reorder instructionsQuentin Carbonneaux
2016-04-01tradeoff the type of bsiter()Quentin Carbonneaux
int is used all over the place for temporaries, maybe this should be changed, I don't know. Another thing to consider is that temporaries are currently on 12 bits (and will be on 29 or 30 bits in the future), so int will always be safe to store them. We just loose the free invariant of non-negativity.
2016-03-31move abi code in a new fileQuentin Carbonneaux
2016-03-31cleanup error handlingQuentin Carbonneaux
2016-03-29new layout, put LICENSE in rootQuentin Carbonneaux