InstructionSimplify.h revision 9f3c25aeb3df77a336693308dc0f19a4983c99af
1//===-- InstructionSimplify.h - Fold instructions into simpler forms ------===//
2//
3//                     The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9//
10// This file declares routines for folding instructions into simpler forms that
11// do not require creating new instructions.  For example, this does constant
12// folding, and can handle identities like (X&0)->0.
13//
14//===----------------------------------------------------------------------===//
15
16#ifndef LLVM_ANALYSIS_INSTRUCTIONSIMPLIFY_H
17#define LLVM_ANALYSIS_INSTRUCTIONSIMPLIFY_H
18
19namespace llvm {
20  class Value;
21  class TargetData;
22
23  /// SimplifyCompare - Given operands for a CmpInst, see if we can
24  /// fold the result.  If not, this returns null.
25  Value *SimplifyCompare(unsigned Predicate, Value *LHS, Value *RHS,
26                         const TargetData *TD = 0);
27
28
29  /// SimplifyBinOp - Given operands for a BinaryOperator, see if we can
30  /// fold the result.  If not, this returns null.
31  Value *SimplifyBinOp(unsigned Opcode, Value *LHS, Value *RHS,
32                       const TargetData *TD = 0);
33
34} // end namespace llvm
35
36#endif
37
38