//===-------- LegalizeTypesGeneric.cpp - Generic type legalization --------===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // This file implements generic type expansion and splitting for LegalizeTypes. // The routines here perform legalization when the details of the type (such as // whether it is an integer or a float) do not matter. // Expansion is the act of changing a computation in an illegal type to be a // computation in two identical registers of a smaller type. The Lo/Hi part // is required to be stored first in memory on little/big-endian machines. // Splitting is the act of changing a computation in an illegal type to be a // computation in two not necessarily identical registers of a smaller type. // There are no requirements on how the type is represented in memory. // //===----------------------------------------------------------------------===// #include "LegalizeTypes.h" #include "llvm/IR/DataLayout.h" usingnamespacellvm; #define DEBUG_TYPE … //===----------------------------------------------------------------------===// // Generic Result Expansion. //===----------------------------------------------------------------------===// // These routines assume that the Lo/Hi part is stored first in memory on // little/big-endian machines, followed by the Hi/Lo part. This means that // they cannot be used as is on vectors, for which Lo is always stored first. void DAGTypeLegalizer::ExpandRes_MERGE_VALUES(SDNode *N, unsigned ResNo, SDValue &Lo, SDValue &Hi) { … } void DAGTypeLegalizer::ExpandRes_BITCAST(SDNode *N, SDValue &Lo, SDValue &Hi) { … } void DAGTypeLegalizer::ExpandRes_BUILD_PAIR(SDNode *N, SDValue &Lo, SDValue &Hi) { … } void DAGTypeLegalizer::ExpandRes_EXTRACT_ELEMENT(SDNode *N, SDValue &Lo, SDValue &Hi) { … } void DAGTypeLegalizer::ExpandRes_EXTRACT_VECTOR_ELT(SDNode *N, SDValue &Lo, SDValue &Hi) { … } void DAGTypeLegalizer::ExpandRes_NormalLoad(SDNode *N, SDValue &Lo, SDValue &Hi) { … } void DAGTypeLegalizer::ExpandRes_VAARG(SDNode *N, SDValue &Lo, SDValue &Hi) { … } //===--------------------------------------------------------------------===// // Generic Operand Expansion. //===--------------------------------------------------------------------===// void DAGTypeLegalizer::IntegerToVector(SDValue Op, unsigned NumElements, SmallVectorImpl<SDValue> &Ops, EVT EltVT) { … } SDValue DAGTypeLegalizer::ExpandOp_BITCAST(SDNode *N) { … } SDValue DAGTypeLegalizer::ExpandOp_BUILD_VECTOR(SDNode *N) { … } SDValue DAGTypeLegalizer::ExpandOp_EXTRACT_ELEMENT(SDNode *N) { … } // Split the integer operand in two and create a second FAKE_USE node for // the other half. The original SDNode is updated in place. SDValue DAGTypeLegalizer::ExpandOp_FAKE_USE(SDNode *N) { … } SDValue DAGTypeLegalizer::ExpandOp_INSERT_VECTOR_ELT(SDNode *N) { … } SDValue DAGTypeLegalizer::ExpandOp_SCALAR_TO_VECTOR(SDNode *N) { … } SDValue DAGTypeLegalizer::ExpandOp_NormalStore(SDNode *N, unsigned OpNo) { … } //===--------------------------------------------------------------------===// // Generic Result Splitting. //===--------------------------------------------------------------------===// // Be careful to make no assumptions about which of Lo/Hi is stored first in // memory (for vectors it is always Lo first followed by Hi in the following // bytes; for integers and floats it is Lo first if and only if the machine is // little-endian). void DAGTypeLegalizer::SplitRes_MERGE_VALUES(SDNode *N, unsigned ResNo, SDValue &Lo, SDValue &Hi) { … } void DAGTypeLegalizer::SplitRes_Select(SDNode *N, SDValue &Lo, SDValue &Hi) { … } void DAGTypeLegalizer::SplitRes_SELECT_CC(SDNode *N, SDValue &Lo, SDValue &Hi) { … } void DAGTypeLegalizer::SplitRes_UNDEF(SDNode *N, SDValue &Lo, SDValue &Hi) { … } void DAGTypeLegalizer::SplitVecRes_AssertZext(SDNode *N, SDValue &Lo, SDValue &Hi) { … } void DAGTypeLegalizer::SplitRes_FREEZE(SDNode *N, SDValue &Lo, SDValue &Hi) { … } void DAGTypeLegalizer::SplitRes_ARITH_FENCE(SDNode *N, SDValue &Lo, SDValue &Hi) { … }