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

10389 Commits

Author SHA1 Message Date
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
Chris Lattner
8c10fbf3cc Use a name mangler object to uniquify names and remove nonstandard
characters from them.

llvm-svn: 22371
2005-07-11 03:11:47 +00:00
Chris Lattner
cd3e31ee5a fix long lines
llvm-svn: 22369
2005-07-11 02:49:16 +00:00
Chris Lattner
ffaf40a143 Change *EXTLOAD to use an VTSDNode operand instead of being an MVTSDNode.
This is the last MVTSDNode.

This allows us to eliminate a bunch of special case code for handling
MVTSDNodes.

Also, remove some uses of dyn_cast that should really be cast (which is
cheaper in a release build).

llvm-svn: 22368
2005-07-10 01:56:13 +00:00
Chris Lattner
6e49696ba6 Change *EXTLOAD to use an VTSDNode operand instead of being an MVTSDNode.
This is the last MVTSDNode.

This allows us to eliminate a bunch of special case code for handling
MVTSDNodes.

llvm-svn: 22367
2005-07-10 01:55:33 +00:00
Chris Lattner
273b81e0c0 Change TRUNCSTORE to use a VTSDNode operand instead of being an MVTSTDNode
llvm-svn: 22366
2005-07-10 00:29:18 +00:00
Chris Lattner
c355896290 Introduce a new VTSDNode class with the ultimate goal of eliminating the
MVTSDNode class.  This class is used to provide an operand to operators
that require an extra type.  We start by converting FP_ROUND_INREG and
SIGN_EXTEND_INREG over to using it.

llvm-svn: 22364
2005-07-10 00:07:11 +00:00
Jeff Cohen
d1901833d9 Fix bugs also fixed in Unix version, plus other general cleanup.
llvm-svn: 22363
2005-07-09 18:42:49 +00:00
Jeff Cohen
32d77a9154 1. Fix bug in getBaseName where it mishandles suffixes
2. Fix bug in eraseSuffix where it allows /path/.suffix to become /path/

llvm-svn: 22362
2005-07-09 18:42:02 +00:00
Reid Spencer
0db6c1f252 Ensure that functions like isDirectory don't fail if the file doesn't
exist but just return false instead.

llvm-svn: 22361
2005-07-08 17:46:10 +00:00
Reid Spencer
6bed5ca433 Two changes:
1. Use isValid() to check validity of the resulting path name in the
   eraseSuffix even though we can't think of a case where eraseSuffix could
   possibly cause an invalid path name.
2. Rewrite isValid() to not use the deprecated realpath function any more.
   It now just uses isascii to make sure all the characters are legit.

llvm-svn: 22359
2005-07-08 06:53:26 +00:00
Chris Lattner
de44e16474 Add support for emitting a .data section and .bss section.
Add support for emitting external and .bss symbols.

llvm-svn: 22358
2005-07-08 05:47:00 +00:00
Jeff Cohen
00f7df2ba0 Stamp out tabs
llvm-svn: 22357
2005-07-08 05:02:13 +00:00
Jeff Cohen
2a6a854faf Make Win32 implementation conform to new paradigm
llvm-svn: 22356
2005-07-08 04:50:08 +00:00
Jeff Cohen
fff16d6986 Fix eraseSuffix()
llvm-svn: 22355
2005-07-08 04:49:16 +00:00
Reid Spencer
04d734c2f6 Final Changes For PR495:
This chagne just renames some sys::Path methods to ensure they are not
misused. The Path documentation now divides methods into two dimensions:
Path/Disk and accessor/mutator. Path accessors and mutators only operate
on the Path object itself without making any disk accesses. Disk accessors
and mutators will also access or modify the file system. Because of the
potentially destructive nature of disk mutators, it was decided that all
such methods should end in the work "Disk" to ensure the user recognizes
that the change will occur on the file system. This patch makes that
change. The method name changes are:

makeReadable        -> makeReadableOnDisk
makeWriteable       -> makeWriteableOnDisk
makeExecutable      -> makeExecutableOnDisk
setStatusInfo       -> setStatusInfoOnDisk
createDirectory     -> createDirectoryOnDisk
createFile          -> createFileOnDisk
createTemporaryFile -> createTemporaryFileOnDisk
destroy             -> eraseFromDisk
rename              -> renamePathOnDisk

These changes pass the Linux Deja Gnu tests.

llvm-svn: 22354
2005-07-08 03:08:58 +00:00
Jeff Cohen
abf7ec1fcc Fix VC++ breakage
llvm-svn: 22353
2005-07-08 02:48:42 +00:00
Nate Begeman
70532b9f00 Add support for assembling .s files on mac os x for intel
Add support for running bugpoint on mac os x for intel

llvm-svn: 22351
2005-07-08 00:23:26 +00:00
Reid Spencer
a23bbd3854 Changes to mimic those in Unix/Path.inc in support of PR495. This hasn't
been compiled or tested.

llvm-svn: 22350
2005-07-07 23:35:23 +00:00
Reid Spencer
5534b2d505 For PR495:
Get rid of the difference between file paths and directory paths. The Path
class now simply stores a path that can refer to either a file or a
directory. This required various changes in the implementation and interface
of the class with the corresponding impact to its users. Doxygen comments were
also updated to reflect these changes. Interface changes are:

appendDirectory -> appendComponent
appendFile -> appendComponent
elideDirectory -> eraseComponent
elideFile -> eraseComponent
elideSuffix -> eraseSuffix
renameFile -> rename
setDirectory -> set
setFile -> set

Changes pass Dejagnu and llvm-test/SingleSource tests.

llvm-svn: 22349
2005-07-07 23:21:43 +00:00
Chris Lattner
e102466ece Fix a problem that instcombine would hit when dealing with unreachable code.
Because the instcombine has to scan the entire function when it starts up
to begin with, we might as well do it in DFO so we can nuke unreachable code.

This fixes: Transforms/InstCombine/2005-07-07-DeadPHILoop.ll

llvm-svn: 22348
2005-07-07 20:40:38 +00:00
Andrew Lenharth
262477edde clean up prolouge and epilouge
llvm-svn: 22346
2005-07-07 19:52:58 +00:00
Reid Spencer
fb7bca6fa6 For PR495:
Change interface to Path class:
readable -> canRead
writable -> canWrite
executable -> canExecute

More (incremental) changes coming to close 495.

llvm-svn: 22345
2005-07-07 18:21:42 +00:00
Chris Lattner
e45dd7850d Restore some code that was accidentally removed by Nate's patch yesterday.
This fixes the regressions from last night.

llvm-svn: 22344
2005-07-07 17:12:53 +00:00
Chris Lattner
efccb190b5 Add support for emitting the symbol table (and its string table) of the
module to the ELF file.  Test it by adding support for emitting common
symbols.  This allows us to compile this:

%X = weak global int 0
%Y = weak global int 0
%Z = weak global int 0

to an elf file that 'readelf's this:

Symbol table '.symtab' contains 4 entries:
   Num:    Value  Size Type    Bind   Vis      Ndx Name
     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND
     1: 00000004     4 OBJECT  GLOBAL DEFAULT  COM X
     2: 00000004     4 OBJECT  GLOBAL DEFAULT  COM Y
     3: 00000004     4 OBJECT  GLOBAL DEFAULT  COM Z

llvm-svn: 22343
2005-07-07 07:02:20 +00:00
Nate Begeman
667588d524 Fix a typo in my checkin today that caused regressions. Oops!
llvm-svn: 22341
2005-07-07 06:32:01 +00:00
Nate Begeman
e5314eb2c2 First round of support for doing scalar FP using the SSE2 ISA extension and
XMM registers.  There are many known deficiencies and fixmes, which will be
addressed ASAP.  The major benefit of this work is that it will allow the
LLVM register allocator to allocate FP registers across basic blocks.

The x86 backend will still default to x87 style FP.  To enable this work,
you must pass -enable-sse-scalar-fp and either -sse2 or -sse3 to llc.

An example before and after would be for:
double foo(double *P) { double Sum = 0; int i; for (i = 0; i < 1000; ++i)
                        Sum += P[i]; return Sum; }

The inner loop looks like the following:
x87:
.LBB_foo_1:     # no_exit
        fldl (%esp)
        faddl (%eax,%ecx,8)
        fstpl (%esp)
        incl %ecx
        cmpl $1000, %ecx
        #FP_REG_KILL
        jne .LBB_foo_1  # no_exit

SSE2:
        addsd (%eax,%ecx,8), %xmm0
        incl %ecx
        cmpl $1000, %ecx
        #FP_REG_KILL
        jne .LBB_foo_1  # no_exit

llvm-svn: 22340
2005-07-06 18:59:04 +00:00
Chris Lattner
199560c668 Make several cleanups to Andrews varargs change:
1. Pass Value*'s into lowering methods so that the proper pointers can be
   added to load/stores from the valist
2. Intrinsics that return void should only return a token chain, not a token
   chain/retval pair.
3. Rename LowerVAArgNext -> LowerVAArg, because VANext is long gone.
4. Now that we have Value*'s available in the lowering methods, pass them
   into any load/stores from the valist that are emitted

llvm-svn: 22339
2005-07-05 19:58:54 +00:00
Chris Lattner
bf100c8bdb Make several cleanups to Andrews varargs change:
1. Pass Value*'s into lowering methods so that the proper pointers can be
   added to load/stores from the valist
2. Intrinsics that return void should only return a token chain, not a token
   chain/retval pair.
3. Rename LowerVAArgNext -> LowerVAArg, because VANext is long gone.

llvm-svn: 22338
2005-07-05 19:57:53 +00:00
Andrew Lenharth
3543e3b3a9 2 fixes:
1: Legalize operand in UINT_TO_FP expanision

2: SRA x, const i8 was not promoting the constant to shift amount type.
llvm-svn: 22337
2005-07-05 19:52:39 +00:00
Chris Lattner
f8faaa8a39 Fit to 80 columns
llvm-svn: 22336
2005-07-05 17:50:16 +00:00
Chris Lattner
23a1b681d0 Fix PowerPC varargs
llvm-svn: 22335
2005-07-05 17:48:31 +00:00
Andrew Lenharth
d2db55ec81 check the correct VT
llvm-svn: 22332
2005-07-04 20:07:21 +00:00
Andrew Lenharth
6a674b7805 fix loading address of fp symbols
llvm-svn: 22331
2005-07-03 20:06:13 +00:00
Chris Lattner
93a2576078 Percolate the call up to the right superclass
llvm-svn: 22330
2005-07-03 17:34:39 +00:00
Andrew Lenharth
c9903eb2cc I really didn't think this was necessary. But, Legalize wasn't running again
and legalizing the extload.  Strange.  Should fix most alpha regressions.

llvm-svn: 22329
2005-07-02 20:58:53 +00:00
Nate Begeman
12d2961fd2 The statistic needs to be in the correct namespace.
llvm-svn: 22327
2005-07-01 23:56:38 +00:00
Chris Lattner
6a865d5a22 Varargs is apparently currently broken on PPC. This hacks it so that it
is at least overloading the right virtual methods.  The implementations
are currently wrong though.  This fixes Ptrdist/bc, but not other programs
(e.g. siod).

llvm-svn: 22326
2005-07-01 23:11:56 +00:00
Chris Lattner
b299933fc7 Refactor X86AsmPrinter.cpp into multiple files. Patch contributed
by Aaron Gray, cleaned up by me.

llvm-svn: 22324
2005-07-01 22:44:09 +00:00
Andrew Lenharth
b1de98d654 simplify call code, remove pseudo ops for div and rem, track more loads and stores
llvm-svn: 22323
2005-07-01 19:14:02 +00:00
Andrew Lenharth
f2c8cd0c36 simplify call code, remove pseudo ops for div and rem, track more loads and stores
llvm-svn: 22322
2005-07-01 19:12:13 +00:00
Chris Lattner
c2438fe76f remove some debugging code
llvm-svn: 22321
2005-07-01 06:40:58 +00:00
Andrew Lenharth
b8c48ce74e oops
llvm-svn: 22320
2005-06-30 19:32:57 +00:00
Andrew Lenharth
04aa18bd2a FP EXTLOAD is not support on all archs, expand to LOAD and FP_EXTEND
llvm-svn: 22319
2005-06-30 19:22:37 +00:00
Chris Lattner
02fe175f3d Fix PR590 and Transforms/Mem2Reg/2005-06-30-ReadBeforeWrite.ll.
The optimization for locally used allocas was not safe for allocas that
were read before they were written.  This change disables that optimization
in that case.

llvm-svn: 22318
2005-06-30 07:29:44 +00:00
Nate Begeman
31e3028bac Make the x86 asm printer darwin-aware. This mostly entails doing the same
thing as cygwin most of the time, and printing our alignments in log2
rather than number of bytes.

llvm-svn: 22316
2005-06-30 00:53:20 +00:00
Andrew Lenharth
898efb338a restore old srcValueNode behavior and try to to work around it
llvm-svn: 22315
2005-06-29 18:54:02 +00:00
John Criswell
a6620d4a6e Doh! Forgot to LLVMify the style.
llvm-svn: 22312
2005-06-29 15:57:50 +00:00
Andrew Lenharth
edccb834bb tracking the instructions causing loads and stores provides more information than just the pointer being loaded or stored
llvm-svn: 22311
2005-06-29 15:57:19 +00:00
John Criswell
1bafe064da Basic fix for PR#591; don't convert an fprintf() to an fwrite() if there
is a mismatch in their character type pointers (i.e. fprintf() prints an
array of ubytes while fwrite() takes an array of sbytes).
We can probably do better than this (such as casting the ubyte to an
sbyte).

llvm-svn: 22310
2005-06-29 15:03:18 +00:00
Andrew Lenharth
781dd8e05f thinko
llvm-svn: 22309
2005-06-29 13:35:05 +00:00
Andrew Lenharth
6b4dbd7cd5 unify SelectExpr and SelectFP
llvm-svn: 22308
2005-06-29 12:49:51 +00:00
Andrew Lenharth
88491475e2 fix most regressions
llvm-svn: 22307
2005-06-29 12:23:34 +00:00
Andrew Lenharth
172871ba0f support more relocations for stores also
llvm-svn: 22306
2005-06-29 00:39:17 +00:00
Andrew Lenharth
41d08a0bbe Get rid of all symbolic loads. I now do gernate all relocations sequences
rather than relying on the assembler.  Only a few more pseudo instructions
left.  Also merge load code paths.

llvm-svn: 22305
2005-06-29 00:31:08 +00:00
Andrew Lenharth
d1dbc8ab27 some call work
llvm-svn: 22303
2005-06-27 23:59:51 +00:00
Andrew Lenharth
d534c5cb2a Adapt the code for handling uint -> fp conversion for the 32 bit case to
handling it in the 64 bit case.  The two code paths should probably be merged.

llvm-svn: 22302
2005-06-27 23:28:32 +00:00
Andrew Lenharth
cc12cd8c5a So, it turns out I forgot that one valid way of restoring GP after a call
is to use RA, which assumes the called function uses RA for the register
holding the return address when it issues a ret.

llvm-svn: 22301
2005-06-27 23:24:11 +00:00
Nate Begeman
032a94775d Initial set of .td file changes necessary to get scalar fp in xmm registers
working.  The instruction selector changes will hopefully be coming later
this week once they are debugged.  This is necessary to support the darwin
x86 FP model, and is recommended by intel as the replacement for x87.  As
a bonus, the register allocator knows how to deal with these registers
across basic blocks, unliky the FP stackifier.  This leads to significantly
better codegen in several cases.

llvm-svn: 22300
2005-06-27 21:20:31 +00:00
Andrew Lenharth
34630b5ab0 get rid of another pseudo op
llvm-svn: 22299
2005-06-27 21:11:40 +00:00
Andrew Lenharth
b80c19b01a generate address of constant pool entries
llvm-svn: 22298
2005-06-27 21:02:56 +00:00
Andrew Lenharth
6e30e970ed Misha happification patch
llvm-svn: 22297
2005-06-27 17:39:17 +00:00
Andrew Lenharth
a3f70592a7 Reduce use of pseudo ops
Namely, output the rellocation flags explicitly when loading constants.
Added benifit: save a load when loading from the constant pool.

llvm-svn: 22296
2005-06-27 17:15:36 +00:00
Andrew Lenharth
573514894c missed a load
llvm-svn: 22295
2005-06-27 16:40:26 +00:00
Andrew Lenharth
ac3ecf5338 make constant pool labels local
llvm-svn: 22294
2005-06-27 16:29:54 +00:00
Andrew Lenharth
f50cb3fad2 who said we had to use the return address in the return address register. Might save a move in many cases
llvm-svn: 22293
2005-06-27 15:36:48 +00:00
Chris Lattner
cd6b5c5011 Add support to the X86 backend for emitting ELF files. To use this, we
currently use: llc t.bc --filetype=obj

This will produce a t.o file which is dumpable with readelf.  Currently
the file produced is empty, but the scaffolding to do more is now in place.

llvm-svn: 22292
2005-06-27 06:30:12 +00:00
Chris Lattner
8be1980730 iniital checkin of ELFWriter implementation
For now, the elf writer is only capable of emitting an empty elf file, with
a section table and a section table string table.  This will be enhanced
in the future :)

llvm-svn: 22291
2005-06-27 06:29:00 +00:00
Andrew Lenharth
9dc5d846ee depend more on legalize putting constants on the RHS
llvm-svn: 22289
2005-06-26 23:01:11 +00:00
Andrew Lenharth
91bc570aac With setOperationAction(ISD::UINT_TO_FP, MVT::i64, Expand), Legalize
should be able to handle this case.  The code is there, so let's see
if it works.

llvm-svn: 22288
2005-06-26 22:23:06 +00:00
Chris Lattner
06282f51cf Refactor the addPassesToEmitAssembly interface into a addPassesToEmitFile
interface.

llvm-svn: 22282
2005-06-25 02:48:37 +00:00
Chris Lattner
6f3c7b46ee Fix grammar
llvm-svn: 22279
2005-06-24 18:00:40 +00:00
Chris Lattner
eb08628106 add a debug type
llvm-svn: 22277
2005-06-24 16:00:46 +00:00
Andrew Lenharth
17f46306d6 remove a pseudo instruction, make ret always right, and fix vararg chains
llvm-svn: 22276
2005-06-23 23:42:05 +00:00
Andrew Lenharth
51d9d1b763 finally, Working varargs
llvm-svn: 22275
2005-06-23 16:48:51 +00:00
Andrew Lenharth
eda77c60a0 more complete Lowering for vacopy and vaarg
llvm-svn: 22274
2005-06-22 23:04:28 +00:00
Andrew Lenharth
4fd2bde906 If we support structs as va_list, we must pass pointers to them to va_copy
See last commit for LangRef, this implements it on all targets.

llvm-svn: 22273
2005-06-22 21:04:42 +00:00
Andrew Lenharth
e54b651806 Make it easier to find alpha stuff in doxygen, and fixup labeling
of memory instructions in the assembly, to allow later linking
of traces with LLVM Value*s.

llvm-svn: 22271
2005-06-22 17:19:45 +00:00
John Criswell
00c8485c77 Fixed indentation.
llvm-svn: 22270
2005-06-20 19:59:22 +00:00
Andrew Lenharth
ce6f907ffe because some functions just use va_start and pass things to vfprintf
llvm-svn: 22269
2005-06-20 15:41:37 +00:00
Andrew Lenharth
4e1c8055ea the correct fix was to fix AliasAnalysis.getModRefInfo
llvm-svn: 22268
2005-06-20 15:25:22 +00:00
Andrew Lenharth
262b657737 prevent GCSE from forwarding stores to loads around vaarg. This is uggly, and I am trying to fix the AliasInfo, as it should catch the problem instead.
llvm-svn: 22266
2005-06-20 15:02:05 +00:00