-
Notifications
You must be signed in to change notification settings - Fork 11.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[X86] Use X86AS::GS and X86AS::FS instead of 256 and 257. NFC #109342
Conversation
@llvm/pr-subscribers-clang-codegen @llvm/pr-subscribers-backend-x86 Author: Craig Topper (topperc) ChangesFull diff: https://github.com/llvm/llvm-project/pull/109342.diff 4 Files Affected:
diff --git a/clang/lib/CodeGen/CMakeLists.txt b/clang/lib/CodeGen/CMakeLists.txt
index aa0c871c5352a8..868ec847b9634b 100644
--- a/clang/lib/CodeGen/CMakeLists.txt
+++ b/clang/lib/CodeGen/CMakeLists.txt
@@ -144,6 +144,7 @@ add_clang_library(clangCodeGen
VarBypassDetector.cpp
DEPENDS
+ vt_gen
intrinsics_gen
ClangDriverOptions
# These generated headers are included transitively.
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);
}
|
clang/lib/CodeGen/CMakeLists.txt
Outdated
@@ -144,6 +144,7 @@ add_clang_library(clangCodeGen | |||
VarBypassDetector.cpp | |||
|
|||
DEPENDS | |||
vt_gen |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why it depends?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know how that got in here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That change is c3fe727, but I'm not sure how it got squashed into my commit. I rebased so its gone now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
No description provided.