[llvm] [DirectX backend] generate ISG1, OSG1 part for compute shader (PR #90508)

Chris B via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 29 13:34:17 PDT 2024


================
@@ -104,6 +112,39 @@ GlobalVariable *DXContainerGlobals::computeShaderHash(Module &M) {
   return GV;
 }
 
+GlobalVariable *DXContainerGlobals::buildContainerGlobal(
+    Module &M, Constant *Content, StringRef Name, StringRef SectionName) {
+  auto *GV = new llvm::GlobalVariable(
+      M, Content->getType(), true, GlobalValue::PrivateLinkage, Content, Name);
+  GV->setSection(SectionName);
+  GV->setAlignment(Align(4));
+  return GV;
+}
+
+GlobalVariable *DXContainerGlobals::buildSingature(Module &M, Signature &Sig,
+                                                   StringRef Name,
+                                                   StringRef SectionName) {
+  std::string Data;
+  raw_string_ostream OS(Data);
----------------
llvm-beanz wrote:

Probably better to use a `raw_svector_ostream` and a `SmallString<256>` as the backing store.

https://github.com/llvm/llvm-project/pull/90508


More information about the llvm-commits mailing list