11/9/2023 0 Comments Stack vs heap in memory%1 = tail call %struct.Alloc* Call _Z8allocPtrv (Defined above). You can see this by passing this string through a This doesn't need to be defined since it's already defined %2 = bitcast i8* %1 to %struct.Alloc* Cast the returned value to Alloc*. %3 = bitcast i8* %1 to i32* Cast the returned value to i32* (int*). %1 = tail call noalias i8* 4) #2 Call _Znwj(4). %call = call %struct.Alloc* %struct.Alloc* %call, %struct.Alloc** %ptr, align 8Īttributes #0 = Define the Alloc type. Then run clang -S -emit-llvm alloc.cpp to produce alloc.ll ModuleID = 'alloc.cpp' (P.S my interpretation of the alloca instruction docs is that it anything created from that gets freed on return so I can't use that right, it's essentially only for local variables?) The things obvious to me are the function definition/declarations and some function calls and a memset call so I get pieces of it but it doesn't all come together for me yet. So I've written a simply C++ example, dumped the IR with clang in an effort to try to understand what it produces but to be honest I don't follow it all. The Kaleidoscope tutorial doesn't include or even mention this and I don't know what I'm looking for in the LLVM source/tests to find possible examples. I'm making progress on a toy compiler (first time), and trying to understand how to allocate/construct an LLVM struct type.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |