Commit Graph

261 Commits

Author SHA1 Message Date
Brian Gaeke
49a178b9fd Don't include llvm/SlotCalculator.h, or <set>.
Move up the inclusion of llvm/Support/Mangler.h.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7320 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-25 20:21:06 +00:00
Brian Gaeke
d9fb37ac98 Use unified CWriter-X86/Printer name mangler. Do not bother using
SlotCalculator in CWriter.  (Unfortunately, all this means a lot of
X86/Printer's methods have to be de-constified again.  Oh well.)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7299 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-24 20:20:44 +00:00
Chris Lattner
d4e8d31e40 Fix program: SingleSource/UnitTests/2003-07-09-SignedArgs with the CBE
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7276 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23 20:45:31 +00:00
Chris Lattner
c07736a397 Simplify code by using ConstantInt::getRawValue instead of checking to see
whether the constant is signed or unsigned, then casting


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7252 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23 15:22:26 +00:00
Misha Brukman
8f9f9a2901 Eliminated dead code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7209 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-21 16:34:35 +00:00
Misha Brukman
ac25de3bf0 Some beautification changes (tabs to spaces, removed extra blank lines);
no functionality changed.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7138 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-09 17:33:50 +00:00
John Criswell
cf6d7b0353 Removed size_t from the parameter list of the malloc() prototype in generated C
code.  This prevents a compiler warning on Sparc that causes the tests to fail.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7125 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-08 14:52:09 +00:00
Chris Lattner
2fa42a816d jmp_buf is really a pointer type that is passed around...
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6935 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-28 19:29:34 +00:00
Chris Lattner
9bda5f52bd Add support for the Invoke instruction!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6934 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-28 17:53:05 +00:00
Chris Lattner
4148819f0f Preserve compatibility with non-gcc compilers
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6932 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-28 17:15:12 +00:00
Chris Lattner
76d9f1b467 Fix bug: CBackend/2003-06-28-LinkOnceGlobalVars.llx
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6931 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-28 17:08:36 +00:00
Joel Stanley
54f6032dae - Fixed name mangling conditions to handle 'linkonce' linkage type. In
particular, name mangling for GlobalValues only occurs when the linkage type is
internal or when the name must be mangled to avoid a collision.  See comments in
CWriter::getValueName for more information.

- 'inline' keyword is now emitted for functions with 'linkonce' linkage type.

- Fixed typos.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6898 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-25 04:52:09 +00:00
Brian Gaeke
e99f4cf4ac It seems likely that floats would need a cast too, because they are
ordinarily promoted to doubles.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6894 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-25 03:05:33 +00:00
Brian Gaeke
031a112747 Fix 2003-06-23-PromotedExprs.llx -- if we are adding two bytes we better
explicitly cast the result to be a byte, or C will gleefully promote it
to int.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6869 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-23 20:00:51 +00:00
Brian Gaeke
b471a23a85 lib/CWriter/Writer.cpp: Copy AsmWriter's ConstantFP checking code here
into a new function FPCSafeToPrint(), and use it in printConstant()
and printFunction() to decide whether we should output ConstantFPs as
floating-point constants or as references to stack-allocated variables.

lib/VMCore/AsmWriter.cpp: Fix an apparent typo in the code mentioned above.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6762 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-17 23:55:35 +00:00
Chris Lattner
a8ab89e3da Fairly major change: emit fixed sized allocas in the entry block as a variable,
instead of a variable pointer and an alloca.  All accesses to the variable then
use the address-of operator to access it.  This plays better with the internal
GCC code generation phases, which bail early on functions which contain allocas.
It also makes the code a bit easier to read.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6734 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-17 04:39:14 +00:00
Brian Gaeke
a0145ccb20 Don't include alloca.h on FreeBSD.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6728 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-16 23:57:13 +00:00
Chris Lattner
da92090f0e Fix typeo
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6704 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-16 12:21:19 +00:00
Chris Lattner
02da6c0f08 Fix bug: CBackend/2003-06-11-HexConstant.ll
Fix bug: CBackend/2003-06-11-LiteralStringProblem.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6697 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-16 12:09:09 +00:00
Chris Lattner
940b08dd1e Don't output explicit initializers for globals that are zero initialized
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6651 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-06 07:10:24 +00:00
Chris Lattner
cf135cbc77 Fix bug: CBackend/2003-06-01-NullPointerType.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6526 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-02 03:10:53 +00:00
Chris Lattner
d13bd22fbe Fix a bug with casts to bool. This fixes testcase UnitTests/2003-05-31-CastToBool.c
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6507 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-01 03:36:51 +00:00
Chris Lattner
ab2b328c78 Eliminate unnecessary ->get calls that are now automatically handled.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6397 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-29 15:12:27 +00:00
Chris Lattner
c436b37262 Add support for setjmp/longjmp primitives
Patch checked in for Bill Wendling :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6241 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-17 22:26:33 +00:00
Chris Lattner
84c0d5e157 Casts are now unnecessary
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6199 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-14 17:50:19 +00:00
Chris Lattner
ddfc03c8cb Fix bug: CBackend/2003-05-13-VarArgFunction.ll
In C, a prototype with no arguments is varargs.  A prototype that takes void
has zero args.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6172 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-13 20:15:37 +00:00
Chris Lattner
45343ea5ac Fix bug: CWriter/2003-05-12-IntegerSizeWarning.c
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6128 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-12 15:39:31 +00:00
Chris Lattner
18ac3c8914 Add support for variable argument functions!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6044 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-08 18:41:45 +00:00
Chris Lattner
84e6665570 Fix bug: UnitTests/2003-05-02-DependantPHI.c
Fix testcase MultiSource/Ptrdist-ks


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6000 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-03 07:11:00 +00:00
Chris Lattner
edd8ce1370 * Eliminate using decls
* Fix some styleistic things
* Fix bug: CWriter/2002-05-16-NameCollide.ll


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5988 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-03 03:14:35 +00:00
Chris Lattner
f1acd9623c Fix problem where labels were being incorrectly elided, and fix problem
where PHI copies where not emitted for the default label of switch insts


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5882 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-23 19:15:13 +00:00
Chris Lattner
f5612b76bc Fix the super obnoxious "cast to pointer from integer of different size" warnings
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5881 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-23 19:09:22 +00:00
Chris Lattner
2ee82e05e3 Remove unneccesary &*
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5871 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-23 16:36:11 +00:00
Chris Lattner
a9f5e0517e Add support for the switch instruction to the CWriter
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5847 91177308-0d34-0410-b5e6-96231b3b80d8
2003-04-22 20:19:52 +00:00
Joel Stanley
ecd78ac1cb Fixed alloca declaration problem on sun.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5546 91177308-0d34-0410-b5e6-96231b3b80d8
2003-02-12 20:45:00 +00:00
Chris Lattner
6e6026b465 - Eliminated the deferred symbol table stuff in Module & Function, it really
wasn't an optimization and it was causing lots of bugs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4779 91177308-0d34-0410-b5e6-96231b3b80d8
2002-11-20 18:36:02 +00:00
Nick Hildenbrandt
a1a64f8f27 *** empty log message ***
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4754 91177308-0d34-0410-b5e6-96231b3b80d8
2002-11-18 22:21:52 +00:00
Nick Hildenbrandt
9850237536 *** empty log message ***
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4745 91177308-0d34-0410-b5e6-96231b3b80d8
2002-11-18 20:55:50 +00:00
Chris Lattner
9c1338b71c _REALLY_ fix the float constant problem
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4609 91177308-0d34-0410-b5e6-96231b3b80d8
2002-11-07 22:12:53 +00:00
Chris Lattner
eb6f8c757f Print out 'float' constants correctly
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4607 91177308-0d34-0410-b5e6-96231b3b80d8
2002-11-07 19:43:59 +00:00
Nick Hildenbrandt
088b472eed Fixes escapeing bug in strings. Fixes test case test/Regression/CBackend/2002-11-06-PrintEscaped.c
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4583 91177308-0d34-0410-b5e6-96231b3b80d8
2002-11-06 21:40:23 +00:00
Nick Hildenbrandt
2cf2cbcefb Loads and stores can't be inlined. This fixes test/Singlesource/matrixTranspose
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4579 91177308-0d34-0410-b5e6-96231b3b80d8
2002-11-06 20:07:54 +00:00
Nick Hildenbrandt
7e9fea736d Fixed bug in Regression/CBackend/2002-10-30-FunctionPointerAlloca.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4486 91177308-0d34-0410-b5e6-96231b3b80d8
2002-11-01 17:37:09 +00:00
Nick Hildenbrandt
f0fca36d14 Casting NULL can cause problems so lets just not cast NULL to anything.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4349 91177308-0d34-0410-b5e6-96231b3b80d8
2002-10-28 19:54:06 +00:00
Nick Hildenbrandt
50de36a41d *** empty log message ***
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4343 91177308-0d34-0410-b5e6-96231b3b80d8
2002-10-28 19:05:12 +00:00
Nick Hildenbrandt
3cecdc5b9a Malloc prototyping now works even if the original file had its own prototype for malloc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4271 91177308-0d34-0410-b5e6-96231b3b80d8
2002-10-23 18:59:40 +00:00
Chris Lattner
e8e035b591 Fix bug: CBackend/2002-10-16-External.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4201 91177308-0d34-0410-b5e6-96231b3b80d8
2002-10-16 20:08:47 +00:00
Chris Lattner
04b72c821e Fix bug: test/Regression/CBackend/2002-10-15-OpaqueTypeProblem.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4190 91177308-0d34-0410-b5e6-96231b3b80d8
2002-10-16 00:08:22 +00:00
Nick Hildenbrandt
98360a1752 Instead of adding stdlib we just prototype malloc correctly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4118 91177308-0d34-0410-b5e6-96231b3b80d8
2002-10-11 21:40:44 +00:00
Nick Hildenbrandt
c7140e9bd9 Sun requires you to include stdlib to use malloc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4117 91177308-0d34-0410-b5e6-96231b3b80d8
2002-10-11 18:41:44 +00:00
Vikram S. Adve
2a408f06b5 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).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4043 91177308-0d34-0410-b5e6-96231b3b80d8
2002-10-05 23:43:10 +00:00
Nick Hildenbrandt
d2eb386c16 Add parens around constant calls to getelemptr to properly associate the reference
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4032 91177308-0d34-0410-b5e6-96231b3b80d8
2002-10-03 20:47:24 +00:00
Nick Hildenbrandt
ca626922bc I was wrong on the removing of those references on the last commit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4023 91177308-0d34-0410-b5e6-96231b3b80d8
2002-10-02 21:14:33 +00:00
Nick Hildenbrandt
51c84d14ab Removed unneeded reference and dereferences.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4016 91177308-0d34-0410-b5e6-96231b3b80d8
2002-10-02 18:34:51 +00:00
Nick Hildenbrandt
275801b2dd Cleaned up my last check-in.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4014 91177308-0d34-0410-b5e6-96231b3b80d8
2002-10-02 18:32:35 +00:00
Nick Hildenbrandt
113ad893b9 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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4013 91177308-0d34-0410-b5e6-96231b3b80d8
2002-10-02 18:20:18 +00:00
Nick Hildenbrandt
c3dd2af428 Fixed to properly escape quotes in strings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3991 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-30 21:11:55 +00:00
Nick Hildenbrandt
e548f009f7 Strings now handled correctly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3920 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-25 20:29:26 +00:00
Nick Hildenbrandt
c14ded4858 Parenthesis are now added to casts of type array.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3892 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-23 21:02:50 +00:00
Chris Lattner
d1cf1b458a 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3871 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-20 23:26:33 +00:00
Chris Lattner
1f8c4a17c1 Fix bug: 2002-09-20-VarArgPrototypes.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3870 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-20 22:32:30 +00:00
Chris Lattner
270d78a8d6 Fix output of typedefs to avoid syntax errors.
* We now can correctly Cify the Olden-power benchmark


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3860 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-20 15:20:24 +00:00
Chris Lattner
58d04d4e35 * 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3859 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-20 15:18:30 +00:00
Chris Lattner
2db41cd5de 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3858 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-20 15:12:13 +00:00
Chris Lattner
2c601a7be1 Make the StructPrinted set only take memory when it's being used.
rename parseStruct to printContainedStructs


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3857 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-20 15:05:40 +00:00
Chris Lattner
a4c047ec27 No functionality changes, primarily just changing tab indentation to space
indentation


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3856 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-20 14:56:54 +00:00
Vikram S. Adve
913bfbc2e4 Don't print global variable definitions twice! Sun's pathetic compiler
never complained about this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3774 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-17 11:50:38 +00:00
Vikram S. Adve
9d6f13f34b No longer need to sign-extend array indices to 64 bits since they
are now longs and not unsigned ints.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3731 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-15 21:51:04 +00:00
Nick Hildenbrandt
67aa2e235d Fixed problem with printing struct definitions in the correct order.
This allows for the Regression/Transforms/ScalarReplacement/scalarize.c to run correctly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3721 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-14 21:36:24 +00:00
Chris Lattner
59afbf3999 Fix a bug introduced by the Getelementptr change
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3695 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-12 20:34:47 +00:00
Chris Lattner
106ff4551c - Change getelementptr instruction to use long indexes instead of uint
indexes for sequential types.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3681 91177308-0d34-0410-b5e6-96231b3b80d8
2002-09-11 01:21:29 +00:00
Chris Lattner
0e9f93ea37 - Fix bug: test/Regression/CBackend/2002-08-20-RecursiveTypes.ll
- Converted CWriter to be an LLVM pass.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3558 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-31 00:29:16 +00:00
Chris Lattner
fabc8803a3 Fix bug: test/Regression/CBackend/2002-08-26-IndirectCallTest.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3511 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-26 20:50:09 +00:00
Vikram S. Adve
969c4ad65d 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3506 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-25 20:00:08 +00:00
Vikram S. Adve
42eb2bae8e Sign-extend array index expressions to work correctly on non-32 bit machines.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3496 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-24 14:44:23 +00:00
Anand Shukla
ed0f1c5285 Changed default value of 3rd parameter in function definition
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3492 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-23 10:55:49 +00:00
Chris Lattner
5dfe767b87 Load & StoreInst no longer derive from MemAccessInst, so we don't have
to handle indexing anymore


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3484 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-22 22:48:55 +00:00
Chris Lattner
4cda83568e Fix bug: 2002-08-20-UnnamedArgument.c
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3401 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-20 16:55:48 +00:00
Chris Lattner
df35a1cb4b Implement ConstantExprs in CWriter
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3394 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-19 23:09:46 +00:00
Chris Lattner
83c577566e Incorporate calcTypeNameVar into CWriter class, fixing
test/Regression/CBackend/2002-08-19-FunctionPointer.c in the process


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3392 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-19 22:17:53 +00:00
Chris Lattner
a4d4a855d8 Output forward definitions of global vars to handle recursive intializers correctly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3391 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-19 21:48:40 +00:00
Chris Lattner
6d49292003 - 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3389 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-19 21:32:41 +00:00
Chris Lattner
20e8e01c5d Remove support for NOT instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3320 91177308-0d34-0410-b5e6-96231b3b80d8
2002-08-14 18:00:52 +00:00
Chris Lattner
4b367217c2 Avoid warning message
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3085 91177308-0d34-0410-b5e6-96231b3b80d8
2002-07-25 16:30:45 +00:00
Chris Lattner
e7f65d3b71 Fix anands changes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2806 91177308-0d34-0410-b5e6-96231b3b80d8
2002-06-30 16:07:20 +00:00
Anand Shukla
e6f74a9ce8 added include<iostream> for cerr
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2796 91177308-0d34-0410-b5e6-96231b3b80d8
2002-06-25 21:29:10 +00:00
Anand Shukla
eea60fc59c changes to make it compatible with 64bit gcc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2790 91177308-0d34-0410-b5e6-96231b3b80d8
2002-06-25 20:44:04 +00:00
Chris Lattner
bb03efd7e5 * Update with MegaPatch
* Fix various bugs


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2774 91177308-0d34-0410-b5e6-96231b3b80d8
2002-06-25 15:57:03 +00:00
Chris Lattner
594b9fadb8 * Fix typeo
* Provide a #include of <malloc.h> so that the sun C compiler does not
  miscompile malloc function calls


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2702 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-21 21:10:04 +00:00
Chris Lattner
963b70bbf8 Fix bug: test/Regression/CBackend/2002-05-21-MissingReturn.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2690 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-21 18:05:19 +00:00
Chris Lattner
78771c886a 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2639 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-17 04:55:35 +00:00
Chris Lattner
3af3ba8b38 Last minor cleanups, this code still does not work for all cases, but it
works much better than it used to.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2588 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 21:31:18 +00:00
Chris Lattner
d0c668c380 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).


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2587 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 21:18:38 +00:00
Chris Lattner
4fbf26d2fc * Remove CInstPrintVisitor class, incorporating it into the CWriter class
* Reorder code in the file to make it more logically laid out.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2586 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 20:53:56 +00:00
Chris Lattner
497e19aee0 Remove CLocalVars data structure entirely, instead of building stuff and
then printing it out, just print as we go.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2585 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 20:39:03 +00:00
Chris Lattner
7683a12e20 Simplify code by removing InstLocalVarsVisitor, replacing it with a simple
inst_iterator.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2584 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 20:33:35 +00:00
Chris Lattner
1f02c8910a * 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2583 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 20:14:10 +00:00
Chris Lattner
8c8a37061a Emit:
l3_reg109 = l81_this->field0;
Instead of:
  l3_reg109 = l81_this[0u].field0;

where possible


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2579 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 15:59:50 +00:00
Chris Lattner
8c3c4bfcfe * 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)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2578 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 15:49:41 +00:00
Chris Lattner
deed7a5ae3 * 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


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2577 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 15:18:52 +00:00
Chris Lattner
3ef6dc7bdd Gut the type printing code so there is only one copy of it instead of 3
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2576 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 14:40:11 +00:00
Chris Lattner
2d05a1acb0 * 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2575 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 05:16:40 +00:00
Chris Lattner
2a7ab2e46d Remove gross "Operand" instance variable
Remove lots of unneccesary arguments to methods


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2574 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 04:39:00 +00:00
Chris Lattner
2f49902374 Simplify and clean up function calls.
Now indirect function calls work, except that function pointer types are not correct.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2573 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 04:21:21 +00:00
Chris Lattner
2f5eb4e9a5 * Remove dead function
* Print C strings correctly
* Expand C escape sequences nicely (ie \n \t, etc get generated instead of hex escapes)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2572 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 03:56:52 +00:00
Chris Lattner
4440826cae Make Getelementptr, load & store all work the right way.
Handle global variables correctly.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2571 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 03:50:42 +00:00
Chris Lattner
2f5f51a852 Many random fixes:
* Use binary operator logic for shifts instead of cloning code
 * Unary not is '~' not '!'


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2570 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 03:28:37 +00:00
Chris Lattner
f34ee81c5e 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2569 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 03:12:34 +00:00
Chris Lattner
b5af06a0ec 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2568 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 03:06:06 +00:00
Chris Lattner
16c7bb2c8f First wave of cleanups, looks like the first of many.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2567 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-09 02:28:59 +00:00
Sumant Kowshik
9ddc86c6e5 *** empty log message ***
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@2552 91177308-0d34-0410-b5e6-96231b3b80d8
2002-05-08 18:09:58 +00:00