Commit Graph

128 Commits

Author SHA1 Message Date
David Greene
0ffd167a01 [AVX] Unique BitInit
Keep only two copies of BitInit: one for true and one for false.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136488 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-29 19:07:10 +00:00
David Greene
ba1ae18287 [AVX] Unique UnsetInit
Keep only one UnsetInit around.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136487 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-29 19:07:09 +00:00
David Greene
dcd35c797d [AVX] Create Inits Via Factory Method
Replace uses of new *Init with *Init::get.  This hides the allocation
implementation so that we can unique Inits in various ways.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136486 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-29 19:07:07 +00:00
David Greene
f37dd02f77 [AVX] Constify Inits
Make references to Inits const everywhere.  This is the final step
before making them unique.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136485 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-29 19:07:05 +00:00
David Greene
60c04af787 [AVX] Remove non-const Iterators
Remove all non-const iterators from Init classes.  This is another
step toward constifying Inits and ultimately turning them into
FoldingSetNodes.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136484 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-29 19:07:02 +00:00
David Greene
ca7fd3de36 [AVX] Remove Mutating Members from Inits
Get rid of all Init members that modify internal state.  This is in
preparation for making references to Inits const.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136483 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-29 19:07:00 +00:00
David Greene
cd0bc905d2 Add a std::string Wrapper for TableGen
Create a std::string wrapper for use as a DenseMap key.  DenseMap is
not safe in generate with strings, so this wrapper indicates that only
strings guaranteed not to have certain values should be used in the
DenseMap.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136481 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-29 19:06:58 +00:00
Jakob Stoklund Olesen
77f8274c7d Intern all RecTy subclass instances to avoid duplicates.
Make all of the RecTy constructors private, and use get() factory
methods instead. Return singleton instances when it makes sense.

ListTy instance pointers are stored in the element RecTy instance.

BitsRecTy instance pointers, one per length, are stored in a static vector.

Also unique DefInit instances. A Record has a unique DefInit which
has a unique RecordRecTy instance.

This saves some 200k-300k RecTy allocations when parsing ARM.td. It
reduces TableGen's heap usage by almost 50%.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135399 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-18 17:02:57 +00:00
Eric Christopher
d568b3f552 Revert r134921, 134917, 134908 and 134907. They're causing failures
in multiple buildbots.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134936 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-11 23:06:52 +00:00
David Greene
5e3cb47bea Use get(0 Instead of Create()
Respond to some feedback asking for a name change.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134921 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-11 20:55:22 +00:00
David Greene
d4a9066c93 [AVX] Make Inits Foldable
Manage Inits in a FoldingSet.  This provides several benefits:

- Memory for Inits is properly managed

- Duplicate Inits are folded into Flyweights, saving memory

- It enforces const-correctness, protecting against certain classes
  of bugs

The above benefits allow Inits to be used in more contexts, which in
turn provides more dynamism to TableGen.  This enhanced capability
will be used by the AVX code generator to a fold common patterns
together.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@134907 91177308-0d34-0410-b5e6-96231b3b80d8
2011-07-11 18:25:51 +00:00
Owen Anderson
bea6f615ee Add support for alternative register names, useful for instructions whose operands are logically equivalent to existing registers, but happen to be printed specially. For example, an instruciton that prints d0[0] instead of s0.
Patch by Jim Grosbach.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133940 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-27 21:06:21 +00:00
Jim Grosbach
0b6a44afb9 Consolidate some TableGen diagnostic helper functions.
TableGen had diagnostic printers sprinkled about in a few places. Pull them
together into a single location in Error.cpp.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@133568 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-21 22:55:50 +00:00
Nick Lewycky
b2afe8759d Rework the logic to not rely on undefined behaviour (1LL << 64). Also simplify.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@132537 91177308-0d34-0410-b5e6-96231b3b80d8
2011-06-03 08:25:39 +00:00
Jim Grosbach
5d754bfa32 Improve diagnostics for some parse errors. Not asserting when a user input
error is detected is a good thing.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131005 91177308-0d34-0410-b5e6-96231b3b80d8
2011-05-06 18:47:45 +00:00
David Greene
1434f66b2e Rename lisp-like functions as suggested by Gabor Greif as loooong time
ago.  This is both easier to learn and easier to read.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123001 91177308-0d34-0410-b5e6-96231b3b80d8
2011-01-07 17:05:37 +00:00
Bill Wendling
548f5a0b75 Add support for using the `!if' operator when initializing variables:
class A<bit a, bits<3> x, bits<3> y> {
    bits<3> z;
    let z = !if(a, x, y);
  }

The variable z will get the value of x when 'a' is 1 and 'y' when a is '0'.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121666 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-13 01:46:19 +00:00
Chris Lattner
67db883487 eliminate the Records global variable, patch by Garrison Venn!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121659 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-13 00:23:57 +00:00
Chris Lattner
9d6250f52b clean up RecordKeeper::getAllDerivedDefinitions, patch by Garrison Venn!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121658 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-13 00:20:52 +00:00
Bill Wendling
ab7837c269 Get rid of ellipses.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@121589 91177308-0d34-0410-b5e6-96231b3b80d8
2010-12-10 22:54:30 +00:00
Michael J. Spencer
1f6efa3996 Merge System into Support.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120298 91177308-0d34-0410-b5e6-96231b3b80d8
2010-11-29 18:16:10 +00:00
Chris Lattner
c7252ce743 remove the !nameconcat tblgen feature. It "shorthand" and only used in 4 places
where !cast is just as short.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115722 91177308-0d34-0410-b5e6-96231b3b80d8
2010-10-06 00:19:21 +00:00
David Greene
9703843dfa Generalize getFieldType to work on all TypedInits. Add a couple of testcases from
Amaury Pouly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113010 91177308-0d34-0410-b5e6-96231b3b80d8
2010-09-03 21:00:49 +00:00
Bruno Cardoso Lopes
81cd7ffe45 Fix a tblgen bug.
Given the pattern below as an example:
list<dag> Pattern = [(set RC:$dst, (v4f32 (shufp:src3 RC:$src1,
                            (mem_frag addr:$src2))))];

The right reference resolving should lead to:
list<dag> Pattern = [(set VR128:$dst, (v4f32 (shufp:src3 VR128:$src1,
                            (mem_frag addr:$src2))))];
But was yielding:
list<dag> Pattern = [(set VR128:$dst, (v4f32 (shufp VR128:$src1,
                            (mem_frag addr:$src2))))];

Fix this by passing the right name when creating a new DagInit node.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106670 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-23 19:50:39 +00:00
Bruno Cardoso Lopes
93583c97f8 In case Rec is a definition and not a class, do the proper comparison!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106246 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-17 23:00:16 +00:00
Bruno Cardoso Lopes
477bf62048 Fix the handling of !if result, avoiding null results for non 'int'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106201 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-17 01:50:39 +00:00
Bruno Cardoso Lopes
eba8f1893b For a tablegen expression such as !if(a,b,c), let 'a'
be evaluated for 'bit' operators


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106185 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-17 00:31:36 +00:00
Bruno Cardoso Lopes
e87de41189 let the '!eq' expression support 'int' and 'bit' types
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@106171 91177308-0d34-0410-b5e6-96231b3b80d8
2010-06-16 23:24:12 +00:00
Jakob Stoklund Olesen
fddb7667ca Replace TSFlagsFields and TSFlagsShifts with a simpler TSFlags field.
When a target instruction wants to set target-specific flags, it should simply
set bits in the TSFlags bit vector defined in the Instruction TableGen class.

This works well because TableGen resolves member references late:

class I : Instruction {
  AddrMode AM = AddrModeNone;
  let TSFlags{3-0} = AM.Value;
}

let AM = AddrMode4 in
def ADD : I;

TSFlags gets the expected bits from AddrMode4 in this example.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@100384 91177308-0d34-0410-b5e6-96231b3b80d8
2010-04-05 03:10:20 +00:00
Jakob Stoklund Olesen
70feca409e Teach TableGen to understand X.Y notation in the TSFlagsFields strings.
Remove much horribleness from X86InstrFormats as a result. Similar
simplifications are probably possible for other targets.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99539 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-25 18:52:01 +00:00
Jakob Stoklund Olesen
d1baa252c4 Fix evil TableGen bug in template parameters with defaults.
If a TableGen class has an initializer expression containing an X.Y subexpression,
AND X depends on template parameters,
AND those template parameters have defaults,
AND some parameters with defaults are beyond position 1,
THEN parts of the initializer expression are evaluated prematurely with the default values when the first explicit template parameter is substituted, before the remaining explicit template parameters have been substituted.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99492 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-25 06:23:34 +00:00
Chris Lattner
0b6c926856 disallow concatenation of two dags with different operators.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@98871 91177308-0d34-0410-b5e6-96231b3b80d8
2010-03-18 21:07:51 +00:00
David Greene
6786d5e183 Add an !eq() operator to TableGen. It operates on strings only.
Use !cast<string>() to compare other types of objects.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92754 91177308-0d34-0410-b5e6-96231b3b80d8
2010-01-05 19:11:42 +00:00
David Greene
f660802f34 Fix a bug in !subst where TableGen would go and resubstitute text it had
just substituted.  This could cause infinite looping in certain
pathological cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@91843 91177308-0d34-0410-b5e6-96231b3b80d8
2009-12-21 21:21:34 +00:00
Dan Gohman
9e763b88b0 Delete some dead and non-obvious code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89729 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-24 01:48:15 +00:00
Bob Wilson
21870411d9 Fix whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89582 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-22 04:24:42 +00:00
Bob Wilson
2214dc0764 Fix pr5470. Tablegen handles template arguments by temporarily setting their
values, resolving references to them, and then removing the definitions.
If a template argument is set to an undefined value, we need to resolve
references to that argument to an explicit undefined value.  The current code
leaves the reference to the template argument as it is, which causes an
assertion failure later when the definition of the template argument is
removed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89581 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-22 03:58:57 +00:00
Bob Wilson
a8449e6aaa Fix some spelling in comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@89566 91177308-0d34-0410-b5e6-96231b3b80d8
2009-11-21 22:44:20 +00:00
Chandler Carruth
8b67f774e9 Move DataTypes.h to include/llvm/System, update all users. This breaks the last
direct inclusion edge from System to Support.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@85086 91177308-0d34-0410-b5e6-96231b3b80d8
2009-10-26 01:35:46 +00:00
Chris Lattner
c19418f31f convert some stuff to StringRef to avoid temporary std::strings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82244 91177308-0d34-0410-b5e6-96231b3b80d8
2009-09-18 18:31:37 +00:00
Daniel Dunbar
6f5cc82686 Fix non-determinism in DAGISel emitter.
- This manifested as non-determinism in the .inc output in rare cases (when two
   distinct patterns ended up being equivalent, which is rather rare). That
   meant the pattern matching was non-deterministic, which could eventually mean
   the code generator selected different instructions based on the arch.

 - It's probably worth making the DAGISel ensure a total ordering (or force the
   user to), but the simple fix here is to totally order the Record* maps based
   on a unique ID.

 - PR4672, PR4711.

Yay:
--
ddunbar@giles:~$ cat ~/llvm.obj.64/lib/Target/*/*.inc | shasum
d1099ff34b21459a5a3e7021c225c080e6017ece  -
ddunbar@giles:~$ cat ~/llvm.obj.ppc/lib/Target/*/*.inc | shasum
d1099ff34b21459a5a3e7021c225c080e6017ece  -
--

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79846 91177308-0d34-0410-b5e6-96231b3b80d8
2009-08-23 09:47:37 +00:00
Daniel Dunbar
1a55180238 Replace std::iostreams with raw_ostream in TableGen.
- Sorry, I can't help myself.

 - No intended functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74742 91177308-0d34-0410-b5e6-96231b3b80d8
2009-07-03 00:10:29 +00:00
David Greene
2bfa06d8cd Remove commented code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74471 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-29 22:55:52 +00:00
David Greene
2c0266202d Implement !cast<string>.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74444 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-29 20:05:29 +00:00
David Greene
ffc0ab6037 Revert 73074 and 73099 because Windows doesn't have POSIX
regular expressions.  We will add an OpenBSD implementation
and re-apply ASAP.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73138 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-09 18:31:17 +00:00
David Greene
0d973999f3 Add a !patsubst operator. Use on string types.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73099 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-08 23:05:37 +00:00
David Greene
e1b469170b Make IntInits and ListInits typed. This helps deduce types of !if and
other operators.  For the rare cases where a list type cannot be
deduced, provide a []<type> syntax, where <type> is the list element
type.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73078 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-08 20:23:18 +00:00
David Greene
77c489dcae Make !if short-circuit when possible.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73076 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-08 19:16:56 +00:00
David Greene
938c8ab0a0 Add a !regmatch operator to do pattern matching in TableGen.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73074 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-08 17:00:34 +00:00
Nick Lewycky
c98a77d078 Fix warning.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@71834 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-15 03:07:14 +00:00