2004-01-12 22:13:12 +01:00
|
|
|
//===-- ConstantFolding.h - Internal Constant Folding Interface -*- C++ -*-===//
|
2005-04-22 01:48:37 +02:00
|
|
|
//
|
2003-10-20 22:19:47 +02:00
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
2007-12-29 21:36:04 +01:00
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
2005-04-22 01:48:37 +02:00
|
|
|
//
|
2003-10-20 22:19:47 +02:00
|
|
|
//===----------------------------------------------------------------------===//
|
2001-06-06 22:29:01 +02:00
|
|
|
//
|
2004-01-12 22:13:12 +01: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.
|
|
|
|
//
|
|
|
|
// These operators may return a null object if I don't know how to perform the
|
|
|
|
// specified operation on the specified constant types.
|
2001-06-06 22:29:01 +02:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2004-01-12 22:13:12 +01:00
|
|
|
#ifndef CONSTANTFOLDING_H
|
|
|
|
#define CONSTANTFOLDING_H
|
2001-06-06 22:29:01 +02:00
|
|
|
|
2003-11-11 23:41:34 +01:00
|
|
|
namespace llvm {
|
2004-10-12 00:52:25 +02:00
|
|
|
class Value;
|
2004-01-12 22:02:29 +01:00
|
|
|
class Constant;
|
2004-10-27 18:14:51 +02:00
|
|
|
class Type;
|
2005-04-22 01:48:37 +02:00
|
|
|
|
2004-01-12 22:13:12 +01:00
|
|
|
// Constant fold various types of instruction...
|
2006-11-27 02:05:10 +01:00
|
|
|
Constant *ConstantFoldCastInstruction(
|
|
|
|
unsigned opcode, ///< The opcode of the cast
|
|
|
|
const Constant *V, ///< The source constant
|
|
|
|
const Type *DestTy ///< The destination type
|
|
|
|
);
|
2004-03-12 06:53:41 +01:00
|
|
|
Constant *ConstantFoldSelectInstruction(const Constant *Cond,
|
|
|
|
const Constant *V1,
|
|
|
|
const Constant *V2);
|
2006-01-10 21:03:46 +01:00
|
|
|
Constant *ConstantFoldExtractElementInstruction(const Constant *Val,
|
|
|
|
const Constant *Idx);
|
2006-01-17 21:07:22 +01:00
|
|
|
Constant *ConstantFoldInsertElementInstruction(const Constant *Val,
|
|
|
|
const Constant *Elt,
|
|
|
|
const Constant *Idx);
|
2006-04-08 03:18:18 +02:00
|
|
|
Constant *ConstantFoldShuffleVectorInstruction(const Constant *V1,
|
|
|
|
const Constant *V2,
|
|
|
|
const Constant *Mask);
|
2004-01-12 22:13:12 +01:00
|
|
|
Constant *ConstantFoldBinaryInstruction(unsigned Opcode, const Constant *V1,
|
|
|
|
const Constant *V2);
|
2006-12-23 07:05:41 +01:00
|
|
|
Constant *ConstantFoldCompareInstruction(unsigned short predicate,
|
2006-12-24 19:52:08 +01:00
|
|
|
const Constant *C1,
|
|
|
|
const Constant *C2);
|
2004-01-12 22:13:12 +01:00
|
|
|
Constant *ConstantFoldGetElementPtr(const Constant *C,
|
2007-01-31 05:40:28 +01:00
|
|
|
Constant* const *Idxs, unsigned NumIdx);
|
2003-11-11 23:41:34 +01:00
|
|
|
} // End llvm namespace
|
|
|
|
|
2001-06-06 22:29:01 +02:00
|
|
|
#endif
|