I want to get a specific type of instruction in a Basic Block.
For example, I want to get all “sub” instructions in a Basic Block.
I know I can do this by iterating the basic block from begin to end and using if statement to compare the opcode. But I don’t think this is a clean method to do this.
I checked the function in BasicBlock class, but I didn’t see any function can do this.
Maybe there are another ways. Please help me. Thanks!!
If iterating the begin and end on Basic Block is the only way, is there any recommended data structure can store all the instructions that I want? I know there is a iterator
class in llvm, but I’m not sure it is a container or not.