Commit Graph

8708 Commits

Author SHA1 Message Date
Nate Begeman 784a0dcbd0 Move virtual function call out of loop to speed up getFreePhysReg by about
20%, shaving 0.1s off hbd compile time on my g5.  Yay.

llvm-svn: 18592
2004-12-07 05:25:53 +00:00
Reid Spencer 9083936835 For PR387:\
Make only one print method to avoid overloaded virtual warnings when \
compiled with -Woverloaded-virtual

llvm-svn: 18589
2004-12-07 04:03:45 +00:00
Reid Spencer a8288d93ae For PR409: \
Test the range of float constants to ensure we are not attempting to create a \
float constant using a double value that is out of range for a float

llvm-svn: 18585
2004-12-06 22:18:37 +00:00
Reid Spencer 95044d0071 For PR409: \
Make sure to check isValueValidForType on floating point constants and give \
an error if the value is not valid, otherwise it would assert in the VMCore

llvm-svn: 18584
2004-12-06 22:18:25 +00:00
Reid Spencer 1014afc7ea Fix PR139: \
Implement LinkItems and BuildLinkItems interfaces.

llvm-svn: 18547
2004-12-05 19:14:55 +00:00
Chris Lattner a34f9da4b4 Properly implement a fix for PR475
llvm-svn: 18537
2004-12-05 07:19:16 +00:00
Chris Lattner 1a0117f641 Revert this patch, it broke a ton of programs.
llvm-svn: 18535
2004-12-05 06:59:59 +00:00
Chris Lattner f878f75d46 Move lower intrinsics before FP constant emission, in case
intrinsic lowering ever introduces constants.

Rename local symbols before printing function bodies, fixing 255.vortex
with the CBE!!!

llvm-svn: 18534
2004-12-05 06:49:44 +00:00
Chris Lattner 97e36f211b When printing out a function, make sure that local and global symbols
don't conflict.  This fixes Assembler/2004-12-05-LocalGlobalSymtabConflict.ll

llvm-svn: 18532
2004-12-05 06:44:09 +00:00
Chris Lattner b392d30761 Add a new method
llvm-svn: 18531
2004-12-05 06:43:27 +00:00
Alkis Evlogimenos 8c5affedd1 Fix PR475.
llvm-svn: 18515
2004-12-05 01:51:20 +00:00
Reid Spencer ca49210f65 Distribute headers and license files too
llvm-svn: 18505
2004-12-04 22:34:21 +00:00
Reid Spencer ef510c0279 Provide more information in the error message that occurs when there are
unresolved constants remaining.

llvm-svn: 18502
2004-12-04 22:19:53 +00:00
Chris Lattner 8145bd5006 Check in some patches for better assertions
llvm-svn: 18500
2004-12-04 21:28:47 +00:00
Chris Lattner a27dd47e7a This patch prevents an infinite recursion while compiling 103.su2cor.
All SPEC CFP 95 programs now work, though the JIT isn't loading -lf2c right
so they aren't testing correctly.

llvm-svn: 18499
2004-12-04 20:54:32 +00:00
Chris Lattner a57c105687 Fix linkage of mismatched weak globals. This unbreaks 300.twolf
llvm-svn: 18494
2004-12-04 18:54:48 +00:00
Chris Lattner 8f97278c49 Do not allow bytecode files with unresolved references to be read. Doing
so lets wierd ConstantPlaceholder objects sneak into the system which
confuses it greatly.

llvm-svn: 18487
2004-12-04 05:28:27 +00:00
Chris Lattner 73a1914131 Fix compilation error on Darwin.
llvm-svn: 18485
2004-12-04 04:17:20 +00:00
Alkis Evlogimenos be526cfba4 Check if a block has a terminator first before calling front() on
it. If a block has a terminator then it is certainly non-empty so the
verifier will not crash on it.

llvm-svn: 18484
2004-12-04 02:30:42 +00:00
Alkis Evlogimenos b92de19116 Make error msg reflect what exactly went wrong.
llvm-svn: 18478
2004-12-04 01:25:06 +00:00
Chris Lattner 5684f4817f Prevent accessing past the end of the intervals vector, this fixes
Prolang-C/bison in the JIT

llvm-svn: 18477
2004-12-04 01:22:09 +00:00
Chris Lattner 87a756f09f Remove darwin specific majik
llvm-svn: 18467
2004-12-03 23:02:55 +00:00
Chris Lattner 4cf8b36469 Move darwin-specific majik here.
llvm-svn: 18466
2004-12-03 23:02:42 +00:00
Chris Lattner fc61de3902 Significantly rework linker support for global variables, allowing it to
correctly link globals whose LLVM types do not match.

This fixes several of the F2C SPEC FP benchmarks, which were failing this
due to the implementation of common blocks used by f2c.

llvm-svn: 18465
2004-12-03 22:18:41 +00:00
Chris Lattner 26d9c22832 Fix test/Regression/CodeGen/CBackend/2004-12-03-ExternStatics.ll and
PR472

llvm-svn: 18459
2004-12-03 17:19:10 +00:00
Chris Lattner 9019e5cfa0 Implement stripping of debug symbols, making the --strip-debug options in
gccas/gccld more than just a noop.

llvm-svn: 18456
2004-12-03 16:22:08 +00:00
Chris Lattner 5a4dc8ca5a Do not look here for elegance.
This fixes the ugly darwin "cannot find symbols starting with __" issue.

Thanks for Owen/resistor for testing this out for me.

llvm-svn: 18454
2004-12-03 07:16:51 +00:00
Brian Gaeke 608a6dae43 This code rotted - change it to call abort() until someone wants
to rewrite this to use relocations.

llvm-svn: 18453
2004-12-03 06:57:14 +00:00
Tanya Lattner c0d9dcdfac When writing kernel, save the branches til the end. They are still put in the "right place" in the schedule, but sometimes when folding to make a kernel instructions are added between branches. This is wrong. To avoid this, we handle branches special.
llvm-svn: 18450
2004-12-03 05:25:22 +00:00
Chris Lattner 9d76c236f7 Fix a regression caused by the previous patch
llvm-svn: 18449
2004-12-03 05:13:15 +00:00
Chris Lattner e8ebcb3300 Initial reimplementation of the -strip pass, with a stub for implementing
-S

llvm-svn: 18440
2004-12-02 21:25:03 +00:00
Chris Lattner a4c9808603 This pass is moving to lib IPO
llvm-svn: 18439
2004-12-02 21:24:40 +00:00
Chris Lattner 7651614c4d The stripping pass as we know it is about to disappear
llvm-svn: 18436
2004-12-02 21:05:01 +00:00
John Criswell 335c342440 Reverting revision 1.209.
Including alloca.h on Solaris brings in the prototype of strftime(), which
breaks compilation of CBE generated code.

llvm-svn: 18435
2004-12-02 19:02:49 +00:00
Chris Lattner 33660426a5 Spill/restore X86 floating point stack registers with 64-bits of precision
instead of 80-bits of precision.  This fixes PR467.

This change speeds up fldry on X86 with LLC from 7.32s on apoc to 4.68s.

llvm-svn: 18433
2004-12-02 18:17:31 +00:00
Chris Lattner 96b14e18bb Consider 64-bit registers to be FP as well.
llvm-svn: 18432
2004-12-02 17:57:21 +00:00
Reid Spencer f78508b25e PR466:
* Make the linker find lib*.bca files now instead of lib*.bc since those
  are what the makefiles now generate for bytecode archives.
* Make sure the linker only links archives when LinkLibraries is called.
  Previously if it found a lib*.bc file and that file was a bytecode file,
  it would link in the entire bytecode. This could make -lc -lc fail with
  duplicate symbols error but it shouldn't as searching multiple libraries,
  even the same one more than once, is permitted.
* Now that the above problems are corrected, implement the dependent libs
  feature. After the module is linked with all specified libraries, the
  LinkLibraries function will obtain the set of dependent libraries from
  the linked modules and attemp to find and link against those libraries.

llvm-svn: 18428
2004-12-02 09:52:10 +00:00
Reid Spencer f473185cbc Fix seriously broken implementation of GetMagicNumber.
llvm-svn: 18422
2004-12-02 09:09:48 +00:00
Tanya Lattner 201e972dc4 Reworked branch adding in prologue. Added check for infinite loops which are not modulo scheduled.
llvm-svn: 18419
2004-12-02 07:22:15 +00:00
Chris Lattner c0677c081d Implement a FIXME by checking to make sure that a malloc is not being used
in scary and unknown ways before we promote it.  This fixes the miscompilation
of 188.ammp that has been plauging us since a globalopt patch went in.

Thanks a ton to Tanya for helping me diagnose the problem!

llvm-svn: 18418
2004-12-02 07:11:07 +00:00
Chris Lattner 3b18139b3c Fix a minor bug where we set a var to initialized on malloc, not on store.
This doesn't fix anything that I'm aware of, just noticed it by inspection

llvm-svn: 18417
2004-12-02 06:25:58 +00:00
Tanya Lattner e94b466a8e Reverting this patch:
http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20041122/021428.html

It broke Mutlisource/Applications/obsequi

llvm-svn: 18407
2004-12-01 18:27:03 +00:00
Chris Lattner e58bf09138 Initial support for packed types, contributed by Morten Ofstad
llvm-svn: 18406
2004-12-01 17:14:28 +00:00
Chris Lattner 9a43d294b9 Remove unneeded cast.
llvm-svn: 18405
2004-12-01 17:13:05 +00:00
Chris Lattner cf2e128758 Get GEP's working with packed types. Contributed by Morten Ofstad!
llvm-svn: 18404
2004-12-01 17:12:16 +00:00
Reid Spencer 3f2352e23e Revert version 1.39. It breaks the ordering of the library processing.
llvm-svn: 18399
2004-11-30 22:54:48 +00:00
Chris Lattner 798e0349c0 Do not let GCC emit a warning for INT64_MIN
llvm-svn: 18398
2004-11-30 21:33:58 +00:00
Brian Gaeke 86deaf2211 Sparcs behave better if we use <alloca.h> and avoid messing with __builtin_alloca.
llvm-svn: 18397
2004-11-30 21:27:01 +00:00
Chris Lattner 56bac30683 Fix the JIT when being used from llvm-db
llvm-svn: 18391
2004-11-30 17:41:49 +00:00
Chris Lattner 951673a94c This pass is completely broken.
llvm-svn: 18387
2004-11-30 17:09:06 +00:00
Chris Lattner 37a14496c5 RevisionNum is read by error(), initialize it early.
llvm-svn: 18386
2004-11-30 16:58:18 +00:00
Brian Gaeke 5c9fa5bcee Update list of failing benchmarks.
llvm-svn: 18384
2004-11-30 08:15:44 +00:00
Brian Gaeke 1d6b926ab6 If we're about to emit something like:
%f0 = fmovs %f0
  %f1 = fmovs %f1

then just delete the FpMOVD pseudo-instruction instead.  Also, add
statistics and debug printouts.

llvm-svn: 18383
2004-11-30 08:15:15 +00:00
Chris Lattner 019445715e Squelch warning
llvm-svn: 18381
2004-11-30 07:47:34 +00:00
Chris Lattner bd11625469 Fix several bugs in 'op x, imm' handling. Foremost is that we now emit
addi r3, r3, -1
instead of
   addi r3, r3, 1

for 'sub int X, 1'.

Secondarily, this fixes several cases where we could crash given an unsigned
constant.  And fixes a couple of minor missed optimization cases, such as
xor X, ~0U -> not X

llvm-svn: 18379
2004-11-30 07:30:20 +00:00
Reid Spencer 95729469cc Up the compression threshold to 64K so we avoid it for all but the largest
bytecode files. This should help linking substantially.

llvm-svn: 18378
2004-11-30 07:13:34 +00:00
Chris Lattner 868ae13dc0 Fix test/Regression/Transforms/LICM/2004-09-14-AliasAnalysisInvalidate.llx
This only fails on darwin or on X86 under valgrind.

llvm-svn: 18377
2004-11-30 07:01:15 +00:00
Chris Lattner 7562a05735 Fix CodeGen/PowerPC/2004-11-30-shr-var-crash.ll
llvm-svn: 18376
2004-11-30 06:40:04 +00:00
Chris Lattner ce350cbd3a Fix test/Regression/CodeGen/PowerPC/2004-11-29-ShrCrash.ll
llvm-svn: 18374
2004-11-30 06:36:11 +00:00
Chris Lattner 9eeb2033ff Fix test/Regression/CodeGen/PowerPC/2004-11-30-shift-crash.ll
llvm-svn: 18371
2004-11-30 06:29:10 +00:00
Chris Lattner fd8cbc257e Alkis noticed that this variable is dead. Thanks!
llvm-svn: 18369
2004-11-30 04:01:44 +00:00
Chris Lattner 0b6ebd8d10 Add method
llvm-svn: 18368
2004-11-30 02:51:53 +00:00
Chris Lattner 389cfac0d1 If we have something like this:
if (x) {
    code
    ...
  } else {
    code
    ...
  }

Turn it into:

  code
  if (x) {
    ...
  } else {
    ...
  }

This reduces code size and in some common cases allows us to completely
eliminate the conditional.  This turns several if/then/else blocks in loops
into straightline code in 179.art, turning the loops into single basic blocks
(good for modsched even!).

Maybe now brg will leave me alone ;-)

llvm-svn: 18366
2004-11-30 00:29:14 +00:00
Chris Lattner e0c207d2d3 Remove extraneous namespacification. In particular, don't define llvm::llvm::createInternalGlobalMapperPass
llvm-svn: 18365
2004-11-30 00:22:59 +00:00
Chris Lattner 6e455608e2 Allow hoisting loads of globals and alloca's in conditionals.
llvm-svn: 18363
2004-11-29 21:26:12 +00:00
Reid Spencer 4f44c95967 Functionality moved to portable lib/System/DynamicLibrary.cpp
implementation

llvm-svn: 18358
2004-11-29 14:11:41 +00:00
Reid Spencer 70e37278cb Use System/DynamicLibrary instead of Support/DynamicLinker
llvm-svn: 18357
2004-11-29 14:11:29 +00:00
Reid Spencer 9ec2761bb7 Use System/DynamicLibrary instead of Support/DynamicLinker to implement.
llvm-svn: 18356
2004-11-29 14:07:46 +00:00
Reid Spencer 0e6a4fc448 Implement two new functions: LoadLibraryPermanently and
SearchForAddressOfSymbol.

llvm-svn: 18355
2004-11-29 13:33:28 +00:00
Reid Spencer d1697bf2f7 Shared library extension is now in LTDL_SHLIB_EXT
llvm-svn: 18353
2004-11-29 12:40:21 +00:00
Reid Spencer 3468ae1a87 We just use ltdl's implementation for this abstraction now. Its portable to
more platforms than LLVM supports.

llvm-svn: 18352
2004-11-29 12:39:10 +00:00
Reid Spencer 47430cf2a5 Mods for compilation with llvm.
llvm-svn: 18346
2004-11-29 12:04:27 +00:00
Reid Spencer 11ba920d55 Original version of ltdl.h from libtool 1.5.10
llvm-svn: 18345
2004-11-29 12:02:48 +00:00
Reid Spencer 6717b80ba2 Original version of ltdl.c from libtool 1.5.10
llvm-svn: 18344
2004-11-29 12:02:25 +00:00
Reid Spencer 72a7457a90 Implement the default constructor which causes the current program to be
opened as if it was a dynamic library so its symbols can be searched too.

llvm-svn: 18341
2004-11-29 10:39:46 +00:00
Chris Lattner f9c5dc9fb4 Revamp long/ulong comparisons to use a much more efficient sequence (thanks
to Brian and the Sun compiler for pointing out that the obvious works :)

This also enables folding all long comparisons into setcc and branch
instructions: before we could only do == and !=

For example, for:
void test(unsigned long long A, unsigned long long B) {
   if (A < B) foo();
 }

We now generate:

test:
        subl $4, %esp
        movl %esi, (%esp)
        movl 8(%esp), %eax
        movl 12(%esp), %ecx
        movl 16(%esp), %edx
        movl 20(%esp), %esi
        subl %edx, %eax
        sbbl %esi, %ecx
        jae .LBBtest_2  # UnifiedReturnBlock
.LBBtest_1:     # then
        call foo
        movl (%esp), %esi
        addl $4, %esp
        ret
.LBBtest_2:     # UnifiedReturnBlock
        movl (%esp), %esi
        addl $4, %esp
        ret

Instead of:

test:
        subl $12, %esp
        movl %esi, 8(%esp)
        movl %ebx, 4(%esp)
        movl 16(%esp), %eax
        movl 20(%esp), %ecx
        movl 24(%esp), %edx
        movl 28(%esp), %esi
        cmpl %edx, %eax
        setb %al
        cmpl %esi, %ecx
        setb %bl
        cmove %ax, %bx
        testb %bl, %bl
        je .LBBtest_2   # UnifiedReturnBlock
.LBBtest_1:     # then
        call foo
        movl 4(%esp), %ebx
        movl 8(%esp), %esi
        addl $12, %esp
        ret
.LBBtest_2:     # UnifiedReturnBlock
        movl 4(%esp), %ebx
        movl 8(%esp), %esi
        addl $12, %esp
        ret

llvm-svn: 18330
2004-11-29 05:55:24 +00:00
Tanya Lattner d8cc4facd0 Reworked branching so we don't handle BAs specially. It just updates the branchTO regardless of what type of branch it is.
llvm-svn: 18322
2004-11-29 04:39:47 +00:00
Tanya Lattner 341828ee64 Fixed bug where instructions in the kernel were not ordered right to preserve dependencies in a cycle.
llvm-svn: 18314
2004-11-28 23:36:15 +00:00
Reid Spencer 279fa256a2 Fix for PR454:
* Make sure we handle signed to unsigned conversion correctly
* Move this visitSetCondInst case to its own method.

llvm-svn: 18312
2004-11-28 21:31:15 +00:00
Chris Lattner c0f8a1c721 The LLVM bool type shall have 1 byte alignment on PPC.
llvm-svn: 18311
2004-11-28 21:16:45 +00:00
Chris Lattner 6ea2888832 Make DSE potentially more aggressive by being more specific about alloca sizes.
llvm-svn: 18309
2004-11-28 20:44:37 +00:00
Chris Lattner 1b784b117d Fix DeadStoreElimination/2004-11-28-LiveStoreDeleted.ll
llvm-svn: 18308
2004-11-28 20:30:15 +00:00
Chris Lattner ebb54c55e1 Fix SingleSource/UnitTests/2004-11-28-GlobalBoolLayout.c, and hopefully
PR449

llvm-svn: 18306
2004-11-28 17:56:47 +00:00
Chris Lattner aef74b55de Fix PR463
llvm-svn: 18303
2004-11-28 16:45:45 +00:00
Reid Spencer 8a3312cab3 Compute the firstFileOffset correctly after reading the LLVM symbol table.
llvm-svn: 18300
2004-11-28 03:13:02 +00:00
Chris Lattner 24bba4d237 When merging to alias sets, if they are both must alias, the result is not
a must alias set unless all of the pointers in the resultant set are must
aliased together.

llvm-svn: 18275
2004-11-27 18:37:42 +00:00
Chris Lattner 14f3cdc227 Implement Regression/Transforms/InstCombine/getelementptr_cast.ll, which
occurs many times in crafty

llvm-svn: 18273
2004-11-27 17:55:46 +00:00
Nate Begeman 43123c9f7a Remove the ISel->AsmPrinter link via the TargetMachine that was put in
place to help bring up the PowerPC back end on Darwin.  This code is no
longer serves any purpose now that the AsmPrinter does the right thing
all the time printing GlobalValues.  --Cruft.

llvm-svn: 18267
2004-11-27 04:45:11 +00:00
Chris Lattner eeaa29c377 Add a new interface
llvm-svn: 18266
2004-11-26 21:36:25 +00:00
Chris Lattner b137409926 Provide size information when checking to see if we can LICM a load, this
allows us to hoist more loads in some cases.

llvm-svn: 18265
2004-11-26 21:20:09 +00:00
Chris Lattner f30656b437 When evaluating an AA, pass in size info
llvm-svn: 18264
2004-11-26 21:05:39 +00:00
Chris Lattner b50fd9262d There is no reason to store <x,x>, just store <x>.
llvm-svn: 18263
2004-11-26 20:25:17 +00:00
Chris Lattner 63b45b4768 The trick with globals actually works with allocas and malloc too
llvm-svn: 18262
2004-11-26 20:01:48 +00:00
Chris Lattner 75819a81b2 A store or load cannot alias a global if the accessed amount is larger then
the global.

This implements Regression/Analysis/BasicAA/global-size.ll

llvm-svn: 18261
2004-11-26 19:20:01 +00:00
Reid Spencer d49013f0b8 Add bzip2 subdirectory
llvm-svn: 18251
2004-11-25 19:38:28 +00:00
Reid Spencer fa8d2e0b27 Remove zlib support in favor of our own bzip2 library
llvm-svn: 18250
2004-11-25 19:38:16 +00:00
Reid Spencer af6fd29a08 Adjust to Compressor interface change
llvm-svn: 18249
2004-11-25 19:38:05 +00:00
Reid Spencer c51e80a09f Revise to LLVM makefile standards.
llvm-svn: 18246
2004-11-25 16:12:25 +00:00
Reid Spencer a01ef71032 Initial Version from bzip2 Release 1.0.2.
llvm-svn: 18245
2004-11-25 16:11:36 +00:00
Reid Spencer 8bb258d1ea Implement dependent library linking. It is no longer required that -lstdc++
-lstdsup++ no -lc be passed on the command line to llvm linkers if the
progam being linked was compiled with the C/C++ Front End or Stacker.

llvm-svn: 18243
2004-11-25 09:32:08 +00:00
Reid Spencer 2c4f9a484c Remove blank comment lines for uniformity.
Make sure lines don't exceed 80 cols.

llvm-svn: 18242
2004-11-25 09:29:44 +00:00
Nate Begeman 3f76eb69f6 Enable optimization suggested by Chris Lattner to not emit reloc stubs for
static global variables whose addresses are taken.  This allows us to
convert the following code for taking the address of a static function foo

        addis r2, r30, ha16(Ll1__2E_foo_2$non_lazy_ptr-"L00001$pb")
        lwz r3, lo16(Ll1__2E_foo_2$non_lazy_ptr-"L00001$pb")(r2)

which also includes linker stub code emitted at the end of the .s file not
shown here, and replace it with this:

        addis r2, r30, ha16(l1__2E_foo_2-"L00001$pb")
        la r3, lo16(l1__2E_foo_2-"L00001$pb")(r2)

which in addition to not needing linker help, also has no load instruction.
For those not up on PowerPC mnemonics, la is shorthand for add immediate.

llvm-svn: 18239
2004-11-25 07:09:01 +00:00
Chris Lattner 8cbad8efcf Fix the build on non ppc machines
llvm-svn: 18235
2004-11-25 06:14:45 +00:00
Chris Lattner 497a622376 The JIT works enough
llvm-svn: 18228
2004-11-25 04:14:54 +00:00
Chris Lattner da76c16ba4 Fix encoding of fsel, fixing olden/power, McCat/bisort and several others.
All of Olden passes now! :)

llvm-svn: 18227
2004-11-25 04:11:07 +00:00
Chris Lattner 305f78f646 Fix encoding of fneg instruction
llvm-svn: 18226
2004-11-25 03:53:44 +00:00
Chris Lattner 191e525bae Fix encoding of swari, fixing several programs, including Olden/mst
llvm-svn: 18225
2004-11-25 03:40:20 +00:00
Chris Lattner 5d8ae54267 There is not a 1-1 mappign between llvm blocks and PPC blocks, do not use
LLVM blocks as the keys for the branch rewriter.  This fixes treeadd and
many other programs with the JIT.

llvm-svn: 18223
2004-11-25 00:33:57 +00:00
Chris Lattner dd516799d7 * Rename existing relocations to be more specific
* Add relocations for refernces to non-lazy darwin stubs and implement
  them correctly.

With this change, we can correctly references external globals, and now
all but two UnitTests and all but 1 Regression/C tests pass.

More importantly, bugpoint-jit will start giving us useful testcases,
instead of always telling us that references to external globals don't
work :)

llvm-svn: 18222
2004-11-24 22:30:08 +00:00
Nate Begeman e49936af54 Add the same optimization that we do loading from fixed alloca slots to
storing to fixed alloca slots.

llvm-svn: 18221
2004-11-24 21:53:14 +00:00
Chris Lattner 078b6f2b62 Write CompilationCallback as an explicit assembly stub to avoid getting GCC's
prolog.

llvm-svn: 18220
2004-11-24 21:01:46 +00:00
Chris Lattner 659d72e319 When rewriting the original call instruction, make sure to rewrite it to
call the right address.

llvm-svn: 18213
2004-11-24 18:00:02 +00:00
Chris Lattner cb9af557e7 Force the intregs ptr into R2 and the FPregs ptr into R3. This fixes a really
obscure problem where we were doing:

lmw     r3,0(r9)

which is undefined on PPC.  Now we do:

lmw     r3,0(r2)

by force, not relying on the GCC register allocator for luck :)

llvm-svn: 18212
2004-11-24 17:42:55 +00:00
Reid Spencer 80bb693109 Implement and document prefix options with arbitrary values including an
= sign. This needed to support -DNAME=value options as pass-through in
llvmc.

llvm-svn: 18203
2004-11-24 06:13:42 +00:00
Brian Gaeke 7217642438 Update list of failing benchmarks.
llvm-svn: 18202
2004-11-24 04:07:42 +00:00
Brian Gaeke 1139802b98 Fix bug in emitGEPOperation with large struct-member offsets.
llvm-svn: 18201
2004-11-24 04:07:33 +00:00
Chris Lattner 130888ad37 Fix a few more tests by encoding the extsb and other XForm11 instructions
correctly.

llvm-svn: 18200
2004-11-24 03:52:02 +00:00
Chris Lattner 022e271db5 Fix the encoding of ORi and other DForm4 instructions. This brings us to
36/42 SingleSource/UnitTests passing!

llvm-svn: 18199
2004-11-24 02:15:41 +00:00
Chris Lattner 57542fcfc2 Loads are relocatable too
llvm-svn: 18198
2004-11-24 02:03:44 +00:00
Chris Lattner 7b1cf0d6c6 Calls do not need a MovPCtoLR instruction
llvm-svn: 18197
2004-11-24 02:00:06 +00:00
Chris Lattner 6a7ebe034e Get constant pools working. This fixes even more programs, allowing us to
pass 24/42 in UnitTests (up from 20).

llvm-svn: 18196
2004-11-24 01:56:12 +00:00
Tanya Lattner 13c71ca7b6 Forced branches to be first to be scheduled.
llvm-svn: 18195
2004-11-24 01:49:10 +00:00
Chris Lattner 193b6f3281 Rewrite branches more closely to correct. This makes more stuff pass, and
stops the infinite loops!

llvm-svn: 18194
2004-11-24 01:35:12 +00:00
Chris Lattner b55f748b1a Branch instructions explicitly represent CRx in them. bEcause of this, encode
them explicitly as well.

llvm-svn: 18193
2004-11-24 01:15:19 +00:00
Nate Begeman 674fe0bb60 Fix encoding of bctrl, and remove some unused instructions
llvm-svn: 18192
2004-11-24 00:16:37 +00:00
Reid Spencer a193f3cdbf Allow reading of member names that begin with an _ character.
llvm-svn: 18179
2004-11-23 22:35:39 +00:00
Chris Lattner c7eeae4661 Fix encoding of blr and bctr
llvm-svn: 18178
2004-11-23 22:06:24 +00:00
Nate Begeman c5fc6f5717 Use the correct register class as a constaint to gcc's inline assembly, so
that we don't end up trying to use r0 as a base register.

llvm-svn: 18176
2004-11-23 21:37:22 +00:00
Nate Begeman 617760687a Save/Restore arg regs and nonvolatile regs the compiler might use during
CompilationCallback

llvm-svn: 18175
2004-11-23 21:34:18 +00:00
Chris Lattner 578dfd5e42 Fix the encoding of OR, AND and many other instructions
llvm-svn: 18174
2004-11-23 21:17:35 +00:00
Brian Gaeke 94c58dc877 Support shr long/ulong.
llvm-svn: 18173
2004-11-23 21:10:50 +00:00
Brian Gaeke 8d4a5ad55c Support printing ConstantAggregateZeros.
llvm-svn: 18172
2004-11-23 21:10:49 +00:00
Brian Gaeke 2e7f71863f Update failing SingleSource test-case list.
llvm-svn: 18171
2004-11-23 21:10:48 +00:00
Chris Lattner a630adebc7 Remove argtype and argcount magic, which was used by the old asmprinter.
llvm-svn: 18170
2004-11-23 20:41:34 +00:00
Chris Lattner be39b8f541 Get rid of flags that are dead
llvm-svn: 18169
2004-11-23 20:37:41 +00:00
Chris Lattner 5f4b0e1bf7 Fix encoding of rlwinm?
llvm-svn: 18165
2004-11-23 19:23:32 +00:00
Chris Lattner 1238cca6df Fix encodings
llvm-svn: 18164
2004-11-23 19:23:18 +00:00
Chris Lattner 431e0132ef Enumerate CR registers
llvm-svn: 18162
2004-11-23 18:59:59 +00:00
Chris Lattner a8936af13e Initial implementation of exiting CompilationCallback
This should save all argument registers on entry and restore on exit, despite
that, simple things seem to work!!!

llvm-svn: 18161
2004-11-23 18:49:46 +00:00
Chris Lattner febc3eb8fa This method is dead
llvm-svn: 18160
2004-11-23 18:47:55 +00:00
Chris Lattner 24ad93f55c Remove this method.
llvm-svn: 18159
2004-11-23 18:47:42 +00:00
Chris Lattner cccd49f1b7 Squelch a bogus warning
llvm-svn: 18157
2004-11-23 15:57:01 +00:00
Chris Lattner b1fd07a862 Squelch a bogus warning.
llvm-svn: 18156
2004-11-23 15:56:38 +00:00
Nate Begeman 7e7a08dba5 Don't return value from void function. This is only temporary anyway while
the JIT is made to work!

llvm-svn: 18155
2004-11-23 10:04:49 +00:00
Brian Gaeke bde370eb58 pseudocode for 64-bit lshr.
llvm-svn: 18154
2004-11-23 08:14:09 +00:00
Chris Lattner 40ff89c212 Fix a minor bug
llvm-svn: 18153
2004-11-23 06:56:31 +00:00
Chris Lattner 5369ab3e24 Be really paranoid about not breaking stuff yet
llvm-svn: 18152
2004-11-23 06:56:18 +00:00
Chris Lattner 4ff117585d Implement the first hunk of CompilationCallback. The pieces missing are the
ones noted, which require funny PPC specific inline assembly.

If some angel felt the desire to help me, I think this is that last bit missing
for JIT support (however, generic code emitter might night work right with
the constant pool yet).

llvm-svn: 18151
2004-11-23 06:55:05 +00:00
Brian Gaeke d3311665cc Add more known-failing tests.
llvm-svn: 18149
2004-11-23 06:39:50 +00:00
Brian Gaeke 2491727b5d Add the rest of the logical instructions.
llvm-svn: 18148
2004-11-23 06:39:37 +00:00
Chris Lattner 7445c5eadc Implement the stub needed to get into compilation callback.
llvm-svn: 18147
2004-11-23 06:27:02 +00:00
Chris Lattner e1187d46a1 Simplify code a bit
llvm-svn: 18146
2004-11-23 06:05:44 +00:00
Chris Lattner 8296c4c323 Initial implementation of the JIT interfaces. Relocation is done and stubs
for external functions work.  CompilationCallback has not been written, and
stubs for internal functions are not generated yet.  This means you can call
printf and exit, and use global variables, but cannot call functions local to
a module yet.

llvm-svn: 18145
2004-11-23 06:02:06 +00:00
Chris Lattner 743a43424f Emit relocations for the global variable using instructions. This gets us
LA, LOADHiAddr, CALLpcrel, and MovePCtoLR working, though the constant pool
probably is not right.

llvm-svn: 18144
2004-11-23 05:59:53 +00:00
Chris Lattner 1c95751676 Implement all of the methods
llvm-svn: 18142
2004-11-23 05:57:57 +00:00
Chris Lattner 0b4eb3f806 Initial checkin of the 32-bit PPC relocation types
llvm-svn: 18141
2004-11-23 05:57:38 +00:00
Chris Lattner f5363dc789 Move JITInfo from PPCTM to PPC32TM
llvm-svn: 18140
2004-11-23 05:56:40 +00:00
Chris Lattner ae670d5895 Do not provide the non-specialized PowerPCJITInfo object, it is pretty useless.
Instead, let derived classes provide specialized ones.

llvm-svn: 18139
2004-11-23 05:55:38 +00:00
Chris Lattner 6500c6d332 LA is really addi. Be consistent with operand ordering to avoid confusing the code emitter
llvm-svn: 18138
2004-11-23 05:54:25 +00:00
Tanya Lattner c3a7394291 Changed the CreateCodeToLoadConst function to preserve SSA form. This basically means adding extra tmp instructions for intermediate values.
llvm-svn: 18137
2004-11-23 04:22:29 +00:00
Chris Lattner 69e4cc55ef Remove some dead code
llvm-svn: 18136
2004-11-22 23:07:22 +00:00
Chris Lattner 40565d72d4 Comment out a couple of unused instructions.
llvm-svn: 18135
2004-11-22 23:07:01 +00:00
Chris Lattner a76f09d0d3 Do not push two return addresses on the stack when we call external functions who have their addresses taken. This fixes test-call.ll
llvm-svn: 18134
2004-11-22 22:25:30 +00:00
Chris Lattner c5753055ea Rename Emitter.cpp -> JITEmitter.cpp
llvm-svn: 18132
2004-11-22 22:00:25 +00:00
Chris Lattner 88dc917c72 Fix the FIXME, nuke the JIT specific forceCompilationOf method.
llvm-svn: 18131
2004-11-22 21:54:35 +00:00
Chris Lattner 0e7faedde7 Disable this.
llvm-svn: 18130
2004-11-22 21:51:40 +00:00
Chris Lattner 213e39ee7c These methods are obsolete
llvm-svn: 18129
2004-11-22 21:48:33 +00:00
Chris Lattner 8e9ed2747c This chunk of code needs to be rewritten
llvm-svn: 18127
2004-11-22 21:45:54 +00:00
Chris Lattner 54e1b22ea3 Remove some dead vars and some useless namespacification
llvm-svn: 18126
2004-11-22 21:42:40 +00:00
Chris Lattner 80ad8871e7 Implement a disgusting hack to work around broken machine code emission of
the RDCCR instruction.  This fixes a bunch of programs with the JIT.

llvm-svn: 18124
2004-11-22 21:25:10 +00:00
Tanya Lattner ab9cf27cd0 Fixed a bug where I was trying to ModuloSchedule a loop with no instructions but a terminator.
Fixed a bug in the schedule generation that was always using the start cycle.

llvm-svn: 18123
2004-11-22 20:41:24 +00:00
Chris Lattner c15c120342 Remove JIT-specific code from the code emitter.
llvm-svn: 18122
2004-11-22 20:25:10 +00:00
Chris Lattner 8edcdaa6eb New methods implemented
llvm-svn: 18121
2004-11-22 20:24:42 +00:00
Chris Lattner b098ce7c8e Implement the Sparc JIT interfaces, including relocation support.
llvm-svn: 18120
2004-11-22 20:24:27 +00:00
Chris Lattner 9e90720658 Fix test/Regression/CFrontend/2003-11-01-EmptyStructCrash.c
llvm-svn: 18115
2004-11-22 19:15:27 +00:00
Chris Lattner 540e5f92b4 Do not count debugger intrinsics in size estimation.
llvm-svn: 18110
2004-11-22 17:23:57 +00:00
Chris Lattner 79e87e39eb Ignore debugger intrinsics when doing inlining size computations.
llvm-svn: 18109
2004-11-22 17:21:44 +00:00
Chris Lattner 6d048a0d32 Do not consider debug intrinsics in the size computations for loop unrolling.
Patch contributed by Michael McCracken!

llvm-svn: 18108
2004-11-22 17:18:36 +00:00
Brian Gaeke dd10ba214e Add stub method for long shift codegen.
llvm-svn: 18100
2004-11-22 08:02:06 +00:00
Brian Gaeke d1502c5c5d Update to-do list.
llvm-svn: 18099
2004-11-22 08:02:05 +00:00
Chris Lattner 50c2e117b3 Support targets that require stubs for external functions better
llvm-svn: 18098
2004-11-22 07:24:43 +00:00
Reid Spencer db372c707b Fix a comment to imply the correct semantics.
llvm-svn: 18097
2004-11-22 02:58:47 +00:00
Chris Lattner 96304f816f Initial checkin of the V9 relocation types
llvm-svn: 18095
2004-11-22 00:40:51 +00:00
Brian Gaeke 29a4b354a3 Implement setcc on longs.
llvm-svn: 18088
2004-11-21 08:11:28 +00:00
Brian Gaeke 8ab27507fd Add all the rest of the ADD and SUB variants, some of which are important for
64-bit support.

llvm-svn: 18087
2004-11-21 07:13:17 +00:00
Brian Gaeke 46cdc9e043 Support add, sub, mul, div, rem on longs/ulongs (latter 3 by emitting libcalls).
Add a big comment containing my notes on how to do setcc for longs/ulongs.

llvm-svn: 18086
2004-11-21 07:13:16 +00:00
Brian Gaeke 07ef7e0ae1 Update to-do list.
llvm-svn: 18085
2004-11-21 07:13:15 +00:00
Nate Begeman 6c9375b20c Fix Shootout-C++/wc, which was broken by my recent changes to emit fewer
reg-reg copies.  The necessary conditions for this bug are a GEP that is
used outside the basic block in which it is defined, whose components
other than the pointer are all constant zero, and where the use is
selected before the definition (backwards branch to successsor block).

llvm-svn: 18084
2004-11-21 05:14:06 +00:00
Chris Lattner d68ebaacc0 There is no reason to emit function stubs for direct calls.
llvm-svn: 18082
2004-11-21 03:46:06 +00:00
Chris Lattner 9de8e2225f Clean up DEBUG output
llvm-svn: 18081
2004-11-21 03:44:32 +00:00
Chris Lattner 65f6638822 Allow targets to avoid emitting a stub for EVERY lazily resolved call. In
most cases (e.g. direct calls) no stub is needed.

llvm-svn: 18080
2004-11-21 03:37:42 +00:00
Brian Gaeke 016bd3ba11 Fix extraStack calculation -- I think in fact it might be getting a bit *too*
much stack, but that's better than not enough, which leads to miscompilations.

Fix FP vaarg.

llvm-svn: 18079
2004-11-21 03:35:22 +00:00
Brian Gaeke 83189cdff3 Update list of failing benchmarks & to-do list.
llvm-svn: 18078
2004-11-21 03:35:21 +00:00
Chris Lattner 894bf8eed0 ignore generated files
llvm-svn: 18073
2004-11-21 00:01:54 +00:00
Chris Lattner aee9a76f52 ignore generated files.
llvm-svn: 18072
2004-11-21 00:00:54 +00:00
Chris Lattner 60d815a18b Implement relocation support by adding a target independent resolver interface.
llvm-svn: 18069
2004-11-20 23:57:07 +00:00
Chris Lattner d02c9eb697 Remove all JIT specific code and switch the code generator over to emitting
relocations for global references.

llvm-svn: 18068
2004-11-20 23:55:15 +00:00
Chris Lattner b7e72cba22 Implement the X86 JIT interfaces
llvm-svn: 18067
2004-11-20 23:54:33 +00:00
Chris Lattner 8f2ed923ea Describe the X86 target-specific relocations.
llvm-svn: 18066
2004-11-20 23:54:19 +00:00
Chris Lattner 8c645ec0d3 We implement these interfaces
llvm-svn: 18065
2004-11-20 23:53:56 +00:00
Chris Lattner 5f3d274f5f Adjust to changed interfaces
llvm-svn: 18064
2004-11-20 23:53:26 +00:00
Chris Lattner 374301ecb9 This method does not exist any longer.
llvm-svn: 18061
2004-11-20 23:51:03 +00:00
Tanya Lattner d27b014459 Fixed assertion from triggering. We need to check if the commandline map is empty before checking if an arg exists.
llvm-svn: 18057
2004-11-20 23:35:20 +00:00
Reid Spencer 9afecaf4ff Cast the void* handle data member to HMODULE* to keep the VC++ compiler
happy. Thanks to Henrik Bach for pointing this out.

llvm-svn: 18056
2004-11-20 23:30:55 +00:00
Brian Gaeke a8ea7d9cdb Support most cases of vaarg (except double).
llvm-svn: 18055
2004-11-20 22:50:42 +00:00
Brian Gaeke a45e7c40d4 Update failing test cases & to-do list.
llvm-svn: 18054
2004-11-20 22:50:41 +00:00
Reid Spencer 7a32486483 Distinguish between BSD4.4 and SVR4 symbol tables
llvm-svn: 18044
2004-11-20 07:29:40 +00:00
Chris Lattner 233e9bb546 This method was never implemented
llvm-svn: 18039
2004-11-20 04:19:47 +00:00
Chris Lattner 6f01b4cf1f Remove this method, it's not clear how it could be implemented indep of 32 or 64-bit mode
llvm-svn: 18038
2004-11-20 04:17:17 +00:00
Chris Lattner ae5ac03c1d getJITStubForFunction is optional and unimplemented, just remove it for now.
llvm-svn: 18037
2004-11-20 04:15:38 +00:00
Chris Lattner f0c6aff268 getJITStubForFunction is optional and unimplemented, just remove it.
llvm-svn: 18036
2004-11-20 04:14:44 +00:00
Chris Lattner 6cf7a43603 Add getCurrentPCOffset() and addRelocation() methods.
Add stub support for relocations to finishFunction

llvm-svn: 18035
2004-11-20 03:46:14 +00:00
Chris Lattner f6fcf39aed Add getCurrentPCOffset() and addRelocation() methods.
llvm-svn: 18034
2004-11-20 03:44:39 +00:00
Brian Gaeke 774e978e0d Implement vacopy and vanext.
llvm-svn: 18031
2004-11-20 03:32:12 +00:00
Chris Lattner b7b78508a8 Add accessor
llvm-svn: 18030
2004-11-20 03:11:07 +00:00
Misha Brukman 72a57c3259 Allow constructor parameter to override aggregating args; fix spacing
llvm-svn: 18028
2004-11-20 02:20:27 +00:00
Misha Brukman 4bf11e1618 Revert the patch that adds Function* for each 64-bit libc div/mul/rem that we
want to do; instead, we can use MachineInstr::addExternalSymbol(char*, bool) and
thus we don't have to modify the Module as we are code generating for it

llvm-svn: 18025
2004-11-20 00:10:20 +00:00
Tanya Lattner 2e4f222045 Made modsched hidden and changed so it matches the style of other options.
llvm-svn: 18024
2004-11-19 23:34:33 +00:00
Misha Brukman f1ccebba3d Fix grammar
llvm-svn: 18023
2004-11-19 23:09:40 +00:00
Misha Brukman ce75b2c2cf Add protoypes for 64-bit long/ulong div, mul, and rem functions
llvm-svn: 18019
2004-11-19 22:14:35 +00:00
Misha Brukman dbe04afcb9 Fix file comment header
llvm-svn: 18018
2004-11-19 22:09:21 +00:00
Misha Brukman cb178bd478 Handle GhostLinkage case for completeness (should not be seen by the asm writer)
llvm-svn: 18015
2004-11-19 21:49:19 +00:00
Brian Gaeke 1db83f7b73 Add VANext and VAArg stubs.
llvm-svn: 18012
2004-11-19 21:08:18 +00:00
Brian Gaeke 1c014df436 Implement va_start.
llvm-svn: 18011
2004-11-19 20:57:24 +00:00
Chris Lattner 4cd9def8b7 Dont' forget to switch back to decimal output
llvm-svn: 18010
2004-11-19 20:57:07 +00:00
Chris Lattner c27389815d Match change in MachineCodeEmitter prototype.
llvm-svn: 18009
2004-11-19 20:56:46 +00:00
Brian Gaeke 3db46bd0e1 First part of varargs support: getting all varargs which could possibly
be in registers into memory.

llvm-svn: 18006
2004-11-19 20:31:08 +00:00
Brian Gaeke 8bb29bf3f6 va_end can safely be codegen'd to nothing on v8.
llvm-svn: 18004
2004-11-19 19:21:34 +00:00
Brian Gaeke 201535d102 A very sorry stub implementation of varargs intrinsics...
llvm-svn: 18003
2004-11-19 18:53:59 +00:00
Brian Gaeke 1810073046 Update list of expected test failures.
llvm-svn: 18002
2004-11-19 18:48:29 +00:00
Brian Gaeke 3effd0d769 Fix bug in casting to long/ulong.
llvm-svn: 18001
2004-11-19 18:48:10 +00:00
Chris Lattner a8a8a03a85 Fix memory leaks, patch contributed by Morten Ofstad!
llvm-svn: 17999
2004-11-19 17:09:48 +00:00
Chris Lattner 37bcd99622 Patches to avoid "leaking" memory on process exit. Patch contributed by
Morten Ofstad!

llvm-svn: 17998
2004-11-19 17:08:15 +00:00
Reid Spencer 78e12c73e5 Correct the computation of when to add the padding. It is not based on the
member's size. It is based on the oddness/evenness of the file pointer.
This fixes a bug with llvm-ar not being able to read archives produced by
llvm-ranlib when there are members with odd long file name lengths.

llvm-svn: 17997
2004-11-19 17:08:00 +00:00
Chris Lattner 446948e094 Fix the exposed prototype for the lower packed pass, thanks to
Morten Ofstad.

llvm-svn: 17996
2004-11-19 16:49:34 +00:00
Chris Lattner 99a669b110 Add hooks to free all memory allocated by the singleton factories in these
files.  Patch contributed by Morten Ofstad!

llvm-svn: 17995
2004-11-19 16:39:44 +00:00
Chris Lattner d137be2d0d CPR is dead.
llvm-svn: 17992
2004-11-19 16:24:57 +00:00
Chris Lattner ddf3b7997f Add note that this is for old bytecode files.
llvm-svn: 17991
2004-11-19 16:24:05 +00:00
Chris Lattner 1b4e78d9e6 Mission accomplished!
llvm-svn: 17990
2004-11-19 16:22:24 +00:00
Reid Spencer dc23fe9ded Allow this to compile even on machines that HAVE the bzlib library but do
NOT have the bzlib.h header file. Go figure.

llvm-svn: 17989
2004-11-19 15:56:28 +00:00
Chris Lattner d215992b35 This is a horrible hack to work around libstdc++ bugs :(
llvm-svn: 17988
2004-11-19 08:44:07 +00:00
Nate Begeman 488f4a4352 Eliminate another 6k register copies that the register allocator would just
coalesce out of hbd.  Speeds up compilation by 2% (0.6s)

llvm-svn: 17987
2004-11-19 08:01:16 +00:00
Reid Spencer 0bcf9e4da6 Undo last change as its unnecessary.
llvm-svn: 17985
2004-11-19 04:59:07 +00:00
Reid Spencer fc9f779039 Don't save an iterator, just use post-increment.
llvm-svn: 17981
2004-11-19 03:44:10 +00:00
Reid Spencer 3356325996 Eliminate unsightly ;;
llvm-svn: 17979
2004-11-19 03:27:05 +00:00
Reid Spencer 5d76fa0a3c Make a cast explicit.
llvm-svn: 17977
2004-11-19 03:20:09 +00:00
Reid Spencer 39a0347b79 Make findModulesDefiningSymbols modify its symbols argument so we can \
eliminate symbols defined by the archive efficiently

llvm-svn: 17976
2004-11-19 03:18:22 +00:00
Reid Spencer c2455ca7b7 Reduce the amount of work in LinkInArchive by not searching the archive for
symbols it has already identified as not defining.

llvm-svn: 17975
2004-11-19 03:13:25 +00:00
Nate Begeman f4fd759f9e Generate fewer reg-reg copies for the register allocator to deal with.
This eliminates over 2000 in hbd alone.

llvm-svn: 17973
2004-11-19 02:06:40 +00:00
Chris Lattner 953075442d Delete stoppoints that occur for the same source line.
llvm-svn: 17970
2004-11-18 21:41:39 +00:00