I've been working on updating the grammar to handle aggregate types (structs, classes, that sort of thing). This weekend, I've adapted some of the C grammar and got things running again.
The LLVM code you see up there uses the "insertvalue" instruction, which is the way to write into a struct. The paired instruction is "extractvalue", which the compiler doesn't yet generate.
There are a few other issues with the generated code - the correct offset isn't being used. I think the "1" at the end of each line is an index to the element within the aggregate structure. I'm computing an offset for x and y members of my 2d vectors, but it's not piped through properly.
And then there's the loading and reloading of each of the aggregate instances. I know that LLVM has some aggressive optimization, but I'd rather not rely on it to clean this sort of thing up.
No comments:
Post a Comment