[clang] [CIR] Integral types; simple global variables (PR #118743)
Shoaib Meenai via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 5 11:24:00 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)>];
----------------
smeenai wrote:
Nit: the indentation seems off here (which is probably my fault from the namespace renaming)
https://github.com/llvm/llvm-project/pull/118743
More information about the cfe-commits
mailing list