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++)); } ...