Skip to content

Commit e988056

Browse files
committed
clang formatting
1 parent 206667d commit e988056

File tree

3 files changed

+38
-27
lines changed

3 files changed

+38
-27
lines changed

llvm/lib/Target/DirectX/DXILConstants.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ inline Attributes operator|(Attributes a, Attributes b) {
3939
Attributes c;
4040
#define DXIL_ATTRIBUTE(Name) c.Name = a.Name | b.Name;
4141
#include "DXILOperation.inc"
42-
return c;
42+
return c;
4343
}
4444

4545
inline Attributes &operator|=(Attributes &a, Attributes &b) {

llvm/lib/Target/DirectX/DXILOpBuilder.cpp

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -361,39 +361,48 @@ static std::optional<size_t> getPropIndex(ArrayRef<T> PropList,
361361
return std::nullopt;
362362
}
363363

364-
constexpr static uint64_t computeSwitchEnum(dxil::OpCode OpCode, uint16_t VersionMajor, uint16_t VersionMinor) {
364+
constexpr static uint64_t computeSwitchEnum(dxil::OpCode OpCode,
365+
uint16_t VersionMajor,
366+
uint16_t VersionMinor) {
365367
uint64_t OpCodePack = (uint64_t)OpCode;
366368
return (OpCodePack << 32) | (VersionMajor << 16) | VersionMinor;
367369
}
368370

369-
static dxil::Attributes getDXILAttributes(dxil::OpCode OpCode, VersionTuple DXILVersion) {
371+
static dxil::Attributes getDXILAttributes(dxil::OpCode OpCode,
372+
VersionTuple DXILVersion) {
370373
SmallVector<Version> Versions = {
371374
#define DXIL_VERSION(MAJOR, MINOR) {MAJOR, MINOR},
372375
#include "DXILOperation.inc"
373376
};
374377

375378
dxil::Attributes Attributes;
376379
for (auto Version : Versions) {
377-
if (DXILVersion < VersionTuple(Version.Major, Version.Minor)) continue;
380+
if (DXILVersion < VersionTuple(Version.Major, Version.Minor))
381+
continue;
378382
switch (computeSwitchEnum(OpCode, Version.Major, Version.Minor)) {
379-
#define DXIL_OP_ATTRIBUTES(OpCode, VersionMajor, VersionMinor, ...) \
380-
case computeSwitchEnum(OpCode, VersionMajor, VersionMinor): { \
381-
auto Other = dxil::Attributes{__VA_ARGS__}; \
382-
Attributes |= Other; \
383-
break; \
384-
};
383+
#define DXIL_OP_ATTRIBUTES(OpCode, VersionMajor, VersionMinor, ...) \
384+
case computeSwitchEnum(OpCode, VersionMajor, VersionMinor): { \
385+
auto Other = dxil::Attributes{__VA_ARGS__}; \
386+
Attributes |= Other; \
387+
break; \
388+
};
385389
#include "DXILOperation.inc"
386390
}
387391
}
388392
return Attributes;
389393
}
390394

391-
static void setDXILAttributes(CallInst *CI, dxil::OpCode OpCode, VersionTuple DXILVersion) {
395+
static void setDXILAttributes(CallInst *CI, dxil::OpCode OpCode,
396+
VersionTuple DXILVersion) {
392397
dxil::Attributes Attributes = getDXILAttributes(OpCode, DXILVersion);
393-
if (Attributes.ReadNone) CI->setDoesNotAccessMemory();
394-
if (Attributes.ReadOnly) CI->setOnlyReadsMemory();
395-
if (Attributes.NoReturn) CI->setDoesNotReturn();
396-
if (Attributes.NoDuplicate) CI->setCannotDuplicate();
398+
if (Attributes.ReadNone)
399+
CI->setDoesNotAccessMemory();
400+
if (Attributes.ReadOnly)
401+
CI->setOnlyReadsMemory();
402+
if (Attributes.NoReturn)
403+
CI->setDoesNotReturn();
404+
if (Attributes.NoDuplicate)
405+
CI->setCannotDuplicate();
397406
return;
398407
}
399408

llvm/utils/TableGen/DXILEmitter.cpp

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -323,11 +323,11 @@ static std::string getStageMaskString(ArrayRef<const Record *> Recs) {
323323
static void emitDXILVersions(const RecordKeeper &Records, raw_ostream &OS) {
324324
OS << "#ifdef DXIL_VERSION\n";
325325
for (const Record *Version : Records.getAllDerivedDefinitions("Version")) {
326-
unsigned Major = Version->getValueAsInt("Major");
327-
unsigned Minor = Version->getValueAsInt("Minor");
328-
OS << "DXIL_VERSION(";
329-
OS << std::to_string(Major) << ", " << std::to_string(Minor);
330-
OS << ")\n";
326+
unsigned Major = Version->getValueAsInt("Major");
327+
unsigned Minor = Version->getValueAsInt("Minor");
328+
OS << "DXIL_VERSION(";
329+
OS << std::to_string(Major) << ", " << std::to_string(Minor);
330+
OS << ")\n";
331331
}
332332
OS << "#undef DXIL_VERSION\n";
333333
OS << "#endif\n\n";
@@ -372,7 +372,8 @@ static void emitDXILAttributes(const RecordKeeper &Records, raw_ostream &OS) {
372372
}
373373

374374
// Determine which function attributes are set for a dxil version
375-
static bool attrIsDefined(std::vector<const Record *> Attrs, const Record *Attr) {
375+
static bool attrIsDefined(std::vector<const Record *> Attrs,
376+
const Record *Attr) {
376377
for (auto CurAttr : Attrs)
377378
if (CurAttr->getName() == Attr->getName())
378379
return true;
@@ -386,20 +387,22 @@ static void emitDXILOpAttributes(const RecordKeeper &Records,
386387
OS << "#ifdef DXIL_OP_ATTRIBUTES\n";
387388
for (const auto &Op : Ops) {
388389
for (const auto *Rec : Op.AttrRecs) {
389-
unsigned Major = Rec->getValueAsDef("dxil_version")->getValueAsInt("Major");
390-
unsigned Minor = Rec->getValueAsDef("dxil_version")->getValueAsInt("Minor");
390+
unsigned Major =
391+
Rec->getValueAsDef("dxil_version")->getValueAsInt("Major");
392+
unsigned Minor =
393+
Rec->getValueAsDef("dxil_version")->getValueAsInt("Minor");
391394
OS << "DXIL_OP_ATTRIBUTES(dxil::OpCode::" << Op.OpName << ", ";
392395
OS << std::to_string(Major) << ", " << std::to_string(Minor);
393396
auto Attrs = Rec->getValueAsListOfDefs("fn_attrs");
394-
for (const Record *Attr : Records.getAllDerivedDefinitions("DXILAttribute")) {
397+
for (const Record *Attr :
398+
Records.getAllDerivedDefinitions("DXILAttribute")) {
395399
std::string HasAttr = ", false";
396400
if (attrIsDefined(Attrs, Attr))
397401
HasAttr = ", true";
398402
OS << HasAttr;
399403
}
400404
OS << ")\n";
401405
}
402-
403406
}
404407
OS << "#undef DXIL_OP_ATTRIBUTES\n";
405408
OS << "#endif\n\n";
@@ -509,8 +512,7 @@ static void emitDXILOperationTable(ArrayRef<DXILOperationDesc> Ops,
509512
<< OpStrings.get(Op.OpName) << ", OpCodeClass::" << Op.OpClass << ", "
510513
<< OpClassStrings.get(Op.OpClass.data()) << ", "
511514
<< getOverloadMaskString(Op.OverloadRecs) << ", "
512-
<< getStageMaskString(Op.StageRecs) << ", "
513-
<< Op.OverloadParamIndex
515+
<< getStageMaskString(Op.StageRecs) << ", " << Op.OverloadParamIndex
514516
<< " }";
515517
Prefix = ",\n";
516518
}

0 commit comments

Comments
 (0)