Commit Graph

223 Commits

Author SHA1 Message Date
Chris Lattner
d9ce6adfcc Fix a regression from last night. Apparently the CFE is broken and outputs
functions multiple times, expecting them to be merged.  This should be fixed
in the CFE, then here.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14823 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-14 19:33:47 +00:00
Chris Lattner
d88998db01 Pull out code shared between GV forward-decl and definition processing.
This gives us only a single call site for setValueNameMergingDuplicates.
The next stage is the start merging them together.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14811 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-14 08:23:52 +00:00
Chris Lattner
66028f208e Simplify code. Do not allow functions to be redefined more than once.
Since the stupid '%X = const int 4' thing is gone, we can now simplify
setValueNameMergingDuplicates a bit more.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14810 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-14 07:12:48 +00:00
Chris Lattner
e002694ce2 Remove a gross and crufty "feature" that was never documented and doesn't work.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14809 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-14 06:44:56 +00:00
Chris Lattner
8642763f11 Finegrainify namespacification
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14808 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-14 06:39:48 +00:00
Chris Lattner
2e2ed2995a Revamp handling of labels. In particular, if we create a forward reference
for a basic block, use it when the block is defined instead of deleting it
and creating a new one.  Also, only create at most ONE forward reference
for any block, instead of one for each forward reference.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14807 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-14 06:28:35 +00:00
Chris Lattner
64116f980e Split the basic block handling case out of getVal into getBBVal.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14805 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-14 01:33:11 +00:00
Chris Lattner
65cd4b0fa7 Fine-grainify namespacification, prune #include
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14792 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-13 08:42:12 +00:00
Chris Lattner
22ae232d98 Fix typeo and refactor bb productions to make it possible for us to reuse any
forward reference blocks if they have been created (instead of creating a new
block, replaceAllUsesOfWith, then nuking the placeholder).   This is not yet
implemented.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14791 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-13 08:39:15 +00:00
Chris Lattner
bc721ed100 Eliminate some mega-cruft here. There is no reason to DERIVE FROM IR CLASSES
just to keep track of some per-object state!  Gaah!  Whoever wrote this stuff...
oh wait, that would be me.  Never mind.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14790 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-13 08:28:21 +00:00
Chris Lattner
c9aea52ae4 Inline the now trivial setValueNameInternal function into both callers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14789 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-13 08:12:39 +00:00
Chris Lattner
8c89a0a1fd Now that basic blocks are eagerly inserted into the Function, we can use
the funciton symbol table to check for conflicts instead of having to
keep a shadow named LocalSymtab.  Totally eliminate LocalSymtab.  Verified
that this did not cause a regression on the testcase for PR107.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14788 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-13 08:10:10 +00:00
Chris Lattner
8ab406d5bd A couple of substantial cleanup fixes:
1. Split setValueName into two separate functions, one that is only used
     at function scope and doesn't have to deal with duplicates, and one
     that can be used either at global or function scope but that does deal
     with conflicts.  Conflicts were only in there because of the crappy old
     CFE and probably should be entirely eliminated.
  2. Insert BasicBlock's into the parent functions when they are created
     instead of when they are complete.  This effects name lookup (for the
     better), which will be exploited in the next patch.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14787 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-13 07:59:27 +00:00
Chris Lattner
38ab6bff5d Replace a bunch of complex ConstantPointerRef referring code with simple
code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14785 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-13 06:58:07 +00:00
Chris Lattner
8ca2dc0710 Don't call Type::setName()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14724 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-09 16:43:55 +00:00
Chris Lattner
735f2700d6 Eliminate uses of the UniqueID field on Type objects
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14707 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-08 22:30:50 +00:00
Reid Spencer
8ce1da781e - remove use of isa<Type>(Val) since there's no inheritance relationship
any more. Needed for bug 122
- #include <iostream> since Value.h doesn't include it any more.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14621 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-04 12:19:05 +00:00
Reid Spencer
77f4d868d7 Remove use of Type::TypeTy which is no longer defined. This change needed
for bug 122 since the "Type Type" concept is gone now.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14620 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-04 12:17:44 +00:00
Chris Lattner
f70c22b019 Rename Type::PrimitiveID to TypeId and ::getPrimitiveID() to ::getTypeID()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14201 91177308-0d34-0410-b5e6-96231b3b80d8
2004-06-17 18:19:28 +00:00
Reid Spencer
4e6620c9e0 Remove some more dead code resulting from adding setTypeName().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13862 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-28 00:21:06 +00:00
Reid Spencer
9ed0f17a62 Remove an assertion that uses Type::TypeTy that is never hit and will
break when Type::TypeTy goes away. Also remove a dead block of code and
dead comments.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13861 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-27 22:05:50 +00:00
Chris Lattner
a0846a3fa7 Add support for dos-style files
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13837 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-27 17:49:14 +00:00
Reid Spencer
75719bf239 Provide the correct patch for bug 345. The solution is to add a setTypeName
function to llvmAsmParser.y and then use it in the one place in the grammar
that needs it. Also had to make Type::setName public because setTypeName
needs it in order to retain compatibility with setValueName.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13795 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-26 21:48:31 +00:00
Chris Lattner
42fbc7e809 A quick and ugly hack to fix PR345. I used TypeTy specifically to make
Reid cringe :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13788 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-26 17:08:25 +00:00
Reid Spencer
b152f9ff78 Changed to use SymbolTable's new lookup interface.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13758 91177308-0d34-0410-b5e6-96231b3b80d8
2004-05-25 17:29:21 +00:00
Chris Lattner
f57a43da9c Fix a memory leak. We leaked the vector holding the entries in switch tables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@13023 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-17 23:49:15 +00:00
Chris Lattner
830b6f9868 Support getelementptr instructions which use uint's to index into structure
types and can have arbitrary 32- and 64-bit integer types indexing into
sequential types.

Auto-upgrade .ll files that use ubytes to index into structures to use uint's.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12652 91177308-0d34-0410-b5e6-96231b3b80d8
2004-04-05 01:30:04 +00:00
Chris Lattner
91ef460285 Avoid TRUE and FALSE which apparently conflict with some macros on OSX
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12566 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-31 03:49:47 +00:00
Chris Lattner
bc280abd46 Fix bug: Assembler/2004-03-30-UnclosedFunctionCrash.llx
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12551 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-30 20:58:25 +00:00
Chris Lattner
e151259288 Hrm, we were leaking ~1M of garbage that valgrind never told us about because
it was "reachable".  Cute.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12515 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-19 23:34:33 +00:00
Chris Lattner
76f0ff394d Allow parsing select instruction and constant expr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12313 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-12 05:51:36 +00:00
Chris Lattner
63a225050f Insert functions into the module promptly, not lazily. This fixes a bug
I introduced last night.  Note to self: test the *correct* tree...


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12220 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-08 16:14:19 +00:00
Chris Lattner
bc2075977c Eliminate a REALLY HORRIBLE API: mutateReferences, which is gross gross gross.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@12212 91177308-0d34-0410-b5e6-96231b3b80d8
2004-03-08 06:09:57 +00:00
Chris Lattner
16af11d962 It turns out that the two dimensional vectors were causing big slowdowns
in this for programs with lots of types (like the testcase in PR224).
The problem was that the type ID that the outer vector was using was not
very dense (as many types are getting resolved), so the vector is large
and gets reallocated a lot.

Since there are a lot of values in the program (the .ll file is 10M),
each reallocation has to copy the subvectors, which is also quite slow
(this wouldn't be a problem if C++ supported move semantics, but it
doesn't, at least not yet :(

Changing the outer data structure to a map speeds a release build of
llvm-as up from 11.21s to 5.13s on the testcase in PR224.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11244 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-09 21:03:38 +00:00
Chris Lattner
026a8ce312 When resolving upreferences, if multiple uprefs will be resolved to the same
type at the same time, resolve the upreferences to each other before resolving
it to the outer type.  This shaves off some time from the testcase in PR224, from
25.41s -> 21.72s.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11241 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-09 18:53:54 +00:00
Chris Lattner
d21cd809b6 Adjust to the changed StructType interface. In particular, getElementTypes() is gone.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11228 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-09 04:37:31 +00:00
Chris Lattner
d5d8996720 Start using the new and improve interface to FunctionType arguments
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11224 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-09 04:14:01 +00:00
Chris Lattner
bcb6afba33 This #include is not needed, it should have been removed with the last patch
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11222 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-09 03:22:32 +00:00
Chris Lattner
3b07386724 Instead of searching the entire type graph for a type to determine if it
contains the type we are looking for, just search the immediately used types.
We can only do this because we keep the "current" type in the nesting level
as we decrement upreferences.

This change speeds up the testcase in PR224 from 50.4s to 22.08s, not
too shabby.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11221 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-09 03:19:29 +00:00
Chris Lattner
2c37c18c6e Upreferences are always OpaqueTypes, meaning that it is impossible for a non-abstract
type from containing one.  This speeds up the asmparser on the testcase in PR224 from
61->50s.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11220 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-09 03:03:10 +00:00
Chris Lattner
a58e3a16c5 Change the 'exception' destination to the 'unwind' destination. We will always
allow 'except' instead of 'unwind' here though.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11203 91177308-0d34-0410-b5e6-96231b3b80d8
2004-02-08 21:48:25 +00:00
Chris Lattner
b16689b647 Don't use ConstantExpr::getShift anymore
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10791 91177308-0d34-0410-b5e6-96231b3b80d8
2004-01-12 19:08:43 +00:00
Chris Lattner
c7d3f6b6bf Minor code cleanups. The only bugfix is to the UR_DEBUG stuff which didn't
compile when enabled.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10657 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-31 02:18:11 +00:00
Chris Lattner
9cd42575c2 Right, fix the problem with invoke instructions, not just call instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10599 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-23 22:18:36 +00:00
Chris Lattner
f64d57ada8 Do not delete the type holder until after the call instruction has been
constructed!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10598 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-23 20:39:17 +00:00
Chris Lattner
a989b234bd Minor cleanups, plug a minor memory leak
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10596 91177308-0d34-0410-b5e6-96231b3b80d8
2003-12-23 20:05:15 +00:00
Chris Lattner
4257098c36 To not barf when an error occurs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10236 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-26 07:24:58 +00:00
Chris Lattner
0b268fb75e Fix PR147
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10204 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-25 03:54:16 +00:00
Chris Lattner
c282f5a380 Check return types of functions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10146 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-21 22:32:23 +00:00
Chris Lattner
ae711a8b48 Don't crash on bogus source value
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10132 91177308-0d34-0410-b5e6-96231b3b80d8
2003-11-21 20:27:35 +00:00