[llvm] 6611efd - [X86] Use X86AS::GS and X86AS::FS instead of 256 and 257. NFC (#109342)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 19 23:52:36 PDT 2024
Author: Craig Topper
Date: 2024-09-19T23:52:33-07:00
New Revision: 6611efdf76f6a5355eed05f49d4ec324a224b281
URL: https://github.com/llvm/llvm-project/commit/6611efdf76f6a5355eed05f49d4ec324a224b281
DIFF: https://github.com/llvm/llvm-project/commit/6611efdf76f6a5355eed05f49d4ec324a224b281.diff
LOG: [X86] Use X86AS::GS and X86AS::FS instead of 256 and 257. NFC (#109342)
Added:
Modified:
llvm/lib/Target/X86/X86ISelLowering.cpp
llvm/lib/Target/X86/X86ISelLoweringCall.cpp
llvm/lib/Target/X86/X86WinEHState.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 9637e96c21cf52..b9c9e5703849ae 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -18925,7 +18925,7 @@ static SDValue LowerToTLSExecModel(GlobalAddressSDNode *GA, SelectionDAG &DAG,
// Get the Thread Pointer, which is %gs:0 (32-bit) or %fs:0 (64-bit).
Value *Ptr = Constant::getNullValue(
- PointerType::get(*DAG.getContext(), is64Bit ? 257 : 256));
+ PointerType::get(*DAG.getContext(), is64Bit ? X86AS::FS : X86AS::GS));
SDValue ThreadPointer =
DAG.getLoad(PtrVT, dl, DAG.getEntryNode(), DAG.getIntPtrConstant(0, dl),
@@ -19070,8 +19070,8 @@ X86TargetLowering::LowerGlobalTLSAddress(SDValue Op, SelectionDAG &DAG) const {
// %gs:0x58 (64-bit). On MinGW, __tls_array is not available, so directly
// use its literal value of 0x2C.
Value *Ptr = Constant::getNullValue(
- Subtarget.is64Bit() ? PointerType::get(*DAG.getContext(), 256)
- : PointerType::get(*DAG.getContext(), 257));
+ Subtarget.is64Bit() ? PointerType::get(*DAG.getContext(), X86AS::GS)
+ : PointerType::get(*DAG.getContext(), X86AS::FS));
SDValue TlsArray = Subtarget.is64Bit()
? DAG.getIntPtrConstant(0x58, dl)
diff --git a/llvm/lib/Target/X86/X86ISelLoweringCall.cpp b/llvm/lib/Target/X86/X86ISelLoweringCall.cpp
index 43dcaefc623bea..b9124658028da4 100644
--- a/llvm/lib/Target/X86/X86ISelLoweringCall.cpp
+++ b/llvm/lib/Target/X86/X86ISelLoweringCall.cpp
@@ -524,8 +524,9 @@ X86TargetLowering::findRepresentativeClass(const TargetRegisterInfo *TRI,
unsigned X86TargetLowering::getAddressSpace() const {
if (Subtarget.is64Bit())
- return (getTargetMachine().getCodeModel() == CodeModel::Kernel) ? 256 : 257;
- return 256;
+ return (getTargetMachine().getCodeModel() == CodeModel::Kernel) ? X86AS::GS
+ : X86AS::FS;
+ return X86AS::GS;
}
static bool hasStackGuardSlotTLS(const Triple &TargetTriple) {
diff --git a/llvm/lib/Target/X86/X86WinEHState.cpp b/llvm/lib/Target/X86/X86WinEHState.cpp
index 578d653c1e0ada..963d613ddbfe7d 100644
--- a/llvm/lib/Target/X86/X86WinEHState.cpp
+++ b/llvm/lib/Target/X86/X86WinEHState.cpp
@@ -423,7 +423,7 @@ void WinEHStatePass::linkExceptionRegistration(IRBuilder<> &Builder,
// Handler = Handler
Builder.CreateStore(Handler, Builder.CreateStructGEP(LinkTy, Link, 1));
// Next = [fs:00]
- Constant *FSZero = Constant::getNullValue(PointerType::get(C, 257));
+ Constant *FSZero = Constant::getNullValue(PointerType::get(C, X86AS::FS));
Value *Next = Builder.CreateLoad(PointerType::getUnqual(C), FSZero);
Builder.CreateStore(Next, Builder.CreateStructGEP(LinkTy, Link, 0));
// [fs:00] = Link
@@ -443,7 +443,7 @@ void WinEHStatePass::unlinkExceptionRegistration(IRBuilder<> &Builder) {
// [fs:00] = Link->Next
Value *Next = Builder.CreateLoad(PointerType::getUnqual(C),
Builder.CreateStructGEP(LinkTy, Link, 0));
- Constant *FSZero = Constant::getNullValue(PointerType::get(C, 257));
+ Constant *FSZero = Constant::getNullValue(PointerType::get(C, X86AS::FS));
Builder.CreateStore(Next, FSZero);
}
More information about the llvm-commits
mailing list