Commit Graph

19190 Commits

Author SHA1 Message Date
Reid Spencer 1aa7d05f3c For PR540:
* Add check for pthread.h
* Make sure -lpthread gets added to LIBS if its available

llvm-svn: 22402
2005-07-12 15:24:20 +00:00
Reid Spencer cd59fb7a1b In support of PR418:
Make sure that -lpthread gets added to LIBS variable which puts it at the
end of the tools' link commands, if libpthread.a is found.

Add a test for pthread.h so we can use #ifdef HAVE_PTHREAD_H

llvm-svn: 22401
2005-07-12 07:19:13 +00:00
Chris Lattner 298ac69934 Add support for 64-bit elf files
llvm-svn: 22400
2005-07-12 06:57:52 +00:00
Chris Lattner c292519a20 Add support for emitting 64-bit integers
llvm-svn: 22399
2005-07-12 06:57:26 +00:00
Chris Lattner b9e53d892b Add some apparently undocumented ELF section header flags
llvm-svn: 22398
2005-07-12 06:40:29 +00:00
Andrew Lenharth 20b534a4fd Fix povray and minor cleanups
llvm-svn: 22397
2005-07-12 04:20:52 +00:00
Nate Begeman b6daad1f4d Clean up and add comments to the newly implemented subtarget code.
llvm-svn: 22396
2005-07-12 03:04:49 +00:00
Jeff Cohen 8161bc5d35 Add new files to Visual Studio projects.
llvm-svn: 22395
2005-07-12 03:00:20 +00:00
Jeff Cohen ddc8b78cda 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 33b8232ce0 VC++ demands that the function returns a value
llvm-svn: 22393
2005-07-12 02:53:33 +00:00
Nate Begeman df8946dede 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 351817b1f9 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 f873f4d504 Add a note
llvm-svn: 22390
2005-07-12 02:35:36 +00:00
Nate Begeman f26625e1de 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 83b492b83c Commit some pending darwin changes before subtarget support.
llvm-svn: 22388
2005-07-12 01:37:28 +00:00
Chris Lattner 986675cb75 Fix PR576.
Instead of emitting a JIT stub that looks like this:

internal void %l1_main_entry_2E_ce_wrapper(int) {
header:
        %resolver = call sbyte* %getPointerToNamedFunction( sbyte* getelementptr ([20 x sbyte]* %l1_main_entry_2E_ce_name, int 0, int 0) )           ; <sbyte*> [#uses=1]
        %resolverCast = cast sbyte* %resolver to void (int)*            ; <void (int)*> [#uses=1]
        call void %resolverCast( int %0 )
        ret void
}

Emit one that looks like this:

internal void %l1_main_entry_2E_ce_wrapper(int) {
Entry:
	%fpcache = load void (int)** %l1_main_entry_2E_ce.fpcache               ; <void (int)*> [#uses=2]
        %isNull = seteq void (int)* %fpcache, null              ; <bool> [#uses=1]
        br bool %isNull, label %lookupfp, label %usecache

usecache:               ; preds = %lookupfp, %Entry
        %fp = phi void (int)* [ %resolverCast, %lookupfp ], [ %fpcache, %Entry ]            ; <void (int)*> [#uses=1]
        call void %fp( int %0 )
        ret void

lookupfp:               ; preds = %Entry
        %resolver = call sbyte* %getPointerToNamedFunction( sbyte* getelementptr ([20 x sbyte]* %l1_main_entry_2E_ce_name, int 0, int 0) )           ; <sbyte*> [#uses=1]
        %resolverCast = cast sbyte* %resolver to void (int)*            ; <void (int)*> [#uses=2]
        store void (int)* %resolverCast, void (int)** %l1_main_entry_2E_ce.fpcache
        br label %usecache
}


This makes the JIT debugger *MUCH* faster on large programs, as
getPointerToNamedFunction takes time linear with the size of the program, and
before we would call it every time a function in the text module was called from
the safe module (ouch!).

llvm-svn: 22387
2005-07-12 01:00:32 +00:00
Chris Lattner de69bf9972 add a note so I can remember the common t-t's
llvm-svn: 22386
2005-07-12 00:20:49 +00:00
Chris Lattner fd564c6bc9 fix a warning
llvm-svn: 22385
2005-07-11 22:46:18 +00:00
Andrew Lenharth 23167c3be9 Remove glibc specific functions, and mark a couple as C99
llvm-svn: 22384
2005-07-11 20:35:20 +00:00
Andrew Lenharth c51a74cc02 because on alpha:
#   define errno (*__errno_location ())

*shakes head

llvm-svn: 22383
2005-07-11 17:41:12 +00:00
Chris Lattner 449e07f390 Clean up code, no functionality changes.
llvm-svn: 22382
2005-07-11 06:34:30 +00:00
Chris Lattner 9bdb1c3818 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 0d2f043c41 Fix crazy indentation
llvm-svn: 22380
2005-07-11 06:25:47 +00:00
Chris Lattner 3cad7bedc9 convert dos newlines to unix. No other changes.
llvm-svn: 22379
2005-07-11 06:25:34 +00:00
Chris Lattner 5bacb00452 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 c1b8551e3a The symbol table just needs a const GlobalValue*, not a non-const one.
llvm-svn: 22377
2005-07-11 06:16:24 +00:00
Chris Lattner d831209c34 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 2244f73437 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 6801f4f291 expose a new code emitter object
llvm-svn: 22374
2005-07-11 05:15:32 +00:00
Chris Lattner 3bdfd6fcd1 add a helper method
llvm-svn: 22373
2005-07-11 04:49:33 +00:00
Chris Lattner c3e38f7943 Remove prototype for non-existant function
llvm-svn: 22372
2005-07-11 04:20:55 +00:00
Chris Lattner dfe33bc837 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 93bf2de35b add a name mangler object
llvm-svn: 22370
2005-07-11 03:11:10 +00:00
Chris Lattner 8ffb66111c fix long lines
llvm-svn: 22369
2005-07-11 02:49:16 +00:00
Chris Lattner 53676dfd33 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 de0a4b1987 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 36db1ed06f 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 9bfa5495dd Move TRUNCSTORE to using a VTSDNode operand instead of being a MVTSDNode.
Also update some comments that Andrew forgot to update when he changed
loads/stores.

llvm-svn: 22365
2005-07-10 00:28:25 +00:00
Chris Lattner 0b6ba90a72 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 0aad91acfe Fix bugs also fixed in Unix version, plus other general cleanup.
llvm-svn: 22363
2005-07-09 18:42:49 +00:00
Jeff Cohen 5b106d0fed 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 2d85f5697d 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 03f6f7a537 Make sure we don't error out if an invalid path is used, just simply
exit from isBytecodeLPath with "false".

llvm-svn: 22360
2005-07-08 16:48:52 +00:00
Reid Spencer d28e432c36 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 748de6e248 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 f50677610f Stamp out tabs
llvm-svn: 22357
2005-07-08 05:02:13 +00:00
Jeff Cohen 0e1d7354b7 Make Win32 implementation conform to new paradigm
llvm-svn: 22356
2005-07-08 04:50:08 +00:00
Jeff Cohen 4c24144ddf Fix eraseSuffix()
llvm-svn: 22355
2005-07-08 04:49:16 +00:00
Reid Spencer af48d8643d 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 215db9041b Fix VC++ breakage
llvm-svn: 22353
2005-07-08 02:48:42 +00:00