简体   繁体   中英

Get non-constant operands in LLVM

Say I have an instruction like %res = add i32 4, %var and I want to extract only the operand %var because it's a variable. My question is how I can determine whether an operand is a constant number or rvalue so that I can exclude them in my pass.

Thanks in advance.

使用Instruction::value_op_begin()Instruction::value_op_end()Instruction::operand_values()循环指令的操作数,并使用isa<Constant>()测试给定的操作数是否为常数1。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM