Rotem Varon wrote:
Hi,
If i want to continue the conversation with you, do i need to replay to llvmdev or to you diractly ?
If i replay to you, me email will be routed to you?
You should reply to the llvmdev mailing list. That way, others can answer your questions, others can read their responses if they are having problems similar to the ones that you are experiencing, and you don't become dependent upon a single person and his/her schedule (e.g., I'm fairly busy these days due to finals,so my time for answering llvmdev questions is limited).
anyway i have question about your answare:
%3 = add i32 %1, 2
So, now i know to get %1 and 2 from the instruction
but how do i get the %3 ?
In LLVM, the instruction *is* the result that the instruction generates.
So, when you have an Instruction *, that Instruction * is the result of that instruction. For example, if I have a pointer to the instruction:
Instruction * I = <however you got the instruction>
Value * Op1 = I->getOperand(0);
Value * Op2 = I->getOperand(1);
..., if the instruction is the add instruction above, Op1 points to the %1, Op2 points to the 2, and I points to the %3.
and one more Q:
when i call i->getOperand(0) i want to get 1 but i am getting %1 = ...
is it possible?
Yes. Values starting with a percent are LLVM virtual registers; they are either the results of instructions or are constants of some sort.
Is LLVM supply a convenient API for instruction parsing ?
Yes. LLVM provides libraries for parsing bitcode, manipulating the in-memory intermediate representation, running analysis and transform passes, etc.
-- John T.