Commit Graph

3082 Commits

Author SHA1 Message Date
Chris Lattner 213a9f933d switch from std::ostream to raw ostream, fix file header.
llvm-svn: 79815
2009-08-23 03:56:06 +00:00
Owen Anderson c1a3a471c4 Reduce contention on the Attributes lock by using atomic operations for reference counting rather than locking.
llvm-svn: 79560
2009-08-20 19:03:20 +00:00
Dan Gohman 16f5415f5b Rename hasNoUnsignedOverflow and hasNoSignedOverflow to hasNoUnsignedWrap
and hasNoSignedWrap, for consistency with the nuw and nsw properties.

llvm-svn: 79539
2009-08-20 17:11:38 +00:00
Daniel Dunbar cb13b48969 Add a fast path for setName("") on an unnamed value.
llvm-svn: 79492
2009-08-19 23:37:23 +00:00
Owen Anderson d6f7af652e AttrListPtr operations need to be atomic.
llvm-svn: 79486
2009-08-19 22:58:34 +00:00
Daniel Dunbar 948f82b8e4 Change ValueSymbolTable to use raw_svector_ostream for string concatenation.
llvm-svn: 79449
2009-08-19 19:22:52 +00:00
Owen Anderson 6d549d6450 Reapply my less-lock-contention-in-leak-detector patch, now with new files
actually added.

llvm-svn: 79429
2009-08-19 17:07:46 +00:00
Daniel Dunbar acf0b258de Make a SmallVector size more reasonable.
llvm-svn: 79403
2009-08-19 05:08:06 +00:00
Owen Anderson 077df2c4ce Revert my last patch temporarily.
llvm-svn: 79388
2009-08-19 00:52:13 +00:00
Owen Anderson 3042539089 Privatize part of the leak detector mechanism, which turned out to be heavily contended
when trying to run opt in parallel.  This lets parallel opt crunch 403.gcc in about a third
of the time.

llvm-svn: 79387
2009-08-19 00:37:02 +00:00
Owen Anderson e8f2185a2f Privatize the ValueHandle global map. Because this is used so heavily throughout the code base, locking all accesses to
it is not practical performance-wise.

llvm-svn: 79355
2009-08-18 18:28:58 +00:00
Devang Patel c6faffde6c Add prefix only if it is needed.
llvm-svn: 79289
2009-08-17 23:17:17 +00:00
Owen Anderson 9801560ace Privatize the last bits of static type state.
llvm-svn: 79258
2009-08-17 17:59:35 +00:00
Owen Anderson 286b3af6ae Move the TypeMap lock to a member on LLVMContextImpl.
llvm-svn: 79256
2009-08-17 17:34:27 +00:00
Owen Anderson d91e6b097d Add locking around the attributes list.
llvm-svn: 79255
2009-08-17 17:10:58 +00:00
Chris Lattner ee97b8b11c the MinPad argument to PadToColumn only really makes sense to be 1,
just remove the argument and replace it with 1.

llvm-svn: 79246
2009-08-17 15:48:08 +00:00
Dan Gohman d04f9bf01a Fix printing of instructions with null operands.
llvm-svn: 79243
2009-08-17 15:28:08 +00:00
Dan Gohman d0cc3f31c0 Always print at least one space before adding a comment.
llvm-svn: 79242
2009-08-17 15:27:30 +00:00
Erick Tryzelaar dd99135721 Expose creating constant ints and floats from strings in llvm-c.
llvm-svn: 79213
2009-08-16 23:36:46 +00:00
Erick Tryzelaar fc2280d874 Add helper functions to ConstantInt and ConstantFP to accept strings.
llvm-svn: 79212
2009-08-16 23:36:33 +00:00
Dan Gohman ff3af725ea Add a getOffsetOf, for building a target-independent expression for
offsetof, similar to getSizeOf for sizeof.

llvm-svn: 79208
2009-08-16 21:26:11 +00:00
Erick Tryzelaar 9813beadcd Add an llvm-c function that lets you insert an instruction with a name.
llvm-svn: 79163
2009-08-16 02:20:57 +00:00
Erick Tryzelaar 4cc690cce4 Expose most of the Constant creation functions to llvm-c.
llvm-svn: 79160
2009-08-16 02:20:12 +00:00
Erick Tryzelaar 3045b8b5d6 Expose most of the rest of IRBuilder's functions to llvm-c.
llvm-svn: 79159
2009-08-16 02:19:59 +00:00
Chris Lattner b1bf2009a4 switch DominanceFrontier::splitBlock to use a smallvector for
the pred list instead of a vector, saving a boat load of malloc/free's.

llvm-svn: 79062
2009-08-15 01:39:28 +00:00
Erick Tryzelaar 262332f24b Expose LLVMContext to llvm-c.
llvm-svn: 78964
2009-08-14 00:01:31 +00:00
Owen Anderson a42ac6953b Actually privatize a IntegerTypes, and fix a few bugs exposed by this.
llvm-svn: 78955
2009-08-13 23:27:32 +00:00
Dan Gohman d57cbfc7d8 Make formatted_raw_ostream restore the buffer settings of the
underlying stream when it is finished, so that clients don't
have to do this manually.

llvm-svn: 78952
2009-08-13 23:16:59 +00:00
Dan Gohman 0809712def Take the fast path for any named value and any GlobalValue, which doesn't
need TypePrinting despite being a subclass of Constant. This fixes
compile-time problems especially visible on 403.gcc when -asm-verbose is
enabled.

llvm-svn: 78951
2009-08-13 23:07:11 +00:00
Owen Anderson 55f1c09e31 Push LLVMContexts through the IntegerType APIs.
llvm-svn: 78948
2009-08-13 21:58:54 +00:00
Dan Gohman 8061d9e23f Fix a 4x slowdown in llc -asm-verbose caused by the use of
WriteAsOperand in more places.

Now that more things are using WriteAsOperand, its behavior of
constructing a TypePrinting object and populating it with strings for all
the numbered types in the Module on each call is a significant bottleneck.
Fancier solutions could be pursued here, but for now, just bypass the
TypePrinting overhead in obvious cases.

llvm-svn: 78906
2009-08-13 15:27:57 +00:00
Dan Gohman b4583b1b36 Change the indentation for LLVM Assembly files from 1 tab to 2 spaces.
This is vaguely consistent with LLVM's own source code, but more
importantly it lets more lines stay within 80 columns.

llvm-svn: 78879
2009-08-13 01:41:52 +00:00
Dan Gohman 69273e6474 Now that numbered types have their number printed, it's no longer
interesting to print the number in a comment. Numbered instructions
don't need their number in a comment either.

Also, tidy up newline printing.

llvm-svn: 78865
2009-08-12 23:54:22 +00:00
Dan Gohman 466876b0a6 Extend the AsmWriter to print unnamed numbered types as "%0 = type ..."
and unnamed numbered global variables as "@0 = global ...". Extend the
AsmParser to recognize these forms.

llvm-svn: 78859
2009-08-12 23:32:33 +00:00
Dan Gohman 12dad639b5 Make AsmWriter more careful with formatted_raw_ostream so that
it doesn't leave the underlying stream in unbuffered mode when
the stream was originally buffered.

Also, change WriteAsOperand back to plain raw_ostream. This
lets it work for either formatted_raw_ostream or plain
raw_ostream, so that it doesn't have to force a buffer flush
on a plain raw_ostream.

llvm-svn: 78837
2009-08-12 20:56:03 +00:00
Dan Gohman e274526d78 Make LLVM Assembly dramatically easier to read by aligning the comments,
using formatted_raw_ostream's PadToColumn.

Before:

bb1:            ; preds = %bb
  %2 = sext i32 %i.01 to i64            ; <i64> [#uses=1]
  %3 = getelementptr double* %p, i64 %2         ; <double*> [#uses=1]
  %4 = load double* %3, align 8         ; <double> [#uses=1]
  %5 = fmul double %4, 1.100000e+00             ; <double> [#uses=1]
  %6 = sext i32 %i.01 to i64            ; <i64> [#uses=1]
  %7 = getelementptr double* %p, i64 %6         ; <double*> [#uses=1]

After:

bb1:                                        ; preds = %bb
  %2 = sext i32 %i.01 to i64                ; <i64> [#uses=1]
  %3 = getelementptr double* %p, i64 %2     ; <double*> [#uses=1]
  %4 = load double* %3, align 8             ; <double> [#uses=1]
  %5 = fmul double %4, 1.100000e+00         ; <double> [#uses=1]
  %6 = sext i32 %i.01 to i64                ; <i64> [#uses=1]
  %7 = getelementptr double* %p, i64 %6     ; <double*> [#uses=1]

Several tests required whitespace adjustments.

llvm-svn: 78816
2009-08-12 17:23:50 +00:00
Dan Gohman 5476cfdb15 Remove a bunch more now-unnecessary Context arguments.
llvm-svn: 78809
2009-08-12 16:23:25 +00:00
Owen Anderson 117c9e8497 Add contexts to some of the MVT APIs. No functionality change yet, just the infrastructure work needed to get the contexts to where they need to be first.
llvm-svn: 78759
2009-08-12 00:36:31 +00:00
Dan Gohman 76733748e1 Simplify this code, and use an in-bounds GEP.
llvm-svn: 78755
2009-08-12 00:32:55 +00:00
Owen Anderson 9f94459d24 Split EVT into MVT and EVT, the former representing _just_ a primitive type, while
the latter is capable of representing either a primitive or an extended type.

llvm-svn: 78713
2009-08-11 20:47:22 +00:00
Dan Gohman 77ad32ab0e Add convenience functions for creating nsw add operators.
llvm-svn: 78707
2009-08-11 20:20:39 +00:00
Dan Gohman 221a2c711d Don't set the isexact flag if an sdiv operator has been folded into
something else.

llvm-svn: 78702
2009-08-11 19:56:00 +00:00
Daniel Dunbar 919fe2bd2f Simplify ConstantExpr::getInBoundsGetElementPtr and fix a possible crash, if
constant folding eliminated the GEP instruction.
 - clang was hitting this on its test suite (for x86_64, at least).

llvm-svn: 78698
2009-08-11 18:28:09 +00:00
Daniel Dunbar 270968279b Revert 78680 until I figure out why it completely broke things.
llvm-svn: 78697
2009-08-11 18:11:15 +00:00
Devang Patel 5c310be0ff Link NamedMDNodes.
llvm-svn: 78696
2009-08-11 18:01:24 +00:00
Dan Gohman 50c09d0ca3 Add convenience functions for creating inbounds GEPs.
llvm-svn: 78695
2009-08-11 17:57:01 +00:00
Benjamin Kramer 78c3bcb582 Make LLVMContext and LLVMContextImpl classes instead of structs.
llvm-svn: 78690
2009-08-11 17:45:13 +00:00
Daniel Dunbar 5c13812e2f Remove some unnecessary LoadInst constructors, missed during Twinification.
llvm-svn: 78689
2009-08-11 17:38:47 +00:00
Dan Gohman 58f4d89a10 Add convenience functions for creating exact sdiv operators, and
use them in CreatePtrDiff.

llvm-svn: 78682
2009-08-11 17:05:24 +00:00
Dan Gohman 7c50c9bd63 Tidy #includes.
llvm-svn: 78677
2009-08-11 16:02:12 +00:00
Dan Gohman 5211b0128b Fix a typo in an assertion string.
llvm-svn: 78671
2009-08-11 15:53:15 +00:00
Devang Patel c5aa8c6d29 Remove dead metadata.
llvm-svn: 78651
2009-08-11 06:31:57 +00:00
Bob Wilson 2cd5da8300 Add a new overloaded EVT::vAny type for use in TableGen to allow intrinsic
arguments that are vectors of any size and element type.

llvm-svn: 78631
2009-08-11 01:14:02 +00:00
Devang Patel 9b4ea1c474 Remove MDNode from ValueMap when MDNode is destroyed.
llvm-svn: 78612
2009-08-10 22:59:46 +00:00
Owen Anderson 53aa7a960c Rename MVT to EVT, in preparation for splitting SimpleValueType out into its own struct type.
llvm-svn: 78610
2009-08-10 22:56:29 +00:00
Devang Patel 2c6c743039 Rename MDNodeSet as MDNodes.
llvm-svn: 78607
2009-08-10 22:31:31 +00:00
Daniel Dunbar 009ac1ae04 Rename ConvertType to ConvertConstant to avoid a name conflict on llvm-gcc.
llvm-svn: 78596
2009-08-10 20:56:46 +00:00
Devang Patel 0bdbee14cd We are not using FoldingSet for metadata uniquing anymore.
llvm-svn: 78585
2009-08-10 18:59:07 +00:00
Benjamin Kramer 850e0f9e7e g++ 4.0 doesn't have std::vector::data.
llvm-svn: 78579
2009-08-10 18:27:33 +00:00
Owen Anderson 13234f83ac Change the MDNode uniquing to a ValueMap, at Devang's request.
llvm-svn: 78577
2009-08-10 18:16:08 +00:00
Dan Gohman a6d0afcb74 Fix a bunch of namespace pollution.
llvm-svn: 78363
2009-08-07 01:32:21 +00:00
Daniel Dunbar 84f399103b Don't search the entire type table just to delete a type by name.
- This also fixes the ENABLE_EXPENSIVE_CHECKS failure on vmcore.ml.

llvm-svn: 78287
2009-08-06 06:04:35 +00:00
Owen Anderson 03cb69fbd1 Privatize the StructType table, which unfortunately involves routing contexts through a number of APIs.
llvm-svn: 78258
2009-08-05 23:16:16 +00:00
Owen Anderson 4b5c761af2 Privatize the FunctionType table.
llvm-svn: 78221
2009-08-05 18:13:27 +00:00
Chris Lattner 0aff0b2b58 common globals may also not be marked constant.
llvm-svn: 78169
2009-08-05 05:41:44 +00:00
Chris Lattner d055488c72 Clarify common linkage and the requirements on it. Enforce
them in the verifier.

llvm-svn: 78160
2009-08-05 05:21:07 +00:00
Owen Anderson e565995c65 Privatize the PointerType factory.
llvm-svn: 78130
2009-08-05 00:15:12 +00:00
Owen Anderson d918649d5f Privatize the VectorType uniquing.
llvm-svn: 78125
2009-08-04 23:47:44 +00:00
Owen Anderson 542cffc3eb Begin the process of privatizing the type uniquing tables. No API changes yet, but there will be in the near future.
llvm-svn: 78122
2009-08-04 23:33:01 +00:00
Chris Lattner 694285ca6d revert r78048, it isn't worth using assertingvh here.
llvm-svn: 78119
2009-08-04 23:07:12 +00:00
Benjamin Kramer 83c917a627 Update CMakeLists.
llvm-svn: 78118
2009-08-04 23:02:53 +00:00
Owen Anderson 9b67698574 It helps if I remember to actually add the file...
llvm-svn: 78116
2009-08-04 22:55:26 +00:00
Owen Anderson afd0c4cd56 Factor some of the constants+context related code out into a separate header, to make LLVMContextImpl.h
not hideous.  Also, fix some MSVC compile errors.

llvm-svn: 78115
2009-08-04 22:41:48 +00:00
Owen Anderson 1584a29536 Privatize the last bit of Constant-creation state.
llvm-svn: 78097
2009-08-04 20:25:11 +00:00
Chris Lattner 59c08e76ca switch ValueMap to using AssertingVH. This is an old patch I had laying
around in a tree I forgot about.

llvm-svn: 78048
2009-08-04 04:31:02 +00:00
Devang Patel d7fd6aba7c Keep track of metadata used by other metadata.
llvm-svn: 78012
2009-08-03 22:51:10 +00:00
Dan Gohman f011f5a8a2 Add a new Constant::getIntegerValue helper function, and convert a
few places in InstCombine to use it, to fix problems handling pointer
types. This fixes the recent llvm-gcc bootstrap error.

llvm-svn: 78005
2009-08-03 22:07:33 +00:00
Devang Patel 79238d7e6b Add NamedMDNode destructor.
llvm-svn: 77959
2009-08-03 06:19:01 +00:00
Edward O'Callaghan 4bf58b8add One two many newlines at end of file LLVMContextImpl.cpp
llvm-svn: 77911
2009-08-02 20:06:26 +00:00
Edward O'Callaghan 2dd529c9ef Fix no newline at end of LLVMContextImpl.cpp
llvm-svn: 77907
2009-08-02 19:38:12 +00:00
Owen Anderson c8c302644c Privatize all but one of the remaining constant tables.
llvm-svn: 77748
2009-07-31 22:45:43 +00:00
Owen Anderson 0087fe6e5c Move the metadata constructors back to 2.5 syntax.
llvm-svn: 77733
2009-07-31 21:35:40 +00:00
Owen Anderson 5a1acd9912 Move a few more APIs back to 2.5 forms. The only remaining ones left to change back are
metadata related, which I'm waiting on to avoid conflicting with Devang.

llvm-svn: 77721
2009-07-31 20:28:14 +00:00
Dan Gohman b53e26c7eb Fix printing of Alloca instructions with null operands.
llvm-svn: 77697
2009-07-31 18:23:24 +00:00
Owen Anderson 23a204d91b Move getTrue() and getFalse() to 2.5-like APIs.
llvm-svn: 77685
2009-07-31 17:39:07 +00:00
Devang Patel 98250795e8 Add getOrInsertNamedMetadata().
llvm-svn: 77646
2009-07-30 23:59:04 +00:00
Owen Anderson b292b8ce70 Move more code back to 2.5 APIs.
llvm-svn: 77635
2009-07-30 23:03:37 +00:00
Devang Patel 3f4ab29f45 Do not use getNamedValue() to lookup NamedMDNode. NamedMDNode is not a GlobalValue.
Thanks Benjamin Kramer!

llvm-svn: 77619
2009-07-30 18:46:29 +00:00
Benjamin Kramer 5656e4fcd3 fix a unitialized pointer in NamedMDNode (and reenable unittest)
llvm-svn: 77597
2009-07-30 15:35:55 +00:00
Nate Begeman 50b69eaa36 Typo
llvm-svn: 77568
2009-07-30 02:00:06 +00:00
Devang Patel 847fcacd48 Check null NameMDNode elements.
llvm-svn: 77559
2009-07-30 01:02:04 +00:00
Devang Patel b4a4e774db print single NamedMDNode.
llvm-svn: 77549
2009-07-30 00:02:57 +00:00
Owen Anderson 4056ca9568 Move types back to the 2.5 API.
llvm-svn: 77516
2009-07-29 22:17:13 +00:00
Devang Patel 23e68308b5 Print named metadata.
llvm-svn: 77513
2009-07-29 22:04:47 +00:00
Devang Patel 4a942d0863 There is no need to keep name ref in NamedMDNode.
llvm-svn: 77511
2009-07-29 21:58:56 +00:00
Owen Anderson 487375e9a2 Move ConstantExpr to 2.5 API.
llvm-svn: 77494
2009-07-29 18:55:55 +00:00
Devang Patel 18dfdc99af Keep track of named mdnodes in a Module using an ilist.
llvm-svn: 77476
2009-07-29 17:16:17 +00:00
Bob Wilson 5be9ee399f Fix an assumption that there is a single return value when verifying
overloaded types for intrinsic parameters.

llvm-svn: 77466
2009-07-29 16:25:56 +00:00
Devang Patel 05a26fb6dd Add NamedMDNode.
llvm-svn: 77409
2009-07-29 00:33:07 +00:00
Devang Patel f869caa03f Remove unused method.
llvm-svn: 77378
2009-07-28 22:04:55 +00:00
Devang Patel a4f43fb5dd Rename MDNode.h header. It defines MDnode and other metadata classes.
New name is Metadata.h.

llvm-svn: 77370
2009-07-28 21:49:47 +00:00
Owen Anderson 4aa3295a65 Return ConstantVector to 2.5 API.
llvm-svn: 77366
2009-07-28 21:19:26 +00:00
Owen Anderson c2c7932c64 Change ConstantArray to 2.5 API.
llvm-svn: 77347
2009-07-28 18:32:17 +00:00
Owen Anderson 45308b578b Move ConstantStruct back to 2.5 API.
llvm-svn: 77266
2009-07-27 22:29:26 +00:00
Dan Gohman 75b7f678a3 Add a comment about the "getelementptr null" trick.
llvm-svn: 77262
2009-07-27 21:59:50 +00:00
Dan Gohman 1639c3905e Add a new keyword 'inbounds' for use with getelementptr. See the
LangRef.html changes for details.

llvm-svn: 77259
2009-07-27 21:53:46 +00:00
Daniel Dunbar ae15479eb3 Unbreak build.
llvm-svn: 77256
2009-07-27 21:47:07 +00:00
Owen Anderson 69c464dec4 Move ConstantFP construction back to the 2.5-ish API.
llvm-svn: 77247
2009-07-27 20:59:43 +00:00
Devang Patel 072833539b Initialize mdnNext.
llvm-svn: 77229
2009-07-27 18:42:56 +00:00
Dan Gohman 9c7f808201 Change the assembly syntax for nsw, nuw, and exact, putting them
after their associated opcodes rather than before. This makes them
a little easier to read.

llvm-svn: 77194
2009-07-27 16:11:46 +00:00
Daniel Dunbar 7cc8f7e86d Make sure getName().data() is always null terminated.
llvm-svn: 77149
2009-07-26 09:22:02 +00:00
Daniel Dunbar 9813b0b025 Eliminate some uses of DOUT, cerr, and getNameStart().
llvm-svn: 77145
2009-07-26 07:49:05 +00:00
Daniel Dunbar 32285942a1 Rewrite getName{Start,End,Len} in terms of getName(), instead of vice-versa.
llvm-svn: 77105
2009-07-26 00:51:56 +00:00
Daniel Dunbar a32c999ca2 Simplify.
llvm-svn: 77102
2009-07-26 00:42:33 +00:00
Daniel Dunbar d786b51ea4 Remove Value::setName(const char*, unsigned).
llvm-svn: 77100
2009-07-26 00:34:27 +00:00
Daniel Dunbar 987ec564e7 Remove Value::setName(const char*).
- Split into a separate patch because there is a slight functionality change,
   it is no longer valid to call setName(0), which was equivalent to
   setName(""). I'm hoping no one depends on this...

llvm-svn: 77099
2009-07-26 00:17:14 +00:00
Daniel Dunbar e03eecb75f Remove Value::{isName, getNameRef}.
Also, change MDString to use a StringRef.

llvm-svn: 77098
2009-07-25 23:55:21 +00:00
Daniel Dunbar d43b86d4a4 Finish migrating VMCore to StringRef/Twine based APIs.
llvm-svn: 77051
2009-07-25 06:02:13 +00:00
Daniel Dunbar 4975db6276 Initial update to VMCore to use Twines for string arguments.
- The only meat here is in Value.{h,cpp} the rest is essential 'const
   std::string &' -> 'const Twine &'.

llvm-svn: 77048
2009-07-25 04:41:11 +00:00
Eric Christopher c974225976 Move ExtractElementInst to ::Create instead of new. Update all uses.
llvm-svn: 77044
2009-07-25 02:28:41 +00:00
Dan Gohman 1ddf98ad8e Convert a few more things to use raw_ostream.
llvm-svn: 77039
2009-07-25 01:43:01 +00:00
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