1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 12:12:47 +01:00
Commit Graph

10370 Commits

Author SHA1 Message Date
Chris Lattner
faa90d30f5 Do not let MaskedValueIsZero consider undef to be zero, for reasons
explained in the comment.

This fixes UnitTests/2003-09-18-BitFieldTest on darwin

llvm-svn: 22483
2005-07-20 18:49:28 +00:00
Chris Lattner
648d6f150e count the number of relocations performed.
llvm-svn: 22480
2005-07-20 16:29:20 +00:00
Nate Begeman
b83789d611 Integrate SelectFPExpr into SelectExpr. This gets PPC32 closer to being
automatically generated from a target description.

llvm-svn: 22470
2005-07-19 16:51:05 +00:00
Nate Begeman
a25a2010e3 Remove unnecessary FP_EXTEND. This causes worse codegen for SSE.
llvm-svn: 22469
2005-07-19 16:50:03 +00:00
Reid Spencer
40c5ebe4eb For: memory operations -> stores
This is the first incremental patch to implement this feature. It adds no
functionality to LLVM but setup up the information needed from targets in
order to implement the optimization correctly. Each target needs to specify
the maximum number of store operations for conversion of the llvm.memset,
llvm.memcpy, and llvm.memmove intrinsics into a sequence of store operations.
The limit needs to be chosen at the threshold of performance for such an
optimization (generally smallish). The target also needs to specify whether
the target can support unaligned stores for multi-byte store operations.
This helps ensure the optimization doesn't generate code that will trap on
an alignment errors.
More patches to follow.

llvm-svn: 22468
2005-07-19 04:52:44 +00:00
Chris Lattner
4c9139447d When transforming &A[i] < &A[j] -> i < j, make sure to perform the comparison
as a signed compare.  This patch may fix PR597, but is correct in any case.

llvm-svn: 22465
2005-07-18 23:07:33 +00:00
Chris Lattner
d4f9ab3809 The assertion was wrong: the code only worked for i64. While we're at it,
expand the code to work for all integer datatypes.  This should unbreak
alpha.

llvm-svn: 22464
2005-07-18 04:31:14 +00:00
Chris Lattner
07d79f8aa7 Only get the .bss and .data sections when needed instead of unconditionally.
This allows is to not emit empty sections when .data or .bss is not used.

llvm-svn: 22457
2005-07-16 17:41:06 +00:00
Chris Lattner
60bcec0238 Refactor getSection() method to make it easier to use.
llvm-svn: 22455
2005-07-16 17:36:04 +00:00
Chris Lattner
40fbf63df8 Major refactor of the ELFWriter code. Instead of building up one big
vector that represents the .o file at once, build up a vector for each
section of the .o file.  This is needed because the .o file writer needs
to be able to switch between sections as it emits them (e.g. switch
between the .text section and the .rel section when emitting code).

This patch has no functionality change.

llvm-svn: 22453
2005-07-16 08:01:13 +00:00
Nate Begeman
160c12d896 Teach the legalizer how to promote SINT_TO_FP to a wider SINT_TO_FP that
the target natively supports.  This eliminates some special-case code from
the x86 backend and generates better code as well.

For an i8 to f64 conversion, before & after:

_x87 before:
        subl $2, %esp
        movb 6(%esp), %al
        movsbw %al, %ax
        movw %ax, (%esp)
        filds (%esp)
        addl $2, %esp
        ret

_x87 after:
        subl $2, %esp
        movsbw 6(%esp), %ax
        movw %ax, (%esp)
        filds (%esp)
        addl $2, %esp
        ret

_sse before:
        subl $12, %esp
        movb 16(%esp), %al
        movsbl %al, %eax
        cvtsi2sd %eax, %xmm0
        addl $12, %esp
        ret

_sse after:
        subl $12, %esp
        movsbl 16(%esp), %eax
        cvtsi2sd %eax, %xmm0
        addl $12, %esp
        ret

llvm-svn: 22452
2005-07-16 02:02:34 +00:00
Nate Begeman
7a1bc7318d Teach the register allocator that movaps is also a move instruction
llvm-svn: 22451
2005-07-16 02:00:20 +00:00
Nate Begeman
c93c1c5148 A couple more darwinisms
llvm-svn: 22450
2005-07-16 01:59:47 +00:00
Chris Lattner
79573b1a93 Remove all knowledge of UINT_TO_FP from the X86 backend, relying on the
legalizer to eliminate them.  With this comes the expected code quality
improvements, such as, for this:

double foo(unsigned short X) { return X; }

we now generate this:

_foo:
        subl $4, %esp
        movzwl 8(%esp), %eax
        movl %eax, (%esp)
        fildl (%esp)
        addl $4, %esp
        ret

instead of this:

_foo:
        subl $4, %esp
        movw 8(%esp), %ax
        movzwl %ax, %eax   ;; Load not folded into this.
        movl %eax, (%esp)
        fildl (%esp)
        addl $4, %esp
        ret

-Chris

llvm-svn: 22449
2005-07-16 00:28:20 +00:00
Chris Lattner
10da57bfed Break the code for expanding UINT_TO_FP operations out into its own
SelectionDAGLegalize::ExpandLegalUINT_TO_FP method.

Add a new method, PromoteLegalUINT_TO_FP, which allows targets to request
that UINT_TO_FP operations be promoted to a larger input type.  This is
useful for targets that have some UINT_TO_FP or SINT_TO_FP operations but
not all of them (like X86).

The same should be done with SINT_TO_FP, but this patch does not do that
yet.

llvm-svn: 22447
2005-07-16 00:19:57 +00:00
Chris Lattner
94e486c56e You can't use config options without config.h
llvm-svn: 22446
2005-07-15 22:48:31 +00:00
Nate Begeman
957e0e7c9e Get closer to fully working scalar FP in SSE regs. This gets singlesource
working, and Olden/power.

llvm-svn: 22441
2005-07-15 00:38:55 +00:00
Nate Begeman
8c2dadc92e Add support for printing the sse scalar comparison instruction mnemonics.
llvm-svn: 22440
2005-07-14 22:52:25 +00:00
John Criswell
64f658a2f7 Fixed PR#596:
Add parenthesis around the value being negated; that way, if the value
begins with a minus sign (e.g. negative integer), we won't generate a
C predecrement operator by mistake.

llvm-svn: 22437
2005-07-14 19:41:16 +00:00
Chris Lattner
d8eb6ea6da Make this use the new autoconf support for finding the executables for
gv and Graphviz.

llvm-svn: 22434
2005-07-14 05:33:13 +00:00
Chris Lattner
d9f1a60c61 As discussed on IRC, this stuff is just for debugging.
llvm-svn: 22432
2005-07-14 05:17:43 +00:00
Chris Lattner
61b33e0bc4 If the Graphviz program is available, use it to visualize dot graphs.
llvm-svn: 22429
2005-07-14 01:10:55 +00:00
Reid Spencer
ed5ee0f4e8 Don't call pthread_mutexattr_setpshared on FreeBSD because its implementation
of pthreads is missing that call (despite it violating the spec).

llvm-svn: 22423
2005-07-13 03:02:06 +00:00
Jeff Cohen
f008a9d1a7 Note to self: don't introduce memory leaks.
llvm-svn: 22422
2005-07-13 02:58:04 +00:00
Jeff Cohen
0882aa2a75 Win32 support for Mutex class.
llvm-svn: 22420
2005-07-13 02:15:18 +00:00
Chris Lattner
aeae45b371 Fix Alpha/2005-07-12-TwoMallocCalls.ll and PR593.
It is not safe to call LegalizeOp on something that has already been legalized.
Instead, just force another iteration of legalization.

This could affect all platforms but X86, as this codepath is dynamically
dead on X86 (ISD::MEMSET and friends are legal).

llvm-svn: 22419
2005-07-13 02:00:04 +00:00
Chris Lattner
628a248ff9 Fix test/Regression/CodeGen/Generic/2005-07-12-memcpy-i64-length.ll
llvm-svn: 22417
2005-07-13 01:42:45 +00:00
Nate Begeman
7330d9cd80 Check in the last of the darwin-specific code necessary to get shootout
working before modifying the asm printer to use the subtarget info.

llvm-svn: 22408
2005-07-12 18:34:58 +00:00
Nate Begeman
be4b78ff53 Remove some code that moved to the generic asm printer a long time ago.
llvm-svn: 22407
2005-07-12 18:34:15 +00:00
Reid Spencer
78910545f0 For PR540:
This patch completes the changes for making lli thread-safe. Here's the list
of changes:
* The Support/ThreadSupport* files were removed and replaced with the
  MutexGuard.h file since all ThreadSupport* declared was a Mutex Guard.
  The implementation of MutexGuard.h is now based on sys::Mutex which hides
  its implementation and makes it unnecessary to have the -NoSupport.h and
  -PThreads.h versions of ThreadSupport.

* All places in ExecutionEngine that previously referred to "Mutex" now
  refer to sys::Mutex

* All places in ExecutionEngine that previously referred to "MutexLocker"
  now refer to MutexGuard (this is frivolous but I believe the technically
  correct name for such a class is "Guard" not a "Locker").

These changes passed all of llvm-test. All we need now are some test cases
that actually use multiple threads.

llvm-svn: 22404
2005-07-12 15:51:55 +00:00
Reid Spencer
5f037ea395 For PR540:
Add a Mutex class for thread synchronization in a platform-independent way.
The current implementation only supports pthreads. Win32 use of Critical
Sections will be added later. The design permits other threading models to
be used if (and only if) pthreads is not available.

llvm-svn: 22403
2005-07-12 15:37:43 +00:00
Chris Lattner
bec12eb953 Add support for 64-bit elf files
llvm-svn: 22400
2005-07-12 06:57:52 +00:00
Andrew Lenharth
062b70fd54 Fix povray and minor cleanups
llvm-svn: 22397
2005-07-12 04:20:52 +00:00
Jeff Cohen
13c63ee283 I don't know how this ever compiled with gcc, but VC++ correctly rejects it.
llvm-svn: 22394
2005-07-12 02:59:38 +00:00
Jeff Cohen
7bc4266cf1 VC++ demands that the function returns a value
llvm-svn: 22393
2005-07-12 02:53:33 +00:00
Nate Begeman
4d96f2769c Clean up the TargetSubtarget class a bit, removing an unnecessary argument
to the constructor.

llvm-svn: 22392
2005-07-12 02:41:19 +00:00
Chris Lattner
b383dec36f Minor changes to improve comments and fix the build on _WIN32 systems.
llvm-svn: 22391
2005-07-12 02:36:10 +00:00
Chris Lattner
855fe2ea0c Add a note
llvm-svn: 22390
2005-07-12 02:35:36 +00:00
Nate Begeman
626fb671c8 Implement Subtarget support
Implement the X86 Subtarget.

This consolidates the checks for target triple, and setting options based
on target triple into one place.  This allows us to convert the asm printer
and isel over from being littered with "forDarwin", "forCygwin", etc. into
just having the appropriate flags for each subtarget feature controlling
the code for that feature.

This patch also implements indirect external and weak references in the
X86 pattern isel, for darwin.  Next up is to convert over the asm printers
to use this new interface.

llvm-svn: 22389
2005-07-12 01:41:54 +00:00
Nate Begeman
faf9b5b763 Commit some pending darwin changes before subtarget support.
llvm-svn: 22388
2005-07-12 01:37:28 +00:00
Chris Lattner
ac2bba6862 fix a warning
llvm-svn: 22385
2005-07-11 22:46:18 +00:00
Andrew Lenharth
10f725f64b Remove glibc specific functions, and mark a couple as C99
llvm-svn: 22384
2005-07-11 20:35:20 +00:00
Andrew Lenharth
8089fbc902 because on alpha:
#   define errno (*__errno_location ())

*shakes head

llvm-svn: 22383
2005-07-11 17:41:12 +00:00
Chris Lattner
8dd11b0f9c Clean up code, no functionality changes.
llvm-svn: 22382
2005-07-11 06:34:30 +00:00
Chris Lattner
cace336deb Output .size directives to tell the assembler the size of each function.
llvm-svn: 22381
2005-07-11 06:29:14 +00:00
Chris Lattner
af83621722 Fix crazy indentation
llvm-svn: 22380
2005-07-11 06:25:47 +00:00
Chris Lattner
d710b0a025 Emit a symbol table entry for each function we output to the ELF file. This
allows objdump to know which function we are emitting to:

00000000 <foo>:     <----
   0:   b8 01 00 00 00          mov    $0x1,%eax
   5:   03 44 24 04             add    0x4(%esp,1),%eax
   9:   c3                      ret

... and allows .o files to be useful for linking :)

llvm-svn: 22378
2005-07-11 06:17:35 +00:00
Chris Lattner
a556fc183f Refactor things a bit to allow the ELF code emitter to run the X86 machine code emitter
after itself.

llvm-svn: 22376
2005-07-11 05:17:48 +00:00
Chris Lattner
34d2a2ae23 add code to emit the .text section to the section header.
Add a *VERY INITIAL* machine code emitter class.  This is enough to take
this C function:
int foo(int X) { return X +1; }

and make objdump produce the following:

$ objdump -d t-llvm.o

t-llvm.o:     file format elf32-i386

Disassembly of section .text:

00000000 <.text>:
   0:   b8 01 00 00 00          mov    $0x1,%eax
   5:   03 44 24 04             add    0x4(%esp,1),%eax
   9:   c3                      ret


Anything using branches or refering to the constant pool or requiring
relocations will not work yet.

llvm-svn: 22375
2005-07-11 05:17:18 +00:00
Chris Lattner
41dbb3993d Remove prototype for non-existant function
llvm-svn: 22372
2005-07-11 04:20:55 +00:00