LLVM API Documentation
00001 //===-- ConstantFolding.h - Internal Constant Folding Interface -*- C++ -*-===// 00002 // 00003 // The LLVM Compiler Infrastructure 00004 // 00005 // This file was developed by the LLVM research group and is distributed under 00006 // the University of Illinois Open Source License. See LICENSE.TXT for details. 00007 // 00008 //===----------------------------------------------------------------------===// 00009 // 00010 // This file defines the (internal) constant folding interfaces for LLVM. These 00011 // interfaces are used by the ConstantExpr::get* methods to automatically fold 00012 // constants when possible. 00013 // 00014 // These operators may return a null object if I don't know how to perform the 00015 // specified operation on the specified constant types. 00016 // 00017 //===----------------------------------------------------------------------===// 00018 00019 #ifndef CONSTANTFOLDING_H 00020 #define CONSTANTFOLDING_H 00021 00022 #include <vector> 00023 00024 namespace llvm { 00025 class Value; 00026 class Constant; 00027 class Type; 00028 00029 // Constant fold various types of instruction... 00030 Constant *ConstantFoldCastInstruction(const Constant *V, const Type *DestTy); 00031 Constant *ConstantFoldSelectInstruction(const Constant *Cond, 00032 const Constant *V1, 00033 const Constant *V2); 00034 Constant *ConstantFoldExtractElementInstruction(const Constant *Val, 00035 const Constant *Idx); 00036 Constant *ConstantFoldInsertElementInstruction(const Constant *Val, 00037 const Constant *Elt, 00038 const Constant *Idx); 00039 Constant *ConstantFoldShuffleVectorInstruction(const Constant *V1, 00040 const Constant *V2, 00041 const Constant *Mask); 00042 Constant *ConstantFoldBinaryInstruction(unsigned Opcode, const Constant *V1, 00043 const Constant *V2); 00044 Constant *ConstantFoldGetElementPtr(const Constant *C, 00045 const std::vector<Value*> &IdxList); 00046 } // End llvm namespace 00047 00048 #endif