Alexander Poddey
2015-Jan-14 18:10 UTC
[LLVMdev] list of available/valid values near an instruction
Hi Krzysztof yes, they are available. What I want is to have a list of those values I can iterate over.... Alex> I'm not sure if I understand your question correctly, but all values > whose definitions dominate the instruction that you are looking at are > available. Globals and function arguments are always available in a > given module or function. > > -Krzysztof > > > On 1/14/2015 9:08 AM, Alexander Poddey wrote: >> I wonder if there is a list of available/valid values (globals, constants >> arguments,..) in the scope of a given instruction? >> >> Background: >> Iterating over the instructions of a module, i would like to know which >> values are accessible in the context of the instruction, possibly >> replacing the instructions operand by a valid available other operand. >> >> >> Thx >> Alex >> >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >> > >
Krzysztof Parzyszek
2015-Jan-14 19:06 UTC
[LLVMdev] list of available/valid values near an instruction
For instructions you can simply iterate over the current basic block from the instruction before the one that you are looking at, up to the beginning of the block. Then iterate over all instructions in all blocks dominating the current block. (You can get those from the dominator tree, following the immediate-dominator chain.) There is no such iterator that I'm aware of, so you may need to implement your own, but it should be fairly simple. -Krzysztof On 1/14/2015 12:10 PM, Alexander Poddey wrote:> > Hi Krzysztof > yes, they are available. What I want is to have a list of those values I can > iterate over.... > > Alex >> I'm not sure if I understand your question correctly, but all values >> whose definitions dominate the instruction that you are looking at are >> available. Globals and function arguments are always available in a >> given module or function. >> >> -Krzysztof >> >> >> On 1/14/2015 9:08 AM, Alexander Poddey wrote: >>> I wonder if there is a list of available/valid values (globals, constants >>> arguments,..) in the scope of a given instruction? >>> >>> Background: >>> Iterating over the instructions of a module, i would like to know which >>> values are accessible in the context of the instruction, possibly >>> replacing the instructions operand by a valid available other operand. >>> >>> >>> Thx >>> Alex >>> >>> _______________________________________________ >>> LLVM Developers mailing list >>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >>> >> >> > > > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >-- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Philip Reames
2015-Jan-16 19:07 UTC
[LLVMdev] list of available/valid values near an instruction
If you're still looking for example code, you can glance at the function findLiveGCValuesAtInst in http://reviews.llvm.org/D6975. It does more or less exactly this with an extra filtering step. Philip On 01/14/2015 11:06 AM, Krzysztof Parzyszek wrote:> For instructions you can simply iterate over the current basic block > from the instruction before the one that you are looking at, up to the > beginning of the block. Then iterate over all instructions in all > blocks dominating the current block. (You can get those from the > dominator tree, following the immediate-dominator chain.) > > There is no such iterator that I'm aware of, so you may need to > implement your own, but it should be fairly simple. > > -Krzysztof > > > On 1/14/2015 12:10 PM, Alexander Poddey wrote: >> >> Hi Krzysztof >> yes, they are available. What I want is to have a list of those >> values I can >> iterate over.... >> >> Alex >>> I'm not sure if I understand your question correctly, but all values >>> whose definitions dominate the instruction that you are looking at are >>> available. Globals and function arguments are always available in a >>> given module or function. >>> >>> -Krzysztof >>> >>> >>> On 1/14/2015 9:08 AM, Alexander Poddey wrote: >>>> I wonder if there is a list of available/valid values (globals, >>>> constants >>>> arguments,..) in the scope of a given instruction? >>>> >>>> Background: >>>> Iterating over the instructions of a module, i would like to know >>>> which >>>> values are accessible in the context of the instruction, possibly >>>> replacing the instructions operand by a valid available other operand. >>>> >>>> >>>> Thx >>>> Alex >>>> >>>> _______________________________________________ >>>> LLVM Developers mailing list >>>> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >>>> >>> >>> >> >> >> _______________________________________________ >> LLVM Developers mailing list >> LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu >> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev >> > >