Roxanne [email protected]

In general, the ADD and SUB instructions have a lot in common, but there is also a difference: addition is a commutative operation but subtraction is not. Let’s capture that fact in the record, too. A small challenge is that TableGen only supports a limited set of data types. You already used string and int in the examples. The other available data types are bit, bits<n>, list<type>, and dag. The bit type represents a single bit; that is, 0 or 1. If you need a fixed number of bits, then you use the bits<n> type. For example, bits<5> is an integer type 5 bits wide. To define a list based on another type, you use the list<type> type. For example, list<int> is a list of integers, and list<Inst> is a list of records of the Inst class from the example. The dag type represents directed acyclic graph (DAG) nodes. This type is useful for defining patterns and operations and is used extensively in LLVM backends.