[clang] MIPS/Clang: Set HasUnalignedAccess false if +strict-align (PR #87257)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 1 09:34:58 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clang
Author: YunQiang Su (wzssyqa)
<details>
<summary>Changes</summary>
TargetInfo has HasUnalignedAccess support now. For MIPSr6, we should set it according strict-align.
For pre-R6, we always set strict-align and HasUnalignedAccess to false.
---
Full diff: https://github.com/llvm/llvm-project/pull/87257.diff
1 Files Affected:
- (modified) clang/lib/Basic/Targets/Mips.h (+6)
``````````diff
diff --git a/clang/lib/Basic/Targets/Mips.h b/clang/lib/Basic/Targets/Mips.h
index c9dcf434c93b0b..f5ce1bc735a700 100644
--- a/clang/lib/Basic/Targets/Mips.h
+++ b/clang/lib/Basic/Targets/Mips.h
@@ -318,6 +318,7 @@ class LLVM_LIBRARY_VISIBILITY MipsTargetInfo : public TargetInfo {
FPMode = isFP64Default() ? FP64 : FPXX;
NoOddSpreg = false;
bool OddSpregGiven = false;
+ bool StrictAlign = false;
for (const auto &Feature : Features) {
if (Feature == "+single-float")
@@ -330,6 +331,8 @@ class LLVM_LIBRARY_VISIBILITY MipsTargetInfo : public TargetInfo {
IsMicromips = true;
else if (Feature == "+mips32r6" || Feature == "+mips64r6")
HasUnalignedAccess = true;
+ else if (Feature == "+strict-align")
+ StrictAlign = true;
else if (Feature == "+dsp")
DspRev = std::max(DspRev, DSP1);
else if (Feature == "+dspr2")
@@ -368,6 +371,9 @@ class LLVM_LIBRARY_VISIBILITY MipsTargetInfo : public TargetInfo {
if (FPMode == FPXX && !OddSpregGiven)
NoOddSpreg = true;
+ if (StrictAlign)
+ HasUnalignedAccess = false;
+
setDataLayout();
return true;
``````````
</details>
https://github.com/llvm/llvm-project/pull/87257
More information about the cfe-commits
mailing list