Skip to content

Commit 881ada5

Browse files
committed
[clang] Support -Wa, options -mmsa and -mno-msa
1 parent c813667 commit 881ada5

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

clang/include/clang/Basic/CodeGenOptions.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ CODEGENOPT(MergeAllConstants , 1, 1) ///< Merge identical constants.
178178
CODEGENOPT(MergeFunctions , 1, 0) ///< Set when -fmerge-functions is enabled.
179179
CODEGENOPT(NoCommon , 1, 0) ///< Set when -fno-common or C++ is enabled.
180180
CODEGENOPT(NoExecStack , 1, 0) ///< Set when -Wa,--noexecstack is enabled.
181+
CODEGENOPT(Msa , 1, 0) ///< Set when -Wa,-mmsa is enabled.
181182
CODEGENOPT(FatalWarnings , 1, 0) ///< Set when -Wa,--fatal-warnings is
182183
///< enabled.
183184
CODEGENOPT(NoWarn , 1, 0) ///< Set when -Wa,--no-warn is enabled.

clang/include/clang/Driver/Options.td

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5337,7 +5337,9 @@ def mmadd4 : Flag<["-"], "mmadd4">, Group<m_mips_Features_Group>,
53375337
def mno_madd4 : Flag<["-"], "mno-madd4">, Group<m_mips_Features_Group>,
53385338
HelpText<"Disable the generation of 4-operand madd.s, madd.d and related instructions.">;
53395339
def mmsa : Flag<["-"], "mmsa">, Group<m_mips_Features_Group>,
5340-
HelpText<"Enable MSA ASE (MIPS only)">;
5340+
Visibility<[ClangOption, CC1Option, CC1AsOption]>,
5341+
HelpText<"Enable MSA ASE (MIPS only)">,
5342+
MarshallingInfoFlag<CodeGenOpts<"Msa">>;
53415343
def mno_msa : Flag<["-"], "mno-msa">, Group<m_mips_Features_Group>,
53425344
HelpText<"Disable MSA ASE (MIPS only)">;
53435345
def mmt : Flag<["-"], "mmt">, Group<m_mips_Features_Group>,

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2507,6 +2507,7 @@ static void CollectArgsForIntegratedAssembler(Compilation &C,
25072507
bool Crel = false, ExperimentalCrel = false;
25082508
bool UseRelaxRelocations = C.getDefaultToolChain().useRelaxRelocations();
25092509
bool UseNoExecStack = false;
2510+
bool Msa = false;
25102511
const char *MipsTargetFeature = nullptr;
25112512
StringRef ImplicitIt;
25122513
for (const Arg *A :
@@ -2630,6 +2631,10 @@ static void CollectArgsForIntegratedAssembler(Compilation &C,
26302631
CmdArgs.push_back("-massembler-no-warn");
26312632
} else if (Value == "--noexecstack") {
26322633
UseNoExecStack = true;
2634+
} else if (Value == "-mmsa") {
2635+
Msa = true;
2636+
} else if (Value == "-mno-msa") {
2637+
Msa = false;
26332638
} else if (Value.starts_with("-compress-debug-sections") ||
26342639
Value.starts_with("--compress-debug-sections") ||
26352640
Value == "-nocompress-debug-sections" ||
@@ -2716,6 +2721,8 @@ static void CollectArgsForIntegratedAssembler(Compilation &C,
27162721
<< "-Wa,--crel" << D.getTargetTriple();
27172722
}
27182723
}
2724+
if (Msa)
2725+
CmdArgs.push_back("-mmsa");
27192726
if (!UseRelaxRelocations)
27202727
CmdArgs.push_back("-mrelax-relocations=no");
27212728
if (UseNoExecStack)

0 commit comments

Comments
 (0)