Commit Graph

52319 Commits

Author SHA1 Message Date
Victor Hernandez e6ff7662b6 Revert 82694 "Auto-upgrade malloc instructions to malloc calls." because it causes regressions in the nightly tests.
llvm-svn: 82784
2009-09-25 18:11:52 +00:00
Dale Johannesen a318d91a1e Make sure sin, cos, sqrt calls are marked readonly
before producing FSIN, FCOS, FSQRT.  If they aren't
so marked we have to assume they might set errno.

llvm-svn: 82781
2009-09-25 18:00:35 +00:00
Chris Lattner 0a4c44bdf4 reject attempts to use ()'s in patterns, these are reserved for filecheck.
llvm-svn: 82780
2009-09-25 17:29:36 +00:00
Chris Lattner b16ab0c40a reimplement the regex matching strategy by building a single
regex and matching it instead of trying to match chunks at a time.
Matching chunks at a time broke with check lines like 
  CHECK: foo {{.*}}bar
because the .* would eat the entire rest of the line and bar would
never match.

Now we just escape the fixed strings for the user, so that something
like:
  CHECK: a() {{.*}}???
is matched as:
  CHECK: {{a\(\) .*\?\?\?}}
transparently "under the covers".

llvm-svn: 82779
2009-09-25 17:23:43 +00:00
Dale Johannesen c72134269f Generate FSQRT from calls to the sqrt function, which
allows appropriate backends to generate a sqrt instruction.

On x86, this isn't done at -O0 because we go through
FastISel instead.  This is a behavior change from before
this series of sqrt patches started.  I think this is OK
considering that compile speed is most important at -O0, but
could be convinced otherwise.

llvm-svn: 82778
2009-09-25 17:23:22 +00:00
Chris Lattner 221460e0be special case Patterns that are a single fixed string. This is a microscopic
perf win and is needed for future changes.

llvm-svn: 82777
2009-09-25 17:09:12 +00:00
Dale Johannesen 722212d1a0 Revise C library functions description to be vaguer, per Chris.
llvm-svn: 82776
2009-09-25 17:04:42 +00:00
Jeffrey Yasskin db281085c5 This patch causes the --enable-debug-runtime configure flag and the
DEBUG_RUNTIME Makefile variable to pass -g to gcc when building LLVM's objects.
Without this, it's very hard to debug crashes that happen in Release-Asserts
mode but not Debug mode.

llvm-svn: 82775
2009-09-25 16:46:09 +00:00
Bob Wilson f7fe0132c9 Add some comments to clarify things that I discovered this week.
llvm-svn: 82773
2009-09-25 16:34:46 +00:00
Daniel Dunbar e813b22b13 Make llvm-bcanalyzer percentages more readable.
llvm-svn: 82772
2009-09-25 16:04:21 +00:00
Daniel Dunbar 75359a7c2f Strip trailing whitespace.
llvm-svn: 82771
2009-09-25 16:03:57 +00:00
Bob Wilson d60367c198 pr4926: ARM requires the stack pointer to be aligned, even for leaf functions.
For the AAPCS ABI, SP must always be 4-byte aligned, and at any "public
interface" it must be 8-byte aligned.  For the older ARM APCS ABI, the stack
alignment is just always 4 bytes.  For X86, we currently align SP at
entry to a function (e.g., to 16 bytes for Darwin), but no stack alignment
is needed at other times, such as for a leaf function.

After discussing this with Dan, I decided to go with the approach of adding
a new "TransientStackAlignment" field to TargetFrameInfo.  This value
specifies the stack alignment that must be maintained even in between calls.
It defaults to 1 except for ARM, where it is 4.  (Some other targets may
also want to set this if they have similar stack requirements. It's not
currently required for PPC because it sets targetHandlesStackFrameRounding
and handles the alignment in target-specific code.) The existing StackAlignment
value specifies the alignment upon entry to a function, which is how we've
been using it anyway.

llvm-svn: 82767
2009-09-25 14:41:49 +00:00
Duncan Sands 3cf0cdee4c Print INST_INBOUNDS_GEP rather than UnknownCode30.
Likewise for constant inbounds GEP.

llvm-svn: 82763
2009-09-25 12:28:37 +00:00
Chris Lattner 233117b7f6 convert testcases to filecheck.
llvm-svn: 82759
2009-09-25 06:49:41 +00:00
Chris Lattner 712e8e03a5 filecheck should not match a \n with a .
llvm-svn: 82758
2009-09-25 06:47:09 +00:00
Chris Lattner 812e594454 remove a large unreduced testcase
llvm-svn: 82756
2009-09-25 06:37:22 +00:00
Chris Lattner b121a24f25 turn a std::pair into a real class.
llvm-svn: 82754
2009-09-25 06:32:47 +00:00
Nate Begeman 18150d5abc Fix combiner-aa issue with bases which are different, but can alias.
Previously, it treated GV+28 GV+0 as different bases, and assumed they could
not alias.

llvm-svn: 82753
2009-09-25 06:05:26 +00:00
Bob Wilson 0bb2a929a2 Update the description of MachineFrameInfo's OffsetAdjustment. The value of
this adjustment does not change the direction or the signs of the object
offsets, and the details of the offset calculations can be target-specific.
Also mention that for most targets this value is only used to generate debug
info.

llvm-svn: 82750
2009-09-25 05:30:55 +00:00
Dan Gohman 28328db571 Don't try to use pre-indexed addressing with sthbrx/stwbrx
instructions. This fixes a PowerPC bug exposed by some unrelated
changes I'm working on.

llvm-svn: 82743
2009-09-25 00:57:30 +00:00
Dan Gohman ebdfe4af62 Add a version of dumpr() that has a SelectionDAG* argument.
llvm-svn: 82742
2009-09-25 00:34:34 +00:00
Jim Grosbach 372e9a389b Start of revamping the register scavenging in PEI. ARM Thumb1 is the driving
interest for this, as it currently reserves a register rather than using
the scavenger for matierializing constants as needed.

Instead of scavenging registers on the fly while eliminating frame indices,
new virtual registers are created, and then a scavenged collectively in a
post-pass over the function. This isolates the bits that need to interact
with the scavenger, and sets the stage for more intelligent use, and reuse,
of scavenged registers.

For the time being, this is disabled by default. Once the bugs are worked out,
the current scavenging calls in replaceFrameIndices() will be removed and
the post-pass scavenging will be the default. Until then,
-enable-frame-index-scavenging enables the new code. Currently, only the
Thumb1 back end is set up to use it.

llvm-svn: 82734
2009-09-24 23:52:18 +00:00
Dale Johannesen c594890a82 Reenable sqrt IR generation test.
llvm-svn: 82731
2009-09-24 23:37:40 +00:00
Mike Stump 944fa25934 Delete space after function name, before (, reflow a comment and
delete a few blank lines.

llvm-svn: 82729
2009-09-24 23:21:26 +00:00
Mike Stump d6f9a2f90b Fix spacing.
llvm-svn: 82727
2009-09-24 23:11:08 +00:00
Chris Lattner f08d2db928 add and document regex support for FileCheck. You can now do stuff like:
; CHECK: movl {{%e[a-z][xi]}}, %eax

or whatever.

llvm-svn: 82717
2009-09-24 21:47:32 +00:00
Chris Lattner abab11abb2 unconditionally request MMI
llvm-svn: 82716
2009-09-24 21:45:57 +00:00
Chris Lattner 688f991b38 wrap long lines.
llvm-svn: 82715
2009-09-24 21:44:20 +00:00
Chris Lattner a2f8fc5a72 Use CanonicalizeInputFile to canonicalize the entire buffer containing the
CHECK strings, instead of canonicalizing the patterns directly.  This allows
Pattern to just contain a StringRef instead of std::string.

llvm-svn: 82713
2009-09-24 20:45:07 +00:00
Chris Lattner 74d50731c1 change 'not' matching to use Pattern, move pattern parsing logic into
the Pattern class.

llvm-svn: 82712
2009-09-24 20:39:13 +00:00
Chris Lattner 3b40b44528 refactor out the match string into its own Pattern class.
llvm-svn: 82711
2009-09-24 20:25:55 +00:00
Bob Wilson 6cd4aee5e9 Convert to FileCheck.
llvm-svn: 82710
2009-09-24 20:23:02 +00:00
David Goodwin bf97147a7e Make the end-of-itinerary mark explicit. Some cleanup.
llvm-svn: 82709
2009-09-24 20:22:50 +00:00
Dan Gohman c0ecc6f4f9 Add nounwind to this test.
llvm-svn: 82708
2009-09-24 20:20:08 +00:00
Chris Lattner 1ce83629df tidy up, fix a memory leak in Regex::isValid
llvm-svn: 82707
2009-09-24 20:15:51 +00:00
Dale Johannesen 68f971b1d6 Clarify that llvm attaches C language semantics to
functions with names that match the C library.

llvm-svn: 82701
2009-09-24 18:38:21 +00:00
Torok Edwin 21bd8c9fc5 Constant propagating byval pointer is safe if function is readonly.
llvm-svn: 82700
2009-09-24 18:33:42 +00:00
Victor Hernandez 46cd467310 Auto-upgrade malloc instructions to malloc calls.
Reviewed by Devang Patel.

llvm-svn: 82694
2009-09-24 17:47:49 +00:00
Bob Wilson 5fe313d6e0 Fix a hypothetical problem for targets with StackGrowsUp and a non-zero
LocalAreaOffset.  (We don't have any of those right now.)
PEI::calculateFrameObjectOffsets includes the absolute value of the
LocalAreaOffset in the cumulative offset value used to calculate the
stack frame size.  It then adds the raw value of the LocalAreaOffset
to the stack size.  For a StackGrowsDown target, that raw value is negative
and has the effect of cancelling out the absolute value that was added
earlier, but that obviously won't work for a StackGrowsUp target.  Change
to subtract the absolute value of the LocalAreaOffset.

llvm-svn: 82693
2009-09-24 16:42:27 +00:00
Devang Patel 4e6f2e46e8 Move parent assertion check before metadata deletion.
llvm-svn: 82692
2009-09-24 16:19:11 +00:00
Torok Edwin f95a450ef9 Don't constant propagate byval pointers, since they are not really pointers, but
rather structs passed by value.
This fixes PR5038.

llvm-svn: 82689
2009-09-24 09:47:18 +00:00
Daniel Dunbar 00dd448cff Add count/not tools as executables.
- Apparently, I'm willing to do incredibly stupid things in the name of portability.

llvm-svn: 82685
2009-09-24 06:23:57 +00:00
Chris Lattner 87d8f2b9d5 unconditionally compute MMI even if the target doesn't support EH or Debug info, because the target may use it for other things, this fixes PR5036
llvm-svn: 82684
2009-09-24 05:44:53 +00:00
Chris Lattner 4e37f877b5 reapply r82348 with a fix, thanks Jeffrey.
llvm-svn: 82683
2009-09-24 05:38:36 +00:00
Evan Cheng 26ea28eb5f Fix PR5024 with a big hammer: disable the double-def assertion in the scavenger.
LiveVariables add implicit kills to correctly track partial register kills. This works well enough and is fairly accurate. But coalescer can make it impossible to maintain these markers. e.g.

        BL <ga:sss1>, %R0<kill,undef>, %S0<kill>, %R0<imp-def>, %R1<imp-def,dead>, %R2<imp-def,dead>, %R3<imp-def,dead>, %R12<imp-def,dead>, %LR<imp-def,dead>, %D0<imp-def>, ...
...
	%reg1031<def> = FLDS <cp#1>, 0, 14, %reg0, Mem:LD4[ConstantPool]
...
   	%S0<def> = FCPYS %reg1031<kill>, 14, %reg0, %D0<imp-use,kill>

When reg1031 and S0 are coalesced, the copy (FCPYS) will be eliminated the the implicit-kill of D0 is lost. In this case it's possible to move the marker to the FLDS. But in many cases, this is not possible. Suppose

	%reg1031<def> = FOO <cp#1>, %D0<imp-def>
...
   	%S0<def> = FCPYS %reg1031<kill>, 14, %reg0, %D0<imp-use,kill>

When FCPYS goes away, the definition of S0 is the "FOO" instruction. However, transferring the D0 implicit-kill to FOO doesn't work since it is the def of D0 itself. We need to fix this in another time by introducing a "kill" pseudo instruction to track liveness.

Disabling the assertion is not ideal, but machine verifier is doing that job now. It's important to know double-def is not a miscomputation since it means a register should be free but it's not tracked as free. It's a performance issue instead.

llvm-svn: 82677
2009-09-24 02:27:09 +00:00
Evan Cheng a21aac3811 Clean up LiveVariables and change how it deals with partial updates and kills. This also eliminate the horrible check which scan forward to the end of the basic block. It should be faster and more accurate.
llvm-svn: 82676
2009-09-24 02:15:22 +00:00
Jeffrey Yasskin a75d6bf3a8 Roll back r82348, which introduced an infinite loop in ParseCStringVector() that
a trivial unittest would have caught.  This revision also adds the trivial
unittest.

llvm-svn: 82675
2009-09-24 01:14:07 +00:00
Dale Johannesen fb1b55bc9c A minor improvment in accuracy to inline cost
computation, and some cosmetics.

llvm-svn: 82660
2009-09-23 22:05:24 +00:00
Dale Johannesen ea406ed0a6 Disable test; what it's testing for is wrong.
llvm-svn: 82658
2009-09-23 21:46:36 +00:00
David Goodwin afcaf79603 Checkpoint NEON scheduling itineraries.
llvm-svn: 82657
2009-09-23 21:38:08 +00:00
Dan Gohman 203d53ed79 Use getStoreSize() instead of getStoreSizeInBits()/8.
llvm-svn: 82656
2009-09-23 21:07:02 +00:00
Dan Gohman 99bdae2992 Spruce up some comments.
llvm-svn: 82655
2009-09-23 21:06:36 +00:00
Dan Gohman 08c0a95ac6 Rename several variables from EVT to more descriptive names, now that EVT
is also the name of their type, as declarations like "EVT EVT" look
really odd.

llvm-svn: 82654
2009-09-23 21:02:20 +00:00
Dan Gohman 2366ffd2cb Add an EVT::getStoreSize function, like getStoreSizeInBits but in bytes.
llvm-svn: 82653
2009-09-23 20:59:10 +00:00
Jakob Stoklund Olesen 75b9c2741d Fix verification of explicit operands.
The machine code verifier did not check for explicit operands correctly. It
used MachineInstr::getNumExplicitOperands, but that method may cheat and use
the declared count in the TargetInstrDesc.

Now we check the explicit operands one at a time in visitMachineOperand.

llvm-svn: 82652
2009-09-23 20:57:55 +00:00
Bob Wilson abfdbbfd1a Remove BlackfinRegisterInfo::getFrameIndexOffset since it is the same as the
default implementation.  Update comment on the default version, which made it
sound like most targets override it.  Currently only X86 and SystemZ override
this method.

llvm-svn: 82651
2009-09-23 20:57:02 +00:00
Dan Gohman 49f271afb3 Correct a comment.
llvm-svn: 82648
2009-09-23 20:40:16 +00:00
Devang Patel 52e819c7cf Delete attached metadata when an instruction is deleted.
llvm-svn: 82647
2009-09-23 20:33:51 +00:00
Anton Korobeynikov 29a44df5f8 ARM does not support offset folding (yet). Disable it for now.
This fixes PR5031. Unfortunately, there is no small testcase :(

llvm-svn: 82643
2009-09-23 19:04:09 +00:00
Bob Wilson c2c86cede6 Edit a comment.
llvm-svn: 82641
2009-09-23 18:53:19 +00:00
Devang Patel add586526e Do not leave behind metadata while cloning an instruction.
llvm-svn: 82638
2009-09-23 18:32:25 +00:00
Evan Cheng 3cf0ddf094 Add nounwind.
llvm-svn: 82637
2009-09-23 18:20:27 +00:00
Devang Patel e4e8181111 s/*Location/*DebugLocation/g
llvm-svn: 82635
2009-09-23 17:20:43 +00:00
Jeffrey Yasskin 42a49dfb02 PR4047: Permit configure --enable-targets=host,cpp for example. "host" has the
same effect that "host-only" used to have, but can be combined with other
targets.  host-only is still available as a synonym but no longer documented.

llvm-svn: 82634
2009-09-23 17:05:42 +00:00
David Goodwin a4c98a3e34 Fix bug in kill flag updating for post-register-allocation scheduling. When the kill flag of a superreg needs to be cleared because there are one or more subregs live, we instead add implicit-defs of those subregs and leave the kill flag on the superreg. This allows us to end the live-range of the superreg without ending the live-ranges of the subregs.
llvm-svn: 82629
2009-09-23 16:35:25 +00:00
Benjamin Kramer 43355aec61 Fix a struct/class mismatch.
llvm-svn: 82622
2009-09-23 11:48:57 +00:00
John McCall 0110327ae3 Make the type traits for a const pointer defer to those for a unqualified
pointer, instead of providing independent values modelled on the default
implementation.

llvm-svn: 82620
2009-09-23 06:53:51 +00:00
Evan Cheng 262f86ed90 Fix PR5024. LiveVariables physical register defs should *commit* only after all
of the defs are processed.
Also fix a implicit_def propagation bug: a implicit_def of a physical register
should be applied to uses of the sub-registers.

llvm-svn: 82616
2009-09-23 06:28:31 +00:00
Evan Cheng b2abe07457 Fix a obvious logic error.
llvm-svn: 82610
2009-09-23 05:23:19 +00:00
Gabor Greif 98dd936bc9 pretty mechanical changes to match coding guidelines (blessed by sabre on IRC)
llvm-svn: 82603
2009-09-23 02:46:12 +00:00
Chris Lattner 8bcc6445c7 errorstr can be null, don't unconditionally set it. Only report that
"the jit has not been linked in" if the interpreter failed.

This fixes a unit test failure.

llvm-svn: 82601
2009-09-23 02:03:49 +00:00
Chris Lattner 41fa2bd112 Make EngineBuilder return more error codes, by KS Sreeram.
llvm-svn: 82600
2009-09-23 01:46:04 +00:00
Dan Gohman c0353bfff5 Give MachineMemOperand an operator<<, factoring out code from
two different places for printing MachineMemOperands.

Drop the virtual from Value::dump and instead give Value a
protected virtual hook that can be overridden by subclasses
to implement custom printing. This lets printing be more
consistent, and simplifies printing of PseudoSourceValue
values.

llvm-svn: 82599
2009-09-23 01:33:16 +00:00
Dan Gohman 1439957928 Fix X86's unfoldMemoryOperand to properly handle MachineMemOperands.
llvm-svn: 82597
2009-09-23 01:29:41 +00:00
Mike Stump 8808063181 This is overly constraining with respect to clang.
llvm-svn: 82591
2009-09-23 00:13:30 +00:00
Erick Tryzelaar 21e83eab3f Add examples for Kaleidoscope chapters 2 through 6.
Conflicts:

	examples/Makefile

llvm-svn: 82574
2009-09-22 21:15:19 +00:00
Erick Tryzelaar 2d8813cfb0 Rename Kaleidoscope to show that it's for Chapter 7 of the tutorial.
llvm-svn: 82573
2009-09-22 21:15:00 +00:00
Erick Tryzelaar 6e2b34bc14 Sync c++ kaleidoscope tutorial with test.
llvm-svn: 82572
2009-09-22 21:14:49 +00:00
Devang Patel 320a1c4083 Add SetLocation() to allow IRBuilder user to set location info for an instruction already created.
llvm-svn: 82570
2009-09-22 20:56:31 +00:00
Devang Patel 276b02b325 Check exisiting dbg MDKind first.
llvm-svn: 82568
2009-09-22 20:54:13 +00:00
Victor Hernandez ddc2ce4fe2 No need to verify that malloc's return type is i8*.
llvm-svn: 82561
2009-09-22 18:50:03 +00:00
David Goodwin 74b79566f6 Use early returns.
llvm-svn: 82554
2009-09-22 16:47:52 +00:00
Daniel Dunbar 7e3aa3f68c Revert "Don't allow formatted_ostream to be unbuffered, even if its underlying
buffer", while we work out a solution.

Dan convinced me that making debugging annoying for him is worse than 10x being
slower for me. :)

llvm-svn: 82553
2009-09-22 16:33:42 +00:00
Daniel Dunbar b2942cb5cb ... missed hiding a variable for MSVC only.
llvm-svn: 82552
2009-09-22 16:10:35 +00:00
Daniel Dunbar 1bdedd3876 Hide MSVC specific CRT interaction behind _MSC_VER.
llvm-svn: 82551
2009-09-22 15:58:35 +00:00
Mikhail Glushenkov 88e98fec70 Remove the GetProcessId() call from Win32/Program.inc, take 2.
GetProcessId() was introduced only in Windows XP, and we want to support earlier
versions.

llvm-svn: 82548
2009-09-22 15:40:32 +00:00
Daniel Dunbar 86707c9913 Fix commento.
llvm-svn: 82544
2009-09-22 10:30:34 +00:00
Daniel Dunbar 99e1174baf lit: When executing shell scripts internally, don't allow piped stderr on any
commands except the last one, instead redirect the stderr to a temporary
file. This sidesteps a potential deadlocking issue.

llvm-svn: 82538
2009-09-22 09:50:38 +00:00
Daniel Dunbar 4c7b0ca05b Add a magic LLVM_DISABLE_CRT_DEBUG environment variable which we check in RegisterHandler and use to disable the Win32 crash dialogs. These are a major blocker to any kind of automated testing.
Also, tweak the 'lit' test runner to set this variable unconditionally.

llvm-svn: 82537
2009-09-22 09:50:28 +00:00
Evan Cheng 0570bbbd0f Forgot this.
llvm-svn: 82536
2009-09-22 08:47:59 +00:00
Evan Cheng 08d1e41c10 Fix PR5024. LiveVariables::FindLastPartialDef should return a set of sub-registers that were defined by the last partial def, not just a single sub-register.
llvm-svn: 82535
2009-09-22 08:34:46 +00:00
Daniel Dunbar 28830b39b4 Initial support for running LLVM tests from cmake.
llvm-svn: 82534
2009-09-22 07:38:44 +00:00
Daniel Dunbar 26a6dfe0b6 Generate lit.site.cfg from a .in file, as clang does.
llvm-svn: 82533
2009-09-22 07:38:33 +00:00
Daniel Dunbar 1a0a423b38 Use Compiler.h macro instead of __attribute__.
llvm-svn: 82532
2009-09-22 07:38:23 +00:00
Daniel Dunbar 6ce1ab1c64 CMake: Fix definition of LTDL_SHLIB_EXT for Darwin.
llvm-svn: 82530
2009-09-22 06:09:37 +00:00
Daniel Dunbar a249c42e8c Fix llvm-config --src-root and --obj-root for CMake builds.
llvm-svn: 82529
2009-09-22 06:09:31 +00:00
Daniel Dunbar af890eb82f llvm-config: Remove unused variables.
llvm-svn: 82528
2009-09-22 06:09:22 +00:00
Daniel Dunbar b8895c078f Actually use the arguments with the resolved executable path.
llvm-svn: 82527
2009-09-22 06:09:13 +00:00
Daniel Dunbar 7b446a001d Revert "Get rid of GetProcessId in Win32/Program.inc.", this breaks
ExecuteAndWait.

llvm-svn: 82522
2009-09-22 04:44:56 +00:00
Daniel Dunbar 24a0813fc4 lit: Don't use close_fds=True on Windows.
llvm-svn: 82521
2009-09-22 04:44:37 +00:00
Daniel Dunbar 753f8be411 lit: When executing commands internally, perform PATH resolution ourselves.
llvm-svn: 82520
2009-09-22 04:44:26 +00:00
Daniel Dunbar 78faee0664 Switch FoldingSet::AddString to StringRef based API.
- This also fixes a dereference of std::string::end, which makes MSVC unhappy and was causing all the static analyzer clang tests to fail.

llvm-svn: 82517
2009-09-22 03:34:53 +00:00
Daniel Dunbar c827d9ee0e Workaround what I believe is an MSVC bug where it emits a definition for a
static const class member into each translation unit, with external linkage???
 - If someone understands this issue better, please clue me in, I haven't
   consulted the standard yet.

llvm-svn: 82516
2009-09-22 03:34:40 +00:00
Daniel Dunbar 0356483539 Switch DIDescriptor to use a TrackingVH. - This makes it much safer to work with debug info, since it was extraordinarily easy to have dangling pointers thanks to MDNode uniquing.
llvm-svn: 82507
2009-09-22 02:03:18 +00:00
Daniel Dunbar 70d4fb0d97 Add a TrackingVH value handle.
This is designed for tracking a value even when it might move (like WeakVH), but it is an error to delete the referenced value (unlike WeakVH0. TrackingVH is templated like AssertingVH on the tracked Value subclass, it is an error to RAUW a tracked value to an incompatible type.

For implementation reasons the latter error is only diagnosed on accesses to a mis-RAUWed TrackingVH, because we don't want a virtual interface in a templated class.

The former error is also only diagnosed on access, so that clients are allowed to delete a tracked value, as long as they don't use it. This makes it easier for the client to reason about destruction.

llvm-svn: 82506
2009-09-22 02:02:33 +00:00
Evan Cheng 0dfed43a5b Fix a pasto. Also simplify for Bill's benefit.
llvm-svn: 82505
2009-09-22 01:48:19 +00:00
Evan Cheng 8c500100f6 Minor bug fix. LowerSubregs should translate
%S0<def> = EXTRACT_SUBREG %Q0<kill>, 1
to
%S0<def> = IMPLICIT_DEF %Q0<imp-use,kill>

Implicit_def does not *read* any register so the operand should be marked "implicit". The missing "implicit" marker on the operand is wrong, but it doesn't actually break anything.

llvm-svn: 82503
2009-09-22 00:29:40 +00:00
Chris Lattner cf295039e4 Fix PR5023: The instruction form of DominatorTree::dominates did not
take into consideration that the result of an invoke is only valid in
the normal dest, not the unwind dest.  This caused 'PHINode::hasConstantValue'
to return true in an invalid situation, causing mem2reg to delete a phi that
was actually needed.  This caused a crash building 483.xalancbmk.

llvm-svn: 82491
2009-09-21 22:39:35 +00:00
Chris Lattner 22151ce5e9 move DominatorTree::dominates for instructions out of line,
no functionality change.

llvm-svn: 82490
2009-09-21 22:30:50 +00:00
Chris Lattner 7d08da6b2a tidy up
llvm-svn: 82489
2009-09-21 22:27:34 +00:00
Chris Lattner e3ce1e2a37 tidy up
llvm-svn: 82488
2009-09-21 22:26:02 +00:00
Evan Cheng 255f416470 Clean up spill weight computation. Also some changes to give loop induction
variable increment / decrement slighter high priority. 

This has major impact on some micro-benchmarks. On MultiSource/Applications
and spec tests, it's a minor win. It also reduce 256.bzip instruction count
by 8%, 55 on 164.gzip on i386 / Darwin.

llvm-svn: 82485
2009-09-21 21:12:25 +00:00
David Goodwin 5090273367 Add Cortex-A8 VFP model.
llvm-svn: 82483
2009-09-21 20:52:17 +00:00
Dan Gohman e7c8242baa Change MachineMemOperand's alignment value to be the alignment of
the base pointer, without the offset. This matches MemSDNode's
new alignment behavior, and holds more interesting information.

llvm-svn: 82473
2009-09-21 19:47:04 +00:00
Dan Gohman cf13782fab Add a comment mentioning the rdar number associated with this test.
llvm-svn: 82471
2009-09-21 18:32:20 +00:00
Dan Gohman 69499b13fd Add support for rematerializing FsFLD0SS and FsFLD0SD as constant-pool
loads in order to reduce register pressure.

llvm-svn: 82470
2009-09-21 18:30:38 +00:00
Dan Gohman 48ade83e60 Recognize SSE min and max opportunities in even more cases.
And fix a bug with the behavior of min/max instructions formed from
fcmp uge comparisons.

Also, use FiniteOnlyFPMath() for this code instead of UnsafeFPMath,
as it is more specific.

llvm-svn: 82466
2009-09-21 18:03:22 +00:00
Dan Gohman 757acfea63 Fix the offset values for these memoperands. For frame objects, the
PseudoSourceValue already effectively represents the offset from the
frame base, so the actual offset should not be added to it.

llvm-svn: 82465
2009-09-21 17:58:09 +00:00
Chris Lattner 247053867e big endian systems shift by bits too, hopefully this will fix the ppc
bootstrap problems.

llvm-svn: 82464
2009-09-21 17:55:47 +00:00
Dan Gohman 43d6830ea0 Nick pointed out that DominanceFrontier and DominanceTree are preserved
by setPreservesCFG().

llvm-svn: 82463
2009-09-21 17:54:42 +00:00
Dan Gohman af57ae3da4 Remove the special-case for constants in PHI nodes; it's not really
helpful, and it didn't correctly handle the case of constants input
to PHIs for backedges.

llvm-svn: 82462
2009-09-21 17:53:35 +00:00
Chris Lattner 9045f235d2 fix PR5016, a crash I introduced in GVN handing first class
arrays and structs, which cannot be bitcast to integers.

llvm-svn: 82460
2009-09-21 17:24:04 +00:00
Mikhail Glushenkov fdd0a2fb40 Use raw_ostream::indent instead of passing strings.
llvm-svn: 82456
2009-09-21 15:53:44 +00:00
Dan Gohman a3c45bda22 Fix this assertion string to mention subreg_to_reg.
llvm-svn: 82455
2009-09-21 15:18:33 +00:00
Nuno Lopes 2c7e72cf42 initialize SymbolsCanStartWithDigit to false by default
llvm-svn: 82454
2009-09-21 14:11:56 +00:00
Xerxes Ranby da99be6fae Update cmake.
llvm-svn: 82449
2009-09-21 08:08:29 +00:00
Jakob Stoklund Olesen f6eb7d83d1 Verify that phi instructions refer to MBBs in the CFG.
The machine code verifier no longer tolerates phi instructions with noop
operands. All MBBs on a phi instruction must be in the CFG.

llvm-svn: 82448
2009-09-21 07:19:08 +00:00
Chris Lattner 4d8af2f1ae enable non-local analysis and PRE of large store -> little load.
This doesn't kick in too much because of phi translation issues,
but this can be resolved in the future.

llvm-svn: 82447
2009-09-21 06:48:08 +00:00
Chris Lattner 0cdc17eb50 convert an std::pair to an explicit struct.
llvm-svn: 82446
2009-09-21 06:30:24 +00:00
Chris Lattner d28f90897a move some functions, add a comment.
llvm-svn: 82444
2009-09-21 06:24:16 +00:00
Chris Lattner 9d7fb29522 split HandleLoadFromClobberingStore in two pieces: one that does the
analysis, one that does the xform.

llvm-svn: 82443
2009-09-21 06:22:46 +00:00
Chris Lattner 61858787b1 add a note
llvm-svn: 82442
2009-09-21 06:04:07 +00:00
Daniel Dunbar bc528b16c2 Register the MachineModuleInfo for the ARM JIT, and update JITDwarfEmitter to
assert if the setModuleInfo hasn't been called.

llvm-svn: 82441
2009-09-21 05:58:35 +00:00
Chris Lattner e2b8a80487 add pr#
llvm-svn: 82440
2009-09-21 05:57:47 +00:00
Chris Lattner 0a9616d906 Improve GVN to be able to forward substitute a small load
from a piece of a large store when both are in the same block.

This allows clang to compile the testcase in PR4216 to this code:

_test_bitfield:
	movl	4(%esp), %eax
	movl	%eax, %ecx
	andl	$-65536, %ecx
	orl	$32962, %eax
	andl	$40186, %eax
	orl	%ecx, %eax
	ret

This is not ideal, but is a whole lot better than the code produced
by llvm-gcc:

_test_bitfield:
	movw	$-32574, %ax
	orw	4(%esp), %ax
	andw	$-25350, %ax
	movw	%ax, 4(%esp)
	movw	7(%esp), %cx
	shlw	$8, %cx
	movzbl	6(%esp), %edx
	orw	%cx, %dx
	movzwl	%dx, %ecx
	shll	$16, %ecx
	movzwl	%ax, %eax
	orl	%ecx, %eax
	ret

and dramatically better than that produced by gcc 4.2:

_test_bitfield:
	pushl	%ebx
	call	L3
"L00000000001$pb":
L3:
	popl	%ebx
	movl	8(%esp), %eax
	leal	0(,%eax,4), %edx
	sarb	$7, %dl
	movl	%eax, %ecx
	andl	$7168, %ecx
	andl	$-7201, %ebx
	movzbl	%dl, %edx
	andl	$1, %edx
	sall	$5, %edx
	orl	%ecx, %ebx
	orl	%edx, %ebx
	andl	$24, %eax
	andl	$-58336, %ebx
	orl	%eax, %ebx
	orl	$32962, %ebx
	movl	%ebx, %eax
	popl	%ebx
	ret

llvm-svn: 82439
2009-09-21 05:57:11 +00:00
Chris Lattner 450fd6ffbb add a helper method.
llvm-svn: 82438
2009-09-21 05:52:45 +00:00
Evan Cheng fccbd0afc6 Fix PR4986. "r1024 = insert_subreg r1024, undef, 2" cannot be turned in an implicit_def. Instead, it's an identity copy so it should be eliminated. Also make sure to update livevariable kill information.
llvm-svn: 82436
2009-09-21 04:32:32 +00:00
Daniel Dunbar 7814fa1d5d Don't allow formatted_ostream to be unbuffered, even if its underlying buffer
is.
 - The problem is that formatted_ostream forces its underlying buffer to be
   unbuffered, so if some client happens to wrap a formatted_ostream around
   something, but still use the underlying stream, then we can end up writing on
   a fully unbuffered output (which was never intended to be unbuffered).

 - This makes clang (and presumably llvm-gcc) -emit-llvm -S a mere 10x faster.

llvm-svn: 82434
2009-09-21 03:56:00 +00:00
Chris Lattner 9858859fd6 one case handled, expanded another testcase inline.
llvm-svn: 82427
2009-09-21 02:53:57 +00:00
Chris Lattner 1eefa9c427 formatting cleanups, no functionality change.
llvm-svn: 82426
2009-09-21 02:42:51 +00:00
Reid Kleckner 7dfb37e58a Add documentation on how to use enable debug information in the JIT and use it with GDB.
llvm-svn: 82425
2009-09-21 02:34:59 +00:00
Chris Lattner b9f2bf46f7 fix a FileCheck bug where:
; CHECK: foo
; CHECK-NOT: foo
; CHECK: bar

would always fail.

llvm-svn: 82424
2009-09-21 02:30:42 +00:00
Daniel Dunbar c05f9a60d9 Move ARM and X86 specific AsmParser tests into separate subdirectories, and only
run if appropriate target is supported.

llvm-svn: 82419
2009-09-21 00:05:30 +00:00
Reid Kleckner 9a10db8c46 Implement the JIT side of the GDB JIT debugging interface. To enable this
feature, either build the JIT in debug mode to enable it by default or pass
-jit-emit-debug to lli.

Right now, the only debug information that this communicates to GDB is call
frame information, since it's already being generated to support exceptions in
the JIT.  Eventually, when DWARF generation isn't tied so tightly to AsmPrinter,
it will be easy to push that information to GDB through this interface.

Here's a step-by-step breakdown of how the feature works:

- The JIT generates the machine code and DWARF call frame info
  (.eh_frame/.debug_frame) for a function into memory.
- The JIT copies that info into an in-memory ELF file with a symbol for the
  function.
- The JIT creates a code entry pointing to the ELF buffer and adds it to a
  linked list hanging off of a global descriptor at a special symbol that GDB
  knows about.
- The JIT calls a function marked noinline that GDB knows about and has put an
  internal breakpoint in.
- GDB catches the breakpoint and reads the global descriptor to look for new
  code.
- When sees there is new code, it reads the ELF from the inferior's memory and
  adds it to itself as an object file.
- The JIT continues, and the next time we stop the program, we are able to
  produce a proper backtrace.

Consider running the following program through the JIT:

#include <stdio.h>
void baz(short z) {
  long w = z + 1;
  printf("%d, %x\n", w, *((int*)NULL));  // SEGFAULT here
}
void bar(short y) {
  int z = y + 1;
  baz(z);
}
void foo(char x) {
  short y = x + 1;
  bar(y);
}
int main(int argc, char** argv) {
  char x = 1;
  foo(x);
}

Here is a backtrace before this patch:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x2aaaabdfbd10 (LWP 25476)]
0x00002aaaabe7d1a8 in ?? ()
(gdb) bt
#0  0x00002aaaabe7d1a8 in ?? ()
#1  0x0000000000000003 in ?? ()
#2  0x0000000000000004 in ?? ()
#3  0x00032aaaabe7cfd0 in ?? ()
#4  0x00002aaaabe7d12c in ?? ()
#5  0x00022aaa00000003 in ?? ()
#6  0x00002aaaabe7d0aa in ?? ()
#7  0x01000002abe7cff0 in ?? ()
#8  0x00002aaaabe7d02c in ?? ()
#9  0x0100000000000001 in ?? ()
#10 0x00000000014388e0 in ?? ()
#11 0x00007fff00000001 in ?? ()
#12 0x0000000000b870a2 in llvm::JIT::runFunction (this=0x1405b70,
F=0x14024e0, ArgValues=@0x7fffffffe050)
   at /home/rnk/llvm-gdb/lib/ExecutionEngine/JIT/JIT.cpp:395
#13 0x0000000000baa4c5 in llvm::ExecutionEngine::runFunctionAsMain
(this=0x1405b70, Fn=0x14024e0, argv=@0x13f06f8, envp=0x7fffffffe3b0)
   at /home/rnk/llvm-gdb/lib/ExecutionEngine/ExecutionEngine.cpp:377
#14 0x00000000007ebd52 in main (argc=2, argv=0x7fffffffe398,
envp=0x7fffffffe3b0) at /home/rnk/llvm-gdb/tools/lli/lli.cpp:208

And a backtrace after this patch:
Program received signal SIGSEGV, Segmentation fault.
0x00002aaaabe7d1a8 in baz ()
(gdb) bt
#0  0x00002aaaabe7d1a8 in baz ()
#1  0x00002aaaabe7d12c in bar ()
#2  0x00002aaaabe7d0aa in foo ()
#3  0x00002aaaabe7d02c in main ()
#4  0x0000000000b870a2 in llvm::JIT::runFunction (this=0x1405b70,
F=0x14024e0, ArgValues=...)
   at /home/rnk/llvm-gdb/lib/ExecutionEngine/JIT/JIT.cpp:395
#5  0x0000000000baa4c5 in llvm::ExecutionEngine::runFunctionAsMain
(this=0x1405b70, Fn=0x14024e0, argv=..., envp=0x7fffffffe3c0)
   at /home/rnk/llvm-gdb/lib/ExecutionEngine/ExecutionEngine.cpp:377
#6  0x00000000007ebd52 in main (argc=2, argv=0x7fffffffe3a8,
envp=0x7fffffffe3c0) at /home/rnk/llvm-gdb/tools/lli/lli.cpp:208

llvm-svn: 82418
2009-09-20 23:52:43 +00:00
Daniel Dunbar ffb60d566f Work around a FileCheck bug, for now.
llvm-svn: 82416
2009-09-20 23:30:31 +00:00
Chris Lattner 5a3a854205 simplify as daniel suggests
llvm-svn: 82415
2009-09-20 22:56:43 +00:00
Chris Lattner 50f387c5f0 write rfind in terms of npos as daniel requested
llvm-svn: 82414
2009-09-20 22:54:26 +00:00
Chris Lattner 3b0dbeb96d remove a dead method.
llvm-svn: 82413
2009-09-20 22:46:42 +00:00
Chris Lattner 05593db193 grammaro
llvm-svn: 82412
2009-09-20 22:45:18 +00:00
Chris Lattner 7e6d56ebc5 Revert r82404, it is causing a bootstrap miscompile. This is very very
scary, as it indicates a lurking bug. yay.

llvm-svn: 82411
2009-09-20 22:44:26 +00:00