[llvm] [Exegesis][RISCV] Add RISCV support for llvm-exegesis (PR #89047)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 17 06:04:11 PDT 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 971237dab259bdaa619403fc6472bd1758d4dc18 0855ea1284edab29d0df18c8b6d3c3a347ef9f6c -- llvm/tools/llvm-exegesis/lib/RISCV/RISCVCounters.cpp llvm/tools/llvm-exegesis/lib/RISCV/RISCVCounters.h llvm/tools/llvm-exegesis/lib/RISCV/Target.cpp llvm/lib/Target/RISCV/MCTargetDesc/RISCVBaseInfo.h llvm/tools/llvm-exegesis/lib/Assembler.cpp llvm/tools/llvm-exegesis/lib/BenchmarkCode.h llvm/tools/llvm-exegesis/lib/CodeTemplate.cpp llvm/tools/llvm-exegesis/lib/CodeTemplate.h llvm/tools/llvm-exegesis/lib/LlvmState.cpp llvm/tools/llvm-exegesis/lib/MCInstrDescView.cpp llvm/tools/llvm-exegesis/lib/MCInstrDescView.h llvm/tools/llvm-exegesis/lib/PerfHelper.h llvm/tools/llvm-exegesis/lib/SerialSnippetGenerator.cpp llvm/tools/llvm-exegesis/lib/SnippetFile.cpp llvm/tools/llvm-exegesis/lib/SnippetGenerator.cpp llvm/tools/llvm-exegesis/lib/SnippetGenerator.h llvm/tools/llvm-exegesis/lib/Target.h llvm/tools/llvm-exegesis/llvm-exegesis.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/tools/llvm-exegesis/lib/RISCV/Target.cpp b/llvm/tools/llvm-exegesis/lib/RISCV/Target.cpp
index be989bde4c..69b6c7644e 100644
--- a/llvm/tools/llvm-exegesis/lib/RISCV/Target.cpp
+++ b/llvm/tools/llvm-exegesis/lib/RISCV/Target.cpp
@@ -101,11 +101,9 @@ public:
ExegesisRISCVTarget::ExegesisRISCVTarget()
: ExegesisTarget(RISCVCpuPfmCounters, RISCV_MC::isOpcodeAvailable) {}
-Expected<std::unique_ptr<pfm::CounterGroup>>
-ExegesisRISCVTarget::createCounter(StringRef CounterName,
- const LLVMState &State,
- ArrayRef<const char *> ValidationCounters,
- const pid_t ProcessID) const {
+Expected<std::unique_ptr<pfm::CounterGroup>> ExegesisRISCVTarget::createCounter(
+ StringRef CounterName, const LLVMState &State,
+ ArrayRef<const char *> ValidationCounters, const pid_t ProcessID) const {
if (CounterName == RISCVPfmCounterNames[0]) {
return createRISCVCpuCyclesCounter(pfm::PerfEvent(CounterName));
}
@@ -271,8 +269,8 @@ std::vector<MCInst> ExegesisRISCVTarget::setRegTo(const MCSubtargetInfo &STI,
return {};
}
-const unsigned DefaultLoopCounterReg = RISCV::X31; // t6
-const unsigned ScratchMemoryReg = RISCV::X10; // a0
+const unsigned DefaultLoopCounterReg = RISCV::X31; // t6
+const unsigned ScratchMemoryReg = RISCV::X10; // a0
unsigned
ExegesisRISCVTarget::getDefaultLoopCounterRegister(const Triple &) const {
@@ -281,7 +279,7 @@ ExegesisRISCVTarget::getDefaultLoopCounterRegister(const Triple &) const {
void ExegesisRISCVTarget::decrementLoopCounterAndJump(
MachineBasicBlock &MBB, MachineBasicBlock &TargetMBB,
- const MCInstrInfo &MII, unsigned LoopRegister) const{
+ const MCInstrInfo &MII, unsigned LoopRegister) const {
BuildMI(&MBB, DebugLoc(), MII.get(RISCV::ADDI))
.addDef(LoopRegister)
.addUse(LoopRegister)
diff --git a/llvm/tools/llvm-exegesis/lib/SnippetGenerator.cpp b/llvm/tools/llvm-exegesis/lib/SnippetGenerator.cpp
index 814cf042f4..8eaf83044e 100644
--- a/llvm/tools/llvm-exegesis/lib/SnippetGenerator.cpp
+++ b/llvm/tools/llvm-exegesis/lib/SnippetGenerator.cpp
@@ -73,9 +73,9 @@ Error SnippetGenerator::generateConfigurations(
for (CodeTemplate &CT : Templates) {
// TODO: Generate as many BenchmarkCode as needed.
{
- CT.ScratchSpacePointerInReg =
- State.getExegesisTarget().getScratchMemoryRegister(
- State.getTargetMachine().getTargetTriple());
+ CT.ScratchSpacePointerInReg =
+ State.getExegesisTarget().getScratchMemoryRegister(
+ State.getTargetMachine().getTargetTriple());
BenchmarkCode BC;
BC.Info = CT.Info;
BC.Key.Instructions.reserve(CT.Instructions.size());
``````````
</details>
https://github.com/llvm/llvm-project/pull/89047
More information about the llvm-commits
mailing list