summary refs log tree commit diff
path: root/load.c
AgeCommit message (Collapse)Author
2022-12-15bugfix in load eliminationQuentin Carbonneaux
When checking if two slices represent the same range of memory we must check that offsets match. The bug was revealed by a harec test.
2022-12-14new blit instructionQuentin Carbonneaux
2022-11-22use a new struct for symbolsQuentin Carbonneaux
Symbols are a useful abstraction that occurs in both Con and Alias. In this patch they get their own struct. This new struct packages a symbol name and a type; the type tells us where the symbol name must be interpreted (currently, in gobal memory or in thread-local storage). The refactor fixed a bug in addcon(), proving the value of packaging symbol names with their type.
2022-11-20stored bytes in Alias informationQuentin Carbonneaux
Stack slots may have padding bytes, and if we want to have precise liveness information it's important that we are able to tell them apart. This patch extends fillalias() to remember for every slot what bytes were ever assigned. In case the slot address does not escape we know that only these bytes matter. To save space, we only store this information if the slot size is less than or equal to NBit. The Alias struct was reworked a bit to save some space. I am still not very satisfied with its layout though.
2022-11-20make Alias.base an intQuentin Carbonneaux
We had the invariant that it'd always be a temporary.
2022-10-08"rel" fields become "reloc"Quentin Carbonneaux
2022-10-08do not drop relocation kind in alias analysisQuentin Carbonneaux
2022-10-08add support for thread-local storageQuentin Carbonneaux
The apple targets are not done yet.
2022-10-03fix case of Pool constantsQuentin Carbonneaux
2021-11-22reuse previous address constants in fold()Michael Forney
parseref() has code to reuse address constants, but this is not done in other passes such as fold or isel. Introduce a new function newcon() which takes a Con and returns a Ref for that constant, and use this whenever creating address constants. This is necessary to fix folding of address constants when one operand is already folded. For example, in %a =l add $x, 1 %b =l add %a, 2 %c =w loadw %b %a and %b were folded to $x+1 and $x+3 respectively, but then the second add is visited again since it uses %a. This gets folded to $x+3 as well, but as a new distinct constant. This results in %b getting labeled as bottom instead of either constant, disabling the replacement of %b by a constant in subsequent instructions (such as the loadw).
2021-10-22make variadic args explicitQuentin Carbonneaux
Some abis, like the riscv one, treat arguments differently depending on whether they are variadic or not. To prepare for the upcomming riscv target, we change the variadic call syntax and give meaning to the location of the '...' marker. # new syntax %ret =w call $f(w %regular, ..., w %variadic) By nature of their abis, the change is backwards compatible for existing targets.
2021-07-29load: handle all cases in cast()Michael Forney
Previously, all casts but d->w, d->s, l->s, s->d, w->d were supported. At least the first three can occur by storing to then loading from a slot, currently triggering an assertion failure. Though the other two might not be possible, they are easy enough to support as well. Fixes hare#360.
2020-08-06Use a dynamic array for phi argumentsMichael Forney
2019-03-14Rearrange the fields in Ins so the bit-fields get packed togetherMichael Forney
2019-03-12improve range-checking macrosQuentin Carbonneaux
They are now linear and can be safely used with arguments that have side-effects. This patch also introduces an iscall() macro and uses it to fix a missing check for Ovacall in liveness analysis.
2019-03-07fix in load elimination (vacall is a call)Michael Forney
2018-04-26more compiler warnings...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-02-24wrong assumption killsl()Quentin Carbonneaux
2017-02-24improve the range of action of load eliminationQuentin Carbonneaux
When eliminating `load %foo`, don't limit the search to the live range of %foo, but to the live range of its aliasing information. For example, if %foo is a constant offset into a stack-allocated slot, %foo =l add %slot, 42 the search will proceed on all the code in which %slot is live, not only below the definition of %foo, like before.
2017-02-24deduplicate loadsz & storeszQuentin Carbonneaux
2017-02-06use uint for block idsQuentin Carbonneaux
2017-01-12use a less obtuse api for vnew()Quentin Carbonneaux
2016-12-28loosen assertion in load eliminationQuentin Carbonneaux
The assertion was invalid, I was assuming il->blk was b when writing it. The new assertion should be right: If the loop level were to decrease we would get out of a cycle in cfg, this should not be possible unless we go through a block with more than 1 predecessor.
2016-12-21fix wrong assertion in load eliminationQuentin Carbonneaux
The assertion fails incorrectly on a block right after the end of a loop.
2016-12-12implement a simple load elimination passQuentin Carbonneaux