Wednesday, March 4, 2015

Or, maybe I could do it that way.

So, my language recognizes struct declarations. And allocations. And I've been working on assigning to instances of these structs.

I had false starts that I've mentioned here before, specifically about creating anonymous structs, which are probably useful for a language feature I want to do later, but not really relevant right now.

And so, I've been looking for examples of how it's supposed to be done. I found vague references to "getelementptr" in LLVM, which in LLVMPY is exposed as "gep", because hey, it's hard to type stuff.

Interesting side trip: my language is pretty close to C, so I wrote a little bit of C code demonstrating the behavior I want in my language, and I used "clang" to compile it to LLVM.

clang -S -emit-llvm teststruct.c 

Easy peasy. Dropped a bunch of LLVM asm into teststruct.s, which used that getelementptr thing that I was trying to use. So, maybe I'm going in the right direction.

More searching, more experimentation (they call it Computer Science because we use the scientific method) and I start exploring the LLVMPY issue tracker, and I discover a feature request to support structures. Ok, good, it's a priority... ooooh. No. That's been outstanding for going on two years now.

And I start poking around the LLVMPY users' mailing list, and I discover a post suggesting that LLVMPY users switch over to LLVMlite.


So, I guess that's the next thing on my TODO list - migrate over to LLVMlite. And maybe, you know, read the documentation.

No comments:

Post a Comment