I'm new to LLVM, does LLVM IR has scope for duplicated variable name ?
For example:
@x = global i32 0
define void @hello() {
%x = alloca i32, align 4
}
Does @x
variable name duplicates with %x
?
I'm new to LLVM, does LLVM IR has scope for duplicated variable name ?
For example:
@x = global i32 0
define void @hello() {
%x = alloca i32, align 4
}
Does @x
variable name duplicates with %x
?
Had you try to write a code that do something with these variables, you'd find that the answer is NO.
To access @x
you'll have to use Module::GetGlobalVariable
method, which obviously wouldn't pick up %x
. Similarly, to access %x
, you'd have to iterate a Function
s BasicBlocks
, looking for an Instruction
named "x". Yes, the %x
thing is not a variable, but an instruction.
Finally, at the textual IR level these values also can't be mixed in any way, because global values in LLVM are prefixed with @
while local ones - with %
.