[PATCH] D49084: FileCheck: Add support for variable expressions

Thomas Preud'homme via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 9 09:37:05 PDT 2018


thopre created this revision.
thopre added reviewers: jhenderson, tra, chandlerc.

On 32-bit targets, 64-bit values are often stored in 2 registers, with
the requirements that they must be consecutive. This is impossible to
express as a regular expression for FileCheck at the moment which forces
to use hardcoded numbers in the CHECK patterns, such as:

op  r{{[0-9]+}}, r0, r1

This patch adds support for variable expressions in FileCheck to be able
to express that two integer value are linked by an arithmetic
expression. Matching the above situation can then be done in this way:

op  r{{[0-9]+}}, r[[REGSTART:[0-9]+]], r[[REGSTART+1]]

Note that due to its implementation patterns with expressions only match
correctly if the variable definition match appropriately when replacing
the variable expression in the same pattern by [[:digit:]]+.


Repository:
  rL LLVM

https://reviews.llvm.org/D49084

Files:
  docs/CommandGuide/FileCheck.rst
  test/FileCheck/var-expression.txt
  utils/FileCheck/FileCheck.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49084.154626.patch
Type: text/x-patch
Size: 23132 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180709/7b58cc26/attachment.bin>


More information about the llvm-commits mailing list