#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/APInt.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/FloatingPointMode.h"
#include "llvm/ADT/SetVector.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/ADT/SmallSet.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Analysis/ConstantFolding.h"
#include "llvm/Analysis/TargetLibraryInfo.h"
#include "llvm/CodeGen/ISDOpcodes.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineJumpTableInfo.h"
#include "llvm/CodeGen/MachineMemOperand.h"
#include "llvm/CodeGen/RuntimeLibcallUtil.h"
#include "llvm/CodeGen/SelectionDAG.h"
#include "llvm/CodeGen/SelectionDAGNodes.h"
#include "llvm/CodeGen/TargetFrameLowering.h"
#include "llvm/CodeGen/TargetLowering.h"
#include "llvm/CodeGen/TargetSubtargetInfo.h"
#include "llvm/CodeGen/ValueTypes.h"
#include "llvm/CodeGenTypes/MachineValueType.h"
#include "llvm/IR/CallingConv.h"
#include "llvm/IR/Constants.h"
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/Metadata.h"
#include "llvm/IR/Type.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/Debug.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetOptions.h"
#include <cassert>
#include <cstdint>
#include <tuple>
#include <utility>
usingnamespacellvm;
#define DEBUG_TYPE …
namespace {
struct FloatSignAsInt { … };
class SelectionDAGLegalize { … };
}
static MachineMemOperand *getStackAlignedMMO(SDValue StackPtr,
MachineFunction &MF,
bool isObjectScalable) { … }
SDValue SelectionDAGLegalize::ShuffleWithNarrowerEltType(
EVT NVT, EVT VT, const SDLoc &dl, SDValue N1, SDValue N2,
ArrayRef<int> Mask) const { … }
SDValue
SelectionDAGLegalize::ExpandConstantFP(ConstantFPSDNode *CFP, bool UseCP) { … }
SDValue SelectionDAGLegalize::ExpandConstant(ConstantSDNode *CP) { … }
SDValue SelectionDAGLegalize::ExpandINSERT_VECTOR_ELT(SDValue Op) { … }
SDValue SelectionDAGLegalize::OptimizeFloatStore(StoreSDNode* ST) { … }
void SelectionDAGLegalize::LegalizeStoreOps(SDNode *Node) { … }
void SelectionDAGLegalize::LegalizeLoadOps(SDNode *Node) { … }
void SelectionDAGLegalize::LegalizeOp(SDNode *Node) { … }
SDValue SelectionDAGLegalize::ExpandExtractFromVectorThroughStack(SDValue Op) { … }
SDValue SelectionDAGLegalize::ExpandInsertToVectorThroughStack(SDValue Op) { … }
SDValue SelectionDAGLegalize::ExpandVectorBuildThroughStack(SDNode* Node) { … }
void SelectionDAGLegalize::getSignAsIntValue(FloatSignAsInt &State,
const SDLoc &DL,
SDValue Value) const { … }
SDValue SelectionDAGLegalize::modifySignAsInt(const FloatSignAsInt &State,
const SDLoc &DL,
SDValue NewIntValue) const { … }
SDValue SelectionDAGLegalize::ExpandFCOPYSIGN(SDNode *Node) const { … }
SDValue SelectionDAGLegalize::ExpandFNEG(SDNode *Node) const { … }
SDValue SelectionDAGLegalize::ExpandFABS(SDNode *Node) const { … }
void SelectionDAGLegalize::ExpandDYNAMIC_STACKALLOC(SDNode* Node,
SmallVectorImpl<SDValue> &Results) { … }
SDValue SelectionDAGLegalize::EmitStackConvert(SDValue SrcOp, EVT SlotVT,
EVT DestVT, const SDLoc &dl) { … }
SDValue SelectionDAGLegalize::EmitStackConvert(SDValue SrcOp, EVT SlotVT,
EVT DestVT, const SDLoc &dl,
SDValue Chain) { … }
SDValue SelectionDAGLegalize::ExpandSCALAR_TO_VECTOR(SDNode *Node) { … }
static bool
ExpandBVWithShuffles(SDNode *Node, SelectionDAG &DAG,
const TargetLowering &TLI, SDValue &Res) { … }
SDValue SelectionDAGLegalize::ExpandBUILD_VECTOR(SDNode *Node) { … }
SDValue SelectionDAGLegalize::ExpandSPLAT_VECTOR(SDNode *Node) { … }
std::pair<SDValue, SDValue> SelectionDAGLegalize::ExpandLibCall(RTLIB::Libcall LC, SDNode *Node,
TargetLowering::ArgListTy &&Args,
bool isSigned) { … }
std::pair<SDValue, SDValue> SelectionDAGLegalize::ExpandLibCall(RTLIB::Libcall LC, SDNode *Node,
bool isSigned) { … }
void SelectionDAGLegalize::ExpandFrexpLibCall(
SDNode *Node, SmallVectorImpl<SDValue> &Results) { … }
void SelectionDAGLegalize::ExpandFPLibCall(SDNode* Node,
RTLIB::Libcall LC,
SmallVectorImpl<SDValue> &Results) { … }
void SelectionDAGLegalize::ExpandFPLibCall(SDNode* Node,
RTLIB::Libcall Call_F32,
RTLIB::Libcall Call_F64,
RTLIB::Libcall Call_F80,
RTLIB::Libcall Call_F128,
RTLIB::Libcall Call_PPCF128,
SmallVectorImpl<SDValue> &Results) { … }
SDValue SelectionDAGLegalize::ExpandIntLibCall(SDNode* Node, bool isSigned,
RTLIB::Libcall Call_I8,
RTLIB::Libcall Call_I16,
RTLIB::Libcall Call_I32,
RTLIB::Libcall Call_I64,
RTLIB::Libcall Call_I128) { … }
void SelectionDAGLegalize::ExpandArgFPLibCall(SDNode* Node,
RTLIB::Libcall Call_F32,
RTLIB::Libcall Call_F64,
RTLIB::Libcall Call_F80,
RTLIB::Libcall Call_F128,
RTLIB::Libcall Call_PPCF128,
SmallVectorImpl<SDValue> &Results) { … }
void
SelectionDAGLegalize::ExpandDivRemLibCall(SDNode *Node,
SmallVectorImpl<SDValue> &Results) { … }
static bool isSinCosLibcallAvailable(SDNode *Node, const TargetLowering &TLI) { … }
static bool useSinCos(SDNode *Node) { … }
void
SelectionDAGLegalize::ExpandSinCosLibCall(SDNode *Node,
SmallVectorImpl<SDValue> &Results) { … }
SDValue SelectionDAGLegalize::expandLdexp(SDNode *Node) const { … }
SDValue SelectionDAGLegalize::expandFrexp(SDNode *Node) const { … }
SDValue SelectionDAGLegalize::ExpandLegalINT_TO_FP(SDNode *Node,
SDValue &Chain) { … }
void SelectionDAGLegalize::PromoteLegalINT_TO_FP(
SDNode *N, const SDLoc &dl, SmallVectorImpl<SDValue> &Results) { … }
void SelectionDAGLegalize::PromoteLegalFP_TO_INT(SDNode *N, const SDLoc &dl,
SmallVectorImpl<SDValue> &Results) { … }
SDValue SelectionDAGLegalize::PromoteLegalFP_TO_INT_SAT(SDNode *Node,
const SDLoc &dl) { … }
SDValue SelectionDAGLegalize::ExpandPARITY(SDValue Op, const SDLoc &dl) { … }
SDValue SelectionDAGLegalize::PromoteReduction(SDNode *Node) { … }
bool SelectionDAGLegalize::ExpandNode(SDNode *Node) { … }
void SelectionDAGLegalize::ConvertNodeToLibcall(SDNode *Node) { … }
static MVT getPromotedVectorElementType(const TargetLowering &TLI,
MVT EltVT, MVT NewEltVT) { … }
void SelectionDAGLegalize::PromoteNode(SDNode *Node) { … }
void SelectionDAG::Legalize() { … }
bool SelectionDAG::LegalizeOp(SDNode *N,
SmallSetVector<SDNode *, 16> &UpdatedNodes) { … }