[PATCH] D143049: Use ArrayRef instead of raw pointers. NFC
Serge Pavlov via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 31 23:49:57 PST 2023
sepavloff created this revision.
sepavloff added reviewers: efriedma, pengfei.
Herald added a subscriber: hiraditya.
Herald added a project: All.
sepavloff requested review of this revision.
Herald added a project: LLVM.
Change signature of TargetLowering::getRoundingControlRegisters so that
it returns ArrayRef, not plain pointer.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D143049
Files:
llvm/include/llvm/CodeGen/TargetLowering.h
llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
llvm/lib/Target/AArch64/AArch64ISelLowering.h
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/lib/Target/X86/X86ISelLowering.h
Index: llvm/lib/Target/X86/X86ISelLowering.h
===================================================================
--- llvm/lib/Target/X86/X86ISelLowering.h
+++ llvm/lib/Target/X86/X86ISelLowering.h
@@ -1702,7 +1702,7 @@
LLVMContext &Context) const override;
const MCPhysReg *getScratchRegisters(CallingConv::ID CC) const override;
- const MCPhysReg *getRoundingControlRegisters() const override;
+ ArrayRef<MCPhysReg> getRoundingControlRegisters() const override;
TargetLoweringBase::AtomicExpansionKind
shouldExpandAtomicLoadInIR(LoadInst *LI) const override;
Index: llvm/lib/Target/X86/X86ISelLowering.cpp
===================================================================
--- llvm/lib/Target/X86/X86ISelLowering.cpp
+++ llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -3097,10 +3097,10 @@
return ScratchRegs;
}
-const MCPhysReg *X86TargetLowering::getRoundingControlRegisters() const {
+ArrayRef<MCPhysReg> X86TargetLowering::getRoundingControlRegisters() const {
// FIXME: We should def X86::FPCW for x87 as well. But it affects a lot of lit
// tests at the moment, which is not what we expected.
- static const MCPhysReg RCRegs[] = { X86::MXCSR, 0 };
+ static const MCPhysReg RCRegs[] = {X86::MXCSR};
return RCRegs;
}
Index: llvm/lib/Target/AArch64/AArch64ISelLowering.h
===================================================================
--- llvm/lib/Target/AArch64/AArch64ISelLowering.h
+++ llvm/lib/Target/AArch64/AArch64ISelLowering.h
@@ -670,7 +670,7 @@
CodeGenOpt::Level OptLevel) const override;
const MCPhysReg *getScratchRegisters(CallingConv::ID CC) const override;
- const MCPhysReg *getRoundingControlRegisters() const override;
+ ArrayRef<MCPhysReg> getRoundingControlRegisters() const override;
/// Returns false if N is a bit extraction pattern of (X >> C) & Mask.
bool isDesirableToCommuteWithShift(const SDNode *N,
Index: llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
===================================================================
--- llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
+++ llvm/lib/Target/AArch64/AArch64ISelLowering.cpp
@@ -14946,8 +14946,8 @@
return ScratchRegs;
}
-const MCPhysReg *AArch64TargetLowering::getRoundingControlRegisters() const {
- static const MCPhysReg RCRegs[] = {AArch64::FPCR, 0};
+ArrayRef<MCPhysReg> AArch64TargetLowering::getRoundingControlRegisters() const {
+ static const MCPhysReg RCRegs[] = {AArch64::FPCR};
return RCRegs;
}
Index: llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
===================================================================
--- llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
+++ llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp
@@ -1163,10 +1163,9 @@
// Add rounding control registers as implicit def for function call.
if (II.isCall() && MF->getFunction().hasFnAttribute(Attribute::StrictFP)) {
- const MCPhysReg *RCRegs = TLI->getRoundingControlRegisters();
- if (RCRegs)
- for (; *RCRegs; ++RCRegs)
- UsedRegs.push_back(*RCRegs);
+ ArrayRef<MCPhysReg> RCRegs = TLI->getRoundingControlRegisters();
+ for (MCPhysReg Reg : RCRegs)
+ UsedRegs.push_back(Reg);
}
// Finally mark unused registers as dead.
Index: llvm/include/llvm/CodeGen/TargetLowering.h
===================================================================
--- llvm/include/llvm/CodeGen/TargetLowering.h
+++ llvm/include/llvm/CodeGen/TargetLowering.h
@@ -4490,8 +4490,8 @@
/// Returns a 0 terminated array of rounding control registers that can be
/// attached into strict FP call.
- virtual const MCPhysReg *getRoundingControlRegisters() const {
- return nullptr;
+ virtual ArrayRef<MCPhysReg> getRoundingControlRegisters() const {
+ return ArrayRef<MCPhysReg>();
}
/// This callback is used to prepare for a volatile or atomic load.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D143049.493845.patch
Type: text/x-patch
Size: 3892 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230201/5b7e9be2/attachment.bin>
More information about the llvm-commits
mailing list