1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-22 20:43:44 +02:00
Commit Graph

38018 Commits

Author SHA1 Message Date
Nick Lewycky
b6d184c34a Remove tab.
llvm-svn: 101223
2010-04-14 04:19:05 +00:00
Nick Lewycky
5e0d0d551b While DAE can't modify the function signature of an externally visible function,
it can check whether the visible direct callers are passing in parameters to
dead arguments and replace those with undef.

This reinstates r94322 with bugs fixed.

llvm-svn: 101213
2010-04-14 03:38:11 +00:00
Dan Gohman
1158c51fe0 Generalize this code to handle Instructions in addition to ConstantExprs.
llvm-svn: 101210
2010-04-14 02:33:23 +00:00
Dan Gohman
f3d8d6ef18 Reorder the methods of this class to be a little more organized.
llvm-svn: 101206
2010-04-14 02:09:45 +00:00
Johnny Chen
07ed32d767 Fixed another assert exposed by fuzzing. Now, when an encoding error occurs
involing getBFCInvMask() where lsb <= msb does not hold true, the disassembler
just returns false, instead of assert, to indicate disassembly error.

llvm-svn: 101205
2010-04-14 02:05:29 +00:00
Devang Patel
4cc398507f Clear MachineInstr->MCSymbol maps at the end of a function.
llvm-svn: 101202
2010-04-14 01:18:28 +00:00
Johnny Chen
723cdf093a Fixed an assert() exposed by fuzzing. Now, instead of assert when an invalid
instruction encoding is encountered, we just return a NULL ARMBasicMCBuilder
instance and the client just returns false to indicate disassembly error.

llvm-svn: 101201
2010-04-14 01:17:37 +00:00
Douglas Gregor
a672ffc669 Unbreak CMake build by improving the EnhancedDisassembly makefile a
bit (we're not trying to build a shared library yet) and generating
the X86GenEDInfo.inc and ARMGenEDInfo.inc files as necessary.

llvm-svn: 101188
2010-04-13 22:47:43 +00:00
Evan Cheng
aadcfa8ad7 Fast path implicit_def check.
llvm-svn: 101183
2010-04-13 22:13:34 +00:00
Bob Wilson
526e615ff9 Handle a v2f64 formal parameter that is split between registers and memory
such that the entire second half is in memory.  Radar 7855014.

llvm-svn: 101181
2010-04-13 22:03:22 +00:00
Sean Callanan
29a7152676 Fixed a nasty layering violation in the edis source
code.  It used to #include the enhanced disassembly
information for the targets it supported straight
out of lib/Target/{X86,ARM,...} but now it uses a
new interface provided by MCDisassembler, and (so
far) implemented by X86 and ARM.

Also removed hacky #define-controlled initialization
of targets in edis.  If clients only want edis to
initialize a limited set of targets, they can set
--enable-targets on the configure command line.

llvm-svn: 101179
2010-04-13 21:21:57 +00:00
Johnny Chen
f2d6ab5561 Changed getSOImmValRotate()'s hunt retry logic to ignore the low order 6 bits,
instead of 7, because we are only looking for even rotate amount.

llvm-svn: 101172
2010-04-13 20:35:16 +00:00
Devang Patel
7c2bc9dbfe Do not include types without any definition in pubtypes list.
llvm-svn: 101171
2010-04-13 20:35:04 +00:00
Evan Cheng
6e5407402e Avoid variable shadowing.
llvm-svn: 101170
2010-04-13 20:25:29 +00:00
Evan Cheng
bc94b6f1fd Expand postra machine licm's capability a little more. If an instruction's register operands are all loop invariants, then it's safe to hoist it.
llvm-svn: 101167
2010-04-13 20:21:05 +00:00
Jakob Stoklund Olesen
a75eedea38 Teach MachineSinking to handle easy critical edges.
Sometimes it is desirable to sink instructions along a critical edge:

x = ...
if (a && b) ...
else use(x);

The 'a && b' condition creates a critical edge to the else block, but we still
want to sink the computation of x into the block. The else block is dominated by
the parent block, so we are not pushing instructions into new code paths.

llvm-svn: 101165
2010-04-13 19:06:14 +00:00
Evan Cheng
b8861dcb04 Re-apply 101075 and fix it properly. Just reuse the debug info of the branch instruction being optimized. There is no need to --I which can deref off start of the BB.
llvm-svn: 101162
2010-04-13 18:50:27 +00:00
Eric Christopher
330ca0c937 Temporarily revert r101075, it's causing invalid iterator assertions
in a nightly tester.

llvm-svn: 101158
2010-04-13 18:37:58 +00:00
Evan Cheng
d83c1b5a0e Teach postra machine licm to hoist more obvious invariants, e.g. instructions with no source operands.
llvm-svn: 101154
2010-04-13 18:16:00 +00:00
Dan Gohman
a400b6eca8 Add a few comments.
llvm-svn: 101148
2010-04-13 17:07:06 +00:00
Dan Gohman
2bca857d78 Eliminate MachineBasicBlock::const_livein_iterator and make
MachineBasicBlock::livein_iterator a const_iterator, because
clients shouldn't ever be using the iterator interface to
mutate the livein set.

llvm-svn: 101147
2010-04-13 16:57:55 +00:00
Dan Gohman
80b52785a4 Rename MachineFrameInfo variables to MFI, for consistency with
the rest of CodeGen.

llvm-svn: 101146
2010-04-13 16:56:45 +00:00
Dan Gohman
22f72726f3 Move MachineRegisterInfo's isLiveIn and isLiveOut out of line.
llvm-svn: 101145
2010-04-13 16:55:37 +00:00
Dan Gohman
8cb32df13d Use MachineBasicBlock::isLiveIn.
llvm-svn: 101144
2010-04-13 16:53:51 +00:00
Dan Gohman
9652ec03e5 Delete an unused member variable.
llvm-svn: 101143
2010-04-13 16:51:39 +00:00
Dan Gohman
1521831bff Teach ScalarEvolution to simplify smax and umax when it can prove
that one operand is always greater than another.

llvm-svn: 101142
2010-04-13 16:51:03 +00:00
Dan Gohman
298e7410d6 Minor code micro-optimizations.
llvm-svn: 101141
2010-04-13 16:49:23 +00:00
Eric Christopher
32088895fb Actually... return after the check for invalid input.
llvm-svn: 101139
2010-04-13 16:41:29 +00:00
Benjamin Kramer
a4c5712b41 BumpPtrAllocator::Reset() doesn't need to allocate anything. (Thanks, Jakob)
llvm-svn: 101138
2010-04-13 16:38:06 +00:00
Benjamin Kramer
4ca6d372d5 Let BumpPtrAllocator lazily allocate the first slab.
We have some code in llvm and clang where a BumpPtrAllocator is declared in a
class but never used in the common case. Stop wasting memory there.

llvm-svn: 101130
2010-04-13 14:41:51 +00:00
Owen Anderson
12a31a4254 Remove SCCVN from the CMake build system.
llvm-svn: 101125
2010-04-13 08:33:09 +00:00
Owen Anderson
73c74b3153 SCCVN, we hardly knew ye!
llvm-svn: 101117
2010-04-13 05:24:08 +00:00
Chris Lattner
72bc852ebe Fix PR6826: GraphWriter delete the generated file before "dotty" load it,
patch by 'ether'.

llvm-svn: 101116
2010-04-13 04:35:39 +00:00
Bob Wilson
c356444630 Replace r101053 with a fix for getSOImmValRotate() so that it will correctly
recognize all the valid rotated immediates.  This fixes the disassembler
issue and will also help codegen for some unusual constant values.

llvm-svn: 101114
2010-04-13 02:11:48 +00:00
Dan Gohman
a83b45d7b5 Teach IndVarSimplify how to eliminate remainder operators where the
numerator is an induction variable. For example, with code like this:

  for (i=0;i<n;++i)
    x[i%n] = 0;

IndVarSimplify will now recognize that i is always less than n inside
the loop, and eliminate the remainder.

llvm-svn: 101113
2010-04-13 01:46:36 +00:00
Daniel Dunbar
6f0c74d0b4 VMCore: Add Type::getIntN[Ptr]Ty, which are the obvious generic forms of
Type::getInt{1,8,...}[Ptr]Ty, so code can consistently use the methods on Type
without occasionally needed to call IntegerType::get.

llvm-svn: 101111
2010-04-13 01:39:07 +00:00
Chris Lattner
dabcd9738c add llvm codegen support for -ffunction-sections and -fdata-sections,
patch by Sylvere Teissier!

llvm-svn: 101106
2010-04-13 00:36:43 +00:00
Dan Gohman
2b5e134433 Micro-optimize a few hot spots.
llvm-svn: 101086
2010-04-12 23:08:18 +00:00
Evan Cheng
ec21a36774 Use .set expression for x86 pic jump table reference to reduce assembly relocation. rdar://7738756
llvm-svn: 101085
2010-04-12 23:07:17 +00:00
Dan Gohman
ece51fc413 Add fast paths to ScalarEvolution::getSizeOf and getOffsetOf, as
they're used a lot by getNodeForGEP, which can be called a lot.
This speeds up -iv-users by around 15% on several testcases.

llvm-svn: 101083
2010-04-12 23:03:26 +00:00
Bill Wendling
1f2e71928c Micro-optimization:
If we have this situation:

    jCC  L1
    jmp  L2
L1:
  ...
L2:
  ...

We can get a small performance boost by emitting this instead:

    jnCC L2
L1:
  ...
L2:
  ...

This testcase shows an example of this:

float func(float x, float y) {
    double product = (double)x * y;
    if (product == 0.0)
        return product;
    return product - 1.0;
}

llvm-svn: 101075
2010-04-12 22:19:57 +00:00
Dan Gohman
377b9cade7 Simplify this code.
llvm-svn: 101074
2010-04-12 22:12:29 +00:00
Dan Gohman
ba53e85cc3 Suppress LinearFunctionTestReplace when the computed backedge-taken
expression is a UDiv and it doesn't appear that the UDiv came from
the user's source.

ScalarEvolution has recently figured out how to compute a tripcount
expression for the inner loop in
SingleSource/Benchmarks/Shootout/sieve.c, using a udiv. Emitting a
udiv instruction dramatically slows down the enclosing loop.

llvm-svn: 101068
2010-04-12 21:13:43 +00:00
Johnny Chen
7a729daf31 Fixed a crasher in arm disassembler within ARMInstPrinter.cpp after calling
ARM_AM::getSoImmVal(V) with a legitimate so_imm value: #245 rotate right by 2.
Introduce ARM_AM::getSOImmValOneOrNoRotate(unsigned Arg) which is called from
ARMInstPrinter.cpp's printSOImm() function, replacing ARM_AM::getSOImmVal(V).

[12:44:43] johnny:/Volumes/data/llvm/git/trunk (local-trunk) $ gdb Debug/bin/llvm-mc
GNU gdb 6.3.50-20050815 (Apple version gdb-1346) (Fri Sep 18 20:40:51 UTC 2009)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "x86_64-apple-darwin"...Reading symbols for shared libraries ... done

(gdb) set args  -triple=arm-apple-darwin9 -debug-only=arm-disassembler --disassemble
(gdb) r
Starting program: /Volumes/data/llvm/git/trunk/Debug/bin/llvm-mc -triple=arm-apple-darwin9 -debug-only=arm-disassembler --disassemble
Reading symbols for shared libraries ++. done
0xf5 0x71 0xf0 0x53
Opcode=201 Name=MVNi Format=ARM_FORMAT_DPFRM(4)
 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10  9  8  7  6  5  4  3  2  1  0 
-------------------------------------------------------------------------------------------------
| 0: 1: 0: 1| 0: 0: 1: 1| 1: 1: 1: 1| 0: 0: 0: 0| 0: 1: 1: 1| 0: 0: 0: 1| 1: 1: 1: 1| 0: 1: 0: 1|
-------------------------------------------------------------------------------------------------

	mvnpls	r7, Assertion failed: (V != -1 && "Not a valid so_imm value!"), function printSOImm, file ARMInstPrinter.cpp, line 229.

Program received signal SIGABRT, Aborted.
0x00007fff88c65886 in __kill ()
(gdb) bt
#0  0x00007fff88c65886 in __kill ()
#1  0x00007fff88d05eae in abort ()
#2  0x00007fff88cf2ef0 in __assert_rtn ()
#3  0x000000010020e422 in printSOImm (O=@0x1010bdf80, V=-1, VerboseAsm=false, MAI=0x1020106d0) at ARMInstPrinter.cpp:229
#4  0x000000010020e5fe in llvm::ARMInstPrinter::printSOImmOperand (this=0x1020107e0, MI=0x7fff5fbfee70, OpNum=1, O=@0x1010bdf80) at ARMInstPrinter.cpp:254
#5  0x00000001001ffbc0 in llvm::ARMInstPrinter::printInstruction (this=0x1020107e0, MI=0x7fff5fbfee70, O=@0x1010bdf80) at ARMGenAsmWriter.inc:3236
#6  0x000000010020c27c in llvm::ARMInstPrinter::printInst (this=0x1020107e0, MI=0x7fff5fbfee70, O=@0x1010bdf80) at ARMInstPrinter.cpp:182
#7  0x000000010003cbff in PrintInsts (DisAsm=@0x10200f4e0, Printer=@0x1020107e0, Bytes=@0x7fff5fbff060, SM=@0x7fff5fbff078) at Disassembler.cpp:65
#8  0x000000010003c8b4 in llvm::Disassembler::disassemble (T=@0x1010c13c0, Triple=@0x1010b6798, Buffer=@0x102010690) at Disassembler.cpp:153
#9  0x000000010004095c in DisassembleInput (ProgName=0x7fff5fbff3f0 "/Volumes/data/llvm/git/trunk/Debug/bin/llvm-mc") at llvm-mc.cpp:347
#10 0x000000010003eefb in main (argc=4, argv=0x7fff5fbff298) at llvm-mc.cpp:374
(gdb) q
The program is running.  Exit anyway? (y or n) y
[13:36:26] johnny:/Volumes/data/llvm/git/trunk (local-trunk) $ 

llvm-svn: 101053
2010-04-12 18:46:53 +00:00
Dan Gohman
3646979c2c Remove a #include.
llvm-svn: 101043
2010-04-12 16:26:03 +00:00
Tobias Grosser
7bae2d156a Remove unneeded debug in PostDominator runOnFunction()
The information is already available with "opt -analyze". The DominatorTree
does also not have this in its runOnFunction. So they behave now
more consistent.

llvm-svn: 101038
2010-04-12 15:32:55 +00:00
Tobias Grosser
0c22d436c2 Remove dead code in the dotty dominance tree printer.
This template is not needed anymore as it was replaced by the
DOTGraphTraitsViewer.

llvm-svn: 101036
2010-04-12 15:02:19 +00:00
Benjamin Kramer
9904b07b61 Plug trivial leak.
llvm-svn: 101034
2010-04-12 11:38:35 +00:00
Dan Gohman
2f18a9f7d0 Delete this code, which is no longer needed.
llvm-svn: 101033
2010-04-12 08:00:22 +00:00
Dan Gohman
48cfc8f8db Move the EliminateIVUsers call back out to its original location. Now that
a ScalarEvolution bug with overflow handling is fixed, the normal analysis
code will automatically decline to operate on the icmp instructions which
are responsible for the loop exit.

llvm-svn: 101032
2010-04-12 07:56:56 +00:00
Dan Gohman
e87da8a25d Generalize ScalarEvolution's PHI analysis to handle loops that don't
have preheaders or dedicated exit blocks, as clients may not otherwise
need to run LoopSimplify.

llvm-svn: 101030
2010-04-12 07:49:36 +00:00
Dan Gohman
eee8b53fdb Rewrite the overflow checking in the get{Signed,Unsigned}Range code for
AddRecs so that it checks for overflow in the computation that it is
performing, rather than just checking hasNo{Signed,Unsigned}Wrap, since
those flags are for a different computation. This fixes a bug that
impacts an upcoming change.

llvm-svn: 101028
2010-04-12 07:39:33 +00:00
Dan Gohman
234f950516 Use RecursivelyDeleteTriviallyDeadInstructions in EliminateIVComparisons,
instead of deleting just the user. This makes it more consistent with
other code in IndVarSimplify, and theoretically can eliminate more users
earlier.

llvm-svn: 101027
2010-04-12 07:29:15 +00:00
Evan Cheng
90788354c9 Enable post regalloc machine licm by default.
llvm-svn: 101023
2010-04-12 06:25:28 +00:00
Eric Christopher
6b38179ee2 Verify function prototypes before trying to optimize functions. We also
need TargetData, just return false if we don't have it.

Update testcases accordingly.

Fixes PR6807.

llvm-svn: 101011
2010-04-12 04:48:00 +00:00
Dan Gohman
5c9f7ed9aa Remove unnecessary parens.
llvm-svn: 101010
2010-04-12 02:24:01 +00:00
Dan Gohman
77de904df0 Minor code simplification.
llvm-svn: 101009
2010-04-12 02:22:30 +00:00
Dan Gohman
dff42439b2 Re-apply r101000, with a fix: Don't eliminate an icmp which is part of
the loop exit test. This usually doesn't come up for a variety of
reasons, but it isn't impossible, so make IndVarSimplify handle it
conservatively.

llvm-svn: 101008
2010-04-12 02:21:50 +00:00
Dan Gohman
97a1bdfafc Revert 101000, which is breaking self-host builds.
llvm-svn: 101002
2010-04-12 00:17:10 +00:00
Dan Gohman
3bf0040d05 Fix indentation.
llvm-svn: 101001
2010-04-11 23:44:58 +00:00
Dan Gohman
7e250afcfa Teach IndVarSimplify how to eliminate comparisons involving induction
variables. For example, with code like this:

  for (i=0;i<n;++i)
    if (i<n)
      x[i] = 0;

IndVarSimplify will now recognize that i is always less than n inside
the loop, and eliminate the if.

llvm-svn: 101000
2010-04-11 23:10:12 +00:00
Dan Gohman
ff456e3f4d Enhance ScalarEvolution::isKnownPredicate with support for
loop conditions which are invariants.

llvm-svn: 100995
2010-04-11 22:16:48 +00:00
Dan Gohman
f73ed98d56 Minor code simplification.
llvm-svn: 100994
2010-04-11 22:13:11 +00:00
Dan Gohman
07d134b751 When creating a ConstantRange for [n,UINT_MAX], special case n == 0, because
ConstantRange(0, 0) creates an empty range rather than a full one.

llvm-svn: 100993
2010-04-11 22:12:18 +00:00
Dan Gohman
dfc68d4c92 Add a cast to void to show that the return value is being
intentionally ignored.

llvm-svn: 100984
2010-04-11 19:30:19 +00:00
Dan Gohman
487a63d3d7 Delete a dead check.
llvm-svn: 100983
2010-04-11 19:29:41 +00:00
Dan Gohman
a5db61b314 Delete dead code.
llvm-svn: 100981
2010-04-11 19:28:47 +00:00
Dan Gohman
9ca5efece4 Rename isLoopGuardedByCond to isLoopEntryGuardedByCond, to emphasise
that it's only testing for the entry condition, not full loop-invariant
conditions.

llvm-svn: 100979
2010-04-11 19:27:13 +00:00
Chris Lattner
213ad9a058 Implement support for varargs functions without any fixed
parameters in the CBE by implicitly adding a fixed argument.
This allows eliminating a work-around from DAE.  Patch by
Sylvere Teissier!

llvm-svn: 100944
2010-04-10 19:12:44 +00:00
Chris Lattner
92b4e858d0 fix PR6743, a case where we'd delete an instruction before using it
in some cases.

llvm-svn: 100937
2010-04-10 18:26:57 +00:00
Chris Lattner
c5ee900be8 fix PR6760, a missing check in heap SRoA.
llvm-svn: 100936
2010-04-10 18:19:22 +00:00
Chris Lattner
433f14271a turn an assert into a proper check, fixing crash on invalid here:
$ llvm-as t.ll
llvm-as: t.ll:1:6: error: expected 'type' after '='
%0 = = type { i32, float, float, double }
     ^

PR6810.

llvm-svn: 100934
2010-04-10 18:01:25 +00:00
Chris Lattner
bb78eb4d82 improve haiku portability, patch by Paul Davey.
llvm-svn: 100933
2010-04-10 17:54:51 +00:00
Chris Lattner
caf521c6b4 add attributes and module level asm to the ocaml bindings,
patch by Patrick Walton!

llvm-svn: 100932
2010-04-10 17:52:58 +00:00
Dan Gohman
4e910beb76 Fix a typo and some indentation.
llvm-svn: 100908
2010-04-09 22:47:25 +00:00
Dan Gohman
67e02ffd79 When determining a canonical insert position, don't climb deeper
into adjacent loops. Also, ensure that the insert position is
dominated by the loop latch of any loop in the post-inc set which
has a latch.

llvm-svn: 100906
2010-04-09 22:07:05 +00:00
Bob Wilson
c340ffd866 Tidy whitespace.
llvm-svn: 100904
2010-04-09 21:38:26 +00:00
Chris Lattner
7ecde540fb suck the propagating "has dynamic libs" check into a single makefile
variable TARGET_HAS_DYNAMIC_LIBS

llvm-svn: 100896
2010-04-09 20:51:47 +00:00
Chris Lattner
9d77e5ba47 add minix support, patch by Kees van Reeuwijk! PR6797
llvm-svn: 100895
2010-04-09 20:45:04 +00:00
Chris Lattner
cd7b368e65 clean this up, fix std::min ambiguity on some platforms.
llvm-svn: 100894
2010-04-09 20:43:54 +00:00
Wesley Peck
6a6f1a5afa Adding IPSCCP and Internalize passes to the C-bindings
llvm-svn: 100893
2010-04-09 20:43:20 +00:00
Bob Wilson
ef934eac9f Provide versions of the ARM eh_sjlj_setjmp instructions for non-VFP subtargets
such that the non-VFP versions have no implicit defs of VFP registers.
If any callee-saved VFP registers are marked as having been defined, the
prologue/epilogue code will try to save and restore them.
Radar 7770432.

llvm-svn: 100892
2010-04-09 20:41:18 +00:00
Dan Gohman
e36761b7d0 When emitting code for an add, don't force a SCEVUnknown wrapper around
a hoisted intermediate result if the intermediate result isn't an
Instruction.

llvm-svn: 100884
2010-04-09 19:14:31 +00:00
Dan Gohman
2ea51b7464 When looking for loop-invariant users, look through no-op instructions,
so that an unfortunately placed bitcast doesn't pin a value in a
register.

llvm-svn: 100883
2010-04-09 19:12:34 +00:00
Chris Lattner
5408e8a62b "On SPU, variables in the .bss section that are allocated with the .lcomm directive are not aligned on 16 byte boundaries. This causes misaligned loads, as the generated assembly assumes this "default" alignment.
this patch disables .lcomm in favour of '.local .comm'

Patch by Kalle Raisklia!

llvm-svn: 100875
2010-04-09 18:27:03 +00:00
Dan Gohman
d142f14f78 Add a comment.
llvm-svn: 100874
2010-04-09 18:20:03 +00:00
Devang Patel
55172d3571 Clear InsnsBeginScopeSet and InsnsEndScopeSet at the end of function.
llvm-svn: 100867
2010-04-09 16:04:20 +00:00
Gabor Greif
f63f840826 performance: cache result of looking up user
llvm-svn: 100862
2010-04-09 15:18:34 +00:00
Dan Gohman
1dbce98fac Minor code simplification.
llvm-svn: 100859
2010-04-09 14:53:59 +00:00
Dan Gohman
f9cf2772f6 Delete this obsolete comment.
llvm-svn: 100858
2010-04-09 14:12:01 +00:00
Gabor Greif
6f820a041f const-ize a predicate
llvm-svn: 100856
2010-04-09 10:57:00 +00:00
Chandler Carruth
362be7d46d Add a missing dependency to this library when building with CMake.
llvm-svn: 100852
2010-04-09 05:55:25 +00:00
Bob Wilson
1fa38ca6fd Use getNumImplicitDefs() and getNumImplicitUses().
llvm-svn: 100850
2010-04-09 04:46:43 +00:00
Bob Wilson
ed50c79a3a Fix up some comments.
llvm-svn: 100849
2010-04-09 04:34:03 +00:00
Dan Gohman
5ff28f586e Refactor the code for computing the insertion point for an expression into
a separate function.

llvm-svn: 100845
2010-04-09 02:00:38 +00:00
Dan Gohman
b07151b5dd Add several more lint checks.
llvm-svn: 100841
2010-04-09 01:39:53 +00:00
Dan Gohman
853ff6b580 Fix a bug in IVUsers which was permitting non-affine addrecs to
be sent to LSR, which it isn't prepared to handle.

llvm-svn: 100839
2010-04-09 01:22:56 +00:00
Chris Lattner
08fed5e338 fix a SCCP miscompilation that could happen when a
forced constant is changed to a constant, we would end
up adding the instruction to the wrong worklist, 
preventing it from being properly revisited.  This fixes
rdar://7832370

llvm-svn: 100837
2010-04-09 01:14:31 +00:00
Dan Gohman
c33ea94108 Avoid allocating a value of zero in a register if the initial formula
inputs happen to negate each other.

llvm-svn: 100828
2010-04-08 23:36:27 +00:00
Dan Gohman
eeb89ac6d3 Add a few more lint checks.
llvm-svn: 100825
2010-04-08 23:05:57 +00:00
Dan Gohman
127f5c53e1 Add variants of ult, ule, etc. which take a uint64_t RHS, for convenience.
llvm-svn: 100824
2010-04-08 23:03:40 +00:00
Chris Lattner
e154403f78 delete a forwarding function.
llvm-svn: 100815
2010-04-08 21:34:17 +00:00
Chris Lattner
1cf4bded13 move elf section uniquing to MCContext. Along the way
merge XCore's section into MCSectionELF

llvm-svn: 100812
2010-04-08 21:26:26 +00:00
Chris Lattner
0225dbbfee remove the TargetLoweringObjectFileMachO::getMachoSection
api and update clients to use MCContext instead.

llvm-svn: 100808
2010-04-08 20:40:11 +00:00
Chris Lattner
60ff59e5c1 move macho section uniquing from MCParser and TLOF to MCContext where
the compiler and asmparser now unique to the same sections.  This fixes
rdar://7835021.

llvm-svn: 100807
2010-04-08 20:30:37 +00:00
Evan Cheng
619f1b8a94 Coalescer should not delete copy instructions whose defs are partially dead. e.g.
%RDI<def,dead> = MOV64rr %RAX<kill>, %EDI<imp-def>

llvm-svn: 100804
2010-04-08 20:02:37 +00:00
Ted Kremenek
de32c8d8db Update CMake build.
llvm-svn: 100802
2010-04-08 18:52:18 +00:00
Ted Kremenek
141d32b7e9 Fix -Wsign-compare warning (issued by clang++).
llvm-svn: 100799
2010-04-08 18:49:30 +00:00
Dan Gohman
6ad805d335 Add a -lint pass which checks for common sources of undefined or likely
unintended behavior.

llvm-svn: 100798
2010-04-08 18:47:09 +00:00
Devang Patel
17b5b1dd88 Rename a function.
llvm-svn: 100797
2010-04-08 18:43:56 +00:00
Chris Lattner
f6e9c0c4bd implicit defs get added to the end of machine instrs sometimes. Scan the whole instruction for the metadata operand instead of assuming it will be at the end of the instruction.
llvm-svn: 100792
2010-04-08 18:20:52 +00:00
Dan Gohman
b2a87fa39d Pointers to zero-sized objects don't point to overlapping objects.
llvm-svn: 100789
2010-04-08 18:11:50 +00:00
Dan Gohman
5bf62639ed Print empty structs as {} rather than { }.
llvm-svn: 100787
2010-04-08 18:03:05 +00:00
Devang Patel
89756fdbfc One instruction may start (or end) multiple lexical scopes.
There is no need to remember labels identifying regions marked by such instructions in each scope.

llvm-svn: 100781
2010-04-08 16:50:29 +00:00
Gabor Greif
84d4f4ac57 clean up algorithm and remove operand order assumptions
llvm-svn: 100780
2010-04-08 16:46:24 +00:00
Dan Gohman
df4b5c45d5 Fix a comment.
llvm-svn: 100774
2010-04-08 15:57:10 +00:00
Devang Patel
3cc4a24666 Remove dead code.
llvm-svn: 100771
2010-04-08 15:48:02 +00:00
Devang Patel
b9f9a00513 Delete out of date comment.
llvm-svn: 100769
2010-04-08 15:41:13 +00:00
Devang Patel
9ada7b28a2 Refactor.
llvm-svn: 100768
2010-04-08 15:37:09 +00:00
Benjamin Kramer
3b7602b1fb Various MSVC warning fixes about truncated 64 bit shifts and const pointers passed to free.
llvm-svn: 100767
2010-04-08 15:25:57 +00:00
Gabor Greif
79979079e9 use abstract interface in two more places
llvm-svn: 100762
2010-04-08 13:50:42 +00:00
Gabor Greif
362d7b3d89 fix compile
llvm-svn: 100760
2010-04-08 13:08:11 +00:00
Gabor Greif
2703bed5f8 use abstract interface
llvm-svn: 100758
2010-04-08 12:52:19 +00:00
Benjamin Kramer
0fb23008bb Use twines to simplify calls to report_fatal_error. For code size and readability.
llvm-svn: 100756
2010-04-08 10:44:28 +00:00
Evan Cheng
3fa0b6fb03 Avoid using f64 to lower memcpy from constant string. It's cheaper to use i32 store of immediates.
llvm-svn: 100751
2010-04-08 07:37:57 +00:00
Dan Gohman
bd878ac80b Revert this change from a while ago; ScalarEvolution shouldn't analyze
undef as 0, since it can't force other analyses to intepret the undef
in the same way.

llvm-svn: 100749
2010-04-08 05:58:24 +00:00
Dan Gohman
0a77dd29de When expanding expressions which are using post-inc mode for multiple loops,
ensure that the expansion is dominated by the increments of those loops.

llvm-svn: 100748
2010-04-08 05:57:57 +00:00
Evan Cheng
2f7cee1730 Make post regalloc machine licm functional. It now passes all of MultiSource.
llvm-svn: 100742
2010-04-08 01:03:47 +00:00
Eric Christopher
649c823f75 mpsadbw is not commutative.
Fixes PR3440.

llvm-svn: 100736
2010-04-08 00:52:02 +00:00
Sean Callanan
dcd7a375dd Added support for ARM disassembly to edis.
I also added a rule to the ARM target's Makefile to
build the ARM-specific instruction information table
for the enhanced disassembler.

I will add the test harness for all this stuff in
a separate commit.

llvm-svn: 100735
2010-04-08 00:48:21 +00:00
Chris Lattner
579e7eb423 convert a report_fatal_error that I was able to trigger into a nice error
so the user at least knows what inline asm is a problem.  For example:

error: inline asm not supported yet: don't know how to handle tied indirect register inputs
pr8788-1.c:14:10: note: generated from here
    asm ("\n" : "+r" (stack->regs)
         ^

Instead of:
fatal error: error in backend: Don't know how to handle tied indirect register inputs yet!

llvm-svn: 100731
2010-04-08 00:09:16 +00:00
Chris Lattner
f9fbc74e40 minor tidying.
llvm-svn: 100725
2010-04-07 23:50:38 +00:00
Chris Lattner
96ed85d7ab use assertions instead of unreachable for logic errors.
llvm-svn: 100724
2010-04-07 23:47:51 +00:00
Chris Lattner
393ea6fc22 introduce a new recoverable error handling API to LLVMContext
and use it in one place in inline asm handling stuff.  Before
we'd generate this for an invalid modifier letter:

$ clang asm.c -c -o t.o
fatal error: error in backend: Invalid operand found in inline asm: 'abc incl    ${0:Z}'
INLINEASM <es:abc incl    ${0:Z}>, 10, %EAX<def>, 2147483657, %EAX, 14, %EFLAGS<earlyclobber,def,dead>, <!-1>


Now we generate this:

$ clang asm.c -c -o t.o
error: invalid operand in inline asm: 'incl    ${0:Z}'
asm.c:3:12: note: generated from here
  __asm__ ("incl    %Z0" : "+r" (X));
           ^
1 error generated.

This is much better but still admittedly not great ("why" is the operand 
invalid??), codegen should try harder with its diagnostics :)

llvm-svn: 100723
2010-04-07 23:40:44 +00:00
Dan Gohman
8f2ebaf7ec Say bitcast instead of bitconvert.
llvm-svn: 100720
2010-04-07 23:22:42 +00:00
Chris Lattner
ea8b374616 rename llvm_install_error_handler -> install_fatal_error_handler
and friends.

llvm-svn: 100717
2010-04-07 23:12:29 +00:00
Ted Kremenek
cce8f54757 Update CMake build.
llvm-svn: 100714
2010-04-07 23:05:23 +00:00
Benjamin Kramer
8ae03bbc21 Update cmake build.
llvm-svn: 100713
2010-04-07 23:01:37 +00:00
Eric Christopher
70a6c8fd6d Add support for stpncpy_chk.
llvm-svn: 100710
2010-04-07 23:00:07 +00:00
Chris Lattner
80b41881bc rename llvm::llvm_report_error -> llvm::report_fatal_error
llvm-svn: 100709
2010-04-07 22:58:41 +00:00
Chris Lattner
a58082f349 add newlines at end of files.
llvm-svn: 100706
2010-04-07 22:54:55 +00:00
Chris Lattner
0768c834fe remove some unneeded errorhandling stuff.
llvm-svn: 100703
2010-04-07 22:44:07 +00:00
Chris Lattner
f927d33d8c minor tidying up
llvm-svn: 100702
2010-04-07 22:41:29 +00:00
Chris Lattner
cc827ee016 tidy up
llvm-svn: 100700
2010-04-07 22:29:10 +00:00
Dan Gohman
b5210c934f Generalize IVUsers to track arbitrary expressions rather than expressions
explicitly split into stride-and-offset pairs. Also, add the
ability to track multiple post-increment loops on the same expression.

This refines the concept of "normalizing" SCEV expressions used for
to post-increment uses, and introduces a dedicated utility routine for
normalizing and denormalizing expressions.

This fixes the expansion of expressions which are post-increment users
of more than one loop at a time. More broadly, this takes LSR another
step closer to being able to reason about more than one loop at a time.

llvm-svn: 100699
2010-04-07 22:27:08 +00:00
Johnny Chen
b024d0a612 Missed this one line for the previous checkin to fix build warnings.
llvm-svn: 100697
2010-04-07 22:21:03 +00:00
Johnny Chen
9fdf028fd3 Fixed warnings pointed out by clang.
llvm-svn: 100696
2010-04-07 22:03:27 +00:00
Johnny Chen
16c0653745 Fixed warnings pointed out by clang.
Next to work on is ARMDisassemblerCore.cpp.

llvm-svn: 100695
2010-04-07 21:52:48 +00:00
Sean Callanan
3c69c6593a Fixed a bug where the disassembler would allow an immediate
argument that had to be between 0 and 7 to have any value,
firing an assert later in the AsmPrinter.  Now, the
disassembler rejects instructions with out-of-range values
for that immediate.

llvm-svn: 100694
2010-04-07 21:42:19 +00:00
Johnny Chen
4dc93f2195 Fixed 3 warnings pointed out by clang.
llvm-svn: 100693
2010-04-07 21:23:48 +00:00
Johnny Chen
2c992fb384 Re-enable ARM/Thumb disassembler and add a workaround for a memcpy() call in
ARMDecoderEmitter.cpp, with FIXME comment.

llvm-svn: 100690
2010-04-07 20:53:12 +00:00
Sean Callanan
8ac8cf3f10 Added an AsmLexer for the ARM target, which uses
a simple mapping of register names to IDs to
identify register tokens.

llvm-svn: 100685
2010-04-07 20:29:34 +00:00
Dale Johannesen
8691bcbc2a Educate GetInstrSizeInBytes implementations that
DBG_VALUE does not generate code.

llvm-svn: 100681
2010-04-07 19:51:44 +00:00
Gabor Greif
f2480270e1 fix 80-col violations
llvm-svn: 100677
2010-04-07 18:59:26 +00:00
Anton Korobeynikov
e5c1563130 Remove late ARM codegen optimization pass committed by accident.
It is not ready for public yet.

llvm-svn: 100673
2010-04-07 18:23:27 +00:00
Anton Korobeynikov
51fba0e4eb Split A8/A9 itins - they already were too big.
llvm-svn: 100672
2010-04-07 18:22:11 +00:00
Anton Korobeynikov
7d6384b376 Add some crude itin approximation for VFP load / stores on A9
llvm-svn: 100671
2010-04-07 18:22:03 +00:00
Anton Korobeynikov
f2a19a64d1 Add some crude approximation for neon load/store instructions
llvm-svn: 100670
2010-04-07 18:21:58 +00:00
Anton Korobeynikov
1bd6022529 Add some A8-based approximation for instructions with unknown cycle times
llvm-svn: 100669
2010-04-07 18:21:52 +00:00
Anton Korobeynikov
51d00a7f48 Move NEON-VFP domain fixer upper, so post-RA scheduler would benefit from it.
llvm-svn: 100668
2010-04-07 18:21:46 +00:00
Anton Korobeynikov
0401f43ddc Since tblgen bug was fixed (thanks Jakob!) we don't need InstrStage2 hack anymore.
llvm-svn: 100667
2010-04-07 18:21:41 +00:00
Anton Korobeynikov
cdb0066e5f Fix A8 FP NEON MAC itins
llvm-svn: 100666
2010-04-07 18:21:33 +00:00
Anton Korobeynikov
a63bb55ad7 A9 NEON FP itins
llvm-svn: 100665
2010-04-07 18:21:27 +00:00
Anton Korobeynikov
d2770462d1 Some permute goodness for A9
llvm-svn: 100664
2010-04-07 18:21:22 +00:00
Anton Korobeynikov
4eb354a908 More shift itins for A9
llvm-svn: 100663
2010-04-07 18:21:16 +00:00
Anton Korobeynikov
f9463f5b98 More fixes for itins
llvm-svn: 100662
2010-04-07 18:21:10 +00:00
Anton Korobeynikov
0c3bc7a9ce Fix invalid itins for 32-bit varians of VMLAL and friends
llvm-svn: 100661
2010-04-07 18:21:04 +00:00
Anton Korobeynikov
103c4e9803 Add MAC stuff for A9
llvm-svn: 100660
2010-04-07 18:20:58 +00:00
Anton Korobeynikov
bca57ef16b Fix invalid NEON MAC itins on A8
llvm-svn: 100659
2010-04-07 18:20:53 +00:00
Anton Korobeynikov
dce0e2a918 Fix itins for VPAL
llvm-svn: 100658
2010-04-07 18:20:47 +00:00
Anton Korobeynikov
be68ff5b2c Fix itins for VABA
llvm-svn: 100657
2010-04-07 18:20:42 +00:00
Anton Korobeynikov
fbc58bba2f Correct VMVN itinerary: operand is read in the second cycle, not in the first.
llvm-svn: 100656
2010-04-07 18:20:36 +00:00
Anton Korobeynikov
2abd52b692 More A9 itineraries
llvm-svn: 100655
2010-04-07 18:20:29 +00:00
Anton Korobeynikov
13df6eaf1c Correct itinerary class for VPADD
llvm-svn: 100654
2010-04-07 18:20:24 +00:00
Anton Korobeynikov
982f9a042b VP{MAX, MIN} are of IIC_VSUBi4D itin class as well.
llvm-svn: 100653
2010-04-07 18:20:18 +00:00
Anton Korobeynikov
058984f2a8 VHADD differs from VHSUB at least on A9 - the former reads both operands in the second cycle, while the latter reads second operand in first cycle. Introduce new itin classes to catch this behavior. Whether this is true for A8 as well is WIP.
llvm-svn: 100652
2010-04-07 18:20:13 +00:00
Anton Korobeynikov
e8688b87a4 Some easy NEON scheduling goodness for A9
llvm-svn: 100651
2010-04-07 18:20:07 +00:00
Anton Korobeynikov
7339733c80 Define new itin classes for ARM <-> VFP reg moves to distinguish from NEON ops. Define proper scheduling itinerary for them on A9. A8 TRM does not specify latency for them at all :(
llvm-svn: 100650
2010-04-07 18:20:02 +00:00
Anton Korobeynikov
5ab38590b2 FCONST{S,D} behaves the same way as FP unary instructions. This is true for both A8 and A9.
llvm-svn: 100649
2010-04-07 18:19:56 +00:00
Anton Korobeynikov
7c19b34d69 Proper cycle times for locks, since wbck latency can be larger than fwd latency.
llvm-svn: 100648
2010-04-07 18:19:51 +00:00
Anton Korobeynikov
5954edc79b Add new itin classes for FP16 <-> FP32 conversions and make uise of them for A9.
llvm-svn: 100647
2010-04-07 18:19:46 +00:00
Anton Korobeynikov
b68aa8b5ab Make use of new reserved/required scheduling stuff: introduce VFP and NEON locks to model domain cross stalls precisly.
llvm-svn: 100646
2010-04-07 18:19:40 +00:00
Anton Korobeynikov
f93145e685 Initial support for different kinds of FU reservation.
llvm-svn: 100645
2010-04-07 18:19:32 +00:00
Anton Korobeynikov
bf7bbe3e94 Factor out scoreboard into separate class. This way we might have several different score boards.
llvm-svn: 100644
2010-04-07 18:19:24 +00:00
Anton Korobeynikov
7a3b393469 Some bits of A9 scheduling: VFP
llvm-svn: 100643
2010-04-07 18:19:18 +00:00
Anton Korobeynikov
a2b6818832 Separate const from non-const stuff during mergeing
llvm-svn: 100642
2010-04-07 18:19:13 +00:00
Anton Korobeynikov
aa8b0d11a5 Some initial version of global merger
llvm-svn: 100641
2010-04-07 18:19:07 +00:00
Anton Korobeynikov
d873a16430 Add hook to insert late LLVM=>LLVM passes just before isel
llvm-svn: 100640
2010-04-07 18:18:42 +00:00
Chris Lattner
f520500a06 fix 80 col violation, patch by Alastair Lynn
llvm-svn: 100639
2010-04-07 18:13:33 +00:00
Chris Lattner
7816ae8fd0 add a comment line that got dropped
llvm-svn: 100638
2010-04-07 18:10:38 +00:00
Chris Lattner
60e5f55565 fix a latent bug my inline asm stuff exposed:
MachineOperand::isIdenticalTo wasn't handling metadata operands.

llvm-svn: 100636
2010-04-07 18:03:19 +00:00
Benjamin Kramer
389c863692 Remove unused method.
llvm-svn: 100620
2010-04-07 11:23:46 +00:00
Torok Edwin
9028487b8b Workaround the breakage in r100616 by guarding all timers with
TimePassesIsEnabled. This should allow make check to pass.

llvm-svn: 100618
2010-04-07 10:44:46 +00:00
Bill Wendling
8282504a14 Use the "NamedGroupTimer" class to categorize DWARF emission better.
llvm-svn: 100616
2010-04-07 09:28:04 +00:00
Benjamin Kramer
663f265996 Use raw_ostream.
llvm-svn: 100615
2010-04-07 09:26:51 +00:00
Evan Cheng
0f71b51991 Add comments for missed opportunities.
llvm-svn: 100610
2010-04-07 06:00:33 +00:00
Evan Cheng
eb32efa3b6 Fix typo.
llvm-svn: 100609
2010-04-07 05:59:12 +00:00
Chris Lattner
122572e13a Have the inst emitter add the !srcloc mdnode to the machine instr.
Have the asmprinter use the mdnode to scavenge a source location if
present.  Document this nonsense in langref.

llvm-svn: 100607
2010-04-07 05:38:05 +00:00
Chris Lattner
2bf164dbf2 remove another magic number.
llvm-svn: 100606
2010-04-07 05:27:36 +00:00
Chris Lattner
dde7376e9d Three changes:
1. Introduce some enums and accessors in the InlineAsm class
   that eliminate a ton of magic numbers when handling inline
   asm SDNode.
2. Add a new MDNodeSDNode selection dag node type that holds
   a MDNode (shocking!)
3. Add a new argument to ISD::INLINEASM nodes that hold !srcloc
   metadata, propagating it to the instruction emitter, which
   drops it.

No functionality change.

llvm-svn: 100605
2010-04-07 05:20:54 +00:00
Chris Lattner
0f513e1c22 fix a crash on invalid metadata, e.g.: call i32 @foo(), XXXX
We would return the error without inserting the new instruction
into the program, so it wouldn't get deallocated, and an abort
would trigger when the module was deleted. 

llvm-svn: 100602
2010-04-07 04:08:57 +00:00
Sanjiv Gupta
3d39bd26c3 Fix memory leaks for external symbol name strings.
llvm-svn: 100601
2010-04-07 03:36:01 +00:00
John McCall
a28e38ca2f Clean up some signedness oddities in this code noticed by clang.
llvm-svn: 100599
2010-04-07 01:49:15 +00:00
Dale Johannesen
c0f9c29448 Move printing of target-indepedent DEBUG_VALUE comments
into AsmPrinter.  Target-dependent form is still generated
by FastISel and still handled in X86 code.

llvm-svn: 100596
2010-04-07 01:15:14 +00:00
Evan Cheng
ac90d47ea3 Post regalloc LICM. Work in progress.
llvm-svn: 100592
2010-04-07 00:41:17 +00:00
Devang Patel
bcab88162a Do not emit specification DIE with DW_AT_specification attribute for member functions of a funcation local class. This trips gdb's partial scan of DIEs at load time. Fixes Radar 7833483.
llvm-svn: 100586
2010-04-06 23:53:48 +00:00
John McCall
e20cc3b28c Fix a number of clang -Wsign-compare warnings that didn't have an obvious
solution.  The only reason these don't fire with gcc-4.2 is that gcc turns off
part of -Wsign-compare in C++ on accident.

llvm-svn: 100581
2010-04-06 23:35:53 +00:00
Dale Johannesen
2a51b8abe5 Revert 100573, it's causing some testsuite problems.
llvm-svn: 100578
2010-04-06 22:45:26 +00:00
Dale Johannesen
fefeacda3b Move printing of DEBUG_VALUE comments to target-independent place.
There is probably a more elegant way to do this.

llvm-svn: 100573
2010-04-06 22:21:07 +00:00
Bob Wilson
6bc6581ca7 Expand SELECT and SELECT_CC for NEON vector types.
Radar 7770501.

llvm-svn: 100568
2010-04-06 22:02:24 +00:00
Dale Johannesen
fef6eb4076 Allow for the possibility that a debug-value points
to a SDNode that didn't have code generated for it.

llvm-svn: 100566
2010-04-06 21:59:56 +00:00
Stuart Hastings
4f6cdc07e9 Reverting 100530 & 100531 due to regressions in the GDB test suite.
llvm-svn: 100563
2010-04-06 21:38:29 +00:00
Jim Grosbach
0c336a7923 Fix PR6696 and PR6663
When a frame pointer is not otherwise required, and dynamic stack alignment
is necessary solely due to the spilling of a register with larger alignment
requirements than the default stack alignment, the frame pointer can be both
used as a general purpose register and a frame pointer. That goes poorly, for
obvious reasons. This patch brings back a bit of old logic for identifying
the use of such registers and conservatively reserves the frame pointer
during register allocation in such cases.

For now, implement for X86 only since it's 32-bit linux which is hitting this,
and we want a targeted fix for 2.7. As a follow-on, this will be expanded
to handle other targets, as theoretically the problem could arise elsewhere
as well.

llvm-svn: 100559
2010-04-06 20:26:37 +00:00
Jakob Stoklund Olesen
370a3e553f Don't try to collapse DomainValues onto an incompatible SSE domain.
This fixes the Bullet regression on i386/nocona.

llvm-svn: 100553
2010-04-06 19:48:56 +00:00
Gabor Greif
faa9bf800f performance: get rid of repeated dereferencing of use_iterator by caching its result
llvm-svn: 100550
2010-04-06 19:32:30 +00:00
Gabor Greif
2afbfcfaa4 make more two predicates constant
llvm-svn: 100549
2010-04-06 19:24:18 +00:00
Gabor Greif
3969e04cb9 performance: get rid of repeated dereferencing of use_iterator by caching its result
llvm-svn: 100547
2010-04-06 19:14:05 +00:00
Gabor Greif
6e9847b04f const-ize predicate ValueIsOnlyUsedLocallyOrStoredToOneGlobal
llvm-svn: 100546
2010-04-06 18:58:22 +00:00
Gabor Greif
a1fcda6242 use CallSite to access calls vs. invokes uniformly
and remove assumptions about operand order

llvm-svn: 100544
2010-04-06 18:45:08 +00:00
Chris Lattner
c83a42075b enhance SMDiagnostic to also maintain a pointer to the SourceMgr.
Add a simplified constructor for clients that don't have locations
like "file not found" errors.

llvm-svn: 100538
2010-04-06 18:06:18 +00:00
Evan Cheng
99617bac24 Code clean up. Move includes from VirtRegRewriter.h to VirtRegRewriter.cpp.
llvm-svn: 100532
2010-04-06 17:19:55 +00:00
Stuart Hastings
749cf45929 Revise debug info machinery to digest nested functions and classes.
A certain GDB testsuite case (local.cc) has a function nested inside a
class nested inside another function.  GCC presents the innermost
function to llvm-convert first.  Heretofore, the debug info mistakenly
placed the inner function at module scope.  This patch walks the GCC
context links and instantiates the outer class and function so the
debug info is properly nested.  Radar 7426545.

llvm-svn: 100530
2010-04-06 17:19:32 +00:00
Mon P Wang
c0da8af5c3 Remove assert to treat memmove and memset like memcpy
llvm-svn: 100521
2010-04-06 08:27:51 +00:00
Owen Anderson
a8a2718d7d Use a ManagedCleanup to prevent leaking the PassRegistrar map. In breaks the
use case where someone wants to resurrect LLVM after calling llvm_shutdown,
but I'm not aware of any clients that are affected by this.

llvm-svn: 100519
2010-04-06 04:20:48 +00:00
Dan Gohman
cbfa9139eb Add a const qualifier.
llvm-svn: 100515
2010-04-06 01:31:12 +00:00
Chris Lattner
960095d2c8 propagate cookie management out one layer of function calls.
llvm-svn: 100510
2010-04-06 00:58:50 +00:00
Chris Lattner
344a742ed1 report errors through LLVMContext's inline asm handler if available.
llvm-svn: 100509
2010-04-06 00:55:39 +00:00
Chris Lattner
8c1f45d90b Give MachineModuleInfo an actual Module*.
llvm-svn: 100508
2010-04-06 00:51:52 +00:00
Chris Lattner
b7a7cb37b6 give LLVMContext an inline asm diagnostic hook member.
llvm-svn: 100506
2010-04-06 00:44:45 +00:00
Devang Patel
5e0cb53223 Remove unnecessary include.
llvm-svn: 100505
2010-04-06 00:38:32 +00:00
Chris Lattner
48d30a3011 give the SourceMgr object a cookie.
llvm-svn: 100504
2010-04-06 00:33:43 +00:00
Chris Lattner
117d05ca0e Give llvm::SourceMgr the ability to have a client-specified
diagnostic handler.

llvm-svn: 100503
2010-04-06 00:26:48 +00:00
Jakob Stoklund Olesen
fcc2dfa1b4 Properly enable load clustering.
Operand 2 on a load instruction does not have to be a RegisterSDNode for this to
work.

llvm-svn: 100497
2010-04-05 23:48:02 +00:00
Evan Cheng
c6dc63d62c Fix an obvious copy-n-paste bug. It's not known to cause any miscompilation.
llvm-svn: 100494
2010-04-05 23:33:29 +00:00
Chris Lattner
f753452587 Give AsmParser an option to control whether it finalizes
the stream.  New demo:

$ clang asm.c -S -o - -emit-llvm | llc -filetype=obj -o t.o
$ otool -tv t.o
t.o:
(__TEXT,__text) section
_foo:
0000000000000000	subq	$0x08,%rsp
0000000000000004	movl	%edi,(%rsp)
0000000000000007	movl	%edi,%eax
0000000000000009	incl	%eax
000000000000000b	movl	%eax,(%rsp)
000000000000000e	movl	%eax,0x04(%rsp)
0000000000000012	addq	$0x08,%rsp
0000000000000016	ret

llvm-svn: 100492
2010-04-05 23:15:42 +00:00
Chris Lattner
5b4c7591ac add .o file writing for inline asm in llc. Here's a silly
demo:

$ clang asm.c -S -o - -emit-llvm | llc -filetype=obj -o t.o
<inline asm>:1:2: error: unrecognized instruction
	abc incl    %eax
	^
LLVM ERROR: Error parsing inline asm

Only problem seems to be that the parser finalizes OutStreamer 
at the end of the first inline asm, which isn't what we want.
For example:

$ cat asm.c
int foo(int X) {
 __asm__ ("incl    %0" : "+r" (X));
 return X;
}
$ clang asm.c -S -o - -emit-llvm | llc
...
	subq	$8, %rsp
	movl	%edi, (%rsp)
	movl	%edi, %eax
	## InlineAsm Start
	incl    %eax
	## InlineAsm End
	movl	%eax, (%rsp)
	movl	%eax, 4(%rsp)
	addq	$8, %rsp
	ret
$ clang asm.c -S -o - -emit-llvm | llc -filetype=obj -o t.o
$ otool -tv t.o
t.o:
(__TEXT,__text) section
_foo:
0000000000000000	subq	$0x08,%rsp
0000000000000004	movl	%edi,(%rsp)
0000000000000007	movl	%edi,%eax
0000000000000009	incl	%eax
$ 

don't stop at inc!

llvm-svn: 100491
2010-04-05 23:11:24 +00:00
Bill Wendling
bf50ddf6ac Output floating point representations in DWARF format. This is done by outputing
the FP encoding directly as a hex representation.

llvm-svn: 100487
2010-04-05 22:59:21 +00:00
Chris Lattner
269737461d stringref-ize the MemoryBuffer::get apis. This requires
a co-committed clang patch.

llvm-svn: 100485
2010-04-05 22:42:30 +00:00
Evan Cheng
d72090a658 Fix ADD32rr_alt instruction encoding bug. Patch by Marius Wachtler.
llvm-svn: 100480
2010-04-05 22:21:09 +00:00
Chris Lattner
e25e981494 fix a really nasty bug that Evan was tracking in SCCP. When resolving
undefs in branches/switches, we have two cases: a branch on a literal
undef or a branch on a symbolic value which is undef.  If we have a
literal undef, the code was correct: forcing it to a constant is the
right thing to do.

If we have a branch on a symbolic value that is undef, we should force
the symbolic value to a constant, which then makes the successor block
live.  Forcing the condition of the branch to being a constant isn't 
safe if later paths become live and the value becomes overdefined.  This
is the case that 'forcedconstant' is designed to handle, so just use it.

This fixes rdar://7765019 but there is no good testcase for this, the
one I have is too insane to be useful in the future.

llvm-svn: 100478
2010-04-05 22:14:48 +00:00
Chris Lattner
7cd9ea25c1 some code cleanups, use SwitchInst::findCaseValue, reduce indentation
llvm-svn: 100468
2010-04-05 21:18:32 +00:00
Evan Cheng
98db71c632 Code clean up.
llvm-svn: 100467
2010-04-05 21:16:25 +00:00
Eric Christopher
7205f8f510 Remove FIXME.
llvm-svn: 100466
2010-04-05 21:14:32 +00:00
Jeffrey Yasskin
39cdeee4c3 Fix OProfileJITEventListener build for new DebugLoc.
llvm-svn: 100461
2010-04-05 21:09:12 +00:00
Dan Gohman
302746a632 Add a comment.
llvm-svn: 100459
2010-04-05 20:24:08 +00:00
Chris Lattner
7d609ea6cb lowering a volatile llvm.memcpy to a libc memcpy is ok.
PR6779

llvm-svn: 100457
2010-04-05 20:11:45 +00:00
Dan Gohman
2aff0055c1 Don't do code sinking on unreachable blocks. It's unprofitable and hazardous.
llvm-svn: 100455
2010-04-05 19:17:22 +00:00
Chris Lattner
ae3049ffa0 don't use emitlabel in the arm asm printer yet, the order
isn't well specified.  ARM really needs to have its instprinter
finished at some point.

llvm-svn: 100439
2010-04-05 17:52:31 +00:00
Owen Anderson
3694d62450 Push const through the regex engine. Fixes some of the warnings in PR6616.
llvm-svn: 100438
2010-04-05 17:50:20 +00:00
Chris Lattner
bf754085cc fix a couple problems I introduced handling symbols
with spaces in them.  Sym->getName()  !=   OS << *Sym

llvm-svn: 100434
2010-04-05 16:32:14 +00:00