Commit Graph

28822 Commits

Author SHA1 Message Date
Dan Gohman d8329e8378 Update comments to use doxygen syntax.
llvm-svn: 73621
2009-06-17 17:51:33 +00:00
Owen Anderson 4b660a8da7 Protect the ValueHandle table.
llvm-svn: 73620
2009-06-17 17:36:57 +00:00
Owen Anderson e5fdd0b5d1 We need to guard reads of the AbstractTypeUsers list, as well as writes to it. While it would be nice to use a R/W lock here,
we can't, because it HAS to be recursive.

llvm-svn: 73617
2009-06-17 17:13:54 +00:00
Douglas Gregor 2761988cfd Add RWMutex.cpp to the CMake makefiles
llvm-svn: 73615
2009-06-17 17:01:30 +00:00
Owen Anderson a4b739aff4 Type safety for TypeSymbolTable!
llvm-svn: 73614
2009-06-17 16:56:27 +00:00
Owen Anderson 74af4ee79d Improve the Win32 reader-writer lock implementation by making it just a normal
lock.  This is obviously bad, but at least it's threadsafe!  If you know how
to improve this in a pre-Vista friendly well, patches welcome!

Patch by Max Burke.

llvm-svn: 73607
2009-06-17 09:10:42 +00:00
Sanjiv Gupta 2f2b0a1985 >> What if my global variable was into a different address space than stack?
>>     
>
> It doesn't matter in terms of semantics: because AnalyzeGlobal
> returned false, we're guaranteed the address of the global is never
> taken.  I wouldn't be surprised if we end up generating invalid IR in
> some cases, though, because of the semantics of replaceAllUsesWith.
> Do you have a testcase that breaks?
>
>   
The problem is replaceAllUsesWith asserts for type mismatch here. Try attached .bc with llvm-ld.

assert(New->getType() == getType() &&
        "replaceAllUses of value with new value of different type!");

Since stack is always on address space zero, I don't think that type of GV in a different address space is ever going to match.
The other way is to allow replaceAllUsesWith to ignore address spaces while comparing types. (do we have  a way to do that ?).
But then such an optimization may fail the entire idea of user wanting to place a variable into different memory space. The original idea of user might be to save on the stack space (data memory) and hence he asked the variable to be placed into different memory space (program memory). So the best bet here is to deny this optimization by checking

GV->getType()->getAddressSpace() == 0. 

llvm-svn: 73605
2009-06-17 06:47:15 +00:00
Eli Friedman a0fba5319d PR3439: Correct a silly mistake in the SimplifyDemandedUseBits code for
SRem.

llvm-svn: 73598
2009-06-17 02:57:36 +00:00
Dan Gohman b50f5a46e0 Fix ScalarEvolution's Xor handling to not assume that an And
that gets recognized with a SCEVZeroExtendExpr must be an And
with a low-bits mask. With r73540, this is no longer the case.

llvm-svn: 73594
2009-06-17 01:22:39 +00:00
Devang Patel 722848dc01 Do not use first actual instruction's location for prologue. The debug wants to skip prologue while setting a breakpoint for the function.
llvm-svn: 73592
2009-06-17 00:48:26 +00:00
Owen Anderson 82b58a843b Use atomic increment/decrement for reference counting of Type's.
llvm-svn: 73588
2009-06-17 00:28:49 +00:00
Owen Anderson 8d0fe6f0d7 Add an atomic increment and decrement implementation, which will be used for
thread-safe reference counting.

llvm-svn: 73587
2009-06-17 00:13:00 +00:00
Owen Anderson c39919151d Add locking around the accessors for AbstractTypeUsers.
llvm-svn: 73586
2009-06-17 00:12:30 +00:00
Owen Anderson 35a82d40bd Use a reader-writer lock to guard large portions of the Type infrastructure, including abstract type refinement.
There's still some more work to be done here, such as guarding removeAbstractTypeUser() and the printers.

llvm-svn: 73575
2009-06-16 22:51:18 +00:00
Chris Lattner ca52e86346 fix a circular dependency between the mips code generator
and its asmprinter.

llvm-svn: 73573
2009-06-16 22:38:04 +00:00
Chris Lattner 632bfb31c9 Fix the EE bindings to use the proper EE interfaces for creating a JIT.
Calling into createJIT directly creates a circular dependency between libjit and lib ee.

llvm-svn: 73567
2009-06-16 22:26:13 +00:00
Owen Anderson 79b76b5bea Accidentally broke this file.
llvm-svn: 73552
2009-06-16 20:57:51 +00:00
Owen Anderson 993e4261d0 Add newline at end of file.
llvm-svn: 73551
2009-06-16 20:53:09 +00:00
Owen Anderson 896cee711f Remove the Win32 implementation, since it doesn't compile pre-Vista.
llvm-svn: 73550
2009-06-16 20:49:20 +00:00
Owen Anderson 372a9289a5 Fix/cleanup trailing newlines.
llvm-svn: 73546
2009-06-16 20:23:05 +00:00
Owen Anderson 324f94c317 Add a portable wrapper for reader-writer locks.
llvm-svn: 73545
2009-06-16 20:19:28 +00:00
Douglas Gregor 1b731d5dbe Introduce new headers whose inclusion forces linking and
initialization of all targets (InitializeAllTargets.h) or assembler
printers (InitializeAllAsmPrinters.h). This is a step toward the
elimination of relinked object files, so that we can build normal
archives.

llvm-svn: 73543
2009-06-16 20:12:29 +00:00
Dan Gohman 0ed7756fbe Generalize a few more instcombines to be vector/scalar-independent.
llvm-svn: 73541
2009-06-16 19:55:29 +00:00
Dan Gohman 1ee696d8fc Instcombine's ShrinkDemandedConstant may strip bits out of constants,
obscuring what would otherwise be a low-bits mask.  Use ComputeMaskedBits
to compute what ShrinkDemandedConstant knew about to reconstruct a
low-bits mask value.

llvm-svn: 73540
2009-06-16 19:52:01 +00:00
Evan Cheng 0d9730f39f CALL64pcrel32 immediate field is 32-bit. Patch by Abhinav Duggal.
llvm-svn: 73536
2009-06-16 19:44:27 +00:00
Anton Korobeynikov a8fd40b50a Address review comments: add 3 ARM calling conventions.
Dispatch C calling conv. to one of these conventions based on
target triple and subtarget features.

llvm-svn: 73530
2009-06-16 18:50:49 +00:00
Anton Korobeynikov 5d28cb204f GNU as refuses to assemble "pop {}" instruction. Do not emit such
(this is the case when we have thumb vararg function with single
callee-saved register, which is handled separately).

llvm-svn: 73529
2009-06-16 18:49:08 +00:00
Douglas Gregor c791c37633 Add Threading.cpp to the CMake project files
llvm-svn: 73516
2009-06-16 17:45:38 +00:00
Owen Anderson 4cb4b6191a Split the thread-related APIs out into their own file, and add a few more
calls for convenience.

llvm-svn: 73512
2009-06-16 17:33:51 +00:00
Chris Lattner 945d08d76f Generalize instcombine's isSafeToLoadUnconditionally() function
to ignore readonly calls, and factor it out of instcombine so
that it can be used by other passes.  Patch by Frits van Bommel!

llvm-svn: 73506
2009-06-16 17:23:12 +00:00
Sanjiv Gupta 05a7dba3bd Added missing libcalls for floating point to int conversions.
llvm-svn: 73491
2009-06-16 16:17:35 +00:00
Sanjiv Gupta bce3ca6ad9 Fixed names of libcalls checked in r73480.
llvm-svn: 73483
2009-06-16 10:22:58 +00:00
Sanjiv Gupta 5372d4a568 Code Restructuring. No functionality change.
llvm-svn: 73481
2009-06-16 09:45:18 +00:00
Sanjiv Gupta 557ed09e0f Added required libcalls for PIC16 (mostly floating points to integer casting operations).
llvm-svn: 73480
2009-06-16 09:03:58 +00:00
Evan Cheng 591bcad8b9 Rename RemoveCopiesFromValNo to TurnCopiesFromValNoToImpDefs.
llvm-svn: 73479
2009-06-16 07:15:05 +00:00
Evan Cheng cc21a5415a If a val# is defined by an implicit_def and it is being removed, all of the copies off the val# were removed. This causes problem later since the scavenger will see uses of registers without defs. The proper solution is to change the copies into implicit_def's instead.
TurnCopyIntoImpDef turns a copy into implicit_def and remove the val# defined by it. This causes an scavenger assertion later if the def reaches other blocks. Disable the transformation if the value live interval extends beyond its def block.

llvm-svn: 73478
2009-06-16 07:12:58 +00:00
Eli Friedman abfad5d61e Add some generic expansion logic for SMULO and UMULO. Fixes UMULO
support for x86, and UMULO/SMULO for many architectures, including PPC 
(PR4201), ARM, and Cell. The resulting expansion isn't perfect, but it's
not bad.

llvm-svn: 73477
2009-06-16 06:58:29 +00:00
Eli Friedman 48021d15d6 Misc accumulated tweaks to legalization logic for various targets.
llvm-svn: 73476
2009-06-16 06:40:59 +00:00
Chris Lattner 0101f45785 another xform that is target-independent (should be done in instcombine).
llvm-svn: 73472
2009-06-16 06:15:56 +00:00
Chris Lattner aba55a69b1 I think instcombine should unconditionally do this xform.
llvm-svn: 73471
2009-06-16 06:11:35 +00:00
Chris Lattner 06310bf178 Fix PR4336: Iterating over use-def chains doesn't seem to be deterministic.
The problem was that BitcodeReader::materializeModule would read functions
from the bc file in densemap pointer key order (doubly non-deterministic!),
which would cause the use-def chains to be set up for globals in
non-determinstic order.  Non-determinstic use/def chains can cause 
nondeterminism in many places down-stream.

Many thanks to Julien Lerouge for putting together the pass in the PR that
shows the issue!

llvm-svn: 73470
2009-06-16 05:15:21 +00:00
Bill Wendling 92b17b550e There doesn't seem to be a reason to move the save FP stuff.
llvm-svn: 73468
2009-06-16 04:12:45 +00:00
Bill Wendling f6c6a7f1b7 The DWARF to compact encoding converter assumes that the DW_CFA_def_cfa_offset
comes after the DW_CFA_def_cfa_register, because the CFA is really ESP from the
start of the function and only gets an offset when the "subl $xxx,%esp"
instruction happens, not the other way around.

And reapply r72898:

The DWARF unwind info was incorrect. While compiling with
`-fomit-frame-pointer', we would lack the DW_CFA_advance_loc information for a
lot of function, and then they would be `0'. The linker (at least on Darwin)
needs to encode the stack size. In some cases, the stack size is too large to
directly encode. So the linker checks to see if there is a "subl $xxx,%esp"
instruction at the point where the `DW_CFA_def_cfa_offset' says the pc was. If
so, the compact encoding records the offset in the function to where the stack
size is embedded. But because the `DW_CFA_advance_loc' instructions are missing,
it looks before the function and dies.

So, instead of emitting the EH debug label before the stack adjustment
operations, emit it afterwards, right before the frame move stuff.

llvm-svn: 73465
2009-06-16 04:06:15 +00:00
Bill Wendling 4a172428e5 Fix typos.
llvm-svn: 73464
2009-06-16 04:02:03 +00:00
Devang Patel 14491abe48 Use MainCU if it is available.
llvm-svn: 73457
2009-06-16 02:09:30 +00:00
Dan Gohman adfd42a3c8 Use Type::getScalarType.
llvm-svn: 73451
2009-06-16 00:20:26 +00:00
Owen Anderson e2432761f0 Owen Anderson 2009-06-15: Use a SmallPtrSet here, for speed and to match df_iterator.
Owen Anderson 2009-06-15: Remember to clear out our maps to prevent crashing.

llvm-svn: 73438
2009-06-15 22:54:48 +00:00
Dan Gohman 6e6808adaf Change this from an assert to a cerr+exit, since it's diagnosing an
unsupported inline asm construct, rather than verifying a code invariant.

llvm-svn: 73435
2009-06-15 22:32:41 +00:00
Evan Cheng f691b829ab On Darwin, frame pointer r7 is never available.
llvm-svn: 73434
2009-06-15 22:32:01 +00:00
Dan Gohman 7889f2b5e2 Use Type::isIntOrIntVector and Type::isFPOrFPVector.
llvm-svn: 73433
2009-06-15 22:25:12 +00:00