Skip to content

[X86] Remove X86RegisterInfo::getSEHRegNum. #106866

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

Merged
merged 1 commit into from
Sep 1, 2024

Conversation

topperc
Copy link
Collaborator

@topperc topperc commented Aug 31, 2024

As far as I can tell, there's no way to call this. There are no calls in the X86 directory. It has the same name as a function in MCRegisterInfo, but that function takes a MCRegister and isn't virtual.

The function in MCRegisterInfo uses a DenseMap populated by X86_MC::initLLVMToSEHAndCVRegMapping. The DenseMap is populated for every physical register using the encoding value. I think that means the function in MCRegisterInfo would return the same value as the function in X86RegisterInfo.

As far as I can tell, there's no way to call this. There are no
calls in the X86 directory. It has the same name as a function
in MCRegisterInfo, but that function takes a MCRegister and isn't
virtual.

The function in MCRegisterInfo uses a DenseMap populated by
initLLVMToSEHAndCVRegMapping. The DenseMap is populated for every
physical register using the encoding value. I think that means
the function in MCRegisterInfo would return the same value as the
function in X86RegisterInfo.
@llvmbot
Copy link
Member

llvmbot commented Aug 31, 2024

@llvm/pr-subscribers-backend-x86

Author: Craig Topper (topperc)

Changes

As far as I can tell, there's no way to call this. There are no calls in the X86 directory. It has the same name as a function in MCRegisterInfo, but that function takes a MCRegister and isn't virtual.

The function in MCRegisterInfo uses a DenseMap populated by X86_MC::initLLVMToSEHAndCVRegMapping. The DenseMap is populated for every physical register using the encoding value. I think that means the function in MCRegisterInfo would return the same value as the function in X86RegisterInfo.


Full diff: https://github.com/llvm/llvm-project/pull/106866.diff

2 Files Affected:

  • (modified) llvm/lib/Target/X86/X86RegisterInfo.cpp (-5)
  • (modified) llvm/lib/Target/X86/X86RegisterInfo.h (-3)
diff --git a/llvm/lib/Target/X86/X86RegisterInfo.cpp b/llvm/lib/Target/X86/X86RegisterInfo.cpp
index 638eb1c4f11e41..1d8808f4e2b7d0 100644
--- a/llvm/lib/Target/X86/X86RegisterInfo.cpp
+++ b/llvm/lib/Target/X86/X86RegisterInfo.cpp
@@ -83,11 +83,6 @@ X86RegisterInfo::X86RegisterInfo(const Triple &TT)
   }
 }
 
-int
-X86RegisterInfo::getSEHRegNum(unsigned i) const {
-  return getEncodingValue(i);
-}
-
 const TargetRegisterClass *
 X86RegisterInfo::getSubClassWithSubReg(const TargetRegisterClass *RC,
                                        unsigned Idx) const {
diff --git a/llvm/lib/Target/X86/X86RegisterInfo.h b/llvm/lib/Target/X86/X86RegisterInfo.h
index 7296a5f021e4ad..2f73698a4b94d3 100644
--- a/llvm/lib/Target/X86/X86RegisterInfo.h
+++ b/llvm/lib/Target/X86/X86RegisterInfo.h
@@ -54,9 +54,6 @@ class X86RegisterInfo final : public X86GenRegisterInfo {
   /// Return the number of registers for the function.
   unsigned getNumSupportedRegs(const MachineFunction &MF) const override;
 
-  // FIXME: This should be tablegen'd like getDwarfRegNum is
-  int getSEHRegNum(unsigned i) const;
-
   /// getMatchingSuperRegClass - Return a subclass of the specified register
   /// class A so that each register in it has a sub-register of the
   /// specified sub-register index which is in the specified register class B.

@topperc topperc requested a review from rnk August 31, 2024 18:37
Copy link
Contributor

@phoebewang phoebewang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The ARM/AArch64 definition also look redundant.

@topperc
Copy link
Collaborator Author

topperc commented Sep 1, 2024

The ARM/AArch64 definition also look redundant.

ARM/AArch64 has callers and they don't populate the DenseMap in MCRegisterInfo like X86_MC::initLLVMToSEHAndCVRegMapping unless I missed it?

@topperc topperc merged commit feb391c into llvm:main Sep 1, 2024
10 checks passed
@topperc topperc deleted the pr/x86-sehregnum branch September 1, 2024 06:53
@llvm-ci
Copy link
Collaborator

llvm-ci commented Sep 1, 2024

LLVM Buildbot has detected a new failure on builder clang-armv8-quick running on linaro-clang-armv8-quick while building llvm at step 5 "ninja check 1".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/154/builds/3663

Here is the relevant piece of the build log for the reference
Step 5 (ninja check 1) failure: stage 1 checked (failure)
******************** TEST 'ClangPseudo :: crash/backslashes.c' FAILED ********************
Exit Code: 134

Command Output (stderr):
--
RUN: at line 2: clang-pseudo -source=/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang-tools-extra/pseudo/test/crash/backslashes.c -print-tokens
+ clang-pseudo -source=/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang-tools-extra/pseudo/test/crash/backslashes.c -print-tokens
clang-pseudo: ../llvm/clang-tools-extra/pseudo/lib/cxx/CXX.cpp:437: auto clang::pseudo::cxx::getLanguage()::(anonymous class)::operator()() const: Assertion `Diags.empty()' failed.
#0 0x00c5535c llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/tcwg-buildbot/worker/clang-armv8-quick/stage1/bin/clang-pseudo+0x5f35c)
#1 0x00c530e4 llvm::sys::RunSignalHandlers() (/home/tcwg-buildbot/worker/clang-armv8-quick/stage1/bin/clang-pseudo+0x5d0e4)
#2 0x00c55db0 SignalHandler(int) Signals.cpp:0:0
#3 0xf7b7d6e0 __default_sa_restorer ./signal/../sysdeps/unix/sysv/linux/arm/sigrestorer.S:67:0
#4 0xf7b6db06 ./csu/../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:47:0
#5 0xf7bad292 __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
#6 0xf7b7c840 gsignal ./signal/../sysdeps/posix/raise.c:27:6
/home/tcwg-buildbot/worker/clang-armv8-quick/stage1/tools/clang/tools/extra/pseudo/test/crash/Output/backslashes.c.script: line 1: 2031102 Aborted                 clang-pseudo -source=/home/tcwg-buildbot/worker/clang-armv8-quick/llvm/clang-tools-extra/pseudo/test/crash/backslashes.c -print-tokens

--

********************


@phoebewang
Copy link
Contributor

The ARM/AArch64 definition also look redundant.

ARM/AArch64 has callers and they don't populate the DenseMap in MCRegisterInfo like X86_MC::initLLVMToSEHAndCVRegMapping unless I missed it?

That's interesting. I saw MCStreamer::emitWinCFIPushReg will call getSEHRegNum and think it should work for ARM/AArch64 too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants