History log of /external/llvm/lib/TableGen/TGParser.cpp
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
307525cd24c3b9c081ddb3c34a3418f2875cd556 07-Sep-2012 Michael Liao <michael.liao@intel.com> Re-work bit/bits value resolving in tblgen

- This patch is inspired by the failure of the following code snippet
which is used to convert enumerable values into encoding bits to
improve the readability of td files.

class S<int s> {
bits<2> V = !if(!eq(s, 8), {0, 0},
!if(!eq(s, 16), {0, 1},
!if(!eq(s, 32), {1, 0},
!if(!eq(s, 64), {1, 1}, {?, ?}))));
}

Later, PR8330 is found to report not exactly the same bug relevant
issue to bit/bits values.

- Instead of resolving bit/bits values separately through
resolveBitReference(), this patch adds getBit() for all Inits and
resolves bit value by resolving plus getting the specified bit. This
unifies the resolving of bit with other values and removes redundant
logic for resolving bit only. In addition,
BitsInit::resolveReferences() is optimized to take advantage of this
origanization by resolving VarBitInit's variable reference first and
then getting bits from it.

- The type interference in '!if' operator is revised to support possible
combinations of int and bits/bit in MHS and RHS.

- As there may be illegal assignments from integer value to bit, says
assign 2 to a bit, but we only check this during instantiation in some
cases, e.g.

bit V = !if(!eq(x, 17), 0, 2);

Verbose diagnostic message is generated when invalid value is
resolveed to help locating the error.

- PR8330 is fixed as well.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163360 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/TableGen/TGParser.cpp
376a8a773e38fdcd9102a40e08ab1e0661d645d9 23-Aug-2012 Jakob Stoklund Olesen <stoklund@2pi.dk> Print out the location of expanded multiclass defs in TableGen errors.

When reporting an error for a defm, we would previously only report the
location of the outer defm, which is not always where the error is.

Now we also print the location of the expanded multiclass defs:

lib/Target/X86/X86InstrSSE.td:2902:12: error: foo
defm ADD : basic_sse12_fp_binop_s<0x58, "add", fadd, SSE_ALU_ITINS_S>,
^
lib/Target/X86/X86InstrSSE.td:2801:11: note: instantiated from multiclass
defm PD : sse12_fp_packed<opc, !strconcat(OpcodeStr, "pd"), OpNode, VR128,
^
lib/Target/X86/X86InstrSSE.td:194:5: note: instantiated from multiclass
def rm : PI<opc, MRMSrcMem, (outs RC:$dst), (ins RC:$src1, x86memop:$src2),
^

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@162409 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/TableGen/TGParser.cpp
cfbda4a04dacaf976505c54a5308f6954b3b9a58 02-Aug-2012 Jim Grosbach <grosbach@apple.com> TableGen: Allow use of #NAME# outside of 'def' names.

Previously, def NAME values were only populated, and references to NAME
resolved, when NAME was referenced in the 'def' entry of the multiclass
sub-entry. e.g.,
multiclass foo<...> {
def prefix_#NAME : ...
}

It's useful, however, to be able to reference NAME even when the default
def name is used. For example, when a multiclass has 'def : Pat<...>'
or 'def : InstAlias<...>' entries which refer to earlier instruction
definitions in the same multiclass. e.g.,
multiclass myMulti<RegisterClass rc> {
def _r : myI<(outs rc:$d), (ins rc:$r), "r $d, $r", []>;

def : InstAlias<\"wilma $r\", (!cast<Instruction>(NAME#\"_r\") rc:$r, rc:$r)>;
}

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@161198 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/TableGen/TGParser.cpp
fae8b1de47c004fefaa6c2683ae193d465b9d93f 25-May-2012 Jakob Stoklund Olesen <stoklund@2pi.dk> Add support for range expressions in TableGen foreach loops.

Like this:

foreach i = 0-127 in ...

Use braces for composite ranges:

foreach i = {0-3,9-7} in ...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157432 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/TableGen/TGParser.cpp
72cba6cdf640411e2fb6207858a0abd87c4286fc 25-May-2012 Jakob Stoklund Olesen <stoklund@2pi.dk> Don't put TGParser scratch results in the output.

Only fully expanded Records should go into RecordKeeper.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157431 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/TableGen/TGParser.cpp
8e5286e18ffbe4716ef92cd1de8901942d685e1b 25-May-2012 Jakob Stoklund Olesen <stoklund@2pi.dk> Simplify TGParser::ProcessForEachDefs.

Use static type checking.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@157430 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/TableGen/TGParser.cpp
cebb4ee93a0064e4a2cb1fd1da7455b01e5655cb 22-Feb-2012 David Greene <greened@obbligato.org> Add Foreach Loop

Add some data structures to represent for loops. These will be
referenced during object processing to do any needed iteration and
instantiation.

Add foreach keyword support to the lexer.

Add a mode to indicate that we're parsing a foreach loop. This allows
the value parser to early-out when processing the foreach value list.

Add a routine to parse foreach iteration declarations. This is
separate from ParseDeclaration because the type of the named value
(the iterator) doesn't match the type of the initializer value (the
value list). It also needs to add two values to the foreach record:
the iterator and the value list.

Add parsing support for foreach.

Add the code to process foreach loops and create defs based
on iterator values.

Allow foreach loops to be matched at the top level.

When parsing an IDValue check if it is a foreach loop iterator for one
of the active loops. If so, return a VarInit for it.

Add Emacs keyword support for foreach.

Add VIM keyword support for foreach.

Add tests to check foreach operation.

Add TableGen documentation for foreach.

Support foreach with multiple objects.

Support non-braced foreach body with one object.

Do not require types for the foreach declaration. Assume the iterator
type from the iteration list element type.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@151164 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/TableGen/TGParser.cpp
858143816d43e58b17bfd11cb1b57afbd7f0f893 07-Feb-2012 Craig Topper <craig.topper@gmail.com> Convert assert(0) to llvm_unreachable

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149967 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/TableGen/TGParser.cpp
1d5013992f8ecf5cc670ab8a1a599db4722c2f5d 28-Jan-2012 David Greene <greened@obbligato.org> Fix Record Name Reference

Get the record name though the init to avoid an assert.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@149153 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/TableGen/TGParser.cpp
4d6ccb5f68cd7c6418a209f1fa4dbade569e4493 20-Jan-2012 David Blaikie <dblaikie@gmail.com> More dead code removal (using -Wunreachable-code)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148578 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/TableGen/TGParser.cpp
b1320cb38158aedd5b59e0e3649ce5d1e90c9776 20-Jan-2012 Jim Grosbach <grosbach@apple.com> TblGen diagnostic for mismatched template instantiation.

Providing a template argment to a non-templatized class was crashing
tblgen. Add a diagnostic.

For example,
$ cat bug.td
class A;

def B : A<0> {
}
$ llvm-tblgen bug.td
bug.td:3:11: error: template argument provided to non-template class
def B : A<0> {
^

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148565 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/TableGen/TGParser.cpp
8dd6f0c8353f80de6526810899f271d539f6929c 13-Jan-2012 Jakob Stoklund Olesen <stoklund@2pi.dk> Delete CodeInit and CodeRecTy from TableGen.

The code type was always identical to a string anyway. Now it is simply
a synonym. The code literal syntax [{...}] is still valid.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148092 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/TableGen/TGParser.cpp
ebaf92c67dac4974f98a08f8096d3eb2f4edd09d 13-Jan-2012 Jakob Stoklund Olesen <stoklund@2pi.dk> Use uniqued StringInit pointers for lookups.

This avoids a gazillion StringMap and dynamic_cast calls, making
TableGen run 3x faster.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148091 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/TableGen/TGParser.cpp
94f2dc90a54443ea405776d6ffa2a4e27800d3d6 02-Dec-2011 Jim Grosbach <grosbach@apple.com> Check for error after InstantiateMultclassDef.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@145689 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/TableGen/TGParser.cpp
d3d1cad535d1c88e13e8e082c136260ee624967f 19-Oct-2011 David Greene <greened@obbligato.org> Implement Paste

Add a paste operator '#' to take two identifier-like strings and joint
them. Internally paste gets represented as a !strconcat() with any
necessary casts to string added.

This will be used to implement basic for loop functionality as in:

for i = [0, 1, 2, 3, 4, 5, 6, 7] {
def R#i : Register<...>
}

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142525 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/TableGen/TGParser.cpp
e5b252f9fe7a3dfc85ae25ca1603cb406071851b 19-Oct-2011 David Greene <greened@obbligato.org> Process NAME

During multiclass def instantiation, replace NAME in any expressions
with the value of the def or defm ID.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142524 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/TableGen/TGParser.cpp
7be867e48300861b7b1bf614eb204463533d6724 19-Oct-2011 David Greene <greened@obbligato.org> Process Defm Prefix as Init

Parse and process a defm prefix as an Init expression. This allows
paste operations to create defm prefixes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142523 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/TableGen/TGParser.cpp
a9e07dd66dcd951900f9e360fafc1ea30edcc9cd 19-Oct-2011 David Greene <greened@obbligato.org> Parse Def ID as Value

Allow def and defm IDs to be general values. We need this for paste
functionality.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142522 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/TableGen/TGParser.cpp
8592b2b2a3dde4e5c8f00e855497f760ae94272f 19-Oct-2011 David Greene <greened@obbligato.org> Don't Parse Object Body as a Name

Stop parsing a value if we are in name parsing mode and we see a left
brace. A left brace indicates the start of an object body when we are
parsing a name.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142521 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/TableGen/TGParser.cpp
bbec279d8eb0d7e27c2bf6e4da4f44286451d142 19-Oct-2011 David Greene <greened@obbligato.org> Use Parse Mode

Augment the value parser to respect the parse mode and not error if an
ID doesn't map to an object and we are in name parsing mode.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142520 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/TableGen/TGParser.cpp
f3744a0cf9f622e0879a80c1fdcb0f6072e5a6c3 19-Oct-2011 David Greene <greened@obbligato.org> Make ID Parsing More Flexible

Add a mode control to value and ID parsers. The two modes are:

- Parse a value. Expect the parsed ID to map to an existing object.

- Parse a name. Expect the parsed ID to not map to any existing object.

The first is used when parsing an identifier to be looked up, for
example a record field or template argument. The second is used for
parsing declarations. Paste functionality implies that declarations
can contain arbitrary expressions so we need to be able to call into
the general value parser to parse declarations with paste operators.
So we need a way to parse a value-like thing without expecting that
the result will map to some existing object. This parse mode provides
that.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142519 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/TableGen/TGParser.cpp
e338565757bfcfe9d762751c976684f66954fb45 19-Oct-2011 David Greene <greened@obbligato.org> Add NAME Member

Add a Value named "NAME" to each Record. This will be set to the def or defm
name when instantiating multiclasses. This will replace the #NAME# processing
hack once paste functionality is in place.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142518 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/TableGen/TGParser.cpp
22dde7e655b76f75bf11e86129410a7dcbfac3ba 19-Oct-2011 David Greene <greened@obbligato.org> Fix Name Access

Get the Record name as a string explicitly to avoid asserts.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142517 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/TableGen/TGParser.cpp
69a2394b2dd0136581f1485d69669246fc3b62c5 19-Oct-2011 David Greene <greened@obbligato.org> Fix Name Access

Get the Record name as a string explicitly to avoid asserts.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142516 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/TableGen/TGParser.cpp
91919cd8166bb60145efe54dd790b98521b4328a 19-Oct-2011 David Greene <greened@obbligato.org> Fix Name Access

Get the Record name as a string explicitly to avoid asserts.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142515 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/TableGen/TGParser.cpp
2c49fbb32c5f042ecf64ac415f1a628100951a44 19-Oct-2011 David Greene <greened@obbligato.org> Fix Name Access

Get the Record name by string explicitly to avoid potential asserts.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142514 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/TableGen/TGParser.cpp
e22b321d2276b634519165b101b02d92c2fcf5c7 19-Oct-2011 David Greene <greened@obbligato.org> Make Template Arg Names Inits

Allow template arg names to be Inits. This is further work to
implement paste as it allows template names to participate in paste
operations.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142500 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/TableGen/TGParser.cpp
917924d9912df76ba2e639c8c5b00cdcac91a16e 19-Oct-2011 David Greene <greened@obbligato.org> Let SetValue Take and Init Name

Convert SetValue to take the value name as an Init. This allows us to
set values for variables whose names are not yet fully resolved.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142499 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/TableGen/TGParser.cpp
a1b1b79be15c4b79a4282f148085ebad1cf877ca 07-Oct-2011 David Greene <greened@obbligato.org> Remove Multidefs

Multidefs are a bit unwieldy and incomplete. Remove them in favor of
another mechanism, probably for loops.

Revert "Make Test More Thorough"
Revert "Fix a typo."
Revert "Vim Support for Multidefs"
Revert "Emacs Support for Multidefs"
Revert "Document Multidefs"
Revert "Add a Multidef Test"
Revert "Update Test for Multidefs"
Revert "Process Multidefs"
Revert "Parser Multidef Support"
Revert "Lexer Support for Multidefs"
Revert "Add Multidef Data Structures"

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141378 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/TableGen/TGParser.cpp
caa25c81cd12f8a25b6cb7a3cba865a0dbcd4eaf 06-Oct-2011 David Greene <greened@obbligato.org> Prefix Template Arg Names with Multiclass Name

For consistency, prefix multiclass template arg names with the
multiclass name followed by "::" to avoid name clashes among
multiclass arguments and other entities in the multiclass.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141239 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/TableGen/TGParser.cpp
a6d442e65179092542d161679414b1e4e063ec4d 06-Oct-2011 David Greene <greened@obbligato.org> Process Multidefs

Process each multidef declared in a multiclass. Iterate through the
list and instantiate a def in the multiclass for each item, resolving
the list item to the temporary iterator (possibly) used in the
multidef ObjectBody. We then process each generated def in the normal
way.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141233 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/TableGen/TGParser.cpp
6da674cda1587c9b09e01f65219cec54f54d90b8 06-Oct-2011 David Greene <greened@obbligato.org> Parser Multidef Support

Add parser support to recognize multidefs. No processing on the
multidef is done at this point. The grammar is:

MultiDef = MULTIDEF ObjectName < Value, Declaration, Value > ObjectBody

The first Value must be resolveable to a list and the second Value
must be resolveable to an integer. The Declaration is a temporary
value used as an iterator to refer to list items during processing.
It may be passed into the ObjectBody where it will be substituted with
the list value used to instantiate each def.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141232 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/TableGen/TGParser.cpp
e499a2df4492dab21a50d74f3f687b989f910a2f 06-Oct-2011 David Greene <greened@obbligato.org> Refactor Multiclass Def Processing

Move the code to instantiate a multiclass def, bind its arguments and
resolve its members into three helper functions. These will be reused
to support a new kind of multiclass def: a multidef.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141229 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/TableGen/TGParser.cpp
7c788888872233748da10a8177a9a1eb176c1bc8 01-Oct-2011 Peter Collingbourne <peter@pcc.me.uk> Move TableGen's parser and entry point into a library

This is the first step towards splitting LLVM and Clang's tblgen executables.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140951 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/lib/TableGen/TGParser.cpp