1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 03:23:01 +02:00
Commit Graph

22 Commits

Author SHA1 Message Date
Jakob Stoklund Olesen
3776477761 Use uniqued StringInit pointers for lookups.
This avoids a gazillion StringMap and dynamic_cast calls, making
TableGen run 3x faster.

llvm-svn: 148091
2012-01-13 03:16:35 +00:00
Jim Grosbach
129c6dbc32 Check for error after InstantiateMultclassDef.
llvm-svn: 145689
2011-12-02 18:33:03 +00:00
David Greene
d5d61b6c0c 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<...>
}

llvm-svn: 142525
2011-10-19 13:04:43 +00:00
David Greene
82113dc5a1 Process NAME
During multiclass def instantiation, replace NAME in any expressions
with the value of the def or defm ID.

llvm-svn: 142524
2011-10-19 13:04:35 +00:00
David Greene
fadf000eb9 Process Defm Prefix as Init
Parse and process a defm prefix as an Init expression.  This allows
paste operations to create defm prefixes.

llvm-svn: 142523
2011-10-19 13:04:31 +00:00
David Greene
1ce450a01d Parse Def ID as Value
Allow def and defm IDs to be general values.  We need this for paste
functionality.

llvm-svn: 142522
2011-10-19 13:04:29 +00:00
David Greene
8bafcdaa89 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.

llvm-svn: 142521
2011-10-19 13:04:26 +00:00
David Greene
b703001e0b 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.

llvm-svn: 142520
2011-10-19 13:04:21 +00:00
David Greene
3aebc33998 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.

llvm-svn: 142519
2011-10-19 13:04:20 +00:00
David Greene
09fc0034ab 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.

llvm-svn: 142518
2011-10-19 13:04:13 +00:00
David Greene
947cd6bbaf Fix Name Access
Get the Record name as a string explicitly to avoid asserts.

llvm-svn: 142517
2011-10-19 13:04:02 +00:00
David Greene
3cf03cfd6a Fix Name Access
Get the Record name as a string explicitly to avoid asserts.

llvm-svn: 142516
2011-10-19 13:03:58 +00:00
David Greene
b883bee7d6 Fix Name Access
Get the Record name as a string explicitly to avoid asserts.

llvm-svn: 142515
2011-10-19 13:03:51 +00:00
David Greene
9647006543 Fix Name Access
Get the Record name by string explicitly to avoid potential asserts.

llvm-svn: 142514
2011-10-19 13:03:45 +00:00
David Greene
19302d2140 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.

llvm-svn: 142500
2011-10-19 13:02:42 +00:00
David Greene
090d05729c 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.

llvm-svn: 142499
2011-10-19 13:02:39 +00:00
David Greene
ae3329d597 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"

llvm-svn: 141378
2011-10-07 18:25:05 +00:00
David Greene
f6b87ae29a 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.

llvm-svn: 141239
2011-10-05 22:42:54 +00:00
David Greene
f2b42642b1 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.

llvm-svn: 141233
2011-10-05 22:42:45 +00:00
David Greene
0ee8dfe2ad 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.

llvm-svn: 141232
2011-10-05 22:42:44 +00:00
David Greene
9b80f3256e 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.

llvm-svn: 141229
2011-10-05 22:42:07 +00:00
Peter Collingbourne
01246536d9 Move TableGen's parser and entry point into a library
This is the first step towards splitting LLVM and Clang's tblgen executables.

llvm-svn: 140951
2011-10-01 16:41:13 +00:00