[PATCH] D94529: [TableGen] Enhance !cast<string> to handle bit and bits types

Paul C. Anagnostopoulos via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 12 10:50:26 PST 2021


Paul-C-Anagnostopoulos added inline comments.


================
Comment at: llvm/test/TableGen/cast-string.td:41
+  bits<8> bits2 = 0b00100101;
+  string str = !cast<string>(bits1) # " and " # !cast<string>(bits2);
+}
----------------
madhur13490 wrote:
> Would it be useful if we can cast bits to the literal string also and not just to its decimal equivalent? e.g. something like 
> ```
> !cast<stringref>(bits1) -> "0b0101".
> ```
> 
> I am not sure if this exists today or any backend needs it. 
It can't be a pseudo-type without all sorts of horrible parsing hackery. I'll look around to see if it seems useful and then add a !binaryliteral operator if so.



================
Comment at: llvm/test/TableGen/cast-string.td:53
+
+// ERROR1: nitializer of 'str' in 'Rec5' could not be fully resolved
+
----------------
madhur13490 wrote:
> Typo - Initializer?
I left off the "I" so it won't matter whether it is upper- or lowercase.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D94529/new/

https://reviews.llvm.org/D94529



More information about the llvm-commits mailing list