llvm-project/llvm/lib/Target/PowerPC/PPCSelectionDAGInfo.cpp
zhijian lin be6c4d933d
[PowerPC] using milicode call for strlen instead of lib call (#153600)
AIX has "millicode" routines, which are functions loaded at boot time
into fixed addresses in kernel memory. This allows them to be customized
for the processor. The __strlen routine is a millicode implementation;
we use millicode for the strlen function instead of a library call to
improve performance.
2025-09-19 10:02:21 -04:00

38 lines
1.4 KiB
C++

//===----------------------------------------------------------------------===//
//
// 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
//
//===----------------------------------------------------------------------===//
#include "PPCSelectionDAGInfo.h"
#include "PPCISelLowering.h"
using namespace llvm;
PPCSelectionDAGInfo::~PPCSelectionDAGInfo() = default;
bool PPCSelectionDAGInfo::isTargetMemoryOpcode(unsigned Opcode) const {
return Opcode >= PPCISD::FIRST_MEMORY_OPCODE &&
Opcode <= PPCISD::LAST_MEMORY_OPCODE;
}
bool PPCSelectionDAGInfo::isTargetStrictFPOpcode(unsigned Opcode) const {
return Opcode >= PPCISD::FIRST_STRICTFP_OPCODE &&
Opcode <= PPCISD::LAST_STRICTFP_OPCODE;
}
std::pair<SDValue, SDValue> PPCSelectionDAGInfo::EmitTargetCodeForMemcmp(
SelectionDAG &DAG, const SDLoc &dl, SDValue Chain, SDValue Op1, SDValue Op2,
SDValue Op3, const CallInst *CI) const {
return DAG.getMemcmp(Chain, dl, Op1, Op2, Op3, CI);
}
std::pair<SDValue, SDValue>
PPCSelectionDAGInfo::EmitTargetCodeForStrlen(SelectionDAG &DAG, const SDLoc &DL,
SDValue Chain, SDValue Src,
const CallInst *CI) const {
return DAG.getStrlen(Chain, DL, Src, CI);
}