Skip to content

Commit b68466e

Browse files
svenvhjsji
authored andcommitted
Realign all source files to clang-format style (#2744)
Some small deviations from the clang-format style have crept in over time. Re-format all files again to avoid formatting noise in future patches. Original commit: KhronosGroup/SPIRV-LLVM-Translator@8a0638eea4e3043
1 parent d2f7aa2 commit b68466e

12 files changed

+57
-66
lines changed

llvm-spirv/lib/SPIRV/LLVMSPIRVOpts.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ void TranslatorOpts::enableAllExtensions() {
5454
#undef EXT
5555
}
5656

57-
bool TranslatorOpts::isUnknownIntrinsicAllowed(IntrinsicInst *II) const
58-
noexcept {
57+
bool TranslatorOpts::isUnknownIntrinsicAllowed(
58+
IntrinsicInst *II) const noexcept {
5959
if (!SPIRVAllowUnknownIntrinsics.has_value())
6060
return false;
6161
const auto &IntrinsicPrefixList = SPIRVAllowUnknownIntrinsics.value();

llvm-spirv/lib/SPIRV/LLVMToSPIRVDbgTran.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,8 @@ void LLVMToSPIRVDbgTran::transLocationInfo() {
257257
} // Instructions
258258
// Reset current debug line at end of basic block.
259259
BM->setCurrentDebugLine(nullptr);
260-
} // Basic Blocks
261-
} // Functions
260+
} // Basic Blocks
261+
} // Functions
262262
}
263263

264264
// Translation of single debug entry

llvm-spirv/lib/SPIRV/OCLUtil.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ struct OCLBuiltinTransInfo {
161161
std::string Postfix; // Postfix to be added
162162
/// Postprocessor of operands
163163
std::function<void(BuiltinCallMutator &)> PostProc;
164-
Type *RetTy; // Return type of the translated function
164+
Type *RetTy; // Return type of the translated function
165165
OCLBuiltinTransInfo() : RetTy(nullptr) {
166166
PostProc = [](BuiltinCallMutator &) {};
167167
}

llvm-spirv/lib/SPIRV/SPIRVInternal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ using namespace llvm;
6161
namespace llvm {
6262
class IntrinsicInst;
6363
class IRBuilderBase;
64-
}
64+
} // namespace llvm
6565

6666
namespace SPIRV {
6767

llvm-spirv/lib/SPIRV/SPIRVReader.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4784,7 +4784,8 @@ bool SPIRVToLLVM::transVectorComputeMetadata(SPIRVFunction *BF) {
47844784
F->addFnAttr(Attr);
47854785
}
47864786

4787-
if (auto *EM = BF->getExecutionMode(ExecutionModeSharedLocalMemorySizeINTEL)) {
4787+
if (auto *EM =
4788+
BF->getExecutionMode(ExecutionModeSharedLocalMemorySizeINTEL)) {
47884789
unsigned int SLMSize = EM->getLiterals()[0];
47894790
Attribute Attr = Attribute::get(*Context, kVCMetadata::VCSLMSize,
47904791
std::to_string(SLMSize));
@@ -4919,10 +4920,7 @@ Instruction *SPIRVToLLVM::transOCLBuiltinFromExtInst(SPIRVExtInst *BC,
49194920
auto Args = transValue(BC->getArgValues(), F, BB);
49204921
SPIRVDBG(dbgs() << "[transOCLBuiltinFromExtInst] Function: " << *F
49214922
<< ", Args: ";
4922-
for (auto &I
4923-
: Args) dbgs()
4924-
<< *I << ", ";
4925-
dbgs() << '\n');
4923+
for (auto &I : Args) dbgs() << *I << ", "; dbgs() << '\n');
49264924
CallInst *CI = CallInst::Create(F, Args, BC->getName(), BB);
49274925
setCallingConv(CI);
49284926
addFnAttr(CI, Attribute::NoUnwind);

llvm-spirv/lib/SPIRV/SPIRVUtil.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -946,7 +946,7 @@ CallInst *mutateCallInst(
946946
CI->setName(InstName + ".old");
947947
}
948948
auto *NewCI = addCallInst(M, NewName, CI->getType(), Args, Attrs, CI, Mangle,
949-
InstName, TakeFuncName);
949+
InstName, TakeFuncName);
950950
NewCI->setDebugLoc(CI->getDebugLoc());
951951
LLVM_DEBUG(dbgs() << " => " << *NewCI << '\n');
952952
CI->replaceAllUsesWith(NewCI);
@@ -966,8 +966,8 @@ Instruction *mutateCallInst(
966966
Type *RetTy = CI->getType();
967967
auto NewName = ArgMutate(CI, Args, RetTy);
968968
StringRef InstName = CI->getName();
969-
auto *NewCI = addCallInst(M, NewName, RetTy, Args, Attrs, CI, Mangle, InstName,
970-
TakeFuncName);
969+
auto *NewCI = addCallInst(M, NewName, RetTy, Args, Attrs, CI, Mangle,
970+
InstName, TakeFuncName);
971971
auto *NewI = RetMutate(NewCI);
972972
NewI->takeName(CI);
973973
NewI->setDebugLoc(CI->getDebugLoc());
@@ -1012,7 +1012,7 @@ CallInst *addCallInst(Module *M, StringRef FuncName, Type *RetTy,
10121012
StringRef InstName, bool TakeFuncName) {
10131013

10141014
auto *F = getOrCreateFunction(M, RetTy, getTypes(Args), FuncName, Mangle,
1015-
Attrs, TakeFuncName);
1015+
Attrs, TakeFuncName);
10161016
InsertPosition InsertPos(nullptr);
10171017
if (Pos)
10181018
InsertPos = Pos->getIterator();
@@ -1898,8 +1898,8 @@ bool checkTypeForSPIRVExtendedInstLowering(IntrinsicInst *II, SPIRVModule *BM) {
18981898
if ((!Ty->isFloatTy() && !Ty->isDoubleTy() && !Ty->isHalfTy()) ||
18991899
(!BM->hasCapability(CapabilityVectorAnyINTEL) &&
19001900
((NumElems > 4) && (NumElems != 8) && (NumElems != 16)))) {
1901-
BM->SPIRVCK(
1902-
false, InvalidFunctionCall, II->getCalledOperand()->getName().str());
1901+
BM->SPIRVCK(false, InvalidFunctionCall,
1902+
II->getCalledOperand()->getName().str());
19031903
return false;
19041904
}
19051905
break;
@@ -1914,8 +1914,8 @@ bool checkTypeForSPIRVExtendedInstLowering(IntrinsicInst *II, SPIRVModule *BM) {
19141914
if ((!Ty->isIntegerTy()) ||
19151915
(!BM->hasCapability(CapabilityVectorAnyINTEL) &&
19161916
((NumElems > 4) && (NumElems != 8) && (NumElems != 16)))) {
1917-
BM->SPIRVCK(
1918-
false, InvalidFunctionCall, II->getCalledOperand()->getName().str());
1917+
BM->SPIRVCK(false, InvalidFunctionCall,
1918+
II->getCalledOperand()->getName().str());
19191919
}
19201920
break;
19211921
}

llvm-spirv/lib/SPIRV/SPIRVWriter.cpp

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1975,7 +1975,7 @@ void transAliasingMemAccess(SPIRVModule *BM, MDNode *AliasingListMD,
19751975
std::vector<uint32_t> &MemoryAccess,
19761976
SPIRVWord MemAccessMask) {
19771977
if (!BM->isAllowedToUseExtension(
1978-
ExtensionID::SPV_INTEL_memory_access_aliasing))
1978+
ExtensionID::SPV_INTEL_memory_access_aliasing))
19791979
return;
19801980
auto *MemAliasList = addMemAliasingINTELInstructions(BM, AliasingListMD);
19811981
if (!MemAliasList)
@@ -3126,20 +3126,17 @@ bool LLVMToSPIRVBase::transAlign(Value *V, SPIRVValue *BV) {
31263126
void LLVMToSPIRVBase::transMemAliasingINTELDecorations(Instruction *Inst,
31273127
SPIRVValue *BV) {
31283128
if (!BM->isAllowedToUseExtension(
3129-
ExtensionID::SPV_INTEL_memory_access_aliasing))
3129+
ExtensionID::SPV_INTEL_memory_access_aliasing))
31303130
return;
3131-
if (MDNode *AliasingListMD =
3132-
Inst->getMetadata(LLVMContext::MD_alias_scope)) {
3133-
auto *MemAliasList =
3134-
addMemAliasingINTELInstructions(BM, AliasingListMD);
3131+
if (MDNode *AliasingListMD = Inst->getMetadata(LLVMContext::MD_alias_scope)) {
3132+
auto *MemAliasList = addMemAliasingINTELInstructions(BM, AliasingListMD);
31353133
if (!MemAliasList)
31363134
return;
31373135
BV->addDecorate(new SPIRVDecorateId(DecorationAliasScopeINTEL, BV,
31383136
MemAliasList->getId()));
31393137
}
31403138
if (MDNode *AliasingListMD = Inst->getMetadata(LLVMContext::MD_noalias)) {
3141-
auto *MemAliasList =
3142-
addMemAliasingINTELInstructions(BM, AliasingListMD);
3139+
auto *MemAliasList = addMemAliasingINTELInstructions(BM, AliasingListMD);
31433140
if (!MemAliasList)
31443141
return;
31453142
BV->addDecorate(
@@ -4300,41 +4297,41 @@ SPIRVValue *LLVMToSPIRVBase::transIntrinsicInst(IntrinsicInst *II,
43004297
}
43014298
case Intrinsic::experimental_constrained_fadd: {
43024299
auto *BI = BM->addBinaryInst(OpFAdd, transType(II->getType()),
4303-
transValue(II->getArgOperand(0), BB),
4304-
transValue(II->getArgOperand(1), BB), BB);
4300+
transValue(II->getArgOperand(0), BB),
4301+
transValue(II->getArgOperand(1), BB), BB);
43054302
return applyRoundingModeConstraint(II->getOperand(2), BI);
43064303
}
43074304
case Intrinsic::experimental_constrained_fsub: {
43084305
auto *BI = BM->addBinaryInst(OpFSub, transType(II->getType()),
4309-
transValue(II->getArgOperand(0), BB),
4310-
transValue(II->getArgOperand(1), BB), BB);
4306+
transValue(II->getArgOperand(0), BB),
4307+
transValue(II->getArgOperand(1), BB), BB);
43114308
return applyRoundingModeConstraint(II->getOperand(2), BI);
43124309
}
43134310
case Intrinsic::experimental_constrained_fmul: {
43144311
auto *BI = BM->addBinaryInst(OpFMul, transType(II->getType()),
4315-
transValue(II->getArgOperand(0), BB),
4316-
transValue(II->getArgOperand(1), BB), BB);
4312+
transValue(II->getArgOperand(0), BB),
4313+
transValue(II->getArgOperand(1), BB), BB);
43174314
return applyRoundingModeConstraint(II->getOperand(2), BI);
43184315
}
43194316
case Intrinsic::experimental_constrained_fdiv: {
43204317
auto *BI = BM->addBinaryInst(OpFDiv, transType(II->getType()),
4321-
transValue(II->getArgOperand(0), BB),
4322-
transValue(II->getArgOperand(1), BB), BB);
4318+
transValue(II->getArgOperand(0), BB),
4319+
transValue(II->getArgOperand(1), BB), BB);
43234320
return applyRoundingModeConstraint(II->getOperand(2), BI);
43244321
}
43254322
case Intrinsic::experimental_constrained_frem: {
43264323
auto *BI = BM->addBinaryInst(OpFRem, transType(II->getType()),
4327-
transValue(II->getArgOperand(0), BB),
4328-
transValue(II->getArgOperand(1), BB), BB);
4324+
transValue(II->getArgOperand(0), BB),
4325+
transValue(II->getArgOperand(1), BB), BB);
43294326
return applyRoundingModeConstraint(II->getOperand(2), BI);
43304327
}
43314328
case Intrinsic::experimental_constrained_fma: {
43324329
std::vector<SPIRVValue *> Args{transValue(II->getArgOperand(0), BB),
43334330
transValue(II->getArgOperand(1), BB),
43344331
transValue(II->getArgOperand(2), BB)};
43354332
auto *BI = BM->addExtInst(transType(II->getType()),
4336-
BM->getExtInstSetId(SPIRVEIS_OpenCL),
4337-
OpenCLLIB::Fma, Args, BB);
4333+
BM->getExtInstSetId(SPIRVEIS_OpenCL),
4334+
OpenCLLIB::Fma, Args, BB);
43384335
return applyRoundingModeConstraint(II->getOperand(3), BI);
43394336
}
43404337
case Intrinsic::experimental_constrained_fptoui: {
@@ -4347,12 +4344,12 @@ SPIRVValue *LLVMToSPIRVBase::transIntrinsicInst(IntrinsicInst *II,
43474344
}
43484345
case Intrinsic::experimental_constrained_uitofp: {
43494346
auto *BI = BM->addUnaryInst(OpConvertUToF, transType(II->getType()),
4350-
transValue(II->getArgOperand(0), BB), BB);
4347+
transValue(II->getArgOperand(0), BB), BB);
43514348
return applyRoundingModeConstraint(II->getOperand(1), BI);
43524349
}
43534350
case Intrinsic::experimental_constrained_sitofp: {
43544351
auto *BI = BM->addUnaryInst(OpConvertSToF, transType(II->getType()),
4355-
transValue(II->getArgOperand(0), BB), BB);
4352+
transValue(II->getArgOperand(0), BB), BB);
43564353
return applyRoundingModeConstraint(II->getOperand(1), BI);
43574354
}
43584355
case Intrinsic::experimental_constrained_fpext: {
@@ -4361,7 +4358,7 @@ SPIRVValue *LLVMToSPIRVBase::transIntrinsicInst(IntrinsicInst *II,
43614358
}
43624359
case Intrinsic::experimental_constrained_fptrunc: {
43634360
auto *BI = BM->addUnaryInst(OpFConvert, transType(II->getType()),
4364-
transValue(II->getArgOperand(0), BB), BB);
4361+
transValue(II->getArgOperand(0), BB), BB);
43654362
return applyRoundingModeConstraint(II->getOperand(1), BI);
43664363
}
43674364
case Intrinsic::experimental_constrained_fcmp:
@@ -4394,7 +4391,7 @@ SPIRVValue *LLVMToSPIRVBase::transIntrinsicInst(IntrinsicInst *II,
43944391
BM->addBinaryInst(OpFMul, Ty, transValue(II->getArgOperand(0), BB),
43954392
transValue(II->getArgOperand(1), BB), BB);
43964393
auto *BI = BM->addBinaryInst(OpFAdd, Ty, Mul,
4397-
transValue(II->getArgOperand(2), BB), BB);
4394+
transValue(II->getArgOperand(2), BB), BB);
43984395
return applyRoundingModeConstraint(II->getOperand(3), BI);
43994396
}
44004397
case Intrinsic::fmuladd: {
@@ -5103,8 +5100,8 @@ SPIRVValue *LLVMToSPIRVBase::transIntrinsicInst(IntrinsicInst *II,
51035100
else
51045101
// Other LLVM intrinsics shouldn't get to SPIRV, because they
51055102
// can't be represented in SPIRV or aren't implemented yet.
5106-
BM->SPIRVCK(
5107-
false, InvalidFunctionCall, II->getCalledOperand()->getName().str());
5103+
BM->SPIRVCK(false, InvalidFunctionCall,
5104+
II->getCalledOperand()->getName().str());
51085105
}
51095106
return nullptr;
51105107
}

llvm-spirv/lib/SPIRV/libSPIRV/SPIRVDebug.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,7 @@ void verifyRegularizationPass(llvm::Module &, const std::string &);
7979
}
8080

8181
// Output stream for SPIRV debug information.
82-
inline spv_ostream &spvdbgs() {
83-
return std::cerr;
84-
}
82+
inline spv_ostream &spvdbgs() { return std::cerr; }
8583

8684
#else
8785

llvm-spirv/lib/SPIRV/libSPIRV/SPIRVErrorEnum.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,8 @@ _SPIRV_OP(Requires1_1, "Feature requires SPIR-V 1.1 or greater:")
2323
_SPIRV_OP(RequiresVersion, "Cannot fulfill SPIR-V version restriction:\n")
2424
_SPIRV_OP(RequiresExtension,
2525
"Feature requires the following SPIR-V extension:\n")
26-
_SPIRV_OP(InvalidMagicNumber,
27-
"Invalid Magic Number.")
28-
_SPIRV_OP(InvalidVersionNumber,
29-
"Invalid Version Number.")
26+
_SPIRV_OP(InvalidMagicNumber, "Invalid Magic Number.")
27+
_SPIRV_OP(InvalidVersionNumber, "Invalid Version Number.")
3028
_SPIRV_OP(UnspecifiedMemoryModel, "Unspecified Memory Model.")
3129
_SPIRV_OP(RepeatedMemoryModel, "Expects a single OpMemoryModel instruction.")
3230
_SPIRV_OP(UnsupportedVarArgFunction,

llvm-spirv/lib/SPIRV/libSPIRV/SPIRVInstruction.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -318,9 +318,7 @@ class SPIRVInstTemplateBase : public SPIRVInstruction {
318318
return Operands;
319319
}
320320

321-
virtual SPIRVValue *getOperand(unsigned I) {
322-
return getOpValue(I);
323-
}
321+
virtual SPIRVValue *getOperand(unsigned I) { return getOpValue(I); }
324322

325323
bool hasExecScope() const { return SPIRV::hasExecScope(OpCode); }
326324

@@ -406,12 +404,12 @@ class SPIRVMemoryAccess {
406404
}
407405
if (MemoryAccess[0] & MemoryAccessAliasScopeINTELMaskMask) {
408406
assert(MemoryAccess.size() > MemAccessNumParam &&
409-
"Aliasing operand is missing");
407+
"Aliasing operand is missing");
410408
AliasScopeInstID = MemoryAccess[MemAccessNumParam++];
411409
}
412410
if (MemoryAccess[0] & MemoryAccessNoAliasINTELMaskMask) {
413411
assert(MemoryAccess.size() > MemAccessNumParam &&
414-
"Aliasing operand is missing");
412+
"Aliasing operand is missing");
415413
NoAliasInstID = MemoryAccess[MemAccessNumParam++];
416414
}
417415

llvm-spirv/lib/SPIRV/libSPIRV/SPIRVMemAliasingINTEL.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ class SPIRVMemAliasingINTELGeneric : public SPIRVEntry {
5151
SPIRVMemAliasingINTELGeneric(SPIRVModule *TheModule, SPIRVId TheId,
5252
const std::vector<SPIRVId> &TheArgs)
5353
: SPIRVEntry(TheModule, TheArgs.size() + TheFixedWordCount, TheOpCode,
54-
TheId), Args(TheArgs) {
54+
TheId),
55+
Args(TheArgs) {
5556
SPIRVMemAliasingINTELGeneric::validate();
5657
assert(TheModule && "Invalid module");
5758
}
@@ -90,5 +91,5 @@ _SPIRV_OP(AliasScopeDeclINTEL, 2)
9091
_SPIRV_OP(AliasScopeListDeclINTEL, 2)
9192
#undef _SPIRV_OP
9293

93-
} // SPIRV
94+
} // namespace SPIRV
9495
#endif // SPIRV_LIBSPIRV_SPIRVMEMALIASINGINTEL_H

llvm-spirv/lib/SPIRV/libSPIRV/SPIRVModule.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -486,12 +486,14 @@ class SPIRVModule {
486486
virtual SPIRVInstruction *addSampledImageInst(SPIRVType *, SPIRVValue *,
487487
SPIRVValue *,
488488
SPIRVBasicBlock *) = 0;
489-
virtual SPIRVEntry *getOrAddAliasDomainDeclINTELInst(
490-
std::vector<SPIRVId> Args, llvm::MDNode *MD) = 0;
491-
virtual SPIRVEntry *getOrAddAliasScopeDeclINTELInst(
492-
std::vector<SPIRVId> Args, llvm::MDNode *MD) = 0;
493-
virtual SPIRVEntry *getOrAddAliasScopeListDeclINTELInst(
494-
std::vector<SPIRVId> Args, llvm::MDNode *MD) = 0;
489+
virtual SPIRVEntry *
490+
getOrAddAliasDomainDeclINTELInst(std::vector<SPIRVId> Args,
491+
llvm::MDNode *MD) = 0;
492+
virtual SPIRVEntry *getOrAddAliasScopeDeclINTELInst(std::vector<SPIRVId> Args,
493+
llvm::MDNode *MD) = 0;
494+
virtual SPIRVEntry *
495+
getOrAddAliasScopeListDeclINTELInst(std::vector<SPIRVId> Args,
496+
llvm::MDNode *MD) = 0;
495497
virtual SPIRVInstruction *addAssumeTrueKHRInst(SPIRVValue *Condition,
496498
SPIRVBasicBlock *BB) = 0;
497499
virtual SPIRVInstruction *addExpectKHRInst(SPIRVType *ResultTy,
@@ -603,7 +605,6 @@ class SPIRVModule {
603605
bool IsValid;
604606
};
605607

606-
607608
#ifdef _SPIRV_SUPPORT_TEXT_FMT
608609

609610
/// Convert SPIR-V between binary and internel text formats.

0 commit comments

Comments
 (0)