Add an interface to constant fold and instruction given it's opcode, type
authorChris Lattner <sabre@nondot.org>
Sat, 27 May 2006 01:17:40 +0000 (01:17 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 27 May 2006 01:17:40 +0000 (01:17 +0000)
and operands.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28516 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Transforms/Utils/Local.h

index da1ce25f6d8dc081c3552b8e530cc445f9900f62..4ee2f1a120b3da9ae0210fc99e625c97c708e5f9 100644 (file)
@@ -48,6 +48,15 @@ bool ConstantFoldTerminator(BasicBlock *BB);
 ///
 Constant *ConstantFoldInstruction(Instruction *I);
 
+/// ConstantFoldInstOperands - Attempt to constant fold an instruction with the
+/// specified opcode and operands.  If successful, the constant result is
+/// returned, if not, null is returned.  Note that this function can fail when
+/// attempting to fold instructions like loads and stores, which have no
+/// constant expression form.
+///
+Constant *ConstantFoldInstOperands(unsigned Opc, const Type *DestTy,
+                                   const std::vector<Constant*> &Ops);
+
 
 /// ConstantFoldLoadThroughGEPConstantExpr - Given a constant and a
 /// getelementptr constantexpr, return the constant value being addressed by the