//===- ConstantFold.cpp - LLVM constant folder ----------------------------===////// The LLVM Compiler Infrastructure//// This file is distributed under the University of Illinois Open Source// License. See LICENSE.TXT for details.////===----------------------------------------------------------------------===////// This file implements folding of constants for LLVM. This implements the// (internal) ConstantFold.h interface, which is used by the// ConstantExpr::get* methods to automatically fold constants when possible.//// The current constant folding implementation is implemented in two pieces: the// template-based folder for simple primitive constants like ConstantInt, and// the special case hackery that we use to symbolically evaluate expressions// that use ConstantExprs.////===----------------------------------------------------------------------===//#include"ConstantFold.h"#include"llvm/Constants.h"#include"llvm/Instructions.h"#include"llvm/DerivedTypes.h"#include"llvm/Function.h"#include"llvm/GlobalAlias.h"#include"llvm/ADT/SmallVector.h"#include"llvm/Support/Compiler.h"#include"llvm/Support/GetElementPtrTypeIterator.h"#include"llvm/Support/ManagedStatic.h"#include"llvm/Support/MathExtras.h"#include<limits>usingnamespacellvm;//===----------------------------------------------------------------------===//// ConstantFold*Instruction Implementations/