CAFxX
CAFxX

Reputation: 30331

Live values in LLVM

Suppose I have in my CFG (among others) two basic blocks A and B, with an edge from A to B. I need to do the following:

Does LLVM provide an easy way to do the first and third points (because I can't seem to be able to find it)? If not, do you have any suggestions about how to do it?

note: crossposted on the LLVM mailing list

Upvotes: 4

Views: 969

Answers (1)

Grzegorz Wierzowiecki
Grzegorz Wierzowiecki

Reputation: 10843

I do not have clear answer to your question, but director to follow, that came to my mind. I hope it will help you in some way.

First, I would check out "Iterating over the Instructions in a BasicBlock" and "Iterating over def-use & use-def chains" from LLVM Programmers Manual. It gives an idea how to iterate over instructions in basic block and users of this value.

As you need to know living values across the edge, I would check out "Iterating over the BasicBlocks in a Function", and try to determine where users (over ech you iterate) are placed, for example with const BasicBlock* llvm::Instruction::getParent()const.

If information, where users are placed is not enough, you might like to take advantage of [dominators and postdominators analysis], check out :

This might help you determine dominance relation between blocks or instructions, what might help you with creation of your sets.

Upvotes: 3

Related Questions