[LLVMdev] instruction/register identifier?

Bill? Wendling wendling at isanbard.org
Thu Nov 21 00:03:02 PST 2002


Also sprach Juan Nicolas Ruiz:
} Is there a way get the register on the LHS of a llvm instruction? (in
} case there is one)
} 
} for example, given a "free %reg773", I want to find the matching
} "%something = malloc %", where %something is not necessarily %reg773.
} One way I found was to inmediately follow the use-def chain up from
} the free to the malloc. But instead, I want to put %reg773 in a set
} (possibly with many other %things), and when I find
} "%something = malloc" look for %something in the set. One way to do it
} (as far as I see) is to store the "defs" in the set. But I was
} thinking about storing only the "%reg" (the name, a unique
} identifier), but I don't see how to get it from an Instruction.
} 
You can get the name of an instruction with the "getName()" method.
However, it's been pointed out that names are rather meaningless in LLVM
and aren't guaranteed to be unique. Why not store a Value* instead? (Or
Instruction* if you prefer)

I'm not sure if this solves your problem, though...

-- 
|| Bill Wendling           "A computer without a Microsoft operating
|| wendling at isanbard.org    system is like a dog without bricks tied
||                          to its head."   -- Anonymous



More information about the llvm-dev mailing list