2004-01-12 21:13:12 +00:00
|
|
|
//===-- ConstantFolding.h - Internal Constant Folding Interface -*- C++ -*-===//
|
2005-04-21 23:48:37 +00:00
|
|
|
//
|
2003-10-20 20:19:47 +00:00
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 20:36:04 +00:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2005-04-21 23:48:37 +00:00
|
|
|
//
|
2003-10-20 20:19:47 +00:00
|
|
|
//===----------------------------------------------------------------------===//
|
2001-06-06 20:29:01 +00:00
|
|
|
//
|
2004-01-12 21:13:12 +00:00
|
|
|
// This file defines the (internal) constant folding interfaces for LLVM. These
|
|
|
|
// interfaces are used by the ConstantExpr::get* methods to automatically fold
|
|
|
|
// constants when possible.
|
|
|
|
//
|
2008-08-01 12:23:49 +00:00
|
|
|
// These operators may return a null object if they don't know how to perform
|
|
|
|
// the specified operation on the specified constant types.
|
2001-06-06 20:29:01 +00:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2004-01-12 21:13:12 +00:00
|
|
|
#ifndef CONSTANTFOLDING_H
|
|
|
|
#define CONSTANTFOLDING_H
|
2001-06-06 20:29:01 +00:00
|
|
|
|
2003-11-11 22:41:34 +00:00
|
|
|
namespace llvm {
|
2004-10-11 22:52:25 +00:00
|
|
|
class Value;
|
2004-01-12 21:02:29 +00:00
|
|
|
class Constant;
|
2004-10-27 16:14:51 +00:00
|
|
|
class Type;
|
2009-08-11 17:45:13 +00:00
|
|
|
class LLVMContext;
|
2005-04-21 23:48:37 +00:00
|
|
|
|
2004-01-12 21:13:12 +00:00
|
|
|
// Constant fold various types of instruction...
|
2006-11-27 01:05:10 +00:00
|
|
|
Constant *ConstantFoldCastInstruction(
|
2009-07-13 04:09:18 +00:00
|
|
|
LLVMContext &Context,
|
2006-11-27 01:05:10 +00:00
|
|
|
unsigned opcode, ///< The opcode of the cast
|
2009-09-20 01:35:59 +00:00
|
|
|
Constant *V, ///< The source constant
|
2009-06-20 00:26:26 +00:00
|
|
|
const Type *DestTy ///< The destination type
|
2006-11-27 01:05:10 +00:00
|
|
|
);
|
2009-07-13 04:09:18 +00:00
|
|
|
Constant *ConstantFoldSelectInstruction(LLVMContext &Context,
|
2009-09-20 01:35:59 +00:00
|
|
|
Constant *Cond,
|
|
|
|
Constant *V1, Constant *V2);
|
2009-07-13 04:09:18 +00:00
|
|
|
Constant *ConstantFoldExtractElementInstruction(LLVMContext &Context,
|
2009-09-20 01:35:59 +00:00
|
|
|
Constant *Val,
|
|
|
|
Constant *Idx);
|
2009-07-13 04:09:18 +00:00
|
|
|
Constant *ConstantFoldInsertElementInstruction(LLVMContext &Context,
|
2009-09-20 01:35:59 +00:00
|
|
|
Constant *Val,
|
|
|
|
Constant *Elt,
|
|
|
|
Constant *Idx);
|
2009-07-13 04:09:18 +00:00
|
|
|
Constant *ConstantFoldShuffleVectorInstruction(LLVMContext &Context,
|
2009-09-20 01:35:59 +00:00
|
|
|
Constant *V1,
|
|
|
|
Constant *V2,
|
|
|
|
Constant *Mask);
|
2009-07-13 04:09:18 +00:00
|
|
|
Constant *ConstantFoldExtractValueInstruction(LLVMContext &Context,
|
2009-09-20 01:35:59 +00:00
|
|
|
Constant *Agg,
|
2008-06-03 00:15:20 +00:00
|
|
|
const unsigned *Idxs,
|
|
|
|
unsigned NumIdx);
|
2009-07-13 04:09:18 +00:00
|
|
|
Constant *ConstantFoldInsertValueInstruction(LLVMContext &Context,
|
2009-09-20 01:35:59 +00:00
|
|
|
Constant *Agg,
|
|
|
|
Constant *Val,
|
|
|
|
const unsigned *Idxs,
|
2008-06-03 00:15:20 +00:00
|
|
|
unsigned NumIdx);
|
2009-07-13 04:09:18 +00:00
|
|
|
Constant *ConstantFoldBinaryInstruction(LLVMContext &Context,
|
2009-09-20 01:35:59 +00:00
|
|
|
unsigned Opcode, Constant *V1,
|
|
|
|
Constant *V2);
|
2009-07-13 04:09:18 +00:00
|
|
|
Constant *ConstantFoldCompareInstruction(LLVMContext &Context,
|
|
|
|
unsigned short predicate,
|
2009-09-20 01:35:59 +00:00
|
|
|
Constant *C1, Constant *C2);
|
|
|
|
Constant *ConstantFoldGetElementPtr(LLVMContext &Context, Constant *C,
|
2009-09-11 00:04:14 +00:00
|
|
|
bool inBounds,
|
2009-06-20 00:26:26 +00:00
|
|
|
Constant* const *Idxs, unsigned NumIdx);
|
2003-11-11 22:41:34 +00:00
|
|
|
} // End llvm namespace
|
|
|
|
|
2001-06-06 20:29:01 +00:00
|
|
|
#endif
|