Posts

Showing posts with the label llvm

How to iterate through Operators in LLVM IR instruction

How to iterate through Operators in LLVM IR instruction I have the following llvm instruction: %or = or i32 shl (i32 1, i32 urem (i32 ptrtoint ([4 x %struct.my_struct1]* getelementptr inbounds (%struct.my_struct2, %struct.my_struct3* null, i32 0, i32 18, i32 48, i32 3) to i32), i32 32)), %add, !dbg !278709 And I need to iterate over all of the operators. 1) Is there a pass (or a flag for clang) which can spilt this instruction? 2) how do I iterate over these operators in a simple way? Thanks Doesn't for(auto & i : x->getParent()->getInstList()) { ... } do what you want? Or if you want to use names and separate lines per instruction, ...{ i.setName("foo" + utostr(n++)); } . – arnt Jul 2 at 7:03 for(auto & i : x->getParent()->getInstList()) { ... } ...{ i.setName("foo" + utostr(n++)); } ...

How link LLVM libraries

How link LLVM libraries I have small Code::Blocks project using LLVM. Code is already compiled but are problems with link: in /usr/localc/lib are 134 libraries with size all = 5 GB. If I try add to CodeBlocks library by library, are errors: not found symbols. If I try add all libraries to CodeBlocks , is too much and CodeBlocks doesn't start. LLVM has llvm-config, but how use it with CodeBlocks? 1 Answer 1 In CodeBlocks in "Other compiler options:" llvm-config --cxxflags llvm-config --cxxflags In CodeBlocks in "Other linker options:" llvm-config --ldflags --system-libs --libs core orcjit native or maybe other components than "core,orcjit,native" llvm-config --ldflags --system-libs --libs core orcjit native (this is invisible in comments, but llvm-config flags should be between apostrophes) By clicking "Post Your Answe...