LLVM, what are the possibilities?

I ran across something today when searching the web for my favorite subject “arbitrary precision” and ran across something interesting. It turns out that LLVM has built in some native arbitrary precision capabilities; a class for integers “APInt” and one for floats “APFloat”. Links to the classes are below:

APInt LLVM Class

APFloat LLVM Class

Before finding these I had no idea that llvm might contain high level constructs such as these. This leads to some interesting Xojo questions. Will we be able to call these directly in the future perhaps? Or will we be able to build Xojo plugins that integrate llvm code directly. Looks like llvm could provide some dramatic language extension possibilities.

Technically we could add those via plugin if people are interested…

I presume you know Bob’s plugins?

http://delaneyrm.com

llvm::APInt isn’t quite as arbitrary as you might think it is. It’s also just part of the LLVM support library, which has nothing to do with code generation or end user applications. One of its main uses is just to hold literal values during compilation.

Markus, yes I am aware of Bob’s plugins. He and I collaborated quite a bit. He develops mostly with C code that started out using the Number Theory Library but looks like he has now replaced all of that code with his own. I started out as a Xojo plugin module but decided that I wanted to build an optimized Xojo only capability. I now have a complete floating point and integer library that is competitive with Bob’s plugins but is Xojo only based. But I am always looking for ways to make my code faster and llvm looks like a blessing for math intensive code.

But it occurred to me that llvm might be the catalyst to create more depth in Xojo. Included in depth is more math capabilities that is cross-platform. This is in contrast to breadth, that has been driving Xojo development over the last few years(i.e. adding IOS, and other platform support)

I’m hoping that the initial llvm capability is just the beginning and we will see new and exciting features added to Xojo as a result.

Joe, will a Xojo developer have any low level access to llvm calls in the future. Is anything like that planned? I saw a web page that described settings in Xcode to expose the llvm support library calls so I guess it would be possible as Christian suggested to create a plugin to expose the llvm code that was desired.

[quote=211424:@William James]Markus, yes I am aware of Bob’s plugins. He and I collaborated quite a bit. He develops mostly with C code that started out using the Number Theory Library but looks like he has now replaced all of that code with his own. I started out as a Xojo plugin module but decided that I wanted to build an optimized Xojo only capability. I now have a complete floating point and integer library that is competitive with Bob’s plugins but is Xojo only based. But I am always looking for ways to make my code faster and llvm looks like a blessing for math intensive code.

But it occurred to me that llvm might be the catalyst to create more depth in Xojo. Included in depth is more math capabilities that is cross-platform. This is in contrast to breadth, that has been driving Xojo development over the last few years(i.e. adding IOS, and other platform support)

I’m hoping that the initial llvm capability is just the beginning and we will see new and exciting features added to Xojo as a result.[/quote]

You should be pleasantly surprised by 2015R3.

As Joe said, the LLVM support library is not meant for other end-user applications. Those things are designed for compilation, and aren’t even really designed for speed or even complete precision in all cases. There are faster arbitrary precision techniques out there that are better for general app use that one might use if someone wants to do another arbitrary precision plugin.

That isn’t to say I don’t want arbitrary precision in the language, I do. I just don’t want anyone having some expectation that we’ll be exposing those internal LLVM support classes in end user applications directly. They really aren’t designed for that use.

To others reading, of course with LLVM you still get the advantage of a multi-layered, optimizing compiler which can help your existing math intensive code- whatever it does.