Commit Graph

13034 Commits

Author SHA1 Message Date
Misha Brukman
32caa8de62 Don't define the same register twice when loading a ConstantPointerRef to a reg
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14819 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-14 17:57:04 +00:00
Misha Brukman
8d442c2dc4 * Fix multiplication by powers of two and otherwise
* Clarify variable name (StoreInst SI instead of LI)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14818 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-14 15:29:51 +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
Brian Gaeke
d94b6d3fa5 Add Machine-CFG edges to SparcV9 MachineBasicBlocks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14806 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-14 05:40:50 +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
144d9baf5e Make Argument::print more resilient to non-verifiable IR
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14801 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-13 23:14:34 +00:00
Chris Lattner
b4091e548e Catch aggregates passed by value sooner rather than later.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14800 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-13 20:09:51 +00:00
Misha Brukman
a596f8c3aa * Specify that FP arith options have 3 operands
* Correctly load FP constants from the constant pool, should be refactored


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14799 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-13 15:35:45 +00:00
Chris Lattner
b3366bc37e Actually, use an exception to stop verification. This gives us much better
error messages because verification stops at the first error.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14794 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-13 08:48:04 +00:00
Chris Lattner
00dd5cd356 There is no reason to abort and print a stack trace if there is a verification
error.  Just print the message like a good little tool.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14793 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-13 08:45:41 +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
Brian Gaeke
0859e52582 Fix warning on SparcV9, where sizeof (int) != sizeof (void *).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14786 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-13 07:37:43 +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
42df6d1396 Make tblgen not try to be smart. This is better handled in makefiles if
at all.  Patch contributed by Vladimir Prus!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14784 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-13 06:11:46 +00:00
Chris Lattner
b89e071aea Factor some code to handle "load (constantexpr cast foo)" just like
"load (cast foo)".  This allows us to compile C++ code like this:

class Bclass {
  public: virtual int operator()() { return 666; }
};

class Dclass: public Bclass {
  public: virtual int operator()() { return 667; }
} ;

int main(int argc, char** argv) {
  Dclass x;
  return x();
}

Into this:

int %main(int %argc, sbyte** %argv) {
entry:
        call void %__main( )
        ret int 667
}

Instead of this:

int %main(int %argc, sbyte** %argv) {
entry:
        %x = alloca "struct.std::bad_typeid"            ; <"struct.std::bad_typeid"*> [#uses=3]
        call void %__main( )
        %tmp.1.i.i = getelementptr "struct.std::bad_typeid"* %x, uint 0, uint 0, uint 0         ; <int (...)***> [#uses=1]
        store int (...)** getelementptr ([3 x int (...)*]*  %vtable for Bclass, int 0, long 2), int (...)*** %tmp.1.i.i
        %tmp.3.i = getelementptr "struct.std::bad_typeid"* %x, int 0, uint 0, uint 0            ; <int (...)***> [#uses=1]
        store int (...)** getelementptr ([3 x int (...)*]*  %vtable for Dclass, int 0, long 2), int (...)*** %tmp.3.i
        %tmp.5 = load int ("struct.std::bad_typeid"*)** cast (int (...)** getelementptr ([3 x int (...)*]*  %vtable for Dclass, int 0, long 2) to int
("struct.std::bad_typeid"*)**)          ; <int ("struct.std::bad_typeid"*)*> [#uses=1]
        %tmp.6 = call int %tmp.5( "struct.std::bad_typeid"* %x )                ; <int> [#uses=1]
	ret int %tmp.6
        ret int 0
}

In order words, we now resolve the virtual function call.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14783 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-13 01:49:43 +00:00
Misha Brukman
d9aa7836e2 Correctly load FP constants out of the constant pool.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14782 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-12 23:49:47 +00:00
Misha Brukman
f028f82a58 Apple's MacOS X is another OS which does not provide alloca() via <alloca.h>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14781 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-12 23:37:18 +00:00
Misha Brukman
01eca8d2c2 Implement getModuleMatchQuality and getJITMatchQuality() for PowerPC
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14780 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-12 23:36:12 +00:00
Misha Brukman
878ba7cc5d * Tabs to spaces
* Delete extra blank lines


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14779 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-12 22:58:07 +00:00
Misha Brukman
8559594c3d New open proj: C/C++ compiler in C++, with link to Ed Willink's C++ yacc grammar
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14778 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-12 21:10:47 +00:00
Chris Lattner
c78631f0e2 Add a helper method. The StructType element is completely redundant in most
cases


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14777 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-12 20:36:08 +00:00
Chris Lattner
b370c7a41a implement new helper method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14776 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-12 20:35:11 +00:00
Chris Lattner
aec6dd5bbc Fix unused var warning
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14775 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-12 20:29:52 +00:00
Chris Lattner
88e2b780cb Fix a really nasty logic error that VC noticed.
Reid, this might matter to you :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14774 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-12 20:27:31 +00:00
Chris Lattner
268f2583b9 Add a missing #include
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14773 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-12 20:25:33 +00:00
Chris Lattner
85e4eb6dc0 Fix warning compiling with VC++
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14772 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-12 20:25:04 +00:00
Chris Lattner
c8cd7e9e99 new feature
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14770 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-12 17:09:23 +00:00
Misha Brukman
adb1c39db9 * Clarify Sparc as SparcV9
* Add link to bugzilla bug with list of miscompiled SparcV9 programs
* Wrap long lines


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14769 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-12 16:55:41 +00:00
Chris Lattner
bbd913bb6d Implement a new method useful for things like the inliner
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14768 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-12 01:17:52 +00:00
Chris Lattner
1c2fe31483 Implement new method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14767 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-12 01:17:34 +00:00
Reid Spencer
0d88616c9a Correct an output typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14766 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-11 23:20:54 +00:00
Reid Spencer
46b002cd9b Various cleanups:
- Remove tabs
- Standardize use of space around ( and ).
- Consolidate the ConstantPlaceHolder class
- Rename two methods to be more meaningful (ParseType, ParseTypes)
- Correct indentation of blocks
- Add documentation
- Convert input dependent asserts to error(...) so it throws instead.
Provide placeholder implementations of read_float and read_double that
still read in platform-specific endianess. When I figure out how to do
this without knowing the endianess of the platform, it will get implemented
correctly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14765 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-11 17:28:43 +00:00
Reid Spencer
66906518ed - Rename two methods to give them more meaning
- Add read_float and read_double in preparation for a correct
  implementation of bytecode floating point support.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14764 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-11 17:24:05 +00:00
Reid Spencer
1d9349a783 Remove tabs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14763 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-11 17:22:51 +00:00
Reid Spencer
87bc418334 Prepare the writer for a non-broken implementation of writing floating
point values. This will be fixed when I figure out how to do it correctly
without depending on knowing the endianess of a platform.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14762 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-11 17:22:07 +00:00
Chris Lattner
beff74f821 The cleanup is done. Update comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14761 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-11 08:24:02 +00:00
Chris Lattner
5f90cb8c98 Make add constantexprs work with all types, fixing the regressions from last night
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14760 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-11 08:01:11 +00:00
Chris Lattner
7c38def077 Implement TargetRegistrationListener
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14759 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-11 06:03:21 +00:00
Chris Lattner
2845ece825 Add a new listener class for things that want to be informed about new
targets that are loaded


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14758 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-11 06:02:59 +00:00
Chris Lattner
68905bb6fc Delete the allocate*TargetMachine function, which is now dead.
The shared command line options are now in a header that makes sense.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14757 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-11 04:17:58 +00:00
Chris Lattner
0cf0c37469 Delete the allocate*TargetMachine function, which is now dead .
The shared command line options are now in a header that makes sense.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@14756 91177308-0d34-0410-b5e6-96231b3b80d8
2004-07-11 04:17:10 +00:00