[llvm-dev] Proper way to lower all ConstantExprs?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[llvm-dev] Proper way to lower all ConstantExprs?

Bruce Hoult via llvm-dev
Hi:
For my own Transform passes I need to lower all ConstantExpressions into Instructions in order to conveniently analyze the use-def def-use chains and operand comparisons. Could anyone possibly kindly share some insights on if there is any standard way to do this without crafting my own implementation and if not, should we add this feature into LLVM upstream?  

Zhang


_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Reply | Threaded
Open this post in threaded view
|

Re: [llvm-dev] Proper way to lower all ConstantExprs?

Bruce Hoult via llvm-dev
On 5/30/2018 7:21 PM, mayuyu.io via llvm-dev wrote:
> Hi:
> For my own Transform passes I need to lower all ConstantExpressions into Instructions in order to conveniently analyze the use-def def-use chains and operand comparisons. Could anyone possibly kindly share some insights on if there is any standard way to do this without crafting my own implementation and if not, should we add this feature into LLVM upstream?

There's a helper ConstantExpr::getAsInstruction to create an Instruction
for a given ConstantExpr.  I don't think there's any code to do this for
*all* ConstantExprs/ConstantAggregates used by a given function; if you
think you need this, you might want to reconsider your approach. 
(Recursively visiting constant expressions isn't very hard, if you need it.)

-Eli

--
Employee of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project

_______________________________________________
LLVM Developers mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev