Commit Graph

19363 Commits

Author SHA1 Message Date
Chris Lattner 9762834a7f new testcase for PR602
llvm-svn: 22495
2005-07-21 21:55:08 +00:00
Nate Begeman a9443f29b0 Support building non-PIC
Remove the LoadHiAddr pseudo-instruction.
Optimization of stores to and loads from statics.
Force JIT to use new non-PIC codepaths.

llvm-svn: 22494
2005-07-21 20:44:43 +00:00
Chris Lattner 53208ecf34 revert to using 4-byte alignment for doubles, as specified by the ABI
llvm-svn: 22493
2005-07-21 19:17:18 +00:00
Chris Lattner 8a8f2e5a01 llvm.sqrt somehow escaped documentation.
llvm-svn: 22490
2005-07-21 01:29:16 +00:00
Nate Begeman 15527113ab Support assembling fsqrt on darwin. This will be implemented better when
PowerPC gets subtarget support up.

llvm-svn: 22489
2005-07-21 01:25:49 +00:00
Chris Lattner 4e6c118b4d If errno doesn't matter (e.g. in -ffast-math scenarios), sqrt* should be
compiled to llvm.sqrt.

llvm-svn: 22488
2005-07-21 01:09:27 +00:00
Nate Begeman 8465fe8b4b Generate mfocrf when targeting g5. Generate fsqrt/fsqrts when targetin g5.
8-byte align doubles.

llvm-svn: 22486
2005-07-20 22:42:00 +00:00
Misha Brukman 5379a5b571 * "GNU Compiler Collection's gcc tool" is redundant
* Made bullet points start with a verb and lowercase, since they are not
  complete sentences
* Cleaned up grammar, removed extraneous verbosity

llvm-svn: 22485
2005-07-20 21:06:37 +00:00
Chris Lattner 24b350039b Allow this to pass on non-linux systems as well, such as darwin
llvm-svn: 22484
2005-07-20 19:12:00 +00:00
Chris Lattner 18aa4d8196 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 05732c86d4 count the number of relocations performed.
llvm-svn: 22480
2005-07-20 16:29:20 +00:00
Chris Lattner 14568496c0 set the target triple so that we don't fail due to X86 abi issues
llvm-svn: 22479
2005-07-20 03:56:48 +00:00
Nate Begeman 0851f1aaa1 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 1ac40a1245 Remove unnecessary FP_EXTEND. This causes worse codegen for SSE.
llvm-svn: 22469
2005-07-19 16:50:03 +00:00
Reid Spencer d37d854cb2 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 fb6343984a remove some sparc-v9-specific information
llvm-svn: 22467
2005-07-19 03:37:48 +00:00
Reid Spencer e5dc84b73c Provide descriptions for the TargetInstrInfo and TargetFrameInfo classes.
llvm-svn: 22466
2005-07-19 01:36:35 +00:00
Chris Lattner 247aef884c 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 b35912e421 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
Reid Spencer 012d35ae17 Add a parameter to the FIND_STD_PROGRAM macro that allows an alternate name
for the command line options. This helps with situations where the executable
name sought is too generic and a more meaningful name needs to be used for
the command line options. It also helps satisfy picky project leaders.

llvm-svn: 22461
2005-07-17 05:30:33 +00:00
Reid Spencer e7e3c214cf Add two new checks for use in LLVM configuration files:
* FIND_STD_PROGRAM will find a program in the path or using --with options
  and verify that the path/bin/program is executable. Also allows checking
  for include files and libraries. If found, USE_PROGRAM is set, otherwise
  its not set. Also sets PROGRAM_BIN (bin directory), and PROGRAM_DIR (top
  level directory). If headers are found, sets PROGRAM_INC. If libraries
  are found, sets PROGRAM_LIB.
* CHECK_PROGRAM_SANITY can be used to run a program with some option that
  only produces information output and requires no input. If the output
  matches a regular expression, the program passes the sanity check.
  Otherwise, an error occurs.

llvm-svn: 22458
2005-07-17 00:50:40 +00:00
Chris Lattner a5998ce94f 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 2148cffae7 Add two helper methods, adjust a prototype
llvm-svn: 22456
2005-07-16 17:40:34 +00:00
Chris Lattner 363964e53d Refactor getSection() method to make it easier to use.
llvm-svn: 22455
2005-07-16 17:36:04 +00:00
Chris Lattner 2b3380b44e Add ability to set TYPE and FLAGS field for section trivially
llvm-svn: 22454
2005-07-16 17:35:26 +00:00
Chris Lattner fd44500427 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 7e74c834c1 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 8293d0e232 Teach the register allocator that movaps is also a move instruction
llvm-svn: 22451
2005-07-16 02:00:20 +00:00
Nate Begeman 57b9ed522d A couple more darwinisms
llvm-svn: 22450
2005-07-16 01:59:47 +00:00
Chris Lattner 507a27592f 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 e3e847bfd7 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 b47f5e6d54 You can't use config options without config.h
llvm-svn: 22446
2005-07-15 22:48:31 +00:00
Chris Lattner 3a6a4d3707 Fix PR595: These error messages should not be looking at CGI.Name, they
should be looking at CGI.TheDef->getName().

llvm-svn: 22445
2005-07-15 22:43:04 +00:00
John Criswell a3f5110d5e Fixed some punctuation.
llvm-svn: 22443
2005-07-15 19:25:12 +00:00
Nate Begeman a0b5e035ea 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 0f38dc4970 Add support for printing the sse scalar comparison instruction mnemonics.
llvm-svn: 22440
2005-07-14 22:52:25 +00:00
Nate Begeman 4f229d5197 Add support for a TODO; instructions in .td files can now have arguments
printed as part of the opcode.  This allows something like
cmp${cc}ss in the x86 backed to be printed as cmpltss, cmpless, etc.
depending on what the value of $cc is.

llvm-svn: 22439
2005-07-14 22:50:30 +00:00
John Criswell b249d409be Regression test for PR#596: Make sure that negation of a minus doesn't
turn into a C predecrement operator.

llvm-svn: 22438
2005-07-14 19:56:03 +00:00
John Criswell 3870f9d31a 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 46524e2573 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
Reid Spencer f284268ba5 * Correct the AC_DEFINE for LLVM_PATH_GRAPHVIZ to use AC_DEFINE_UNQUOTED so
we actually get the path and not $GRAPHVIZ as the value.
* Add a #define for the gv program (HAVE_GV) and its value LLVM_PATH_GV.

llvm-svn: 22433
2005-07-14 05:19:12 +00:00
Chris Lattner fcc53ad625 As discussed on IRC, this stuff is just for debugging.
llvm-svn: 22432
2005-07-14 05:17:43 +00:00
Reid Spencer 0ac41946e1 Put the path to the Graphviz program in the #defines so it can be used.
llvm-svn: 22430
2005-07-14 02:25:12 +00:00
Chris Lattner 51ded0e1ee 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 8640f2bdc1 Get rid of warnings on Alpha
llvm-svn: 22428
2005-07-13 23:20:24 +00:00
Reid Spencer f17006fdda Implement a test for the Graphviz program for Chris Lattner. The symbol
GRAPHVIZ will contain the path to the program if its found (or "echo Graphviz"
if not) and the #define HAVE_GRAPHVIZ will be defined if its found.

llvm-svn: 22424
2005-07-13 03:20:14 +00:00
Reid Spencer 86df93a216 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 65806e62b1 Note to self: don't introduce memory leaks.
llvm-svn: 22422
2005-07-13 02:58:04 +00:00
Jeff Cohen 014dd48fbc Eliminate tabs
llvm-svn: 22421
2005-07-13 02:19:59 +00:00
Jeff Cohen 3800a28d46 Win32 support for Mutex class.
llvm-svn: 22420
2005-07-13 02:15:18 +00:00
Chris Lattner f9ddfef872 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 330d3acee8 new testcase for PR593
llvm-svn: 22418
2005-07-13 01:57:39 +00:00
Chris Lattner ba08a336f0 Fix test/Regression/CodeGen/Generic/2005-07-12-memcpy-i64-length.ll
llvm-svn: 22417
2005-07-13 01:42:45 +00:00
Chris Lattner 27e4e8e1b8 new testcase that crashes llc on x86/ppc. Not generated by C/C++ or LLVM
though.

llvm-svn: 22416
2005-07-13 01:42:03 +00:00
Reid Spencer 4f61c64639 Add a test that runs the ParallelJIT example program to ensure that the
JIT can run against a multi-threaded program without getting its data
structures messed up. Also had to add the examples directory to the path
for the tests so that ParallelJIT can be found.

llvm-svn: 22415
2005-07-13 00:35:12 +00:00
Reid Spencer 06a1da3efb Correct the file title.
llvm-svn: 22414
2005-07-12 22:00:29 +00:00
Reid Spencer 6855097c0d For PR418:
Add an example program that utilizes multiple threads in the JIT to process
work. This was used by Evan Jones as the original test case for ensuring
that the ExecutionEngine was thread safe.

Original source by Evan Jones (adapted from other LLVM JIT examples) and
made LLVM style compliant by Reid Spencer.

llvm-svn: 22411
2005-07-12 21:51:33 +00:00
Nate Begeman 8dd96ec769 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 5fc86e8314 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 4386e4a826 Update release notes regarding thread-safe JIT.
llvm-svn: 22405
2005-07-12 16:36:24 +00:00
Reid Spencer 79876f52aa 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 f404981bf2 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
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 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
Jeff Cohen 941500dcd1 fix typo
llvm-svn: 22352
2005-07-08 02:48:04 +00:00
Nate Begeman b62a4c8da6 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 17c1bd372a 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 c9c0473fa5 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 4ed40f7c6f 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
Chris Lattner 2d0f468cd2 New testcase distilled from a large chunk of code Misha sent me.
llvm-svn: 22347
2005-07-07 20:39:45 +00:00
Andrew Lenharth 8d40dcbd18 clean up prolouge and epilouge
llvm-svn: 22346
2005-07-07 19:52:58 +00:00
Reid Spencer 5b891e9847 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 2e81f65eb8 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 1932f5c9be 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
Chris Lattner 92a139dd0b Add support for building/representing the symbol table, add some enum constants
llvm-svn: 22342
2005-07-07 07:00:37 +00:00
Nate Begeman fcd2f76cb6 Fix a typo in my checkin today that caused regressions. Oops!
llvm-svn: 22341
2005-07-07 06:32:01 +00:00
Nate Begeman 8a0933608a 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 a7220851c0 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 f5473e44a9 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 80fe411662 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 91ae129b90 Fit to 80 columns
llvm-svn: 22336
2005-07-05 17:50:16 +00:00
Chris Lattner 1239d2d7ff Fix PowerPC varargs
llvm-svn: 22335
2005-07-05 17:48:31 +00:00
Andrew Lenharth 8c220defa8 oops
llvm-svn: 22334
2005-07-05 16:36:18 +00:00
Andrew Lenharth a1f37d616e updates
llvm-svn: 22333
2005-07-05 15:18:33 +00:00
Andrew Lenharth 26fa89e0a7 check the correct VT
llvm-svn: 22332
2005-07-04 20:07:21 +00:00
Andrew Lenharth da852d51df fix loading address of fp symbols
llvm-svn: 22331
2005-07-03 20:06:13 +00:00
Chris Lattner 9f6ce0ebb3 Percolate the call up to the right superclass
llvm-svn: 22330
2005-07-03 17:34:39 +00:00
Andrew Lenharth be3a74ca3e 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
Jeff Cohen 64869f5d20 Adding new files to Visual Studio projects.
llvm-svn: 22328
2005-07-02 02:04:26 +00:00
Nate Begeman 9a1dc72729 The statistic needs to be in the correct namespace.
llvm-svn: 22327
2005-07-01 23:56:38 +00:00
Chris Lattner d313b92b66 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 b97404687a 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 21da9b669e 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 dd55b1566b 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 e8ab64b5c3 remove some debugging code
llvm-svn: 22321
2005-07-01 06:40:58 +00:00
Andrew Lenharth 0a370f4de5 oops
llvm-svn: 22320
2005-06-30 19:32:57 +00:00
Andrew Lenharth b5597e38f6 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 937c71f2b3 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
Chris Lattner ba613f478a new testcase for PR590
llvm-svn: 22317
2005-06-30 07:28:54 +00:00
Nate Begeman 718387e491 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 2edc1881ac restore old srcValueNode behavior and try to to work around it
llvm-svn: 22315
2005-06-29 18:54:02 +00:00
Chris Lattner f550554c02 Don't crash on a query where the block is not in any loop. Thanks to
Sameer D. Sahasrabuddhe for pointing this out!

llvm-svn: 22314
2005-06-29 17:41:25 +00:00
John Criswell 51e2a48b35 Bug fixed.
llvm-svn: 22313
2005-06-29 16:22:34 +00:00
John Criswell 810b4f8d55 Doh! Forgot to LLVMify the style.
llvm-svn: 22312
2005-06-29 15:57:50 +00:00
Andrew Lenharth 8192568fbc 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 4642afdcc1 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 4401049f05 thinko
llvm-svn: 22309
2005-06-29 13:35:05 +00:00
Andrew Lenharth d0a2f0f95a unify SelectExpr and SelectFP
llvm-svn: 22308
2005-06-29 12:49:51 +00:00
Andrew Lenharth d0f59dedf8 fix most regressions
llvm-svn: 22307
2005-06-29 12:23:34 +00:00
Andrew Lenharth 47a9c4715a support more relocations for stores also
llvm-svn: 22306
2005-06-29 00:39:17 +00:00
Andrew Lenharth 1ef3c0c798 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
Jeff Cohen 8d9d9d7af0 Add ElfWriter stuff to Visual Studio
llvm-svn: 22304
2005-06-28 02:43:03 +00:00
Andrew Lenharth 93bf000891 some call work
llvm-svn: 22303
2005-06-27 23:59:51 +00:00
Andrew Lenharth d74877a46d 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 a50adcf57d 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 db32921535 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 595646f934 get rid of another pseudo op
llvm-svn: 22299
2005-06-27 21:11:40 +00:00
Andrew Lenharth 1291a85883 generate address of constant pool entries
llvm-svn: 22298
2005-06-27 21:02:56 +00:00
Andrew Lenharth 02ffa5a7ed Misha happification patch
llvm-svn: 22297
2005-06-27 17:39:17 +00:00
Andrew Lenharth 7aba58ab89 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 fcb112eb7a missed a load
llvm-svn: 22295
2005-06-27 16:40:26 +00:00
Andrew Lenharth 96db51a3b6 make constant pool labels local
llvm-svn: 22294
2005-06-27 16:29:54 +00:00
Andrew Lenharth 53bb83bc43 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 10594206f4 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 386b151ce6 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
Chris Lattner a1debbc634 iniital checkin of ELFWriter header.
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: 22290
2005-06-27 06:28:45 +00:00
Andrew Lenharth dac0b3cb8a depend more on legalize putting constants on the RHS
llvm-svn: 22289
2005-06-26 23:01:11 +00:00
Andrew Lenharth 331380b2e2 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 06fcc4cb75 add a new -filetype argument to llc.
llvm-svn: 22287
2005-06-25 03:32:05 +00:00
Chris Lattner 4c661789c1 add some new file types
llvm-svn: 22286
2005-06-25 03:31:43 +00:00
Chris Lattner 09b0eb387a minor cleanups, use copy ctor instead of manually doing it.
llvm-svn: 22285
2005-06-25 03:00:34 +00:00
Chris Lattner 6a7b48e747 refactor this interface
llvm-svn: 22284
2005-06-25 02:50:35 +00:00
Chris Lattner f11f48ba61 Refactor the addPassesToEmitAssembly interface into a addPassesToEmitFile
interface.

llvm-svn: 22282
2005-06-25 02:48:37 +00:00
Chris Lattner f96366550c refactor these interfaces a bit
llvm-svn: 22281
2005-06-25 02:47:50 +00:00
Chris Lattner aad30b0dc9 improve comments
llvm-svn: 22280
2005-06-24 18:17:33 +00:00
Chris Lattner 805ecf0c79 Fix grammar
llvm-svn: 22279
2005-06-24 18:00:40 +00:00
Chris Lattner c0ad71edd4 add a note about variable length array
llvm-svn: 22278
2005-06-24 17:22:57 +00:00
Chris Lattner 9610c6f287 add a debug type
llvm-svn: 22277
2005-06-24 16:00:46 +00:00
Andrew Lenharth af1e825112 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 01cebcc131 finally, Working varargs
llvm-svn: 22275
2005-06-23 16:48:51 +00:00
Andrew Lenharth a4a12983cc more complete Lowering for vacopy and vaarg
llvm-svn: 22274
2005-06-22 23:04:28 +00:00
Andrew Lenharth 253145299b 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 5305ea5c86 SelectionDAG is very unhappy when the argument to an intrinsic is a struct
llvm-svn: 22272
2005-06-22 20:38:11 +00:00
Andrew Lenharth cf9008afea 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 9cb5a82cdc Fixed indentation.
llvm-svn: 22270
2005-06-20 19:59:22 +00:00
Andrew Lenharth d6bee05fc4 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 5488847304 the correct fix was to fix AliasAnalysis.getModRefInfo
llvm-svn: 22268
2005-06-20 15:25:22 +00:00
Andrew Lenharth f42d7b54c0 make AliasAnalysis know that VAArg writes memory. This is extremely conservative and should be fixed
llvm-svn: 22267
2005-06-20 15:24:23 +00:00
Andrew Lenharth 805d84a077 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
Andrew Lenharth cf52eb2b99 prevent va_arg from being hoisted from a loop
llvm-svn: 22265
2005-06-20 13:36:33 +00:00
Andrew Lenharth 2929266127 fix DCE + va_arg problem
llvm-svn: 22264
2005-06-19 14:46:20 +00:00
Andrew Lenharth d4b103107e prevent DCE of vaarg intrinsics. This should take care of most regressions
llvm-svn: 22263
2005-06-19 14:41:20 +00:00
Andrew Lenharth 717f1610f0 va_end fix
llvm-svn: 22262
2005-06-19 14:04:55 +00:00