Hi Niko,
On 22/03/13 08:12, Hotmail wrote:> How can I check if an operand is a static variable in the IR?
get the operand, for example:
Value *Op = Instr->getOperand(0);
You probably want to get rid of any type casts:
Op = Op->stripPointerCasts();
You can test if it is a global variable using:
if (isa<GlobalVariable>(Op)) { ... }
If it is, you can cast it to a global variable and test the linkage:
GlobalVariable *GV = cast<GlobalVariable>(Op);
if (GV->hasLocalLinkage()) { ... }
Ciao, Duncan.
> I've read that their linkage type should be marked as
"internal" in the .s file, but I can't find a way to test if an
Instruction has static variables as operands.
> Can you help me?
>
> Thank you in advance,
>
> Niko
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>