Commit Graph

8257 Commits

Author SHA1 Message Date
Chris Lattner eb71b17705 Replace the PointerLikeTypeTraits::getNumLowBitsAvailable
function with a new NumLowBitsAvailable enum, which makes the
value available as an integer constant expression.

Add PointerLikeTypeTraits specializations for Instruction* and
Use** since they are only guaranteed 4-byte aligned.

Enhance PointerIntPair to know about (and enforce) the alignment
specified by PointerLikeTypeTraits.  This should allow things 
like PointerIntPair<PointerIntPair<void*, 1,bool>, 1, bool> 
because the inner one knows that 2 low bits are free.

llvm-svn: 67979
2009-03-29 04:32:37 +00:00
Chris Lattner a00f0d7e4c rename PointerLikeTypeInto to PointerLikeTypeTraits, add trait for
# low bits free, and move to its own header.

llvm-svn: 67973
2009-03-29 00:39:30 +00:00
Chris Lattner 8eda11bd9d now that you can put a PointerIntPair in a SmallPtrSet, remove some
hackish workarounds from memdep

llvm-svn: 67971
2009-03-29 00:24:04 +00:00
Chris Lattner dc2999b4df teach SmallPtrSet that PointerIntPair is "basically a pointer".
llvm-svn: 67970
2009-03-29 00:18:42 +00:00
Arnold Schwaighofer 83d5420d02 Enable tail call optimization for functions that return a struct (bug 3664) and for functions that return types that need extending (e.g i1).
llvm-svn: 67934
2009-03-28 08:33:27 +00:00
Chris Lattner 0527eda02e declare everything as class to avoid angering the VC++ gods.
llvm-svn: 67931
2009-03-28 07:48:03 +00:00
Chris Lattner dec48eab86 add a traits class for SmallPtrSet that allows us to stick things that are
"basically pointers" into it.

llvm-svn: 67930
2009-03-28 07:44:53 +00:00
Evan Cheng fd81c73cde Optimize some 64-bit multiplication by constants into two lea's or one lea + shl since imulq is slow (latency 5). e.g.
x * 40
=>
shlq    $3, %rdi
leaq    (%rdi,%rdi,4), %rax

This has the added benefit of allowing more multiply to be folded into addressing mode. e.g.
a * 24 + b
=>
leaq    (%rdi,%rdi,2), %rax
leaq    (%rsi,%rax,8), %rax

llvm-svn: 67917
2009-03-28 05:57:29 +00:00
Chris Lattner 7516668998 move a large method out of line.
llvm-svn: 67892
2009-03-28 02:08:47 +00:00
Gabor Greif 41c8515b1b "ghostify" the ilist<Function> sentinel
llvm-svn: 67872
2009-03-27 22:28:33 +00:00
Mike Stump ced6a2be04 Allow invertable -xno- style optins as well.
llvm-svn: 67862
2009-03-27 20:12:55 +00:00
Dan Gohman 8680802b1f Revert r67844. This fixes the llvm-gcc-4.2 build on Darwin.
llvm-svn: 67856
2009-03-27 18:37:13 +00:00
Duncan Sands 75d7e77a58 Reapply r66415, which was reverted in r66426 for
causing a bootstrap failure.  Bootstraps here on
x86-32-linux and x86-64-linux.  Requested by the
author Gabor Greif who says that a bug that might
have been causing the failure has since been fixed.

llvm-svn: 67844
2009-03-27 15:29:38 +00:00
Mikhail Glushenkov f4be420def -write-graph now can be used with -o.
Makes it possible to set the output file name.

llvm-svn: 67835
2009-03-27 12:57:14 +00:00
Evan Cheng 5e5a63cf8f CodeGen still defaults to non-verbose asm, but llc now overrides it and default to verbose.
llvm-svn: 67668
2009-03-25 01:47:28 +00:00
Dale Johannesen 32dfb35281 Use a SmallPtrSet instead of std::set.
llvm-svn: 67578
2009-03-23 23:39:20 +00:00
Evan Cheng f858466018 Fix PR3391 and PR3864. Reg allocator infinite looping.
llvm-svn: 67544
2009-03-23 18:24:37 +00:00
Dan Gohman 52c278e54d Add a new bit to SUnit to record whether a node has implicit physreg
defs, regardless of whether they are actually used.

llvm-svn: 67528
2009-03-23 16:10:52 +00:00
Dan Gohman 7135a9d166 Clarify a comment.
llvm-svn: 67525
2009-03-23 15:54:02 +00:00
Dan Gohman 87cd443ae9 Make getOperandNumForIncomingValue and getOperandNumForIncomingBlock
static member functions, and add getIncomingValueNumForOperand
and getIncomingBlockNumForOperand, which are the respective
inverses.

llvm-svn: 67522
2009-03-23 15:48:29 +00:00
Evan Cheng 968c3b0d6e Model inline asm constraint which ties an input to an output register as machine operand TIED_TO constraint. This eliminated the need to pre-allocate registers for these. This also allows register allocator can eliminate the unneeded copies.
llvm-svn: 67512
2009-03-23 08:01:15 +00:00
Chris Lattner b6ff0f3a4d Fix PR3860 by correcting a predicate.
llvm-svn: 67473
2009-03-22 19:22:53 +00:00
Chris Lattner adda37fb62 add method to access a template argument.
llvm-svn: 67458
2009-03-22 00:18:18 +00:00
Duncan Sands 1f15ca7c7a Factorize out a concept - no functionality change.
llvm-svn: 67454
2009-03-21 21:27:31 +00:00
Chris Lattner 9b62dff5f6 add some inline methods for infix operators on sparse vectors,
tidy some df iteration stuff, patch by John Mosby!

llvm-svn: 67428
2009-03-21 05:40:09 +00:00
Evan Cheng 2e55923fba For inline asm output operand that matches an input. Encode the input operand index in the high bits.
llvm-svn: 67387
2009-03-20 18:03:34 +00:00
Mon P Wang f67448adf8 Added option to enable generating less precise mad (multiply addition)
for those architectures that support the instruction.

llvm-svn: 67363
2009-03-20 05:06:58 +00:00
Sebastian Redl 8d5baa09f8 Fix the Win32 VS2008 build:
- Make type declarations match the struct/class keyword of the definition.
 - Move AddSignalHandler into the namespace where it belongs.
 - Correctly call functions from template base.
 - Some other small changes.
With this patch, LLVM and Clang should build properly and with far less noise under VS2008.

llvm-svn: 67347
2009-03-19 23:26:52 +00:00
Evan Cheng 1361cbbb0b Added MachineInstr::isRegTiedToDefOperand to check for two-addressness.
llvm-svn: 67335
2009-03-19 20:30:06 +00:00
Dan Gohman 1026a8001f SADDO and UADDO are commutative.
llvm-svn: 67319
2009-03-19 18:53:45 +00:00
Dale Johannesen 2050968df9 Clear the cached cost when removing a function in
the inliner; prevents nondeterministic behavior
when the same address is reallocated.
Don't build call graph nodes for debug intrinsic calls;
they're useless, and there were typically a lot of them.

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

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

 - Please rename if you have a better one.

llvm-svn: 67103
2009-03-17 21:15:18 +00:00
Daniel Dunbar 076b0b649b raw_ostream: Return '*this' explicitly (instead of implicitly via
write) to expose more alias information.

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

 - Move default buffer size to header.

llvm-svn: 67066
2009-03-17 01:13:35 +00:00
Daniel Dunbar db7a36cdac raw_ostream: Replace flush_impl with write_impl, which takes data to
write as arguments.
 - Add raw_ostream::GetNumBytesInBuffer.
 - Privatize buffer pointers.
 - Get rid of slow and unnecessary code for writing out large strings.

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

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

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

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

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

llvm-svn: 67053
2009-03-16 22:00:17 +00:00
Bill Wendling 4bb96e9a50 Revert r66920. It was causing failures in the self-hosting buildbot (in release
mode).

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

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

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

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

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

llvm-svn: 66941
2009-03-13 20:42:20 +00:00
Gabor Greif 258232fb80 Second installment of "BasicBlock operands to the back"
changes.

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

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

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

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


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

llvm-svn: 66875
2009-03-13 07:51:59 +00:00
Bill Wendling fa54bc2052 Oops...I committed too much.
llvm-svn: 66867
2009-03-13 04:39:26 +00:00
Bill Wendling b02eadf660 Temporarily XFAIL this test.
llvm-svn: 66866
2009-03-13 04:37:11 +00:00
Gabor Greif af76c34b4b cosmetic change, in preparation of future change
llvm-svn: 66839
2009-03-12 23:13:03 +00:00
Daniel Dunbar db948ffaf0 raw_ostream: unbuffered streams weren't being immediately flushed on
single character writes.

llvm-svn: 66827
2009-03-12 22:02:44 +00:00
Gabor Greif c91aa9b857 Rearrange operands of the BranchInst, to be able to
access each with a fixed negative index from op_end().

This has two important implications:
- getUser() will work faster, because there are less iterations
  for the waymarking algorithm to perform. This is important
  when running various analyses that want to determine callers
  of basic blocks.
- getSuccessor() now runs faster, because the indirection via OperandList
  is not necessary: Uses corresponding to the successors are at fixed
  offset to "this".

The price we pay is the slightly more complicated logic in the operator
User::delete, as it has to pick up the information whether it has to free
the memory of an original unconditional BranchInst or a BranchInst that
was originally conditional, but has been shortened to unconditional.
I was not able to come up with a nicer solution to this problem. (And
rest assured, I tried *a lot*).

Similar reorderings will follow for InvokeInst and CallInst. After that
some optimizations to pred_iterator and CallSite will fall out naturally.

llvm-svn: 66815
2009-03-12 18:34:49 +00:00
Chris Lattner b0a553b925 Fully initialize all ivars, fixing PR3790, patch by Edwin Torok!
llvm-svn: 66798
2009-03-12 17:22:48 +00:00
Daniel Dunbar aa75c9d8d8 Add StringMap::lookup.
llvm-svn: 66750
2009-03-12 01:16:06 +00:00
Bill Wendling 42adc73a2b Add a -no-implicit-float flag. This acts like -soft-float, but may generate
floating point instructions that are explicitly specified by the user.

llvm-svn: 66719
2009-03-11 22:30:01 +00:00