Couple of fixes to mention bunzip2 and make instructions more clear.
[llvm-complete.git] / lib / VMCore / ConstantFold.h
blobffb7b1057e5b5b83b249ce5c00bc3e5ac38d3371
1 //===-- ConstantFolding.h - Internal Constant Folding Interface -*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines the (internal) constant folding interfaces for LLVM. These
11 // interfaces are used by the ConstantExpr::get* methods to automatically fold
12 // constants when possible.
14 // These operators may return a null object if I don't know how to perform the
15 // specified operation on the specified constant types.
17 //===----------------------------------------------------------------------===//
19 #ifndef CONSTANTFOLDING_H
20 #define CONSTANTFOLDING_H
22 #include <iterator>
24 namespace llvm {
25 class Value;
26 class Constant;
27 class Type;
29 // Constant fold various types of instruction...
30 Constant *ConstantFoldCastInstruction(
31 unsigned opcode, ///< The opcode of the cast
32 const Constant *V, ///< The source constant
33 const Type *DestTy ///< The destination type
35 Constant *ConstantFoldSelectInstruction(const Constant *Cond,
36 const Constant *V1,
37 const Constant *V2);
38 Constant *ConstantFoldExtractElementInstruction(const Constant *Val,
39 const Constant *Idx);
40 Constant *ConstantFoldInsertElementInstruction(const Constant *Val,
41 const Constant *Elt,
42 const Constant *Idx);
43 Constant *ConstantFoldShuffleVectorInstruction(const Constant *V1,
44 const Constant *V2,
45 const Constant *Mask);
46 Constant *ConstantFoldBinaryInstruction(unsigned Opcode, const Constant *V1,
47 const Constant *V2);
48 Constant *ConstantFoldCompareInstruction(unsigned short predicate,
49 const Constant *C1,
50 const Constant *C2);
52 Constant *ConstantFoldGetElementPtr(const Constant *C,
53 Constant* const *Idxs, unsigned NumIdx);
54 } // End llvm namespace
56 #endif