2004-01-13 05:13:12 +08:00
|
|
|
//===-- ConstantFolding.h - Internal Constant Folding Interface -*- C++ -*-===//
|
2003-10-21 04:19:47 +08: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.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
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.
|
|
|
|
//
|
|
|
|
// 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-07 04:29:01 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2004-01-13 05:13:12 +08:00
|
|
|
#ifndef CONSTANTFOLDING_H
|
|
|
|
#define CONSTANTFOLDING_H
|
2001-06-07 04:29:01 +08:00
|
|
|
|
2004-01-13 05:02:29 +08:00
|
|
|
#include <vector>
|
2003-11-12 06:41:34 +08:00
|
|
|
|
|
|
|
namespace llvm {
|
2004-01-13 05:02:29 +08:00
|
|
|
class Constant;
|
2004-06-09 01:53:24 +08:00
|
|
|
struct Type;
|
2004-01-13 05:13:12 +08:00
|
|
|
|
|
|
|
// Constant fold various types of instruction...
|
|
|
|
Constant *ConstantFoldCastInstruction(const Constant *V, const Type *DestTy);
|
2004-03-12 13:53:41 +08:00
|
|
|
Constant *ConstantFoldSelectInstruction(const Constant *Cond,
|
|
|
|
const Constant *V1,
|
|
|
|
const Constant *V2);
|
2004-01-13 05:13:12 +08:00
|
|
|
Constant *ConstantFoldBinaryInstruction(unsigned Opcode, const Constant *V1,
|
|
|
|
const Constant *V2);
|
|
|
|
Constant *ConstantFoldGetElementPtr(const Constant *C,
|
|
|
|
const std::vector<Constant*> &IdxList);
|
2003-11-12 06:41:34 +08:00
|
|
|
} // End llvm namespace
|
|
|
|
|
2001-06-07 04:29:01 +08:00
|
|
|
#endif
|