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
|
|
|
|
//
|
|
|
|
// This file was developed by the LLVM research group and 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.
|
|
|
|
//
|
|
|
|
// 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 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
|
|
|
|
2004-01-12 21:02:29 +00:00
|
|
|
#include <vector>
|
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;
|
2005-04-21 23:48:37 +00:00
|
|
|
|
2004-01-12 21:13:12 +00:00
|
|
|
// Constant fold various types of instruction...
|
|
|
|
Constant *ConstantFoldCastInstruction(const Constant *V, const Type *DestTy);
|
2004-03-12 05:53:41 +00:00
|
|
|
Constant *ConstantFoldSelectInstruction(const Constant *Cond,
|
|
|
|
const Constant *V1,
|
|
|
|
const Constant *V2);
|
2006-01-10 20:03:46 +00:00
|
|
|
Constant *ConstantFoldExtractElementInstruction(const Constant *Val,
|
|
|
|
const Constant *Idx);
|
2006-01-17 20:07:22 +00:00
|
|
|
Constant *ConstantFoldInsertElementInstruction(const Constant *Val,
|
|
|
|
const Constant *Elt,
|
|
|
|
const Constant *Idx);
|
2006-04-08 01:18:18 +00:00
|
|
|
Constant *ConstantFoldShuffleVectorInstruction(const Constant *V1,
|
|
|
|
const Constant *V2,
|
|
|
|
const Constant *Mask);
|
2004-01-12 21:13:12 +00:00
|
|
|
Constant *ConstantFoldBinaryInstruction(unsigned Opcode, const Constant *V1,
|
|
|
|
const Constant *V2);
|
|
|
|
Constant *ConstantFoldGetElementPtr(const Constant *C,
|
2004-10-11 22:52:25 +00:00
|
|
|
const std::vector<Value*> &IdxList);
|
2003-11-11 22:41:34 +00:00
|
|
|
} // End llvm namespace
|
|
|
|
|
2001-06-06 20:29:01 +00:00
|
|
|
#endif
|