LLVM 22.0.0git
MipsISelLowering.cpp File Reference
#include "MipsISelLowering.h"
#include "MCTargetDesc/MipsBaseInfo.h"
#include "MCTargetDesc/MipsInstPrinter.h"
#include "MCTargetDesc/MipsMCTargetDesc.h"
#include "MipsCCState.h"
#include "MipsInstrInfo.h"
#include "MipsMachineFunction.h"
#include "MipsRegisterInfo.h"
#include "MipsSubtarget.h"
#include "MipsTargetMachine.h"
#include "MipsTargetObjectFile.h"
#include "llvm/ADT/APFloat.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/Statistic.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/CodeGen/CallingConvLower.h"
#include "llvm/CodeGen/FunctionLoweringInfo.h"
#include "llvm/CodeGen/ISDOpcodes.h"
#include "llvm/CodeGen/MachineBasicBlock.h"
#include "llvm/CodeGen/MachineFrameInfo.h"
#include "llvm/CodeGen/MachineFunction.h"
#include "llvm/CodeGen/MachineInstr.h"
#include "llvm/CodeGen/MachineInstrBuilder.h"
#include "llvm/CodeGen/MachineJumpTableInfo.h"
#include "llvm/CodeGen/MachineMemOperand.h"
#include "llvm/CodeGen/MachineOperand.h"
#include "llvm/CodeGen/MachineRegisterInfo.h"
#include "llvm/CodeGen/SelectionDAG.h"
#include "llvm/CodeGen/SelectionDAGNodes.h"
#include "llvm/CodeGen/TargetFrameLowering.h"
#include "llvm/CodeGen/TargetInstrInfo.h"
#include "llvm/CodeGen/TargetRegisterInfo.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/DebugLoc.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/Value.h"
#include "llvm/MC/MCContext.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/CodeGen.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Compiler.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/MathExtras.h"
#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetOptions.h"
#include <algorithm>
#include <cassert>
#include <cctype>
#include <cstdint>
#include <deque>
#include <iterator>
#include <utility>
#include <vector>
#include "MipsGenCallingConv.inc"

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "mips-lower"

Functions

 STATISTIC (NumTailCalls, "Number of tail calls")
static SDValue performDivRemCombine (SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const MipsSubtarget &Subtarget)
static Mips::CondCode condCodeToFCC (ISD::CondCode CC)
static bool invertFPCondCodeUser (Mips::CondCode CC)
 This function returns true if the floating point conditional branches and conditional moves which use condition code CC should be inverted.
static SDValue createFPCmp (SelectionDAG &DAG, const SDValue &Op)
static SDValue createCMovFP (SelectionDAG &DAG, SDValue Cond, SDValue True, SDValue False, const SDLoc &DL)
static SDValue performSELECTCombine (SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const MipsSubtarget &Subtarget)
static SDValue performCMovFPCombine (SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const MipsSubtarget &Subtarget)
static SDValue performANDCombine (SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const MipsSubtarget &Subtarget)
static SDValue performORCombine (SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const MipsSubtarget &Subtarget)
static SDValue performMADD_MSUBCombine (SDNode *ROOTNode, SelectionDAG &CurDAG, const MipsSubtarget &Subtarget)
static SDValue performSUBCombine (SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const MipsSubtarget &Subtarget)
static SDValue performADDCombine (SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const MipsSubtarget &Subtarget)
static SDValue performSHLCombine (SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const MipsSubtarget &Subtarget)
static SDValue performSignExtendCombine (SDNode *N, SelectionDAG &DAG, TargetLowering::DAGCombinerInfo &DCI, const MipsSubtarget &Subtarget)
static unsigned addLiveIn (MachineFunction &MF, unsigned PReg, const TargetRegisterClass *RC)
static MachineBasicBlockinsertDivByZeroTrap (MachineInstr &MI, MachineBasicBlock &MBB, const TargetInstrInfo &TII, bool Is64Bit, bool IsMicroMips)
static SDValue lowerFCOPYSIGN32 (SDValue Op, SelectionDAG &DAG, bool HasExtractInsert)
static SDValue lowerFCOPYSIGN64 (SDValue Op, SelectionDAG &DAG, bool HasExtractInsert)
static SDValue createLoadLR (unsigned Opc, SelectionDAG &DAG, LoadSDNode *LD, SDValue Chain, SDValue Src, unsigned Offset)
static SDValue createStoreLR (unsigned Opc, SelectionDAG &DAG, StoreSDNode *SD, SDValue Chain, unsigned Offset)
static SDValue lowerUnalignedIntStore (StoreSDNode *SD, SelectionDAG &DAG, bool IsLittle)
static SDValue lowerFP_TO_SINT_STORE (StoreSDNode *SD, SelectionDAG &DAG, bool SingleFloat)
static bool CC_MipsO32 (unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, Type *OrigTy, CCState &State, ArrayRef< MCPhysReg > F64Regs)
static bool CC_MipsO32_FP32 (unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, Type *OrigTy, CCState &State)
static bool CC_MipsO32_FP64 (unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, Type *OrigTy, CCState &State)
static bool CC_MipsO32 (unsigned ValNo, MVT ValVT, MVT LocVT, CCValAssign::LocInfo LocInfo, ISD::ArgFlagsTy ArgFlags, Type *OrigTy, CCState &State) LLVM_ATTRIBUTE_UNUSED
static SDValue UnpackFromArgumentSlot (SDValue Val, const CCValAssign &VA, EVT ArgVT, const SDLoc &DL, SelectionDAG &DAG)
static std::pair< bool, boolparsePhysicalReg (StringRef C, StringRef &Prefix, unsigned long long &Reg)
 This is a helper function to parse a physical register string and split it into non-numeric and numeric parts (Prefix and Reg).

Variables

static cl::opt< boolNoZeroDivCheck ("mno-check-zero-division", cl::Hidden, cl::desc("MIPS: Don't trap on integer division by zero."), cl::init(false))
cl::opt< boolEmitJalrReloc
static const MCPhysReg Mips64DPRegs [8]

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "mips-lower"

Definition at line 80 of file MipsISelLowering.cpp.

Function Documentation

◆ addLiveIn()

◆ CC_MipsO32() [1/2]

bool CC_MipsO32 ( unsigned ValNo,
MVT ValVT,
MVT LocVT,
CCValAssign::LocInfo LocInfo,
ISD::ArgFlagsTy ArgFlags,
Type * OrigTy,
CCState & State )
static

References LLVM_ATTRIBUTE_UNUSED.

◆ CC_MipsO32() [2/2]

◆ CC_MipsO32_FP32()

bool CC_MipsO32_FP32 ( unsigned ValNo,
MVT ValVT,
MVT LocVT,
CCValAssign::LocInfo LocInfo,
ISD::ArgFlagsTy ArgFlags,
Type * OrigTy,
CCState & State )
static

Definition at line 3159 of file MipsISelLowering.cpp.

References CC_MipsO32().

◆ CC_MipsO32_FP64()

bool CC_MipsO32_FP64 ( unsigned ValNo,
MVT ValVT,
MVT LocVT,
CCValAssign::LocInfo LocInfo,
ISD::ArgFlagsTy ArgFlags,
Type * OrigTy,
CCState & State )
static

Definition at line 3169 of file MipsISelLowering.cpp.

References CC_MipsO32().

◆ condCodeToFCC()

◆ createCMovFP()

◆ createFPCmp()

◆ createLoadLR()

◆ createStoreLR()

◆ insertDivByZeroTrap()

◆ invertFPCondCodeUser()

bool invertFPCondCodeUser ( Mips::CondCode CC)
static

This function returns true if the floating point conditional branches and conditional moves which use condition code CC should be inverted.

Definition at line 650 of file MipsISelLowering.cpp.

References assert(), llvm::Mips::FCOND_F, llvm::Mips::FCOND_GT, llvm::Mips::FCOND_NGT, and llvm::Mips::FCOND_T.

Referenced by createCMovFP().

◆ lowerFCOPYSIGN32()

◆ lowerFCOPYSIGN64()

◆ lowerFP_TO_SINT_STORE()

◆ lowerUnalignedIntStore()

◆ parsePhysicalReg()

std::pair< bool, bool > parsePhysicalReg ( StringRef C,
StringRef & Prefix,
unsigned long long & Reg )
static

This is a helper function to parse a physical register string and split it into non-numeric and numeric parts (Prefix and Reg).

The first boolean flag that is returned indicates whether parsing was successful. The second flag is true if the numeric part exists.

Definition at line 4191 of file MipsISelLowering.cpp.

References B(), llvm::CallingConv::C, E(), llvm::getAsUnsignedInteger(), I, and Reg.

◆ performADDCombine()

◆ performANDCombine()

◆ performCMovFPCombine()

◆ performDivRemCombine()

◆ performMADD_MSUBCombine()

◆ performORCombine()

◆ performSELECTCombine()

◆ performSHLCombine()

◆ performSignExtendCombine()

◆ performSUBCombine()

◆ STATISTIC()

STATISTIC ( NumTailCalls ,
"Number of tail calls"  )

◆ UnpackFromArgumentSlot()

Variable Documentation

◆ EmitJalrReloc

cl::opt<bool> EmitJalrReloc
extern

◆ Mips64DPRegs

const MCPhysReg Mips64DPRegs[8]
static
Initial value:
= {
Mips::D12_64, Mips::D13_64, Mips::D14_64, Mips::D15_64,
Mips::D16_64, Mips::D17_64, Mips::D18_64, Mips::D19_64
}

Definition at line 91 of file MipsISelLowering.cpp.

Referenced by llvm::MipsTargetLowering::HandleByVal().

◆ NoZeroDivCheck

cl::opt< bool > NoZeroDivCheck("mno-check-zero-division", cl::Hidden, cl::desc("MIPS: Don't trap on integer division by zero."), cl::init(false)) ( "mno-check-zero-division" ,
cl::Hidden ,
cl::desc("MIPS: Don't trap on integer division by zero.") ,
cl::init(false)  )
static

Referenced by insertDivByZeroTrap().