oota-llvm.git
14 years agoSync c++ kaleidoscope tutorial with test.
Erick Tryzelaar [Tue, 22 Sep 2009 21:14:49 +0000 (21:14 +0000)]
Sync c++ kaleidoscope tutorial with test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82572 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd SetLocation() to allow IRBuilder user to set location info for an instruction...
Devang Patel [Tue, 22 Sep 2009 20:56:31 +0000 (20:56 +0000)]
Add SetLocation() to allow IRBuilder user to set location info for an instruction already created.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82570 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoCheck exisiting dbg MDKind first.
Devang Patel [Tue, 22 Sep 2009 20:54:13 +0000 (20:54 +0000)]
Check exisiting dbg MDKind first.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82568 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoNo need to verify that malloc's return type is i8*.
Victor Hernandez [Tue, 22 Sep 2009 18:50:03 +0000 (18:50 +0000)]
No need to verify that malloc's return type is i8*.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82561 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoUse early returns.
David Goodwin [Tue, 22 Sep 2009 16:47:52 +0000 (16:47 +0000)]
Use early returns.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82554 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRevert "Don't allow formatted_ostream to be unbuffered, even if its underlying
Daniel Dunbar [Tue, 22 Sep 2009 16:33:42 +0000 (16:33 +0000)]
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. :)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82553 91177308-0d34-0410-b5e6-96231b3b80d8

14 years ago... missed hiding a variable for MSVC only.
Daniel Dunbar [Tue, 22 Sep 2009 16:10:35 +0000 (16:10 +0000)]
... missed hiding a variable for MSVC only.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82552 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoHide MSVC specific CRT interaction behind _MSC_VER.
Daniel Dunbar [Tue, 22 Sep 2009 15:58:35 +0000 (15:58 +0000)]
Hide MSVC specific CRT interaction behind _MSC_VER.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82551 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRemove the GetProcessId() call from Win32/Program.inc, take 2.
Mikhail Glushenkov [Tue, 22 Sep 2009 15:40:32 +0000 (15:40 +0000)]
Remove the GetProcessId() call from Win32/Program.inc, take 2.

GetProcessId() was introduced only in Windows XP, and we want to support earlier
versions.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82548 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFix commento.
Daniel Dunbar [Tue, 22 Sep 2009 10:30:34 +0000 (10:30 +0000)]
Fix commento.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82544 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agolit: When executing shell scripts internally, don't allow piped stderr on any
Daniel Dunbar [Tue, 22 Sep 2009 09:50:38 +0000 (09:50 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82538 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd a magic LLVM_DISABLE_CRT_DEBUG environment variable which we check in RegisterHan...
Daniel Dunbar [Tue, 22 Sep 2009 09:50:28 +0000 (09:50 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82537 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoForgot this.
Evan Cheng [Tue, 22 Sep 2009 08:47:59 +0000 (08:47 +0000)]
Forgot this.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82536 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFix PR5024. LiveVariables::FindLastPartialDef should return a set of sub-registers...
Evan Cheng [Tue, 22 Sep 2009 08:34:46 +0000 (08:34 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82535 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoInitial support for running LLVM tests from cmake.
Daniel Dunbar [Tue, 22 Sep 2009 07:38:44 +0000 (07:38 +0000)]
Initial support for running LLVM tests from cmake.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82534 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoGenerate lit.site.cfg from a .in file, as clang does.
Daniel Dunbar [Tue, 22 Sep 2009 07:38:33 +0000 (07:38 +0000)]
Generate lit.site.cfg from a .in file, as clang does.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82533 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoUse Compiler.h macro instead of __attribute__.
Daniel Dunbar [Tue, 22 Sep 2009 07:38:23 +0000 (07:38 +0000)]
Use Compiler.h macro instead of __attribute__.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82532 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoCMake: Fix definition of LTDL_SHLIB_EXT for Darwin.
Daniel Dunbar [Tue, 22 Sep 2009 06:09:37 +0000 (06:09 +0000)]
CMake: Fix definition of LTDL_SHLIB_EXT for Darwin.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82530 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFix llvm-config --src-root and --obj-root for CMake builds.
Daniel Dunbar [Tue, 22 Sep 2009 06:09:31 +0000 (06:09 +0000)]
Fix llvm-config --src-root and --obj-root for CMake builds.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82529 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agollvm-config: Remove unused variables.
Daniel Dunbar [Tue, 22 Sep 2009 06:09:22 +0000 (06:09 +0000)]
llvm-config: Remove unused variables.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82528 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoActually use the arguments with the resolved executable path.
Daniel Dunbar [Tue, 22 Sep 2009 06:09:13 +0000 (06:09 +0000)]
Actually use the arguments with the resolved executable path.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82527 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRevert "Get rid of GetProcessId in Win32/Program.inc.", this breaks
Daniel Dunbar [Tue, 22 Sep 2009 04:44:56 +0000 (04:44 +0000)]
Revert "Get rid of GetProcessId in Win32/Program.inc.", this breaks
ExecuteAndWait.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82522 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agolit: Don't use close_fds=True on Windows.
Daniel Dunbar [Tue, 22 Sep 2009 04:44:37 +0000 (04:44 +0000)]
lit: Don't use close_fds=True on Windows.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82521 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agolit: When executing commands internally, perform PATH resolution ourselves.
Daniel Dunbar [Tue, 22 Sep 2009 04:44:26 +0000 (04:44 +0000)]
lit: When executing commands internally, perform PATH resolution ourselves.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82520 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoSwitch FoldingSet::AddString to StringRef based API.
Daniel Dunbar [Tue, 22 Sep 2009 03:34:53 +0000 (03:34 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82517 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoWorkaround what I believe is an MSVC bug where it emits a definition for a
Daniel Dunbar [Tue, 22 Sep 2009 03:34:40 +0000 (03:34 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82516 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoSwitch DIDescriptor to use a TrackingVH. - This makes it much safer to work with...
Daniel Dunbar [Tue, 22 Sep 2009 02:03:18 +0000 (02:03 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82507 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd a TrackingVH value handle.
Daniel Dunbar [Tue, 22 Sep 2009 02:02:33 +0000 (02:02 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82506 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFix a pasto. Also simplify for Bill's benefit.
Evan Cheng [Tue, 22 Sep 2009 01:48:19 +0000 (01:48 +0000)]
Fix a pasto. Also simplify for Bill's benefit.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82505 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMinor bug fix. LowerSubregs should translate
Evan Cheng [Tue, 22 Sep 2009 00:29:40 +0000 (00:29 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82503 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFix PR5023: The instruction form of DominatorTree::dominates did not
Chris Lattner [Mon, 21 Sep 2009 22:39:35 +0000 (22:39 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82491 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agomove DominatorTree::dominates for instructions out of line,
Chris Lattner [Mon, 21 Sep 2009 22:30:50 +0000 (22:30 +0000)]
move DominatorTree::dominates for instructions out of line,
no functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82490 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agotidy up
Chris Lattner [Mon, 21 Sep 2009 22:27:34 +0000 (22:27 +0000)]
tidy up

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82489 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agotidy up
Chris Lattner [Mon, 21 Sep 2009 22:26:02 +0000 (22:26 +0000)]
tidy up

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82488 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoClean up spill weight computation. Also some changes to give loop induction
Evan Cheng [Mon, 21 Sep 2009 21:12:25 +0000 (21:12 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82485 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd Cortex-A8 VFP model.
David Goodwin [Mon, 21 Sep 2009 20:52:17 +0000 (20:52 +0000)]
Add Cortex-A8 VFP model.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82483 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoChange MachineMemOperand's alignment value to be the alignment of
Dan Gohman [Mon, 21 Sep 2009 19:47:04 +0000 (19:47 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82473 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd a comment mentioning the rdar number associated with this test.
Dan Gohman [Mon, 21 Sep 2009 18:32:20 +0000 (18:32 +0000)]
Add a comment mentioning the rdar number associated with this test.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82471 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd support for rematerializing FsFLD0SS and FsFLD0SD as constant-pool
Dan Gohman [Mon, 21 Sep 2009 18:30:38 +0000 (18:30 +0000)]
Add support for rematerializing FsFLD0SS and FsFLD0SD as constant-pool
loads in order to reduce register pressure.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82470 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRecognize SSE min and max opportunities in even more cases.
Dan Gohman [Mon, 21 Sep 2009 18:03:22 +0000 (18:03 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82466 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFix the offset values for these memoperands. For frame objects, the
Dan Gohman [Mon, 21 Sep 2009 17:58:09 +0000 (17:58 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82465 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agobig endian systems shift by bits too, hopefully this will fix the ppc
Chris Lattner [Mon, 21 Sep 2009 17:55:47 +0000 (17:55 +0000)]
big endian systems shift by bits too, hopefully this will fix the ppc
bootstrap problems.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82464 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoNick pointed out that DominanceFrontier and DominanceTree are preserved
Dan Gohman [Mon, 21 Sep 2009 17:54:42 +0000 (17:54 +0000)]
Nick pointed out that DominanceFrontier and DominanceTree are preserved
by setPreservesCFG().

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82463 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRemove the special-case for constants in PHI nodes; it's not really
Dan Gohman [Mon, 21 Sep 2009 17:53:35 +0000 (17:53 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82462 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agofix PR5016, a crash I introduced in GVN handing first class
Chris Lattner [Mon, 21 Sep 2009 17:24:04 +0000 (17:24 +0000)]
fix PR5016, a crash I introduced in GVN handing first class
arrays and structs, which cannot be bitcast to integers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82460 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoUse raw_ostream::indent instead of passing strings.
Mikhail Glushenkov [Mon, 21 Sep 2009 15:53:44 +0000 (15:53 +0000)]
Use raw_ostream::indent instead of passing strings.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82456 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFix this assertion string to mention subreg_to_reg.
Dan Gohman [Mon, 21 Sep 2009 15:18:33 +0000 (15:18 +0000)]
Fix this assertion string to mention subreg_to_reg.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82455 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoinitialize SymbolsCanStartWithDigit to false by default
Nuno Lopes [Mon, 21 Sep 2009 14:11:56 +0000 (14:11 +0000)]
initialize SymbolsCanStartWithDigit to false by default

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82454 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoUpdate cmake.
Xerxes Ranby [Mon, 21 Sep 2009 08:08:29 +0000 (08:08 +0000)]
Update cmake.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82449 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoVerify that phi instructions refer to MBBs in the CFG.
Jakob Stoklund Olesen [Mon, 21 Sep 2009 07:19:08 +0000 (07:19 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82448 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoenable non-local analysis and PRE of large store -> little load.
Chris Lattner [Mon, 21 Sep 2009 06:48:08 +0000 (06:48 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82447 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoconvert an std::pair to an explicit struct.
Chris Lattner [Mon, 21 Sep 2009 06:30:24 +0000 (06:30 +0000)]
convert an std::pair to an explicit struct.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82446 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agomove some functions, add a comment.
Chris Lattner [Mon, 21 Sep 2009 06:24:16 +0000 (06:24 +0000)]
move some functions, add a comment.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82444 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agosplit HandleLoadFromClobberingStore in two pieces: one that does the
Chris Lattner [Mon, 21 Sep 2009 06:22:46 +0000 (06:22 +0000)]
split HandleLoadFromClobberingStore in two pieces: one that does the
analysis, one that does the xform.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82443 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoadd a note
Chris Lattner [Mon, 21 Sep 2009 06:04:07 +0000 (06:04 +0000)]
add a note

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82442 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRegister the MachineModuleInfo for the ARM JIT, and update JITDwarfEmitter to
Daniel Dunbar [Mon, 21 Sep 2009 05:58:35 +0000 (05:58 +0000)]
Register the MachineModuleInfo for the ARM JIT, and update JITDwarfEmitter to
assert if the setModuleInfo hasn't been called.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82441 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoadd pr#
Chris Lattner [Mon, 21 Sep 2009 05:57:47 +0000 (05:57 +0000)]
add pr#

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82440 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoImprove GVN to be able to forward substitute a small load
Chris Lattner [Mon, 21 Sep 2009 05:57:11 +0000 (05:57 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82439 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoadd a helper method.
Chris Lattner [Mon, 21 Sep 2009 05:52:45 +0000 (05:52 +0000)]
add a helper method.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82438 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFix PR4986. "r1024 = insert_subreg r1024, undef, 2" cannot be turned in an implicit_d...
Evan Cheng [Mon, 21 Sep 2009 04:32:32 +0000 (04:32 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82436 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoDon't allow formatted_ostream to be unbuffered, even if its underlying buffer
Daniel Dunbar [Mon, 21 Sep 2009 03:56:00 +0000 (03:56 +0000)]
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82434 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoone case handled, expanded another testcase inline.
Chris Lattner [Mon, 21 Sep 2009 02:53:57 +0000 (02:53 +0000)]
one case handled, expanded another testcase inline.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82427 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoformatting cleanups, no functionality change.
Chris Lattner [Mon, 21 Sep 2009 02:42:51 +0000 (02:42 +0000)]
formatting cleanups, no functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82426 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd documentation on how to use enable debug information in the JIT and use it with...
Reid Kleckner [Mon, 21 Sep 2009 02:34:59 +0000 (02:34 +0000)]
Add documentation on how to use enable debug information in the JIT and use it with GDB.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82425 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agofix a FileCheck bug where:
Chris Lattner [Mon, 21 Sep 2009 02:30:42 +0000 (02:30 +0000)]
fix a FileCheck bug where:

; CHECK: foo
; CHECK-NOT: foo
; CHECK: bar

would always fail.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82424 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMove ARM and X86 specific AsmParser tests into separate subdirectories, and only
Daniel Dunbar [Mon, 21 Sep 2009 00:05:30 +0000 (00:05 +0000)]
Move ARM and X86 specific AsmParser tests into separate subdirectories, and only
run if appropriate target is supported.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82419 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoImplement the JIT side of the GDB JIT debugging interface. To enable this
Reid Kleckner [Sun, 20 Sep 2009 23:52:43 +0000 (23:52 +0000)]
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82418 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoWork around a FileCheck bug, for now.
Daniel Dunbar [Sun, 20 Sep 2009 23:30:31 +0000 (23:30 +0000)]
Work around a FileCheck bug, for now.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82416 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agosimplify as daniel suggests
Chris Lattner [Sun, 20 Sep 2009 22:56:43 +0000 (22:56 +0000)]
simplify as daniel suggests

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82415 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agowrite rfind in terms of npos as daniel requested
Chris Lattner [Sun, 20 Sep 2009 22:54:26 +0000 (22:54 +0000)]
write rfind in terms of npos as daniel requested

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82414 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoremove a dead method.
Chris Lattner [Sun, 20 Sep 2009 22:46:42 +0000 (22:46 +0000)]
remove a dead method.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82413 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agogrammaro
Chris Lattner [Sun, 20 Sep 2009 22:45:18 +0000 (22:45 +0000)]
grammaro

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82412 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRevert r82404, it is causing a bootstrap miscompile. This is very very
Chris Lattner [Sun, 20 Sep 2009 22:44:26 +0000 (22:44 +0000)]
Revert r82404, it is causing a bootstrap miscompile.  This is very very
scary, as it indicates a lurking bug. yay.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82411 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agorewrite CountNumNewlinesBetween to be in terms of StringRef.
Chris Lattner [Sun, 20 Sep 2009 22:42:44 +0000 (22:42 +0000)]
rewrite CountNumNewlinesBetween to be in terms of StringRef.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82410 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agothis was not supposed to be committed
Chris Lattner [Sun, 20 Sep 2009 22:36:11 +0000 (22:36 +0000)]
this was not supposed to be committed

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82409 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoimplement and document support for CHECK-NOT
Chris Lattner [Sun, 20 Sep 2009 22:35:26 +0000 (22:35 +0000)]
implement and document support for CHECK-NOT

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82408 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agorewrite FileCheck in terms of StringRef instead of manual pointer pairs.
Chris Lattner [Sun, 20 Sep 2009 22:11:44 +0000 (22:11 +0000)]
rewrite FileCheck in terms of StringRef instead of manual pointer pairs.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82407 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoimprove memdep to eliminate bitcasts (and aliases, and noop geps)
Chris Lattner [Sun, 20 Sep 2009 21:00:18 +0000 (21:00 +0000)]
improve memdep to eliminate bitcasts (and aliases, and noop geps)
early for the stated reasons: this allows it to find more
equivalences and depend less on code layout.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82404 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoMove CoerceAvailableValueToLoadType earlier in GVN.cpp. Hook it up
Chris Lattner [Sun, 20 Sep 2009 20:09:34 +0000 (20:09 +0000)]
Move CoerceAvailableValueToLoadType earlier in GVN.cpp.  Hook it up
so that nonlocal and partially redundant loads can use it as well.
The testcase shows examples of craziness this can handle.  This triggers
*many* times in 176.gcc.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82403 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agochange the interface to CoerceAvailableValueToLoadType to be
Chris Lattner [Sun, 20 Sep 2009 19:31:14 +0000 (19:31 +0000)]
change the interface to CoerceAvailableValueToLoadType to be
more generic.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82402 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoTeach 'make check-all' to build the site configuration for clang, if it is in tree.
Daniel Dunbar [Sun, 20 Sep 2009 19:04:28 +0000 (19:04 +0000)]
Teach 'make check-all' to build the site configuration for clang, if it is in tree.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82400 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoenhance GVN to forward substitute a stored value to a load
Chris Lattner [Sun, 20 Sep 2009 19:03:47 +0000 (19:03 +0000)]
enhance GVN to forward substitute a stored value to a load
(and load -> load) when the base pointers must alias but when
they are different types.  This occurs very very frequently in
176.gcc and other code that uses bitfields a lot.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82399 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoupdate an entry, delete an entry which has been fixed.
Chris Lattner [Sun, 20 Sep 2009 17:37:38 +0000 (17:37 +0000)]
update an entry, delete an entry which has been fixed.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82398 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agotidy up
Chris Lattner [Sun, 20 Sep 2009 17:32:21 +0000 (17:32 +0000)]
tidy up

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82397 91177308-0d34-0410-b5e6-96231b3b80d8

14 years ago--- Reverse-merging r82282 into '.':
Bill Wendling [Sun, 20 Sep 2009 09:13:15 +0000 (09:13 +0000)]
--- Reverse-merging r82282 into '.':
U    lib/CodeGen/AsmPrinter/DwarfException.cpp
U    lib/CodeGen/AsmPrinter/DwarfException.h

--- Reverse-merging r82274 into '.':
U    lib/Target/TargetLoweringObjectFile.cpp
G    lib/CodeGen/AsmPrinter/DwarfException.cpp

These revisions were breaking everything.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82396 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoremove a temporary hack.
Chris Lattner [Sun, 20 Sep 2009 07:47:59 +0000 (07:47 +0000)]
remove a temporary hack.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82395 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agorename X86ATTAsmPrinter.cpp -> X86AsmPrinter.cpp likewise the .h file.
Chris Lattner [Sun, 20 Sep 2009 07:41:30 +0000 (07:41 +0000)]
rename X86ATTAsmPrinter.cpp -> X86AsmPrinter.cpp likewise the .h file.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82394 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agomove target registry stuff to X86ATTAsmPrinter.cpp
Chris Lattner [Sun, 20 Sep 2009 07:39:06 +0000 (07:39 +0000)]
move target registry stuff to X86ATTAsmPrinter.cpp

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82393 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agosimplify this now that createX86CodePrinterPass is trivial
Chris Lattner [Sun, 20 Sep 2009 07:37:51 +0000 (07:37 +0000)]
simplify this now that createX86CodePrinterPass is trivial

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82392 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agorename X86ATTAsmPrinter class -> X86AsmPrinter
Chris Lattner [Sun, 20 Sep 2009 07:35:34 +0000 (07:35 +0000)]
rename X86ATTAsmPrinter class -> X86AsmPrinter

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82391 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoremove the asmstring, it is now dead. Improve comment.
Chris Lattner [Sun, 20 Sep 2009 07:32:00 +0000 (07:32 +0000)]
remove the asmstring, it is now dead.  Improve comment.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82390 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoPeer through zext and sext to eliminate them when it is safe to do so.
Nick Lewycky [Sun, 20 Sep 2009 07:31:25 +0000 (07:31 +0000)]
Peer through zext and sext to eliminate them when it is safe to do so.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82389 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agokill off printPICLabel now, it's specialness is handled by
Chris Lattner [Sun, 20 Sep 2009 07:28:26 +0000 (07:28 +0000)]
kill off printPICLabel now, it's specialness is handled by
the MachineInstr ->MCInst lowering process, not in the
asmprinter.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82388 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agodelete X86IntelAsmPrinter! Now -x86-asm-syntax just switches
Chris Lattner [Sun, 20 Sep 2009 07:25:17 +0000 (07:25 +0000)]
delete X86IntelAsmPrinter!  Now -x86-asm-syntax just switches
the instruction syntax, not the entire asmprinter.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82387 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoFold 'icmp eq (icmp), true' into an xor(icmp).
Nick Lewycky [Sun, 20 Sep 2009 07:21:39 +0000 (07:21 +0000)]
Fold 'icmp eq (icmp), true' into an xor(icmp).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82386 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoAdd an intel syntax MCInstPrinter implementation. You can now
Chris Lattner [Sun, 20 Sep 2009 07:17:49 +0000 (07:17 +0000)]
Add an intel syntax MCInstPrinter implementation.  You can now
transcode from AT&T to intel syntax with "llvm-mc foo.s -output-asm-variant=1"

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82385 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agotidy up
Chris Lattner [Sun, 20 Sep 2009 07:16:54 +0000 (07:16 +0000)]
tidy up

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82384 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoRewrite this check so that it checks what it's supposed to and doesn't use
Nick Lewycky [Sun, 20 Sep 2009 07:00:24 +0000 (07:00 +0000)]
Rewrite this check so that it checks what it's supposed to and doesn't use
CHECK-NOT.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82383 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agoeliminate a use of strtoul.
Chris Lattner [Sun, 20 Sep 2009 06:58:54 +0000 (06:58 +0000)]
eliminate a use of strtoul.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82382 91177308-0d34-0410-b5e6-96231b3b80d8

14 years agosplit random COFF asmprinter state out to X86COFFMachineModuleInfo.h.
Chris Lattner [Sun, 20 Sep 2009 06:45:52 +0000 (06:45 +0000)]
split random COFF asmprinter state out to X86COFFMachineModuleInfo.h.
Make dllexport directives come out in determinstic order.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@82381 91177308-0d34-0410-b5e6-96231b3b80d8