1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-20 03:23:01 +02:00
Commit Graph

372 Commits

Author SHA1 Message Date
Dan Gohman
5a9c2a3434 Implement CBE support for first-class structs and array values,
and insertvalue and extractvalue instructions.

First-class array values are not trivial because C doesn't
support them. The approach I took here is to wrap all arrays
in structs. Feedback is welcome.

The 2007-01-15-NamedArrayType.ll test needed to be modified
because it has a "not grep" for a string that now exists,
because array types now have associated struct types, and
those struct types have names.

llvm-svn: 51881
2008-06-02 21:30:49 +00:00
Chris Lattner
43a47ddd89 Fix the CBE's handling of instructions whose result is an i1. Previously,
we did not truncate the value down to i1 with (x&1).  This caused a problem
when the computation of x was nontrivial, for example, "add i1 1, 1" would 
return 2 instead of 0.

This makes the testcase compile into:

...
  llvm_cbe_t = (((llvm_cbe_r == 0u) + (llvm_cbe_r == 0u))&1);
  llvm_cbe_u = (((unsigned int )(bool )llvm_cbe_t));
...

instead of:

...
  llvm_cbe_t = ((llvm_cbe_r == 0u) + (llvm_cbe_r == 0u));
  llvm_cbe_u = (((unsigned int )(bool )llvm_cbe_t));
...

This fixes a miscompilation of mediabench/adpcm/rawdaudio/rawdaudio and
403.gcc with the CBE, regressions from LLVM 2.2. Tanya, please pull 
this into the release branch.

llvm-svn: 51813
2008-05-31 09:23:55 +00:00
Duncan Sands
4757a8dd76 Fix some constructs that gcc-4.4 warns about.
llvm-svn: 51591
2008-05-27 11:50:51 +00:00
Duncan Sands
69bebf19a7 Tweak how ConstantFP80Ty constants are output
so that gcc doesn't warn about them.

llvm-svn: 51529
2008-05-24 01:00:52 +00:00
Dan Gohman
1bff0b83b0 Fix another isFirstClassType that now needs to be isSingleValueType.
This fixes recent CBE regressions.

llvm-svn: 51483
2008-05-23 16:57:00 +00:00
Chris Lattner
0a98796008 fix an off-by-one error in my previous patch, don't treat the callee as a incoming arg.
llvm-svn: 51422
2008-05-22 06:29:38 +00:00
Chris Lattner
6a45cf9dd6 Add support for multiple-return values in inline asm. This should
get inline asm working as well as it did previously with the CBE
with the new MRV support for inline asm.

llvm-svn: 51420
2008-05-22 06:19:37 +00:00
Dale Johannesen
768b6f281e Add CommonLinkage; currently tentative definitions
are represented as "weak", but there are subtle differences
in some cases on Darwin, so we need both.  The intent
is that "common" will behave identically to "weak" unless
somebody changes their target to do something else.
No functional change as yet.

llvm-svn: 51118
2008-05-14 20:12:51 +00:00
Dan Gohman
bab18cae46 Clean up the use of static and anonymous namespaces. This turned up
several things that were neither in an anonymous namespace nor static
but not intended to be global.

llvm-svn: 51017
2008-05-13 00:00:25 +00:00
Dan Gohman
5df2f2c2e7 Initial CBE support for multiple return values.
llvm-svn: 50187
2008-04-23 21:49:29 +00:00
Dan Gohman
5b2503097e Suppress the 128-bit integer typedef on 32-bit targets, because
it causes compile errors.

llvm-svn: 49122
2008-04-02 23:52:49 +00:00
Dan Gohman
4949a9c308 Partial CBackend support for 128-bit integers. This is needed
now that llvm-gcc is lowering appropriately-sized struct returns
to i128 on x86-64.

llvm-svn: 49109
2008-04-02 19:40:14 +00:00
Dan Gohman
2b96ce84aa Add explicit keywords.
llvm-svn: 48801
2008-03-25 22:06:05 +00:00
Dan Gohman
22002efa15 A quick nm audit turned up several fixed tables and objects that were
marked read-write. Use const so that they can be allocated in a
read-only segment.

llvm-svn: 48800
2008-03-25 21:45:14 +00:00
Chris Lattner
7925cc72c0 Reimplement the parameter attributes support, phase #1. hilights:
1. There is now a "PAListPtr" class, which is a smart pointer around
   the underlying uniqued parameter attribute list object, and manages
   its refcount.  It is now impossible to mess up the refcount.
2. PAListPtr is now the main interface to the underlying object, and
   the underlying object is now completely opaque.
3. Implementation details like SmallVector and FoldingSet are now no
   longer part of the interface.
4. You can create a PAListPtr with an arbitrary sequence of
   ParamAttrsWithIndex's, no need to make a SmallVector of a specific 
   size (you can just use an array or scalar or vector if you wish).
5. All the client code that had to check for a null pointer before
   dereferencing the pointer is simplified to just access the 
   PAListPtr directly.
6. The interfaces for adding attrs to a list and removing them is a
   bit simpler.

Phase #2 will rename some stuff (e.g. PAListPtr) and do other less 
invasive changes.

llvm-svn: 48289
2008-03-12 17:45:29 +00:00
Andrew Lenharth
0c26f5bb94 gcc likes things spelled correctly
llvm-svn: 47981
2008-03-05 23:41:37 +00:00
Devang Patel
d0d7028a2b s/isReturnStruct()/hasStructRetAttr()/g
llvm-svn: 47857
2008-03-03 21:46:28 +00:00
Chris Lattner
963b3c9039 add support for lvsl, fixing PR1481
llvm-svn: 47825
2008-03-02 08:54:27 +00:00
Chris Lattner
fdcd03cc98 add support for the sse.cmp.* intrinsics, which fixes sse.isamax with the CBE.
llvm-svn: 47824
2008-03-02 08:47:13 +00:00
Chris Lattner
7196bf5358 refactor intrinsic handling code out into its own method.
llvm-svn: 47823
2008-03-02 08:29:41 +00:00
Chris Lattner
75c409057a fix printing of undef vectors, this fixes "simple" and "build" in UnitTests/Vector.
Now they all pass.

llvm-svn: 47820
2008-03-02 08:14:45 +00:00
Chris Lattner
d8eeb6b1c8 insertelement got the wrong operands.
llvm-svn: 47819
2008-03-02 08:10:16 +00:00
Chris Lattner
e9aa391b61 Several changes:
* Simplify handling of byval, making it easier to understand and more 
    consistent.  This fixes PR2065.
  * Clean up and simplify handling of GEPs.  I can actually understand it now!
  * Implement support for GEP'ing into vectors, this fixes
    SingleSource/UnitTests/Vector/build2 among others.

llvm-svn: 47818
2008-03-02 08:07:24 +00:00
Chris Lattner
78f255dca8 Fix a bug I introduced in constant array and constant vector handling.
llvm-svn: 47816
2008-03-02 05:46:57 +00:00
Chris Lattner
96469b446d implement shufflevector.
llvm-svn: 47815
2008-03-02 05:41:07 +00:00
Chris Lattner
18c26f3dad implement extractelement.
llvm-svn: 47812
2008-03-02 03:57:08 +00:00
Chris Lattner
72e898e589 implement insertelement.
llvm-svn: 47811
2008-03-02 03:52:39 +00:00
Chris Lattner
85243c2223 respect isSigned for vector types, fixing sdiv of vectors etc.
llvm-svn: 47810
2008-03-02 03:41:23 +00:00
Chris Lattner
980424b55c print the attribute in the right place, this fixes function returning vectors.
llvm-svn: 47809
2008-03-02 03:39:43 +00:00
Chris Lattner
112819e1e6 vector types are simple types. This fixes div/rem of vectors.
llvm-svn: 47807
2008-03-02 03:33:31 +00:00
Chris Lattner
8eddd5055d Print vector types appropriately. This gets basic vector code working
(PR1126)

llvm-svn: 47806
2008-03-02 03:29:50 +00:00
Chris Lattner
c5f37fc11d rename PT -> VT for VectorTypes.
llvm-svn: 47805
2008-03-02 03:18:46 +00:00
Chris Lattner
a70385185e Print i32/i64 integer constants as 1u instead of ((unsigned int)1).
Use dyn_cast better.

llvm-svn: 47804
2008-03-02 03:16:38 +00:00
Lauro Ramos Venancio
ea557cc68e Avoid collisions in value names.
llvm-svn: 47725
2008-02-28 20:26:04 +00:00
Dale Johannesen
ae08bdb4cf Split ParameterAttributes.h, putting the complicated
stuff into ParamAttrsList.h.  Per feedback from
ParamAttrs changes.

llvm-svn: 47504
2008-02-22 22:17:59 +00:00
Evan Cheng
51789192ce Temporarily backing out r47337. It breaks a number of CBE tests.
llvm-svn: 47385
2008-02-20 18:32:05 +00:00
Anton Korobeynikov
4f6e612973 Remove bunch of gcc 4.3-related warnings from Target
llvm-svn: 47369
2008-02-20 11:22:39 +00:00
Andrew Lenharth
8e5c7e0bd9 fix some byval problems in the cbe. Closes PR2065
llvm-svn: 47337
2008-02-19 19:47:54 +00:00
Andrew Lenharth
da54523742 I cannot find a libgcc function for this builtin. Therefor expanding it to a noop (which is how it use to be treated). If someone who knows the x86 backend better than me could tell me how to get a lock prefix on an instruction, that would be nice to complete x86 support.
llvm-svn: 47213
2008-02-16 14:46:26 +00:00
Lauro Ramos Venancio
563e0a3ea3 CBackend: Implement unaligned load/store.
llvm-svn: 46646
2008-02-01 21:25:59 +00:00
Evan Cheng
1e7cbf32c2 Indirect call with byval parameter requires a cast first.
llvm-svn: 45911
2008-01-12 18:53:07 +00:00
Chris Lattner
e1bd3e1e72 Add support for NetBSD, patch by Krister Walfridsson!
llvm-svn: 45902
2008-01-12 06:46:09 +00:00
Evan Cheng
438d36bf7d More cbe byval fixes.
llvm-svn: 45891
2008-01-11 23:10:11 +00:00
Evan Cheng
ae6d80dead Some C backend ByVal parameter attribute support. Not yet complete.
llvm-svn: 45864
2008-01-11 09:12:49 +00:00
Evan Cheng
18c4155e7d A couple of obvious off-by-one bugs.
llvm-svn: 45852
2008-01-11 03:07:46 +00:00
Gordon Henriksen
88a41c672b Enabling the target-independent garbage collection infrastructure by hooking it
up to the various compiler pipelines.

This doesn't actually add support for any GC algorithms, which means it 
temporarily breaks a few tests. To be fixed shortly.

llvm-svn: 45669
2008-01-07 01:30:38 +00:00
Chris Lattner
ad9a6ccb83 Remove attribution from file headers, per discussion on llvmdev.
llvm-svn: 45418
2007-12-29 20:36:04 +00:00
Chris Lattner
8193d4af33 remove attribution from lib Makefiles.
llvm-svn: 45415
2007-12-29 20:09:26 +00:00
Anton Korobeynikov
913c80d37f Fix silly typo in the FP CEP handling.
llvm-svn: 45300
2007-12-21 23:33:44 +00:00
Duncan Sands
1e2e4972ff Rather than having special rules like "intrinsics cannot
throw exceptions", just mark intrinsics with the nounwind
attribute.  Likewise, mark intrinsics as readnone/readonly
and get rid of special aliasing logic (which didn't use
anything more than this anyway).

llvm-svn: 44544
2007-12-03 20:06:50 +00:00
Chris Lattner
906683b821 Work around a GCC bug, producing this code:
unsigned char *llvm_cbe_X;
...
  llvm_cbe_X = 0; *((void**)&llvm_cbe_X) = __builtin_stack_save();

instead of:

  llvm_cbe_X = __builtin_stack_save();

See PR1809 for details.

llvm-svn: 44415
2007-11-28 21:26:17 +00:00
Duncan Sands
3602011bec Fix PR1146: parameter attributes are longer part of
the function type, instead they belong to functions
and function calls.  This is an updated and slightly
corrected version of Reid Spencer's original patch.
The only known problem is that auto-upgrading of
bitcode files doesn't seem to work properly (see
test/Bitcode/AutoUpgradeIntrinsics.ll).  Hopefully
a bitcode guru (who might that be? :) ) will fix it.

llvm-svn: 44359
2007-11-27 13:23:08 +00:00
Gordon Henriksen
a6050b38d2 Switching TargetMachineRegistry to use the new generic Registry.
llvm-svn: 43094
2007-10-17 21:28:48 +00:00
Dale Johannesen
28beae4a4f Handle PPC long double in CBackend.
llvm-svn: 42972
2007-10-15 01:05:37 +00:00
Dale Johannesen
a4e3643cb3 Rewrite sqrt and powi to use anyfloat. By popular demand.
llvm-svn: 42537
2007-10-02 17:43:59 +00:00
Dale Johannesen
089d2e760f Make temporaries explicit to avoid premature
destruction of compiler-created ones.

llvm-svn: 42383
2007-09-26 23:20:33 +00:00
Chris Lattner
03d0e8d0ff Fix PR1679, by printing GEP indices as signed values instead of unsigned.
llvm-svn: 42239
2007-09-22 20:16:48 +00:00
Dale Johannesen
0ea2cc2e51 Implement x86 long double (uses host long double,
so only works on x86 target).

llvm-svn: 42019
2007-09-17 00:38:27 +00:00
Chris Lattner
1b622ad721 Fix PR1666, SPASS with the CBE and 254.gap with the CBE.
GCC optimizes away things like ptr < NULL  to false.  To "fix" this,
have the CBE emit casts of pointers to intptr_t when doing relational
pointer comparisons.

llvm-svn: 41983
2007-09-15 06:51:03 +00:00
Dale Johannesen
575bd6070a Remove the assumption that FP's are either float or
double from some of the many places in the optimizers
it appears, and do something reasonable with x86
long double.
Make APInt::dump() public, remove newline, use it to
dump ConstantSDNode's.
Allow APFloats in FoldingSet.
Expand X86 backend handling of long doubles (conversions
to/from int, mostly).

llvm-svn: 41967
2007-09-14 22:26:36 +00:00
Dale Johannesen
4784ee3431 Revise previous patch per review comments.
Next round of x87 long double stuff.
Getting close now, basically works.

llvm-svn: 41875
2007-09-12 03:30:33 +00:00
Dale Johannesen
7bc3969cea Add APInt interfaces to APFloat (allows directly
access to bits).  Use them in place of float and
double interfaces where appropriate.
First bits of x86 long double constants handling 
(untested, probably does not work).

llvm-svn: 41858
2007-09-11 18:32:33 +00:00
Dale Johannesen
783215c630 Apply feedback from previous patch.
llvm-svn: 41774
2007-09-07 21:07:57 +00:00
Dale Johannesen
86f367a6b7 Next round of APFloat changes.
Use APFloat in UpgradeParser and AsmParser.
Change all references to ConstantFP to use the
APFloat interface rather than double.  Remove
the ConstantFP double interfaces.
Use APFloat functions for constant folding arithmetic
and comparisons.
(There are still way too many places APFloat is
just a wrapper around host float/double, but we're
getting there.)

llvm-svn: 41747
2007-09-06 18:13:44 +00:00
Lauro Ramos Venancio
0ad4cde600 Handle packed structs in the CBackend.
llvm-svn: 39752
2007-07-11 19:56:53 +00:00
Chris Lattner
ecc23415ad Fix PR1413
llvm-svn: 37023
2007-05-13 22:19:27 +00:00
Chris Lattner
ee99a109d7 revert reid's patch to fix these failures:
test/CodeGen/CBackend/2007-01-08-ParamAttr-ICmp.ll for PR1099 [DEJAGNU]
Applications/SPASS/SPASS [CBE]
Regression/C/2004-03-15-IndirectGoto [CBE]

llvm-svn: 36664
2007-05-03 02:57:13 +00:00
Devang Patel
cd45427a87 Drop 'const'
llvm-svn: 36662
2007-05-03 01:11:54 +00:00
Devang Patel
8ee9065162 Use 'static const char' instead of 'static const int'.
Due to darwin gcc bug, one version of darwin linker coalesces
static const int, which defauts PassID based pass identification.

llvm-svn: 36652
2007-05-02 21:39:20 +00:00
Reid Spencer
10804f3fcb Make sign extension work correctly for unusual bit widths.
llvm-svn: 36635
2007-05-02 02:17:41 +00:00
Devang Patel
38a66bc82e Do not use typeinfo to identify pass in pass manager.
llvm-svn: 36632
2007-05-01 21:15:47 +00:00
Anton Korobeynikov
9bc4b792bf Implemented correct stack probing on mingw/cygwin for dynamic alloca's.
Also, fixed static case in presence of eax livin. This fixes PR331

PS: Why don't we still have push/pop instructions? :)
llvm-svn: 36195
2007-04-17 09:20:00 +00:00
Jeff Cohen
3ffd34cac6 Silence VC++ warning.
llvm-svn: 35975
2007-04-13 22:52:03 +00:00
Reid Spencer
d31093d340 Implement review feedback .. don't double search a set.
llvm-svn: 35957
2007-04-12 21:57:15 +00:00
Reid Spencer
0325471d3c Provide support for intrinsics that lower themselves to a function body.
This can happen for intrinsics that are overloaded.  In such cases it is
necessary to emit a function prototype before the body of the function
that calls the intrinsic and to ensure we don't emit it multiple times.

llvm-svn: 35954
2007-04-12 21:00:45 +00:00
Lauro Ramos Venancio
6c5f53f6ac Implement Thread Local Storage (TLS) in CBackend.
llvm-svn: 35951
2007-04-12 18:42:08 +00:00
Reid Spencer
2792e203c5 For PR1146:
Put the parameter attributes in their own ParamAttr name space. Adjust the
rest of llvm as a result.

llvm-svn: 35877
2007-04-11 02:44:20 +00:00
Reid Spencer
2660b8dccb For PR1146:
Adapt handling of parameter attributes to use the new ParamAttrsList class.

llvm-svn: 35814
2007-04-09 06:17:21 +00:00
Jeff Cohen
67dbe2064f MS C does have inlining after all, just uses _inline instead of inline.
llvm-svn: 35467
2007-03-29 17:42:21 +00:00
Jeff Cohen
9193778f39 Fix C Backend to generate code that works with Microsoft C for the benefit of
front ends that do not depend on the GCC runtime (someday...).

llvm-svn: 35441
2007-03-28 23:08:37 +00:00
Reid Spencer
e0d00951c2 Make sure that when we store a value it is masked to its correct bit
width. This helps CBE work with non-standard integer bit widths.

llvm-svn: 34885
2007-03-03 16:33:33 +00:00
Bill Wendling
2c5f64532b PR1164:
Generate local names with a "llvm_cbe_" prefix using the actual name of the
variable instead of a temporary name.

llvm-svn: 34540
2007-02-23 22:45:08 +00:00
Reid Spencer
e7ff3305d6 For PR1195:
Change use of "packed" term to "vector" in comments, strings, variable
names, etc.

llvm-svn: 34300
2007-02-15 03:39:18 +00:00
Reid Spencer
55e4e98a2a For PR1195:
Rename PackedType -> VectorType, ConstantPacked -> ConstantVector, and
PackedTyID -> VectorTyID. No functional changes.

llvm-svn: 34293
2007-02-15 02:26:10 +00:00
Reid Spencer
6af21b3029 For PR411:
This patch replaces the SymbolTable class with ValueSymbolTable which does
not support types planes. This means that all symbol names in LLVM must now
be unique. The patch addresses the necessary changes to deal with this and
removes code no longer needed as a result. This completes the bulk of the
changes for this PR. Some cleanup patches will follow.

llvm-svn: 33918
2007-02-05 20:47:22 +00:00
Reid Spencer
591bfa1e0b Changes to support making the shift instructions be true BinaryOperators.
This feature is needed in order to support shifts of more than 255 bits
on large integer types.  This changes the syntax for llvm assembly to
make shl, ashr and lshr instructions look like a binary operator:
   shl i32 %X, 1
instead of
   shl i32 %X, i8 1
Additionally, this should help a few passes perform additional optimizations.

llvm-svn: 33776
2007-02-02 02:16:23 +00:00
Reid Spencer
19af04a142 For PR1136: Rename GlobalVariable::isExternal as isDeclaration to avoid
confusion with external linkage types.

llvm-svn: 33663
2007-01-30 20:08:39 +00:00
Reid Spencer
c0ebe17b6a Implement use of new IntrinsicLowering interface.
llvm-svn: 33619
2007-01-29 17:51:02 +00:00
Anton Korobeynikov
611d5e2eda Propagate changes from my local tree. This patch includes:
1. New parameter attribute called 'inreg'. It has meaning "place this
parameter in registers, if possible". This is some generalization of
gcc's regparm(n) attribute. It's currently used only in X86-32 backend.
2. Completely rewritten CC handling/lowering code inside X86 backend.
Merged stdcall + c CCs and fastcall + fast CC.
3. Dropped CSRET CC. We cannot add struct return variant for each
target-specific CC (e.g. stdcall + csretcc and so on).
4. Instead of CSRET CC introduced 'sret' parameter attribute. Setting in
on first attribute has meaning 'This is hidden pointer to structure
return. Handle it gently'.
5. Fixed small bug in llvm-extract + add new feature to
FunctionExtraction pass, which relinks all internal-linkaged callees
from deleted function to external linkage. This will allow further
linking everything together.

NOTEs: 1. Documentation will be updated soon.
       2. llvm-upgrade should be improved to translate csret => sret.
          Before this, there will be some unexpected test fails.
llvm-svn: 33597
2007-01-28 13:31:35 +00:00
Reid Spencer
cca21cf060 For PR645:
Remove the Function::renameLocalSymbols function as it is no longer
needed.

llvm-svn: 33522
2007-01-26 08:01:30 +00:00
Chris Lattner
c102e8919b Fix SMG2000 with the CBE: opaque types need names too.
llvm-svn: 33258
2007-01-16 18:02:45 +00:00
Chris Lattner
de9ba0fdb4 Fix PR918 by only using typedefs to name struct types. This makes the later
type ordering stuff work better.  This fixes PR918 and
CodeGen/CBackend/2007-01-15-NamedArrayType.ll

Patch by Gordon Henriksen.

llvm-svn: 33254
2007-01-16 07:22:23 +00:00
Chris Lattner
c5e1611848 rename Type::isIntegral to Type::isInteger, eliminating the old Type::isInteger.
rename Type::getIntegralTypeMask to Type::getIntegerTypeMask.

This makes naming much more consistent.  For example, there are now no longer any
instances of IntegerType that are not considered isInteger! :)

llvm-svn: 33225
2007-01-15 02:27:26 +00:00
Chris Lattner
bf132d8342 Make use of isInteger vs isIntegral more explicit
llvm-svn: 33216
2007-01-15 01:48:11 +00:00
Chris Lattner
bc884d406d remove obsolete fixme
llvm-svn: 33151
2007-01-12 22:52:50 +00:00
Anton Korobeynikov
548b9af9c2 * PIC codegen for X86/Linux has been implemented
* PIC-aware internal structures in X86 Codegen have been refactored
* Visibility (default/weak) has been added
* Docs fixes (external weak linkage, visibility, formatting)

llvm-svn: 33136
2007-01-12 19:20:47 +00:00
Reid Spencer
373d2bccea For PR1064:
Implement the arbitrary bit-width integer feature. The feature allows
integers of any bitwidth (up to 64) to be defined instead of just 1, 8,
16, 32, and 64 bit integers.

This change does several things:
1. Introduces a new Derived Type, IntegerType, to represent the number of
   bits in an integer. The Type classes SubclassData field is used to
   store the number of bits. This allows 2^23 bits in an integer type.
2. Removes the five integer Type::TypeID values for the 1, 8, 16, 32 and
   64-bit integers. These are replaced with just IntegerType which is not
   a primitive any more.
3. Adjust the rest of LLVM to account for this change.

Note that while this incremental change lays the foundation for arbitrary
bit-width integers, LLVM has not yet been converted to actually deal with
them in any significant way. Most optimization passes, for example, will
still only deal with the byte-width integer types.  Future increments
will rectify this situation.

llvm-svn: 33113
2007-01-12 07:05:14 +00:00
Reid Spencer
3d986f6487 Implement review feedback for the ConstantBool->ConstantInt merge. Chris
recommended that getBoolValue be replaced with getZExtValue and that
get(bool) be replaced by get(const Type*, uint64_t). This implements
those changes.

llvm-svn: 33110
2007-01-12 04:24:46 +00:00
Reid Spencer
f3265181e2 Rename BoolTy as Int1Ty. Patch by Sheng Zhou.
llvm-svn: 33076
2007-01-11 18:21:29 +00:00
Zhou Sheng
23d24526b2 For PR1043:
Merge ConstantIntegral and ConstantBool into ConstantInt.
Remove ConstantIntegral and ConstantBool from LLVM.

llvm-svn: 33073
2007-01-11 12:24:14 +00:00
Reid Spencer
e6d962e729 Change the file header name as this file was renamed.
llvm-svn: 33051
2007-01-10 04:17:32 +00:00
Reid Spencer
b808cbe40b Rename Writer.cpp as CBackend.cpp so it doesn't conflict with Writer.cpp
in the bytecode writer library. This helps with debugging.

llvm-svn: 33050
2007-01-10 04:16:17 +00:00
Reid Spencer
b4f3c47095 For PR1099:
Invert the "isSigned" logic in calls to printType and printPrimitiveType.
We want variables to be declared unsigned by default so that signless
operators like + and - perform the unsigned operation that LLVM expects
by default. Parameters with the sext attribute will be declared signed and
signed instructions will case operand values to signed regardless of the
type of the variable. This passes all tests and fixes PR1099.

llvm-svn: 33039
2007-01-09 17:09:09 +00:00
Reid Spencer
76d79c7040 For PR1099:
Partial fix for this PR. Default function parameters to signed integer, just
like everything else in CBE. The bug was caused by incorrectly introducing
parameter attributes feature by choosing "signed" parameter if the
SExtAttribute was specified. Howeer, if no attribute is specified, this
causes it to become unsigned which is incorrect. Reversing the logic so
that signedness is detected by "not ZExtAttribute" set fixes the issue.

This fixes 197.parser but there is more to do. Any comparison and possibly
other operators involving arguments may need to correctly cast the parameter
before its use, depending on the sign of the operator.

llvm-svn: 33034
2007-01-09 06:38:06 +00:00
Reid Spencer
1f80d735e2 For PR1090:
Clean up the definitions of the helper functions per Chris' review
suggestions so they are easier to read.

For PR1091:
Print minimum signed integer values as unsigned so that we get no warnings
from the C compiler about constant ranges and value comparisons.

llvm-svn: 33010
2007-01-08 08:00:00 +00:00
Reid Spencer
1a8a0762a5 Fix PR1090:
Implemented some llvm_fcmp_{pred} functions at the start of the function bodies
and use them for fcmp instructions and constant expressions. These help
implement the ordered and unordered comparisons necessary for correct exectuion
of these comparisons.

llvm-svn: 33007
2007-01-08 06:58:32 +00:00
Reid Spencer
9fae72ee14 For PR1086:
Parameter attributes do have to be specially handled in the CBE. Implement
their handling.

llvm-svn: 32976
2007-01-07 03:24:48 +00:00
Reid Spencer
cdaf88ff9d For PR411:
Take an incremental step towards type plane elimination. This change
separates types from values in the symbol tables by finally making use
of the TypeSymbolTable class. This yields more natural interfaces for
dealing with types and unclutters the SymbolTable class.

llvm-svn: 32956
2007-01-06 07:24:44 +00:00
Reid Spencer
dda168599d For PR950:
Three changes:
1. Convert signed integer types to signless versions.
2. Implement the @sext and @zext parameter attributes. Previously the
   type of an function parameter was used to determine whether it should
   be sign extended or zero extended before the call. This information is
   now communicated via the function type's parameter attributes.
3. The interface to LowerCallTo had to be changed in order to accommodate
   the parameter attribute information. Although it would have been
   convenient to pass in the FunctionType itself, there isn't always one
   present in the caller. Consequently, a signedness indication for the
   result type and for each parameter was provided for in the interface
   to this method. All implementations were changed to make the adjustment
   necessary.

llvm-svn: 32788
2006-12-31 05:55:36 +00:00
Reid Spencer
4428c3483b For PR950:
This patch removes the SetCC instructions and replaces them with the ICmp
and FCmp instructions. The SetCondInst instruction has been removed and
been replaced with ICmpInst and FCmpInst.

llvm-svn: 32751
2006-12-23 06:05:41 +00:00
Reid Spencer
0cb59889d2 Use a predicate function to identify bitcast of fp and integer instead of
repeating the logic in two different parts of the code.

llvm-svn: 32643
2006-12-17 20:24:50 +00:00
Reid Spencer
85f67cbc7a Fix PR1058:
Generate the BITCAST_TEMPORARY regardless of the uses or inlinability of
the instruction. This temporary is needed to perform the instruction, not
provide storage for its results.

llvm-svn: 32642
2006-12-17 18:50:51 +00:00
Reid Spencer
562b83c7df Change inferred getCast into specific getCast. Passes all tests.
llvm-svn: 32469
2006-12-12 05:05:00 +00:00
Reid Spencer
d2390e3b0a Fix the BitCastUnion type for 32-bit targets.
llvm-svn: 32453
2006-12-12 00:11:08 +00:00
Reid Spencer
0549f720b2 Implement correct bitcast of int<->float and long<->double by using a
union to perform the bitcast.

llvm-svn: 32444
2006-12-11 20:39:15 +00:00
Anton Korobeynikov
e76b69846d Cleaned setjmp/longjmp lowering interfaces. Now we're producing right
code (both asm & cbe) for Mingw32 target.
Removed autoconf checks for underscored versions of setjmp/longjmp.

llvm-svn: 32415
2006-12-10 23:12:42 +00:00
Bill Wendling
fe0af72bc4 Don't use <sstream> in Streams.h but <iosfwd> instead.
llvm-svn: 32340
2006-12-07 23:41:45 +00:00
Bill Wendling
f13d78d3b8 What should be the last unnecessary <iostream>s in the library.
llvm-svn: 32333
2006-12-07 22:21:48 +00:00
Reid Spencer
bb6793b8b5 Always pass "true" to isMaxValue(bool) because we know the type is LongTy.
llvm-svn: 32290
2006-12-06 21:27:07 +00:00
Reid Spencer
166f4dd036 Adjust to new ConstantIntegral interface for Max/Min tests.
llvm-svn: 32289
2006-12-06 20:45:15 +00:00
Anton Korobeynikov
f627d28d9c Introducing external weak linkage. Darwin codegen should be added later.
llvm-svn: 32052
2006-12-01 00:25:12 +00:00
Andrew Lenharth
e46a408fb9 gcc doesn't like an empty colbber list
llvm-svn: 31987
2006-11-28 23:07:32 +00:00
Andrew Lenharth
a32f3e30b3 Make identity default, and fix PR1020
llvm-svn: 31979
2006-11-28 22:25:32 +00:00
Andrew Lenharth
7669b3acc5 update comments
llvm-svn: 31975
2006-11-28 19:56:02 +00:00
Andrew Lenharth
d93af28924 Get the asminfo for the target most closely matching the module and use that for inline asm
llvm-svn: 31974
2006-11-28 19:53:36 +00:00
Andrew Lenharth
f284b201e7 Preliminary support for inline asm in the cbe. The target specific ugliness
is still in Writer, but issolated to a single function. This might be split
into something in each target directory.  This is sufficient to get through
archie and an strcpy impl on linux-x86.

Module level asm is not handled.

llvm-svn: 31948
2006-11-27 23:50:49 +00:00
Reid Spencer
6010c0ef4a When truncating to bool, it is necessary to & with 1 for all casts that
can result in a bool. Previously PtrToInt, FPToUI and FPToSI were missing
this operation.

llvm-svn: 31938
2006-11-27 18:51:06 +00:00
Reid Spencer
992d9788b3 For PR950:
The long awaited CAST patch. This introduces 12 new instructions into LLVM
to replace the cast instruction. Corresponding changes throughout LLVM are
provided. This passes llvm-test, llvm/test, and SPEC CPUINT2000 with the
exception of 175.vpr which fails only on a slight floating point output
difference.

llvm-svn: 31931
2006-11-27 01:05:10 +00:00
Chris Lattner
ccbbe940eb Simplify IntrinsicLowering and clarify that it is only for use by the
CBE and interpreter.

llvm-svn: 31755
2006-11-15 18:00:10 +00:00
Reid Spencer
da1f5b882a For PR950:
This patch converts the old SHR instruction into two instructions,
AShr (Arithmetic) and LShr (Logical). The Shr instructions now are not
dependent on the sign of their operands.

llvm-svn: 31542
2006-11-08 06:47:33 +00:00
Reid Spencer
be216ad603 Fix a bug in the last patch and convert to && instead of & for logical expr.
llvm-svn: 31463
2006-11-05 19:26:37 +00:00
Reid Spencer
f88c9b1dfc Implement the -enabled-cbe-printf-a feature.
llvm-svn: 31462
2006-11-05 17:09:41 +00:00
Reid Spencer
524974949d Make CBackend -pedantic clean.
llvm-svn: 31388
2006-11-03 00:00:57 +00:00
Reid Spencer
4bafa71dc1 For PR786:
Turn on -Wunused and -Wno-unused-parameter. Clean up most of the resulting
fall out by removing unused variables. Remaining warnings have to do with
unused functions (I didn't want to delete code without review) and unused
variables in generated code. Maintainers should clean up the remaining
issues when they see them. All changes pass DejaGnu tests and Olden.

llvm-svn: 31380
2006-11-02 20:25:50 +00:00
Reid Spencer
1abf69e923 For PR950:
Replace the REM instruction with UREM, SREM and FREM.

llvm-svn: 31369
2006-11-02 01:53:59 +00:00
Reid Spencer
b3409f52ef Enclose a case in { and } so that the pickier compilers don't complain.
llvm-svn: 31196
2006-10-26 06:17:40 +00:00
Reid Spencer
6833ffe8b8 For PR950:
Make necessary changes to support DIV -> [SUF]Div. This changes llvm to
have three division instructions: signed, unsigned, floating point. The
bytecode and assembler are bacwards compatible, however.

llvm-svn: 31195
2006-10-26 06:15:43 +00:00
Reid Spencer
65b4f5b2dd Don't generate a prototype for _setjmp. At least on Linux, this function
has a different prototype than the one #included from <setjmp.h>. This
patch fixes siod and a number of other test cases on Linux that were
failing the CBE because of this _setjmp issue.

llvm-svn: 31112
2006-10-22 09:58:21 +00:00
Reid Spencer
d414793dbc For PR950:
This patch implements the first increment for the Signless Types feature.
All changes pertain to removing the ConstantSInt and ConstantUInt classes
in favor of just using ConstantInt.

llvm-svn: 31063
2006-10-20 07:07:24 +00:00
Chris Lattner
8a986f39c2 Simplify some code, reformat break's
llvm-svn: 30660
2006-09-28 23:19:29 +00:00
Anton Korobeynikov
7c2118575c Added some eye-candy for Subtarget type checking
Added X86 StdCall & FastCall calling conventions. Codegen will follow.

llvm-svn: 30446
2006-09-17 20:25:45 +00:00
Anton Korobeynikov
6e19f80688 Adding dllimport, dllexport and external weak linkage types.
DLL* linkages got full (I hope) codegeneration support in C & both x86
assembler backends.
External weak linkage added for future use, we don't provide any
codegeneration, etc. support for it.

llvm-svn: 30374
2006-09-14 18:23:27 +00:00
Chris Lattner
e4ef84f421 Add cbe support for powi
llvm-svn: 30226
2006-09-09 06:17:12 +00:00
Chris Lattner
33c9ddc91d Completely rearchitect the interface between targets and the pass manager.
This pass:

1. Splits TargetMachine into TargetMachine (generic targets, can be implemented
any way, like the CBE) and LLVMTargetMachine (subclass of TM that is used by
things using libcodegen and other support).
2. Instead of having each target fully populate the passmgr for file or JIT
   output, move all this to common code, and give targets hooks they can
   implement.
3. Commonalize the target population stuff between file emission and JIT
   emission.
4. All (native code) codegen stuff now happens in a FunctionPassManager, which
   paves the way for "fast -O0" stuff in the CFE later, and now LLC could
   lazily stream .bc files from disk to use less memory.
5. There are now many fewer #includes and the targets don't depend on the
   scalar xforms or libanalysis anymore (but codegen does).
6. Changing common code generator pass ordering stuff no longer requires
   touching all targets.
7. The JIT now has the option of "-fast" codegen or normal optimized codegen,
   which is now orthogonal to the fact that JIT'ing is being done.

llvm-svn: 30081
2006-09-04 04:14:57 +00:00
Chris Lattner
fb12884be6 Simplify target construction.
llvm-svn: 30070
2006-09-03 18:44:02 +00:00
Chris Lattner
8cb78a0d45 Make functions with an "asm" name propagate that asm name into the cbe.c file.
This fixes link errors on programs with these on targets with prefixes.

llvm-svn: 29390
2006-07-28 20:58:47 +00:00
Evan Cheng
b0bb6dd981 __i386__, __i386, etc. are not defined for x86-64. Use __x86_64__.
llvm-svn: 28881
2006-06-20 22:11:12 +00:00
Chris Lattner
6a9ec7e80e Don't pass target name into TargetData anymore, it is never used or needed.
Remove explicit casts to std::string now that there is no overload resolution
issues in the TargetData ctors.

llvm-svn: 28830
2006-06-16 18:22:52 +00:00
Chris Lattner
3dbb345389 Now that PR633 is implemented, the CBE can know to emit _setjmp/_longjmp
when available.  This speeds up hexxagon from 18.61s to 16.61s with the CBE on
PPC Mac OS (for reference, LLC is 15.48s and GCC is 23.35s).

llvm-svn: 28697
2006-06-06 21:45:47 +00:00
Chris Lattner
d14d882c4a Add mingw support, patch contributed by Anton
llvm-svn: 28661
2006-06-02 18:54:01 +00:00