Commit Graph

3288 Commits

Author SHA1 Message Date
Jakob Stoklund Olesen 68d6d8ab87 Move TableGen's register bank classes to their own source file.
I'll be moving some more code there to gather all of the
register-specific stuff in one place. Currently it is shared between
CodeGenTarget and RegisterInfoEmitter.

The plan is that CodeGenRegisters can compute the full register bank
structure while RegisterInfoEmitter only will handle the printing part.

llvm-svn: 132788
2011-06-09 18:42:07 +00:00
Bob Wilson 6b03ec7581 Add special-case range checking for VCVT_N intrinsic immediate operands.
Radar 9558930.

llvm-svn: 132782
2011-06-09 16:57:29 +00:00
Chad Rosier d0445fd5a5 Fixed a few illegal paths with llvm_unreachable. Patch by Cameron McInally.
llvm-svn: 132732
2011-06-07 20:41:31 +00:00
Jakob Stoklund Olesen 25b753bb3f Drop a RecordKeeper reference that wasn't necessary.
llvm-svn: 132636
2011-06-04 07:49:55 +00:00
Jakob Stoklund Olesen a4615a6f94 Silence compiler warnings.
llvm-svn: 132624
2011-06-04 05:09:36 +00:00
Jakob Stoklund Olesen fc205a5694 Teach TableGen to evaluate DAG expressions as set operations.
A TableGen backend can define how certain classes can be expanded into
ordered sets of defs, typically by evaluating a specific field in the
record. The SetTheory class can then evaluate DAG expressions that refer
to these named sets.

A number of standard set and list operations are predefined, and the
backend can add more specialized operators if needed. The -print-sets
backend is used by SetTheory.td to provide examples.

This is intended to simplify how register classes are defined:

  def GR32_NOSP : RegisterClass<"X86", [i32], 32, (sub GR32, ESP)>;

llvm-svn: 132621
2011-06-04 04:11:37 +00:00
Nick Lewycky 79286bf251 Rework the logic to not rely on undefined behaviour (1LL << 64). Also simplify.
llvm-svn: 132537
2011-06-03 08:25:39 +00:00
Jakob Stoklund Olesen 75703ca76f Make it possible to have unallocatable register classes.
Some register classes are only used for instruction operand constraints.
They should never be used for virtual registers. Previously, those
register classes were given an empty allocation order, but now you can
say 'let isAllocatable=0' in the register class definition.

TableGen calculates if a register is part of any allocatable register
class, and makes that information available in TargetRegisterDesc::inAllocatableClass.

The goal here is to eliminate use cases for overriding allocation_order_*
methods.

llvm-svn: 132508
2011-06-02 23:07:20 +00:00
Joerg Sonnenberger af5f23ee07 Add new -d option to tblgen. It writes a make(1)-style dependency file.
llvm-svn: 132395
2011-06-01 13:10:15 +00:00
Bruno Cardoso Lopes 394f516d16 Fix ssat and ssat16 encodings for ARM and Thumb. The bit position value
must be encoded decremented by one. Only add encoding tests for ssat16
because ssat can't be parsed yet.

llvm-svn: 132324
2011-05-31 03:33:27 +00:00
Rafael Espindola 08600bcf65 Use the dwarf->llvm mapping to print register names in the cfi
directives.

Fixes PR9826.

llvm-svn: 132317
2011-05-30 20:20:15 +00:00
Rafael Espindola ddffa0e160 Introduce the DwarfRegAlias class for declaring that two registers have the
same dwarf number. This will be used for creating a dwarf number to register
mapping.

The only case that needs this so far is the XMM/YMM registers that unfortunately
do have the same numbers.

llvm-svn: 132314
2011-05-30 17:49:59 +00:00
John McCall 375dcc9ec9 Change how tblgen generates attributes for intrinsics to use a single
switch.  With this newfound organization, teach tblgen how not to give
all intrinsics the 'nounwind' attribute.  Introduce a new intrinsic,
llvm.eh.resume, which does not have this attribute.  Documentation and uses
to follow.

llvm-svn: 132252
2011-05-28 06:31:34 +00:00
Rafael Espindola 836f7db2cc Fix the root cause of the bootstrap failure:
There was no way to check if a given register/mode pair was valid. We now return
an error code (-2) instead of asserting. If anyone thinks that an assert
at this point  is really needed, we can autogen a hasValidDwarfRegNum instead.

llvm-svn: 132236
2011-05-28 00:13:01 +00:00
Argyrios Kyrtzidis 0246d63715 [tablegen] A couple of changes to ClangDiagnosticEmmitter.
-Emit an empty warning option as string ("") instead of 0.
-For diagnostic names also emit the size of the string.

llvm-svn: 132046
2011-05-25 05:04:22 +00:00
Bill Wendling f5199debc0 Use a more efficient data structure for the "operand map". The number of
operands to an instruction aren't great, so an iterative search is fairly quick
and doesn't have the overhead of std::map.

llvm-svn: 131886
2011-05-23 00:18:33 +00:00
Cameron Zwarich 8b76e01c4b Fix PR9947 by placing OPFL_MemRefs on the node using memory operands rather than
the root if there is only one such node. This leaves only 2 verifier failures in
the entire test suite when running "make check".

llvm-svn: 131677
2011-05-19 21:13:30 +00:00
Tanya Lattner 48b182c3a4 In r131488 I misunderstood how VREV works. It splits the vector in half and splits each half. Therefore, the real problem was that we were using a VREV64 for a 4xi16, when we should have been using a VREV32.
Updated test case and reverted change to the PerfectShuffle Table.

llvm-svn: 131529
2011-05-18 06:42:21 +00:00
Tanya Lattner c7e291b354 vrev is incorrectly defined in the perfect shuffle table. The ordering is backwards (should be 0x3210 versus 0x1032) which exposed a bug when doing a shuffle on a 4xi16. I've attached a test case.
llvm-svn: 131488
2011-05-17 20:48:40 +00:00
Jakob Stoklund Olesen 4028ccdbe3 Downgrade a tablegen warning to an error.
Ambiguous sub-register index compositions are OK as long as the backend writer
knows what he is doing.

llvm-svn: 131134
2011-05-10 17:52:59 +00:00
Mon P Wang 92ff16b7bb Fixed MC encoding for index_align for VLD1/VST1 (single element from one lane) for size 32
llvm-svn: 131085
2011-05-09 17:47:27 +00:00
Jakob Stoklund Olesen c8c4ded3c6 Teach TableGen to automatically generate missing SubRegIndex instances.
The RegisterInfo.td file should only specify the indexes that sources need to
refer to. The rest is inferred.

llvm-svn: 131058
2011-05-07 21:22:39 +00:00
Jim Grosbach 59ddb73d47 Improve diagnostics for some parse errors. Not asserting when a user input
error is detected is a good thing.

llvm-svn: 131005
2011-05-06 18:47:45 +00:00
Jim Grosbach 763ac0397e ParseFile() may throw, so extend the try/catch to handle that.
llvm-svn: 131004
2011-05-06 18:39:28 +00:00
Mikhail Glushenkov 67ebd94a5d llvmc: Make it possible to provide an argument to (join).
llvm-svn: 130914
2011-05-05 04:24:58 +00:00
Nick Lewycky 737aac5107 The system suppression file should catch these, but since they *once again* are
not, I'll just add them here and be done with it.

llvm-svn: 130819
2011-05-04 01:03:02 +00:00
Jim Grosbach e6ce2053e7 Tidy up. Add missing newline to generated file.
llvm-svn: 130779
2011-05-03 19:09:56 +00:00
Eli Friedman 3bc13b4feb Filter out pattterns from the FastISel emitter which it doesn't actually know how to handle. No significant functionality change at the moment, but it's necessary for some changes I'm planning.
llvm-svn: 130547
2011-04-29 21:58:31 +00:00
Nick Lewycky 61aed87a49 Rename profile_rt.so to libprofile_rt.so under configure+make (it already was
under cmake).

Add libprofile_rt.a so that we can tell clang to link against it in --coverage
mode. Also turn it on by default in cmake builds.

Oscar, this touches a change you made for EXCLUDE_FROM_ALL support -- I think
I've done the right thing, but please let me know (or fix and commit) if not!

llvm-svn: 130470
2011-04-29 02:12:06 +00:00
Owen Anderson 715973fc6c Fix a bug in tblgen that caused incorrect encodings on instructions that specified operands with "bit" instead of "bits<1>".
Unfortunately, my only testcase for this is fragile, and the ARM AsmParser can't round trip the instruction in question.
<rdar://problem/9345702>

llvm-svn: 130410
2011-04-28 17:51:45 +00:00
Mikhail Glushenkov acb5f8ecf7 Add a TODO.
llvm-svn: 130092
2011-04-24 14:17:41 +00:00
Jay Foad 1a180156b6 Remove unused STL header includes.
llvm-svn: 130068
2011-04-23 19:53:52 +00:00
Johnny Chen 57c892860e Disassembly of A8.6.59 LDR (literal) Encoding T1 (16-bit thumb instruction) should
print out ldr, not ldr.n.

rdar://problem/9267772

llvm-svn: 130008
2011-04-22 19:12:43 +00:00
Bob Wilson 23c28ee17e Define Neon load/store intrinsics for Clang as macros instead of functions.
This is needed so the front-end can see "aligned" attributes on the type
for the pointer arguments.  Radar 9311427.

llvm-svn: 129964
2011-04-22 00:37:01 +00:00
Jakob Stoklund Olesen 6b3396fbd2 Don't allow per-register spill size and alignment.
These values were not used for anything. Spill size and alignment is a property
of the register class, not the register.

llvm-svn: 129906
2011-04-21 03:43:21 +00:00
Jakob Stoklund Olesen 0e34c1dfac Prefer cheap registers for busy live ranges.
On the x86-64 and thumb2 targets, some registers are more expensive to encode
than others in the same register class.

Add a CostPerUse field to the TableGen register description, and make it
available from TRI->getCostPerUse. This represents the cost of a REX prefix or a
32-bit instruction encoding required by choosing a high register.

Teach the greedy register allocator to prefer cheap registers for busy live
ranges (as indicated by spill weight).

llvm-svn: 129864
2011-04-20 18:19:48 +00:00
Eric Christopher 2e3fbaab39 Invert the meaning of printAliasInstr's return value. It now returns
true on success and false on failure. Update callers.

llvm-svn: 129722
2011-04-18 21:28:11 +00:00
Owen Anderson f2e8397b4b Enhance the fixed-length disassembler to support the callbacks necessary for symbolic disassembly.
llvm-svn: 129708
2011-04-18 18:42:26 +00:00
Chris Lattner 80254a53cc Add a new bit that ImmLeaf's can opt into, which allows them to duck out of
the generated FastISel.  X86 doesn't need to generate code to match ADD16ri8 
since ADD16ri will do just fine.  This is a small codesize win in the generated
instruction selector.

llvm-svn: 129692
2011-04-18 06:36:55 +00:00
Chris Lattner 07add49a4b Implement major new fastisel functionality: the matcher can now handle immediates with
value constraints on them (when defined as ImmLeaf's).  This is particularly important
for X86-64, where almost all reg/imm instructions take a i64immSExt32 immediate operand,
which has a value constraint.  Before this patch we ended up iseling the examples into
such amazing code as:

	movabsq	$7, %rax
	imulq	%rax, %rdi
	movq	%rdi, %rax
	ret

now we produce:

	imulq	$7, %rdi, %rax
	ret

This dramatically shrinks the generated code at -O0 on x86-64.

llvm-svn: 129691
2011-04-18 06:22:33 +00:00
Chris Lattner 722f0ccdf9 introduce a new OpKind abstraction which wraps up operand flavors in a tidy little wrapper.
No functionality change.

llvm-svn: 129680
2011-04-17 23:29:05 +00:00
Chris Lattner 9080391b55 change OperandsSignature to use SmallVector<char> instead of std::vector<string>
since the strings are always exactly one character, and there are usually only 2-3 operands.

llvm-svn: 129678
2011-04-17 22:24:13 +00:00
Chris Lattner 0d7a5a7daa since the VT is fixed for a ImmLeaf, there is no reason to expose it to the matching code.
llvm-svn: 129677
2011-04-17 22:17:27 +00:00
Chris Lattner 2ff8c1a25f now that predicates have a decent abstraction layer on them, introduce a new
kind of predicate: one that is specific to imm nodes.  The predicate function
specified here just checks an int64_t directly instead of messing around with
SDNode's.  The virtue of this is that it means that fastisel and other things
can reason about these predicates.

llvm-svn: 129675
2011-04-17 22:05:17 +00:00
Chris Lattner 514e292b72 Rework our internal representation of node predicates to expose more
structure and fix some fixmes.  We now have a TreePredicateFn class
that handles all of the decoding of these things.  This is an internal
cleanup that has no impact on the code generated by tblgen.

llvm-svn: 129670
2011-04-17 21:38:24 +00:00
Chris Lattner 4604bddc07 remove some debugging code I added.
llvm-svn: 129668
2011-04-17 21:36:19 +00:00
Chris Lattner b53ccb8e36 1. merge fast-isel-shift-imm.ll into fast-isel-x86-64.ll
2. implement rdar://9289501 - fast isel should fold trivial multiplies to shifts
3. teach tblgen to handle shift immediates that are different sizes than the 
   shifted operands, eliminating some code from the X86 fast isel backend.
4. Have FastISel::SelectBinaryOp use (the poorly named) FastEmit_ri_ function
   instead of FastEmit_ri to simplify code.

llvm-svn: 129666
2011-04-17 20:23:29 +00:00
Douglas Gregor f29216072e Initial work to improve documentation for Clang's diagnostics, from Matthieu Monrocq
llvm-svn: 129613
2011-04-15 22:04:07 +00:00
Evan Cheng a2e61292f0 Increase SubtargetFeatureKV Value and Implies fields to 64 bits since some targets are getting very close to 32 subtarget features. Also teach tablegen to error when there are more than 64 features to guard against undefined behavior. rdar://9282332
llvm-svn: 129590
2011-04-15 19:35:46 +00:00
Chris Lattner 0ab5e2cded Fix a ton of comment typos found by codespell. Patch by
Luis Felipe Strano Moraes!

llvm-svn: 129558
2011-04-15 05:18:47 +00:00