top | item 11279851

(no title)

piroux | 10 years ago

I had the same feeling about LLVM until a few weeks ago, when I started tinkering with it during a school project. It let me the time to implement a simple array which can be sliced and copied, through the functions I created :

https://gist.github.com/piroux/a856aa31525ca23238be

It can directly run with lli:

$ lli basics_array.ll

Note: I called it DynArray because I wanted it to grow itself when its nominal capacity would have been reached, but I never took the time to implement this feature ...

For instance, the prototype of the function adding an element could be :

define void @DynArrayI__add(%DynArrayI* %dynarray, i64 %elt)

You might need to add a capacity field to the type of DynArrayI and update others functions, to take it into account.

But according to me it is doable, even for a beginner, because the code is entirely written in LLVM.

So feel free to try !

discuss

order

No comments yet.