Commit Graph

56303 Commits

Author SHA1 Message Date
Rafael Espindola 9794fdfab0 Revert 93648.
Mangler::getMangledName is used from lto
Mangler::setUseQuotes is used in the AsmPrinter
Mangler::setSymbolsCanStartWithDigit is used in the AsmPrinter

llvm-svn: 93652
2010-01-16 20:27:59 +00:00
Chris Lattner 8b27547d6d Mangler::getMangledName is now dead, remove it and all the other stuff in Mangler that is now transitively dead. woo.
llvm-svn: 93648
2010-01-16 19:08:51 +00:00
Chris Lattner 06d45f6e75 Change DIEObjectLabel to take an MCSymbol instead of std::string.
llvm-svn: 93647
2010-01-16 18:50:28 +00:00
Chris Lattner 555ceabe64 rename GetPrivateGlobalValueSymbolStub -> GetSymbolWithGlobalValueBase,
and add an explicit ForcePrivate argument.

Switch FunctionEHFrameInfo to be MCSymbol based instead of string based.

llvm-svn: 93646
2010-01-16 18:37:32 +00:00
Chris Lattner 8a1f23af11 eliminate uses of getMangledName from AsmPrinter.cpp, last up is
dwarf emission which is going to be more invasive.

llvm-svn: 93645
2010-01-16 18:17:26 +00:00
Chris Lattner 9787fd0468 switch liblto to use the new getNameWithPrefix() method instead of getMangledName.
llvm-svn: 93643
2010-01-16 18:12:14 +00:00
Chris Lattner d3a2163069 add an inefficient version of getNameWithPrefix that returns an std::string.
llvm-svn: 93641
2010-01-16 18:06:34 +00:00
Benjamin Kramer 41cab696fc Revive dead assert.
llvm-svn: 93638
2010-01-16 16:14:55 +00:00
Anton Korobeynikov 803c60c012 Provide magic define on mingw to not generate inline variants of ctyper functions.
Otherwise we'll end with random cyclic deps between libraries due to this.
Proposed by Gianluigi Tiesi!

llvm-svn: 93635
2010-01-16 14:06:58 +00:00
Tobias Grosser b478d3e0fc Fix PR6047
Nodes that had children outside of the post dominator tree (infinite loops)
where removed from the post dominator tree. This seems to be wrong. Leave them
in the tree.

llvm-svn: 93633
2010-01-16 13:38:07 +00:00
Tobias Grosser 53da3f8da8 Create Generic DOTGraphTraits Printer/Viewer
Move the DOTGraphTraits dotty printer/viewer templates, that were developed for
the dominance tree into their own header file. This will allow reuse in future
passes.

llvm-svn: 93632
2010-01-16 10:56:41 +00:00
Devang Patel 814b7e7488 No need to use WeakVH here.
llvm-svn: 93631
2010-01-16 06:17:40 +00:00
Devang Patel c0e17df3ce Replace DebugLocTuple with DILocation.
llvm-svn: 93630
2010-01-16 06:09:35 +00:00
Chris Lattner a44d8f806b fix build failure.
llvm-svn: 93628
2010-01-16 03:38:27 +00:00
Chris Lattner 32c9512132 remove a couple of actively incorrect uses of getMangledName.
llvm-svn: 93627
2010-01-16 02:16:09 +00:00
Chris Lattner 3a3480fa53 this doesn't need the mangler.
llvm-svn: 93626
2010-01-16 02:15:38 +00:00
Chris Lattner 3d571ff970 more string -> sym, getMangledName is now gone from this file.
llvm-svn: 93624
2010-01-16 02:09:06 +00:00
Chris Lattner 1e26ec35d7 use symbols instead of strings, eliminating a bunch of getMangledName
calls.  Add FIXMEs about a bunch of nondeterminism in stub output.

llvm-svn: 93621
2010-01-16 02:00:23 +00:00
Chris Lattner e4e85a4e75 simplify some code.
llvm-svn: 93619
2010-01-16 01:45:47 +00:00
Bill Wendling bf5cfa1a41 Retrying r91337:
The CIE says that the LSDA point in the FDE section is an "sdata4". That's fine,
but we need it to actually be 4-bytes in the FDE for some platforms. Allow
individual platforms to decide for themselves.

llvm-svn: 93616
2010-01-16 01:40:55 +00:00
Chris Lattner 94d91a5b30 eliminate uses of mangler and simplify code.
llvm-svn: 93615
2010-01-16 01:40:07 +00:00
Chris Lattner a689edd067 fix inverted conditional
llvm-svn: 93614
2010-01-16 01:37:14 +00:00
Chris Lattner a091179b5f CurrentFnName is now dead, remove it.
llvm-svn: 93612
2010-01-16 01:24:10 +00:00
Chris Lattner 53c659f3ab get pic16 off CurrentFnName
llvm-svn: 93610
2010-01-16 01:21:04 +00:00
Chris Lattner fedff0f67d remove the string form of printVisibility.
llvm-svn: 93609
2010-01-16 01:17:26 +00:00
Chris Lattner 426f31f458 switch more stuff onto MCSymbols
llvm-svn: 93608
2010-01-16 01:12:01 +00:00
Bill Wendling efda1e4f0f Temporarily revert r93581. It was causing failures in the ExecutionEngine tests
on the build bots.

llvm-svn: 93606
2010-01-16 01:06:58 +00:00
Chris Lattner 8a38fc33b0 eliminate uses of deprecated mangler apis
llvm-svn: 93605
2010-01-16 01:00:27 +00:00
Chris Lattner 08eff61eeb this teestcase takes a long time to crash, remove it. If someone cares about this, they should file a bug, it's not doing any good as an xfail.
llvm-svn: 93604
2010-01-16 00:53:22 +00:00
Chris Lattner e6b1bef33a switch X86 target off CurFunctionName and MCIze more.
Note that the code wasn't calling DecorateCygMingName
when emitting the ".ascii -export" stuff at the end of
file for DLLExported functions.  I don't know if it should
or not, but I'm preserving behavior.

llvm-svn: 93603
2010-01-16 00:51:39 +00:00
Bob Wilson 97598f0cba Treat indirect branches specially only during pre-regalloc tail duplication,
not during the later post-alloc tail duplication.

llvm-svn: 93600
2010-01-16 00:42:25 +00:00
Chris Lattner 274c0c0db3 MCize tis, and make it keep CurrentFnSym up to date with CurrentFnName.
llvm-svn: 93598
2010-01-16 00:32:38 +00:00
Bob Wilson 298cdac99c Run the pre-register allocation tail duplication pass by default. Remove
the -pre-regalloc-taildup command-line option, and add a new
-disable-early-taildup option.

llvm-svn: 93597
2010-01-16 00:29:50 +00:00
Chris Lattner c6d3d82798 revert the x86 part of my last patch, cygwin is mutating CurrentFnName!
llvm-svn: 93595
2010-01-16 00:24:20 +00:00
Chris Lattner 719e908e7c MCize a bunch more stuff, eliminating a lot of uses of the mangler
and CurrentFnName.

llvm-svn: 93594
2010-01-16 00:21:18 +00:00
Daniel Dunbar 6d8f59e65f Fix llvm_supports_binding for lit, problem noticed by Bob!
llvm-svn: 93591
2010-01-16 00:00:20 +00:00
Chris Lattner 8b96af5665 remove two write-only sets.
llvm-svn: 93590
2010-01-15 23:56:03 +00:00
Chris Lattner ae9b9eed18 supplement CurrentFnName with CurrentFnSym, which will eventually
replace it.  Upgrade Alpha, Blackfin, and part of CellSPU to not
use mangler anymore.  CellSPU needs more invasive surgery.

llvm-svn: 93589
2010-01-15 23:55:16 +00:00
Erick Tryzelaar fb47255591 Fix bug 5992: O'Caml's llvm_create_module was treating the context as a string.
Thanks Andy Ray for catching this!

llvm-svn: 93588
2010-01-15 23:49:16 +00:00
Chris Lattner 7fec180909 add a version of AsmPrinter::printVisibility that takes an MCSymbol.
llvm-svn: 93587
2010-01-15 23:38:51 +00:00
Chris Lattner 6394a6e285 use MCSymbol instead of getMangledName() in all cases except one.
llvm-svn: 93582
2010-01-15 23:31:55 +00:00
Ted Kremenek 12821816c6 BumpPtrAllocator: Have the DefaultSlabAllocator created at runtime, not initialization time. This removes one of the 'init_constructors' reported in <rdar://problem/7545356>.
llvm-svn: 93581
2010-01-15 23:29:34 +00:00
Dale Johannesen cb7554a3ab Adjust some comments per review.
llvm-svn: 93580
2010-01-15 23:29:29 +00:00
Dale Johannesen 617603aaee Remove unneeded argument per review.
llvm-svn: 93579
2010-01-15 23:28:49 +00:00
Chris Lattner 45400336ab mc'ize a bunch of symbol stuff, eliminating std::strings.
llvm-svn: 93578
2010-01-15 23:26:49 +00:00
Chris Lattner 0dca0a9650 add another helper
llvm-svn: 93577
2010-01-15 23:25:11 +00:00
David Greene b0c0e6433f Fix PR6019. A load has more than one use if it feeds a bitconvert that
has more than one use.

llvm-svn: 93576
2010-01-15 23:23:41 +00:00
Chris Lattner 91687f6e28 add a AsmPrinter::GetGlobalValueSymbol and GetExternalSymbolSymbol
helper method, use it to simplify some code.

llvm-svn: 93575
2010-01-15 23:18:17 +00:00
Ted Kremenek 1ec62347e5 Update CMake build.
llvm-svn: 93571
2010-01-15 22:59:46 +00:00
Ted Kremenek bda8193caf Update CMake build.
llvm-svn: 93570
2010-01-15 22:59:11 +00:00
Jim Grosbach fd850837a3 add testcase for r93564
llvm-svn: 93567
2010-01-15 22:27:37 +00:00
Dan Gohman 8ea3acbb3d Add comments to the dump() and dumpr() routines.
llvm-svn: 93566
2010-01-15 22:22:58 +00:00
Dale Johannesen 188fa96cf9 DEBUG_VALUE is now variable sized, as it has a
target-dependent memory address representation in it.
Restore X86 printing of DEBUG_VALUE; lowering is
done in X86RegisterInfo using the normal algorithm.

llvm-svn: 93565
2010-01-15 22:22:35 +00:00
Jim Grosbach d1a8a7819c Update Thumb1 storeRegToStackSlot() and loadRegFromStackSlot() to properly
handle physical registers R0-R7 when described as having a non-tGPR register
class.

llvm-svn: 93564
2010-01-15 22:21:03 +00:00
Dan Gohman d2968c4c12 Fix a typo that Anton noticed.
llvm-svn: 93563
2010-01-15 22:18:15 +00:00
Devang Patel 0633820599 Add FIXME.
llvm-svn: 93562
2010-01-15 22:08:16 +00:00
Bob Wilson e0da4b6cff Fix a comment typo.
llvm-svn: 93560
2010-01-15 21:55:02 +00:00
Chris Lattner c2f8f16162 move "Metadata Nodes and Metadata Strings" section to the right place in the
document and edit it.

llvm-svn: 93559
2010-01-15 21:50:19 +00:00
Eric Christopher 8444d7536c Remove the InlineHint attribute. There are no current or planned
users.

llvm-svn: 93558
2010-01-15 21:36:30 +00:00
Anton Korobeynikov a6450df92a zext / truncate is free on msp430. Inform codegen about this.
llvm-svn: 93556
2010-01-15 21:19:43 +00:00
Anton Korobeynikov 07e8171fcb Reenable tests
llvm-svn: 93555
2010-01-15 21:19:26 +00:00
Anton Korobeynikov ce52fd5f93 Add branch relaxation pass (shamelessly stolen from PPC).
llvm-svn: 93554
2010-01-15 21:19:05 +00:00
Anton Korobeynikov 71471293a5 Provide instruction sizes & encoding. No opcodes yet (but not needed so far).
llvm-svn: 93553
2010-01-15 21:18:39 +00:00
Anton Korobeynikov 93a7d026a8 Enable bit tests and setcc stuff.
llvm-svn: 93552
2010-01-15 21:18:18 +00:00
Anton Korobeynikov 6826ce7e96 Add micro-optimization which allows us to fold imm into cmp. This allows us to save 1 word (sometimes) and reduce register pressure.
llvm-svn: 93551
2010-01-15 21:18:02 +00:00
Anton Korobeynikov e57b234b88 Add instruction formats & support stuff
llvm-svn: 93550
2010-01-15 21:17:13 +00:00
Jakob Stoklund Olesen 834d70d3df Don't make changes to the MBB in MachineBasicBlock::canFallThrough().
This fixes the regression for -pre-regalloc-taildup in
MultiSource/Applications/lambda-0.1.3.

llvm-svn: 93541
2010-01-15 20:00:12 +00:00
Jakob Stoklund Olesen 73ef9556dd Simplify logic. Any functional change is unintended.
llvm-svn: 93540
2010-01-15 19:59:57 +00:00
Chris Lattner 18bcf30497 unbreak the build, grr symlinks.
llvm-svn: 93539
2010-01-15 19:51:05 +00:00
David Greene 554039a914 Add some debug routines to SelectionDAG to dump full DAGs.
print/dumpWithDepth allows one to dump a DAG up to N levels deep.
dump/printWithFullDepth prints the whole DAG, subject to a depth limit
on 100 in the default case (to prevent infinite recursion).

Have CannotYetSelect to a dumpWithFullDepth so it is clearer exactly
what the non-matching DAG looks like.

llvm-svn: 93538
2010-01-15 19:43:23 +00:00
Chris Lattner e17df0b7f0 fix a bug in range information for $42, eliminate an
unneeded argument from ParseExpression.

llvm-svn: 93536
2010-01-15 19:39:23 +00:00
Chris Lattner 015cfb1577 add range information for mem X86Operand's, now all
X86Operand's have range info.

llvm-svn: 93535
2010-01-15 19:33:43 +00:00
Chris Lattner 528d00b913 extend MCAsmParser::ParseExpression and ParseParenExpression
to return range information for subexpressions.  Use this to
provide range info for several new X86Operands.

llvm-svn: 93534
2010-01-15 19:28:38 +00:00
Chris Lattner 86e6153382 give X86Operand a ctor and start passing SMLoc's into it.
llvm-svn: 93532
2010-01-15 19:06:59 +00:00
Victor Hernandez b324e66f4c Improve llvm.dbg.declare intrinsic by referring directly to the storage in its first argument, via function-local metadata (instead of via a bitcast).
This patch also cleans up code that expects there to be a bitcast in the first argument and testcases that call llvm.dbg.declare.
It also strips old llvm.dbg.declare intrinsics that did not pass metadata as the first argument.

llvm-svn: 93531
2010-01-15 19:04:09 +00:00
Dale Johannesen fb85dddba0 Revert 93499. After discussion with Chris we agreed
FrameIndexes should be lowered, but the same way as
everything else (target dependent) rather than in a
special hacked way.  The lowering needs to be done
for eventual purposes of Dwarf generation.

llvm-svn: 93530
2010-01-15 18:58:14 +00:00
Chris Lattner 0c2538fee2 add range location info for registers, change
X86Operand::Create* implementations to avoid
copy ctor use.

llvm-svn: 93528
2010-01-15 18:51:29 +00:00
Nate Begeman d232150b83 Hook up llc's -filetype=obj to use MCStreamer if an MCCodeEmitter is available.
Remove most of old Mach-O Writer support, it has been replaced by MCMachOStreamer

Further refactoring to completely remove MachOWriter and drive the object file
writer with the AsmPrinter MCInst/MCSection logic is forthcoming.

llvm-svn: 93527
2010-01-15 18:51:18 +00:00
Chris Lattner a2bbb7cbc6 clean up the memory management of the operands.
llvm-svn: 93526
2010-01-15 18:44:13 +00:00
Chris Lattner cc2ad08a11 refactor ParseRegister to avoid using X86Operand as a temporary
datastructure when parsing a mem operand.

llvm-svn: 93521
2010-01-15 18:27:19 +00:00
Chris Lattner 97257f8e40 mention that unwind isn't to be trusted, patch by Dustin Laurence
llvm-svn: 93518
2010-01-15 18:08:37 +00:00
Victor Hernandez 8d4904b639 Revert r93504 because older uses of llvm.dbg.declare intrinsics need to be auto-upgraded
llvm-svn: 93515
2010-01-15 17:36:47 +00:00
Jay Foad 306f155a84 Test case for http://llvm.org/PR6028.
llvm-svn: 93511
2010-01-15 11:29:26 +00:00
Jay Foad bcbdbfb345 Fix http://llvm.org/PR6028, an assertion failure when an UndefValue of
integer type is used.

llvm-svn: 93509
2010-01-15 08:32:58 +00:00
Bob Wilson 1a234c0aee Change pre-regalloc tail duplication to only duplicate indirect branch blocks.
The pre-regalloc pass caused some regressions in both compile time and
performance of the generated code, and it did not improve performance, except
for indirect branches.  I also moved the check for single-block loops to speed
up the common case when running the taildup pass before reg allocation.

llvm-svn: 93505
2010-01-15 06:29:17 +00:00
Victor Hernandez 5d6551816b Improve llvm.dbg.declare intrinsic by referring directly to the storage in its first argument, via function-local metadata (instead of via a bitcast).
This patch also cleans up code that expects there to be a bitcast in the first argument and testcases that call llvm.dbg.declare.

llvm-svn: 93504
2010-01-15 03:37:48 +00:00
Anton Korobeynikov 3a0b066d24 Temporary disable tests
llvm-svn: 93501
2010-01-15 02:09:27 +00:00
Dale Johannesen 0e7e55da1d Lower FrameIndex operand of DEBUG_VALUE (specially) and
print it as a comment on X86.

llvm-svn: 93499
2010-01-15 01:54:55 +00:00
Dale Johannesen 881ba0bb92 Remove DEBUG_DECLARE, looks like we don't need it.
Also, DEBUG_VALUE has side effects.

llvm-svn: 93498
2010-01-15 01:50:44 +00:00
Anton Korobeynikov cefa7addc8 Fix cmp emission on msp430: we definitely should turn stuff like
"icmp lhs, rhs" into "cmp rhs, lhs". This should fix PR5979.

llvm-svn: 93496
2010-01-15 01:29:49 +00:00
Devang Patel 89880c8224 Do not use AT_specification die for static variables. It confuses gdb.
llvm-svn: 93494
2010-01-15 01:12:22 +00:00
Jeffrey Yasskin 1dae4e6c2a Make sure include/llvm/MC/MCParsedAsmOperand.h can be compiled alone.
llvm-svn: 93492
2010-01-15 00:41:53 +00:00
Jim Grosbach 4f1b0ded75 fix 80-column violations
llvm-svn: 93487
2010-01-15 00:36:15 +00:00
Devang Patel 01e2bfd79b new test case for r93485.
llvm-svn: 93486
2010-01-15 00:34:26 +00:00
Jim Grosbach 2e3abd7e82 Fix 80 column violations and clean up whitespace
llvm-svn: 93484
2010-01-15 00:32:47 +00:00
Devang Patel 2108ee075f Do not emit multiple AT_container_type attributes.
We need to find a better way to emit this info.

llvm-svn: 93481
2010-01-15 00:26:31 +00:00
Jim Grosbach 029fbd984b Name change for consistency. No functional change.
llvm-svn: 93480
2010-01-15 00:22:18 +00:00
Jim Grosbach d0860d6e02 EmitAtomicCmpSwap() custome inserter needs to delete the MI passed in. EmitAtomicBinary() already does this.
llvm-svn: 93479
2010-01-15 00:18:34 +00:00
Jeffrey Yasskin 3aa70b2c4f Teach PPC how to replaceMachineCodeForFunction correctly. (Fixes
JITTest.FunctionIsRecompiledAndRelinked.)

llvm-svn: 93475
2010-01-14 23:15:26 +00:00
Eric Christopher f567e1b426 Pad my commit stats by reducing indentation in this now separate
commit.

llvm-svn: 93473
2010-01-14 23:00:10 +00:00
Johnny Chen 0f45f4f849 Added 16-bit Thumb Load/Store immediate instructions with encoding bits so that
the disassembler can properly decode Load/Store register/immediate instructions.

llvm-svn: 93471
2010-01-14 22:42:17 +00:00
Chris Lattner 14bf521792 add virtual methods to get the start/end of a MCParsedAsmOperand,
the default implementation returns "unknown".

llvm-svn: 93470
2010-01-14 22:29:57 +00:00
Chris Lattner f29c0b6880 Split the TargetAsmParser "ParseInstruction" interface in half:
the new ParseInstruction method just parses and returns a list of
target operands.  A new MatchInstruction interface is used to
turn the operand list into an MCInst.

This requires new/deleting all the operands, but it also gives 
targets the ability to use polymorphic operands if they want to. 

llvm-svn: 93469
2010-01-14 22:21:20 +00:00
Anton Korobeynikov fdf7031a1a Add variable-width shifts for MSP430
llvm-svn: 93468
2010-01-14 22:09:38 +00:00
Anton Korobeynikov abf4ef0ee1 Remove pseudo-MI in custom inserter.
llvm-svn: 93467
2010-01-14 22:09:11 +00:00
Dale Johannesen b297cdd937 Fix a comment.
llvm-svn: 93463
2010-01-14 21:50:17 +00:00
Eric Christopher 35dd9e8e1d Few minor changes that were requested. No functional change.
llvm-svn: 93462
2010-01-14 21:48:00 +00:00
Jim Grosbach 9ae81816bc Add comment explaining the necessity of r93456
llvm-svn: 93459
2010-01-14 21:38:31 +00:00
Chris Lattner 77fd677111 prune #includes in TargetAsmParser.h
Pass in SMLoc of instr opcode into ParseInstruction.
Make AsmToken be a class, not a struct.

llvm-svn: 93457
2010-01-14 21:32:45 +00:00
Jim Grosbach 0868567fc3 Dwarf EH prepare needs to be run after SjLj prepare. Otherwise,
catch info can get misplaced when a selector ends up more than one block
removed from the parent invoke(s). This could happen when a landing pad is
shared by multiple invokes and is also a target of a normal edge from
elsewhere.

llvm-svn: 93456
2010-01-14 21:22:16 +00:00
Chris Lattner ecc8eece7d introduce MCParsedAsmOperand
llvm-svn: 93455
2010-01-14 21:21:40 +00:00
Chris Lattner 872501b6e0 introduce the MCParsedAsmOperand class.
llvm-svn: 93454
2010-01-14 21:20:55 +00:00
Evan Cheng 8e670ee381 Small tweak to inline cost computation. Ext of i/fcmp results are mostly optimized away in codegen.
llvm-svn: 93453
2010-01-14 21:04:31 +00:00
Anton Korobeynikov 105682dc96 Remove spurious semicolon.
Patch by Diego Iastrubni!

llvm-svn: 93450
2010-01-14 20:19:51 +00:00
Victor Hernandez 8296da7b56 In debug builds, assert that function-local metadata has only 1 parent function
llvm-svn: 93449
2010-01-14 20:12:34 +00:00
Eric Christopher f3ac066418 Reduce the inlining cost of functions that contain calls to easily,
and frequently optimized functions.

llvm-svn: 93448
2010-01-14 20:12:34 +00:00
Victor Hernandez 572218b53b Simplify code that chooses when to enumerate function-local metadata operands
llvm-svn: 93446
2010-01-14 19:54:11 +00:00
Victor Hernandez 36aee30dfb Avoid modifying ValueEnumerator's MD ValueList by choosing which function-local MD to write based on the function currently being written
llvm-svn: 93441
2010-01-14 19:38:44 +00:00
Jakob Stoklund Olesen 0ca14e4498 ARM "l" constraint for inline asm means R0-R7, also for Thumb2.
This is consistent with llvm-gcc's arm/constraints.md.

Certain instructions (e.g. CBZ, CBNZ) require a low register, even in Thumb2
mode.

llvm-svn: 93436
2010-01-14 18:19:56 +00:00
Bill Wendling 22fe58e1b9 Use ENABLE_ASSERTIONS throughout.
llvm-svn: 93423
2010-01-14 10:19:55 +00:00
Dan Gohman dd5286dc63 Fix a codegen abort seen in 483.xalancbmk.
llvm-svn: 93417
2010-01-14 03:08:49 +00:00
Evan Cheng 37463a7a58 Test for r93409.
llvm-svn: 93410
2010-01-14 02:24:50 +00:00
Victor Hernandez d2b4f36986 Extend testcase to also test llvm.dbg.value intrinsic
llvm-svn: 93408
2010-01-14 02:12:41 +00:00
Victor Hernandez b658d30b91 Now that LLParser, AsmWriter, BitcodeReader, and BitcodeWriter all correctly support function-local metadata, test it.
llvm-svn: 93406
2010-01-14 01:51:28 +00:00
Victor Hernandez 6c730dea6f In WriteFunction(), write function-local metadata before we write the instructions, so instruction's references to metadata are fully resolved by the time they get written.
llvm-svn: 93403
2010-01-14 01:50:08 +00:00
Victor Hernandez 61e6e829c6 Fix printing of function-local metadata in AsmWriter
llvm-svn: 93402
2010-01-14 01:47:37 +00:00
Victor Hernandez b816154268 Clean up unnecessary return and brackets
llvm-svn: 93401
2010-01-14 01:46:02 +00:00
Victor Hernandez 8c85e25589 Add MDNode::getFunction(), which figures out the metadata's function, if it has function that it is local to.
llvm-svn: 93400
2010-01-14 01:45:14 +00:00
Jakob Stoklund Olesen bff090648b Don't fold insufficiently aligned ldr/str into ldm/stm instructions.
An unaligned ldr causes a trap, and is then emulated by the kernel with
awesome performance. The darwin kernel does not emulate unaligned ldm/stm
Thumb2 instructions, so don't generate them.

This fixes the miscompilation of Multisource/Applications/JM/lencod for Thumb2.

Generating unaligned ldr/str pairs from a 16-bit aligned memcpy is probably
also a bad idea, but that is beyond the scope of this patch.

llvm-svn: 93393
2010-01-14 00:54:10 +00:00
Stuart Hastings e355daf7b0 Erm, previous patch was wrong; Thanks Bill\!
llvm-svn: 93381
2010-01-14 00:34:53 +00:00
Stuart Hastings b65256c414 Enable assertions by default for Apple-style builds.
llvm-svn: 93380
2010-01-14 00:22:05 +00:00
Chris Lattner 3eb76c23dd this is an SSE-specific issue.
llvm-svn: 93373
2010-01-13 23:29:11 +00:00
Chris Lattner fb534d97b5 X86 if conversion + tail merging issues from PR6032.
llvm-svn: 93372
2010-01-13 23:28:40 +00:00
Bill Wendling ad7a5b07a7 When the visitSub method was split into visitSub and visitFSub, this xform was
added to the FSub version. However, the original version of this xform guarded
against doing this for floating point (!Op0->getType()->isFPOrFPVector()).

This is causing LLVM to perform incorrect xforms for code like:

void func(double *rhi, double *rlo, double xh, double xl, double yh, double yl){
  double mh, ml;
  double c = 134217729.0;
  double up, u1, u2, vp, v1, v2;
        
  up = xh*c;
  u1 = (xh - up) + up;
  u2 = xh - u1;
        
  vp = yh*c;
  v1 = (yh - vp) + vp;
  v2 = yh - v1;
        
  mh = xh*yh;
  ml = (((u1*v1 - mh) + (u1*v2)) + (u2*v1)) + (u2*v2);
  ml += xh*yl + xl*yh;
        
  *rhi = mh + ml;
  *rlo = (mh - (*rhi)) + ml;
}

The last line was optimized away, but rl is intended to be the difference
between the infinitely precise result of mh + ml and after it has been rounded
to double precision.

llvm-svn: 93369
2010-01-13 23:23:17 +00:00
Tobias Grosser e77d17b73a Add getSource() to SuccIterator
Get the source BB of an iterator.

llvm-svn: 93364
2010-01-13 22:21:43 +00:00
Tobias Grosser ad3f4bd6f9 Extend SuccIterator
Implement most of the missing methods to make SuccIterator random access.
operator[] is still missing.

llvm-svn: 93363
2010-01-13 22:21:28 +00:00
Chris Lattner fb40a8e5f1 this test requires SSE, thanks to jyasskin for pointing this out.
llvm-svn: 93360
2010-01-13 21:51:41 +00:00
Chris Lattner 4cfd5835c9 makeNameProper is now private!
llvm-svn: 93357
2010-01-13 21:31:39 +00:00
Chris Lattner ccbeed2af4 fix ELF section mangling stuff for weak symbols to not use
obsolete Mangler interfaces.

llvm-svn: 93356
2010-01-13 21:29:21 +00:00
Victor Hernandez 9c203e362a Fix comment typo
llvm-svn: 93355
2010-01-13 21:25:04 +00:00
Chris Lattner b9d1f5a006 tidy
llvm-svn: 93352
2010-01-13 21:21:29 +00:00
Chris Lattner 51d6cc4bdb reduce duplicate mangling logic by using MCSymbol::printMangledName.
llvm-svn: 93351
2010-01-13 21:12:34 +00:00
Chris Lattner 8361006264 expose a static function as a static method on the MCSymbol class.
llvm-svn: 93350
2010-01-13 21:09:59 +00:00
Johnny Chen b34888b6d0 Fixed a couple of places for Thumb MOV where encoding bits are underspecified.
llvm-svn: 93349
2010-01-13 21:00:26 +00:00
Jakob Stoklund Olesen fcf91ee403 Fix pasto
llvm-svn: 93342
2010-01-13 19:54:39 +00:00
Chris Lattner c5b7dcf552 stop the CBE from using deprecated Mangler stuff.
llvm-svn: 93341
2010-01-13 19:54:07 +00:00
Victor Hernandez b00a6beef6 Write function-local metadata as a metadata subblock of a funciton block
llvm-svn: 93339
2010-01-13 19:37:33 +00:00
Victor Hernandez cad7328d8c Enumerate function-local metadata (and its types and operands) only during function-incorporation, global metadata continues to be enumerated during creation of ValueEnumerator
llvm-svn: 93338
2010-01-13 19:36:16 +00:00
Victor Hernandez 108d3acb43 Parse function-local metadata inside function blocks
llvm-svn: 93337
2010-01-13 19:34:08 +00:00
Chris Lattner 643b817d92 Use the GV version of getNameWithPrefix in TargetLoweringObjectFileCOFF::
SelectSectionForGlobal, unbreaking weak globals with no-name.

llvm-svn: 93336
2010-01-13 19:19:17 +00:00
Evan Cheng af0ad65ff2 Commit some changes I had managed to lose last night while refactoring the code. Avoid change use of PHI instructions because it's not legal to insert any instructions before them.
This fixes PR6027.

llvm-svn: 93335
2010-01-13 19:16:39 +00:00
Chris Lattner a9365352cf just finish MCizing FnStubInfo which cleans it up and simplifies it.
llvm-svn: 93334
2010-01-13 19:13:16 +00:00
Chris Lattner 45faea454d don't call getNameWithPrefix repeatedly and unnecesarily.
llvm-svn: 93333
2010-01-13 19:05:36 +00:00
Chris Lattner 9148f36e90 properly use MCSymbol to print the strings aquired from getNameWithPrefix.
llvm-svn: 93332
2010-01-13 19:00:57 +00:00
Benjamin Kramer 2e06b93f43 Introduce Twine::toStringRef, a variant of toVector which avoids the copy if the
twine can be represented as a single StringRef. Use the new methode to simplify
some twine users.

llvm-svn: 93317
2010-01-13 12:45:23 +00:00
Evan Cheng b5499d09d1 Re-enable extension optimization pass.
llvm-svn: 93313
2010-01-13 08:45:40 +00:00
Chris Lattner ede8ad45bc upgrade and MC'ize a few uses of makeNameProper.
llvm-svn: 93310
2010-01-13 08:08:33 +00:00
Chris Lattner 4cd281dab1 MC'ize this a bit and upgrade APIs
llvm-svn: 93309
2010-01-13 08:04:24 +00:00
Chris Lattner b0dc959e1d add a fixme, ELF MCSection isn't quite right and weak unnamed globals are broken
on linux (even though they are pointless, they shouldn't ICE).

llvm-svn: 93308
2010-01-13 08:02:14 +00:00
Evan Cheng ceb5a4e8f6 For now, avoid issuing extract_subreg to reuse lower 8-bit, it's not safe in 32-bit.
llvm-svn: 93307
2010-01-13 08:01:32 +00:00
Evan Cheng 957b8beaaa Add comment; refactor; avoid pulling in DT if it's not used.
llvm-svn: 93306
2010-01-13 07:59:13 +00:00
Chris Lattner f0a401fcf0 eliminate some uses of Mangler::makeNameProper.
llvm-svn: 93305
2010-01-13 07:56:59 +00:00
Chris Lattner 98b05e017b don't add the \1 to the name.
llvm-svn: 93304
2010-01-13 07:50:21 +00:00
Chris Lattner 25d8ed3773 remove uses of deprecated functions, this generates slightly
different BlockAddress labels, but nothing semantically important.

Add a FIXME that BlockAddress codegen is broken if the LLVM BB has 
an empty name (e.g. strip was run).

llvm-svn: 93303
2010-01-13 07:30:49 +00:00
Chris Lattner 2b630fe822 use the new form of getNameWithPrefix, not makeNameProper.
Among other things, this would do very weird things if the 
basic block name had (e.g.) a space in it on darwin:
makeNameProper would add quotes, then the mcsymbol would 
escape the quotes.

llvm-svn: 93302
2010-01-13 07:16:53 +00:00
Chris Lattner 1126534dce add new isSingleStringRef()/getSingleStringRef() methods to twine,
and use them to avoid a copy of a string in getNameWithPrefix in
the common case.  It seems like Value::setName and other places 
should use this as well?

llvm-svn: 93301
2010-01-13 07:12:06 +00:00
Chris Lattner 33535b3250 ugh, my last patch just sped up a method and changed all the clients
that I want to completely eliminate.  Add fixme's so I remember this
in the future, and add the missing helper that they should be upgraded
to use instead.

llvm-svn: 93300
2010-01-13 07:01:09 +00:00
Chris Lattner 209aecad0c change Mangler::makeNameProper to return its result in a SmallVector
instead of returning it in an std::string.  Based on this change:

1. Change TargetLoweringObjectFileCOFF::getCOFFSection to take a StringRef
2. Change a bunch of targets to call makeNameProper with a smallstring,
   making several of them *much* more efficient.
3. Rewrite Mangler::makeNameProper to not build names and then prepend
   prefixes, not use temporary std::strings, and to avoid other crimes.

llvm-svn: 93298
2010-01-13 06:38:18 +00:00
Chris Lattner b252cbb04c my mistake, Mangler::makeNameProper wants to take a twine, not a stringref!
llvm-svn: 93296
2010-01-13 05:02:57 +00:00
Chris Lattner 04a7ce850d change makeNameProper to take a stringref instead of std::string.
llvm-svn: 93295
2010-01-13 04:55:33 +00:00
Chris Lattner e192d377c5 give StringRef a const_iterator member.
llvm-svn: 93294
2010-01-13 04:50:20 +00:00
Chris Lattner 8e26d19cb3 fix assert in AsmPrinter::EmitGlobalConstantLargeInt to match reality.
llvm-svn: 93293
2010-01-13 04:39:46 +00:00
Chris Lattner 4581a4f03a reduce nesting and code duplication in AsmPrinter::EmitGlobalConstantLargeInt.
llvm-svn: 93292
2010-01-13 04:38:16 +00:00
Chris Lattner a32ba6d056 reduce indentation and add a fast-path to EmitGlobalConstant for 8-byte
integers on 64-bit systems.

llvm-svn: 93291
2010-01-13 04:34:19 +00:00
Chris Lattner 7e0c164b5e reduce indentation and use early exits in AsmPrinter::EmitConstantValueOnly
llvm-svn: 93290
2010-01-13 04:29:19 +00:00
Victor Hernandez 013a91ddfe Revert 93270 pending investigation of how stray non-constant values end up in ValueEnumerator's ValueList during WriteConstants()
llvm-svn: 93289
2010-01-13 03:18:30 +00:00
Evan Cheng d7d8f6d000 Disable opt-ext pass to unbreak the build for now.
llvm-svn: 93286
2010-01-13 01:51:43 +00:00
Evan Cheng 7a4bac3000 Remove debug option I accidentally left in.
llvm-svn: 93285
2010-01-13 01:43:20 +00:00
Dale Johannesen 93e42c5435 Fix a comment.
llvm-svn: 93284
2010-01-13 01:39:38 +00:00
Ted Kremenek 451a965a78 Update CMake file.
llvm-svn: 93283
2010-01-13 01:02:47 +00:00
Jakob Stoklund Olesen a94837dc24 Remove the JustSP single-register regclass.
It was only being used by instructions with the t_addrmode_sp addressing mode,
and that is pattern matched in a way that guarantees SP is used. There is
never any register allocation done from this class.

llvm-svn: 93280
2010-01-13 00:43:06 +00:00
Jeffrey Yasskin 0ad23efb0f Try to fix the ARM and PPC buildbots. The -mattr=vector-unaligned-mem
flag doesn't exist there, and this is an x86 test.

llvm-svn: 93279
2010-01-13 00:31:43 +00:00
Evan Cheng 30bebff456 Add a quick pass to optimize sign / zero extension instructions. For targets where the pre-extension values are available in the subreg of the result of the extension, replace the uses of the pre-extension value with the result + extract_subreg.
For now, this pass is fairly conservative. It only perform the replacement when both the pre- and post- extension values are used in the block. It will miss cases where the post-extension values are live, but not used.

llvm-svn: 93278
2010-01-13 00:30:23 +00:00
Dale Johannesen 7b1a7ed330 Further progration of metadata operands. The
dumper doesn't really do what I want yet, but
at least it doesn't crash now.

llvm-svn: 93272
2010-01-13 00:00:24 +00:00
Victor Hernandez fc4aefb129 Make WriteConstants() more robust against stray values in ValueEnumerator's ValueList
llvm-svn: 93270
2010-01-12 23:37:59 +00:00
Bob Wilson 5b562906ac Fix a comment typo.
llvm-svn: 93261
2010-01-12 22:18:56 +00:00
Chris Lattner 3b96c8ae1d use consistent tag kinds for ilist_traits
llvm-svn: 93259
2010-01-12 22:00:04 +00:00
Chris Lattner 573da8ac90 1) Use the new SimplifyInstructionsInBlock routine instead of the copy
in JT.

2) When cloning blocks for PHI or xor conditions, use
instsimplify to simplify the code as we go.  This allows us to 
squish common cases early in JT which opens up opportunities for
subsequent iterations, and allows it to completely simplify the
testcase.

llvm-svn: 93253
2010-01-12 20:41:47 +00:00
Chris Lattner 7c743f2c74 add a helper function.
llvm-svn: 93251
2010-01-12 19:40:54 +00:00
Devang Patel f76941ed83 Use Twine, instead of StringRef, for consistency.
llvm-svn: 93249
2010-01-12 18:57:56 +00:00
Devang Patel 943ddf666d Use ilist_tratis to autoinsert and remove NamedMDNode from MDSymbolTable.
llvm-svn: 93247
2010-01-12 18:34:06 +00:00
Evan Cheng 08557ef5f4 Eliminate or_not_add and just use AddedComplexity so isel tries or_is_add patterns first.
llvm-svn: 93245
2010-01-12 18:31:19 +00:00
Evan Cheng 0e9189371f Add nounwind.
llvm-svn: 93244
2010-01-12 18:29:23 +00:00
Duncan Sands b7168c270e Revert commit 93204, since it causes the assembler to barf
on x86-64 linux with messages like this:
Error: Incorrect register `%r14' used with `l' suffix

llvm-svn: 93242
2010-01-12 17:46:16 +00:00
Duncan Sands 0067d6bbbe Fix typo.
llvm-svn: 93235
2010-01-12 08:30:46 +00:00
Duncan Sands fd75e12954 Tweak commit 91745, which changed target data for both Mingw and Cygwin,
to not touch Cygwin: the change caused llvm-gcc build failures due to
long double getting the wrong size.  Patch by Aaron Gray.

llvm-svn: 93234
2010-01-12 08:21:07 +00:00
Dan Gohman 9059833de6 Make several tests less fragile.
llvm-svn: 93230
2010-01-12 04:52:47 +00:00
Dan Gohman c119580307 Reapply the MOV64r0 patch, with a fix: MOV64r0 clobbers EFLAGS.
llvm-svn: 93229
2010-01-12 04:42:54 +00:00
Dan Gohman d49763d200 Update a partially obsolete comment.
llvm-svn: 93228
2010-01-12 04:32:35 +00:00
Dan Gohman f9d6d53823 Fix a typo in a comment.
llvm-svn: 93227
2010-01-12 04:30:26 +00:00
Chris Lattner af7855d571 tidy up
llvm-svn: 93222
2010-01-12 02:07:50 +00:00
Chris Lattner eb73bdb2e1 Teach jump threading to duplicate small blocks when the branch
condition is a xor with a phi node.  This eliminates nonsense
like this from 176.gcc in several places:

 LBB166_84:
        testl   %eax, %eax
-       setne   %al
-       xorb    %cl, %al
-       notb    %al
-       testb   $1, %al
-       je      LBB166_85
+       je      LBB166_69
+       jmp     LBB166_85

This is rdar://7391699

llvm-svn: 93221
2010-01-12 02:07:17 +00:00
Dale Johannesen 585f82b6f6 Add MO_Metadata as an operand kind. Not used yet.
llvm-svn: 93220
2010-01-12 02:01:53 +00:00
Evan Cheng 4216615f99 Add TargetInstrInfo::isCoalescableInstr. It returns true if the specified
instruction is copy like where the source and destination registers can
overlap. This is to be used by the coalescable to coalesce the source and
destination registers of instructions like X86::MOVSX64rr32. Apparently
some crazy people believe the coalescer is too simple.

llvm-svn: 93210
2010-01-12 00:09:37 +00:00
Chris Lattner 6a19ed0b86 some cleanup, and make it obvious that ProcessJumpOnPHI only works
on branches by renaming it and checking for a branch at the call site.

llvm-svn: 93208
2010-01-11 23:41:09 +00:00
Chris Lattner 2d2c0a00ad disable this testcase, PR5997
llvm-svn: 93206
2010-01-11 23:18:33 +00:00
Evan Cheng 42b07e9600 Add manual ISD::OR fastisel selection routines. TableGen is no longer autogen them after 93152 and 93191.
llvm-svn: 93204
2010-01-11 22:59:27 +00:00
Victor Hernandez 0b62cc6dc4 Add documentation for llvm.dbg.value intrinsic
llvm-svn: 93203
2010-01-11 22:53:48 +00:00
Chris Lattner d1a3efedd8 reenable the piece that turns trunc(zext(x)) -> x even if zext has multiple uses,
codegen has no apparent problem with the trunc version of this, because it turns
into a simple subreg idiom

llvm-svn: 93202
2010-01-11 22:49:40 +00:00
Chris Lattner a6b1356cf9 Disable folding sext(trunc(x)) -> x (and other similar cast/cast cases) when the
trunc has multiple uses.  Codegen is not able to coalesce the subreg case 
correctly and so this leads to higher register pressure and spilling (see PR5997).

This speeds up 256.bzip2 from 8.60 -> 8.04s on my machine, ~7%.

llvm-svn: 93200
2010-01-11 22:45:25 +00:00
Victor Hernandez 9d75c966e0 Consolidate ConvertGlobalValIDToValue, ConvertGlobalOrMetadataValIDToValue, and ConvertValIDToValue into a more powerful ConvertValIDToValue() that does all three's work
llvm-svn: 93197
2010-01-11 22:31:58 +00:00
Tobias Grosser b53e826103 Remove trailing white spaces in post dominators header file
llvm-svn: 93195
2010-01-11 22:22:46 +00:00
Tobias Grosser 829e8a75a1 Add getNode() to post dominators.
Implement the same interface as already available for dominators.

llvm-svn: 93194
2010-01-11 22:22:32 +00:00
Evan Cheng 99789a7a76 Extend r93152 to work on OR r, r. If the source set bits are known not to overlap, then select as an ADD instead.
llvm-svn: 93191
2010-01-11 22:03:29 +00:00
Chris Lattner f0d26d4b74 reduce this to a sensible testcase.
llvm-svn: 93189
2010-01-11 21:58:19 +00:00
David Greene eb103c404b Shorten up this testcase.
llvm-svn: 93187
2010-01-11 21:50:35 +00:00
Evan Cheng 7bdf339602 Revert 93158. It's breaking quite a few x86_64 tests.
llvm-svn: 93185
2010-01-11 21:13:41 +00:00
Jakob Stoklund Olesen d2a1bee2d4 Avoid adding PHI arguments for a predecessor that has gone away when a BRCOND was constant folded.
This fixes PR5980.

llvm-svn: 93184
2010-01-11 21:02:33 +00:00
Benjamin Kramer 93ad708a46 Remove unused string functions.
llvm-svn: 93183
2010-01-11 20:33:12 +00:00
Evan Cheng c5f8184eec Do not turn 8-bit OR to ADD since ADD8ri is not 3-addressfiable.
llvm-svn: 93182
2010-01-11 20:18:04 +00:00
Mon P Wang ec57c81e64 Disable transformation of select of two loads to a select of address and then a load if the
loads are not in the default address space because the transformation discards src value info.

llvm-svn: 93180
2010-01-11 20:12:49 +00:00
Benjamin Kramer 6bf8240762 Add StrInStrNoCase, a StringRef version of CStrInCStrNoCase.
llvm-svn: 93174
2010-01-11 19:45:18 +00:00
Devang Patel d1a8969dd2 Add top level section for named metadata.
llvm-svn: 93172
2010-01-11 19:35:55 +00:00
Jeffrey Yasskin f991bbb0c1 Improve unclear bits and inaccuracies in structure and insertvalue
documentation.

Patch by Dustin Laurence!

llvm-svn: 93170
2010-01-11 19:19:26 +00:00
Jeffrey Yasskin 81e7fb15e9 Update the -tailcallopt description to match djg's improvements to the calling
convention. 

llvm-svn: 93167
2010-01-11 18:53:47 +00:00
Devang Patel 8992323bb9 s/NextValueNo/NextMDValueNo while processing metadata.
llvm-svn: 93165
2010-01-11 18:52:33 +00:00
Benjamin Kramer 0ef736fef2 Turns out llvm-gcc still uses SplitString with a vector. Add it back until I
have a fix.

llvm-svn: 93163
2010-01-11 18:44:35 +00:00
Benjamin Kramer c6fe3c3273 Reimplement getToken and SplitString as "StringRef helper functions"
- getToken is modeled after StringRef::split but it can split on multiple
  separator chars and skips leading seperators.
- SplitString is a StringRef::split variant for more than 2 elements with the
  same behaviour as getToken.

llvm-svn: 93161
2010-01-11 18:03:24 +00:00
Dan Gohman e99a3c191e Use a 32-bit and with implicit zero-extension instead of a 64-bit and if it
has an immediate with at least 32 bits of leading zeros, to avoid needing to
materialize that immediate in a register first.

FileCheckize, tidy, and extend a testcase to cover this case.

This fixes rdar://7527390.

llvm-svn: 93160
2010-01-11 17:58:34 +00:00
Dan Gohman 3a55686345 Re-instate MOV64r0 and MOV16r0, with adjustments to work with the
new AsmPrinter. This is perhaps less elegant than describing them
in terms of MOV32r0 and subreg operations, but it allows the
current register to rematerialize them.

llvm-svn: 93158
2010-01-11 17:37:57 +00:00
Dan Gohman 31e8637ac2 Generalize this check to avoid depending on a specific register assignment.
llvm-svn: 93157
2010-01-11 17:24:27 +00:00
Dan Gohman 355ebc7f58 Make this test less trivial, to avoid spurious failures.
llvm-svn: 93156
2010-01-11 17:23:56 +00:00
Dan Gohman f6e8369a5b Pattern top-level operators don't need to be restricted to a
single user. The _su forms are intended for non-top-level nodes.

llvm-svn: 93155
2010-01-11 17:21:05 +00:00
Dan Gohman 40ea3e5ce2 Reword this comment to reference a more fundamental issue.
llvm-svn: 93154
2010-01-11 17:14:46 +00:00
Evan Cheng 64d9f40557 Select an OR with immediate as an ADD if the input bits are known zero. This allow the instruction to be 3address-fied if needed.
llvm-svn: 93152
2010-01-11 17:03:47 +00:00
David Greene 206351a1ff Implement a feature (-vector-unaligned-mem) to allow targets to
ignore alignment requirements for SIMD memory operands.  This
is useful on architectures like the AMD 10h that do not trap on
unaligned references if a status bit is twiddled at startup time.

llvm-svn: 93151
2010-01-11 16:29:42 +00:00
Victor Hernandez 9ce5b5134d Respond to Chris' review:
Make InsertDbgValueIntrinsic() and get Offset take and recieve a uint64_t.
Get constness correct for getVariable() and getValue().

llvm-svn: 93149
2010-01-11 07:45:19 +00:00
Chris Lattner 9518869423 add one more bitfield optimization, allowing clang to generate
good code on PR4216:

_test_bitfield:                                             ## @test_bitfield
	orl	$32962, %edi
	movl	$4294941946, %eax
	andq	%rdi, %rax
	ret

instead of:

_test_bitfield:
        movl    $4294941696, %ecx
        movl    %edi, %eax
        orl     $194, %edi
        orl     $32768, %eax
        andq    $250, %rdi
        andq    %rax, %rcx
        movq    %rdi, %rax
        orq     %rcx, %rax
        ret

Evan is looking into the remaining andq+imm -> andl optimization.

llvm-svn: 93147
2010-01-11 06:55:24 +00:00
Chris Lattner 0a85420409 Extend CanEvaluateZExtd to handle and/or/xor more aggressively in the
BitsToClear case.  This allows it to promote expressions which have an
and/or/xor after the lshr, promoting cases like test2 (from PR4216) 
and test3 (random extample extracted from a spec benchmark).

clang now compiles the code in PR4216 into:

_test_bitfield:                                             ## @test_bitfield
	movl	%edi, %eax
	orl	$194, %eax
	movl	$4294902010, %ecx
	andq	%rax, %rcx
	orl	$32768, %edi
	andq	$39936, %rdi
	movq	%rdi, %rax
	orq	%rcx, %rax
	ret

instead of:

_test_bitfield:                                             ## @test_bitfield
	movl	%edi, %eax
	orl	$194, %eax
	movl	$4294902010, %ecx
	andq	%rax, %rcx
	shrl	$8, %edi
	orl	$128, %edi
	shlq	$8, %rdi
	andq	$39936, %rdi
	movq	%rdi, %rax
	orq	%rcx, %rax
	ret

which is still not great, but is progress.

llvm-svn: 93145
2010-01-11 04:05:13 +00:00
Chris Lattner 12bd8992b3 Remove the dead TD argument to CanEvaluateZExtd, and add a
new BitsToClear result which allows us to start promoting
expressions that end with a lshr-by-constant.  This is
conservatively correct and better than what we had before
(see testcases) but still needs to be extended further.

llvm-svn: 93144
2010-01-11 03:32:00 +00:00
Chris Lattner 172630abd2 improve comments, remove dead TD argument to CanEvaluateSExtd.
llvm-svn: 93143
2010-01-11 02:43:35 +00:00
Chris Lattner 7dd540ee24 teach sext optimization to handle truncs from types that are not
the dest of the sext.

llvm-svn: 93128
2010-01-10 20:30:41 +00:00
Chris Lattner 39d2daa94c teach zext optimization how to deal with truncs that don't come from
the zext dest type.  This allows us to handle test52/53 in cast.ll,
and allows llvm-gcc to generate much better code for PR4216 in -m64
mode:

_test_bitfield:                                             ## @test_bitfield
	orl	$32962, %edi
	movl	%edi, %eax
	andl	$-25350, %eax
	ret

This also fixes a bug handling vector extends, ensuring that the
mask produced is a vector constant, not an integer constant.

llvm-svn: 93127
2010-01-10 20:25:54 +00:00
Chris Lattner 5370ae7b70 fix a buggy assertion, CreateIntegerCast should allow
integer vectors as well as just integers.

llvm-svn: 93126
2010-01-10 20:21:42 +00:00
Mikhail Glushenkov ed3bd13c3a Suppress a warning on gcc 4.4.
warning: suggest parentheses around ‘&&’ within ‘||’.
llvm-svn: 93121
2010-01-10 18:48:49 +00:00
Chris Lattner 1a05fddcdc simplify CanEvaluateSExtd to return a bool now that we have a
simpler profitability predicate.

llvm-svn: 93111
2010-01-10 07:57:20 +00:00
Chris Lattner d7816780e2 the NumCastsRemoved argument to CanEvaluateSExtd is dead, remove it.
llvm-svn: 93110
2010-01-10 07:42:21 +00:00
Chris Lattner 2fff10c424 now that the cost model has changed, we can always consider
elimination of a sign extend to be a win, which simplifies 
the client of CanEvaluateSExtd, and allows us to eliminate
more casts (examples taken from real code).

llvm-svn: 93109
2010-01-10 07:40:50 +00:00
Victor Hernandez b8fd152d94 Compute isFunctionLocal in MDNode ctor or via argument in new function getWhenValsUnresolved().
Document PFS argument to ParseValID() and ConvertGlobalOrMetadataValIDToValue().

llvm-svn: 93108
2010-01-10 07:14:18 +00:00
Chris Lattner d8509424a4 change the preferred canonical form for a sign extension to be
lshr+ashr instead of trunc+sext.  We want to avoid type 
conversions whenever possible, it is easier to codegen expressions
without truncates and extensions.

llvm-svn: 93107
2010-01-10 07:08:30 +00:00