Control dependence pass

Hi,

I have written a pass to find the control dependences. Right now I am
using a map of of basic blocks to vectors of basic blocks to store the
dependences, so the dependence is represented in terms of basic
blocks. Before I submit the patch for review, I wanted to know the
format in which control dependences should be stored.

1) Should the dependence information be instead represented in terms
of instructions? This is how I plan to do in terms of instructions -
if basic block bb1 is control dependent on basic block bb2, then all
instructions in bb1 are dependent on the compare instruction in bb2.
2) Shall I provide an additional wrapper class to get the dependence
information in terms of instructions?
3) Is the STL map good enough for storing and retrieving the
dependence information?

Thanks

funceval wrote:

Hi,

I have written a pass to find the control dependences. Right now I am
using a map of of basic blocks to vectors of basic blocks to store the
dependences, so the dependence is represented in terms of basic
blocks. Before I submit the patch for review, I wanted to know the
format in which control dependences should be stored.

1) Should the dependence information be instead represented in terms
of instructions? This is how I plan to do in terms of instructions -
if basic block bb1 is control dependent on basic block bb2, then all
instructions in bb1 are dependent on the compare instruction in bb2.
  

I think your pass can store the dependence information however it wants.

2) Shall I provide an additional wrapper class to get the dependence
information in terms of instructions?
  

Why not add methods to your current class to look up control dependence information using an Instruction? I don't see any reason why your pass can't accept both Instructions and BasicBlocks for lookup operations.

3) Is the STL map good enough for storing and retrieving the
dependence information?
  

I don't know. Have you read about the data structures in the LLVM Programmer's Manual?

-- John T.