Commit Graph

76 Commits

Author SHA1 Message Date
Dan Gohman c731c97fac Use empty() member functions when that's what's being tested for instead
of comparing begin() and end().

llvm-svn: 42585
2007-10-03 19:26:29 +00:00
Chris Lattner 2be9ec5c91 Make Value::getNameLen not crash on an empty name, fixing PR1712.
llvm-svn: 42444
2007-09-28 20:09:40 +00:00
Chris Lattner 8e5b2c27a3 simplify code, improve a comment.
llvm-svn: 41205
2007-08-21 00:21:07 +00:00
Chris Lattner 5109a88ac3 add Value::getNameStart/getNameLen() accessors.
llvm-svn: 40989
2007-08-10 15:34:35 +00:00
Chris Lattner af867a3937 Fix a nasty memory leak, caused by my revamp of the value symbol table.
llvm-svn: 35195
2007-03-20 00:18:10 +00:00
Jeff Cohen b622c11f77 Unbreak VC++ build.
llvm-svn: 34917
2007-03-05 00:00:42 +00:00
Chris Lattner cf835ff85a rewrite Value::takeName to take advantage of the new symtab stuff. This
causes it to require no allocations and no symtab lookups in the common
case.  This speeds up instcombine 9.2% on 447.dealII.

llvm-svn: 34324
2007-02-15 20:01:43 +00:00
Chris Lattner fd27ed9733 Add a new Value::getNameStr method, which is preferred over getName.
llvm-svn: 34310
2007-02-15 18:53:54 +00:00
Chris Lattner cb9a626c67 add a setName variant that takes a null-terminated string. This can be
used to avoid std::string allocations in common cases.

llvm-svn: 34232
2007-02-13 07:53:34 +00:00
Chris Lattner 1a5de584dc Add new setName accessor which doesn't require creating a string.
llvm-svn: 34197
2007-02-12 18:52:59 +00:00
Chris Lattner 32ab643df7 Switch ValueSymbolTable to use StringMap<Value*> instead of std::map<std::string, Value*>
as its main datastructure.  There are many improvements yet to be made, but
this speeds up opt --std-compile-opts on 447.dealII by 7.3%.

llvm-svn: 34193
2007-02-12 05:18:08 +00:00
Chris Lattner 569c8acfe3 fix uninitialized variable
llvm-svn: 34182
2007-02-11 19:12:18 +00:00
Chris Lattner cba18e3a01 add an optimization for the case where the src has no name
llvm-svn: 34174
2007-02-11 01:04:09 +00:00
Chris Lattner b625082a42 add a helper method: Value::takeName
llvm-svn: 34171
2007-02-11 00:37:27 +00:00
Chris Lattner f5df4859cd eliminate ValueSymbolTable::rename, it has no advantage over using remove+insert.
Make insert/remove assert if used incorrectly instead of returning a bool.

llvm-svn: 33988
2007-02-07 06:13:49 +00:00
Reid Spencer 3aaaa0b2bd For PR411:
This patch replaces the SymbolTable class with ValueSymbolTable which does
not support types planes. This means that all symbol names in LLVM must now
be unique. The patch addresses the necessary changes to deal with this and
removes code no longer needed as a result. This completes the bulk of the
changes for this PR. Some cleanup patches will follow.

llvm-svn: 33918
2007-02-05 20:47:22 +00:00
Reid Spencer 32af9e8cc5 For PR411:
Take an incremental step towards type plane elimination. This change
separates types from values in the symbol tables by finally making use
of the TypeSymbolTable class. This yields more natural interfaces for
dealing with types and unclutters the SymbolTable class.

llvm-svn: 32956
2007-01-06 07:24:44 +00:00
Bill Wendling 6a462f1e99 Removed iostream #includes. Replaced std::cerr with DOUT.
llvm-svn: 31814
2006-11-17 08:03:48 +00:00
Chris Lattner 7a1450dbc6 Change the signature of replaceUsesOfWithOnConstant. The bool was always
true dynamically.  Finally, pass the Use* that replaceAllUsesWith has into
the method for future use.

llvm-svn: 23626
2005-10-04 18:13:04 +00:00
Misha Brukman b1c9317bb4 Remove trailing whitespace
llvm-svn: 21427
2005-04-21 23:48:37 +00:00
Chris Lattner ffb3778f87 This fixes PR531, a crash when running the CBE on a bytecode file.
The problem is that Function::renameLocalSymbols is iterating through
the symbol table planes, occasionally calling setName to rename a value
(which used to do a symbol table remove/insert pair).

The problem is that if there is only a single value in a particular type
plane that the remove will nuke the symbol table plane, and the insert
will create and insert a new one.  This hoses Function::renameLocalSymbols
because it has an iterator to the old plane, under the (very reasonable)
assumption that simply renaming a value won't cause the type plane to
disappear.

This patch fixes the bug by making the rename operation a single atomic
operation, which has a side effect of making the whole thing faster too. :)

llvm-svn: 20469
2005-03-06 02:14:28 +00:00
Chris Lattner cdb9bfc150 remove all of the various setName implementations, consolidating them into
Value::setName, which is no longer virtual.

llvm-svn: 20464
2005-03-05 19:51:50 +00:00
Chris Lattner d36552f34f new method
llvm-svn: 20288
2005-02-23 16:51:11 +00:00
Chris Lattner a29c92ffdd Initialize new field.
llvm-svn: 20044
2005-02-05 01:37:58 +00:00
Chris Lattner 4947e67c4f Updates for new use list changes.
llvm-svn: 19961
2005-02-01 01:24:21 +00:00
Misha Brukman 65c23ee5d3 Add a space between the type and name of value when printing error message
llvm-svn: 17022
2004-10-15 23:08:50 +00:00
Reid Spencer 7c16caa336 Changes For Bug 352
Move include/Config and include/Support into include/llvm/Config,
include/llvm/ADT and include/llvm/Support. From here on out, all LLVM
public header files must be under include/llvm/.

llvm-svn: 16137
2004-09-01 22:55:40 +00:00
Alkis Evlogimenos 74614b0c30 Use name.empty() instead of testing against equality with the empty
string.

llvm-svn: 15191
2004-07-25 06:16:52 +00:00
Alkis Evlogimenos 2f130282bd Disallow creation of named values of type void.
llvm-svn: 15190
2004-07-25 06:07:15 +00:00
Reid Spencer bbddbf3aed bug 122:
- Correct isa<Constant> for GlobalValue subclass

llvm-svn: 14933
2004-07-18 00:01:50 +00:00
Chris Lattner 9df9afddcf Fix regressions in these testcases:
Regression.Assembler.2002-01-24-BadSymbolTableAssert
 Regression.Assembler.2002-01-24-ValueRefineAbsType

Found through the nightly tester :)

llvm-svn: 14671
2004-07-07 18:07:46 +00:00
Chris Lattner bea7247357 Find bugs sooner rather than later. In this case, don't allow the creation
of instructions that don't have a first-class or void type.

llvm-svn: 14646
2004-07-06 17:44:17 +00:00
Reid Spencer 8baf8e270a - #include <iostream> since its not in Value.h any more.
llvm-svn: 14617
2004-07-04 11:55:37 +00:00
Chris Lattner 60a29a77aa User ctor is now inline
llvm-svn: 14431
2004-06-27 18:01:38 +00:00
Chris Lattner d0b0b454e5 Instancevar was renamed
llvm-svn: 14428
2004-06-26 20:33:39 +00:00
Chris Lattner 189d19fb04 Finegrainify namespacification
llvm-svn: 10131
2003-11-21 20:23:48 +00:00
Brian Gaeke 960707c335 Put all LLVM code into the llvm namespace, as per bug 109.
llvm-svn: 9903
2003-11-11 22:41:34 +00:00
Chris Lattner e225507193 If we're not checking, don't check!
llvm-svn: 9732
2003-11-05 19:09:40 +00:00
John Criswell 482202a601 Added LLVM project notice to the top of every C++ source file.
Header files will be on the way.

llvm-svn: 9298
2003-10-20 19:43:21 +00:00
Chris Lattner 079edeb919 Completely rewrite support for the Value::use_* list. Now, all operations on
this list (except use_size()) are constant time.  Before the killUse method
(used whenever something stopped using a value) was linear time, and thus
very very slow for large programs.

This speeds GCCAS up _substantially_ on large programs: almost 2x for 176.gcc:

176.gcc:     77.07s -> 37.38s
177.mesa:     7.59s ->  5.57s
252.eon:     21.02s -> 19.52s (*)
253.perlbmk: 11.40s -> 13.05s
254.gap:      7.25s -> 7.42s

252.eon would speed up a whole lot more, but optimization time is being
dominated by the inlining pass, which needs to be fixed.

llvm-svn: 9160
2003-10-16 16:53:07 +00:00
Chris Lattner 794a7490f8 Users can never be null
llvm-svn: 8895
2003-10-06 17:33:39 +00:00
Chris Lattner 22e4ca8863 There is no reason for Value to be an AbstractTypeUser. This just makes things
significantly more complete.  Instead, just make DerivedType's AbstractTypeUser's,
and make Value contain a PATypeHolder.

llvm-svn: 8828
2003-10-02 19:44:40 +00:00
Chris Lattner a38adaa88f Fix bug: Linker/2003-08-28-TypeResolvesGlobal3.ll
Use new replaceAllUsesWith stuff in a way that works even though types have not yet been propagated

llvm-svn: 8210
2003-08-29 05:37:22 +00:00
Chris Lattner 9f15812e88 Refactor code to make it useful outside of Constants.cpp
llvm-svn: 8205
2003-08-29 05:09:37 +00:00
Chris Lattner 8bd8bc8399 Make assertion more descriptive
llvm-svn: 6889
2003-06-24 22:20:19 +00:00
Chris Lattner 3789369330 This speeds up processing LLVM a _lot_, 17% in the case of loading and destroying "vortex"
llvm-svn: 5553
2003-02-13 19:46:22 +00:00
Chris Lattner 2c6abeac43 - Make Value::replaceAllUsesWith work with constants correctly. This fixes
bug FuncResolve/2002-08-19-ResolveGlobalVars.ll and gzip looks better.

llvm-svn: 4103
2002-10-09 23:12:59 +00:00
Chris Lattner 6023f638a1 - Remove Value::use_remove
llvm-svn: 4090
2002-10-09 00:25:05 +00:00
Chris Lattner 3ea0c188b7 Fix NASTY N^2 behavior that was causing the gzip benchmark to take forever to
assemble.  Now we scan the use-list from the back when removing users instead
of from the front.

llvm-svn: 4086
2002-10-08 23:46:55 +00:00
Chris Lattner 184b298edc Enable "garbage detection" of LLVM objects. Now users should be obnoxious
warnings.  If they accidentally leak LLVM Value's.

llvm-svn: 3620
2002-09-08 18:59:35 +00:00