Commit Graph

783 Commits

Author SHA1 Message Date
Mikhail Glushenkov
4e9ca339b5 Add segment flag bits to ELF.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68438 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-05 09:07:08 +00:00
Daniel Dunbar
38f4dd7b5e Add fast path for raw_ostream output of strings.
- Particularly nice for small constant strings, which get optimized
   down nicely. On a synthetic benchmark writing out "hello" in a
   loop, this is about 2x faster with gcc and 3x faster with
   llvm-gcc. llc on insn-attrtab.bc from 403.gcc is about .5% faster.

 - I tried for a fancier solution which wouldn't increase code size as
   much (by trying to match constant arrays), but can't quite make it
   fly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68396 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-03 18:43:17 +00:00
Chris Lattner
b7a00daa11 Work around an apparent GCC miscompilation by specializing different,
this fixes a regression on some compilers from r68147.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68356 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-03 00:26:01 +00:00
Chris Lattner
6caced9564 add missing *
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68350 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-02 23:53:03 +00:00
Dan Gohman
de551f91d8 Use CHAR_BIT instead of hard-coding 8 in several places where it
is appropriate. This helps visually differentiate host-oriented
calculations from target-oriented calculations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68227 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01 18:45:54 +00:00
Misha Brukman
d485e885f0 * Fixed spelling of `invertible'
* Simplified if statement


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68163 91177308-0d34-0410-b5e6-96231b3b80d8
2009-04-01 00:15:46 +00:00
Chris Lattner
b160f5d36d add a converting operator
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68158 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 23:09:51 +00:00
Chris Lattner
722272df41 Add two new classes: WeakVH and AssertingVH. These are both "ValueHandles",
which are effectively smart pointers to Value*'s.  They are both very light
weight and simple, and react to values being destroyed or being RAUW'd.

WeakVN does a best effort to follow a value around, including through RAUW 
operations and will get nulled out of the value is destroyed.  This is useful
for the eventual "metadata that references a value" work, because it is a
reference to a value that does not show up on its use_* list.

AssertingVH is a pointer that compiles down to a dumb raw pointer when 
assertions are disabled.  When enabled, it emits an assertion if the 
pointed-to value is destroyed while it is still being referenced.  This
is very useful for Maps and other things, and should have caught the recent
bugs in CallGraph and Reassociate, for example.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68149 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 22:11:05 +00:00
Chris Lattner
f385167b85 teach PointerLikeTypeTraits that all pointers to pointers may only be 4-byte aligned.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68147 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-31 21:28:39 +00:00
Bill Wendling
31fd5a571e Constify check. This fixes PR3900.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68013 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-29 20:08:56 +00:00
Chris Lattner
911c8b21da Add a PointerLikeTypeTraits specialization for uintptr_t
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67985 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-29 06:00:21 +00:00
Chris Lattner
e30173ac33 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.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67979 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-29 04:32:37 +00:00
Chris Lattner
8ee1b5e916 rename PointerLikeTypeInto to PointerLikeTypeTraits, add trait for
# low bits free, and move to its own header.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67973 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-29 00:39:30 +00:00
Chris Lattner
e8b64106ec move a large method out of line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67892 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-28 02:08:47 +00:00
Mike Stump
5c1f715d4b Allow invertable -xno- style optins as well.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67862 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-27 20:12:55 +00:00
Chris Lattner
4cc2b85861 add method to access a template argument.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67458 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-22 00:18:18 +00:00
Sebastian Redl
48fe63526e 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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67347 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-19 23:26:52 +00:00
Daniel Dunbar
b372c1114c 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67103 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-17 21:15:18 +00:00
Daniel Dunbar
c39b80fdfc raw_ostream: Return '*this' explicitly (instead of implicitly via
write) to expose more alias information.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67070 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-17 01:53:36 +00:00
Daniel Dunbar
d17d74bb80 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67066 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-17 01:13:35 +00:00
Daniel Dunbar
89a66a96fe 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67060 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-16 23:29:31 +00:00
Daniel Dunbar
cf2a2c6a26 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67057 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-16 22:55:06 +00:00
Daniel Dunbar
de75d7ffcd Add slow path for single character write, and use exclusively for
single characters writes outside of the fast path in raw_ostream.h


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67053 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-16 22:00:17 +00:00
Bill Wendling
9a507cd915 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



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66953 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 21:15:59 +00:00
Gabor Greif
b14cda3c0d 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66920 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-13 18:27:29 +00:00
Daniel Dunbar
bcf8ea9554 raw_ostream: unbuffered streams weren't being immediately flushed on
single character writes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66827 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-12 22:02:44 +00:00
Mon P Wang
535f390bc3 Changed Allocate to use size_t instead of unsigned.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66602 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-10 23:48:49 +00:00
Dan Gohman
7f3030c471 Add an explicit keyword.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66595 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-10 23:10:46 +00:00
Mon P Wang
cabb383aba Fixed rounding up EltSize
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66594 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-10 23:04:40 +00:00
Daniel Dunbar
e77e434bc9 PR3478: raw_ostream should not buffer stderr
- Add unbuffered flag to raw_ostream, forwarded by raw_fd_ostream and
   used by raw_stderr_ostream.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66545 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-10 16:21:55 +00:00
Daniel Dunbar
7af9248391 Add C++ marker.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66543 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-10 15:56:48 +00:00
Daniel Dunbar
1779f2213f Add IRBuilder::CreateConstGEP{1, 2}_{32, 64}.
- Names are lame, but it seems better to be explicit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66295 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-06 22:26:07 +00:00
Gabor Greif
f3841fcbd5 ooops, forgot to include the pointless-write eliminator in my previous checkin
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66081 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-04 21:54:31 +00:00
Chris Lattner
e97c733541 add some helper classes for building light-weight symbolic stack traces
that get printed when a program crashes.  This is the first step of many.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66076 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-04 21:40:23 +00:00
Gabor Greif
c23b8719ef Give sentinel traits the right to determine the policy where the sentinel is kept.
This should result in less indirect memory accesses, less dead writes and tighter code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@66061 91177308-0d34-0410-b5e6-96231b3b80d8
2009-03-04 20:36:44 +00:00
Misha Brukman
fe2cce63aa Removed trailing whitespace.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@65196 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-20 22:51:36 +00:00
Chris Lattner
ccd846b73f allow TimeRegion to take a potentially-null pointer to a
timer for clang.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64874 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-18 01:48:17 +00:00
Devang Patel
13319ceffd The debugger sometimes lookup dynamically in the runtime to find ivar info of any Objective-C classes. It would be very helpful to debugger if the compiler encodes runtime version number in DWARF.
Add support for two additional DWARF attributes to encode Objective-C runtime version number.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64834 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-17 22:43:44 +00:00
Daniel Dunbar
e2a8dfefe5 Add llvm::RoundUpToAlignment.
- No functionality change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@64691 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-16 22:57:04 +00:00
Ted Kremenek
3f4c81de0a Deallocate() methods now take a 'const void*' instead of a 'void *', matching observed behavior with how 'delete[]' can be used.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63956 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-06 19:34:14 +00:00
Chris Lattner
6038840210 add a method to BumpPtrAllocator that allows allocating elements
with a specified alignment.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63629 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-03 07:39:50 +00:00
Mike Stump
d64e0eb094 Improve -fno-opt style option processing to not require an extra
option to make the -fno- form on the option.  We also document the new
form in the CommandLine documentation.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63559 91177308-0d34-0410-b5e6-96231b3b80d8
2009-02-02 22:48:49 +00:00
Mike Stump
d6f175b3ec Add opposite_of and inverse_opt to support -fno- style options. This
is necessary for eventual gcc commmand line compatibility.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63384 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-30 08:19:46 +00:00
Ted Kremenek
9c27886dd5 Add method raw_fd_ostream::seek() for random access within a file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63044 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-26 21:42:04 +00:00
Devang Patel
3b64c6bc29 Introduce two DWARF attribute extentions DW_AT_APPLE_optimized, DW_AT_APPLE_flags.
DW_AT_APPLE_optimized flag is set when a compile_unit is optimized. The debugger takes advantage of this information some way.

DW_AT_APPLE_flags encodes command line options when certain env. variable is set. This is used by build engineers to track various gcc command lines used by by  a project, irrespective of whether the project used makefile, Xcode or something else.

llvm-gcc patch is next.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62888 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-23 22:33:47 +00:00
Gabor Greif
edc4d69917 introduce a useful abstraction to find out if a Use is in the call position of an instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62788 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-22 21:35:57 +00:00
Dale Johannesen
541ed9fd02 Do not use host floating point types when emitting
ASCII IR; loading and storing these can change the
bits of NaNs on some hosts.  Remove or add warnings
at a few other places using host floating point;
this is a bad thing to do in general.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62712 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-21 20:32:55 +00:00
Devang Patel
018ec84b32 indentation...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62603 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-20 19:23:29 +00:00
Devang Patel
6906ba52f0 Need only one set of debug info versions enum.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62602 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-20 19:22:03 +00:00
Gabor Greif
7543f7fae3 make comparisons a bist faster
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62428 91177308-0d34-0410-b5e6-96231b3b80d8
2009-01-17 19:03:45 +00:00