CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
108 lines
3.8 KiB
C++
108 lines
3.8 KiB
C++
//=- LoongArchISelDAGToDAG.h - A dag to dag inst selector for LoongArch ---===//
|
|
//
|
|
// 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 defines an instruction selector for the LoongArch target.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#ifndef LLVM_LIB_TARGET_LOONGARCH_LOONGARCHISELDAGTODAG_H
|
|
#define LLVM_LIB_TARGET_LOONGARCH_LOONGARCHISELDAGTODAG_H
|
|
|
|
#include "LoongArch.h"
|
|
#include "LoongArchSelectionDAGInfo.h"
|
|
#include "LoongArchTargetMachine.h"
|
|
#include "llvm/CodeGen/SelectionDAGISel.h"
|
|
|
|
// LoongArch-specific code to select LoongArch machine instructions for
|
|
// SelectionDAG operations.
|
|
namespace llvm {
|
|
class LoongArchDAGToDAGISel : public SelectionDAGISel {
|
|
const LoongArchSubtarget *Subtarget = nullptr;
|
|
|
|
public:
|
|
LoongArchDAGToDAGISel() = delete;
|
|
|
|
explicit LoongArchDAGToDAGISel(LoongArchTargetMachine &TM,
|
|
CodeGenOptLevel OptLevel)
|
|
: SelectionDAGISel(TM, OptLevel) {}
|
|
|
|
bool runOnMachineFunction(MachineFunction &MF) override {
|
|
Subtarget = &MF.getSubtarget<LoongArchSubtarget>();
|
|
return SelectionDAGISel::runOnMachineFunction(MF);
|
|
}
|
|
|
|
void Select(SDNode *Node) override;
|
|
|
|
bool SelectInlineAsmMemoryOperand(const SDValue &Op,
|
|
InlineAsm::ConstraintCode ConstraintID,
|
|
std::vector<SDValue> &OutOps) override;
|
|
|
|
bool SelectBaseAddr(SDValue Addr, SDValue &Base);
|
|
bool SelectAddrConstant(SDValue Addr, SDValue &Base, SDValue &Offset);
|
|
bool selectNonFIBaseAddr(SDValue Addr, SDValue &Base);
|
|
bool SelectAddrRegImm12(SDValue Addr, SDValue &Base, SDValue &Offset);
|
|
|
|
bool selectShiftMask(SDValue N, unsigned ShiftWidth, SDValue &ShAmt);
|
|
bool selectShiftMaskGRLen(SDValue N, SDValue &ShAmt) {
|
|
return selectShiftMask(N, Subtarget->getGRLen(), ShAmt);
|
|
}
|
|
bool selectShiftMask32(SDValue N, SDValue &ShAmt) {
|
|
return selectShiftMask(N, 32, ShAmt);
|
|
}
|
|
|
|
bool selectSExti32(SDValue N, SDValue &Val);
|
|
bool selectZExti32(SDValue N, SDValue &Val);
|
|
|
|
bool selectVSplat(SDNode *N, APInt &Imm, unsigned MinSizeInBits) const;
|
|
|
|
template <unsigned ImmSize, unsigned EltSize = 0, bool IsSigned = false>
|
|
bool selectVSplatImm(SDValue N, SDValue &SplatVal);
|
|
template <unsigned ImmSize>
|
|
bool selectVSplatImmNeg(SDValue N, SDValue &SplatVal) const;
|
|
template <unsigned EltSize = 0>
|
|
bool selectVSplatUimmInvPow2(SDValue N, SDValue &SplatImm) const;
|
|
template <unsigned EltSize = 0>
|
|
bool selectVSplatUimmPow2(SDValue N, SDValue &SplatImm) const;
|
|
|
|
// Return the LoongArch branch opcode that matches the given DAG integer
|
|
// condition code. The CondCode must be one of those supported by the
|
|
// LoongArch ISA (see translateSetCCForBranch).
|
|
static unsigned getBranchOpcForIntCC(ISD::CondCode CC) {
|
|
switch (CC) {
|
|
default:
|
|
llvm_unreachable("Unsupported CondCode");
|
|
case ISD::SETEQ:
|
|
return LoongArch::BEQ;
|
|
case ISD::SETNE:
|
|
return LoongArch::BNE;
|
|
case ISD::SETLT:
|
|
return LoongArch::BLT;
|
|
case ISD::SETGE:
|
|
return LoongArch::BGE;
|
|
case ISD::SETULT:
|
|
return LoongArch::BLTU;
|
|
case ISD::SETUGE:
|
|
return LoongArch::BGEU;
|
|
}
|
|
}
|
|
|
|
// Include the pieces autogenerated from the target description.
|
|
#include "LoongArchGenDAGISel.inc"
|
|
};
|
|
|
|
class LoongArchDAGToDAGISelLegacy : public SelectionDAGISelLegacy {
|
|
public:
|
|
static char ID;
|
|
explicit LoongArchDAGToDAGISelLegacy(LoongArchTargetMachine &TM,
|
|
CodeGenOptLevel OptLevel);
|
|
};
|
|
|
|
} // end namespace llvm
|
|
|
|
#endif // LLVM_LIB_TARGET_LOONGARCH_LOONGARCHISELDAGTODAG_H
|