Commit Graph

3011 Commits

Author SHA1 Message Date
Owen Anderson edb4a70325 Revert the ConstantInt constructors back to their 2.5 forms where possible, thanks to contexts-on-types. More to come.
llvm-svn: 77011
2009-07-24 23:12:02 +00:00
Daniel Dunbar b99eac8814 Move more to raw_ostream.
llvm-svn: 76964
2009-07-24 10:05:20 +00:00
Chris Lattner 5cd4dd391f make Constant::getRelocationInfo return an enum, as suggested by Duncan.
llvm-svn: 76938
2009-07-24 03:27:21 +00:00
Owen Anderson 0348a13cc6 Privatize the ConstantVector tables.
llvm-svn: 76922
2009-07-24 00:36:24 +00:00
Owen Anderson 909f6001e9 Privatize the ConstantStruct table.
llvm-svn: 76912
2009-07-23 23:25:33 +00:00
Daniel Dunbar 84b5f6efb7 Switch ValueSymbolTable to StringRef based API.
llvm-svn: 76894
2009-07-23 18:52:12 +00:00
Daniel Dunbar f01154cf2c Add llvm::Value::getNameRef, for help in API migration.
llvm-svn: 76893
2009-07-23 18:50:53 +00:00
Daniel Dunbar 5bf72e20eb Convert StringMap to using StringRef for its APIs.
- Yay for '-'s and simplifications!

 - I kept StringMap::GetOrCreateValue for compatibility purposes, this can
   eventually go away. Likewise the StringMapEntry Create functions still follow
   the old style.

 - NIFC.

llvm-svn: 76888
2009-07-23 18:17:34 +00:00
Devang Patel 6292003492 MDString
- Rename member function size(). New name is length().
- Store string beginning and length. Earlier it used to store string end.

llvm-svn: 76841
2009-07-23 02:00:51 +00:00
Devang Patel e059ba6ed2 Derive MDNode from MetadataBase instead of Constant. Emit MDNodes into METADATA_BLOCK in bitcode file.
llvm-svn: 76834
2009-07-23 01:07:34 +00:00
Dan Gohman 902dfff8b6 Rename the new unsigned and signed keywords to nuw and nsw,
which stand for no-unsigned-wrap and no-signed-wrap.

llvm-svn: 76810
2009-07-22 22:44:56 +00:00
Daniel Dunbar 5899dda08c Switch some clients to Value::getName(), and other getName() user
simplification.
 - NFC

llvm-svn: 76789
2009-07-22 21:33:09 +00:00
Devang Patel e171bc8ae5 Do not print "metadata" twice while printing MDString.
This fixes unittest failure.

llvm-svn: 76764
2009-07-22 18:10:23 +00:00
Devang Patel 7428d8acec Introduce MetadataBase, a base class for MDString and MDNode.
Derive MDString directly from MetadataBase. 
Introduce new bitcode block to hold metadata.

llvm-svn: 76759
2009-07-22 17:43:22 +00:00
Duncan Sands c0647b31ee Add newline at end of file.
llvm-svn: 76736
2009-07-22 13:20:41 +00:00
Owen Anderson 47db941fd3 Get rid of the Pass+Context magic.
llvm-svn: 76702
2009-07-22 00:24:57 +00:00
Chris Lattner 4565ef5b65 reimplement Constant::ContainsRelocations as
Constant::getRelocationInfo(), which has a much simpler
to use API.  It still should not be part of libvmcore, but
is better than it was.  Also teach it to be smart about 
hidden visibility.

llvm-svn: 76700
2009-07-22 00:05:44 +00:00
Dan Gohman 9413de19b1 Permit the IntPtrTy argument to isEliminableCastPair to be null,
to help support use when TargetData is not available.

llvm-svn: 76675
2009-07-21 23:19:40 +00:00
Owen Anderson 3d34492c1f Privatize the ConstantArray table.
llvm-svn: 76639
2009-07-21 20:55:28 +00:00
Owen Anderson 39ede7b8d1 Privatize the first of the value maps.
llvm-svn: 76634
2009-07-21 20:13:12 +00:00
Owen Anderson c37bc69e91 Rename getConstantInt{True|False} to get{True|False} at Chris' behest.
llvm-svn: 76598
2009-07-21 18:03:38 +00:00
Owen Anderson 2ad52176f9 Move a bit more state over to the LLVMContext.
llvm-svn: 76533
2009-07-21 02:47:59 +00:00
Dan Gohman 0ebd69614c Assembly and Bitcode support for unsigned/signed overflow flags and
exact sdiv flags.

llvm-svn: 76475
2009-07-20 21:19:07 +00:00
Bill Wendling 2dd0bf8db0 Change the casting of linkage types into a map. This makes this much more robust
as it no longer depends upon two different enums being kept in sync with each
other.

llvm-svn: 76465
2009-07-20 20:34:46 +00:00
Bill Wendling 1bcfbff7af Rename Mangler linkage enums to something less gross.
llvm-svn: 76456
2009-07-20 19:41:27 +00:00
Dan Gohman 33a3fd0b9c Revert the addition of hasNoPointerOverflow to GEPOperator.
Getelementptrs that are defined to wrap are virtually useless to
optimization, and getelementptrs that are undefined on any kind
of overflow are too restrictive -- it's difficult to ensure that
all intermediate addresses are within bounds. I'm going to take
a different approach.

Remove a few optimizations that depended on this flag.

llvm-svn: 76437
2009-07-20 17:43:30 +00:00
Bill Wendling a3c6f6bffa Add plumbing for the `linker_private' linkage type. This type is meant for
"private" symbols which the assember shouldn't strip, but which the linker may
remove after evaluation. This is mostly useful for Objective-C metadata.

This is plumbing, so we don't have a use of it yet. More to come, etc.

llvm-svn: 76385
2009-07-20 01:03:30 +00:00
Dan Gohman 7d82e1338e Make GetElementPtr ConstantExprs default to having no pointer overflow.
llvm-svn: 76280
2009-07-18 01:49:22 +00:00
Dan Gohman ff081b0126 Fix this accidentally inverted condition.
llvm-svn: 76278
2009-07-18 00:58:38 +00:00
Dan Gohman e1019db658 Convert more code to use Operator instead of explicitly handling both
ConstantExpr and Instruction. This involves duplicating some code
between GetElementPtrInst and GEPOperator, but it's not a lot.

llvm-svn: 76265
2009-07-17 23:55:56 +00:00
Dan Gohman 1d548d851a Make BasicAliasAnalysis and Value::getUnderlyingObject use
GEPOperator's hasNoPointer0verflow(), and make a few places in instcombine
that create GEPs that may overflow clear the NoOverflow value. Among
other things, this partially addresses PR2831.

llvm-svn: 76252
2009-07-17 22:25:10 +00:00
Dan Gohman d2a251f9f9 Add a GEPOperator class, and move the hasNoPointerOverflow
accessors into it.

llvm-svn: 76245
2009-07-17 21:33:58 +00:00
Dan Gohman 510fdfd92e Fix a typo that Duncan spotted.
llvm-svn: 76233
2009-07-17 20:51:47 +00:00
Dan Gohman 97190a2c93 GetElementPtr instructions default to having no overflow.
llvm-svn: 76222
2009-07-17 19:23:21 +00:00
Daniel Dunbar e974dc3eb1 Fix compile warning.
llvm-svn: 76210
2009-07-17 18:33:52 +00:00
Anton Korobeynikov c8ce7b08ba Add support for naked functions
llvm-svn: 76198
2009-07-17 18:07:26 +00:00
Dan Gohman 9691e71a4f Add a SubclassOptionalData field to Value. See the doxygen comment for
details.

llvm-svn: 76189
2009-07-17 17:16:59 +00:00
Eli Friedman b8f6a4fc8e Replace isTrapping with a new, similar method called
isSafeToSpeculativelyExecute. The new method is a bit closer to what 
the callers actually care about in that it rejects more things callers 
don't want.  It also adds more precise handling for integer 
division, and unifies code for analyzing the legality of a speculative 
load.

llvm-svn: 76150
2009-07-17 04:28:42 +00:00
Jeffrey Yasskin 062853552e Fix "no newline at end of file" warning from gcc.
llvm-svn: 76127
2009-07-16 23:58:14 +00:00
Owen Anderson 4118ddeeed Privatize the MDNode uniquing table.
llvm-svn: 76126
2009-07-16 23:44:30 +00:00
Owen Anderson 69ab416d66 Privatize the MDString uniquing table.
llvm-svn: 76113
2009-07-16 22:11:26 +00:00
Daniel Dunbar bfc2d8e5de Fix compiler warning (for -Asserts).
llvm-svn: 76110
2009-07-16 22:06:22 +00:00
Owen Anderson c277dc408b Privatize the ConstantFP table. I'm on a roll!
llvm-svn: 76097
2009-07-16 19:05:41 +00:00
Ted Kremenek 4ded3d3db2 Update CMake file.
llvm-svn: 76093
2009-07-16 18:29:22 +00:00
Owen Anderson 20b34ac794 Move the ConstantInt uniquing table into LLVMContextImpl. This exposed a number of issues in
our current context-passing stuff, which is also fixed here

llvm-svn: 76089
2009-07-16 18:04:31 +00:00
Owen Anderson d420fd4f75 Now that we have contexts on types, convert some more internals to use contexts.
llvm-svn: 75866
2009-07-16 00:03:07 +00:00
Owen Anderson 4fdeba9706 Revert yesterday's change by removing the LLVMContext parameter to AllocaInst and MallocInst.
llvm-svn: 75863
2009-07-15 23:53:25 +00:00
Chris Lattner dac44ec99b Update the C bindings to keep the LLVMTypeKind up to date between the C/C++
stuff.  Patch by Zoltan Varga!

llvm-svn: 75842
2009-07-15 22:00:31 +00:00
Owen Anderson f945a9ed07 Move a few more convenience factory functions from Constant to LLVMContext.
llvm-svn: 75840
2009-07-15 21:51:10 +00:00
Ted Kremenek 39816d9157 Lexically order files in CMakeLists.txt files.
llvm-svn: 75831
2009-07-15 21:08:16 +00:00
Owen Anderson 8ee7e405dc Move the ConstantStruct factory methods over to LLVMContext.
llvm-svn: 75830
2009-07-15 21:00:46 +00:00
Rafael Espindola f5d53d46b9 Revert 75798 to fix llvm build.
llvm-svn: 75805
2009-07-15 17:40:42 +00:00
Duncan Sands c5928d2fad The static function TypeToFloatSemantics is now
unused - remove it.

llvm-svn: 75798
2009-07-15 17:19:24 +00:00
Duncan Sands 9ad1594fe0 Remove the v3i32 and v3f32 value types: they are not
native for any supported targets.

llvm-svn: 75785
2009-07-15 15:28:52 +00:00
Chris Lattner c35b5bac32 eliminate the Mangler::PreserveAsmNames bit, the sole client of this
can do it perfectly well itself.

llvm-svn: 75743
2009-07-15 04:50:47 +00:00
Owen Anderson b6b2530000 Move EVER MORE stuff over to LLVMContext.
llvm-svn: 75703
2009-07-14 23:09:55 +00:00
Chris Lattner 8c9a96b966 Reapply my previous asmprinter changes now with more testing and two
additional bug fixes:

1. The bug that everyone hit was a problem in the asmprinter where it
   would remove $stub but keep the L prefix on a name when emitting the
   indirect symbol.  This is easy to fix by keeping the name of the stub
   and the name of the symbol in a StringMap instead of just keeping a
   StringSet and trying to reconstruct it late.

2. There was a problem printing the personality function.  The current
   logic to print out the personality function from the DWARF information
   is a bit of a cesspool right now that duplicates a bunch of other 
   logic in the asm printer.  The short version of it is that it depends
   on emitting both the L and _ prefix for symbols (at least on darwin)
   and until I can untangle it, it is best to switch the mangler back to
   emitting both prefixes.

llvm-svn: 75646
2009-07-14 18:17:16 +00:00
Torok Edwin fbcc663cbf llvm_unreachable->llvm_unreachable(0), LLVM_UNREACHABLE->llvm_unreachable.
This adds location info for all llvm_unreachable calls (which is a macro now) in
!NDEBUG builds.
In NDEBUG builds location info and the message is off (it only prints
"UREACHABLE executed").

llvm-svn: 75640
2009-07-14 16:55:14 +00:00
Daniel Dunbar 966932ccb7 Revert r75610 (and r75620, which was blocking the revert), in the hopes of
unbreaking llvm-gcc (on Darwin).

--- Reverse-merging r75620 into '.':
U    include/llvm/Support/Mangler.h
--- Reverse-merging r75610 into '.':
U    test/CodeGen/X86/loop-hoist.ll
G    include/llvm/Support/Mangler.h
U    lib/Target/X86/AsmPrinter/X86ATTAsmPrinter.cpp
U    lib/VMCore/Mangler.cpp

llvm-svn: 75636
2009-07-14 15:57:55 +00:00
Bob Wilson e749587f4a Fix an obvious error.
llvm-svn: 75611
2009-07-14 06:06:28 +00:00
Chris Lattner 774f2a2d51 Change the X86 asmprinter to use the mangler to apply suffixes like "$non_lazy_ptr"
to symbols instead of doing it with "printSuffixedName".  This gets us to the point
where there is a real separation between computing a symbol name and printing it,
something I need for MC printer stuff.

This patch also fixes a corner case bug where unnamed private globals wouldn't get
the private label prefix.

Next up, rename all uses of getValueName -> getMangledName for better greppability,
and then tackle the ppc/arm backends to eliminate "printSuffixedName".

llvm-svn: 75610
2009-07-14 06:04:35 +00:00
Chris Lattner f34815b32f Change the internal interface to makeNameProper to take a bool that
indicates whether the label is private or not, instead of taking
prefix stuff.  One effect of this is that symbols will be generated
with *just* the private prefix, instead of both the private prefix
*and* the user-label-prefix, but this doesn't matter as long as it
is consistent.  For example we'll now get "Lfoo" instead of "L_foo".
These are just assembler temporary labels anyway, so they never even
make it into the .o file.

llvm-svn: 75607
2009-07-14 04:50:12 +00:00
Dan Gohman 8da86eb274 FreeInst is trapping.
llvm-svn: 75567
2009-07-14 00:32:11 +00:00
Bob Wilson c6026b5198 Revert 75308.
llvm-svn: 75565
2009-07-14 00:16:03 +00:00
Chris Lattner 05f1976aba the mangler can never mangle intrinsics, don't allow this.
llvm-svn: 75564
2009-07-14 00:15:14 +00:00
Chris Lattner 105efaf3df rename Memo/Count to AnonGlobalIDs/NextAnonGlobalID to be more
descriptive.  Thange them to keep track of the ID of a global that is
assigned, not the first mangled name returned for it.  Without doing this,
we are required to always use the same suffix for a global that gets 
mangled.  This means that we can mangle the same global once with $stub
and another time with $non_lazy_ptr or whatever.

llvm-svn: 75561
2009-07-14 00:01:06 +00:00
Owen Anderson 3e42e9f2fc Move more functionality over to LLVMContext.
llvm-svn: 75559
2009-07-13 23:50:59 +00:00
Chris Lattner 327387156a remove Mangler::getTypeID and related data, it was only used for mangling
local symbols and we haven't had type planes since llvm 1.9.

llvm-svn: 75558
2009-07-13 23:50:53 +00:00
Chris Lattner 15c6d8779b remove mangler support for mangling local names. Mangler should only be
used with globals.

llvm-svn: 75557
2009-07-13 23:47:27 +00:00
Chris Lattner cf485bd781 the mangler should put suffixes on unnamed global's mangled names as well
if present.

llvm-svn: 75547
2009-07-13 23:20:38 +00:00
Owen Anderson 13c240a4c1 Move a bit more functionality to LLVMContext, which apparently wasn't being used anyways.
llvm-svn: 75546
2009-07-13 23:16:26 +00:00
Chris Lattner ec8efcb44e Two changes:
1) unique globals with the existing "Count" local in Mangler, not with
atomic nonsense.  Using atomics will give us nondeterminstic output
from the compiler when using multiple threads, which is bad.

2) Do not mangle an unknown global name with a type suffix.  We don't
   need this anymore now that llvm ir doesn't have type planes.

llvm-svn: 75541
2009-07-13 22:48:46 +00:00
Owen Anderson 85f86dc058 Inline EvalVectorOp in order to get rid of passing-pointer-to-static-methods behavior.
llvm-svn: 75538
2009-07-13 22:41:06 +00:00
Owen Anderson bb2501bbbe These don't really need contexts either.
llvm-svn: 75528
2009-07-13 22:18:28 +00:00
Owen Anderson e4dcecd006 As Chris pointed out, this doesn't actually need an LLVMContext to operate.
llvm-svn: 75508
2009-07-13 21:27:19 +00:00
Owen Anderson 542619e6d5 Move more functionality over to LLVMContext.
llvm-svn: 75497
2009-07-13 20:58:05 +00:00
Dan Gohman a4f709ee5a Change printInstruction to not print a trailing newline. Value::dump
always adds a newline, so this fixes Value::dump printing an
extra blank line.

llvm-svn: 75481
2009-07-13 18:27:59 +00:00
Nick Lewycky c07adb7b0b Fix build on Linux.
llvm-svn: 75453
2009-07-13 05:49:04 +00:00
Owen Anderson 53a52215b5 Begin the painful process of tearing apart the rat'ss nest that is Constants.cpp and ConstantFold.cpp.
This involves temporarily hard wiring some parts to use the global context.  This isn't ideal, but it's
the only way I could figure out to make this process vaguely incremental.

llvm-svn: 75445
2009-07-13 04:09:18 +00:00
Torok Edwin 69208f0f9e Remove extra \n from LLVM_UNREACHABLE calls.
llvm-svn: 75416
2009-07-12 07:15:17 +00:00
Torok Edwin 56d0659726 assert(0) -> LLVM_UNREACHABLE.
Make llvm_unreachable take an optional string, thus moving the cerr<< out of
line.
LLVM_UNREACHABLE is now a simple wrapper that makes the message go away for
NDEBUG builds.

llvm-svn: 75379
2009-07-11 20:10:48 +00:00
Torok Edwin ccb29cd290 Convert more assert(0)+abort() -> LLVM_UNREACHABLE,
and abort()/exit() -> llvm_report_error().

llvm-svn: 75363
2009-07-11 13:10:19 +00:00
Bob Wilson 73fd66c06b Add new vector types for 192-bit, 348-bit and 512-bit sizes.
These are needed to represent ARM Neon struct datatypes containing 2, 3 or 4
separate vectors.

llvm-svn: 75308
2009-07-10 23:05:09 +00:00
Owen Anderson 1e5f00e7a7 This started as a small change, I swear. Unfortunately, lots of things call the [I|F]CmpInst constructors. Who knew!?
llvm-svn: 75200
2009-07-09 23:48:35 +00:00
Owen Anderson 0504e0a222 Thread LLVMContext through MVT and related parts of SDISel.
llvm-svn: 75153
2009-07-09 17:57:24 +00:00
Owen Anderson 785c56ce1d LLVMContext-ification.
llvm-svn: 75072
2009-07-08 23:50:31 +00:00
Jeffrey Yasskin d8d725de4f Fix the AssertingVH unittests.
llvm-svn: 75060
2009-07-08 22:09:00 +00:00
Devang Patel f04d63a398 Drop "constant" from
!0 = constant metadata !{...}

llvm-svn: 75057
2009-07-08 21:57:07 +00:00
Devang Patel 983c6b1b8f Update SLotTracker to handle MDNode slots.
Simplify MDNode printing.

llvm-svn: 75053
2009-07-08 21:44:25 +00:00
Torok Edwin fb8d6d5b58 Implement changes from Chris's feedback.
Finish converting lib/Target.

llvm-svn: 75043
2009-07-08 20:53:28 +00:00
Owen Anderson a771459bb1 Push LLVMContext _back_ through IRBuilder.
llvm-svn: 75040
2009-07-08 20:50:47 +00:00
Owen Anderson b17f32945f Switch GlobalVariable ctors to a sane API, where *either* a context or a module is required.
llvm-svn: 75025
2009-07-08 19:03:57 +00:00
Torok Edwin 6dd2730024 Start converting to new error handling API.
cerr+abort -> llvm_report_error
assert(0)+abort -> LLVM_UNREACHABLE (assert(0)+llvm_unreachable-> abort() included)

llvm-svn: 75018
2009-07-08 18:01:40 +00:00
Nick Lewycky a21d3daadc Remove the vicmp and vfcmp instructions. Because we never had a release with
these instructions, no autoupgrade or backwards compatibility support is
provided.

llvm-svn: 74991
2009-07-08 03:04:38 +00:00
Owen Anderson 5948fdf68b Push LLVMContext through GlobalVariables and IRBuilder.
llvm-svn: 74985
2009-07-08 01:26:06 +00:00
Owen Anderson 155dccd87c LLVMContext-ification.
llvm-svn: 74973
2009-07-07 23:43:39 +00:00
Owen Anderson 8ec8c97f81 LLVMContext-ifiy the implementation of the C API.
llvm-svn: 74950
2009-07-07 21:33:58 +00:00
Owen Anderson 5c96ef7c4e Have scoped mutexes take referenes instead of pointers.
llvm-svn: 74931
2009-07-07 18:33:04 +00:00
Owen Anderson 38264b1554 "LLVMContext* " --> "LLVMContext *"
llvm-svn: 74878
2009-07-06 23:00:19 +00:00
Chris Lattner 7f31824a44 Add two new accessors to the C bindings, patch by Wladimir van der Laan!
llvm-svn: 74836
2009-07-06 17:29:59 +00:00
Owen Anderson e70b637033 More LLVMContext-ification.
llvm-svn: 74807
2009-07-05 22:41:43 +00:00
Owen Anderson 340288c621 Even more passes being LLVMContext'd.
llvm-svn: 74781
2009-07-03 19:42:02 +00:00
Owen Anderson 39a7aed050 Fill in a few more missing accessors.
llvm-svn: 74739
2009-07-02 23:58:19 +00:00
Owen Anderson 0a2c458ae0 Add an accessor to Function so that Passes can easily get access to the context.
llvm-svn: 74714
2009-07-02 18:03:58 +00:00
Owen Anderson fea7ae88c9 Add accessors for metadata constants.
llvm-svn: 74707
2009-07-02 17:19:47 +00:00
Owen Anderson e792c90fd1 Add accessor for MDNode.
llvm-svn: 74705
2009-07-02 17:12:48 +00:00
Owen Anderson f85afb2591 Add accessor for getting UndefValue's.
llvm-svn: 74702
2009-07-02 16:51:51 +00:00
Owen Anderson 31d44e4904 Restore other bits of the C API that I tore up. All pre-existing APIs default to using the
default global context, while new *InContext() APIs have been added that take a LLVMContextRef parameter.

Apologies to anyone affected by this breakage.

llvm-svn: 74694
2009-07-02 07:17:57 +00:00
Owen Anderson f7691d398d Add a C wrapper for accessing the global default context.
llvm-svn: 74675
2009-07-02 00:16:38 +00:00
Owen Anderson 7d12807ef0 Add a few methods that got left out earlier.
llvm-svn: 74670
2009-07-01 23:56:45 +00:00
Owen Anderson 2a15443aa8 Make the use of const with respect to LLVMContext sane. Hopefully this is the last time, for the
moment, that I will need to make far-reaching changes.

llvm-svn: 74655
2009-07-01 23:13:44 +00:00
Dan Gohman 83ff184206 Use find instead of operator[] to test whether an element is in a std::map.
This fixes a bug that caused -debug-pass=Details to abort.

llvm-svn: 74654
2009-07-01 23:12:33 +00:00
Bill Wendling 4534d2562b --- Reverse-merging (from foreign repository) r74648 into '.':
U    include/llvm/LLVMContext.h
U    lib/VMCore/LLVMContext.cpp
U    lib/AsmParser/LLParser.cpp
U    lib/AsmParser/LLParser.h

Temporarily reverting r74648. It was causing massive failures in release mode.

llvm-svn: 74653
2009-07-01 22:33:26 +00:00
Owen Anderson 91b5e630a9 Fix typo.
llvm-svn: 74649
2009-07-01 21:58:14 +00:00
Owen Anderson 7373c6bbd6 Convert LLParser to use LLVMContext for creating constants.
llvm-svn: 74648
2009-07-01 21:57:44 +00:00
Owen Anderson 1cf085d558 Hold the LLVMContext by reference rather than by pointer.
llvm-svn: 74640
2009-07-01 21:22:36 +00:00
Devang Patel 5546b98d07 Fix metadata unittests
llvm-svn: 74638
2009-07-01 20:59:15 +00:00
Devang Patel de91b9e292 Do not print stranded metadata.
llvm-svn: 74632
2009-07-01 19:39:39 +00:00
Devang Patel 39e64d452a Support stand alone metadata syntax.
!0 = constant metadata !{i32 21, i32 22}
@llvm.blah = constant metadata !{i32 1000, i16 200, metadata !0}

llvm-svn: 74630
2009-07-01 19:21:12 +00:00
Owen Anderson e722976d54 I give up on trying to use reader/writer locks for recursive type refinement. Use a recursive mutex instead, which will (in theory) generate more contention, but is really
a much more natural fit for what's going on during recursive type refinement.

llvm-svn: 74618
2009-07-01 17:22:27 +00:00
Owen Anderson 6773d388aa Add a pointer to the owning LLVMContext to Module. This requires threading LLVMContext through a lot
of the bitcode reader and ASM parser APIs, as well as supporting it in all of the tools.

Patches for Clang and LLVM-GCC to follow.

llvm-svn: 74614
2009-07-01 16:58:40 +00:00
Owen Anderson 1938fb1954 Add a global context, for easing backwards compatibility.
llvm-svn: 74574
2009-06-30 23:39:59 +00:00
Owen Anderson a8560219c7 Add wrappers for type construction to LLVMContext.
llvm-svn: 74542
2009-06-30 17:50:28 +00:00
Owen Anderson 36f62e5df6 Fix up header comments to make Chris happy.
llvm-svn: 74537
2009-06-30 17:06:46 +00:00
Owen Anderson 8e66e0bab4 Add LLVMContext, which will eventually be used as a container for privatizing a lot of (currently) global state, including the
constant and type uniquing tables.  For now, just make it a wrapper around the existing APIs.

llvm-svn: 74488
2009-06-30 00:48:55 +00:00
Torok Edwin 896556eec7 Set wasRun to false here on Dan's suggestion.
llvm-svn: 74455
2009-06-29 21:05:10 +00:00
Torok Edwin 24c7835d19 Call doInitialization(), releaseMemory(), and doFinalization() for on-the-fly passes as well.
Also don't call finalizers for LoopPass if initialization was not called.
Add a unittest that tests that these methods are called, in the proper
order, and the correct number of times.

llvm-svn: 74438
2009-06-29 18:49:09 +00:00
David Greene f92ba97cda Add more vector ValueTypes for AVX and other extended vector instruction
sets.

llvm-svn: 74427
2009-06-29 16:47:10 +00:00
Owen Anderson f92b432385 Make this const.
llvm-svn: 74317
2009-06-26 20:21:18 +00:00
Devang Patel 4c563168d5 Add constructor to create MDString using std::string
llvm-svn: 74133
2009-06-24 22:42:39 +00:00
Owen Anderson ecdab5406d Guard the listeners list. Unfortunately, this requires a real static rather
than a managed static because other managed statics can (and do) access this
list in their destructors.  Yes, I know it's horrible.

llvm-svn: 74029
2009-06-24 00:25:42 +00:00
Owen Anderson 5cc4131063 Revert my last series of commits related to Timer and 64-bit atomics. Not all the targets
we care about are capable of supporting it.

llvm-svn: 73993
2009-06-23 20:17:22 +00:00
Owen Anderson 9262d43c5d Atomic ops that do arithmetic use signed arithmetic.
llvm-svn: 73980
2009-06-23 18:30:27 +00:00
Owen Anderson 9e3df5b67f Label the existing atomic functions as 32-bit specific, and add a 64-bit one that will be useful in
the near future.

llvm-svn: 73971
2009-06-23 18:01:04 +00:00
Nick Lewycky 6b8320fa5b Expand this test to handle more cases (remainder and shifts) of zero.
llvm-svn: 73839
2009-06-21 01:56:41 +00:00
Chris Lattner 62fdd112fc implement PR4424: 0/x is always 0 for integer division.
llvm-svn: 73835
2009-06-21 01:15:55 +00:00
Owen Anderson 2cda7d74bc Forgot this file.
llvm-svn: 73802
2009-06-20 00:26:26 +00:00
Owen Anderson 0d2de8c35e Revert r73790, and replace it with a significantly less ugly solution. Rather than trying to make the global reader-writer lock work,
create separate recursive mutexes for each value map.  The recursive-ness fixes the double-acquiring issue, which having one per ValueMap
lets us continue to maintain some concurrency.

llvm-svn: 73801
2009-06-20 00:24:58 +00:00
Owen Anderson b07dd959a4 Fix a serious bug that would cause deadlock during abstract type refinement. The constant creation
gets involved, and we end up trying to recursively acquire a writer lock.  The fix for this is slightly horrible,
and involves passing a boolean "locked" parameter around in Constants.cpp, but it's better than having locked and
unlocked versions of most of the code.

llvm-svn: 73790
2009-06-19 23:16:19 +00:00
Owen Anderson 59ba814f39 Forgot to remove some explicit locking when it became implicit in the ValueMap.
llvm-svn: 73778
2009-06-19 18:34:09 +00:00
Owen Anderson 81241a37fa Move the memory fences out of the path for single-threaded mode.
llvm-svn: 73775
2009-06-19 17:45:12 +00:00
Owen Anderson ff967be708 Fix incorrect comment pointed out by Duncan.
llvm-svn: 73773
2009-06-19 17:20:50 +00:00
Owen Anderson b614f1e13c Simplify.
llvm-svn: 73725
2009-06-18 21:35:56 +00:00
Owen Anderson 7f1ef67a7b Simplify.
llvm-svn: 73723
2009-06-18 20:56:48 +00:00
Owen Anderson 5a6960fcc3 Add a SmartScopedLock, and use it to simplify code.
llvm-svn: 73722
2009-06-18 20:51:00 +00:00
Owen Anderson a6dc7456e1 Simplify with SmartRWMutex.
llvm-svn: 73721
2009-06-18 20:44:31 +00:00
Owen Anderson 5e1f6d95a2 Simplify by using no-op-when-not-multithreaded locks.
llvm-svn: 73719
2009-06-18 20:36:21 +00:00
Owen Anderson 830ff50abf Simplify using mutexes that become no-ops when not in multithreaded mode.
llvm-svn: 73716
2009-06-18 20:15:26 +00:00
Owen Anderson d830eb8365 Simplify a lot of code by using a R/W mutex that becomes a no-op when multithreading is disabled.
llvm-svn: 73714
2009-06-18 19:10:19 +00:00
Owen Anderson fa107259fe Use SmartMutex to simplify.
llvm-svn: 73712
2009-06-18 18:36:34 +00:00
Owen Anderson 7d42b95b6c Move Threading.[h|cpp] from Support to System.
llvm-svn: 73707
2009-06-18 16:54:52 +00:00
Owen Anderson c5eb1ee4b7 Fix the double checked locking in this file too.
llvm-svn: 73703
2009-06-18 16:17:42 +00:00
Owen Anderson 0fd4eaef30 As pointed out by Duncan, I accidentally dropped the first MemoryFence of the
double-checked locking pattern here.

llvm-svn: 73701
2009-06-18 16:08:27 +00:00
Nick Lewycky 87c4a05008 Add braces to clarify if/else structure and remove warning.
llvm-svn: 73673
2009-06-18 03:01:42 +00:00
Owen Anderson ed14e767e8 Reapply r73647 in a non-broken form.
llvm-svn: 73662
2009-06-17 23:49:06 +00:00
Owen Anderson 89ee957cbd Use double-checked locking for this lazy initialization.
llvm-svn: 73653
2009-06-17 22:53:57 +00:00
Owen Anderson aab59c52cf Protect the GC table in Function.cpp
llvm-svn: 73647
2009-06-17 22:23:31 +00:00
Owen Anderson b299d40d5a Use atomic increment here.
llvm-svn: 73643
2009-06-17 22:01:09 +00:00
Owen Anderson c7b91a0820 Thread-safe (and ManagedStatic-ized) LeakDetector!
llvm-svn: 73642
2009-06-17 21:56:05 +00:00
Owen Anderson 0dd39fdf96 Guard mutation of the timing info global.
llvm-svn: 73639
2009-06-17 21:28:54 +00:00
Owen Anderson eae9772679 We need to use double-checked locking for lazy initialization in this case when running multithreaded.
llvm-svn: 73636
2009-06-17 21:16:20 +00:00
Owen Anderson f89c38cace Factor out some common code.
llvm-svn: 73631
2009-06-17 20:43:39 +00:00
Owen Anderson 65c5cd728e Add an RAII ScopedWriter, which allows one to acquire a writer lock for the duration of a scope. Simplify a lot of uses of
writer locks in Constants.cpp by using it.

llvm-svn: 73630
2009-06-17 20:34:43 +00:00
Owen Anderson 61794049e4 Simplify the locking on the Constants tables, and make it more efficient, by pushing it into the ValueMap from the callers.
Document those ValueMap functions that are _not_ locked, so that callers are aware that they need to do the locking themselves.

llvm-svn: 73628
2009-06-17 20:10:08 +00:00
Owen Anderson 2d7231d4c3 Type safety for Constants.cpp! Some of this is temporary, as I'm planning to push some of the R/W locking into FoldingSet.
llvm-svn: 73624
2009-06-17 18:40:29 +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
Owen Anderson a4b739aff4 Type safety for TypeSymbolTable!
llvm-svn: 73614
2009-06-17 16:56:27 +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
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
Dan Gohman 7889f2b5e2 Use Type::isIntOrIntVector and Type::isFPOrFPVector.
llvm-svn: 73433
2009-06-15 22:25:12 +00:00
Dan Gohman 7ccc52f131 Support vector casts in more places, fixing a variety of assertion
failures.

To support this, add some utility functions to Type to help support
vector/scalar-independent code. Change ConstantInt::get and
ConstantFP::get to support vector types, and add an overload to
ConstantInt::get that uses a static IntegerType type, for
convenience.

Introduce a new getConstant method for ScalarEvolution, to simplify
common use cases.

llvm-svn: 73431
2009-06-15 22:12:54 +00:00
Dan Gohman 4fe64deb7b Fix old-style type names in comments.
llvm-svn: 73362
2009-06-14 23:30:43 +00:00
Dan Gohman 17fb0d24eb Give Instruction::isSameOperationAs a corresponding comment to note
the relationship with MergeFunctions.cpp's isEquivalentOperation,
and make a trivial code reordering so that the two functions are
easier to compare.

Fix the name of Instruction::isSameOperationAs in MergeFunction.cpp's
isEquivalentOperation's comment, and fix a nearby 80-column violation.

llvm-svn: 73241
2009-06-12 19:03:05 +00:00
Duncan Sands c3a7992216 Cosmetic changes to parameter attribute verification.
llvm-svn: 73188
2009-06-11 08:11:03 +00:00
Jay Foad 557169d923 Implement and use new method Function::hasAddressTaken().
llvm-svn: 73164
2009-06-10 08:41:11 +00:00
Nick Lewycky 0aa6a74a79 Create FunctionType::isValidArgumentType to go along with isValidReturnType.
Also create isValidElementType for ArrayType, PointerType, StructType and
VectorType.

Make LLParser use them. This closes up some holes like an assertion failure on:

  %x = type {label}

but largely doesn't change any semantics. The only thing we accept now which
we didn't before is vectors of opaque type such as "<4 x opaque>". The opaque
can be resolved to an int or float when linking.

llvm-svn: 73016
2009-06-07 07:26:46 +00:00
Nick Lewycky cc13058998 Remove cyclic MDNode detection. Any attempt to create a cyclic MDNode will
crash LLVM first.

llvm-svn: 73011
2009-06-07 04:03:01 +00:00
Devang Patel d1c7d34924 Add new function attribute - noimplicitfloat
Update code generator to use this attribute and remove NoImplicitFloat target option.
Update llc to set this attribute when -no-implicit-float command line option is used.

llvm-svn: 72959
2009-06-05 21:57:13 +00:00
Dan Gohman 2bde90b3ee Fix a copy+pasto in an assertion string that Jay Foad noticed.
llvm-svn: 72953
2009-06-05 18:34:16 +00:00
Dan Gohman 5208dd899f Update the Verifier to be aware of the difference between Add and FAdd, etc.
llvm-svn: 72946
2009-06-05 16:10:00 +00:00
Dan Gohman a5b9645c4b Split the Add, Sub, and Mul instruction opcodes into separate
integer and floating-point opcodes, introducing
FAdd, FSub, and FMul.

For now, the AsmParser, BitcodeReader, and IRBuilder all preserve
backwards compatability, and the Core LLVM APIs preserve backwards
compatibility for IR producers. Most front-ends won't need to change
immediately.

This implements the first step of the plan outlined here:
http://nondot.org/sabre/LLVMNotes/IntegerOverflow.txt

llvm-svn: 72897
2009-06-04 22:49:04 +00:00
Devang Patel 72a4d2fec1 Add new function attribute - noredzone.
Update code generator to use this attribute and remove DisableRedZone target option.
Update llc to set this attribute when -disable-red-zone command line option is used.

llvm-svn: 72894
2009-06-04 22:05:33 +00:00
Nick Lewycky adbc284666 Give embedded metadata its own type instead of relying on EmptyStructTy.
llvm-svn: 72610
2009-05-30 05:06:04 +00:00
Bill Wendling 09f17a8479 Untabification.
llvm-svn: 72604
2009-05-30 01:09:53 +00:00
Duncan Sands 15de591890 Dan noticed that the verifier wasn't thoroughly checking uses of
invoke results (see the testcases).  Tighten up the checking.

llvm-svn: 72586
2009-05-29 19:39:36 +00:00
Nick Lewycky 47be7d135c Audit the type constructors. Previously it was possible to create [0 x void]
or use labels as members of structures for example. Also included a couple of
whitespace fixes.

llvm-svn: 72402
2009-05-25 21:28:11 +00:00
Duncan Sands e5e9f09c6d Always verify dominfo if expensive checking is enabled.
llvm-svn: 72253
2009-05-22 08:52:53 +00:00
Torok Edwin 9c4dcfb4a7 Revert this. There's no way to verifiy indirect calls, and an optimizer can turn
indirect call into direct call, thus the verifier would reject something it
previously accepted.

llvm-svn: 72249
2009-05-22 07:12:05 +00:00
Torok Edwin a39d69684a Verify that calling conventions match function prototype.
This only rejects mismatches between target specific calling convention
and C/LLVM specific calling convention.
There are too many fastcc/C, coldcc/cc42 mismatches in the testsuite, these are
not reject by the verifier.

llvm-svn: 72248
2009-05-22 06:41:43 +00:00
Dan Gohman faa7d055de Update an assertion string to new-style type names.
llvm-svn: 72239
2009-05-22 00:40:35 +00:00
Eli Friedman 0ac904455e Fix some incorrect logic in DominanceFrontier::splitBlock. Part of
PR4238.

llvm-svn: 72223
2009-05-21 20:40:30 +00:00
Duncan Sands d334aca93f Add a getAlignOf helper for getting the ABI alignment of a
type as a target independent constant expression.  I confess
that I didn't check that this method works as intended (though
I did test the equivalent hand-written IR a little).  But what
could possibly go wrong!

llvm-svn: 72213
2009-05-21 15:52:21 +00:00
Jay Foad 7d0479f2c2 Use v.data() instead of &v[0] when SmallVector v might be empty.
llvm-svn: 72210
2009-05-21 09:52:38 +00:00
Dan Gohman f0974de75e Revert r72025. It is possible for clients to convert between signed types
and pointer types safely if they only do so when the sizes are the same.
llvm-gcc is such a client.

llvm-svn: 72029
2009-05-18 18:55:39 +00:00
Dan Gohman 32912cbf65 Add assertions to CastInst::getCastOpcode to catch attempted conversions
between integers and pointers when the source type is marked signed,
since inttoptr and ptrtoint always use zero-extension when the destination
is larger than the source.

llvm-svn: 72025
2009-05-18 18:18:57 +00:00
Bill Wendling aeec9d53ce Needed #includes. Thanks Fritz van Bommel!
llvm-svn: 71413
2009-05-10 23:27:41 +00:00
Nick Lewycky b8f9b7a965 Make MDNode use CallbackVH. Also change MDNode to store Value* instead of
Constant* in preperation of a future change to support holding non-Constants
in an MDNode.

llvm-svn: 71407
2009-05-10 20:57:05 +00:00
Duncan Sands 7374a0118d OCaml parameter attribute bindings from PR2752.
Incomplete, but better than nothing.

llvm-svn: 71081
2009-05-06 12:21:17 +00:00
Duncan Sands 1efabaaa2a Allow readonly functions to unwind exceptions. Teach
the optimizers about this.  For example, a readonly
function with no uses cannot be removed unless it is
also marked nounwind.

llvm-svn: 71071
2009-05-06 06:49:50 +00:00
Evan Cheng cfdbfccd91 Quotes should be printed before private prefix; some code clean up.
llvm-svn: 71032
2009-05-05 22:50:29 +00:00
Dan Gohman 3f02595048 Use true instead of 1 for a boolean value. And fix a copy+pasto
in a comment.

llvm-svn: 70882
2009-05-04 17:25:21 +00:00
Dan Gohman 745ad4486e Apply Jeffrey Yasskin's CallbackVH patch, with minor tweaks from me
to make the copy constructor and destructor protected, and corresponding
adjustments to the unittests.

llvm-svn: 70644
2009-05-02 21:10:48 +00:00
Sanjiv Gupta 8d319047c5 Any size of integral indices are allowed in gep for indexing into sequential types. Also adding a test case to check the indices type allowed into struct.
llvm-svn: 70134
2009-04-26 17:14:35 +00:00
Chris Lattner cde89e48b2 Allow aliasee to be a GEP or bitcast instead of just a bitcast.
The real fix for this whole mess is to require the operand of the
alias to be a *GlobalValue* (not a general constant, including 
constant exprs) but allow the operand and the alias type to be
unrelated.

This fixes PR4066

llvm-svn: 70079
2009-04-25 21:23:19 +00:00
Sanjiv Gupta 46c97e626f Allow i16 type indices to gep.
llvm-svn: 69946
2009-04-24 02:37:54 +00:00
Dan Gohman f7db87f2dc It's not necessary for PrintModulePass to flush the output streams
now that errs() is properly non-buffered.

llvm-svn: 69602
2009-04-20 16:26:25 +00:00
Dan Gohman 6c7a485c19 Don't discard an AssemblyAnnotationWriter when writing GlobalValues,
which include Functions, where it can be quite useful to use an
AssemblyAnnotationWriter.

llvm-svn: 69598
2009-04-20 16:10:33 +00:00
Dan Gohman 5fe6b530a5 Implement operator<<(raw_ostream &OS, const Type &T).
llvm-svn: 69596
2009-04-20 15:55:38 +00:00
Nick Lewycky 4a7bcf6410 Limit the number of times we're willing to chase pointers. Removes an O(n^2)
problem from instcombine.

llvm-svn: 69151
2009-04-15 06:23:41 +00:00
Chris Lattner 184f1be4a8 Add a new "available_externally" linkage type. This is intended
to support C99 inline, GNU extern inline, etc.  Related bugzilla's
include PR3517, PR3100, & PR2933.  Nothing uses this yet, but it
appears to work.

llvm-svn: 68940
2009-04-13 05:44:34 +00:00
Chris Lattner bc8848f76f Add a new Type::getPointerTo method, which is shorthand for
llvm::PointerType::get().  Patch by Anders Johnsen!

llvm-svn: 68772
2009-04-10 06:42:02 +00:00
Chris Lattner a72576e92b disable this code for now, re-breaking PR2975, but fixing
a testcase I'm about to attach to that pr.

llvm-svn: 68592
2009-04-08 04:36:59 +00:00
Torok Edwin 671eb8b7bb fix style.
llvm-svn: 68542
2009-04-07 19:45:59 +00:00
Torok Edwin 73312b3f39 Another attempt at fixing PR2975.
Types can have references to eachother, so we can't just call destroy on them.

llvm-svn: 68523
2009-04-07 17:23:02 +00:00
Torok Edwin 839026562c revert r68457, its crashing in make check.
llvm-svn: 68459
2009-04-06 20:57:34 +00:00
Torok Edwin 96dadc3b63 fix (part of) memory leak on shutdown. See PR2975.
llvm-svn: 68457
2009-04-06 20:49:21 +00:00
Nick Lewycky 0bb65f44fa Remove bogus include.
llvm-svn: 68421
2009-04-04 07:42:46 +00:00
Nick Lewycky 49f891958f Add support for embedded metadata to LLVM. This introduces two new types of
Constant, MDString and MDNode which can only be used by globals with a name
that starts with "llvm." or as arguments to a function with the same naming
restriction.

llvm-svn: 68420
2009-04-04 07:22:01 +00:00
Devang Patel ec9c58f7e5 Clean up pass manager cache after each run.
llvm-svn: 68254
2009-04-01 22:34:41 +00:00
Chris Lattner 90234f34c6 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.

llvm-svn: 68149
2009-03-31 22:11:05 +00:00
Anton Korobeynikov 255a3cbfb4 Fix infinite looping
llvm-svn: 68034
2009-03-30 15:28:21 +00:00
Anton Korobeynikov d5e8e93a92 Properly propagate Kind.
llvm-svn: 68033
2009-03-30 15:28:00 +00:00
Anton Korobeynikov 7437b59caf Extend the relocation tracker handler, so we can filter on different 'kinds' of relocations required.
llvm-svn: 68004
2009-03-29 17:13:18 +00:00
Gabor Greif 41c8515b1b "ghostify" the ilist<Function> sentinel
llvm-svn: 67872
2009-03-27 22:28:33 +00:00
Dale Johannesen 93eefa0043 Fix internal representation of fp80 to be the
same as a normal i80 {low64, high16} rather
than its own {high64, low16}.  A depressing number
of places know about this; I think I got them all.
Bitcode readers and writers convert back to the old
form to avoid breaking compatibility.

llvm-svn: 67562
2009-03-23 21:16:53 +00:00
Dan Gohman 4f2fea1a21 Now that errs() is properly non-buffered, there's no need to
explicitly flush it.

llvm-svn: 67526
2009-03-23 15:57:19 +00:00
Chris Lattner cbeda87da1 add a fastpath to ConstantExpr::getBitCast to handle the case when an obviously
unneeded bitcast is requested.  This is common for frontends who just unconditionally
cast even if the target is often the right type already.  THis prevents going into
getFoldedCast which switches on the opcode and does a bunch of other stuff before
doing the same opzn.

llvm-svn: 67435
2009-03-21 06:55:54 +00:00
Nick Lewycky 063699af70 Fix a couple glaring whitespace issues. This file isn't internally consistent
either.

llvm-svn: 67288
2009-03-19 06:31:22 +00:00
Gabor Greif bda5a94c79 typo
llvm-svn: 67080
2009-03-17 11:38:29 +00:00
Nick Lewycky edbb0e2f1b Simplify. "Broken" is always true here.
llvm-svn: 67025
2009-03-15 06:40:32 +00:00
Nick Lewycky 5aa592a2f8 Remove obviously redundant call.
llvm-svn: 67023
2009-03-15 06:39:52 +00:00
Dan Gohman 79975d5ffb Apply a patch by Micah Villmow to fix AsmParser to accept vector
shift constant expressions, and add support for folding vector
shift constant expressions. This fixes PR3802.

llvm-svn: 67010
2009-03-14 17:09: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
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
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
Duncan Sands 4581bebf2a It makes no sense to have a ODR version of common
linkage, so remove it.

llvm-svn: 66690
2009-03-11 20:14:15 +00:00
Duncan Sands e2881053c9 Remove the one-definition-rule version of extern_weak
linkage: this linkage type only applies to declarations,
but ODR is only relevant to globals with definitions.

llvm-svn: 66650
2009-03-11 08:08:06 +00:00
Dan Gohman 79fc0e9250 Use WriteAsOperand instead of manually decorating the name for this
debug output. This improves the printing of anonymous values.

llvm-svn: 66561
2009-03-10 18:47:59 +00:00
Chris Lattner 6f884e07c5 make GlobalValue::removeDeadConstantUsers() const.
llvm-svn: 66403
2009-03-09 05:50:45 +00:00
Chris Lattner 4a48815bd9 fix Analysis/BasicAA/2004-12-08-BasicAACrash.ll by allowing opaque types.
llvm-svn: 66395
2009-03-09 04:56:22 +00:00
Chris Lattner 6090a42fe5 Fix PR3746 - Crash in isel with GEP of function pointer
by checking that the top-level type of a gep is sized. This
causes us to reject the example with:

llvm-as: t2.ll:2:16: invalid getelementptr indices
getelementptr i32()* null, i32 1
              ^

llvm-svn: 66393
2009-03-09 04:46:40 +00:00
Chris Lattner e408601cec fix typo
llvm-svn: 66367
2009-03-08 04:06:26 +00:00
Duncan Sands 12da8ce3d2 Introduce new linkage types linkonce_odr, weak_odr, common_odr
and extern_weak_odr.  These are the same as the non-odr versions,
except that they indicate that the global will only be overridden
by an *equivalent* global.  In C, a function with weak linkage can
be overridden by a function which behaves completely differently.
This means that IP passes have to skip weak functions, since any
deductions made from the function definition might be wrong, since
the definition could be replaced by something completely different
at link time.   This is not allowed in C++, thanks to the ODR
(One-Definition-Rule): if a function is replaced by another at
link-time, then the new function must be the same as the original
function.  If a language knows that a function or other global can
only be overridden by an equivalent global, it can give it the
weak_odr linkage type, and the optimizers will understand that it
is alright to make deductions based on the function body.  The
code generators on the other hand map weak and weak_odr linkage
to the same thing.

llvm-svn: 66339
2009-03-07 15:45:40 +00:00
Gabor Greif 51bbcf834c simplify the way how traits get hold of the symbol table
llvm-svn: 66336
2009-03-07 12:33:24 +00:00
Gabor Greif 6e1ca84d2c further simplifications arising from peruse of the more declarative interface
llvm-svn: 66333
2009-03-07 10:49:57 +00:00
Daniel Dunbar dcf8d3c9eb Add Module::getNamedValue; use to normalize access to Module symbol
table.
 - No functionality change.

llvm-svn: 66289
2009-03-06 22:04:43 +00:00
Chris Lattner 4c1e9541d3 Sprinkle some PrettyStackEntry magic into the passmanager. With this, we now
get nice and happy stack traces when we crash in an optimizer or codegen.  For
example, an abort put in UnswitchLoops now looks like this:

Stack dump:
0.	Program arguments: clang pr3399.c -S -O3 
1.	<eof> parser at end of file
2.	per-module optimization passes
3.	Running pass 'CallGraph Pass Manager' on module 'pr3399.c'.
4.	Running pass 'Loop Pass Manager' on function '@foo'
5.	Running pass 'Unswitch loops' on basic block '%for.inc'
Abort

llvm-svn: 66260
2009-03-06 06:45:05 +00:00
Chris Lattner 609873608e various cosmetic cleanups.
llvm-svn: 66254
2009-03-06 05:53:14 +00:00