1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 19:42:54 +02:00
Commit Graph

6959 Commits

Author SHA1 Message Date
Chris Lattner
952bbd726b This patch was contributed by Daniel Berlin!
Speed up SCCP substantially by processing overdefined values quickly.  This
patch speeds up SCCP by about 30-40% on large testcases.

llvm-svn: 14861
2004-07-15 23:36:43 +00:00
Chris Lattner
0193bbef1f Fix PR404 try #2
This version takes about 1s longer than the previous one (down to 2.35s),
but on the positive side, it actually works :)

llvm-svn: 14856
2004-07-15 08:20:22 +00:00
Chris Lattner
36f2a4eb77 Nuke a clearly bogus assertion
llvm-svn: 14854
2004-07-15 07:44:34 +00:00
Chris Lattner
fde0e6bb95 Revert previous patch until I get a bug fixed
llvm-svn: 14853
2004-07-15 05:36:31 +00:00
Chris Lattner
9896dfb8e7 Fix PR404: Loop simplify is really slow on 252.eon
This eliminates an N*N*logN algorithm from the loop simplify pass, replacing
it with a much simpler and faster alternative.  In a debug build, this reduces
gccas time on eon from 85s to 42s.

llvm-svn: 14851
2004-07-15 04:27:04 +00:00
Chris Lattner
d7870e4b1a Fixes for PR341
llvm-svn: 14848
2004-07-15 02:51:32 +00:00
Chris Lattner
94212f7102 Fixes for PR341
llvm-svn: 14847
2004-07-15 02:51:31 +00:00
Chris Lattner
47c6a06211 Fix for PR341
llvm-svn: 14845
2004-07-15 02:40:04 +00:00
Chris Lattner
b9ec0b791c Revert stuff that I didn't mean to checkin
llvm-svn: 14844
2004-07-15 02:33:38 +00:00
Chris Lattner
bb7fe18493 Fixes for PR341
llvm-svn: 14843
2004-07-15 02:31:46 +00:00
Chris Lattner
d7d7bc70fd Fix for PR341
llvm-svn: 14842
2004-07-15 02:26:49 +00:00
Chris Lattner
c4888ccda7 Patches towards fixing PR341
llvm-svn: 14841
2004-07-15 02:14:30 +00:00
Chris Lattner
2db1894038 Progress on PR341
llvm-svn: 14840
2004-07-15 02:06:12 +00:00
Chris Lattner
0f61d55197 Fixes working towards PR341
llvm-svn: 14839
2004-07-15 01:50:47 +00:00
Chris Lattner
ffd5effa5f Bug fixes for PR341
llvm-svn: 14838
2004-07-15 01:29:12 +00:00
Chris Lattner
d1b726d18f Implement folding of expressions like 'uint cast (int* getelementptr (int*
null, uint 1) to uint)' to a constant integer.  We can only do this with
primitive LLVM types, because other types have target-specific sizes.

llvm-svn: 14837
2004-07-15 01:16:59 +00:00
Chris Lattner
de4449ef34 Now that we codegen the portable "sizeof" efficiently, we can use it for
malloc lowering.  This means that lowerallocations doesn't need targetdata
anymore.  yaay.

llvm-svn: 14835
2004-07-15 01:08:08 +00:00
Chris Lattner
210ffe4b77 Improve codegen for the LLVM offsetof/sizeof "operator". Before we compiled
this LLVM function:

int %foo() {
        ret int cast (int** getelementptr (int** null, int 1) to int)
}

into:

foo:
        mov %EAX, 0
        lea %EAX, DWORD PTR [%EAX + 4]
        ret

now we compile it into:

foo:
        mov %EAX, 4
        ret

This sequence is frequently generated by the MSIL front-end, and soon the malloc lowering pass and
Java front-ends as well..

-Chris

llvm-svn: 14834
2004-07-15 00:58:53 +00:00
Chris Lattner
7397a61a7f This is logically part of the last patch. Just more really horrible code
that is made unnecessary by it.

llvm-svn: 14831
2004-07-14 23:07:13 +00:00
Chris Lattner
d81b8323ee ** Finally DeclareNewGlobalValue is dead!
* Simplify a lot of code because type's cannot be in function symbol tables
* Fix memory leaks in handling of redefined function prototypes
* Don't use SymbolTable directly for stuff that we can go through the Module
  for.
* Fix some minor bugs on obscure testcases like:
      test/Feature/globalredefinition.ll
* Do not create GlobalVariable objects for forward referenced Functions!
* When forward referencing a function in a constant expression, do not create
  a placeholder, add a bunch of references to it, then turn around and
  replaceAllUsesOfWith on it with a new global, deleting the placeholder.
  Instead, when we find the real definition of the global, just use the
  placeholder instead of creating a new object.

This substantially simplifies the asmwriter and should even speed it up on
cases heavy in constantexprs (like C++, Java, MSIL)...

llvm-svn: 14830
2004-07-14 23:03:46 +00:00
Chris Lattner
7bef7be4c4 * Fairly substantial change. Instead of creating new globalvariables, then
replaceAllUsesWith'ing any forward references, just use the forward
  reference if it exists.

This introduces GetForwardRefForGlobal, which will eventually completely
replace the horrible DeclareNewGlobalValue function.

llvm-svn: 14828
2004-07-14 21:44:00 +00:00
Chris Lattner
5b80b7157a Fold setValueNameMergingDuplicates into ParseGlobalVariable, allowing us
to substantially simplify the result.  In particular, we no longer create
GlobalVariables and then immediately destroy them when they are duplciate
definitions.

The real point of this patch though is that it gets us closer to the
DeclareNewGlobalValue calls...

llvm-svn: 14827
2004-07-14 20:42:57 +00:00
Brian Gaeke
d8746a7ab6 Actually set the endian/pointersize flags on the module being read in!
llvm-svn: 14826
2004-07-14 20:33:13 +00:00
Chris Lattner
fb6e1c2007 Simplify logic.
llvm-svn: 14825
2004-07-14 20:27:12 +00:00
Chris Lattner
7044b0d4e1 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.

llvm-svn: 14823
2004-07-14 19:33:47 +00:00
Misha Brukman
d6a9646f29 Make sure MTSPR instruction is inserted into the BasicBlock
llvm-svn: 14822
2004-07-14 18:26:31 +00:00
Chris Lattner
74bd192fba Implement new helper methods for creating two-index GEP instructions
llvm-svn: 14821
2004-07-14 18:14:33 +00:00
Misha Brukman
0f42826f30 Don't define the same register twice when loading a ConstantPointerRef to a reg
llvm-svn: 14819
2004-07-14 17:57:04 +00:00
Misha Brukman
73d729838f * Fix multiplication by powers of two and otherwise
* Clarify variable name (StoreInst SI instead of LI)

llvm-svn: 14818
2004-07-14 15:29:51 +00:00
Chris Lattner
6472a6b770 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.

llvm-svn: 14811
2004-07-14 08:23:52 +00:00
Chris Lattner
9827ad9f08 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.

llvm-svn: 14810
2004-07-14 07:12:48 +00:00
Chris Lattner
fafef8ecd1 Remove a gross and crufty "feature" that was never documented and doesn't work.
llvm-svn: 14809
2004-07-14 06:44:56 +00:00
Chris Lattner
633e78c5c6 Finegrainify namespacification
llvm-svn: 14808
2004-07-14 06:39:48 +00:00
Chris Lattner
a262a55378 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.

llvm-svn: 14807
2004-07-14 06:28:35 +00:00
Brian Gaeke
4dc7caee0e Add Machine-CFG edges to SparcV9 MachineBasicBlocks.
llvm-svn: 14806
2004-07-14 05:40:50 +00:00
Chris Lattner
483a35c547 Split the basic block handling case out of getVal into getBBVal.
llvm-svn: 14805
2004-07-14 01:33:11 +00:00
Chris Lattner
183766f21e Make Argument::print more resilient to non-verifiable IR
llvm-svn: 14801
2004-07-13 23:14:34 +00:00
Chris Lattner
1a1afa3566 Catch aggregates passed by value sooner rather than later.
llvm-svn: 14800
2004-07-13 20:09:51 +00:00
Misha Brukman
79b089abff * Specify that FP arith options have 3 operands
* Correctly load FP constants from the constant pool, should be refactored

llvm-svn: 14799
2004-07-13 15:35:45 +00:00
Chris Lattner
96d249c97a Fine-grainify namespacification, prune #include
llvm-svn: 14792
2004-07-13 08:42:12 +00:00
Chris Lattner
ed8ebfdac9 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.

llvm-svn: 14791
2004-07-13 08:39:15 +00:00
Chris Lattner
3ab20a8c6a 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.

llvm-svn: 14790
2004-07-13 08:28:21 +00:00
Chris Lattner
2314ffe629 Inline the now trivial setValueNameInternal function into both callers
llvm-svn: 14789
2004-07-13 08:12:39 +00:00
Chris Lattner
34682ff049 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.

llvm-svn: 14788
2004-07-13 08:10:10 +00:00
Chris Lattner
83973de5a7 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.

llvm-svn: 14787
2004-07-13 07:59:27 +00:00
Brian Gaeke
f6ec78a335 Fix warning on SparcV9, where sizeof (int) != sizeof (void *).
llvm-svn: 14786
2004-07-13 07:37:43 +00:00
Chris Lattner
7aa45e259a Replace a bunch of complex ConstantPointerRef referring code with simple
code.

llvm-svn: 14785
2004-07-13 06:58:07 +00:00
Chris Lattner
fca5fee9d5 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.

llvm-svn: 14783
2004-07-13 01:49:43 +00:00
Misha Brukman
449715a57d Correctly load FP constants out of the constant pool.
llvm-svn: 14782
2004-07-12 23:49:47 +00:00
Misha Brukman
da8ed5f4d5 Apple's MacOS X is another OS which does not provide alloca() via <alloca.h>
llvm-svn: 14781
2004-07-12 23:37:18 +00:00
Misha Brukman
b7f3d7b04b Implement getModuleMatchQuality and getJITMatchQuality() for PowerPC
llvm-svn: 14780
2004-07-12 23:36:12 +00:00
Chris Lattner
3f023d6df9 implement new helper method
llvm-svn: 14776
2004-07-12 20:35:11 +00:00
Chris Lattner
9fc90f37fd Fix unused var warning
llvm-svn: 14775
2004-07-12 20:29:52 +00:00
Chris Lattner
d581590c73 Fix a really nasty logic error that VC noticed.
Reid, this might matter to you :)

llvm-svn: 14774
2004-07-12 20:27:31 +00:00
Chris Lattner
b704df8365 Implement new method
llvm-svn: 14767
2004-07-12 01:17:34 +00:00
Reid Spencer
c6bdf47e72 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.

llvm-svn: 14765
2004-07-11 17:28:43 +00:00
Reid Spencer
1d6847c22e - 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.

llvm-svn: 14764
2004-07-11 17:24:05 +00:00
Reid Spencer
af6625347f Remove tabs.
llvm-svn: 14763
2004-07-11 17:22:51 +00:00
Reid Spencer
1a22913bac 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.

llvm-svn: 14762
2004-07-11 17:22:07 +00:00
Chris Lattner
196b4f394f The cleanup is done. Update comment.
llvm-svn: 14761
2004-07-11 08:24:02 +00:00
Chris Lattner
6029e3234e Make add constantexprs work with all types, fixing the regressions from last night
llvm-svn: 14760
2004-07-11 08:01:11 +00:00
Chris Lattner
e0ccf04c10 Implement TargetRegistrationListener
llvm-svn: 14759
2004-07-11 06:03:21 +00:00
Chris Lattner
773f2d65c2 Delete the allocate*TargetMachine function, which is now dead.
The shared command line options are now in a header that makes sense.

llvm-svn: 14757
2004-07-11 04:17:58 +00:00
Chris Lattner
6331eb6bbe Delete the allocate*TargetMachine function, which is now dead .
The shared command line options are now in a header that makes sense.

llvm-svn: 14756
2004-07-11 04:17:10 +00:00
Chris Lattner
9e183d06a6 Delete the allocate*TargetMachine function, which is now dead .
llvm-svn: 14755
2004-07-11 04:16:31 +00:00
Chris Lattner
6bbbf294d1 Goodbye macro hell, hello nice clean simple extensible code. This change
also gives the JIT the ability to dynamically load targets. e.g.

lli -load libparisc.so -march=parisc foo.bc

llvm-svn: 14750
2004-07-11 04:02:06 +00:00
Chris Lattner
646bc16b63 Implement a couple of methods that TargetMachineRegistry now provides. See,
I told you this file wasn't useless :)

llvm-svn: 14749
2004-07-11 04:00:19 +00:00
Chris Lattner
b67e3b01bc Make these format a bit nicer
llvm-svn: 14747
2004-07-11 03:27:42 +00:00
Chris Lattner
2ada866a78 Auto-registrate target
llvm-svn: 14745
2004-07-11 02:48:49 +00:00
Chris Lattner
164659f141 Add compilability
llvm-svn: 14744
2004-07-11 02:48:28 +00:00
Chris Lattner
3c3babb91d Initial impl of this file. Yes this is pretty useless right now, but it
will grow in time.

llvm-svn: 14743
2004-07-11 02:44:26 +00:00
Chris Lattner
20b8801a35 Implicitly getting a new option by linking to support.o instead of support.a
is a bad idea.  Make tools that want the option #include PluginSupport.h
explicitly.

llvm-svn: 14738
2004-07-11 01:04:33 +00:00
Reid Spencer
d45c27da89 Replace use of defunct Type::setName method with SymbolTable::insert.
Patch found and provided by Vladimir Merzliakov. Thanks Vladimir!

llvm-svn: 14732
2004-07-10 16:37:42 +00:00
Reid Spencer
27a5454cf0 Make the VBRSavings percentage make sense (as a fraction of the total
expanded size instead of the file size). Thanks Chris.

llvm-svn: 14731
2004-07-10 08:04:13 +00:00
Reid Spencer
20dc3903a6 Error Handling Cleanup:
- get rid of PARSE_ERROR macro
- add error(std::string) function
- use error(std::string) for all errors
- make input dependent asserts call error(std::string) instead
- ensure asserts are only for logic bugs, not input discrepancies.

llvm-svn: 14729
2004-07-09 22:21:33 +00:00
Reid Spencer
d38042c423 Fix a backwards compatibility bug found by Tanya. In version 1.2, the
global type plane starts with a length and the TypeTyID value to identify
the type plane has having type definitions. This doesn't happen in 1.3
because the types are read from a known position in the file. However, the
TypeTyID must be read in (and ignored) if its a 1.2 bytecode file.

llvm-svn: 14728
2004-07-09 21:13:53 +00:00
Chris Lattner
d3f73edc53 Remove unused method
llvm-svn: 14726
2004-07-09 16:48:13 +00:00
Chris Lattner
456583c52c Add checks to ensure that there are no unreachable blocks in the function
llvm-svn: 14725
2004-07-09 16:44:37 +00:00
Chris Lattner
75bbce2fdb Don't call Type::setName()
llvm-svn: 14724
2004-07-09 16:43:55 +00:00
Misha Brukman
f8f753f04b * Add support for indexing into structures, thanks to Chris (x86)
The large diff is because of indentation of a whole region
* Fix querying predecessor blocks in SelectPHINodes(), thanks to Brian (v8)
* Add support for external functions malloc() and free()
* Fix some code indentation

Remember, kids: It's not plagiarism if you "creatively borrow" from your
sources.  It's called "research"!

llvm-svn: 14723
2004-07-09 15:45:07 +00:00
Misha Brukman
1881beb0b3 Read/write the offset value for stack-relative loads via correct instr operand.
llvm-svn: 14722
2004-07-09 15:37:16 +00:00
Misha Brukman
abbe59490b * Doxygenify comments
* Fix spacing, grammar in comment
* Make code layout consistent
* Wrap code at 80 cols
* Delete spurious blank lines

No functional changes.

llvm-svn: 14721
2004-07-09 14:45:17 +00:00
Alkis Evlogimenos
d8e8396e33 Fix typo.
llvm-svn: 14720
2004-07-09 11:25:27 +00:00
Alkis Evlogimenos
57839c592a Improve code comments.
llvm-svn: 14719
2004-07-09 11:10:00 +00:00
Chris Lattner
ef1e8119ec The uid mapping is no more
llvm-svn: 14708
2004-07-08 22:31:09 +00:00
Chris Lattner
2d48ef104b Eliminate uses of the UniqueID field on Type objects
llvm-svn: 14707
2004-07-08 22:30:50 +00:00
Chris Lattner
0939a316d6 Do not call Type::getUniqueID
llvm-svn: 14706
2004-07-08 22:09:34 +00:00
Misha Brukman
b83ace891d Add support for __fixdfdi(), __floatdisf(), and __floatdidf() external functions
llvm-svn: 14703
2004-07-08 19:41:16 +00:00
Misha Brukman
db4cddea8d * Use several Function* for external functions instead of a std::map
* Non-const FP values must be loaded into int regs (for vararg fns) via memory

llvm-svn: 14701
2004-07-08 18:27:59 +00:00
Misha Brukman
869f2b7219 * Add support for loading FP constants from the constant pool
* Load FP values into int regs as well for vararg functions; without memory ops!

llvm-svn: 14700
2004-07-08 18:02:38 +00:00
Misha Brukman
3bbd3cd1de * Fix header comment, excise references to X86
* Add suport for printing out references to constant pool indices

llvm-svn: 14699
2004-07-08 17:58:04 +00:00
Chris Lattner
77a943eb4c Eliminate the SignedType and UnsignedType classes.
llvm-svn: 14695
2004-07-08 17:30:07 +00:00
Brian Gaeke
0601002727 Support setcc on fp values.
llvm-svn: 14687
2004-07-08 09:08:35 +00:00
Brian Gaeke
23d171a9ed Add floating-point branches and compares. Compares don't complete
until the next cycle, and there's no interlock, so they effectively
have a delay slot.

llvm-svn: 14686
2004-07-08 09:08:22 +00:00
Brian Gaeke
99a4b4ecc6 Fix bug where SwitchSection would fail to change to ".bss" successfully.
llvm-svn: 14685
2004-07-08 08:08:23 +00:00
Brian Gaeke
79c41545a7 Fix bug involving bool arguments to binary operators.
Fix typo in comment.

llvm-svn: 14684
2004-07-08 08:08:10 +00:00
Brian Gaeke
2de292734d Fix bug in copying long constants to register pairs. We were getting
the top and bottom halves backwards...how embarrassing.
Support 'cast long to long' and other similar no-op casts to long.
Support 'ret long'.

llvm-svn: 14683
2004-07-08 07:52:13 +00:00
Chris Lattner
203cdb2e64 Disable some code that isn't helping matters
llvm-svn: 14682
2004-07-08 07:25:51 +00:00
Brian Gaeke
04176a23a7 Support 'ret float'
llvm-svn: 14681
2004-07-08 07:22:27 +00:00
Alkis Evlogimenos
e7e19f771f Add viewCFG() and viewCFGOnly() APIs.
llvm-svn: 14679
2004-07-08 00:47:58 +00:00
Misha Brukman
f7987f7c2a There is no error message to print out, end sentence with `!'
llvm-svn: 14678
2004-07-07 21:22:05 +00:00
Reid Spencer
b28dd1ea9f Make error message consistent with the rest of LLVM by saying that bytecode
is read, not parsed.

llvm-svn: 14677
2004-07-07 21:20:28 +00:00
Reid Spencer
ff9f74082f Fix for bug 391.
Improve exeception handling around bcreader invocations.

llvm-svn: 14674
2004-07-07 21:01:38 +00:00
Misha Brukman
93b47cc963 * Use a map for caching lookups to external functions (fp div/rem)
* Tabs to spaces

llvm-svn: 14673
2004-07-07 20:07:22 +00:00
Misha Brukman
f2473e6267 * Wrap long lines (comments and code)
* Tabs to spaces

llvm-svn: 14672
2004-07-07 20:01:36 +00:00
Chris Lattner
6c5e26142c 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
Misha Brukman
d5a439760c Add fmod() to the Module being compiled so that it gets a stub in the asm file
llvm-svn: 14670
2004-07-07 15:36:18 +00:00
Chris Lattner
ab994ac49a The bytecode reader wants to be able to read types that are not quite resolved
yet, then resolve them in it's own sweet time.  We must support this.

llvm-svn: 14666
2004-07-07 06:48:27 +00:00
Chris Lattner
dce7977318 Headers moved
llvm-svn: 14665
2004-07-07 06:35:22 +00:00
Chris Lattner
7e0d8f8084 Move all of the DSA headers into the Analysis/DataStructure subdir.
llvm-svn: 14663
2004-07-07 06:32:21 +00:00
Chris Lattner
fb2f56c7c8 As much as I hate to say it, the whole setNode interface for DSNodeHandles
is HOPELESSLY broken.  The problem is that the embedded getNode call can
change the offset of the node handle in unpredictable ways.

As it turns out, all of the clients of this method really want to set
both the node and the offset, thus it is more efficient (and less buggy)
to just do both of them in one method call.  This fixes some obscure bugs
handling non-forwarded node handles.

llvm-svn: 14660
2004-07-07 06:12:52 +00:00
Chris Lattner
006aea24ff When folding constant expr gep's, don't force the use of long indices.
llvm-svn: 14658
2004-07-07 04:45:13 +00:00
Alkis Evlogimenos
51dda289a7 Disable coalescing.
llvm-svn: 14655
2004-07-07 02:03:12 +00:00
Chris Lattner
b9f3b677ae Make sure people don't make functiontypes with an invalid return type
llvm-svn: 14654
2004-07-06 23:25:19 +00:00
Misha Brukman
ef78244e72 * Add support for calling vararg functions (must pass doubles in int regs too)
* Make visitSetCondInst() share condition-generating code with EmitComparison()
* There are 13 FPRs for function-passing arguments, not 8
* Do not rely on registers being sequential, use an array lookup
* In unimplemented switch cases, send an error and abort instead of silent
  fall-through
* Add doInitialization() for adding function prototypes for external math fns
* Minor changes: fix indentation, spacing, code clarity

llvm-svn: 14653
2004-07-06 22:51:53 +00:00
Misha Brukman
4543cea6ae Use the more compact bl' instead of cryptic (but equivalent) bcl 20,31'
llvm-svn: 14652
2004-07-06 22:40:34 +00:00
Brian Gaeke
b189dba59c Work around apparent Apple compiler bug which was making all mangled
names start with l0_.

llvm-svn: 14651
2004-07-06 20:29:05 +00:00
Chris Lattner
ed776e0c06 Check to make sure types are sized before calling getTypeSize on them.
llvm-svn: 14649
2004-07-06 19:28:42 +00:00
Brian Gaeke
f9c3f6178a It doesn't matter what the 2nd operand is; if the GEP has 2 operands and
the first is a zero, we should leave it alone.

llvm-svn: 14648
2004-07-06 19:24:47 +00:00
Brian Gaeke
ef192b1a19 Add helper function.
Don't touch GEPs for which DecomposeArrayRef is not going to do anything
special (e.g., < 2 indices, or 2 indices and the last one is a constant.)

llvm-svn: 14647
2004-07-06 18:15:39 +00:00
Chris Lattner
5c1abfecfe 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
Alkis Evlogimenos
e0c8d140a9 Do not crash when joining two intervals of registers of different
classes: just ignore that move. Thanks to Vladimir Prus who found the
bug!

llvm-svn: 14644
2004-07-06 16:03:21 +00:00
Misha Brukman
0b6de12a84 * Add utility functions: convert SetCC => PPC opcode and invert PPC opcode
* If SetCondInst is folded into BranchInst (and it is the only user), do not
  emit code for SetCondInst
* Fix assembly opcodes in comments in visitSetCondInst()
* Fix codegen of conditional branches

llvm-svn: 14643
2004-07-06 15:32:44 +00:00
Chris Lattner
560992669f Implement rem.ll:test3
llvm-svn: 14640
2004-07-06 07:38:18 +00:00
Chris Lattner
97ebe25e6c Fix a minor bug where we would go into infinite loops on some constants
llvm-svn: 14638
2004-07-06 07:11:42 +00:00
Chris Lattner
4d6c479f08 Implement InstCombine/sub.ll:test15: X % -Y === X % Y
Also, remove X % -1 = 0, because it's not true for unsigneds, and the
signed case is superceeded by this new handling.

llvm-svn: 14637
2004-07-06 07:01:22 +00:00
Chris Lattner
d450ccbc91 Fix a bug in the unreachable block elim pass. Dropping all references on a
basic block clear()'s all of the operands lists, including phis.  This
caused removePredecessor to get confused later.  Because of this, we just
nuke (without prejudice) PHI nodes in unreachable blocks.

llvm-svn: 14635
2004-07-06 06:36:11 +00:00
Reid Spencer
3e8a01d80f Remove definition and use of OtherVal enumerator. This just fixes a thinko.
llvm-svn: 14634
2004-07-06 01:30:36 +00:00
Reid Spencer
4d7e02d657 Finalize bytecode dumping. The "handleFinish" method was getting called
too soon so the function data was not getting dumped (it was generated
after the call handleFinish). Also cleaned up the output format for
proper indentation.

llvm-svn: 14627
2004-07-05 00:57:50 +00:00
Alkis Evlogimenos
69ea68d4b6 Correctly compute the ration of iterations/#intervals.
llvm-svn: 14626
2004-07-04 17:23:35 +00:00
Chris Lattner
8d61e9ad98 Add #includes
llvm-svn: 14625
2004-07-04 17:19:21 +00:00
Reid Spencer
50ec3f9325 Add #include <iostream> since Value.h does not #include it any more.
llvm-svn: 14622
2004-07-04 12:19:56 +00:00
Reid Spencer
d5ed7fb8fb - 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.

llvm-svn: 14621
2004-07-04 12:19:05 +00:00
Reid Spencer
172bb5ee88 Remove use of Type::TypeTy which is no longer defined. This change needed
for bug 122 since the "Type Type" concept is gone now.

llvm-svn: 14620
2004-07-04 12:17:44 +00:00
Reid Spencer
bfacdee814 Correct syntax typo .. ; -> :
llvm-svn: 14619
2004-07-04 12:15:11 +00:00
Reid Spencer
8a9a34f7ff - Changes for bug 122
- Remove Tabs
- Add inserters  needed since Value doesn't implement them any more
- Move some functions here to avoid cyclic header file dependencies.

llvm-svn: 14618
2004-07-04 12:14:17 +00:00
Reid Spencer
d02e1dc90d - #include <iostream> since its not in Value.h any more.
llvm-svn: 14617
2004-07-04 11:55:37 +00:00
Reid Spencer
d242724126 Constify SymbolTable's use of Type* so that it never modifies them.
llvm-svn: 14616
2004-07-04 11:55:08 +00:00
Reid Spencer
64a2a1c92b - #include <iostream> since its not in Value.h any more.
- constify use of Type* returned from symbol table.

llvm-svn: 14615
2004-07-04 11:52:49 +00:00
Reid Spencer
abf33934d2 #include <iostream> since its not in Value.h any more.
llvm-svn: 14614
2004-07-04 11:51:24 +00:00
Reid Spencer
93c3d80eb4 Adjust the slot machine to handle Types separately from Values. This was
done by doubling up the data structures so that Type based equivalents are
used. A consequence of this is overloading of function members that take a
Type* instead of a Value*. Various other cleanups related to Type != Value
(bug 122) were also implemented.

llvm-svn: 14613
2004-07-04 11:50:43 +00:00
Reid Spencer
373ae97a58 Implementation of SlotTable went into header file. Note that this header
is currently not being used but is retained because it will be the basis
for a clean up of the SlotCalculator class.

llvm-svn: 14612
2004-07-04 11:47:22 +00:00
Reid Spencer
3c5a47177e Remove Tabs.
llvm-svn: 14611
2004-07-04 11:46:15 +00:00
Reid Spencer
bd058052d9 Implement new output functions for types and compacted type planes. Also
remove use of Type::TypeTyID and Type::TypeTy since Type no longer inherits
Value.

llvm-svn: 14610
2004-07-04 11:45:47 +00:00
Reid Spencer
ae9ac3dcc5 Add new methods outputTypes and outputCompactionTypes for handling Types
separately from Values. This needed for bug 122.

llvm-svn: 14609
2004-07-04 11:44:27 +00:00
Reid Spencer
f15d7739d1 For bug 122:
Separate Types from Values because Type no longer inherits from Value. The
changes for this are too numerous to list. In essence, any data structure
that contained a Value was doubled so that Types could be contained
similarly. New members include Types, TypeMap, CompactionTypes, and
CompactionTypeMap. Functions taking a Value* were overloaded with a variant
that takes a Type* that acts on the new data structures.

llvm-svn: 14608
2004-07-04 11:42:49 +00:00
Reid Spencer
50fc2ffa25 - Type::TypeTyID doesn't exist any more (bug 122)
- Types don't have names any more, just write them on ostream directly

llvm-svn: 14606
2004-07-04 11:37:54 +00:00
Reid Spencer
37b31cbcba Move SlotCalculator.h to lib/Bytecode/Writer since that is the only place
that needs it after the Type != Value changes (bug 122).

llvm-svn: 14605
2004-07-04 11:36:31 +00:00
Reid Spencer
58d99835c3 - Don't use macros to call the BytecodeHandler
- Don't use PARSE_ERROR macro unnecessarily (for simple strings)
- Add comments before each function
- Convert for bug 122 (Type != Value)
- Handle new value range on Type::PrimitiveTypeId enumeration by augmenting
  the reader with a new read_typeid method and sanitizeTypeId method.
- Remove BytecodeHandler's default method implementations to header file.

llvm-svn: 14604
2004-07-04 11:33:49 +00:00
Reid Spencer
1ed71ecc7c - Make ValueList an "OtherVal" user of Values to ensure it doesn't get
mistaken for anything else.
- Move function descriptions to Reader.cpp file per Chris.
- Remove tabs.

llvm-svn: 14602
2004-07-04 11:04:56 +00:00