[llvm] e77c40f - [NFC] Make dxil namespace consistent
Chris Bieneman via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 21 15:48:36 PDT 2022
Author: Chris Bieneman
Date: 2022-09-21T17:48:13-05:00
New Revision: e77c40ffbda1bc844de642b3c07f58b541daa8d7
URL: https://github.com/llvm/llvm-project/commit/e77c40ffbda1bc844de642b3c07f58b541daa8d7
DIFF: https://github.com/llvm/llvm-project/commit/e77c40ffbda1bc844de642b3c07f58b541daa8d7.diff
LOG: [NFC] Make dxil namespace consistent
We have namespaces `DXIL` and `dxil`, which is just confusing. This
renames `DXIL` -> `dxil` making everything consistent.
While the LLVM coding standards don't have a clear direction here, I
chose lower case because by my current unscientific count there are
more places where we had the lowercase namespace than the uppercase.
Added:
Modified:
llvm/include/llvm/Support/DXILOperationCommon.h
llvm/lib/Target/DirectX/DXILConstants.h
llvm/lib/Target/DirectX/DXILOpBuilder.cpp
llvm/lib/Target/DirectX/DXILOpBuilder.h
llvm/lib/Target/DirectX/DXILOpLowering.cpp
llvm/lib/Target/DirectX/DXILStubs.td
llvm/utils/TableGen/DXILEmitter.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Support/DXILOperationCommon.h b/llvm/include/llvm/Support/DXILOperationCommon.h
index 09365411b3e72..134f92710b626 100644
--- a/llvm/include/llvm/Support/DXILOperationCommon.h
+++ b/llvm/include/llvm/Support/DXILOperationCommon.h
@@ -20,7 +20,7 @@
#include "llvm/ADT/StringSwitch.h"
namespace llvm {
-namespace DXIL {
+namespace dxil {
enum class ParameterKind : uint8_t {
INVALID = 0,
@@ -57,7 +57,7 @@ inline ParameterKind parameterTypeNameToKind(StringRef Name) {
.Default(ParameterKind::INVALID);
}
-} // namespace DXIL
+} // namespace dxil
} // namespace llvm
#endif
diff --git a/llvm/lib/Target/DirectX/DXILConstants.h b/llvm/lib/Target/DirectX/DXILConstants.h
index e8e7b5396a468..f7e37ba16d68d 100644
--- a/llvm/lib/Target/DirectX/DXILConstants.h
+++ b/llvm/lib/Target/DirectX/DXILConstants.h
@@ -13,13 +13,13 @@
#define LLVM_LIB_TARGET_DIRECTX_DXILCONSTANTS_H
namespace llvm {
-namespace DXIL {
+namespace dxil {
#define DXIL_OP_ENUM
#include "DXILOperation.inc"
#undef DXIL_OP_ENUM
-} // namespace DXIL
+} // namespace dxil
} // namespace llvm
#endif
diff --git a/llvm/lib/Target/DirectX/DXILOpBuilder.cpp b/llvm/lib/Target/DirectX/DXILOpBuilder.cpp
index 1985bee8e0ae1..9057564699025 100644
--- a/llvm/lib/Target/DirectX/DXILOpBuilder.cpp
+++ b/llvm/lib/Target/DirectX/DXILOpBuilder.cpp
@@ -17,7 +17,7 @@
#include "llvm/Support/ErrorHandling.h"
using namespace llvm;
-using namespace llvm::DXIL;
+using namespace llvm::dxil;
constexpr StringLiteral DXILOpNamePrefix = "dx.op.";
@@ -125,10 +125,10 @@ static std::string getTypeName(OverloadKind Kind, Type *Ty) {
// Static properties.
struct OpCodeProperty {
- DXIL::OpCode OpCode;
+ dxil::OpCode OpCode;
// Offset in DXILOpCodeNameTable.
unsigned OpCodeNameOffset;
- DXIL::OpCodeClass OpCodeClass;
+ dxil::OpCodeClass OpCodeClass;
// Offset in DXILOpCodeClassNameTable.
unsigned OpCodeClassNameOffset;
uint16_t OverloadTys;
@@ -234,7 +234,7 @@ static FunctionType *getDXILOpFunctionType(const OpCodeProperty *Prop,
ArgTys[0], ArrayRef<Type *>(&ArgTys[1], ArgTys.size() - 1), false);
}
-static FunctionCallee getOrCreateDXILOpFunction(DXIL::OpCode DXILOp,
+static FunctionCallee getOrCreateDXILOpFunction(dxil::OpCode DXILOp,
Type *OverloadTy, Module &M) {
const OpCodeProperty *Prop = getOpCodeProperty(DXILOp);
@@ -255,9 +255,9 @@ static FunctionCallee getOrCreateDXILOpFunction(DXIL::OpCode DXILOp,
}
namespace llvm {
-namespace DXIL {
+namespace dxil {
-CallInst *DXILOpBuilder::createDXILOpCall(DXIL::OpCode OpCode, Type *OverloadTy,
+CallInst *DXILOpBuilder::createDXILOpCall(dxil::OpCode OpCode, Type *OverloadTy,
llvm::iterator_range<Use *> Args) {
auto Fn = getOrCreateDXILOpFunction(OpCode, OverloadTy, M);
SmallVector<Value *> FullArgs;
@@ -266,7 +266,7 @@ CallInst *DXILOpBuilder::createDXILOpCall(DXIL::OpCode OpCode, Type *OverloadTy,
return B.CreateCall(Fn, FullArgs);
}
-Type *DXILOpBuilder::getOverloadTy(DXIL::OpCode OpCode, FunctionType *FT,
+Type *DXILOpBuilder::getOverloadTy(dxil::OpCode OpCode, FunctionType *FT,
bool NoOpCodeParam) {
const OpCodeProperty *Prop = getOpCodeProperty(OpCode);
@@ -317,8 +317,8 @@ Type *DXILOpBuilder::getOverloadTy(DXIL::OpCode OpCode, FunctionType *FT,
return OverloadType;
}
-const char *DXILOpBuilder::getOpCodeName(DXIL::OpCode DXILOp) {
+const char *DXILOpBuilder::getOpCodeName(dxil::OpCode DXILOp) {
return ::getOpCodeName(DXILOp);
}
-} // namespace DXIL
+} // namespace dxil
} // namespace llvm
diff --git a/llvm/lib/Target/DirectX/DXILOpBuilder.h b/llvm/lib/Target/DirectX/DXILOpBuilder.h
index 0cc39e845b716..940ed538c7ce1 100644
--- a/llvm/lib/Target/DirectX/DXILOpBuilder.h
+++ b/llvm/lib/Target/DirectX/DXILOpBuilder.h
@@ -24,23 +24,23 @@ class Type;
class FunctionType;
class Use;
-namespace DXIL {
+namespace dxil {
class DXILOpBuilder {
public:
DXILOpBuilder(Module &M, IRBuilderBase &B) : M(M), B(B) {}
- CallInst *createDXILOpCall(DXIL::OpCode OpCode, Type *OverloadTy,
+ CallInst *createDXILOpCall(dxil::OpCode OpCode, Type *OverloadTy,
llvm::iterator_range<Use *> Args);
- Type *getOverloadTy(DXIL::OpCode OpCode, FunctionType *FT,
+ Type *getOverloadTy(dxil::OpCode OpCode, FunctionType *FT,
bool NoOpCodeParam);
- static const char *getOpCodeName(DXIL::OpCode DXILOp);
+ static const char *getOpCodeName(dxil::OpCode DXILOp);
private:
Module &M;
IRBuilderBase &B;
};
-} // namespace DXIL
+} // namespace dxil
} // namespace llvm
#endif
diff --git a/llvm/lib/Target/DirectX/DXILOpLowering.cpp b/llvm/lib/Target/DirectX/DXILOpLowering.cpp
index 20c08f47745d3..f6e2297e9af41 100644
--- a/llvm/lib/Target/DirectX/DXILOpLowering.cpp
+++ b/llvm/lib/Target/DirectX/DXILOpLowering.cpp
@@ -27,9 +27,9 @@
#define DEBUG_TYPE "dxil-op-lower"
using namespace llvm;
-using namespace llvm::DXIL;
+using namespace llvm::dxil;
-static void lowerIntrinsic(DXIL::OpCode DXILOp, Function &F, Module &M) {
+static void lowerIntrinsic(dxil::OpCode DXILOp, Function &F, Module &M) {
IRBuilder<> B(M.getContext());
Value *DXILOpArg = B.getInt32(static_cast<unsigned>(DXILOp));
DXILOpBuilder DXILB(M, B);
diff --git a/llvm/lib/Target/DirectX/DXILStubs.td b/llvm/lib/Target/DirectX/DXILStubs.td
index ce4327f93bc18..ea936b2f422fe 100644
--- a/llvm/lib/Target/DirectX/DXILStubs.td
+++ b/llvm/lib/Target/DirectX/DXILStubs.td
@@ -1,13 +1,13 @@
// DXIL doesn't actually use registers, but this gets the boilerplate code
// generated through tablegen.
-let Namespace = "DXIL" in {
-def DXIL : Register<"DXIL">;
-def DXILClass : RegisterClass<"DXIL", [i32], 32, (add DXIL)>;
+let Namespace = "dxil" in {
+def DXIL : Register<"dxil">;
+def DXILClass : RegisterClass<"dxil", [i32], 32, (add DXIL)>;
}
class DXILInst : Instruction {
- let Namespace = "DXIL";
- let DecoderNamespace = "DXIL";
+ let Namespace = "dxil";
+ let DecoderNamespace = "dxil";
dag OutOperandList = (outs);
dag InOperandList = (ins);
diff --git a/llvm/utils/TableGen/DXILEmitter.cpp b/llvm/utils/TableGen/DXILEmitter.cpp
index cd41fbaa6ca1b..44c1df3e9ac46 100644
--- a/llvm/utils/TableGen/DXILEmitter.cpp
+++ b/llvm/utils/TableGen/DXILEmitter.cpp
@@ -21,7 +21,7 @@
#include "llvm/TableGen/Record.h"
using namespace llvm;
-using namespace llvm::DXIL;
+using namespace llvm::dxil;
namespace {
@@ -144,7 +144,7 @@ static std::string parameterKindToString(ParameterKind Kind) {
case ParameterKind::DXIL_HANDLE:
return "DXIL_HANDLE";
}
- llvm_unreachable("Unknown llvm::DXIL::ParameterKind enum");
+ llvm_unreachable("Unknown llvm::dxil::ParameterKind enum");
}
static void emitDXILOpEnum(DXILOperationData &DXILOp, raw_ostream &OS) {
@@ -238,14 +238,14 @@ static void emitDXILIntrinsicMap(std::vector<DXILOperationData> &DXILOps,
raw_ostream &OS) {
OS << "\n";
// FIXME: use array instead of SmallDenseMap.
- OS << "static const SmallDenseMap<Intrinsic::ID, DXIL::OpCode> LowerMap = "
+ OS << "static const SmallDenseMap<Intrinsic::ID, dxil::OpCode> LowerMap = "
"{\n";
for (auto &DXILOp : DXILOps) {
if (DXILOp.Intrinsic.empty())
continue;
- // {Intrinsic::sin, DXIL::OpCode::Sin},
+ // {Intrinsic::sin, dxil::OpCode::Sin},
OS << " { Intrinsic::" << DXILOp.Intrinsic
- << ", DXIL::OpCode::" << DXILOp.DXILOp << "},\n";
+ << ", dxil::OpCode::" << DXILOp.DXILOp << "},\n";
}
OS << "};\n";
OS << "\n";
@@ -340,16 +340,16 @@ static void emitDXILOperationTable(std::vector<DXILOperationData> &DXILOps,
Parameters.layout();
// Emit the DXIL operation table.
- //{DXIL::OpCode::Sin, OpCodeNameIndex, OpCodeClass::Unary,
+ //{dxil::OpCode::Sin, OpCodeNameIndex, OpCodeClass::Unary,
// OpCodeClassNameIndex,
// OverloadKind::FLOAT | OverloadKind::HALF, Attribute::AttrKind::ReadNone, 0,
// 3, ParameterTableOffset},
- OS << "static const OpCodeProperty *getOpCodeProperty(DXIL::OpCode DXILOp) "
+ OS << "static const OpCodeProperty *getOpCodeProperty(dxil::OpCode DXILOp) "
"{\n";
OS << " static const OpCodeProperty OpCodeProps[] = {\n";
for (auto &DXILOp : DXILOps) {
- OS << " { DXIL::OpCode::" << DXILOp.DXILOp << ", "
+ OS << " { dxil::OpCode::" << DXILOp.DXILOp << ", "
<< OpStrings.get(DXILOp.DXILOp.str())
<< ", OpCodeClass::" << DXILOp.DXILClass << ", "
<< OpClassStrings.get(getDXILOpClassName(DXILOp.DXILClass)) << ", "
@@ -375,7 +375,7 @@ static void emitDXILOperationTable(std::vector<DXILOperationData> &DXILOps,
OS << "}\n\n";
// Emit the string tables.
- OS << "static const char *getOpCodeName(DXIL::OpCode DXILOp) {\n\n";
+ OS << "static const char *getOpCodeName(dxil::OpCode DXILOp) {\n\n";
OpStrings.emitStringLiteralDef(OS,
" static const char DXILOpCodeNameTable[]");
More information about the llvm-commits
mailing list