Commit Graph

1600 Commits

Author SHA1 Message Date
Dan Gohman 7170623b16 Begin making more use of the FastISelEmitter class.
llvm-svn: 55093
2008-08-21 00:19:05 +00:00
Dan Gohman e6724d404b Remove an obsolete todo comment.
llvm-svn: 55080
2008-08-20 21:47:28 +00:00
Dan Gohman 3e2225dfd6 Factor the code for determining the target-specific instruction
namespace out of the isel emitters and into common code.

llvm-svn: 55079
2008-08-20 21:45:57 +00:00
Dan Gohman 02c84b8910 Simplify FastISel's constructor argument list, make the FastISel
class hold a MachineRegisterInfo member, and make the
MachineBasicBlock be passed in to SelectInstructions rather
than the FastISel constructor.

llvm-svn: 55076
2008-08-20 21:05:57 +00:00
Dan Gohman b93b489c54 Fix the string for MVT::isVoid.
llvm-svn: 55034
2008-08-20 01:44:30 +00:00
Dan Gohman 2dbebd7db5 For now, restrict FastISel to instructions that only involve one
register class.

llvm-svn: 55008
2008-08-19 20:58:14 +00:00
Dan Gohman 98e6f1c48a Factor out the code to scan an instruction's operands into a
helper function.

llvm-svn: 55007
2008-08-19 20:56:30 +00:00
Dan Gohman aa13b6f71b Add more comments.
llvm-svn: 55004
2008-08-19 20:36:33 +00:00
Dan Gohman 49520b99a3 Fix indentation in FastISel tablegen-emitted code.
llvm-svn: 55003
2008-08-19 20:31:38 +00:00
Dan Gohman a6c14d0ddb Add more checking to filter out more kinds of things that
FastISel doesn't support yet.

llvm-svn: 55002
2008-08-19 20:30:54 +00:00
Dan Gohman 6a36fe912c 80 columns.
llvm-svn: 54998
2008-08-19 18:07:49 +00:00
Dan Gohman dbd5328238 Add a few doxygen comments.
llvm-svn: 54997
2008-08-19 18:06:12 +00:00
Dan Gohman 522012fc56 Remove an unneeded #include.
llvm-svn: 54996
2008-08-19 17:53:16 +00:00
Devang Patel 3978c758f7 Compress manpages.
llvm-svn: 54971
2008-08-19 01:17:41 +00:00
Owen Anderson fa8b2ea41b Speed up addRegisterDead by adding more fast checks before performing the expensive
subregister query, and by increasing the size of the subregister hashtable so
that there are fewer collisions.

llvm-svn: 54781
2008-08-14 18:34:18 +00:00
Daniel Dunbar f3537e04bb Update makellvm to return correct result code.
llvm-svn: 54756
2008-08-13 20:43:56 +00:00
Dan Gohman b2226e21c3 Initial checkin of the new "fast" instruction selection support. See
the comments in FastISelEmitter.cpp for details on what this is.
This is currently experimental and unusable.

llvm-svn: 54751
2008-08-13 20:19:35 +00:00
Dan Gohman e81ac0b66f Oops, check in these files too, for the FastISel -> Fast rename.
llvm-svn: 54750
2008-08-13 19:55:00 +00:00
Chris Lattner 4d3a5f0817 remove obsolete files
llvm-svn: 54630
2008-08-11 06:12:45 +00:00
Bill Wendling 9b26ca1ab4 Add ARM to the targets to build.
llvm-svn: 54386
2008-08-05 23:52:28 +00:00
Mon P Wang 2c839d4b1e Added support for overloading intrinsics (atomics) based on pointers
to different address spaces.  This alters the naming scheme for those
intrinsics, e.g., atomic.load.add.i32 => atomic.load.add.i32.p0i32

llvm-svn: 54195
2008-07-30 04:36:53 +00:00
Bill Wendling ac3cf6657b Don't build with 4.0.
llvm-svn: 54137
2008-07-28 18:45:36 +00:00
Dan Gohman 2ce6f2ad5e Rename SDOperand to SDValue.
llvm-svn: 54128
2008-07-27 21:46:04 +00:00
Chris Lattner e754764aa9 'Previously, the emacs tablegen mode would highlight constants even if
they appear in words. This would cause things like the "128" in "VR128"
to be highlighted. This patch fixes the highlighting by only recognizing 
constants when they have word breaks around them.'

Patch by Stefanus Du Toit!

llvm-svn: 53944
2008-07-23 04:49:20 +00:00
Bill Wendling c90c560c43 Temporary hack to build with GCC 4.0 instead of 4.2.
llvm-svn: 53860
2008-07-21 18:33:09 +00:00
Dan Gohman 1705968102 Add a new function, ReplaceAllUsesOfValuesWith, which handles bulk
replacement of multiple values. This is slightly more efficient
than doing multiple ReplaceAllUsesOfValueWith calls, and theoretically
could be optimized even further. However, an important property of this
new function is that it handles the case where the source value set and
destination value set overlap. This makes it feasible for isel to use
SelectNodeTo in many very common cases, which is advantageous because
SelectNodeTo avoids a temporary node and it doesn't require CSEMap
updates for users of values that don't change position.

Revamp MorphNodeTo, which is what does all the work of SelectNodeTo, to
handle operand lists more efficiently, and to correctly handle a number
of corner cases to which its new wider use exposes it.

This commit also includes a change to the encoding of post-isel opcodes
in SDNodes; now instead of being sandwiched between the target-independent
pre-isel opcodes and the target-dependent pre-isel opcodes, post-isel
opcodes are now represented as negative values. This makes it possible
to test if an opcode is pre-isel or post-isel without having to know
the size of the current target's post-isel instruction set.

These changes speed up llc overall by 3% and reduce memory usage by 10%
on the InstructionCombining.cpp testcase with -fast and -regalloc=local.

llvm-svn: 53728
2008-07-17 19:10:17 +00:00
Bill Wendling 5c77307c2b Porting r53478 into mainline:
Update to build_llvm. Don't output a floating point number for the version.

llvm-svn: 53484
2008-07-11 22:42:10 +00:00
Evan Cheng 4a898c0b11 TargetRegisterDesc::Name field is the same as the abstract register name. There is no need for targets to specify register names in addition to their AsmName's.
llvm-svn: 53207
2008-07-07 22:19:41 +00:00
Dan Gohman d6ec05077f Refactor the tablegen DAGISelEmitter code for outputing calls to
getTargetNode and SelectNodeTo to reduce duplication, and to
make some of the getTargetNode code available to SelectNodeTo.
Use SelectNodeTo instead of getTargetNode in several new
interesting cases, as it mutates nodes in place instead of
creating new ones.

This triggers some scheduling behavior differences due to nodes
being presented to the scheduler in a different order. Some of the
arbitrary scheduling decisions it makes are now arbitrarily made
differently. This is visible in CodeGen/PowerPC/LargeAbsoluteAddr.ll,
where a trivial scheduling difference led to a trivial register
allocation difference.

llvm-svn: 53203
2008-07-07 21:00:17 +00:00
Dan Gohman 56e3f63ec5 Add explicit keywords.
llvm-svn: 53179
2008-07-07 18:00:37 +00:00
Evan Cheng 798d9bb97f isel load folding is disabled at -fast. Now hoist the check up to the top level to save some time.
llvm-svn: 53096
2008-07-03 08:39:51 +00:00
Dan Gohman 22e9707480 Replace a few uses of SelectionDAG::getTargetNode with
SelectionDAG::SelectNodeTo in the instruction selector. This
updates existing nodes in place instead of creating new ones.

Go back to selecting ISD::DBG_LABEL nodes into
TargetInstrInfo::DBG_LABEL nodes instead of leaving them
unselected, now that SelectNodeTo allows us to update them
in place.

llvm-svn: 53057
2008-07-02 23:23:19 +00:00
Owen Anderson 3684013910 Make the subregister hashtable output more readable by wrapping the lines,
and mark it const along with the associated changes to TargetRegisterInfo.

llvm-svn: 52966
2008-07-01 17:34:38 +00:00
Owen Anderson 9e75cb2e7a Use delete[] instead of free on an array created with new[].
llvm-svn: 52960
2008-07-01 15:56:31 +00:00
Owen Anderson 1760b92d27 Implement suggestions from Chris:
- Use a more accurate heuristic for the size of the hashtable.
  - Use bitwise and instead of modulo since the size is a power of two.
  - Use new[] instead of malloc().

llvm-svn: 52951
2008-07-01 07:02:30 +00:00
Owen Anderson 49cce257ae Replace the dynamically computed std::set lookup method for subregisters with a hashtable-based
version that is computed by tblgen at the time LLVM is compiled.

llvm-svn: 52945
2008-07-01 00:18:52 +00:00
Dan Gohman fb19f9402b Split ISD::LABEL into ISD::DBG_LABEL and ISD::EH_LABEL, eliminating
the need for a flavor operand, and add a new SDNode subclass,
LabelSDNode, for use with them to eliminate the need for a label id
operand.

Change instruction selection to let these label nodes through
unmodified instead of creating copies of them. Teach the MachineInstr
emitter how to emit a MachineInstr directly from an ISD label node.

This avoids the need for allocating SDNodes for the label id and
flavor value, as well as SDNodes for each of the post-isel label,
label id, and label flavor.

llvm-svn: 52943
2008-07-01 00:05:16 +00:00
Evan Cheng 5447e4331b Eliminate TargetRegisterDesc::ImmSubRegs. It's no longer in use.
llvm-svn: 52892
2008-06-30 07:32:56 +00:00
Chris Lattner 2e253b426f check in anton's patch to make inlining happen in a determinstic order
and fix the bug that it uncovers: inlining a pattern fragment could bring
in other pattern fragments if the inlinee hadn't already been inlined.

llvm-svn: 52888
2008-06-30 03:02:03 +00:00
Dale Johannesen a2de8eab61 Fixes the last x86-64 test failure in compat.exp:
<16 x float> is 64-byte aligned (for some reason),
which gets us into the stack realignment code.  The
computation changing FP-relative offsets to SP-relative
was broken, assiging a spill temp to a location
also used for parameter passing.  This
fixes it by rounding up the stack frame to a multiple
of the largest alignment (I concluded it wasn't fixable
without doing this, but I'm not very sure.)

llvm-svn: 52750
2008-06-26 01:51:13 +00:00
Mon P Wang 6a490371c9 Added MemOperands to Atomic operations since Atomics touches memory.
Added abstract class MemSDNode for any Node that have an associated MemOperand
Changed atomic.lcs => atomic.cmp.swap, atomic.las => atomic.load.add, and
atomic.lss => atomic.load.sub

llvm-svn: 52706
2008-06-25 08:15:39 +00:00
Chris Lattner 01602a18a9 Add support for building on solaris, working around namespace
polution problems from system headers.  Patch by Nathan Keynes!

llvm-svn: 52682
2008-06-24 17:44:42 +00:00
Bill Wendling e2af44d9c0 Extract the x86_64 part for the executables.
llvm-svn: 52647
2008-06-23 22:08:30 +00:00
Evan Cheng 49bad4c9e1 - Add "Commutative" property to intrinsics. This allows tblgen to generate the commuted variants for dagisel matching code.
- Mark lots of X86 intrinsics as "Commutative" to allow load folding.

llvm-svn: 52353
2008-06-16 20:29:38 +00:00
Matthijs Kooijman d4f2f2e86f Remove some debug output from tblgen. This fixes a test.
llvm-svn: 52177
2008-06-10 14:53:49 +00:00
Dan Gohman 3ab46f1383 AsmParser support for immediate constant aggregate values.
llvm-svn: 52149
2008-06-09 14:45:02 +00:00
Duncan Sands 13237ac3b9 Wrap MVT::ValueType in a struct to get type safety
and better control the abstraction.  Rename the type
to MVT.  To update out-of-tree patches, the main
thing to do is to rename MVT::ValueType to MVT, and
rewrite expressions like MVT::getSizeInBits(VT) in
the form VT.getSizeInBits().  Use VT.getSimpleVT()
to extract a MVT::SimpleValueType for use in switch
statements (you will get an assert failure if VT is
an extended value type - these shouldn't exist after
type legalization).
This results in a small speedup of codegen and no
new testsuite failures (x86-64 linux).

llvm-svn: 52044
2008-06-06 12:08:01 +00:00
Nick Lewycky 0702adc65e Escape "$#".
llvm-svn: 51998
2008-06-05 12:54:44 +00:00
Chris Lattner 6449690da4 Add #includes required by GCC 4.3, thanks for Zhongxing Xu
for reporting this.

llvm-svn: 51926
2008-06-04 04:46:14 +00:00
Dan Gohman 9494a03df8 Update the polygen grammer for the new insertvalue and extractvalue syntax.
llvm-svn: 51879
2008-06-02 19:47:09 +00:00
Dan Gohman 92d62b43c2 Fix the position of MemOperands in nodes that use variadic_ops
in DAGISelEmitter output. This bug was recently uncovered by the
addition of patterns for CALL32m and CALL64m, which are nodes
that now have both MemOperands and variadic_ops.

This bug was especially visible with PIC in various configurations,
because the new patterns are matching the indirect call code used
in many PIC configurations.

llvm-svn: 51877
2008-06-02 17:40:38 +00:00
Anton Korobeynikov 10d2f50826 Initialize members properly during construction
llvm-svn: 51841
2008-06-01 16:22:49 +00:00
Mikhail Glushenkov f970edf9b7 Callback was not executed on OS X when it was a function.
llvm-svn: 51814
2008-05-31 13:43:21 +00:00
Dan Gohman bd3390c73a Teach the DAGISelEmitter to not compute the variable_ops operand
index for the input pattern in terms of the output pattern. Instead
keep track of how many fixed operands the input pattern actually
has, and have the input matching code pass the output-emitting
function that index value. This simplifies the code, disentangles
variables_ops from the support for predication operations, and
makes variable_ops more robust.

llvm-svn: 51808
2008-05-31 02:11:25 +00:00
Evan Cheng 215c528565 Revert 51775.
llvm-svn: 51795
2008-05-30 22:47:19 +00:00
Evan Cheng a50833b695 Patches for building llvm on Solaris x86. Contributed by Nathan Keynes.
llvm-svn: 51775
2008-05-30 17:16:20 +00:00
Mikhail Glushenkov 401f3d6eab Add a check for side effect-free options (specified only in the OptionList).
llvm-svn: 51759
2008-05-30 06:28:37 +00:00
Mikhail Glushenkov c03ce6071c Refactoring: remove code duplication introduced in the previous patch.
llvm-svn: 51757
2008-05-30 06:27:29 +00:00
Mikhail Glushenkov e8cee23f67 Refactoring: split CollectProperties into two separate function objects.
llvm-svn: 51756
2008-05-30 06:27:02 +00:00
Mikhail Glushenkov b9b010eb09 New feature: OptionList.
It can be handy to have all information about options gathered in a single place
to provide an overview of all supported options. This patch allows the following:

def Options : OptionList<[
(switch_option "E", (help "Help string")),
(alias_option "quiet", "q")
...
]>;

Tool-specific option properties (like 'append_cmd') have (obviously) no meaning in
this context, so the only properties that are allowed are 'help' and 'required'.

See usage example in examples/Clang.td.

llvm-svn: 51754
2008-05-30 06:26:08 +00:00
Mikhail Glushenkov c8bd3517d5 A small optimization: use static char* array instead of StrVector.
llvm-svn: 51752
2008-05-30 06:24:49 +00:00
Mikhail Glushenkov bf14dd7dc3 Make it possible to test if the '-o' option is provided.
The following is now allowed:

    (case (not_empty "o"), do_something, ...)

This didn't work previously because "-o" is built-in.

llvm-svn: 51751
2008-05-30 06:24:07 +00:00
Mikhail Glushenkov f83f33e8d3 Fix: 'sink' handling was broken.
llvm-svn: 51750
2008-05-30 06:23:29 +00:00
Mikhail Glushenkov b043663cf9 Add support for option aliases.
llvm-svn: 51749
2008-05-30 06:22:52 +00:00
Mikhail Glushenkov bf1552d866 Allow nesting of case expressions.
The following is now legal:

    (case (in_language "c"),
          (case (switch_on "E"), "gcc -x c -E $INFILE", (default), "gcc -x c $INFILE"),
          (default),
          "gcc $INFILE $OUTFILE")

llvm-svn: 51748
2008-05-30 06:22:15 +00:00
Mikhail Glushenkov d1a6a34cc5 Small error message improvement.
llvm-svn: 51747
2008-05-30 06:21:48 +00:00
Mikhail Glushenkov 763cc577b3 Remove RequireDefault parameter from EmitCaseConstructHandler.
There are now no situations when 'default' is required.

llvm-svn: 51746
2008-05-30 06:21:21 +00:00
Mikhail Glushenkov 5916ade717 Fix some headers.
llvm-svn: 51745
2008-05-30 06:20:54 +00:00
Mikhail Glushenkov 2f51489a62 New tests for the 'case' expression: not_empty, in_language.
llvm-svn: 51744
2008-05-30 06:19:52 +00:00
Mikhail Glushenkov 1f7a028929 Make it possible to have multiple input languages for a single tool.
llvm-svn: 51742
2008-05-30 06:18:16 +00:00
Mikhail Glushenkov 326d508303 Better error reporting for the 'case' construct.
llvm-svn: 51738
2008-05-30 06:15:47 +00:00
Mikhail Glushenkov 9e58d5958f Do not generate empty 'if's for the output_suffix property.
llvm-svn: 51737
2008-05-30 06:15:20 +00:00
Mikhail Glushenkov 6db24d96cd Make it possible to use hooks like this: '$CALL(MyHook)/path/to/file'.
llvm-svn: 51734
2008-05-30 06:13:29 +00:00
Mikhail Glushenkov 73edde26f0 Make it possible to change the output file suffix based on command-line options.
For instance, the following command:

    llvmc2 -E hello.c

now generates a file with the correct suffix (hello.i).

llvm-svn: 51733
2008-05-30 06:13:02 +00:00
Mikhail Glushenkov fc4ed7ad83 Add support for user-provided hooks and environment variable reads to the cmd_line tool property.
Used like this: (cmd_line "$CALL(MyHook) --option -o $ENV(VARIABLE) $CALL(AnotherHook)")
Also works with case expressions.

Hook declarations are auto-generated, the definitions should be provided by the user
(just drop a .cpp file in the tools/llvmc2 directory).

Hooks should live in the "hooks" namespace and have type std::string hooks::Hook(void).

llvm-svn: 51732
2008-05-30 06:12:24 +00:00
Mikhail Glushenkov f1c87ff378 Some small tweaks to make the generated code prettier.
llvm-svn: 51729
2008-05-30 06:10:47 +00:00
Mikhail Glushenkov e57a403338 Make it possible to use the generalised 'case' construct in the cmd_line property.
llvm-svn: 51728
2008-05-30 06:10:19 +00:00
Mikhail Glushenkov 8fedbb7b02 Add a generalised 'case' construct.
Besides assigning edge weights, it will also be used by the cmd_line tool property.

llvm-svn: 51727
2008-05-30 06:08:50 +00:00
Dan Gohman 96af4ddb62 Add patterns for CALL32m and CALL64m. They aren't matched in most
cases due to an isel deficiency already noted in
lib/Target/X86/README.txt, but they can be matched in this fold-call.ll
testcase, for example.

This is interesting mainly because it exposes a tricky tblgen bug;
tblgen was incorrectly computing the starting index for variable_ops
in the case of a complex pattern.

llvm-svn: 51706
2008-05-29 21:50:34 +00:00
Dan Gohman 6e582c449f Fix a tblgen problem handling variable_ops in tblgen instruction
definitions. This adds a new construct, "discard", for indicating
that a named node in the input matching pattern is to be discarded,
instead of corresponding to a node in the output pattern. This
allows tblgen to know where the arguments for the varaible_ops are
supposed to begin.

This fixes "rdar://5791600", whatever that is ;-).

llvm-svn: 51699
2008-05-29 19:57:41 +00:00
Bill Wendling 3f6bb2713e Add a flag to indicate that an instruction is as cheap (or cheaper) than a move
instruction to execute. This can be used for transformations (like two-address
conversion) to remat an instruction instead of generating a "move"
instruction. The idea is to decrease the live ranges and register pressure and
all that jazz.

llvm-svn: 51660
2008-05-28 22:54:52 +00:00
Dan Gohman 14552f83bb Fix the spelling of the va_arg keyword.
llvm-svn: 51484
2008-05-23 17:11:55 +00:00
Dan Gohman 30499844ea Make structs and arrays first-class types, and add assembly
and bitcode support for the extractvalue and insertvalue
instructions and constant expressions.

Note that this does not yet include CodeGen support.

llvm-svn: 51468
2008-05-23 01:55:30 +00:00
Dan Gohman 5477a1583a Add a polygen grammar definition for LLVM assembly language.
llvm-svn: 51449
2008-05-22 22:45:03 +00:00
Roman Levenstein 52a005ac13 Do not generate by TableGen the hard-coded standard, target-independent part of
DAG instruction selectors. Introudce a dedicated header file for this part:
include/llvm/CodeGen/DAGISelHeader.h

TableGen now only generates the include preprocessor directive to include this
new header.

This is a preparation for supporting multiple implementations of instruction
selectors in the future.

Reviewed and approved by Evan and Dan.

llvm-svn: 51102
2008-05-14 10:17:11 +00:00
Mikhail Glushenkov c79304461a Filter option names to escape symbols not allowed as C++ identifiers.
Makes it possible to use options with names like "Wa,".
Also fixes the -Wall option handling as a side-effect.

llvm-svn: 50973
2008-05-12 16:33:06 +00:00
Mikhail Glushenkov 22ce861ffe Reapply 50867: A small refactoring (extract method) + some comment fixes.
Fixed the build breakage, sorry for that.

llvm-svn: 50895
2008-05-09 08:27:26 +00:00
Tanya Lattner 93cea9fd18 Revertin 50867 since it was breaking the build.
llvm-svn: 50871
2008-05-08 21:54:20 +00:00
Mikhail Glushenkov d7e151f868 A small refactoring (extract method) + some comment fixes.
llvm-svn: 50867
2008-05-08 20:02:03 +00:00
Mikhail Glushenkov 41318a15d0 Use Doxygen-style comments.
llvm-svn: 50833
2008-05-07 21:50:19 +00:00
Mikhail Glushenkov eeac27e38c Change from llvm::SmallSet<std::string> to llvm::StringMap<char>.
llvm-svn: 50766
2008-05-06 18:18:58 +00:00
Mikhail Glushenkov 5e9d6a3dd8 Add new edge property combinator: weight.
llvm-svn: 50765
2008-05-06 18:18:20 +00:00
Mikhail Glushenkov a02084cff7 Use edge weights to choose the right linker based on input language names.
llvm-svn: 50759
2008-05-06 18:15:12 +00:00
Mikhail Glushenkov 1b056e9e5a Add weights to graph edges. Choose between edges based on their weight.
llvm-svn: 50757
2008-05-06 18:14:24 +00:00
Mikhail Glushenkov 3a2f5c423e Remove the UnpackValues() function.
llvm-svn: 50756
2008-05-06 18:13:45 +00:00
Mikhail Glushenkov 7f6ed20009 Add a --linker command-line option, make all tests pass.
llvm-svn: 50755
2008-05-06 18:13:00 +00:00
Mikhail Glushenkov 20c18c344b Naming fix: LLVMCCConfigurationEmitter -> LLVMCConfigurationEmitter.
llvm-svn: 50754
2008-05-06 18:12:03 +00:00
Mikhail Glushenkov 1002d5f33f Rename LLVMCCConfigurationEmitter to LLVMCConfigurationEmitter
llvm-svn: 50748
2008-05-06 18:09:29 +00:00
Mikhail Glushenkov d4918dd32c Add output redirection, rename namespace llvmcc to namespace llvmc.
llvm-svn: 50746
2008-05-06 18:08:59 +00:00
Mikhail Glushenkov 7ed45e2261 Small output formatting fix.
llvm-svn: 50739
2008-05-06 17:27:15 +00:00
Mikhail Glushenkov 2709e1a2c9 Add inward edge counters to Nodes; Associate JoinLists with JoinTools.
llvm-svn: 50738
2008-05-06 17:26:53 +00:00
Mikhail Glushenkov baa0b592d0 Return const char* instead of std::string in Tool classes
llvm-svn: 50733
2008-05-06 17:24:26 +00:00
Mikhail Glushenkov 1c41c6d734 Refactoring: extract method.
llvm-svn: 50731
2008-05-06 17:23:14 +00:00
Mikhail Glushenkov 59eb254092 Add new edge properties: parameter_equals, element_in_list, and.
llvm-svn: 50730
2008-05-06 17:22:47 +00:00
Mikhail Glushenkov 681df41f2c Implemented switch_on edge property.
llvm-svn: 50729
2008-05-06 17:22:03 +00:00
Mikhail Glushenkov 251280ce0b More work on edge properties. Use Edge classes instead of strings in CompilationGraph.
llvm-svn: 50726
2008-05-06 16:36:50 +00:00
Mikhail Glushenkov 459df48de7 Ongoing work: add an edge typechecker, rudimentary support for edge properties.
llvm-svn: 50725
2008-05-06 16:36:06 +00:00
Mikhail Glushenkov adcb08d1b3 Convert internal representation to use DAG. This gives us more flexibility and enables future improvements.
llvm-svn: 50724
2008-05-06 16:35:25 +00:00
Mikhail Glushenkov a8276c5323 Code reorg
llvm-svn: 50722
2008-05-06 16:34:12 +00:00
Bill Wendling 557ecd8670 Remove tar ball from installed directory.
llvm-svn: 50717
2008-05-06 08:33:07 +00:00
Bill Wendling d8c2d29327 Added support for:
- defm and multiclass
- imbricatable multiline C style comment
- FIXME/TODO highlight in comment
- binary and hexadecimal number
- code using [{ }] is no highlighted as special (perhaps not the best
choice)
Patch by Cedric Venet!

llvm-svn: 50319
2008-04-27 09:44:10 +00:00
Bill Wendling 837b1dcf36 Apple GCC 4.2 builds things differently. It no longer spawns a bunch of
processes, but requires the project to use -j.

llvm-svn: 49744
2008-04-15 21:33:52 +00:00
Chuck Rose III c6a47e8a79 VisualStudio project files updated. #include <algorithm> added to make VisualStudio happy. Also had to undefine setjmp because of #include <csetjmp> turning setjmp into _setjmp in VisualStudio.
llvm-svn: 49743
2008-04-15 21:27:11 +00:00
Evan Cheng ba7126064a Sort sub-registers and super-registers lists according to super-sub register relations. e.g. X86::RAX sub-register list is EAX, AX, AL, AH (order of last two are not guaranteed).
llvm-svn: 49714
2008-04-15 07:56:03 +00:00
Bill Wendling 97632952c9 Install into the directory
llvm-svn: 49713
2008-04-15 07:02:59 +00:00
Devang Patel bde1bbed16 Change llvm tools install location.
llvm-svn: 49540
2008-04-11 17:45:39 +00:00
Chris Lattner 57dd77462b produce an error on invalid input instead of asserting:
def : Pat<((v2f64 (vector_shuffle immAllZerosV_bc,
           ^

llvm-svn: 49462
2008-04-10 04:48:34 +00:00
Nate Begeman a6063118c6 Fix a bug where an incorrect bit mask would be generated if a target's last asm
string began at a power of 2 in the string index.  For example, if "ret" started
at position 16, the ret instruction would be assigned code 16, but the mask would be AsmChars[] + Code & 15, not Code & 31.

llvm-svn: 49433
2008-04-09 16:24:11 +00:00
Chris Lattner 5ed17b67d2 Fix generation of multi-stage instruction itineraries. Patch by
giuma.cordes@gmail.com

llvm-svn: 49276
2008-04-06 17:38:14 +00:00
Dan Gohman fc4ad7de66 Move instruction flag inference out of InstrInfoEmitter and into
CodeGenDAGPatterns, where it can be used in other tablegen backends.
This allows the inference to be done for DAGISelEmitter so that it
gets accurate mayLoad/mayStore/isSimpleLoad flags. 

This brings MemOperand functionality back to where it was before
48329. However, it doesn't solve the problem of anonymous patterns
which expand to code that does loads or stores.

llvm-svn: 49123
2008-04-03 00:02:49 +00:00
Anton Korobeynikov 20c9e4cbee Add new CC lowering rule: provide a list of registers, which can be 'shadowed',
when some another register is used for argument passing.
Currently is used on Win64.

llvm-svn: 49079
2008-04-02 05:23:57 +00:00
Chris Lattner 6f2ffdb73f Change the MemoryBuffer::getFile* methods to take just a pointer to the
start of a filename, not a filename+length.  All clients can produce a
null terminated name, and the system api's require null terminated 
strings anyway.

llvm-svn: 49041
2008-04-01 18:04:03 +00:00
Bill Wendling a86fd1b214 Simplify the conversion from "0x" numbers to a single digit number.
llvm-svn: 48907
2008-03-28 06:22:23 +00:00
Mikhail Glushenkov abb139c3f8 Fix build breakage on Windows with GCC 4.3. References bug #2176.
llvm-svn: 48874
2008-03-27 09:53:47 +00:00
Dan Gohman c60c67fc37 Add explicit keywords.
llvm-svn: 48801
2008-03-25 22:06:05 +00:00
Dan Gohman bdc24adaaf A quick nm audit turned up several fixed tables and objects that were
marked read-write. Use const so that they can be allocated in a
read-only segment.

llvm-svn: 48800
2008-03-25 21:45:14 +00:00
Anton Korobeynikov 70548d835e Add first proof-of-concept universal compiler driver framework based
on ideas mentioned in PR686.
Written by Mikhail Glushenkov and contributed by Codedgers, Inc.

Old llvmc will be removed soon after new one will have all its properties.

llvm-svn: 48699
2008-03-23 08:57:20 +00:00
Bill Wendling da2586f69a Don't strip things when we're doing a debug build.
llvm-svn: 48696
2008-03-22 21:57:15 +00:00
Duncan Sands d97eea372a Introduce a new node for holding call argument
flags.  This is needed by the new legalize types
infrastructure which wants to expand the 64 bit
constants previously used to hold the flags on
32 bit machines.  There are two functional changes:
(1) in LowerArguments, if a parameter has the zext
attribute set then that is marked in the flags;
before it was being ignored; (2) PPC had some bogus
code for handling two word arguments when using the
ELF 32 ABI, which was hard to convert because of
the bogusness.  As suggested by the original author
(Nicolas Geoffray), I've disabled it for the moment.
Tested with "make check" and the Ada ACATS testsuite.

llvm-svn: 48640
2008-03-21 09:14:45 +00:00
Chris Lattner a7cca362af detabify llvm, patch by Mike Stump!
llvm-svn: 48577
2008-03-20 01:22:40 +00:00
Nate Begeman fbbe80b597 Add support for escaping {} in asm strings, based on patch from Nick Burns.
llvm-svn: 48450
2008-03-17 07:26:14 +00:00
Christopher Lamb d3d0ad3f58 Make insert_subreg a two-address instruction, vastly simplifying LowerSubregs pass. Add a new TII, subreg_to_reg, which is like insert_subreg except that it takes an immediate implicit value to insert into rather than a register.
llvm-svn: 48412
2008-03-16 03:12:01 +00:00
Evan Cheng ec7533b620 Remove isImplicitDef TargetInstrDesc flag.
llvm-svn: 48381
2008-03-15 00:19:36 +00:00
Evan Cheng 0e7b00d79f Replace all target specific implicit def instructions with a target independent one: TargetInstrInfo::IMPLICIT_DEF.
llvm-svn: 48380
2008-03-15 00:03:38 +00:00
Christopher Lamb dd55d3f1b2 Get rid of a pseudo instruction and replace it with subreg based operation on real instructions, ridding the asm printers of the hack used to do this previously. In the process, update LowerSubregs to be careful about eliminating copies that have side affects.
Note: the coalescer will have to be careful about this too, when it starts coalescing insert_subreg nodes.
llvm-svn: 48329
2008-03-13 05:47:01 +00:00
Christopher Lamb a731239c30 Recommitting changes after more testing. These appear to cause no problems.
llvm-svn: 48222
2008-03-11 09:33:47 +00:00
Chris Lattner 6aa4f515bb emit an ID # for each regclass ID. Chris doesn't like to have to count.
llvm-svn: 48200
2008-03-11 00:00:23 +00:00
Evan Cheng d4e1d9eeb2 Revert 48125, 48126, and 48130 for now to unbreak some x86-64 tests.
llvm-svn: 48167
2008-03-10 19:31:26 +00:00
Tanya Lattner f7c52a1d52 Add nosubmit option to control what is sent back to the results server.
Patch by Joachim Durchholz. Thanks!

llvm-svn: 48139
2008-03-10 07:28:08 +00:00
Christopher Lamb 80b928e600 Revert accidentally committed local changes.
llvm-svn: 48126
2008-03-10 04:16:09 +00:00
Christopher Lamb 0faed2a9a6 Add support in TableGen for unknown operands that infer their type from the pattern their used in. This will be used to allow insert/extract subreg patterns in .td files!
llvm-svn: 48125
2008-03-10 04:13:41 +00:00
Dale Johannesen 4e622ec86d Increase ISD::ParamFlags to 64 bits. Increase the ByValSize
field to 32 bits, thus enabling correct handling of ByVal
structs bigger than 0x1ffff.  Abstract interface a bit.
Fixes gcc.c-torture/execute/pr23135.c and 
gcc.c-torture/execute/pr28982b.c in gcc testsuite (were ICE'ing
on ppc32, quietly producing wrong code on x86-32.)

llvm-svn: 48122
2008-03-10 02:17:22 +00:00
Scott Michel 944207423b This patch fixes a problem encountered by the CellSPU backend where variants
were being pruned in patterns where a variable was used more than once, e.g.:

  (or (and R32C:$rA, R32C:$rC), (and R32C:$rB, (not R32C:$rC)))

In this example, $rC is used more than once and is actually significant to
instruction selection pattern matching when commuted variants are produced.
This patch scans the pattern's clauses and collects the variables, creating
a set of variables that are used more than once. TreePatternNode::isIsomorphicTo()
also understands that multiply-used variables are significant.

llvm-svn: 47950
2008-03-05 17:49:05 +00:00
Nick Kledzik 2204568281 install new lto dylib. pass down LLVM_SUBMIT_VERSION
llvm-svn: 47763
2008-02-29 19:32:13 +00:00
Nick Kledzik 618ba73288 fix default RC_ProjectSourceSubversion to be zero
llvm-svn: 47761
2008-02-29 19:30:23 +00:00
Bill Wendling d7a258d325 Rename PrintableName to Name.
llvm-svn: 47629
2008-02-26 21:47:57 +00:00
Bill Wendling c24ea4fb41 Change "Name" to "AsmName" in the target register info. Gee, a refactoring tool
would have been a Godsend here!

llvm-svn: 47625
2008-02-26 21:11:01 +00:00
Bill Wendling e65d2afdb1 De-tabify.
llvm-svn: 47595
2008-02-26 10:45:29 +00:00
Bill Wendling a7d1ed4c98 Some platforms use the same name for 32-bit and 64-bit registers (like
%r3 on PPC) in their ASM files. However, it's hard for humans to read
during debugging. Adding a new field to the register data that lets you
specify a different name to be printed than the one that goes into the
ASM file -- %x3 instead of %r3, for instance.

llvm-svn: 47534
2008-02-24 00:56:13 +00:00
Anton Korobeynikov 579f07135a Unbreak build with gcc 4.3: provide missed includes and silence most annoying warnings.
llvm-svn: 47367
2008-02-20 11:08:44 +00:00
Scott Michel a3cefeaf0c Make tblgen a little smarter about constants smaller than i32. Currently,
tblgen will complain if a sign-extended constant does not fit into a
data type smaller than i32, e.g., i16. This causes a problem when certain
hex constants are used, such as 0xff for byte masks or immediate xor
values.

tblgen will try the sign-extended value first and, if the sign extended
value would overflow, it tries to see if the unsigned value will fit.
Consequently, a software developer can now safely incant:

	(XORHIr16 R16C:$rA, 0xffff)

which is somewhat clearer and more informative than incanting:

	(XORHIr16 R16C:$rA, (i16 -1))

even if the two are bitwise equivalent.

Tblgen also outputs the 64-bit unsigned constant in the generated ISel code
when getTargetConstant() is invoked.

llvm-svn: 47188
2008-02-15 23:05:48 +00:00
Dale Johannesen 6ca3ccf519 Rewrite tblgen handling of subtarget features so
it follows the order of the enum, not alphabetical.
The motivation is to make -mattr=+ssse3,+sse41
select SSE41 as it ought to.  Added "ignored"
enum values of 0 to PPC and SPU to avoid compiler
warnings.

llvm-svn: 47143
2008-02-14 23:35:16 +00:00
Nate Begeman 53e1b3f9d5 Change how FP immediates are handled.
1) ConstantFP is now expand by default
2) ConstantFP is not turned into TargetConstantFP during Legalize
   if it is legal.

This allows ConstantFP to be handled like Constant, allowing for 
targets that can encode FP immediates as MachineOperands.

As a bonus, fix up Itanium FP constants, which now correctly match,
and match more constants!  Hooray.

llvm-svn: 47121
2008-02-14 08:57:00 +00:00
Devang Patel ac562ab102 Remove dead code.
llvm-svn: 47012
2008-02-12 18:20:50 +00:00
Dan Gohman 3a4be0fdef Rename MRegisterInfo to TargetRegisterInfo.
llvm-svn: 46930
2008-02-10 18:45:23 +00:00
Nate Begeman 17bedbc500 Tablegen support for insert & extract element matching
llvm-svn: 46901
2008-02-09 01:37:05 +00:00
Dan Gohman 2d489b5081 Re-apply the memory operand changes, with a fix for the static
initializer problem, a minor tweak to the way the
DAGISelEmitter finds load/store nodes, and a renaming of the
new PseudoSourceValue objects.

llvm-svn: 46827
2008-02-06 22:27:42 +00:00
Evan Cheng 87fbd66f9f Fix PR1975: dag isel emitter produces patterns that isel wrong flag result.
llvm-svn: 46776
2008-02-05 22:50:29 +00:00
Evan Cheng 2cb9068c78 Dwarf requires variable entries to be in the source order. Right now, since we are recording variable information at isel time this means parameters would appear in the reverse order. The short term fix is to issue recordVariable() at asm printing time instead.
llvm-svn: 46724
2008-02-04 23:06:48 +00:00
Chris Lattner b2b9d6f0fb Change the 'global modification' APIs in SelectionDAG to take a new
DAGUpdateListener object pointer instead of just returning a vector 
of deleted nodes.  This makes the interfaces more efficient (no more
allocating a vector [at least a malloc], filling it in, then walking
it) and more clean.  This also allows the client to be notified of
nodes that are *changed* but not deleted.

llvm-svn: 46677
2008-02-03 06:49:24 +00:00
Evan Cheng 32e5347eb8 Get rid of the annoying blank lines before labels.
llvm-svn: 46667
2008-02-02 08:39:46 +00:00
Evan Cheng efd142a920 SDIsel processes llvm.dbg.declare by recording the variable debug information descriptor and its corresponding stack frame index in MachineModuleInfo. This only works if the local variable is "homed" in the stack frame. It does not work for byval parameter, etc.
Added ISD::DECLARE node type to represent llvm.dbg.declare intrinsic. Now the intrinsic calls are lowered into a SDNode and lives on through out the codegen passes.
For now, since all the debugging information recording is done at isel time, when a ISD::DECLARE node is selected, it has the side effect of also recording the variable. This is a short term solution that should be fixed in time.

llvm-svn: 46659
2008-02-02 04:07:54 +00:00
Evan Cheng 27b32b87ed Revert 46556 and 46585. Dan please fix the PseudoSourceValue problem and re-commit.
llvm-svn: 46623
2008-01-31 21:00:00 +00:00
Evan Cheng 1c6c16ea11 Add an extra operand to LABEL nodes which distinguishes between debug, EH, or misc labels. This fixes the EH breakage. However I am not convinced this is *the* solution.
llvm-svn: 46609
2008-01-31 09:59:15 +00:00
Christopher Lamb 0592cf7e74 Allow ComplexExpressions in InstrInfo.td files to be slightly more... complex! ComplexExpressions can now have attributes which affect how TableGen interprets
the pattern when generating matchin code. 

The first (and currently, only) attribute causes the immediate parent node of the ComplexPattern operand to be passed into the matching code rather than the node at the root of the entire DAG containing the pattern.

llvm-svn: 46606
2008-01-31 07:27:46 +00:00
Dan Gohman 3646fdda67 Create a new class, MemOperand, for describing memory references
in the backend. Introduce a new SDNode type, MemOperandSDNode, for
holding a MemOperand in the SelectionDAG IR, and add a MemOperand
list to MachineInstr, and code to manage them. Remove the offset
field from SrcValueSDNode; uses of SrcValueSDNode that were using
it are all all using MemOperandSDNode now.

Also, begin updating some getLoad and getStore calls to use the
PseudoSourceValue objects.

Most of this was written by Florian Brander, some
reorganization and updating to TOT by me.

llvm-svn: 46585
2008-01-31 00:25:39 +00:00
Devang Patel ebde4b34aa Always put version numbers at the end because they are optional.
llvm-svn: 46563
2008-01-30 18:30:11 +00:00
Dan Gohman d63d9feadd Update this file for 2.0 syntax.
llvm-svn: 46512
2008-01-29 12:35:50 +00:00
Scott Michel 167502a508 Fix to bug 1951: tblgen gratuitously renames variables when no temporary was
generated. This feature would only show up in fairly complex patterns, such
as this one in CellSPU:

  def : Pat<(add (SPUhi tconstpool:$in, 0), (SPUlo tconstpool:$in, 0)),
	    (IOHLlo (ILHUhi tconstpool:$in), tconstpool:$in)>;

which generated the following emit code:

SDNode *Emit_0(const SDOperand &N, unsigned Opc0, unsigned Opc1, MVT::ValueType VT0, MVT::ValueType VT1) DISABLE_INLINE {
  SDOperand N0 = N.getOperand(0);
  SDOperand N00 = N0.getOperand(0);
  SDOperand N01 = N0.getOperand(1);
  SDOperand N1 = N.getOperand(1);
  SDOperand N10 = N1.getOperand(0);
  SDOperand N11 = N1.getOperand(1);
  SDOperand Tmp3(CurDAG->getTargetNode(Opc0, VT0, N00), 0);
  return CurDAG->SelectNodeTo(N.Val, Opc1, VT1, Tmp3, Tmp2); /* Tmp2 s/b N00 */
}

Tested against the test suites without incident.

llvm-svn: 46487
2008-01-29 02:29:31 +00:00
Anton Korobeynikov 010bd77372 Add interator interface to DAGInit also
llvm-svn: 46250
2008-01-22 11:00:07 +00:00
Anton Korobeynikov e49cc26380 Provide iterator access to ListInit contents
llvm-svn: 46223
2008-01-21 22:30:26 +00:00
Evan Cheng 26c33032fa Fix makefiles to enable Apply style debug build.
llvm-svn: 46180
2008-01-18 21:01:00 +00:00
Devang Patel 16808a32f4 Enable CBE
llvm-svn: 46112
2008-01-17 02:10:08 +00:00
Chuck Rose III fe2714fab3 Add files to windows project files. Also include <algorithm> explicitly so that vstudio build works
llvm-svn: 46013
2008-01-15 21:43:17 +00:00
Evan Cheng 4d70ba3134 Rename CCIfStruct to CCIfByVal and CCStructAssign to CCPassByVal. Remove unused parameters of CCStructAssign and add size and alignment requirement info.
llvm-svn: 45997
2008-01-15 03:34:58 +00:00
Evan Cheng a9ecdf6927 Revert my last commit. Not needed.
llvm-svn: 45994
2008-01-15 03:10:35 +00:00
Evan Cheng c8dc2f781f Need a space to separate Make options.
llvm-svn: 45964
2008-01-14 17:58:03 +00:00
Evan Cheng 0395fd76cf Add -disable-lto optimization.
llvm-svn: 45900
2008-01-12 04:27:18 +00:00
Evan Cheng 02e78103ab ByVal arguments are passed on stack. Make sure to allocate a slot using size and alignment information on the parameter attribute.
llvm-svn: 45897
2008-01-12 01:07:41 +00:00
Chris Lattner c8226f32e9 Simplify the side effect stuff a bit more and make licm/sinking
both work right according to the new flags.

This removes the TII::isReallySideEffectFree predicate, and adds
TII::isInvariantLoad. 

It removes NeverHasSideEffects+MayHaveSideEffects and adds
UnmodeledSideEffects as machine instr flags.  Now the clients
can decide everything they need.

I think isRematerializable can be implemented in terms of the
flags we have now, though I will let others tackle that.

llvm-svn: 45843
2008-01-10 23:08:24 +00:00
Chris Lattner 317332fc2a Start inferring side effect information more aggressively, and fix many bugs in the
x86 backend where instructions were not marked maystore/mayload, and perf issues where
instructions were not marked neverHasSideEffects.  It would be really nice if we could
write patterns for copy instructions.

I have audited all the x86 instructions down to MOVDQAmr.  The flags on others and on
other targets are probably not right in all cases, but no clients currently use this
info that are enabled by default.

llvm-svn: 45829
2008-01-10 07:59:24 +00:00
Chris Lattner 70ddafaf45 Fix a crash on code like: let x = 1 {x
llvm-svn: 45827
2008-01-10 07:01:53 +00:00
Chris Lattner 86c458a178 if an instr lacks a pattern, assume it has side effects (unless never has s-e is true).
llvm-svn: 45823
2008-01-10 05:40:54 +00:00
Chris Lattner 42c63ef96e start inferring 'no side effects'.
llvm-svn: 45822
2008-01-10 05:39:30 +00:00
Chris Lattner 9e69654461 Infer mayload
llvm-svn: 45819
2008-01-10 04:44:48 +00:00
Chris Lattner 1ca2068227 realize that instructions who match intrinsics that read memory read memory.
Also, instructions with any nodes that are SDNPMayLoad also read memory.

llvm-svn: 45817
2008-01-10 04:38:57 +00:00
Chris Lattner 07fde9bde1 add a mayLoad property for machine instructions, a correlary to mayStore.
This is currently not set by anything.

llvm-svn: 45748
2008-01-08 18:05:21 +00:00
Chris Lattner 03ad885039 rename TargetInstrDescriptor -> TargetInstrDesc.
Make MachineInstr::getDesc return a reference instead
of a pointer, since it can never be null.

llvm-svn: 45695
2008-01-07 07:27:27 +00:00
Chris Lattner e99a6caee4 Rename all the M_* flags to be namespace qualified enums, and switch
all clients over to using predicates instead of these flags directly.
These are now private values which are only to be used to statically
initialize the tables.

llvm-svn: 45692
2008-01-07 06:42:05 +00:00
Chris Lattner f376c99ea0 rename hasVariableOperands() -> isVariadic(). Add some comments.
Evan, please review the comments I added to getNumDefs to make sure
that they are accurate, thx.

llvm-svn: 45687
2008-01-07 05:19:29 +00:00
Chris Lattner fd548c96cc Move M_* flags down in the file. Move SchedClass up in the
TargetInstrDescriptor class and shrink to 16-bits, saving a 
word in TargetInstrDescriptor.  Add some comments.

llvm-svn: 45686
2008-01-07 05:06:49 +00:00
Chris Lattner 6f8713decb the name field of instructions is never set to a non-empty string,
just unconditionally use the def name of the instruction.

llvm-svn: 45684
2008-01-07 04:57:31 +00:00
Chris Lattner e55e115616 Add predicates methods to TargetOperandInfo, and switch all clients
over to using them, instead of diddling Flags directly.  Change the
various flags from const variables to enums.

llvm-svn: 45677
2008-01-07 02:39:19 +00:00
Chris Lattner a4ce4f6987 rename isLoad -> isSimpleLoad due to evan's desire to have such a predicate.
llvm-svn: 45667
2008-01-06 23:38:27 +00:00
Chris Lattner 10324d0175 rename isStore -> mayStore to more accurately reflect what it captures.
llvm-svn: 45656
2008-01-06 08:36:04 +00:00
Chris Lattner a348f55ec6 Change the 'isStore' inferrer to look for 'SDNPMayStore'
instead of "ISD::STORE".  This allows us to mark target-specific dag
nodes as storing (such as ppc byteswap stores).  This allows us to remove
more explicit isStore flags from the .td files.

Finally, add a warning for when a .td file contains an explicit 
isStore and tblgen is able to infer it.

llvm-svn: 45654
2008-01-06 06:44:58 +00:00
Chris Lattner 89c6566577 set the 'isstore' flag for instructions whose pattern is an
intrinsic that writes to memory.

llvm-svn: 45650
2008-01-06 05:36:50 +00:00
Chris Lattner e457fd1e9b remove some old hacky code that tried to infer whether a store
occured in a pattern, but failed miserably.  The new code works for
any instruction that has a store in its pattern, including all the 
x86 mem op mem instructions.

The only target-independent code that uses this is branch folding,
so this won't change anything in practice.

llvm-svn: 45648
2008-01-06 02:16:26 +00:00
Chris Lattner 27a4c1515a rearrange some code to allow inferring instr info from the pattern of the instr, but don't do so yet.
llvm-svn: 45647
2008-01-06 01:53:37 +00:00
Chris Lattner d5326def4a improve const correctness.
llvm-svn: 45646
2008-01-06 01:52:22 +00:00