Skip to content

Commit 9104e82

Browse files
authored
[SystemZ][NFC] Fix a couple of style issues (llvm#69958)
Some fixes for style issues pointed out by clang-tidy: - Upper case/lower case fixes - No else after return - Removed unused #include's - Added NOLINTNEXTLINE() for the LLVM* functions All changes are NFC.
1 parent 23d6a6d commit 9104e82

File tree

9 files changed

+31
-29
lines changed

9 files changed

+31
-29
lines changed

llvm/lib/Target/SystemZ/AsmParser/SystemZAsmParser.cpp

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ class SystemZOperand : public MCParsedAsmOperand {
154154
}
155155

156156
public:
157-
SystemZOperand(OperandKind kind, SMLoc startLoc, SMLoc endLoc)
158-
: Kind(kind), StartLoc(startLoc), EndLoc(endLoc) {}
157+
SystemZOperand(OperandKind Kind, SMLoc StartLoc, SMLoc EndLoc)
158+
: Kind(Kind), StartLoc(StartLoc), EndLoc(EndLoc) {}
159159

160160
// Create particular kinds of operand.
161161
static std::unique_ptr<SystemZOperand> createInvalid(SMLoc StartLoc,
@@ -1084,7 +1084,8 @@ SystemZAsmParser::parseAddressRegister(Register &Reg) {
10841084
if (Reg.Group == RegV) {
10851085
Error(Reg.StartLoc, "invalid use of vector addressing");
10861086
return true;
1087-
} else if (Reg.Group != RegGR) {
1087+
}
1088+
if (Reg.Group != RegGR) {
10881089
Error(Reg.StartLoc, "invalid address register");
10891090
return true;
10901091
}
@@ -1236,8 +1237,8 @@ bool SystemZAsmParser::ParseDirectiveInsn(SMLoc L) {
12361237
assert(Entry->Format == Format);
12371238

12381239
// Parse the following operands using the table's information.
1239-
for (int i = 0; i < Entry->NumOperands; i++) {
1240-
MatchClassKind Kind = Entry->OperandKinds[i];
1240+
for (int I = 0; I < Entry->NumOperands; I++) {
1241+
MatchClassKind Kind = Entry->OperandKinds[I];
12411242

12421243
SMLoc StartLoc = Parser.getTok().getLoc();
12431244

@@ -1285,9 +1286,9 @@ bool SystemZAsmParser::ParseDirectiveInsn(SMLoc L) {
12851286
// Build the instruction with the parsed operands.
12861287
MCInst Inst = MCInstBuilder(Entry->Opcode);
12871288

1288-
for (size_t i = 0; i < Operands.size(); i++) {
1289-
MCParsedAsmOperand &Operand = *Operands[i];
1290-
MatchClassKind Kind = Entry->OperandKinds[i];
1289+
for (size_t I = 0; I < Operands.size(); I++) {
1290+
MCParsedAsmOperand &Operand = *Operands[I];
1291+
MatchClassKind Kind = Entry->OperandKinds[I];
12911292

12921293
// Verify operand.
12931294
unsigned Res = validateOperandClass(Operand, Kind);
@@ -1583,7 +1584,7 @@ ParseStatus SystemZAsmParser::parsePCRel(OperandVector &Operands,
15831584
if (getParser().parseExpression(Expr))
15841585
return ParseStatus::NoMatch;
15851586

1586-
auto isOutOfRangeConstant = [&](const MCExpr *E, bool Negate) -> bool {
1587+
auto IsOutOfRangeConstant = [&](const MCExpr *E, bool Negate) -> bool {
15871588
if (auto *CE = dyn_cast<MCConstantExpr>(E)) {
15881589
int64_t Value = CE->getValue();
15891590
if (Negate)
@@ -1599,7 +1600,7 @@ ParseStatus SystemZAsmParser::parsePCRel(OperandVector &Operands,
15991600
if (auto *CE = dyn_cast<MCConstantExpr>(Expr)) {
16001601
if (isParsingHLASM())
16011602
return Error(StartLoc, "Expected PC-relative expression");
1602-
if (isOutOfRangeConstant(CE, false))
1603+
if (IsOutOfRangeConstant(CE, false))
16031604
return Error(StartLoc, "offset out of range");
16041605
int64_t Value = CE->getValue();
16051606
MCSymbol *Sym = Ctx.createTempSymbol();
@@ -1612,8 +1613,8 @@ ParseStatus SystemZAsmParser::parsePCRel(OperandVector &Operands,
16121613
// For consistency with the GNU assembler, conservatively assume that a
16131614
// constant offset must by itself be within the given size range.
16141615
if (const auto *BE = dyn_cast<MCBinaryExpr>(Expr))
1615-
if (isOutOfRangeConstant(BE->getLHS(), false) ||
1616-
isOutOfRangeConstant(BE->getRHS(),
1616+
if (IsOutOfRangeConstant(BE->getLHS(), false) ||
1617+
IsOutOfRangeConstant(BE->getRHS(),
16171618
BE->getOpcode() == MCBinaryExpr::Sub))
16181619
return Error(StartLoc, "offset out of range");
16191620

@@ -1702,6 +1703,7 @@ bool SystemZAsmParser::isLabel(AsmToken &Token) {
17021703
}
17031704

17041705
// Force static initialization.
1706+
// NOLINTNEXTLINE(readability-identifier-naming)
17051707
extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeSystemZAsmParser() {
17061708
RegisterMCAsmParser<SystemZAsmParser> X(getTheSystemZTarget());
17071709
}

llvm/lib/Target/SystemZ/Disassembler/SystemZDisassembler.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class SystemZDisassembler : public MCDisassembler {
3232
: MCDisassembler(STI, Ctx) {}
3333
~SystemZDisassembler() override = default;
3434

35-
DecodeStatus getInstruction(MCInst &instr, uint64_t &Size,
35+
DecodeStatus getInstruction(MCInst &Instr, uint64_t &Size,
3636
ArrayRef<uint8_t> Bytes, uint64_t Address,
3737
raw_ostream &CStream) const override;
3838
};
@@ -45,6 +45,7 @@ static MCDisassembler *createSystemZDisassembler(const Target &T,
4545
return new SystemZDisassembler(STI, Ctx);
4646
}
4747

48+
// NOLINTNEXTLINE(readability-identifier-naming)
4849
extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeSystemZDisassembler() {
4950
// Register the disassembler.
5051
TargetRegistry::RegisterMCDisassembler(getTheSystemZTarget(),
@@ -70,11 +71,11 @@ extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeSystemZDisassembler() {
7071
/// is done and if a symbol is found an MCExpr is created with that, else
7172
/// an MCExpr with the immediate Value is created. This function returns true
7273
/// if it adds an operand to the MCInst and false otherwise.
73-
static bool tryAddingSymbolicOperand(int64_t Value, bool isBranch,
74+
static bool tryAddingSymbolicOperand(int64_t Value, bool IsBranch,
7475
uint64_t Address, uint64_t Offset,
7576
uint64_t Width, MCInst &MI,
7677
const MCDisassembler *Decoder) {
77-
return Decoder->tryAddingSymbolicOperand(MI, Value, Address, isBranch, Offset,
78+
return Decoder->tryAddingSymbolicOperand(MI, Value, Address, IsBranch, Offset,
7879
Width, /*InstSize=*/0);
7980
}
8081

llvm/lib/Target/SystemZ/MCTargetDesc/SystemZELFObjectWriter.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "llvm/Support/ErrorHandling.h"
1919
#include <cassert>
2020
#include <cstdint>
21+
#include <memory>
2122

2223
using namespace llvm;
2324

llvm/lib/Target/SystemZ/MCTargetDesc/SystemZGOFFObjectWriter.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include "MCTargetDesc/SystemZMCTargetDesc.h"
1010
#include "llvm/MC/MCGOFFObjectWriter.h"
11+
#include <memory>
1112

1213
using namespace llvm;
1314

llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCCodeEmitter.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#include "llvm/MC/MCRegisterInfo.h"
2323
#include "llvm/MC/MCSubtargetInfo.h"
2424
#include "llvm/Support/ErrorHandling.h"
25-
#include "llvm/Support/raw_ostream.h"
2625
#include <cassert>
2726
#include <cstdint>
2827

@@ -37,9 +36,8 @@ class SystemZMCCodeEmitter : public MCCodeEmitter {
3736
MCContext &Ctx;
3837

3938
public:
40-
SystemZMCCodeEmitter(const MCInstrInfo &mcii, MCContext &ctx)
41-
: MCII(mcii), Ctx(ctx) {
42-
}
39+
SystemZMCCodeEmitter(const MCInstrInfo &MCII, MCContext &Ctx)
40+
: MCII(MCII), Ctx(Ctx) {}
4341

4442
~SystemZMCCodeEmitter() override = default;
4543

llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCExpr.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
//
77
//===----------------------------------------------------------------------===//
88

9-
#ifndef LLVM_LIB_TARGET_SystemZ_MCTARGETDESC_SystemZMCEXPR_H
10-
#define LLVM_LIB_TARGET_SystemZ_MCTARGETDESC_SystemZMCEXPR_H
9+
#ifndef LLVM_LIB_TARGET_SYSTEMZ_MCTARGETDESC_SYSTEMZMCEXPR_H
10+
#define LLVM_LIB_TARGET_SYSTEMZ_MCTARGETDESC_SYSTEMZMCEXPR_H
1111

1212
#include "llvm/MC/MCExpr.h"
1313
#include "llvm/MC/MCStreamer.h"

llvm/lib/Target/SystemZ/SystemZSubtarget.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,8 @@ SystemZSubtarget::initializeSpecialRegisters() {
5959
return new SystemZXPLINK64Registers;
6060
else if (isTargetELF())
6161
return new SystemZELFRegisters;
62-
else {
63-
llvm_unreachable("Invalid Calling Convention. Cannot initialize Special "
64-
"Call Registers!");
65-
}
62+
llvm_unreachable("Invalid Calling Convention. Cannot initialize Special "
63+
"Call Registers!");
6664
}
6765

6866
SystemZSubtarget::SystemZSubtarget(const Triple &TT, const std::string &CPU,

llvm/lib/Target/SystemZ/SystemZTargetMachine.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
#include "SystemZMachineScheduler.h"
1414
#include "SystemZTargetTransformInfo.h"
1515
#include "TargetInfo/SystemZTargetInfo.h"
16-
#include "llvm/ADT/STLExtras.h"
17-
#include "llvm/ADT/SmallVector.h"
1816
#include "llvm/ADT/StringRef.h"
1917
#include "llvm/Analysis/TargetTransformInfo.h"
2018
#include "llvm/CodeGen/Passes.h"
@@ -25,11 +23,13 @@
2523
#include "llvm/Support/CodeGen.h"
2624
#include "llvm/Target/TargetLoweringObjectFile.h"
2725
#include "llvm/Transforms/Scalar.h"
26+
#include <memory>
2827
#include <optional>
2928
#include <string>
3029

3130
using namespace llvm;
3231

32+
// NOLINTNEXTLINE(readability-identifier-naming)
3333
extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeSystemZTarget() {
3434
// Register the target.
3535
RegisterTargetMachine<SystemZTargetMachine> X(getTheSystemZTarget());
@@ -171,9 +171,9 @@ SystemZTargetMachine::getSubtargetImpl(const Function &F) const {
171171
// FIXME: This is related to the code below to reset the target options,
172172
// we need to know whether or not the soft float flag is set on the
173173
// function, so we can enable it as a subtarget feature.
174-
bool softFloat = F.getFnAttribute("use-soft-float").getValueAsBool();
174+
bool SoftFloat = F.getFnAttribute("use-soft-float").getValueAsBool();
175175

176-
if (softFloat)
176+
if (SoftFloat)
177177
FS += FS.empty() ? "+soft-float" : ",+soft-float";
178178

179179
auto &I = SubtargetMap[CPU + TuneCPU + FS];

llvm/lib/Target/SystemZ/TargetInfo/SystemZTargetInfo.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Target &llvm::getTheSystemZTarget() {
1616
return TheSystemZTarget;
1717
}
1818

19+
// NOLINTNEXTLINE(readability-identifier-naming)
1920
extern "C" LLVM_EXTERNAL_VISIBILITY void LLVMInitializeSystemZTargetInfo() {
2021
RegisterTarget<Triple::systemz, /*HasJIT=*/true> X(
2122
getTheSystemZTarget(), "systemz", "SystemZ", "SystemZ");

0 commit comments

Comments
 (0)