Commit Graph

45514 Commits

Author SHA1 Message Date
Dan Gohman 70d9929def Add comments explaining why there's only one register for
i8 return values.

llvm-svn: 67502
2009-03-23 04:28:24 +00:00
Evan Cheng 3138f7a781 Missed this as part of r67451.
llvm-svn: 67500
2009-03-23 03:45:56 +00:00
Chris Lattner b6ff0f3a4d Fix PR3860 by correcting a predicate.
llvm-svn: 67473
2009-03-22 19:22:53 +00:00
Duncan Sands b1656c1e1f Add some explanations of how apint loads and stores
work.

llvm-svn: 67471
2009-03-22 11:33:16 +00:00
Bill Wendling a443ab4bcd Really should pass -dylib to the linker...
llvm-svn: 67469
2009-03-22 08:56:15 +00:00
Bill Wendling f3ef2c758f A dylib should be built as a dylib and not a bundle.
llvm-svn: 67468
2009-03-22 08:28:45 +00:00
Chris Lattner adda37fb62 add method to access a template argument.
llvm-svn: 67458
2009-03-22 00:18:18 +00:00
Duncan Sands 1f15ca7c7a Factorize out a concept - no functionality change.
llvm-svn: 67454
2009-03-21 21:27:31 +00:00
Evan Cheng 15f1754eb4 Re-commit r67334 and r67349 with fix.
llvm-svn: 67451
2009-03-21 18:12:24 +00:00
Chris Lattner cbeda87da1 add a fastpath to ConstantExpr::getBitCast to handle the case when an obviously
unneeded bitcast is requested.  This is common for frontends who just unconditionally
cast even if the target is often the right type already.  THis prevents going into
getFoldedCast which switches on the opcode and does a bunch of other stuff before
doing the same opzn.

llvm-svn: 67435
2009-03-21 06:55:54 +00:00
Chris Lattner 9b62dff5f6 add some inline methods for infix operators on sparse vectors,
tidy some df iteration stuff, patch by John Mosby!

llvm-svn: 67428
2009-03-21 05:40:09 +00:00
Bruno Cardoso Lopes 9b9586a5ae Removed AFGR32 register class
Handle odd registers allocation in FGR32.

llvm-svn: 67422
2009-03-21 00:05:07 +00:00
Bob Wilson dc40d5ae2c Fix a few more indentation problems and an 80-column violation.
llvm-svn: 67416
2009-03-20 23:16:43 +00:00
Bob Wilson 7117a916f5 No functional changes. Fix indentation and whitespace only.
llvm-svn: 67412
2009-03-20 22:42:55 +00:00
Chris Lattner 0a981d1d36 Fix instcombine to not introduce undefined shifts when merging two
shifts together.  This fixes PR3851.

llvm-svn: 67411
2009-03-20 22:41:15 +00:00
Duncan Sands a09e0afe74 Don't load values out of global constants with weak
linkage: the value may be replaced with something
different at link time.  (Frontends that want to
allow values to be loaded out of weak constants can
give their constants weak_odr linkage).

llvm-svn: 67407
2009-03-20 21:53:29 +00:00
Dan Gohman 3bdc4bdba6 Simplify this code; use a while instead of an if and a do-while.
llvm-svn: 67400
2009-03-20 20:42:23 +00:00
Evan Cheng 2e55923fba For inline asm output operand that matches an input. Encode the input operand index in the high bits.
llvm-svn: 67387
2009-03-20 18:03:34 +00:00
Sanjiv Gupta 4655d731e1 Fixed comment for libcalls.
llvm-svn: 67373
2009-03-20 14:10:20 +00:00
Sanjiv Gupta 83debdf4b4 Fixed build warnings for unused variables.
llvm-svn: 67372
2009-03-20 13:49:20 +00:00
Sanjiv Gupta c035b7e879 Reformatting. Inserted code comments. Cleaned interfaces.
Removed unncessary code. No functionality change.

llvm-svn: 67371
2009-03-20 13:42:20 +00:00
Sanjiv Gupta e9759c458c Fixed the comment. No functionality change.
llvm-svn: 67370
2009-03-20 09:38:50 +00:00
Nick Lewycky 18ca80cdda Revert r67334 and r37349 which break "make check" on Linux.
llvm-svn: 67368
2009-03-20 07:56:31 +00:00
Chris Lattner f0db9b6321 Apply the patch requested in PR3846.
llvm-svn: 67364
2009-03-20 05:08:24 +00:00
Mon P Wang f67448adf8 Added option to enable generating less precise mad (multiply addition)
for those architectures that support the instruction.

llvm-svn: 67363
2009-03-20 05:06:58 +00:00
Dan Gohman 76402b9a3d The last use in a block that doesn't have successors
(return or unreachable) is a kill.

llvm-svn: 67357
2009-03-20 01:28:21 +00:00
Evan Cheng 6d6647c7b3 Fix typo's.
llvm-svn: 67349
2009-03-20 00:14:09 +00:00
Sebastian Redl 8d5baa09f8 Fix the Win32 VS2008 build:
- Make type declarations match the struct/class keyword of the definition.
 - Move AddSignalHandler into the namespace where it belongs.
 - Correctly call functions from template base.
 - Some other small changes.
With this patch, LLVM and Clang should build properly and with far less noise under VS2008.

llvm-svn: 67347
2009-03-19 23:26:52 +00:00
Evan Cheng 1361cbbb0b Added MachineInstr::isRegTiedToDefOperand to check for two-addressness.
llvm-svn: 67335
2009-03-19 20:30:06 +00:00
Evan Cheng 05799db963 More makefile changes to allow dejagnu tests to pass when system tools default to a different target from the llvm configuration (e.g. 64-bit gcc and 32-bit llvm).
llvm-svn: 67334
2009-03-19 20:27:23 +00:00
Misha Brukman 5182b758a0 Renamed unittest files to have a consistent {Tt}est suffix.
llvm-svn: 67326
2009-03-19 19:09:48 +00:00
Dan Gohman 1026a8001f SADDO and UADDO are commutative.
llvm-svn: 67319
2009-03-19 18:53:45 +00:00
Dale Johannesen 2050968df9 Clear the cached cost when removing a function in
the inliner; prevents nondeterministic behavior
when the same address is reallocated.
Don't build call graph nodes for debug intrinsic calls;
they're useless, and there were typically a lot of them.

llvm-svn: 67311
2009-03-19 18:03:56 +00:00
Dan Gohman 37061eef5d Add a liveness analysis pass for LLVM IR values. This computes
the set of blocks in which values are used, the set in which
values are live-through, and the set in which values are
killed. For the live-through and killed sets, conservative
approximations are used.

llvm-svn: 67309
2009-03-19 17:29:04 +00:00
Dale Johannesen e4f361212b Fix comment typo.
llvm-svn: 67307
2009-03-19 17:23:29 +00:00
Dale Johannesen 52bc2aac8a This pass keeps a map of Instructions to Rank numbers,
and was deleting Instructions without clearing the
corresponding map entry.  This led to nondeterministic
behavior if the same address got allocated to another
Instruction within a short time.

llvm-svn: 67306
2009-03-19 17:22:53 +00:00
Ted Kremenek dd03b5bb63 Fix regression in 'tblgen -gen-clang-diags-defs': Emit the diagnostic kind instead of "DIAGNOSTICCONTROLLED".
llvm-svn: 67305
2009-03-19 17:18:09 +00:00
Chris Lattner 58bd3dccf9 Fix PEI to not walk off the start of a block when an updated instruction
is the first in its block.  This is PR3842.

llvm-svn: 67304
2009-03-19 17:15:43 +00:00
Duncan Sands 8208465036 Fix comment typo.
llvm-svn: 67302
2009-03-19 11:37:15 +00:00
Nick Lewycky 063699af70 Fix a couple glaring whitespace issues. This file isn't internally consistent
either.

llvm-svn: 67288
2009-03-19 06:31:22 +00:00
Nick Lewycky bfd4ad67c7 Remove strange extra semicolons.
llvm-svn: 67287
2009-03-19 05:51:39 +00:00
Nate Begeman dbe3f77f5b Add support to tablegen for naming the nodes themselves, not just the operands,
in selectiondag patterns.  This is required for the upcoming shuffle_vector rewrite,
and as it turns out, cleans up a hack in the Alpha instruction info.

llvm-svn: 67286
2009-03-19 05:21:56 +00:00
Bruno Cardoso Lopes 3b7b301a24 Added support for Mips O32 Calling Convention
llvm-svn: 67280
2009-03-19 02:12:28 +00:00
Ted Kremenek 4724b8262f tblgen -gen-clang-diags-options: Output OptionTable entries in lexicographic
order.

llvm-svn: 67244
2009-03-18 21:36:46 +00:00
Ted Kremenek bf76c6d971 'tblgen -gen-clang-diags-options' now outputs the OptionTable:
static const WarningOption OptionTable[] = {
    {"unused-macros", DIAGS(UnusedMacrosDiags)}
    ...
  };

This table is not yet properly sorted.

llvm-svn: 67242
2009-03-18 21:28:47 +00:00
Ted Kremenek 4a330b7ec1 Add another Clang TableGen-backend (-gen-clang-diags-options) for emitting
declarations for controlling groups of warnings. Currently this transforms:

  def UnusedMacrosDiags : Option<"unused-macros", [pp_macro_not_used]>;
  
into:

  static const diag::kind UnusedMacrosDiags[] = { diag::pp_macro_not_used };

llvm-svn: 67239
2009-03-18 21:16:16 +00:00
Chris Lattner 0f6dc78cfe include the null at the end of a memorybuffer as part of the buffer.
This allows tblgen to handle include "foo.td" when the quote is exactly
the last character in a file.  rdar://6695728

llvm-svn: 67232
2009-03-18 20:36:45 +00:00
Bill Wendling 7b06cbe6d4 These tests are now passing on Darwin because of r67139.
llvm-svn: 67215
2009-03-18 17:45:11 +00:00
Chris Lattner 514fc5b143 aha, DAE does have to think about PHI nodes. Many thanks to "Dr Evil" (aka Duncan)
for pointing this out :)

llvm-svn: 67212
2009-03-18 16:48:45 +00:00
Chris Lattner 595923ff75 Fix PR3826 - InstComb assert with vector shift, by not calling ComputeNumSignBits on a vector.
llvm-svn: 67211
2009-03-18 16:32:19 +00:00
Chris Lattner ab8022055a add an assertion to make it clear that PHI nodes are not allowed.
llvm-svn: 67210
2009-03-18 16:23:56 +00:00
Zhou Sheng 4e2af3cb55 Explicitly check for StoreInst, do not lose the chance to delete
unused loads or bitcasts.

llvm-svn: 67202
2009-03-18 12:48:48 +00:00
Zhou Sheng 05bea906c1 Revert my previous change on Local.cpp, instead, fix the bug on scalarrepl.
If the instruction has no users, it is also not only used by debug info 
and should not be deleted.

llvm-svn: 67194
2009-03-18 10:13:08 +00:00
Rafael Espindola d2b64fc65b Add -relocation-model=pic so that the test works
both in Linux and Darwin.

llvm-svn: 67191
2009-03-18 09:38:28 +00:00
Zhou Sheng 64a6a092b1 Fix a bug.
If I->use_empty(), this method should return false.

llvm-svn: 67180
2009-03-18 07:56:13 +00:00
Mon P Wang 32c8074be6 Added missing support for widening when splitting an unary op (PR3683)
and expanding a bit convert (PR3711).  In both cases, we extract the
valid part of the widen vector and then do the conversion.

llvm-svn: 67175
2009-03-18 06:24:04 +00:00
Evan Cheng 8df898917f Add another test case for r64440.
llvm-svn: 67156
2009-03-18 02:43:01 +00:00
Evan Cheng 110377c669 xfail these tests for now.
llvm-svn: 67143
2009-03-18 00:44:45 +00:00
Chris Lattner a6bed3e950 Disable the "call to immediate" optimization on x86-64. It is
not safe in general because the immediate could be an arbitrary
value that does not fit in a 32-bit pcrel displacement.  
Conservatively fall back to loading the value into a register
and calling through it.

We still do the optzn on X86-32.

llvm-svn: 67142
2009-03-18 00:43:52 +00:00
Chris Lattner a15ce21135 Fix PR3807 by inserting 'insertelement' instructions in the normal dest of
an invoke instead of after the invoke (in its block), which is invalid.

llvm-svn: 67139
2009-03-18 00:31:45 +00:00
Bill Wendling 4eaeb4ef22 A more proper -mtriple.
llvm-svn: 67138
2009-03-18 00:19:44 +00:00
Bill Wendling 3aad86fa3f Temporary fix. I think Rafael wanted this to be Linux-only.
llvm-svn: 67137
2009-03-18 00:16:36 +00:00
Chris Lattner 42e9ca42ce LSR shouldn't ever try to hack on integer IV's larger than 64-bits. Right now
it is not APInt clean, but even when it is it needs to be evaluated carefully
to determine whether it is actually profitable.

This fixes a crash on PR3806

llvm-svn: 67134
2009-03-17 23:58:30 +00:00
Rafael Espindola 4606b12108 Don't force promotion of return arguments on the callee.
Some architectures (like x86) don't require it.
This fixes bug 3779.

llvm-svn: 67132
2009-03-17 23:43:59 +00:00
Daniel Dunbar 437b8a5ccc Add BUILTIN_EXPECT Support/Compiler macro.
- Use for exceptional buffer conditions in raw_ostream:write to shave
   off a cycle or two.

 - Please rename if you have a better one.

llvm-svn: 67103
2009-03-17 21:15:18 +00:00
Chris Lattner 4359f3f26f this is apparently passing now. Evan/Dan, please check
to see if this is producing the expected code or not, I'm
not sure what the test was intended to check.

llvm-svn: 67099
2009-03-17 20:23:43 +00:00
Devang Patel 62c72c6826 test case for rev. 67095.
llvm-svn: 67096
2009-03-17 19:47:21 +00:00
Chris Lattner 2363d0b8b9 Fix codegen to compute the size of an allocation by multiplying the
size by the array amount as an i32 value instead of promoting from
i32 to i64 then doing the multiply.  Not doing this broke wrap-around
assumptions that the optimizers (validly) made.  The ultimate real
fix for this is to introduce i64 version of alloca and remove mallocinst.

This fixes PR3829

llvm-svn: 67093
2009-03-17 19:36:00 +00:00
Chris Lattner e549493a55 Remove a condition which is always true.
llvm-svn: 67089
2009-03-17 17:55:15 +00:00
Evan Cheng 8216785663 Add newline at end of file.
llvm-svn: 67085
2009-03-17 17:08:25 +00:00
Scott Michel df52d3d477 CellSPU:
Revert inadvertent mis-fix of fneg.

llvm-svn: 67084
2009-03-17 16:45:16 +00:00
Daniel Dunbar af41991c8f Minimal raw_ostream unit tests
llvm-svn: 67083
2009-03-17 16:14:59 +00:00
Sanjiv Gupta 88e15b258f r66870 missed this out.
llvm-svn: 67082
2009-03-17 15:46:15 +00:00
Gabor Greif bda5a94c79 typo
llvm-svn: 67080
2009-03-17 11:38:29 +00:00
Duncan Sands fb5c74ef4b Reapply r67049, with the test adjusted for darwin
(which produces "call L_f$stub" rather than "call f").

llvm-svn: 67079
2009-03-17 09:46:22 +00:00
Mon P Wang 523c0852c6 Fix a problem with DAGCombine where we were building an illegal build
vector shuffle mask. Forced the mask to be built using i32.  Note: this will
be irrelevant once vector_shuffle no longer takes a build vector for the
shuffle mask.

llvm-svn: 67076
2009-03-17 06:33:10 +00:00
Dan Gohman d6e571b202 Recognize bswapl as bswap too.
llvm-svn: 67072
2009-03-17 02:45:40 +00:00
Dan Gohman 77a9279d80 Recognize "bswapq" as an alternate spelling for the bswap instruction.
llvm-svn: 67071
2009-03-17 02:17:27 +00:00
Daniel Dunbar 076b0b649b raw_ostream: Return '*this' explicitly (instead of implicitly via
write) to expose more alias information.

llvm-svn: 67070
2009-03-17 01:53:36 +00:00
Daniel Dunbar 64fa3860ed raw_ostream: Put all exceptional conditions in raw_ostream::write
under a single branch.

Also, add a FIXME for formatted output.

llvm-svn: 67069
2009-03-17 01:36:56 +00:00
Evan Cheng 76f1b47ec9 Spiller may unfold load / mod / store instructions as an optimization when the would be loaded value is available in a register. It needs to check if it's legal to clobber the register. Also, the register can contain values of multiple spill slots, make sure to check all instead of just the one being unfolded.
llvm-svn: 67068
2009-03-17 01:23:09 +00:00
Scott Michel 839ad0a5f3 CellSPU:
- Fix fabs, fneg for f32 and f64.
- Use BuildVectorSDNode.isConstantSplat, now that the functionality exists
- Continue to improve i64 constant lowering. Lower certain special constants
  to the constant pool when they correspond to SPU's shufb instruction's
  special mask values. This avoids the overhead of performing a shuffle on a
  zero-filled vector just to get the special constant when the memory load
  suffices.

llvm-svn: 67067
2009-03-17 01:15:45 +00:00
Daniel Dunbar 2d603dae2c raw_ostream: Rework implementation of unbuffered streams so outputting
a single character requires only one branch to follow slow path.
 - Never use a buffer when writing on an unbuffered stream.

 - Move default buffer size to header.

llvm-svn: 67066
2009-03-17 01:13:35 +00:00
Dale Johannesen 87077356be Fix a debug info dependency in jump threading.
llvm-svn: 67064
2009-03-17 00:38:24 +00:00
Daniel Dunbar db7a36cdac raw_ostream: Replace flush_impl with write_impl, which takes data to
write as arguments.
 - Add raw_ostream::GetNumBytesInBuffer.
 - Privatize buffer pointers.
 - Get rid of slow and unnecessary code for writing out large strings.

llvm-svn: 67060
2009-03-16 23:29:31 +00:00
Daniel Dunbar d24535fe3c raw_ostream: Lift out flush_nonempty.
- Flush a known non-empty buffers; enforces the interface to
   flush_impl and kills off HandleFlush (which I saw no reason to be
   an inline method, Chris?).

 - Clarify invariant that flush_impl is only called with OutBufCur >
   OutBufStart.

 - This also cleary collects all places where we have to deal with the
   buffer possibly not existing.

 - A few more comments and fixing the unbuffered behavior remain in
   this commit sequence.

llvm-svn: 67057
2009-03-16 22:55:06 +00:00
Douglas Gregor 6d1ec14f0f CMake: Build system fixes for XCode. llvm-config still causes us some serious trouble, but it's less serious than it used to be
llvm-svn: 67056
2009-03-16 22:53:26 +00:00
Daniel Dunbar 8786218b0c Make raw_ostream::operator<<(const void *) fast; it doesn't matter but
it is easy.

llvm-svn: 67054
2009-03-16 22:08:44 +00:00
Daniel Dunbar 7a9bb9eeec Add slow path for single character write, and use exclusively for
single characters writes outside of the fast path in raw_ostream.h

llvm-svn: 67053
2009-03-16 22:00:17 +00:00
Douglas Gregor d36792c86f CMake: Make sure to build TableGen'd files in the binary directory
llvm-svn: 67052
2009-03-16 21:35:18 +00:00
Bill Wendling dadaf54e09 --- Reverse-merging (from foreign repository) r67049 into '.':
U    test/CodeGen/X86/2009-03-13-PHIElimBug.ll
D    test/CodeGen/X86/2009-03-16-PHIElimInLPad.ll
U    lib/CodeGen/PHIElimination.cpp

r67049 was causing this failure:

Running /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/test/CodeGen/X86/dg.exp ...
FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/test/CodeGen/X86/2009-03-13-PHIElimBug.ll for PR3784
Failed with exit(1) at line 1
while running:  llvm-as < /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvm.src/test/CodeGen/X86/2009-03-13-PHIElimBug.ll |  llc -march=x86 | /usr/bin/grep -A 2 {call f} | /usr/bin/grep movl
child process exited abnormally

llvm-svn: 67051
2009-03-16 20:27:20 +00:00
Duncan Sands d3e07c9d09 Tweak the fix for PR3784: be less sensitive about just
how invokes are set up.  The fix could be disturbed by
register copies coming after the EH_LABEL, and also didn't
behave quite right when it was the invoke result that
was used in a phi node.  Also (see new testcase) fix
another phi elimination bug while there: register copies
in the landing pad need to come after the EH_LABEL, because
that's where execution branches to when unwinding.  If they
come before the EH_LABEL then they will never be executed...
Also tweak the original testcase so it doesn't use a no-longer
existing counter.
The accumulated phi elimination changes fix two of seven Ada
testsuite failures that turned up after landing pad critical
edge splitting was turned off.  So there's probably more to come.

llvm-svn: 67049
2009-03-16 19:58:38 +00:00
Scott Michel d1db1aba66 CellSPU:
Incorporate Tilmann's 128-bit operation patch. Evidently, it gets the
llvm-gcc bootstrap a bit further along.

llvm-svn: 67048
2009-03-16 18:47:25 +00:00
Chris Lattner d35d43dde8 change this to test for an alias result more directly.
llvm-svn: 67046
2009-03-16 18:28:27 +00:00
Douglas Gregor 9f20b83568 Add TGSourceMgr.cpp to CMake build, sort lines
llvm-svn: 67042
2009-03-16 17:04:14 +00:00
Bruno Cardoso Lopes aa7db25235 This causes incorrect stack frame allocation when the last object is an array allocated on the stack which would lead
the compiled program to run over its stack. Thanks to Gil Dogon

llvm-svn: 67034
2009-03-15 23:28:07 +00:00
Nick Lewycky edbb0e2f1b Simplify. "Broken" is always true here.
llvm-svn: 67025
2009-03-15 06:40:32 +00:00
Nick Lewycky 5aa592a2f8 Remove obviously redundant call.
llvm-svn: 67023
2009-03-15 06:39:52 +00:00
Owen Anderson 0422efc994 Give the pre-alloc splitter access to the VirtRegMap. It doesn't do anything
useful with it at the moment, but it will in the future.

llvm-svn: 67012
2009-03-14 21:40:05 +00:00
Nick Lewycky 8e0f9ac051 Add a replacement for 2009-02-12-GEPNoalias.ll that works without -debug.
llvm-svn: 67011
2009-03-14 19:40:09 +00:00
Dan Gohman 79975d5ffb Apply a patch by Micah Villmow to fix AsmParser to accept vector
shift constant expressions, and add support for folding vector
shift constant expressions. This fixes PR3802.

llvm-svn: 67010
2009-03-14 17:09:17 +00:00
Sebastian Redl 6c2d55922f Fix Clang build for srcdir != objdir
llvm-svn: 67008
2009-03-14 14:42:51 +00:00
Sebastian Redl f2e58d6694 Add support for generating Clang diagnostic defs to Makefile.rules.
llvm-svn: 67006
2009-03-14 11:59:18 +00:00
Sebastian Redl 9384e2ca4d Add TableGen syntax highlighting for the jEdit editor.
llvm-svn: 67005
2009-03-14 10:15:32 +00:00
Dan Gohman 6c28e72bb1 Add a testcase that covers a wide variety of ABI isel cases.
llvm-svn: 67003
2009-03-14 02:35:10 +00:00
Dan Gohman f98cd1b48a Use %rip-relative addressing on x86-64 whenever practical, as
it has a smaller encoding than absolute addressing.

llvm-svn: 67002
2009-03-14 02:33:41 +00:00
Dan Gohman 2293eb6037 Don't forego folding of loads into 64-bit adds when the other
operand is a signed 32-bit immediate. Unlike with the 8-bit
signed immediate case, it isn't actually smaller to fold a
32-bit signed immediate instead of a load. In fact, it's
larger in the case of 32-bit unsigned immediates, because
they can be materialized with movl instead of movq.

llvm-svn: 67001
2009-03-14 02:07:16 +00:00
Daniel Dunbar f24f26c75a Add newlines at end of file (this can annoy gcov)
llvm-svn: 67000
2009-03-14 01:53:05 +00:00
Mon P Wang c86715631c Avoid doing the transformation c ? 1.0 : 2.0 as load { 2.0, 1.0 } + c*4
if FPConstant is legal because if the FPConstant doesn't need to be stored
in a constant pool, the transformation is unlikely to be profitable.

llvm-svn: 66994
2009-03-14 00:25:19 +00:00
Dan Gohman 638e530509 Add a few more ptrtoint/inttoptr cast tests.
llvm-svn: 66989
2009-03-13 23:54:51 +00:00
Dan Gohman a62e4ab690 Improve FastISel's handling of truncates to i1, and implement
ptrtoint and inttoptr in X86FastISel. These casts aren't always
handled in the generic FastISel code because X86 sometimes needs
custom code to do truncation and zero-extension.

llvm-svn: 66988
2009-03-13 23:53:06 +00:00
Dale Johannesen a4ac735531 Fix -strip-debug-declare to work when there are
llvm.global.variable's but no llvm.declare's.

llvm-svn: 66977
2009-03-13 22:59:47 +00:00
Evan Cheng 94419d6fdd Fix PR3784: If the source of a phi comes from a bb ended with an invoke, make sure the copy is inserted before the try range (unless it's used as an input to the invoke, then insert it after the last use), not at the end of the bb.
Also re-apply r66140 which was disabled as a workaround.

llvm-svn: 66976
2009-03-13 22:59:14 +00:00
Ted Kremenek 9750429e61 Add (hidden) TableGen command option '-clang-component' which specifies the
component's warnings to process for '-gen-clang-diags-defs'.

Also, when the component is specified, generate a '#if' prologue at the top of
the generated .def file (to match the current files).

llvm-svn: 66975
2009-03-13 22:53:41 +00:00
Ted Kremenek dee115697b Add initial implementation of a TableGen backend for converting Clang-warnings
tablegen files to the original .def preprocessor include files. This is my first
TableGen backend; I don't claim that it is awesome.

llvm-svn: 66971
2009-03-13 22:21:17 +00:00
Ted Kremenek 58e32877f1 Further constify Record::isSubClassOf.
llvm-svn: 66970
2009-03-13 22:20:10 +00:00
Devang Patel 4482c0518b Fix test case. Now, llvm-gcc emits debug info for artificiaal variable _comp_ctor.
llvm-svn: 66963
2009-03-13 21:57:16 +00:00
Stuart Hastings 7440952c01 Fix a hashing bug in APInt. A certain pathological testcase (too
large for the testsuite) took over six minutes to compile on my Mac.
The patched LLVM-GCC compiles that testcase in three seconds (GCC
takes less than one second).  This hash function is more complex
(about 35 instructions on x86) than what Chris wanted, but I expect it
will be well-behaved with arbitrary inputs.

Thank you to everyone who responded to my previous request for advice.

llvm-svn: 66962
2009-03-13 21:51:13 +00:00
Chris Lattner 8bd06d8e1b Fix escaping in asm string literals correctly by having tblgen unescape
them, then the asmprinter emitter reescape them.

llvm-svn: 66958
2009-03-13 21:33:17 +00:00
Chris Lattner a614ef2000 add a horrible hack to fix the build.
llvm-svn: 66957
2009-03-13 21:23:43 +00:00
Bill Wendling 4bb96e9a50 Revert r66920. It was causing failures in the self-hosting buildbot (in release
mode).

Running /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/dg.exp ...
FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/crash-narrowfunctiontest.ll
Failed with signal(SIGBUS) at line 1
while running: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/crash-narrowfunctiontest.ll -bugpoint-crashcalls -silence-passes > /dev/null
0   bugpoint          0x0035dd25 llvm::sys::SetInterruptFunction(void (*)()) + 85
1   bugpoint          0x0035e382 llvm::sys::RemoveFileOnSignal(llvm::sys::Path const&, std::string*) + 706
2   libSystem.B.dylib 0x92f112bb _sigtramp + 43
3   libSystem.B.dylib 0xffffffff _sigtramp + 1829694831
4   bugpoint          0x00021d1c main + 92
5   bugpoint          0x00002106 start + 54
6   bugpoint          0x00000004 start + 18446744073709543220
Stack dump:
0.    Program arguments: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/crash-narrowfunctiontest.ll -bugpoint-crashcalls -silence-passes 

FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/misopt-basictest.ll
Failed with signal(SIGBUS) at line 1
while running: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/misopt-basictest.ll -dce -bugpoint-deletecalls -simplifycfg -silence-passes
0   bugpoint          0x0035dd25 llvm::sys::SetInterruptFunction(void (*)()) + 85
1   bugpoint          0x0035e382 llvm::sys::RemoveFileOnSignal(llvm::sys::Path const&, std::string*) + 706
2   libSystem.B.dylib 0x92f112bb _sigtramp + 43
3   libSystem.B.dylib 0xffffffff _sigtramp + 1829694831
4   bugpoint          0x00021d1c main + 92
5   bugpoint          0x00002106 start + 54
6   bugpoint          0x00000006 start + 18446744073709543222
Stack dump:
0.    Program arguments: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/misopt-basictest.ll -dce -bugpoint-deletecalls -simplifycfg -silence-passes 

FAIL: /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/remove_arguments_test.ll
Failed with signal(SIGBUS) at line 1
while running: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/remove_arguments_test.ll  -bugpoint-crashcalls -silence-passes
0   bugpoint          0x0035dd25 llvm::sys::SetInterruptFunction(void (*)()) + 85
1   bugpoint          0x0035e382 llvm::sys::RemoveFileOnSignal(llvm::sys::Path const&, std::string*) + 706
2   libSystem.B.dylib 0x92f112bb _sigtramp + 43
3   libSystem.B.dylib 0xffffffff _sigtramp + 1829694831
4   bugpoint          0x00021d1c main + 92
5   bugpoint          0x00002106 start + 54
Stack dump:
0.    Program arguments: bugpoint /Volumes/Sandbox/Buildbot/llvm/full-llvm/build/llvmCore/test/BugPoint/remove_arguments_test.ll -bugpoint-crashcalls -silence-passes 

--- Reverse-merging (from foreign repository) r66920 into '.':
U    include/llvm/Support/CallSite.h
U    include/llvm/Instructions.h
U    lib/Analysis/IPA/GlobalsModRef.cpp
U    lib/Analysis/IPA/Andersens.cpp
U    lib/Bitcode/Writer/BitcodeWriter.cpp
U    lib/VMCore/Instructions.cpp
U    lib/VMCore/Verifier.cpp
U    lib/VMCore/AsmWriter.cpp
U    lib/Transforms/Utils/LowerInvoke.cpp
U    lib/Transforms/Scalar/SimplifyCFGPass.cpp
U    lib/Transforms/IPO/PruneEH.cpp
U    lib/Transforms/IPO/DeadArgumentElimination.cpp

llvm-svn: 66953
2009-03-13 21:15:59 +00:00
Chris Lattner 1bd3674306 add support for a few simple escape characters in tblgen strings.
llvm-svn: 66949
2009-03-13 21:03:27 +00:00
Daniel Dunbar 5b86bf527e Add ENABLE_COVERAGE, for building a +Coverage (gcov) configuration.
- Required some extra makefile tweaks to introduce a new flag var
   which only goes to compile/link tools but not the relink step,
   otherwise we get a copy of libgcov in the relinked .o files.

 - No configure magic for this.

llvm-svn: 66945
2009-03-13 20:59:41 +00:00
Dan Gohman c0bb959591 Fix FastISel's assumption that i1 values are always zero-extended
by inserting explicit zero extensions where necessary. Included
is a testcase where SelectionDAG produces a virtual register
holding an i1 value which FastISel previously mistakenly assumed
to be zero-extended.

llvm-svn: 66941
2009-03-13 20:42:20 +00:00
Chris Lattner 2150eb9f6f remove a test that depends on -debug.
llvm-svn: 66937
2009-03-13 20:31:48 +00:00
Chris Lattner 033a654dee remove a testcase that depends on -debug existing.
llvm-svn: 66936
2009-03-13 20:31:25 +00:00
Rafael Espindola 997b74ac61 add 8 and 16 bit TLS moves.
add a fixme note on how to remove code duplication.

llvm-svn: 66932
2009-03-13 19:39:55 +00:00
Dale Johannesen c65830519e One more place where debug info affects codegen.
llvm-svn: 66930
2009-03-13 19:23:20 +00:00
Devang Patel a01646efda Test case for rev. 66925
llvm-svn: 66927
2009-03-13 18:50:51 +00:00
Rafael Espindola 71144973f3 Improve sext and zext of TLS variables.
llvm-svn: 66922
2009-03-13 18:37:06 +00:00
Gabor Greif 258232fb80 Second installment of "BasicBlock operands to the back"
changes.

For InvokeInst now all arguments begin at op_begin().
The Callee, Cont and Fail are now faster to get by
access relative to op_end().

This patch introduces some temporary uglyness in CallSite.
Next I'll bring CallInst up to a similar scheme and then
the uglyness will magically vanish.

This patch also exposes all the reliance of the libraries
on InvokeInst's operand ordering. I am thinking of taking
care of that too.

llvm-svn: 66920
2009-03-13 18:27:29 +00:00
Chris Lattner a18c768e6d remove a buggy test, it is not ok to use -debug in RUN line.
llvm-svn: 66918
2009-03-13 18:19:34 +00:00
Chris Lattner 3fb71c8f49 generalize this code so that fast isel handles integer truncates to i1, which
codegen to the same thing as integer truncates to i8 (the top bits are 
just undefined).  This implements rdar://6667338

llvm-svn: 66902
2009-03-13 16:36:42 +00:00
Chris Lattner ba42e49c14 add a new TGError class and use it to propagate location info with
errors when thrown.  This gets us nice errors like this from tblgen:

CMOVL32rr: 	(set GR32:i32:$dst, (X86cmov GR32:$src1, GR32:$src2))
/Users/sabre/llvm/Debug/bin/tblgen: error:
Included from X86.td:116:
Parsing X86InstrInfo.td:922: In CMOVL32rr: X86cmov node requires exactly 4 operands!
def CMOVL32rr : I<0x4C, MRMSrcReg,       // if <s, GR32 = GR32
^

instead of just:

CMOVL32rr: 	(set GR32:i32:$dst, (X86cmov GR32:$src1, GR32:$src2))
/Users/sabre/llvm/Debug/bin/tblgen: In CMOVL32rr: X86cmov node requires exactly 4 operands!

This is all I plan to do with this, but it should be easy enough to improve if anyone 
cares (e.g. keeping more loc info in "dag" expr records in tblgen.

llvm-svn: 66898
2009-03-13 16:25:21 +00:00
Chris Lattner bd9b9210c2 give each Record a location.
llvm-svn: 66897
2009-03-13 16:09:24 +00:00
Chris Lattner 87710ca527 make "locations" a class instead of a typedef.
llvm-svn: 66895
2009-03-13 16:01:53 +00:00
Duncan Sands 0c9742c3ae Update these for the 2.5 release.
llvm-svn: 66890
2009-03-13 13:42:20 +00:00
Bill Wendling 798fd56d0f These instructions have special lowering that may lower them to SSE
instructions. Prevent that if we don't want implicit uses of SSE.

llvm-svn: 66877
2009-03-13 08:41:47 +00:00
Argyrios Kyrtzidis afc74e2326 Unbreak build, bring in std::string for GCC 4.3
llvm-svn: 66876
2009-03-13 08:12:13 +00:00
Evan Cheng 1fb8aedd1e Fix some significant problems with constant pools that resulted in unnecessary paddings between constant pool entries, larger than necessary alignments (e.g. 8 byte alignment for .literal4 sections), and potentially other issues.
1. ConstantPoolSDNode alignment field is log2 value of the alignment requirement. This is not consistent with other SDNode variants.
2. MachineConstantPool alignment field is also a log2 value.
3. However, some places are creating ConstantPoolSDNode with alignment value rather than log2 values. This creates entries with artificially large alignments, e.g. 256 for SSE vector values.
4. Constant pool entry offsets are computed when they are created. However, asm printer group them by sections. That means the offsets are no longer valid. However, asm printer uses them to determine size of padding between entries.
5. Asm printer uses expensive data structure multimap to track constant pool entries by sections.
6. Asm printer iterate over SmallPtrSet when it's emitting constant pool entries. This is non-deterministic.


Solutions:
1. ConstantPoolSDNode alignment field is changed to keep non-log2 value.
2. MachineConstantPool alignment field is also changed to keep non-log2 value.
3. Functions that create ConstantPool nodes are passing in non-log2 alignments.
4. MachineConstantPoolEntry no longer keeps an offset field. It's replaced with an alignment field. Offsets are not computed when constant pool entries are created. They are computed on the fly in asm printer and JIT.
5. Asm printer uses cheaper data structure to group constant pool entries.
6. Asm printer compute entry offsets after grouping is done.
7. Change JIT code to compute entry offsets on the fly.

llvm-svn: 66875
2009-03-13 07:51:59 +00:00
Evan Cheng bd5616271b Unbreak build.
llvm-svn: 66874
2009-03-13 07:41:30 +00:00
Chris Lattner 8db9bc7ee4 split buffer management and diagnostic printing out of the tblgen
lexer into its own TGSourceMgr class.

llvm-svn: 66873
2009-03-13 07:05:43 +00:00
Owen Anderson d37ddf5b5b Convert VirtRegMap to a MachineFunctionPass.
llvm-svn: 66870
2009-03-13 05:55:11 +00:00
Chris Lattner 99cc133710 generalize the previous code to use the full generality of LEA
for i32/i64 expressions (we could also do i16 on cpus where
i16 lea is fast, but I didn't add this).  On the example, we now
generate:

_test:
	movl	4(%esp), %eax
	cmpl	$42, (%eax)
	setl	%al
	movzbl	%al, %eax
	leal	4(%eax,%eax,8), %eax
	ret

instead of:

_test:
	movl	4(%esp), %eax
	cmpl	$41, (%eax)
	movl	$4, %ecx
	movl	$13, %eax
	cmovg	%ecx, %eax
	ret

llvm-svn: 66869
2009-03-13 05:53:31 +00:00
Chris Lattner 4be6df5d86 optimize the case of cond ? 42 : 41 and friends. This compiles the
example to:

_test:
	movl	4(%esp), %eax
	cmpl	$41, (%eax)
	setg	%al
	movzbl	%al, %eax
	orl	$4294967294, %eax
	ret

instead of:

        movl    4(%esp), %eax
        cmpl    $41, (%eax)
	movl	$4294967294, %ecx
	movl	$4294967295, %eax
	cmova	%ecx, %eax
	ret

which is smaller in code size and faster. rdar://6668608

llvm-svn: 66868
2009-03-13 05:22:11 +00:00
Bill Wendling fa54bc2052 Oops...I committed too much.
llvm-svn: 66867
2009-03-13 04:39:26 +00:00
Bill Wendling b02eadf660 Temporarily XFAIL this test.
llvm-svn: 66866
2009-03-13 04:37:11 +00:00
Dan Gohman a1d92423cf Enhance address-mode folding of ISD::ADD to handle cases where the
operands can't both be fully folded at the same time. For example,
in the included testcase, a global variable is being added with
an add of two values. The global variable wants RIP-relative
addressing, so it can't share the address with another base
register, but it's still possible to fold the initial add.

llvm-svn: 66865
2009-03-13 02:25:09 +00:00
Dale Johannesen cecfa6e08d Fix one more place where debug info affected
codegen (speculative execution).

llvm-svn: 66859
2009-03-13 01:05:24 +00:00
Chris Lattner b858c0eba0 just initialize the first element, we don't need to set the rest to zeros.
llvm-svn: 66850
2009-03-13 00:24:01 +00:00