================ @@ -331,6 +336,249 @@ std::pair<uint32_t, uint32_t> ResourceInfo::getAnnotateProps() const { return {Word0, Word1}; } +void ResourceInfo::print(raw_ostream &OS) const { + OS << " Symbol: "; + Symbol->printAsOperand(OS); + OS << "\n"; + + OS << " Name: \"" << Name << "\"\n" + << " Binding:\n" + << " Unique ID: " << Binding.UniqueID << "\n" + << " Space: " << Binding.Space << "\n" + << " Lower Bound: " << Binding.LowerBound << "\n" + << " Size: " << Binding.Size << "\n" + << " Class: " << static_cast<unsigned>(RC) << "\n" + << " Kind: " << static_cast<unsigned>(Kind) << "\n"; + + if (isCBuffer()) { + OS << " CBuffer size: " << CBufferSize << "\n"; + } else if (isSampler()) { + OS << " Sampler Type: " << static_cast<unsigned>(SamplerTy) << "\n"; + } else { + if (isUAV()) { + OS << " Globally Coherent: " << UAVFlags.GloballyCoherent << "\n" + << " HasCounter: " << UAVFlags.HasCounter << "\n" + << " IsROV: " << UAVFlags.IsROV << "\n"; + } + if (isMultiSample()) + OS << " Sample Count: " << MultiSample.Count << "\n"; + + if (isStruct()) { + OS << " Buffer Stride: " << Struct.Stride << "\n"; + uint32_t AlignLog2 = Struct.Alignment ? Log2(*Struct.Alignment) : 0; + OS << " Alignment: " << AlignLog2 << "\n"; + } else if (isTyped()) { + OS << " Element Type: " << static_cast<unsigned>(Typed.ElementTy) << "\n" + << " Element Count: " << static_cast<unsigned>(Typed.ElementCount) + << "\n"; + } else if (isFeedback()) + OS << " Feedback Type: " << static_cast<unsigned>(Feedback.Type) << "\n"; + } +} + +//===----------------------------------------------------------------------===// +// ResourceMapper + +static dxil::ElementType toDXILElementType(Type *Ty, bool IsSigned) { + // TODO: Handle unorm, snorm, and packed. + Ty = Ty->getScalarType(); ---------------- bogner wrote:
No, `Type::getScalarType` cannot return nullptr. https://github.com/llvm/llvm-project/pull/100699 _______________________________________________ llvm-branch-commits mailing list llvm-branch-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits