Timeline for LLVM, Why we need `load` and `store`?
Current License: CC BY-SA 4.0
8 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jul 6, 2023 at 0:29 | comment | added | Peter Cordes | For future readers: this is asking about loads and stores in the LLVM-IR (I hope), not in the resulting asm. LLVM-IR is an SSA form where assignments are to virtual "registers", aka local temporary values. It's an IR, and the number of "registers" you can use is unbounded, to support functions that make an unbounded number of mutations to an unbounded number of local variables. It's up to the compiler to figure out which things need to get spilled to memory when. llvm.org/docs/LangRef.html#abstract | |
Jul 5, 2023 at 21:18 | answer | added | yasgur99 | timeline score: 0 | |
Jul 4, 2023 at 3:36 | history | edited | Bill Lynch | CC BY-SA 4.0 |
added 10 characters in body
|
Jul 4, 2023 at 1:21 | review | Close votes | |||
Jul 8, 2023 at 0:08 | |||||
Jul 4, 2023 at 0:38 | comment | added | Erik Eidt | Simple local variables do not need loads & stores. Most data structures (e.g. arrays, trees) are memory based. Manipulation of them requires loads & stores; complex local variables may require loads & stores. | |
Jul 4, 2023 at 0:26 | comment | added | Peter Cordes |
Presumably you need loads to access memory, like if you want to implement void foo(int *p) { *p = 123; } . In your example, you don't need anything at all, the function might as well be empty unless you make a debug build. See Why does clang produce inefficient asm with -O0 (for this simple floating point sum)? , and for making functions that compile to something interesting to look at, see How to remove "noise" from GCC/clang assembly output? (take args and return a value, e.g. return (x + z)*2 - 3*a; )
|
|
S Jul 4, 2023 at 0:12 | review | First questions | |||
Jul 18, 2023 at 0:15 | |||||
S Jul 4, 2023 at 0:12 | history | asked | David | CC BY-SA 4.0 | created from wizard |