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
111 lines
3.7 KiB
C++
111 lines
3.7 KiB
C++
//===-- HexagonSelectionDAGInfo.cpp - Hexagon SelectionDAG Info -----------===//
|
|
//
|
|
// 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 the HexagonSelectionDAGInfo class.
|
|
//
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
#include "HexagonSelectionDAGInfo.h"
|
|
#include "HexagonTargetMachine.h"
|
|
#include "llvm/CodeGen/SelectionDAG.h"
|
|
|
|
#define GET_SDNODE_DESC
|
|
#include "HexagonGenSDNodeInfo.inc"
|
|
|
|
using namespace llvm;
|
|
|
|
#define DEBUG_TYPE "hexagon-selectiondag-info"
|
|
|
|
HexagonSelectionDAGInfo::HexagonSelectionDAGInfo()
|
|
: SelectionDAGGenTargetInfo(HexagonGenSDNodeInfo) {}
|
|
|
|
const char *HexagonSelectionDAGInfo::getTargetNodeName(unsigned Opcode) const {
|
|
#define CASE(NAME) \
|
|
case HexagonISD::NAME: \
|
|
return "HexagonISD::" #NAME
|
|
|
|
// These nodes don't have corresponding entries in *.td files yet.
|
|
switch (static_cast<HexagonISD::NodeType>(Opcode)) {
|
|
CASE(CALLR);
|
|
CASE(VROR);
|
|
CASE(D2P);
|
|
CASE(P2D);
|
|
CASE(V2Q);
|
|
CASE(Q2V);
|
|
CASE(TL_EXTEND);
|
|
CASE(TL_TRUNCATE);
|
|
CASE(TYPECAST);
|
|
CASE(ISEL);
|
|
}
|
|
#undef CASE
|
|
|
|
return SelectionDAGGenTargetInfo::getTargetNodeName(Opcode);
|
|
}
|
|
|
|
void HexagonSelectionDAGInfo::verifyTargetNode(const SelectionDAG &DAG,
|
|
const SDNode *N) const {
|
|
switch (N->getOpcode()) {
|
|
default:
|
|
break;
|
|
case HexagonISD::VALIGNADDR:
|
|
// invalid number of operands; expected 1, got 2
|
|
case HexagonISD::VINSERTW0:
|
|
// operand #1 must have type i32, but has type v4i8/v2i16
|
|
return;
|
|
}
|
|
|
|
SelectionDAGGenTargetInfo::verifyTargetNode(DAG, N);
|
|
}
|
|
|
|
SDValue HexagonSelectionDAGInfo::EmitTargetCodeForMemcpy(
|
|
SelectionDAG &DAG, const SDLoc &dl, SDValue Chain, SDValue Dst, SDValue Src,
|
|
SDValue Size, Align Alignment, bool isVolatile, bool AlwaysInline,
|
|
MachinePointerInfo DstPtrInfo, MachinePointerInfo SrcPtrInfo) const {
|
|
ConstantSDNode *ConstantSize = dyn_cast<ConstantSDNode>(Size);
|
|
if (AlwaysInline || Alignment < Align(4) || !ConstantSize)
|
|
return SDValue();
|
|
|
|
uint64_t SizeVal = ConstantSize->getZExtValue();
|
|
if (SizeVal < 32 || (SizeVal % 8) != 0)
|
|
return SDValue();
|
|
|
|
// Special case aligned memcpys with size >= 32 bytes and a multiple of 8.
|
|
//
|
|
const TargetLowering &TLI = *DAG.getSubtarget().getTargetLowering();
|
|
TargetLowering::ArgListTy Args;
|
|
Type *ArgTy = DAG.getDataLayout().getIntPtrType(*DAG.getContext());
|
|
Args.emplace_back(Dst, ArgTy);
|
|
Args.emplace_back(Src, ArgTy);
|
|
Args.emplace_back(Size, ArgTy);
|
|
|
|
RTLIB::LibcallImpl SpecialMemcpyImpl = DAG.getLibcalls().getLibcallImpl(
|
|
RTLIB::HEXAGON_MEMCPY_LIKELY_ALIGNED_MIN32BYTES_MULT8BYTES);
|
|
if (SpecialMemcpyImpl == RTLIB::Unsupported)
|
|
return SDValue();
|
|
|
|
const MachineFunction &MF = DAG.getMachineFunction();
|
|
bool LongCalls = MF.getSubtarget<HexagonSubtarget>().useLongCalls();
|
|
unsigned Flags = LongCalls ? HexagonII::HMOTF_ConstExtended : 0;
|
|
|
|
CallingConv::ID CC =
|
|
DAG.getLibcalls().getLibcallImplCallingConv(SpecialMemcpyImpl);
|
|
|
|
TargetLowering::CallLoweringInfo CLI(DAG);
|
|
CLI.setDebugLoc(dl)
|
|
.setChain(Chain)
|
|
.setLibCallee(
|
|
CC, Type::getVoidTy(*DAG.getContext()),
|
|
DAG.getTargetExternalSymbol(
|
|
SpecialMemcpyImpl, TLI.getPointerTy(DAG.getDataLayout()), Flags),
|
|
std::move(Args))
|
|
.setDiscardResult();
|
|
|
|
std::pair<SDValue, SDValue> CallResult = TLI.LowerCallTo(CLI);
|
|
return CallResult.second;
|
|
}
|