[clang] [CIR] Integral types; simple global variables (PR #118743)

David Olsen via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 5 11:32:17 PST 2024


================
@@ -74,6 +75,32 @@ class LLVMLoweringInfo {
 class CIR_Op<string mnemonic, list<Trait> traits = []> :
     Op<CIR_Dialect, mnemonic, traits>, LLVMLoweringInfo;
 
+//===----------------------------------------------------------------------===//
+// GlobalOp
+//===----------------------------------------------------------------------===//
+
+// TODO(CIR): For starters, cir.global has only name and type.  The other
+// properties of a global variable will be added over time as more of ClangIR
+// is upstreamed.
+
+def GlobalOp : CIR_Op<"global"> {
+  let summary = "Declare or define a global variable";
+  let description = [{
+    ... lots of text to be added later ...
+  }];
+
+  let arguments = (ins SymbolNameAttr:$sym_name, TypeAttr:$sym_type);
+
+  let assemblyFormat = [{ $sym_name `:` $sym_type attr-dict }];
+
+  let skipDefaultBuilders = 1;
+
+  let builders = [OpBuilder<(ins "llvm::StringRef":$sym_name,
+		                             "mlir::Type":$sym_type)>];
----------------
dkolsen-pgi wrote:

This is new code.  It wasn't your fault.  The problem is that a couple tab characters made it in there, and VC Code expanded the tabs to a different width than GitHub.  I'll fix that.  Thanks for noticing that.

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


More information about the cfe-commits mailing list