//===- ConstantFolding.cpp - LLVM constant folder -------------------------===////// 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.////===----------------------------------------------------------------------===////// This file implements folding of constants for LLVM. This implements the// (internal) ConstantFolding.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"ConstantFolding.h"#include"llvm/Constants.h"#include"llvm/Instructions.h"#include"llvm/DerivedTypes.h"#include"llvm/Function.h"#include"llvm/Support/GetElementPtrTypeIterator.h"#include"llvm/Support/MathExtras.h"#include"llvm/Support/Visibility.h"#include<limits>#include<cmath>usingnamespacellvm;namespace{structVISIBILITY_HIDDENConstRules{ConstRules(){}virtual~ConstRules(){}// Binary Operators...virtualConstant*