Path: blob/21.2-virgl/src/freedreno/registers/text-format.txt
7642 views
1. Introduction to rules-ng-ng text format12This-specification defines a text format that can be converted to and from rules-ng-ng XML.3It is intended to allow to create rules-ng-ng files with much less typing and with a more readable text.4xml2text can convert rules-ng-ng XML to this text format5text2xml can convert this text format to rules-ng-ng XML67This specification is an addendum to the rules-ng-ng specification and assumes familiarity with it.892. Format10112.1. Line format1213The initial indentation of a line is divided by 8 and the result determines the position in the document structure (similar to the Python language).14A "//" anywhere in the line causes the rest to be converted to an XML comment (like C++)15A line starting with ":" creates a <doc> tag with the rest of the line (excluding anything starting with //).16The content of multiple lines starting with ":" is merged in a single <doc> tag.17182.2. Tokenization1920The line is then tokenized.21Token are generally continuous strings on non-whitespace characters, with some exceptions22Some characters (such as ":", "=" and "-") form a single-character token.23Text within double quotes generates a <brief> tag.24Any token formatted as ATTR(VALUE) generates an ATTR="VALUE" attribute. No whitespace allowed between ATTR and the '(' character.25Any token formatted as (VALUE) generates a variants="VALUE" attribute.26Any token formatted as (VARSET=VALUE) generates a varset="VARSET" variants="VALUE" attribute.27282.3. Special token sequences2930These sequences are recognized and extracted before matching the line format:3132: NUM33set REGLIKE to regNUM34you must specify a type if the reg is anonymous35the : is recognized only if it is the third or successive token (and not the last) to avoid ambiguity with bitfields and generic tags3637{ STRIDE }38stride="STRIDE" attribute3940[ LENGTH ]41length="LENGTH" attribute4243!FLAGS44access="FLAGS"45no whitespace allowed after '!'4647:=48at the end of the line49set REGLIKE to "stripe"5051=52at the end of the line53set REGLIKE to "array"5455inline56at the beginning of the line57inline="yes" attribute58592.4. Line patterns6061The following line patterns are understood.62Only word tokens are used to match lines.63All tokens with special meaning are treated separately as described above.64[FOO] means that FOO is optional6566#import "FILE"67<import file="FILE"/>6869#pragma regNUM70REGLIKE is now set by default to regNUM instead of reg327172@TAG [NAME]73<TAG name="NAME"/>74use this if there are no children7576TAG [NAME] :77<TAG name="NAME">78use this if there are children7980TOKEN81<value value="TOKEN" /> if inside a reg or enum and TOKEN starts with a digit82<value name="TOKEN" /> if inside a reg or enum and TOKEN does not start with a digit83<REGLIKE offset="TOKEN" /> otherwise8485POS NAME86<bitfield low="POS" high="POS" name="NAME"/> if inside a reg or bitset87<REGLIKE offset="POS" name="NAME"> otherwise8889LOW - HIGH NAME [TYPE]90<bitfield low="LOW" high="HIGH" name="NAME" type="TYPE"/>9192VALUE = NAME93<value value="VALUE" name="NAME"/>9495use WHAT NAME96<use-WHAT name="NAME" />9798OFFSET NAME [TYPE]99<REGLIKE offset="OFFSET" name="NAME" type="TYPE">100101102103