3.1 API Breakage

Trying to get the Pure compiler to work with LLVM 3.1, I've run into a problem. The release notes say: "Target specific options have been moved from global variables to members on the new TargetOptions class, which is local to each TargetMachine." Unfortunately, they don't say anything about how to fix existing source to work around this.

In my application I create a JIT using ExecutionEngine::create() after initializing the native target using InitializeNativeTarget(). I also need to set the GuaranteedTailCallOpt flag beforehand.

However, with LLVM 3.1 the global GuaranteedTailCallOpt flag is gone and neither ExecutionEngine::create() nor InitializeNativeTarget() accept a TargetOptions argument. Nor could I find a way to retrieve and change the target options later.

Is that an oversight, or is there some easy way to set the native target options somewhere that I missed?

Any help is much appreciated.

TIA,
Albert

Hello Albert,

Any help is much appreciated.

I believe examples/ExceptionDemo contains sample code which sets
TargetOptions flags.
In particular, llvm::EngineBuilder class has setTargetOptions() method
which does all necessary magic here.

Hi Anton,

Now I've run into another issue: The ConstantArray::get() method for constructing a string constant from a char* seems to be gone. Is there a replacement for that somewhere?

BTW, this isn't mentioned in the release notes yet.

Now I've run into another issue: The ConstantArray::get() method for
constructing a string constant from a char* seems to be gone. Is there
a replacement for that somewhere?

ConstantDataArray::getString. IRBuilder::CreateGlobalString might also
be useful in some cases.

BTW, this isn't mentioned in the release notes yet.

Hmm... might be worth a mention.

-Eli

ConstantDataArray::getString was just what I needed. Thanks! Still some more testing to do, but it seems that I have Pure up and running on LLVM 3.1 now.