[llvm-dev] How to set Target/Triple of ExecutionEngine

edA-qa mort-ora-y via llvm-dev llvm-dev at lists.llvm.org
Thu Apr 19 01:44:38 PDT 2018


I don't know if I'm setting the triple of my execution engine
correctly.  This is leading to an issue where a struct `{i8,i64}` is not
getting the same layout as the ABI expects.

I setup my engine/module like this:

     llvm::SmallVector<std::string,2> mattrs;
     llvm::EngineBuilder builder{ unique_ptr<llvm::Module>(module) };
     llvm::ExecutionEngine * ee = builder.
        setErrorStr( &errStr ).
        setEngineKind( llvm::EngineKind::JIT ).
        setTargetOptions( topts ).
        create(builder.selectTarget(
llvm::Triple(llvm::Triple::normalize(platform::target->triple)), "", "",
mattrs ));

    module->setDataLayout( ee->getDataLayout() );

Where `module` is my `llvm::Module` with the generated IR code.

I'm using the triple `x86_64-pc-linux-gnu`, the same as clang on the
machine, but getting different alignments. I'm assuming the above is
somehow not creating the correct layout. Perhaps there's an ordering issue?

-- 
edA-qa mort-ora-y  
	http://mortoray.com/

Creator of the Leaf language
	http://leaflang.org/

Streaming algorithms, AI, and design on Twitch
	https://www.twitch.tv/mortoray

Twitter
	edaqa
	



More information about the llvm-dev mailing list