2004-01-13 05:13:12 +08:00
|
|
|
//===-- ConstantFolding.h - Internal Constant Folding Interface -*- C++ -*-===//
|
2005-04-22 07:48:37 +08:00
|
|
|
//
|
2003-10-21 04:19:47 +08:00
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-30 04:36:04 +08:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2005-04-22 07:48:37 +08:00
|
|
|
//
|
2003-10-21 04:19:47 +08:00
|
|
|
//===----------------------------------------------------------------------===//
|
2001-06-07 04:29:01 +08:00
|
|
|
//
|
2004-01-13 05:13:12 +08: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 20:23:49 +08: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-07 04:29:01 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2014-08-14 00:26:38 +08:00
|
|
|
#ifndef LLVM_LIB_IR_CONSTANTFOLD_H
|
|
|
|
#define LLVM_LIB_IR_CONSTANTFOLD_H
|
2001-06-07 04:29:01 +08:00
|
|
|
|
2011-07-13 18:26:04 +08:00
|
|
|
#include "llvm/ADT/ArrayRef.h"
|
|
|
|
|
2003-11-12 06:41:34 +08:00
|
|
|
namespace llvm {
|
2004-10-12 06:52:25 +08:00
|
|
|
class Value;
|
2004-01-13 05:02:29 +08:00
|
|
|
class Constant;
|
2004-10-28 00:14:51 +08:00
|
|
|
class Type;
|
2005-04-22 07:48:37 +08:00
|
|
|
|
2004-01-13 05:13:12 +08:00
|
|
|
// Constant fold various types of instruction...
|
2006-11-27 09:05:10 +08:00
|
|
|
Constant *ConstantFoldCastInstruction(
|
|
|
|
unsigned opcode, ///< The opcode of the cast
|
2009-09-20 09:35:59 +08:00
|
|
|
Constant *V, ///< The source constant
|
2011-07-18 12:54:35 +08:00
|
|
|
Type *DestTy ///< The destination type
|
2006-11-27 09:05:10 +08:00
|
|
|
);
|
2010-02-02 04:48:08 +08:00
|
|
|
Constant *ConstantFoldSelectInstruction(Constant *Cond,
|
2009-09-20 09:35:59 +08:00
|
|
|
Constant *V1, Constant *V2);
|
2010-02-02 04:48:08 +08:00
|
|
|
Constant *ConstantFoldExtractElementInstruction(Constant *Val, Constant *Idx);
|
|
|
|
Constant *ConstantFoldInsertElementInstruction(Constant *Val, Constant *Elt,
|
2009-09-20 09:35:59 +08:00
|
|
|
Constant *Idx);
|
2010-02-02 04:48:08 +08:00
|
|
|
Constant *ConstantFoldShuffleVectorInstruction(Constant *V1, Constant *V2,
|
2009-09-20 09:35:59 +08:00
|
|
|
Constant *Mask);
|
2010-02-02 04:48:08 +08:00
|
|
|
Constant *ConstantFoldExtractValueInstruction(Constant *Agg,
|
2011-07-13 18:26:04 +08:00
|
|
|
ArrayRef<unsigned> Idxs);
|
2010-02-02 04:48:08 +08:00
|
|
|
Constant *ConstantFoldInsertValueInstruction(Constant *Agg, Constant *Val,
|
2011-07-13 18:26:04 +08:00
|
|
|
ArrayRef<unsigned> Idxs);
|
2010-02-02 04:48:08 +08:00
|
|
|
Constant *ConstantFoldBinaryInstruction(unsigned Opcode, Constant *V1,
|
2009-09-20 09:35:59 +08:00
|
|
|
Constant *V2);
|
2010-02-02 04:48:08 +08:00
|
|
|
Constant *ConstantFoldCompareInstruction(unsigned short predicate,
|
2009-09-20 09:35:59 +08:00
|
|
|
Constant *C1, Constant *C2);
|
2015-05-08 01:28:58 +08:00
|
|
|
Constant *ConstantFoldGetElementPtr(Type *Ty, Constant *C, bool inBounds,
|
|
|
|
ArrayRef<Constant *> Idxs);
|
|
|
|
Constant *ConstantFoldGetElementPtr(Type *Ty, Constant *C, bool inBounds,
|
|
|
|
ArrayRef<Value *> Idxs);
|
2015-06-23 17:49:53 +08:00
|
|
|
} // End llvm namespace
|
2003-11-12 06:41:34 +08:00
|
|
|
|
2001-06-07 04:29:01 +08:00
|
|
|
#endif
|