[clang] [llvm] [RISC-V] Add support for MIPS P8700 CPU (PR #117865)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 27 02:36:06 PST 2024
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff 86b69c31642e98f8357df62c09d118ad1da4e16a 7dea5e91019402c5d78349f44f2b33a4f02c2b90 --extensions h,cpp,c -- llvm/lib/Target/RISCV/RISCVLoadStoreOptimizer.cpp llvm/lib/Target/RISCV/RISCVRemoveBackToBackBranches.cpp clang/lib/Driver/ToolChains/Arch/RISCV.cpp clang/lib/Driver/ToolChains/Clang.cpp clang/lib/Driver/ToolChains/Gnu.cpp clang/lib/Driver/ToolChains/Linux.cpp clang/lib/Driver/ToolChains/RISCVToolchain.cpp clang/lib/Driver/ToolChains/RISCVToolchain.h clang/test/Misc/target-invalid-cpu-note/riscv.c llvm/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCAsmInfo.cpp llvm/lib/Target/RISCV/MCTargetDesc/RISCVMCAsmInfo.h llvm/lib/Target/RISCV/RISCV.h llvm/lib/Target/RISCV/RISCVISelLowering.cpp llvm/lib/Target/RISCV/RISCVInstrInfo.cpp llvm/lib/Target/RISCV/RISCVInstrInfo.h llvm/lib/Target/RISCV/RISCVSubtarget.cpp llvm/lib/Target/RISCV/RISCVSubtarget.h llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index a2887fe49d..3ade916958 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -2172,8 +2172,7 @@ void Clang::AddRISCVTargetArgs(const ArgList &Args,
}
}
- if (Arg *A = Args.getLastArg(options::OPT_mccmov,
- options::OPT_mno_ccmov)) {
+ if (Arg *A = Args.getLastArg(options::OPT_mccmov, options::OPT_mno_ccmov)) {
if (A->getOption().matches(options::OPT_mno_ccmov)) {
CmdArgs.push_back("-mllvm");
CmdArgs.push_back("-riscv-ccmov=0");
diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp b/clang/lib/Driver/ToolChains/Gnu.cpp
index b404b7ab07..5c3e23b1f7 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -252,11 +252,10 @@ static const char *getLDMOption(const llvm::Triple &T, const ArgList &Args) {
case llvm::Triple::ppc64le:
return "elf64lppc";
case llvm::Triple::riscv32:
- case llvm::Triple::riscv64:
- {
+ case llvm::Triple::riscv64: {
bool IsBigEndian = false;
if (Arg *A = Args.getLastArg(options::OPT_mlittle_endian,
- options::OPT_mbig_endian))
+ options::OPT_mbig_endian))
IsBigEndian = A->getOption().matches(options::OPT_mbig_endian);
if (T.getArch() == llvm::Triple::riscv32)
@@ -415,7 +414,7 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
Triple.getVendor() == llvm::Triple::MipsTechnologies) {
bool IsBigEndian = false;
if (Arg *A = Args.getLastArg(options::OPT_mlittle_endian,
- options::OPT_mbig_endian))
+ options::OPT_mbig_endian))
IsBigEndian = A->getOption().matches(options::OPT_mbig_endian);
CmdArgs.push_back(IsBigEndian ? "-EB" : "-EL");
}
@@ -796,7 +795,7 @@ void tools::gnutools::Assembler::ConstructJob(Compilation &C,
if (Triple.getVendor() == llvm::Triple::MipsTechnologies) {
bool IsBigEndian = false;
if (Arg *A = Args.getLastArg(options::OPT_mlittle_endian,
- options::OPT_mbig_endian))
+ options::OPT_mbig_endian))
IsBigEndian = A->getOption().matches(options::OPT_mbig_endian);
CmdArgs.push_back(IsBigEndian ? "-EB" : "-EL");
}
@@ -1982,7 +1981,7 @@ static void findRISCVMultilibs(const Driver &D,
MultilibSet RISCVMultilibs =
MultilibSetBuilder()
- .Either(Endian)
+ .Either(Endian)
.Either({Ilp32, Ilp32f, Ilp32d, Lp64, Lp64f, Lp64d})
.makeMultilibSet()
.FilterOut(NonExistent);
@@ -1992,12 +1991,12 @@ static void findRISCVMultilibs(const Driver &D,
StringRef ABIName = tools::riscv::getRISCVABI(Args, TargetTriple);
bool IsBigEndian = false;
if (Arg *A = Args.getLastArg(options::OPT_mlittle_endian,
- options::OPT_mbig_endian))
+ options::OPT_mbig_endian))
IsBigEndian = A->getOption().matches(options::OPT_mbig_endian);
if (IsBigEndian) {
D.Diag(diag::err_drv_unsupported_opt_for_target)
- << "-EB" << TargetTriple.str();
+ << "-EB" << TargetTriple.str();
}
addMultilibFlag(!IsRV64, "-m32", Flags);
@@ -2634,9 +2633,8 @@ void Generic_GCC::GCCInstallationDetector::AddDefaultGCCPrefixes(
static const char *const RISCV32Triples[] = {"riscv32-unknown-linux-gnu",
"riscv32-unknown-elf"};
static const char *const RISCV64LibDirs[] = {"/lib64", "/lib"};
- static const char *const RISCV64Triples[] = {"riscv64-unknown-linux-gnu",
- "riscv64-unknown-elf",
- "riscv64-mti-elf"};
+ static const char *const RISCV64Triples[] = {
+ "riscv64-unknown-linux-gnu", "riscv64-unknown-elf", "riscv64-mti-elf"};
static const char *const SPARCv8LibDirs[] = {"/lib32", "/lib"};
static const char *const SPARCv8Triples[] = {"sparc-linux-gnu",
diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
index 3759b01b43..cf10f7a191 100644
--- a/clang/lib/Driver/ToolChains/Linux.cpp
+++ b/clang/lib/Driver/ToolChains/Linux.cpp
@@ -274,8 +274,9 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
const bool IsHexagon = Arch == llvm::Triple::hexagon;
const bool IsRISCV = Triple.isRISCV();
const bool IsCSKY = Triple.isCSKY();
- const bool IsMipsSysRoot = IsMips ||
- (IsRISCV && Triple.getVendor() == llvm::Triple::MipsTechnologies);
+ const bool IsMipsSysRoot =
+ IsMips ||
+ (IsRISCV && Triple.getVendor() == llvm::Triple::MipsTechnologies);
if (IsCSKY && !SelectedMultilibs.empty())
SysRoot = SysRoot + SelectedMultilibs.back().osSuffix();
@@ -414,9 +415,10 @@ std::string Linux::computeSysRoot() const {
return std::string();
}
- const bool IsMipsSysRoot = getTriple().isMIPS() ||
- (getTriple().isRISCV() &&
- getTriple().getVendor() == llvm::Triple::MipsTechnologies);
+ const bool IsMipsSysRoot =
+ getTriple().isMIPS() ||
+ (getTriple().isRISCV() &&
+ getTriple().getVendor() == llvm::Triple::MipsTechnologies);
if (!GCCInstallation.isValid() || !IsMipsSysRoot)
return std::string();
diff --git a/clang/lib/Driver/ToolChains/RISCVToolchain.cpp b/clang/lib/Driver/ToolChains/RISCVToolchain.cpp
index 6d0e093513..72b4fd0422 100644
--- a/clang/lib/Driver/ToolChains/RISCVToolchain.cpp
+++ b/clang/lib/Driver/ToolChains/RISCVToolchain.cpp
@@ -77,8 +77,8 @@ Tool *RISCVToolChain::buildLinker() const {
}
ToolChain::RuntimeLibType RISCVToolChain::GetDefaultRuntimeLibType() const {
- return GCCInstallation.isValid() ?
- ToolChain::RLT_Libgcc : ToolChain::RLT_CompilerRT;
+ return GCCInstallation.isValid() ? ToolChain::RLT_Libgcc
+ : ToolChain::RLT_CompilerRT;
}
ToolChain::UnwindLibType
diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
index 0fa97d2940..4181538eb0 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfo.cpp
@@ -2752,7 +2752,6 @@ bool RISCVInstrInfo::isLdStSafeToPair(const MachineInstr &LdSt,
return true;
}
-
bool RISCVInstrInfo::getMemOperandsWithOffsetWidth(
const MachineInstr &LdSt, SmallVectorImpl<const MachineOperand *> &BaseOps,
int64_t &Offset, bool &OffsetIsScalable, LocationSize &Width,
diff --git a/llvm/lib/Target/RISCV/RISCVSubtarget.cpp b/llvm/lib/Target/RISCV/RISCVSubtarget.cpp
index 780f466e38..e7966020bd 100644
--- a/llvm/lib/Target/RISCV/RISCVSubtarget.cpp
+++ b/llvm/lib/Target/RISCV/RISCVSubtarget.cpp
@@ -62,20 +62,19 @@ static cl::opt<unsigned> RISCVMinimumJumpTableEntries(
"riscv-min-jump-table-entries", cl::Hidden,
cl::desc("Set minimum number of entries to use a jump table on RISCV"));
-static cl::opt<bool> UseLoadStorePairsOpt(
- "riscv-load-store-pairs",
- cl::desc("RISCV: Optimize for load-store bonding"),
- cl::init(false), cl::Hidden);
+static cl::opt<bool>
+ UseLoadStorePairsOpt("riscv-load-store-pairs",
+ cl::desc("RISCV: Optimize for load-store bonding"),
+ cl::init(false), cl::Hidden);
-static cl::opt<bool> UseCCMovInsn(
- "riscv-ccmov",
- cl::desc("RISCV: Use 'ccmov' instruction"),
- cl::init(true), cl::Hidden);
+static cl::opt<bool> UseCCMovInsn("riscv-ccmov",
+ cl::desc("RISCV: Use 'ccmov' instruction"),
+ cl::init(true), cl::Hidden);
static cl::opt<bool> RISCVRemoveBackToBackBranches(
"riscv-remove-back-to-back-branches",
- cl::desc("RISCV: Insert nops to clear pipeline hazards."),
- cl::init(false), cl::Hidden);
+ cl::desc("RISCV: Insert nops to clear pipeline hazards."), cl::init(false),
+ cl::Hidden);
void RISCVSubtarget::anchor() {}
diff --git a/llvm/lib/Target/RISCV/RISCVSubtarget.h b/llvm/lib/Target/RISCV/RISCVSubtarget.h
index f2c4eaf0eb..484081968f 100644
--- a/llvm/lib/Target/RISCV/RISCVSubtarget.h
+++ b/llvm/lib/Target/RISCV/RISCVSubtarget.h
@@ -169,9 +169,7 @@ public:
MVT getXLenVT() const {
return is64Bit() ? MVT::i64 : MVT::i32;
}
- unsigned getXLen() const {
- return is64Bit() ? 64 : 32;
- }
+ unsigned getXLen() const { return is64Bit() ? 64 : 32; }
bool shouldRemoveBackToBackBranches() const;
bool useLoadStorePairs() const;
bool useCCMovInsn() const;
diff --git a/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp b/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
index 4ed62140c7..57169161a8 100644
--- a/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
+++ b/llvm/lib/Target/RISCV/RISCVTargetMachine.cpp
@@ -479,7 +479,7 @@ void RISCVPassConfig::addIRPasses() {
addPass(createLICMPass());
}
- if (getOptLevel() != CodeGenOptLevel::None){
+ if (getOptLevel() != CodeGenOptLevel::None) {
if (EnableLoopDataPrefetch)
addPass(createLoopDataPrefetchPass());
@@ -566,7 +566,7 @@ void RISCVPassConfig::addPreSched2() {
// Emit KCFI checks for indirect calls.
addPass(createKCFIPass());
if (TM->getOptLevel() != CodeGenOptLevel::None) {
- addPass(createRISCVLoadStoreOptPass());
+ addPass(createRISCVLoadStoreOptPass());
}
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/117865
More information about the cfe-commits
mailing list