summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJames Molloy <james.molloy@arm.com>2012-11-17 17:56:30 +0000
committerJames Molloy <james.molloy@arm.com>2012-11-17 17:56:30 +0000
commitb9478c2aef060aa6b0ede41c05859c34b1527bf8 (patch)
tree4c896b2e5249460cc25c158c72a750cc4ad118f5 /include
parent9e6ee16b1814268897965b81e82a74ef39173ee1 (diff)
downloadllvm-b9478c2aef060aa6b0ede41c05859c34b1527bf8.tar.gz
llvm-b9478c2aef060aa6b0ede41c05859c34b1527bf8.tar.bz2
llvm-b9478c2aef060aa6b0ede41c05859c34b1527bf8.tar.xz
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
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Constants.h10
1 files changed, 10 insertions, 0 deletions
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<Constant*> 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);