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

6984 Commits

Author SHA1 Message Date
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
Reid Spencer
1b40b59651 Remove tabs. Move function declaration to Reader.h where it belongs.
llvm-svn: 14601
2004-07-04 11:03:03 +00:00
Reid Spencer
b342d41159 Add #include <iostream> which is needed now that Value.h doesn't include it
llvm-svn: 14600
2004-07-04 11:01:27 +00:00
Reid Spencer
43f703a636 Excise tabs.
llvm-svn: 14599
2004-07-04 11:00:39 +00:00
Alkis Evlogimenos
8ff35c1ce8 Add efficiency statistic.
llvm-svn: 14590
2004-07-04 07:59:06 +00:00
Chris Lattner
5d7966a0ea Fix compilation on internix
llvm-svn: 14588
2004-07-03 01:21:05 +00:00
Chris Lattner
aafe5aea0d Implement add.ll:test22, a common case in MSIL files
llvm-svn: 14587
2004-07-03 00:26:11 +00:00
Chris Lattner
f0af72ac49 Fix Type::isSized() to realize that "{ opaque }" is not sized
llvm-svn: 14585
2004-07-02 23:20:17 +00:00
Chris Lattner
1120899069 Do not call getTypeSize on a type that has no size
llvm-svn: 14584
2004-07-02 22:55:47 +00:00
Misha Brukman
607dd868a8 Add FIXME notes for spilling int/fp regs (need to calculate stack space).
llvm-svn: 14581
2004-07-02 17:54:38 +00:00
Brian Gaeke
318c4cf9c2 Fix use-before-def thinko
llvm-svn: 14570
2004-07-02 07:01:31 +00:00
Chris Lattner
5b96ed7d1b Revert patches 1.79 and 1.80 which had to do with dead MBB's. Now that they
don't exist, we don't have to pretend to handle them.

llvm-svn: 14567
2004-07-02 05:52:23 +00:00
Chris Lattner
c83e510819 Fix potential problems with unreachable basic blocks.
Also, while noone's looking, add support for constant expressions.  Wait,
I said not to look!

llvm-svn: 14566
2004-07-02 05:49:11 +00:00
Chris Lattner
a99a36881f Fix all of those problems that the PPC backend has running 176.gcc :)
llvm-svn: 14565
2004-07-02 05:48:42 +00:00
Chris Lattner
6da0499f4b Remove dead blocks
llvm-svn: 14564
2004-07-02 05:46:41 +00:00
Chris Lattner
1e20aefbcb Add a trivially simple pass to delete unreachable blocks from the CFG. This
pass is required to paper over problems in the code generator (primarily
live variables and its clients) which doesn't really have any well defined
semantics for unreachable code.

The proper solution to this problem is to have instruction selectors not
select blocks that are unreachable.  Until we have a instruction selection
framework available for use, however, we can't expect all instruction
selector writers to do this.  Until then, this pass should be used.

llvm-svn: 14563
2004-07-02 05:46:10 +00:00
Brian Gaeke
96e0f832f8 Get rid of a dead variable, and fix a typo in a comment.
llvm-svn: 14560
2004-07-02 05:30:01 +00:00
Brian Gaeke
b92c136437 Add M_TERMINATOR_FLAG to terminator instructions (branches and returns).
Also, the RETURN instructions are not used in the sparcv9 backend.

llvm-svn: 14559
2004-07-02 04:57:37 +00:00
Brian Gaeke
62ceddefe8 RETURN instructions are not used in the sparc backend.
When in doubt, stamp it out!!

llvm-svn: 14558
2004-07-02 04:57:35 +00:00
Misha Brukman
c9ecaeb69d * Follow the PowerPC convention of leaving 24 bytes for linking on the stack.
* Also leave space for spilling integer registers (this should be calculated)

llvm-svn: 14554
2004-07-01 21:35:00 +00:00
Misha Brukman
f5deab6100 * Get rid of constant-expr handling code: we use the ConstantExpr lowering pass
* Use the SetCC handling code in the format of Brian's V8
* Add FIXMEs where calls to functions are being made without adding them to the
  Module first... they cause missing symbols at assembly-time.

llvm-svn: 14553
2004-07-01 21:34:10 +00:00
Misha Brukman
1546c2e9c0 Wrap long line
llvm-svn: 14552
2004-07-01 21:27:59 +00:00
Misha Brukman
e409874a9f * Do not allocate r0 as we use it indiscriminantly in the instr selector.
* Do not define CR register class because we don't (yet) have the i4 type

llvm-svn: 14551
2004-07-01 21:24:50 +00:00
Misha Brukman
b296163bb1 Check if operand has an allocated reg before requesting it.
llvm-svn: 14550
2004-07-01 21:09:12 +00:00
Chris Lattner
f3e46315fb Add much better assertion checking for load and store insts.
Contributed by Vladimir Merzliakov!

llvm-svn: 14546
2004-07-01 20:23:52 +00:00
Brian Gaeke
dbf4f13e85 Make this pass use a more specific debug message than "Processing:".
llvm-svn: 14541
2004-07-01 19:27:10 +00:00
Chris Lattner
3fd0ea69f6 Handle targets where alignment can be bigger than the size of the data.
Contributed by Vladimir Prus!

llvm-svn: 14534
2004-07-01 17:32:59 +00:00
Chris Lattner
91662f48b8 Make sure that we destroy the MBB's, with all of their instructions, before
any other data structures

llvm-svn: 14524
2004-07-01 06:29:07 +00:00
Chris Lattner
93bf3a5985 Now that MachineFunction/MachineBasicBlock keep a mapping of blocks to ID #'s
use them instead of a local LiveVariables numbering

llvm-svn: 14523
2004-07-01 06:15:32 +00:00
Chris Lattner
43e765d61c Change MBB autonumber a bit to get the reverse mapping as well as a forward
mapping

llvm-svn: 14521
2004-07-01 06:02:27 +00:00
Chris Lattner
a2481b7e82 Instance var no longer exists
llvm-svn: 14520
2004-07-01 06:02:07 +00:00
Chris Lattner
ae4f21e30a Start using MBB numbers directly instead of going through the live variables
map.

llvm-svn: 14518
2004-07-01 04:29:47 +00:00
Chris Lattner
0bb956cda7 Instead of building a private numbering of MBB's use brg's nifty auto-numbering.
Also convert df_iterator -> df_ext_iterator for subsequent stuff I'm doing.

llvm-svn: 14517
2004-07-01 04:24:29 +00:00
Misha Brukman
a691e0bff7 Fix indentation to be 2 spaces.
llvm-svn: 14512
2004-06-30 22:11:03 +00:00
Misha Brukman
efcb6b8c2c * Coalesce the handy CALL* alias opcodes with the standard ones
* Congregate more branch-and-link opcodes together
* Mark FP, CPR, and special registers as volatile across calls

llvm-svn: 14511
2004-06-30 22:00:45 +00:00
Misha Brukman
7089b3d426 * Allow more registers to be allocated from the general register pool
* Define the condition register class

llvm-svn: 14510
2004-06-30 21:54:50 +00:00
Misha Brukman
08a07e969f * Inquire about the number of operands from the instruction directly
* Only check for a register if we are sure the instruction has one allocated

llvm-svn: 14509
2004-06-30 21:54:12 +00:00
Misha Brukman
010e07078b visitSetCondInst() takes a parameter of type `SetCondInst'
llvm-svn: 14508
2004-06-30 21:47:40 +00:00
Misha Brukman
49e6aa1ba7 Always assume a function may have calls because the printer may add `bl' to get
the PC in a code sequence for global variables.

llvm-svn: 14506
2004-06-30 00:09:12 +00:00
Misha Brukman
3422760e16 * Don't save LR when outputting globals: it's already saved on the stack once
for the function
* Registers aren't necessarily sequential wrt their enums, don't rely on it
  when emitting function arguments into sequential registers
* Remove X86-specific comments about AL/BL/AH/BH/EDX/etc
* Add an abort() for an unimplemented signed right shift
* The src operand for a GEP was never emitted!  Fixed.
* We can skip zero-valued GEP indices as they are no-ops.

"Hello, World!" now works.

llvm-svn: 14505
2004-06-29 23:45:05 +00:00
Misha Brukman
e9166fd352 * Stop using BBNumbering, we don't really need it
* Only increment labelNumber once, because it's used by both Load{hi,lo}Addr
* There is no .bss section on PowerPC
* Use .align 2 instead of other random numbers

llvm-svn: 14504
2004-06-29 23:40:57 +00:00
Misha Brukman
79a92e35b4 Set up the prologue and epilogue to be more like the manual and GCC output.
llvm-svn: 14502
2004-06-29 23:38:26 +00:00
Misha Brukman
2242e8d27f * Use LA instead of LWZ for LoadLoAddr
* Specify the isCall bit and caller-save registers for some call instrs

llvm-svn: 14501
2004-06-29 23:37:36 +00:00
Misha Brukman
a0721ac147 Only allocate non-volatile registers R13-31 (for now).
llvm-svn: 14500
2004-06-29 23:35:32 +00:00
Misha Brukman
ddf07d1c08 Lower ConstantExpressions before the code generator.
llvm-svn: 14497
2004-06-29 23:33:20 +00:00
Reid Spencer
d15e874bb7 Remove files no longer needed. ConstantReader and InstructionReader were
integrated into Reader. Parser.* was just a bad idea. AnalyzerInternals.h
is no longer needed. ReaderPrimitives.h was integrated into Reader.h and
Reader.cpp. Dumper.cpp was integrated into Analyzer.cpp. ReaderInternals.h
became Reader.h. AnalyzerWrappers.cpp was integerated into
ReaderWrappers.cpp

llvm-svn: 14496
2004-06-29 23:32:41 +00:00
Reid Spencer
b8b9962dd1 This is a slimming down of the previous ReaderInternals.h that just
declares the BytecodeReader class.

llvm-svn: 14495
2004-06-29 23:31:01 +00:00
Reid Spencer
401a9df238 MAJOR REWRITE.
- stop passing Buf/BufEnd to every function (now member vars)
- internalize things that used to be in a header file that no one else
  included/needed.
- Remove defunct BCR_TRACE lines
- Standardize error handling with the PARSE_ERROR macro.
- Integrate ConstantReader.cpp and InstructionReader.cpp and reorgnize
  the definition order so that gcc has a chance at optimizing this module
- Standardize case and style of method names.
- Eliminate unneeded header files
- Prepare for Type != Value (bug122) change by splitting Types into their
  own data structures.
- Implement the BytecodeHandler interface calls.
- Provide default implementation of BytecodeHandler interface.

llvm-svn: 14494
2004-06-29 23:29:38 +00:00
Reid Spencer
e0ce1743c6 Adjustments to allow Bytecode Reading to support the BytecodeHandler
interface which is called by the reader if a BytecodeHandler is provided.

llvm-svn: 14493
2004-06-29 23:24:14 +00:00
Reid Spencer
61cff86f35 Merge Dumper.cpp and AnalyzerWrappers.cpp into this file. Also, adjust the
dumping facility to produce useful output.

llvm-svn: 14492
2004-06-29 23:23:12 +00:00
Reid Spencer
21cbc878d9 Analyzer moved to ../Reader directory.
llvm-svn: 14491
2004-06-29 23:21:53 +00:00
Reid Spencer
976bae4918 Remove newly defunct Analyzer directory.
llvm-svn: 14490
2004-06-29 23:21:16 +00:00
Misha Brukman
9e015dddb8 Fix associativity of parameters to assert(): now it actually makes sense.
llvm-svn: 14483
2004-06-29 19:43:20 +00:00
Misha Brukman
b3e4179f42 Convert tabs to spaces.
llvm-svn: 14482
2004-06-29 19:28:53 +00:00
Misha Brukman
01841234e8 * Fix saving LR in function prologue
* Adjust epilogue restore sequence to match the PowerPC documentation

llvm-svn: 14480
2004-06-29 17:14:42 +00:00
Misha Brukman
08f6a46ce2 Assembly syntax/comment fixes by Nate Begeman.
llvm-svn: 14479
2004-06-29 17:13:26 +00:00
Vikram S. Adve
5ad9c7dd34 Restoring this file.
llvm-svn: 14478
2004-06-29 14:20:27 +00:00
Chris Lattner
dda82ce624 The code generator should work with unreachable blocks. If not, then this
is a bug that should be fixed in the code generator, not papered over with
the simplifycfg pass.  Eliminating this makes bugpoint much more useful

llvm-svn: 14477
2004-06-29 07:20:16 +00:00
Chris Lattner
2abf0134d0 I believe that the code generator now properly handles dead basic blocks. If not,
this is a bug, and should be fixed.

llvm-svn: 14476
2004-06-29 07:17:12 +00:00
Chris Lattner
41c3157c70 In line with the previous patch, do not assert out if analyzing a dead basic block.
llvm-svn: 14475
2004-06-29 07:16:23 +00:00
Chris Lattner
27c176234c Do not dereference end iterators. It hurts when you do that.
llvm-svn: 14474
2004-06-29 06:56:51 +00:00
Chris Lattner
cd1a39bbec Fix a regression from r1.224. In particular, codegen a cast from double ->
float as a truncation by going through memory.  This truncation was being
skipped, which caused 175.vpr to fail after aggressive register promotion.

llvm-svn: 14473
2004-06-29 00:14:38 +00:00
Misha Brukman
7627e1ff1a Can't print out machine code before it is constructed.
llvm-svn: 14472
2004-06-28 21:16:57 +00:00
Misha Brukman
92cc94a0e5 Fix the assembly opcode on LOADLoAddr, courtesy of Nate Begeman.
llvm-svn: 14470
2004-06-28 18:27:08 +00:00
Misha Brukman
2f7332b752 Set isBranch and isTerminator bits on all branch instructions.
llvm-svn: 14469
2004-06-28 18:23:35 +00:00
Misha Brukman
8f1e58dfe3 Fix loading and storing PC-relative static variables, courtesy of Nate Begeman.
llvm-svn: 14468
2004-06-28 18:20:59 +00:00
Misha Brukman
2eccf504e2 No need to generate a lazy-linking stub for internal functions, they can be
resolved by the static linker.

llvm-svn: 14467
2004-06-28 18:03:37 +00:00
Misha Brukman
5a52b7aa36 Do not set the `link' bit when branching to the first BB of a function, as it
will cause an infinite loop.  The link bit is only used for calling functions.

llvm-svn: 14466
2004-06-28 17:57:40 +00:00
Misha Brukman
02ac5488d5 Fix spacing around function arguments.
llvm-svn: 14463
2004-06-28 15:53:27 +00:00
Chris Lattner
7d6a9bf05c Initial checkin of a simple mod/ref analysis for global variables. This is
still overly conservative and uses very simple data structures, but it is a
start, and allows elimination of a lot of loads.

llvm-svn: 14462
2004-06-28 06:33:13 +00:00
Chris Lattner
7d0108c315 Remove unused file
llvm-svn: 14460
2004-06-28 00:46:58 +00:00
Chris Lattner
975c95e99a These passes are long dead/obsolete. They never worked in the first place
and are a maintenence burden.  Nuke nuke nuke

llvm-svn: 14457
2004-06-28 00:44:18 +00:00
Chris Lattner
548171248d Moved IPModRef out of the public include dir
llvm-svn: 14455
2004-06-28 00:41:23 +00:00
Chris Lattner
6eb1e76227 Move DependenceGraph.* to lib/Analysis/DataStructure
llvm-svn: 14452
2004-06-28 00:32:33 +00:00
Chris Lattner
a77dd6edec Moving to lib/Analysis/DataStructure
llvm-svn: 14450
2004-06-28 00:29:42 +00:00
Chris Lattner
f914ccfa2a Move MemoryDepAnalysis.h into lib/Analysis/DataStructure
llvm-svn: 14448
2004-06-28 00:27:16 +00:00