1 //===-- ConstantFolding.h - Internal Constant Folding Interface -*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
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 they don't know how to perform
15 // the specified operation on the specified constant types.
17 //===----------------------------------------------------------------------===//
19 #ifndef CONSTANTFOLDING_H
20 #define CONSTANTFOLDING_H
28 // Constant fold various types of instruction...
29 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(LLVMContext
&Context
,
39 Constant
*ConstantFoldExtractElementInstruction(LLVMContext
&Context
,
42 Constant
*ConstantFoldInsertElementInstruction(LLVMContext
&Context
,
46 Constant
*ConstantFoldShuffleVectorInstruction(LLVMContext
&Context
,
49 const Constant
*Mask
);
50 Constant
*ConstantFoldExtractValueInstruction(LLVMContext
&Context
,
54 Constant
*ConstantFoldInsertValueInstruction(LLVMContext
&Context
,
59 Constant
*ConstantFoldBinaryInstruction(LLVMContext
&Context
,
60 unsigned Opcode
, const Constant
*V1
,
62 Constant
*ConstantFoldCompareInstruction(LLVMContext
&Context
,
63 unsigned short predicate
,
66 Constant
*ConstantFoldGetElementPtr(LLVMContext
&Context
, const Constant
*C
,
67 Constant
* const *Idxs
, unsigned NumIdx
);
68 } // End llvm namespace