From b9478c2aef060aa6b0ede41c05859c34b1527bf8 Mon Sep 17 00:00:00 2001 From: James Molloy Date: Sat, 17 Nov 2012 17:56:30 +0000 Subject: Add a new function to ConstantExpr - getAsInstruction. This returns its Instruction* corollary, which may be useful if a user wishes to transform a ConstantExpr so that one of its operands is no longer constant. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@168262 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Constants.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include/llvm') diff --git a/include/llvm/Constants.h b/include/llvm/Constants.h index b7d1a488f5..3308499192 100644 --- a/include/llvm/Constants.h +++ b/include/llvm/Constants.h @@ -1076,6 +1076,16 @@ public: /// current one. Constant *getWithOperands(ArrayRef Ops, Type *Ty) const; + /// getAsInstruction - Returns an Instruction which implements the same operation + /// as this ConstantExpr. The instruction is not linked to any basic block. + /// + /// A better approach to this could be to have a constructor for Instruction + /// which would take a ConstantExpr parameter, but that would have spread + /// implementation details of ConstantExpr outside of Constants.cpp, which + /// would make it harded to remove ConstantExprs altogether + /// (http://llvm.org/bugs/show_bug.cgi?id=10368). + Instruction *getAsInstruction(); + virtual void destroyConstant(); virtual void replaceUsesOfWithOnConstant(Value *From, Value *To, Use *U); -- cgit v1.2.3