Skip to content

Commit 8274be5

Browse files
committed
[AArch64] Remove header dependencies of AArch64ISelLowering.h. NFC
This patch aims to reduce the include used by AArch64ISelLowering, allowing it to be included by unittests so that they can reference the AArch64ISD nodes. It: - Moves the inclusion of AArch64SMEAttributes.h to the uses. - Moves LowerPtrAuthGlobalAddressStatically to a static function, so that AArch64PACKey is not required in the header. - Moves the definitions of getExceptionPointerRegister to the cpp file, to remove the reference of AArch64::X0.
1 parent b54bc10 commit 8274be5

File tree

7 files changed

+27
-17
lines changed

7 files changed

+27
-17
lines changed

llvm/lib/Target/AArch64/AArch64FastISel.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "AArch64Subtarget.h"
2020
#include "MCTargetDesc/AArch64AddressingModes.h"
2121
#include "Utils/AArch64BaseInfo.h"
22+
#include "Utils/AArch64SMEAttributes.h"
2223
#include "llvm/ADT/APFloat.h"
2324
#include "llvm/ADT/APInt.h"
2425
#include "llvm/ADT/DenseMap.h"

llvm/lib/Target/AArch64/AArch64FrameLowering.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,7 @@
212212
#include "AArch64TargetMachine.h"
213213
#include "MCTargetDesc/AArch64AddressingModes.h"
214214
#include "MCTargetDesc/AArch64MCTargetDesc.h"
215+
#include "Utils/AArch64SMEAttributes.h"
215216
#include "llvm/ADT/ScopeExit.h"
216217
#include "llvm/ADT/SmallVector.h"
217218
#include "llvm/ADT/Statistic.h"

llvm/lib/Target/AArch64/AArch64ISelLowering.cpp

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include "AArch64Subtarget.h"
2020
#include "MCTargetDesc/AArch64AddressingModes.h"
2121
#include "Utils/AArch64BaseInfo.h"
22+
#include "Utils/AArch64SMEAttributes.h"
2223
#include "llvm/ADT/APFloat.h"
2324
#include "llvm/ADT/APInt.h"
2425
#include "llvm/ADT/ArrayRef.h"
@@ -10082,9 +10083,9 @@ SDValue AArch64TargetLowering::LowerGlobalTLSAddress(SDValue Op,
1008210083
// Thus, it's only used for ptrauth references to extern_weak to avoid null
1008310084
// checks.
1008410085

10085-
SDValue AArch64TargetLowering::LowerPtrAuthGlobalAddressStatically(
10086+
static SDValue LowerPtrAuthGlobalAddressStatically(
1008610087
SDValue TGA, SDLoc DL, EVT VT, AArch64PACKey::ID KeyC,
10087-
SDValue Discriminator, SDValue AddrDiscriminator, SelectionDAG &DAG) const {
10088+
SDValue Discriminator, SDValue AddrDiscriminator, SelectionDAG &DAG) {
1008810089
const auto *TGN = cast<GlobalAddressSDNode>(TGA.getNode());
1008910090
assert(TGN->getGlobal()->hasExternalWeakLinkage());
1009010091

@@ -27574,6 +27575,22 @@ AArch64TargetLowering::getSafeStackPointerLocation(IRBuilderBase &IRB) const {
2757427575
return TargetLowering::getSafeStackPointerLocation(IRB);
2757527576
}
2757627577

27578+
/// If a physical register, this returns the register that receives the
27579+
/// exception address on entry to an EH pad.
27580+
Register AArch64TargetLowering::getExceptionPointerRegister(
27581+
const Constant *PersonalityFn) const {
27582+
// FIXME: This is a guess. Has this been defined yet?
27583+
return AArch64::X0;
27584+
}
27585+
27586+
/// If a physical register, this returns the register that receives the
27587+
/// exception typeid on entry to a landing pad.
27588+
Register AArch64TargetLowering::getExceptionSelectorRegister(
27589+
const Constant *PersonalityFn) const {
27590+
// FIXME: This is a guess. Has this been defined yet?
27591+
return AArch64::X1;
27592+
}
27593+
2757727594
bool AArch64TargetLowering::isMaskAndCmp0FoldingBeneficial(
2757827595
const Instruction &AndI) const {
2757927596
// Only sink 'and' mask to cmp use block if it is masking a single bit, since

llvm/lib/Target/AArch64/AArch64ISelLowering.h

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
#ifndef LLVM_LIB_TARGET_AARCH64_AARCH64ISELLOWERING_H
1515
#define LLVM_LIB_TARGET_AARCH64_AARCH64ISELLOWERING_H
1616

17-
#include "AArch64.h"
18-
#include "Utils/AArch64SMEAttributes.h"
1917
#include "llvm/CodeGen/CallingConvLower.h"
2018
#include "llvm/CodeGen/MachineFunction.h"
2119
#include "llvm/CodeGen/SelectionDAG.h"
@@ -830,18 +828,12 @@ class AArch64TargetLowering : public TargetLowering {
830828
/// If a physical register, this returns the register that receives the
831829
/// exception address on entry to an EH pad.
832830
Register
833-
getExceptionPointerRegister(const Constant *PersonalityFn) const override {
834-
// FIXME: This is a guess. Has this been defined yet?
835-
return AArch64::X0;
836-
}
831+
getExceptionPointerRegister(const Constant *PersonalityFn) const override;
837832

838833
/// If a physical register, this returns the register that receives the
839834
/// exception typeid on entry to a landing pad.
840835
Register
841-
getExceptionSelectorRegister(const Constant *PersonalityFn) const override {
842-
// FIXME: This is a guess. Has this been defined yet?
843-
return AArch64::X1;
844-
}
836+
getExceptionSelectorRegister(const Constant *PersonalityFn) const override;
845837

846838
bool isIntDivCheap(EVT VT, AttributeList Attr) const override;
847839

@@ -1132,11 +1124,6 @@ class AArch64TargetLowering : public TargetLowering {
11321124
SelectionDAG &DAG) const;
11331125
SDValue LowerWindowsGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const;
11341126
SDValue LowerPtrAuthGlobalAddress(SDValue Op, SelectionDAG &DAG) const;
1135-
SDValue LowerPtrAuthGlobalAddressStatically(SDValue TGA, SDLoc DL, EVT VT,
1136-
AArch64PACKey::ID Key,
1137-
SDValue Discriminator,
1138-
SDValue AddrDiscriminator,
1139-
SelectionDAG &DAG) const;
11401127
SDValue LowerSETCC(SDValue Op, SelectionDAG &DAG) const;
11411128
SDValue LowerSETCCCARRY(SDValue Op, SelectionDAG &DAG) const;
11421129
SDValue LowerBR_CC(SDValue Op, SelectionDAG &DAG) const;

llvm/lib/Target/AArch64/AArch64SelectionDAGInfo.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
//===----------------------------------------------------------------------===//
1212

1313
#include "AArch64TargetMachine.h"
14+
#include "Utils/AArch64SMEAttributes.h"
15+
1416
using namespace llvm;
1517

1618
#define DEBUG_TYPE "aarch64-selectiondag-info"

llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "AArch64ExpandImm.h"
1111
#include "AArch64PerfectShuffle.h"
1212
#include "MCTargetDesc/AArch64AddressingModes.h"
13+
#include "Utils/AArch64SMEAttributes.h"
1314
#include "llvm/Analysis/IVDescriptors.h"
1415
#include "llvm/Analysis/LoopInfo.h"
1516
#include "llvm/Analysis/TargetTransformInfo.h"

llvm/lib/Target/AArch64/GISel/AArch64CallLowering.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "AArch64MachineFunctionInfo.h"
1919
#include "AArch64RegisterInfo.h"
2020
#include "AArch64Subtarget.h"
21+
#include "Utils/AArch64SMEAttributes.h"
2122
#include "llvm/ADT/ArrayRef.h"
2223
#include "llvm/ADT/SmallVector.h"
2324
#include "llvm/Analysis/ObjCARCUtil.h"

0 commit comments

Comments
 (0)