[PATCH] D21091: AArch64: refactor sysreg handling (new TableGen backend!)

Tim Northover via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 7 12:48:39 PDT 2016


t.p.northover added a comment.

Thanks for looking Ahmed.


================
Comment at: include/llvm/TableGen/SearchableTable.td:46-48
@@ +45,4 @@
+
+class Code<code val> {
+  code Field = val;
+}
----------------
ab wrote:
> Hmm, why not use 'code' directly?
Oh, you'll love this one: code just gets mapped to a plain StringInit in TGParser.cpp. There's no way for a backend to tell what was intended, and I need at least some strings to be quoted.

I'll put a comment in about that.

================
Comment at: lib/Target/AArch64/AArch64SystemOperands.td:21-26
@@ +20,8 @@
+
+def ATMapping : MappingKind {
+  let InstanceClass = "AT";
+  let Fields = ["Name", "Encoding"];
+  let SearchableFields = ["Name", "Encoding"];
+  let EnumValueField = "Encoding";
+}
+
----------------
ab wrote:
> The MappingKind defs are a bit awkward; maybe inherit from MappingKind itself in AT/DB/..., get rid of InstanceClass, and pass the fields as template arguments?
> 
> That also lets you nicely factor out the similar Fields/SearchableFields/... here.
I started off like that, but switched. I can't quite remember the details, I *think* it was because I couldn't come up with a clean way to tell what instances of MappingKind belonged to what table at the time.

But I could probably iterate through all classes and just handle subclasses of MappingKind. I'll see if I can make it work, because it would be a lot neater from a user's point of view.


Repository:
  rL LLVM

http://reviews.llvm.org/D21091





More information about the llvm-commits mailing list