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

128 Commits

Author SHA1 Message Date
Chris Lattner
8ca18dd9fa Add support for the switch instruction to the CWriter
llvm-svn: 5847
2003-04-22 20:19:52 +00:00
Joel Stanley
1b7b1786a5 Fixed alloca declaration problem on sun.
llvm-svn: 5546
2003-02-12 20:45:00 +00:00
Chris Lattner
b5027095e5 - Eliminated the deferred symbol table stuff in Module & Function, it really
wasn't an optimization and it was causing lots of bugs.

llvm-svn: 4779
2002-11-20 18:36:02 +00:00
Nick Hildenbrandt
cd79631bb1 *** empty log message ***
llvm-svn: 4754
2002-11-18 22:21:52 +00:00
Nick Hildenbrandt
d97c216a21 *** empty log message ***
llvm-svn: 4745
2002-11-18 20:55:50 +00:00
Chris Lattner
3de4680d56 _REALLY_ fix the float constant problem
llvm-svn: 4609
2002-11-07 22:12:53 +00:00
Chris Lattner
d57a4ec976 Print out 'float' constants correctly
llvm-svn: 4607
2002-11-07 19:43:59 +00:00
Nick Hildenbrandt
1fddd12bae Fixes escapeing bug in strings. Fixes test case test/Regression/CBackend/2002-11-06-PrintEscaped.c
llvm-svn: 4583
2002-11-06 21:40:23 +00:00
Nick Hildenbrandt
4c3112f3cb Loads and stores can't be inlined. This fixes test/Singlesource/matrixTranspose
llvm-svn: 4579
2002-11-06 20:07:54 +00:00
Nick Hildenbrandt
cb64b4ce99 Fixed bug in Regression/CBackend/2002-10-30-FunctionPointerAlloca.ll
llvm-svn: 4486
2002-11-01 17:37:09 +00:00
Nick Hildenbrandt
f3846a75f1 Casting NULL can cause problems so lets just not cast NULL to anything.
llvm-svn: 4349
2002-10-28 19:54:06 +00:00
Nick Hildenbrandt
57a54cb166 *** empty log message ***
llvm-svn: 4343
2002-10-28 19:05:12 +00:00
Nick Hildenbrandt
d23deb3ebe Malloc prototyping now works even if the original file had its own prototype for malloc
llvm-svn: 4271
2002-10-23 18:59:40 +00:00
Chris Lattner
461fc88db8 Fix bug: CBackend/2002-10-16-External.ll
llvm-svn: 4201
2002-10-16 20:08:47 +00:00
Chris Lattner
8eaebbfd80 Fix bug: test/Regression/CBackend/2002-10-15-OpaqueTypeProblem.ll
llvm-svn: 4190
2002-10-16 00:08:22 +00:00
Nick Hildenbrandt
8dba342c37 Instead of adding stdlib we just prototype malloc correctly.
llvm-svn: 4118
2002-10-11 21:40:44 +00:00
Nick Hildenbrandt
27d9b87ed1 Sun requires you to include stdlib to use malloc
llvm-svn: 4117
2002-10-11 18:41:44 +00:00
Vikram S. Adve
6932399f9b Bug fix: In preventing static global variables from being printed twice,
I also prevented external globals from being printed twice, but they
should (extern declaration and definition).

llvm-svn: 4043
2002-10-05 23:43:10 +00:00
Nick Hildenbrandt
1ccdc12400 Add parens around constant calls to getelemptr to properly associate the reference
llvm-svn: 4032
2002-10-03 20:47:24 +00:00
Nick Hildenbrandt
1477c5282f I was wrong on the removing of those references on the last commit.
llvm-svn: 4023
2002-10-02 21:14:33 +00:00
Nick Hildenbrandt
d090d15736 Removed unneeded reference and dereferences.
llvm-svn: 4016
2002-10-02 18:34:51 +00:00
Nick Hildenbrandt
5d1a2cf4b1 Cleaned up my last check-in.
llvm-svn: 4014
2002-10-02 18:32:35 +00:00
Nick Hildenbrandt
f9aa2b4886 No longer include malloc.h. If protoypes are needed for memory functions they will be present in the byte code and the generated c as well.
llvm-svn: 4013
2002-10-02 18:20:18 +00:00
Nick Hildenbrandt
1defd8270c Fixed to properly escape quotes in strings.
llvm-svn: 3991
2002-09-30 21:11:55 +00:00
Nick Hildenbrandt
205d6a6b20 Strings now handled correctly.
llvm-svn: 3920
2002-09-25 20:29:26 +00:00
Nick Hildenbrandt
cb0b25c6c1 Parenthesis are now added to casts of type array.
llvm-svn: 3892
2002-09-23 21:02:50 +00:00
Chris Lattner
b9379750d9 Fix cwriter to not output FP constants in ascii, output them in hex instead.
This fixes a number of FP precision problems, making the output of the
power benchmark closer to the right answer.

Unfortunately, this only addresses FP constants used directly in functions.
Constants referred to by global constants (such as an array of FP values)
aren't helped by this.  Until this happens power won't work.

llvm-svn: 3871
2002-09-20 23:26:33 +00:00
Chris Lattner
6874ea0917 Fix bug: 2002-09-20-VarArgPrototypes.ll
llvm-svn: 3870
2002-09-20 22:32:30 +00:00
Chris Lattner
0752044e03 Fix output of typedefs to avoid syntax errors.
* We now can correctly Cify the Olden-power benchmark

llvm-svn: 3860
2002-09-20 15:20:24 +00:00
Chris Lattner
1c1de51dfe * Add a couple of comments to the output c code
* _FIX_ infinite recursion problem, due to typedefs of a structure being
  printed before the structure.

llvm-svn: 3859
2002-09-20 15:18:30 +00:00
Chris Lattner
af6a9e8fc4 Another change that doesn't affect functionality. Since we are only looking
at types in the symbol table, only traverse the type plane, saving a loop nest.

llvm-svn: 3858
2002-09-20 15:12:13 +00:00
Chris Lattner
a66eef584f Make the StructPrinted set only take memory when it's being used.
rename parseStruct to printContainedStructs

llvm-svn: 3857
2002-09-20 15:05:40 +00:00
Chris Lattner
4f385b19bb No functionality changes, primarily just changing tab indentation to space
indentation

llvm-svn: 3856
2002-09-20 14:56:54 +00:00
Vikram S. Adve
fa9dd5dba9 Don't print global variable definitions twice! Sun's pathetic compiler
never complained about this.

llvm-svn: 3774
2002-09-17 11:50:38 +00:00
Vikram S. Adve
012667a925 No longer need to sign-extend array indices to 64 bits since they
are now longs and not unsigned ints.

llvm-svn: 3731
2002-09-15 21:51:04 +00:00
Nick Hildenbrandt
da4f9b1cee Fixed problem with printing struct definitions in the correct order.
This allows for the Regression/Transforms/ScalarReplacement/scalarize.c to run correctly.

llvm-svn: 3721
2002-09-14 21:36:24 +00:00
Chris Lattner
5f8c0401a9 Fix a bug introduced by the Getelementptr change
llvm-svn: 3695
2002-09-12 20:34:47 +00:00
Chris Lattner
18e3c4ff50 - Change getelementptr instruction to use long indexes instead of uint
indexes for sequential types.

llvm-svn: 3681
2002-09-11 01:21:29 +00:00
Chris Lattner
073971b535 - Fix bug: test/Regression/CBackend/2002-08-20-RecursiveTypes.ll
- Converted CWriter to be an LLVM pass.

llvm-svn: 3558
2002-08-31 00:29:16 +00:00
Chris Lattner
7a75a8e108 Fix bug: test/Regression/CBackend/2002-08-26-IndirectCallTest.ll
llvm-svn: 3511
2002-08-26 20:50:09 +00:00
Vikram S. Adve
9369cfea20 Fix the way parens are printed around "*ptrName" so that
no parens are printed around  *, **, ... alone, except if
it is a pointer type for which no name should be printed,
as in the result of a cast.

llvm-svn: 3506
2002-08-25 20:00:08 +00:00
Vikram S. Adve
d499981c22 Sign-extend array index expressions to work correctly on non-32 bit machines.
llvm-svn: 3496
2002-08-24 14:44:23 +00:00
Anand Shukla
e2a8fb2f79 Changed default value of 3rd parameter in function definition
llvm-svn: 3492
2002-08-23 10:55:49 +00:00
Chris Lattner
21c27f79be Load & StoreInst no longer derive from MemAccessInst, so we don't have
to handle indexing anymore

llvm-svn: 3484
2002-08-22 22:48:55 +00:00
Chris Lattner
5578696d40 Fix bug: 2002-08-20-UnnamedArgument.c
llvm-svn: 3401
2002-08-20 16:55:48 +00:00
Chris Lattner
69a443b356 Implement ConstantExprs in CWriter
llvm-svn: 3394
2002-08-19 23:09:46 +00:00
Chris Lattner
ddd1d61b21 Incorporate calcTypeNameVar into CWriter class, fixing
test/Regression/CBackend/2002-08-19-FunctionPointer.c in the process

llvm-svn: 3392
2002-08-19 22:17:53 +00:00
Chris Lattner
b6818687da Output forward definitions of global vars to handle recursive intializers correctly.
llvm-svn: 3391
2002-08-19 21:48:40 +00:00
Chris Lattner
fc62e1bdb1 - Change constant printing to be better integrated with the rest of the
CWriter class.  Write directly to stream instead of building a big
      string, then writing it out.
    - Implement printing of ConstantPointerRefs

llvm-svn: 3389
2002-08-19 21:32:41 +00:00
Chris Lattner
119695e390 Remove support for NOT instruction
llvm-svn: 3320
2002-08-14 18:00:52 +00:00
Chris Lattner
0d3708d9dc Avoid warning message
llvm-svn: 3085
2002-07-25 16:30:45 +00:00
Chris Lattner
aa9a5b5c15 Fix anands changes
llvm-svn: 2806
2002-06-30 16:07:20 +00:00
Anand Shukla
0de79ee516 added include<iostream> for cerr
llvm-svn: 2796
2002-06-25 21:29:10 +00:00
Anand Shukla
b35aa2b2e7 changes to make it compatible with 64bit gcc
llvm-svn: 2790
2002-06-25 20:44:04 +00:00
Chris Lattner
390c338968 * Update with MegaPatch
* Fix various bugs

llvm-svn: 2774
2002-06-25 15:57:03 +00:00
Chris Lattner
4864c06550 * Fix typeo
* Provide a #include of <malloc.h> so that the sun C compiler does not
  miscompile malloc function calls

llvm-svn: 2702
2002-05-21 21:10:04 +00:00
Chris Lattner
b82857d705 Fix bug: test/Regression/CBackend/2002-05-21-MissingReturn.ll
llvm-svn: 2690
2002-05-21 18:05:19 +00:00
Chris Lattner
4d98351cea Fix bug: test/Regression/CBackend/2002-05-16-NameCollide.ll by tracking
which global variables would have name collisions if they were not mangled,
and use this info to mangle them iff they would collide.

llvm-svn: 2639
2002-05-17 04:55:35 +00:00
Chris Lattner
a98304f4fa Last minor cleanups, this code still does not work for all cases, but it
works much better than it used to.

llvm-svn: 2588
2002-05-09 21:31:18 +00:00
Chris Lattner
4ece8deba5 Two Cleanups to generated C code:
1. Avoid printing *(&globalvariable), instead print globalvariable alone
   as a special case.
2. Inline subexpressions into expressions as much as legal that preserves
   execution characteristics of expressions.  Now we get nice (but
   over-parenthesized, oh well) things like:

     ltmp_428_7 = spec__putc(((unsigned char )((bsBuff) >> 24)), (bsStream));

   instead of five seperate instructions (bsBuff & bsStream are globals).

llvm-svn: 2587
2002-05-09 21:18:38 +00:00
Chris Lattner
9a9b801669 * Remove CInstPrintVisitor class, incorporating it into the CWriter class
* Reorder code in the file to make it more logically laid out.

llvm-svn: 2586
2002-05-09 20:53:56 +00:00
Chris Lattner
3fd3c03371 Remove CLocalVars data structure entirely, instead of building stuff and
then printing it out, just print as we go.

llvm-svn: 2585
2002-05-09 20:39:03 +00:00
Chris Lattner
5ed180c1bd Simplify code by removing InstLocalVarsVisitor, replacing it with a simple
inst_iterator.

llvm-svn: 2584
2002-05-09 20:33:35 +00:00
Chris Lattner
aa1d35be51 * Clean up how PHI nodes are handled
* Correct global variable references
* Fix loads & stores with zero indices
* Do not emit an else part of a branch if there is no code (no phi node
  and a fallthrough branch), makes code more readable to get:
  if (l2_cond240) {
    goto l13_bb10;
  }

with no else{} branch

llvm-svn: 2583
2002-05-09 20:14:10 +00:00
Chris Lattner
94e4578db4 Emit:
l3_reg109 = l81_this->field0;
Instead of:
  l3_reg109 = l81_this[0u].field0;

where possible

llvm-svn: 2579
2002-05-09 15:59:50 +00:00
Chris Lattner
97ae8c039e * Print structures types correctly
* Clean up generated code to not emit basic block labels and goto
  instructions if they are unneccesary (for example, fall throughs)

llvm-svn: 2578
2002-05-09 15:49:41 +00:00
Chris Lattner
93fb65370c * Continue cleanup of type printing code
* Print a newline after a malloc instruction
* Convert unprintable characters to x_ instead of _x so that we don't
  generate identifiers that start with underscores

llvm-svn: 2577
2002-05-09 15:18:52 +00:00
Chris Lattner
b3acea93cf Gut the type printing code so there is only one copy of it instead of 3
llvm-svn: 2576
2002-05-09 14:40:11 +00:00
Chris Lattner
619c55baec * Remove dead "constant printing" code
* Mangle names with only a prefix so that they are easier on the eyes.
* Put spaces around binary operators with low precedence to make them easier to read
* Don't prefix function names with &, although it's correct, it's unnecesary and
  easier to read without it.

llvm-svn: 2575
2002-05-09 05:16:40 +00:00
Chris Lattner
cde698978f Remove gross "Operand" instance variable
Remove lots of unneccesary arguments to methods

llvm-svn: 2574
2002-05-09 04:39:00 +00:00
Chris Lattner
e8573f21c7 Simplify and clean up function calls.
Now indirect function calls work, except that function pointer types are not correct.

llvm-svn: 2573
2002-05-09 04:21:21 +00:00
Chris Lattner
72286b8a3b * Remove dead function
* Print C strings correctly
* Expand C escape sequences nicely (ie \n \t, etc get generated instead of hex escapes)

llvm-svn: 2572
2002-05-09 03:56:52 +00:00
Chris Lattner
c7b3367aad Make Getelementptr, load & store all work the right way.
Handle global variables correctly.

llvm-svn: 2571
2002-05-09 03:50:42 +00:00
Chris Lattner
2a4f66f21d Many random fixes:
* Use binary operator logic for shifts instead of cloning code
 * Unary not is '~' not '!'

llvm-svn: 2570
2002-05-09 03:28:37 +00:00
Chris Lattner
87d656d2a6 Incorporate and purge function before and after printing them so unnamed values
have some hope of working right.

Function calls do not try to emit an lvalue if they return void.

llvm-svn: 2569
2002-05-09 03:12:34 +00:00
Chris Lattner
80f7e2db14 Factor out the code to print a value to ONE place.
It turns out that unnamed values DO NOT work at all, that's next on the list.

llvm-svn: 2568
2002-05-09 03:06:06 +00:00
Chris Lattner
558771c658 First wave of cleanups, looks like the first of many.
llvm-svn: 2567
2002-05-09 02:28:59 +00:00
Sumant Kowshik
64cf4b95c9 *** empty log message ***
llvm-svn: 2552
2002-05-08 18:09:58 +00:00