Owen Anderson
69c464dec4
Move ConstantFP construction back to the 2.5-ish API.
...
llvm-svn: 77247
2009-07-27 20:59:43 +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
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
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
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
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
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
2ad52176f9
Move a bit more state over to the LLVMContext.
...
llvm-svn: 76533
2009-07-21 02:47:59 +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
Dan Gohman
7d82e1338e
Make GetElementPtr ConstantExprs default to having no pointer overflow.
...
llvm-svn: 76280
2009-07-18 01:49:22 +00:00
Daniel Dunbar
e974dc3eb1
Fix compile warning.
...
llvm-svn: 76210
2009-07-17 18:33:52 +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
Owen Anderson
c277dc408b
Privatize the ConstantFP table. I'm on a roll!
...
llvm-svn: 76097
2009-07-16 19:05:41 +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
f945a9ed07
Move a few more convenience factory functions from Constant to LLVMContext.
...
llvm-svn: 75840
2009-07-15 21:51:10 +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
Owen Anderson
b6b2530000
Move EVER MORE stuff over to LLVMContext.
...
llvm-svn: 75703
2009-07-14 23:09:55 +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
Owen Anderson
3e42e9f2fc
Move more functionality over to LLVMContext.
...
llvm-svn: 75559
2009-07-13 23:50:59 +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
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
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
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
5c96ef7c4e
Have scoped mutexes take referenes instead of pointers.
...
llvm-svn: 74931
2009-07-07 18:33:04 +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
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
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
7d42b95b6c
Move Threading.[h|cpp] from Support to System.
...
llvm-svn: 73707
2009-06-18 16:54:52 +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
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
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
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
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
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
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
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
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
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
Chris Lattner
e408601cec
fix typo
...
llvm-svn: 66367
2009-03-08 04:06:26 +00:00
Dan Gohman
92b551bc2b
Fix a bunch of Doxygen syntax issues. Escape special characters,
...
and put @file directives on their own comment line.
llvm-svn: 65920
2009-03-03 02:55:14 +00:00
Nate Begeman
94aa38d568
Add suppport for ConstantExprs of shufflevectors whose result type is not equal to the
...
type of the vectors being shuffled.
llvm-svn: 64401
2009-02-12 21:28:33 +00:00
Chris Lattner
4163213750
select constant exprs should have the same constraints as select instructions,
...
notably, they should support vectors and aggregates.
llvm-svn: 61462
2008-12-29 00:16:12 +00:00
Dan Gohman
8214fc12a3
Make ConstantAggregateZero::get return a ConstantAggregateZero*,
...
as suggested in PR3182.
llvm-svn: 60691
2008-12-08 07:10:54 +00:00
Devang Patel
d26344d252
Fix unused variable warnings.
...
llvm-svn: 58653
2008-11-03 23:20:04 +00:00
Bill Wendling
97f7de8875
Fix type-o in ExprMapKeyType::operator ==(). The "&&" was missing.
...
Patch by Frits van Bommel!
llvm-svn: 58175
2008-10-26 00:19:56 +00:00
Dale Johannesen
4f0bd68cfe
Add a "loses information" return value to APFloat::convert
...
and APFloat::convertToInteger. Restore return value to
IEEE754. Adjust all users accordingly.
llvm-svn: 57329
2008-10-09 23:00:39 +00:00
Gordon Henriksen
b52d1ed7e9
Fix ConstantExpr::getInsertElement.
...
Breakage was exposed in the Ocaml bindings tests after Chris
uncommented an assertion in r55084.
llvm-svn: 55566
2008-08-30 15:41:51 +00:00
Chris Lattner
f97ab6df07
the bug was apparently fixed long ago, reenable the assertion
...
llvm-svn: 55224
2008-08-23 03:48:35 +00:00
Dale Johannesen
47a5ef381e
Accept NOT of a constant vector of int.
...
llvm-svn: 55140
2008-08-21 21:20:09 +00:00
Chris Lattner
b078e28338
Add a new ConstantExpr::getWithOperands that takes any array of operands
...
instead of requiring an std::vector.
llvm-svn: 55084
2008-08-20 22:27:40 +00:00
Dan Gohman
e955c481fd
Fix several const-correctness issues, resolving some -Wcast-qual warnings.
...
llvm-svn: 54349
2008-08-05 14:45:15 +00:00
Nate Begeman
098cc6f22c
Remove unnecessary implicit argument
...
llvm-svn: 54031
2008-07-25 17:56:27 +00:00
Nate Begeman
c96e2e4968
Fix minor issues with VICmp/VFCmp constant expressions
...
llvm-svn: 54030
2008-07-25 17:35:37 +00:00
Dan Gohman
d5d24f63fd
InsertValue and ExtractValue constant expressions are always
...
folded. Remove code that handled the case where they aren't
folded, and remove bitcode reader/writer support for them.
llvm-svn: 53887
2008-07-21 23:30:30 +00:00
Chris Lattner
eab49263b5
Fix a bunch of bugs handling vector compare constant expressions, fixing
...
PR2317.
llvm-svn: 53544
2008-07-14 05:17:31 +00:00
Chris Lattner
c5098a2877
Document and fix Constant::getVectorElements to return an empty vector
...
when presented with a constant expr.
If ConstantExpr::getV[IF]Cmp to work when ConstantFoldCompareInstruction
returns an undef or constant expr.
llvm-svn: 53541
2008-07-14 05:10:41 +00:00
Dan Gohman
3707f1daba
Use find instead of lower_bound.
...
llvm-svn: 53474
2008-07-11 20:58:19 +00:00
Chris Lattner
d977c07680
SImplify ConstantVector::get a bit and make it turn a vector
...
of all undefs into a single undef value.
llvm-svn: 53384
2008-07-10 00:44:03 +00:00
Chris Lattner
2105d66c05
add a helper method for code that wants to handle vector
...
constants by element without caring how they are formed.
llvm-svn: 53381
2008-07-10 00:28:11 +00:00
Matthijs Kooijman
ba5d7efc6c
Add newline at the end of Constants.cpp.
...
llvm-svn: 53092
2008-07-03 07:46:41 +00:00
Evan Cheng
da3db11db3
- Re-apply 52748 and friends with fix. GetConstantStringInfo() returns an empty string for ConstantAggregateZero case which surprises selectiondag.
...
- Correctly handle memcpy from constant string which is zero-initialized.
llvm-svn: 52891
2008-06-30 07:31:25 +00:00
Anton Korobeynikov
a7c583d584
Revert (52748 and friends):
...
Move GetConstantStringInfo to lib/Analysis. Remove
string output routine from Constant. Update all
callers. Change debug intrinsic api slightly to
accomodate move of routine, these now return values
instead of strings.
This unbreaks llvm-gcc bootstrap.
llvm-svn: 52884
2008-06-29 17:57:03 +00:00
Eric Christopher
d0ab9c47e6
Move GetConstantStringInfo to lib/Analysis. Remove
...
string output routine from Constant. Update all
callers. Change debug intrinsic api slightly to
accomodate move of routine, these now return values
instead of strings.
llvm-svn: 52748
2008-06-26 00:31:12 +00:00
Owen Anderson
ee9c30d435
Use push_back rather than operator[], which is incorrect in this cases. Unfortunately, this slow the testcase down a little bit,
...
but only marginally.
llvm-svn: 52700
2008-06-25 01:05:05 +00:00
Owen Anderson
79c69bc45f
In ConstantArray::getAsString(), we know the size of the resultant string in advance so we can pre-allocate it and just fill in
...
the entries. This improves the time for the AsmPrinter on InstructionCombining.cpp from 0.4248s to 0.3370s.
llvm-svn: 52690
2008-06-24 21:58:29 +00:00
Dan Gohman
a469bdbcdf
More changes from Chris' review: simplify getIndices and avoid
...
copying its return value.
llvm-svn: 52627
2008-06-23 16:39:44 +00:00
Dan Gohman
3db11c2bd9
Constant folding for insertvalue and extractvalue.
...
llvm-svn: 51889
2008-06-03 00:15:20 +00:00
Dan Gohman
7bb04509f2
Fix some bugs with the handling of indices in insertvalue/extractvalue.
...
llvm-svn: 51820
2008-05-31 19:09:08 +00:00
Dan Gohman
1ecaf45cf1
IR, bitcode reader, bitcode writer, and asmparser changes to
...
insertvalue and extractvalue to use constant indices instead of
Value* indices. And begin updating LangRef.html.
There's definately more to come here, but I'm checking this
basic support in now to make it available to people who are
interested.
llvm-svn: 51806
2008-05-31 00:58:22 +00:00
Gabor Greif
2d3024d838
eliminate calls to deprecated Use::init() interface
...
llvm-svn: 51570
2008-05-26 21:33:52 +00:00
Dan Gohman
0752bffe9a
Add more IR support for the new extractvalue and insertvalue
...
instructions.
llvm-svn: 51461
2008-05-23 00:36:11 +00:00
Dan Gohman
12fce7751b
IR support for extractvalue and insertvalue instructions. Also, begin
...
moving toward making structs and arrays first-class types.
llvm-svn: 51157
2008-05-15 19:50:34 +00:00
Gabor Greif
697e94cc22
Fix a bunch of 80col violations that arose from the Create API change. Tweak makefile targets to find these better.
...
llvm-svn: 51143
2008-05-15 10:04:30 +00:00
Dan Gohman
d78c400b5b
Clean up the use of static and anonymous namespaces. This turned up
...
several things that were neither in an anonymous namespace nor static
but not intended to be global.
llvm-svn: 51017
2008-05-13 00:00:25 +00:00
Nate Begeman
ac7f3d99dd
Fix build breakage
...
llvm-svn: 50986
2008-05-12 19:23:22 +00:00
Nate Begeman
d21957002a
Add two new instructions to the llvm IR, vicmp and vfcmp. see updated LangRef
...
for details. CodeGen support coming in a follow up patch
llvm-svn: 50985
2008-05-12 19:01:56 +00:00
Gabor Greif
f6caff66a1
merge of use-diet branch to trunk
...
llvm-svn: 50943
2008-05-10 08:32:32 +00:00
Chris Lattner
98bd939af8
add a simplified accessor for creating an fp constant of a
...
particular value but variable type.
llvm-svn: 49416
2008-04-09 06:38:30 +00:00
Chris Lattner
b5b3e3136b
add a version of ConstantFP::get that doesn't take a redundant Type* value,
...
start migrating code over to use it.
llvm-svn: 49413
2008-04-09 00:45:01 +00:00
Gabor Greif
dd8b7a0a47
fix a warning
...
llvm-svn: 49282
2008-04-06 21:42:13 +00:00
Gabor Greif
e9ecc68d8f
API changes for class Use size reduction, wave 1.
...
Specifically, introduction of XXX::Create methods
for Users that have a potentially variable number of
Uses.
llvm-svn: 49277
2008-04-06 20:25:17 +00:00