Commit Graph

18552 Commits

Author SHA1 Message Date
Reid Spencer b4f7b83dce * Merge get_GVInitializer and getCharArrayLength into a single function
named getConstantStringLength. This is the common part of StrCpy and
  StrLen optimizations and probably several others, yet to be written. It
  performs all the validity checks for looking at constant arrays that are
  supposed to be null-terminated strings and then computes the actual
  length of the string.
* Implement the MemCpyOptimization class. This just turns memcpy of 1, 2, 4
  and 8 byte data blocks that are properly aligned on those boundaries into
  a load and a store. Much more could be done here but alignment
  restrictions and lack of knowledge of the target instruction set prevent
  use from doing significantly more. That will have to be delegated to the
  code generators as they lower llvm.memcpy calls.

llvm-svn: 21562
2005-04-26 07:45:18 +00:00
Reid Spencer 89011b6f3c Add a new test case for the llvm.memcpy simplification case.
llvm-svn: 21561
2005-04-26 07:40:40 +00:00
Duraid Madina 81ebb57771 * Add code to reduce multiplies by constant integers to shifts, adds and
subtracts. This is a very rough and nasty implementation of Lefevre's
  "pattern finding" algorithm. With a few small changes though, it should
  end up beating most other methods in common use, regardless of the size
  of the constant (currently, it's often one or two shifts worse)

  TODO: rewrite it so it's not hideously ugly (this is a translation from
        perl, which doesn't help ;)
        bypass most of it for multiplies by 2^n+1
	(eventually) teach it that some combinations of shift+add are
	cheaper than others (e.g. shladd on ia64, scaled adds on alpha)
	get it to try multiple booth encodings in search of the cheapest
	routine
	make it work for negative constants

  This is hacked up as a DAG->DAG transform, so once I clean it up I hope
  it'll be pulled out of here and put somewhere else. The only thing backends
  should really have to worry about for now is where to draw the line
  between using this code vs. going ahead and doing an integer multiply
  anyway.

llvm-svn: 21560
2005-04-26 07:23:02 +00:00
Reid Spencer 76dab9a523 * Implement StrLenOptimization
* Factor out commonalities between StrLenOptimization and StrCatOptimization
* Make sure that signatures return sbyte* not void*

llvm-svn: 21559
2005-04-26 05:24:00 +00:00
Reid Spencer 3f2710e64e * Add a test case for StrLenOptimization
* Rename ExitInMain and StrCat tests so they don't have the date the
  regression was entered since they are feature tests, not regressions.

llvm-svn: 21558
2005-04-26 05:22:38 +00:00
Reid Spencer 8ee5aacc38 Incorporate feedback from Chris:
* Change signatures of OptimizeCall and ValidateCalledFunction so they are
  non-const, allowing the optimization object to be modified. This is in
  support of caching things used across multiple calls.
* Provide two functions for constructing and caching function types
* Modify the StrCatOptimization to cache Function objects for strlen and
  llvm.memcpy so it doesn't regenerate them on each call site. Make sure
  these are invalidated each time we start the pass.
* Handle both a GEP Instruction and a GEP ConstantExpr
* Add additional checks to make sure we really are dealing with an arary of
  sbyte and that all the element initializers are ConstantInt or
  ConstantExpr that reduce to ConstantInt.
* Make sure the GlobalVariable is constant!
* Don't use ConstantArray::getString as it can fail and it doesn't give us
  the right thing. We must check for null bytes in the middle of the array.
* Use llvm.memcpy instead of memcpy so we can factor alignment into it.
* Don't use void* types in signatures, replace with sbyte* instead.

llvm-svn: 21555
2005-04-26 03:26:15 +00:00
Jeff Cohen d45bdb45c1 Add SimplyLibCalls.cpp to VC++ build
llvm-svn: 21554
2005-04-26 02:57:49 +00:00
Reid Spencer 342fe9a833 Fix RUN: line to not always pass.
llvm-svn: 21553
2005-04-26 02:33:25 +00:00
Chris Lattner cfa7ddd6e2 Fold (X > -1) | (Y > -1) --> (X&Y > -1)
llvm-svn: 21552
2005-04-26 01:18:33 +00:00
Reid Spencer fe91dfec91 Changes due to code review and new implementation:
* Don't use std::string for the function names, const char* will suffice
* Allow each CallOptimizer to validate the function signature before
  doing anything
* Repeatedly loop over the functions until an iteration produces
  no more optimizations. This allows one optimization to insert a
  call that is optimized by another optimization.
* Implement the ConstantArray portion of the StrCatOptimization
* Provide a template for the MemCpyOptimization
* Make ExitInMainOptimization split the block, not delete everything
  after the return instruction.
(This covers revision 1.3 and 1.4, as the 1.3 comments were botched)

llvm-svn: 21548
2005-04-25 21:20:38 +00:00
Chris Lattner f806459d90 implement some more logical compares with constants, so that:
int foo1(int x, int y) {
  int t1 = x >= 0;
  int t2 = y >= 0;
  return t1 & t2;
}
int foo2(int x, int y) {
  int t1 = x == -1;
  int t2 = y == -1;
  return t1 & t2;
}

produces:

_foo1:
        or r2, r4, r3
        srwi r2, r2, 31
        xori r3, r2, 1
        blr
_foo2:
        and r2, r4, r3
        addic r2, r2, 1
        li r2, 0
        addze r3, r2
        blr

instead of:

_foo1:
        srwi r2, r4, 31
        xori r2, r2, 1
        srwi r3, r3, 31
        xori r3, r3, 1
        and r3, r2, r3
        blr
_foo2:
        addic r2, r4, 1
        li r2, 0
        addze r2, r2
        addic r3, r3, 1
        li r3, 0
        addze r3, r3
        and r3, r2, r3
        blr

llvm-svn: 21547
2005-04-25 21:20:28 +00:00
Reid Spencer f2534c7291 Lots of changes based on review and new functionality:
* Use a 

llvm-svn: 21546
2005-04-25 21:11:48 +00:00
Reid Spencer 172e9155c1 Update the test case to handle a few more (degenerate) cases and remove
the restriction that it is an XFAIL because it now passes.

llvm-svn: 21545
2005-04-25 21:08:34 +00:00
Chris Lattner d373ff64aa Codegen x < 0 | y < 0 as (x|y) < 0. This allows us to compile this to:
_foo:
        or r2, r4, r3
        srwi r3, r2, 31
        blr

instead of:

_foo:
        srwi r2, r4, 31
        srwi r3, r3, 31
        or r3, r2, r3
        blr

llvm-svn: 21544
2005-04-25 21:03:25 +00:00
Chris Lattner e093c6f565 Make dominates(A,B) work with post dominators. Patch contributed by
Naveen Neelakantam, thanks!

llvm-svn: 21543
2005-04-25 20:50:33 +00:00
Tanya Lattner af0ac2744e Added question about turning off all optimizations. I think this has been asked once or twice.
llvm-svn: 21542
2005-04-25 20:36:56 +00:00
Chris Lattner a21bf8d1be implement getelementptr.ll:test10
llvm-svn: 21541
2005-04-25 20:17:30 +00:00
Chris Lattner 20621b1e94 rename fn
llvm-svn: 21540
2005-04-25 20:17:16 +00:00
Chris Lattner e680ee2a48 new testcase
llvm-svn: 21539
2005-04-25 20:17:00 +00:00
Chris Lattner ecac782786 Correctly handle global-argument aliases induced in main
llvm-svn: 21537
2005-04-25 19:16:31 +00:00
Chris Lattner 5965359d8f Don't mess up SCC traversal when a node has null edges out of it.
llvm-svn: 21536
2005-04-25 19:16:17 +00:00
Chris Lattner 37b6b097ff document 'opaque' types
llvm-svn: 21535
2005-04-25 17:34:15 +00:00
Chris Lattner d1039cc581 Add feedback from Vikram
llvm-svn: 21534
2005-04-25 15:47:57 +00:00
Reid Spencer 478d3b930a Make sure the target buffer is null terminated so we don't blow up
strcat when its called.

llvm-svn: 21533
2005-04-25 15:40:35 +00:00
Reid Spencer 20b0e43e1f A test case for testing the StrCatOptimizer, currently XFAILed everywhere.
llvm-svn: 21532
2005-04-25 07:29:30 +00:00
Reid Spencer 9bbaa2ab7f Post-Review Cleanup:
* Fix comments at top of file
* Change algorithm for running the call optimizations from n*n to something
  closer to n.
* Use a hash_map to store and lookup the optimizations since there will
  eventually (or potentially) be a large number of them. This gets lookup
  based on the name of the function to O(1). Each CallOptimizer now has a
  std::string member named func_name that tracks the name of the function
  that it applies to. It is this string that is entered into the hash_map
  for fast comparison against the function names encountered in the module.
* Cleanup some style issues pertaining to iterator invalidation
* Don't pass the Function pointer to the OptimizeCall function because if
  the optimization needs it, it can get it from the CallInst passed in.
* Add the skeleton for a new CallOptimizer, StrCatOptimizer which will
  eventually replace strcat's of constant strings with direct copies.

llvm-svn: 21526
2005-04-25 03:59:26 +00:00
Reid Spencer 23423346f8 Use the %name rather than the "name" format so those familiar with the
llvm-dis output don't go blind.

llvm-svn: 21525
2005-04-25 03:18:19 +00:00
Reid Spencer ff7b16c1d6 Shut GCC 4.0 up about classes that have virtual functions but a non-virtual
destructor. Just add the do-nothing virtual destructor.

llvm-svn: 21524
2005-04-25 02:55:55 +00:00
Reid Spencer 0c2d046aa4 Declare a function to create the SimplifyLibCalls pass.
llvm-svn: 21523
2005-04-25 02:54:00 +00:00
Reid Spencer 39a762d149 A new pass to provide specific optimizations for certain well-known library
calls. The pass visits all external functions in the module and determines
if such function calls can be optimized. The optimizations are specific to
the library calls involved. This initial version only optimizes calls to
exit(3) when they occur in main(): it changes them to ret instructions.

llvm-svn: 21522
2005-04-25 02:53:12 +00:00
Reid Spencer 985f484263 A test case for the the ExitInMain libcall simplification.
llvm-svn: 21521
2005-04-25 02:50:08 +00:00
Reid Spencer 8edc8beacf Older compilers won't like the inline virtual destructor in the header file
so we put the destructor in Pass.cpp and make it non-inline.

llvm-svn: 21520
2005-04-25 01:01:35 +00:00
Chris Lattner fc104de06d fix some bugs
llvm-svn: 21515
2005-04-25 00:38:52 +00:00
Reid Spencer 756d049c06 Fix a thinko in the documentation of the splitBasicBlock method. The branch
instruction is added to the original block, not the new block.

llvm-svn: 21513
2005-04-25 00:31:53 +00:00
Reid Spencer 9c47b25868 Shut GCC 4.0 up about classes with virtual functions but no virtual
destructor.

llvm-svn: 21510
2005-04-24 22:27:20 +00:00
Reid Spencer ad750a80eb Shut GCC 4.0 up when it complains about classes with virtual functions that
don't have virtual destructors.

llvm-svn: 21507
2005-04-24 22:20:32 +00:00
Reid Spencer 4da978466d Make this readable for newbies and those who can only understand one set of
grammar rules for the English language.

llvm-svn: 21503
2005-04-24 20:56:18 +00:00
Misha Brukman 6818b33096 extract has been renamed to llvm-extract to avoid conflicting with another tool
llvm-svn: 21501
2005-04-24 17:46:58 +00:00
Chris Lattner 2f1457fd83 Eliminate cases where we could << by 64, which is undefined in C.
llvm-svn: 21500
2005-04-24 17:46:05 +00:00
Misha Brukman ca1e0c6ae0 There are still uses for spaces in Makefiles -- to make text line up together,
regardless of the tab size/stop settings on the developer side

llvm-svn: 21499
2005-04-24 17:43:41 +00:00
Misha Brukman e22594f3d7 extract has been renamed to llvm-extract to avoid conflicting with another tool
llvm-svn: 21498
2005-04-24 17:36:05 +00:00
Misha Brukman 3e9634eaa0 elisp code to help with LLVM code standards compliance
llvm-svn: 21497
2005-04-24 17:09:19 +00:00
Misha Brukman 831ad84eea .vimrc file to aid in LLVM coding standards conformance
llvm-svn: 21496
2005-04-24 17:05:04 +00:00
Chris Lattner d6f636a340 Implement xor.ll:test21: select (not C), A, B -> select C, B, A
llvm-svn: 21495
2005-04-24 07:30:14 +00:00
Chris Lattner b57d040464 Test that xor/select are folded into a select with inverted operands.
llvm-svn: 21494
2005-04-24 07:28:53 +00:00
Chris Lattner 2c7d177d25 Allow these methods to take a generic Value* to simplify clients. Use
const_cast instead of c casts.

llvm-svn: 21493
2005-04-24 07:28:37 +00:00
Chris Lattner b220952aca allow these to take a generic Value*
llvm-svn: 21492
2005-04-24 07:28:04 +00:00
Chris Lattner d1f46d3bf9 Use getPrimitiveSizeInBits() instead of getPrimitiveSize()*8
Completely rework the 'setcc (cast x to larger), y' code.  This code has
the advantage of implementing setcc.ll:test19 (being more general than
the previous code) and being correct in all cases.

This allows us to unxfail 2004-11-27-SetCCForCastLargerAndConstant.ll,
and close PR454.

llvm-svn: 21491
2005-04-24 06:59:08 +00:00
Chris Lattner 0de0638522 unxfail this.
llvm-svn: 21490
2005-04-24 06:55:40 +00:00
Chris Lattner 624d5cb006 add a new testcase which occurs in 181.mcf
llvm-svn: 21489
2005-04-24 06:55:33 +00:00
Misha Brukman 1c8d93b08f * The aesthetic police is on patrol!!...
* ... but it wasn't so busy as to not smell the roses and doxygenify comments

llvm-svn: 21487
2005-04-23 22:35:26 +00:00
Chris Lattner 396890d3ac Add a helper method
llvm-svn: 21486
2005-04-23 22:20:22 +00:00
Chris Lattner 8a878ccb25 Fix a bug in my previous checkin
llvm-svn: 21485
2005-04-23 22:01:39 +00:00
Chris Lattner 2908bc1e7a This file is never referenced
llvm-svn: 21484
2005-04-23 22:00:26 +00:00
Chris Lattner 6263766133 Add a method, remove last use of Type.def
llvm-svn: 21483
2005-04-23 22:00:09 +00:00
Chris Lattner 816394d7ad add a method, remove a dead #include
llvm-svn: 21482
2005-04-23 21:59:42 +00:00
Chris Lattner 6226f941b0 Types.def is going away
llvm-svn: 21481
2005-04-23 21:59:11 +00:00
Jeff Cohen 82639853c0 Eliminate tabs and trailing spaces
llvm-svn: 21480
2005-04-23 21:38:35 +00:00
Jeff Cohen 8047f13a88 Eliminate tabs and trailing spaces
llvm-svn: 21479
2005-04-23 21:26:11 +00:00
Chris Lattner 4bbf66b7a2 Propagate eq sets through the bu graphs to the cbu and eq graphs, fixing
a crash of the sfv on 188.ammp

llvm-svn: 21478
2005-04-23 21:11:05 +00:00
Chris Lattner fdfb25a9e1 add a bunch of documentation about the LLVM type resolution machinery
llvm-svn: 21475
2005-04-23 17:27:36 +00:00
Reid Spencer 7fa89cfc9b Make the CBackend actually get included in llc by using USEDLIBS instead of
USEDLIB as the variable to which "CBackend" is appended. The surrounding
if clause is safe because currently the configure script ensures that the
CBackend target is always added to TARGETS_TO_BUILD. By using a non-hard
coded construct in the makefile, we gain uniformity and the ability to
change the default set of targets by only changing the configure script.

llvm-svn: 21474
2005-04-23 17:24:33 +00:00
Chris Lattner c6ce71d434 make an advanced topics section, move symtab to it
llvm-svn: 21473
2005-04-23 16:10:52 +00:00
Chris Lattner 7eae28b9d9 This is not needed
llvm-svn: 21472
2005-04-23 16:00:27 +00:00
Chris Lattner c5ad1ca942 add a search box for the documentation
llvm-svn: 21471
2005-04-23 15:55:18 +00:00
Chris Lattner 77c32c34d7 Generalize the setcc -> PHI and Select folding optimizations to work with
any constant RHS, not just a constant integer RHS.  This implements
select.ll:test17

llvm-svn: 21470
2005-04-23 15:31:55 +00:00
Chris Lattner 64a8a7f9b7 add a new testcase
llvm-svn: 21469
2005-04-23 15:31:03 +00:00
Chris Lattner 01c81ab706 Always enable the C backend. This fixes a *vast* number of failures on the
testers last night, as llc was not getting the cbe linked in.

llvm-svn: 21468
2005-04-23 14:36:22 +00:00
Alkis Evlogimenos 0166db6529 Add method to return the type this type will be promoted to if it is
passed through a variable argument function.

llvm-svn: 21462
2005-04-23 00:11:21 +00:00
Reid Spencer 51efcefa49 Mention the --enable-targets= option to configure.
llvm-svn: 21459
2005-04-22 20:27:33 +00:00
Misha Brukman 7937b07940 * Order #includes as per style guide
* Combine multiple ``std::cerr <<'' statements into one for simplicity

llvm-svn: 21458
2005-04-22 19:13:22 +00:00
Misha Brukman fd8c2265fa Convert tabs to spaces
llvm-svn: 21457
2005-04-22 18:06:01 +00:00
Misha Brukman 36c6bc1bf4 Hyphenate the adjective `n-bit' when used to describe values and processors
llvm-svn: 21456
2005-04-22 18:02:52 +00:00
Misha Brukman d5da38c9aa Build the `Skeleton' target when building "all" targets
llvm-svn: 21455
2005-04-22 18:00:34 +00:00
Reid Spencer 1e195bdd41 Document the --enable-targets= feature of the configure script.
llvm-svn: 21454
2005-04-22 17:58:03 +00:00
Alkis Evlogimenos 7afc9558e0 Silence gcc-4.0.0 warnings.
llvm-svn: 21453
2005-04-22 17:56:01 +00:00
Misha Brukman e73e76dc42 Convert tabs to spaces
llvm-svn: 21452
2005-04-22 17:54:37 +00:00
Reid Spencer 948f453254 Don't always build CBackend and Skeleton. Make use of the TARGETS_TO_BUILD
parameter instead which will correctly list the set of targets to be built.

llvm-svn: 21451
2005-04-22 17:32:05 +00:00
Reid Spencer e4481c7c82 Implement the --enable-targets= feature of the configure script. The make
variable TARGETS_TO_BUILD is used to determine which targets in lib/Target
are built and which libraries are linked into llc. This effectively
implements the feature. One item remains: disabling targets in the dejagnu
test suite.

llvm-svn: 21450
2005-04-22 17:20:11 +00:00
Reid Spencer ce9612b23c Two changes:
1. Get rid of TOOLLINKOPTS as it is a hold over from llvm-test and only
   used to communicate additional libraries to the linker. The *standard*
   way to do that is with the LIBS variable which this change supports.

2. Allow the TARGETS_TO_BUILD variable to be set from the configuration
   substitution. This is the result of the --enable-target= parameter to
   the configure script.

llvm-svn: 21449
2005-04-22 17:14:14 +00:00
Reid Spencer 90dd65e4a7 Make sure the CBackend is always a target that is built.
llvm-svn: 21448
2005-04-22 17:06:18 +00:00
Reid Spencer e482ca8bfa Consolidate the target selection options into a single option,
--enable-target which can take values "all", "host-only" or a comma
separated list of target names (alpha,ia64,powerpc,skeleton,sparc,x86)

llvm-svn: 21447
2005-04-22 17:02:18 +00:00
Andrew Lenharth 8f4081a8c9 keep track of max depth stats
llvm-svn: 21446
2005-04-22 13:35:18 +00:00
Reid Spencer 4742804864 First step in avoiding compilation/usage of non-relevant targets. New
options have been added to the configure script that control which targets
will be used. The options are:

--enable-target-this (default=disabled)
  This will specify that the target corresponding to the build host is
  the target that will be compiled/used. You can't use this with any of
  the other options (they'll be ignored). This is what most people want.

--disable-target-x86 (default=enabled)
  This will prevent the X86 target(s) from being compiled/used.

--disable-target-sparc (default=enabled)
  This will prevent both SparcV8 and SparcV9 from being compiled/used.

--disable-target-powerpc (default=enabled)
  This will prevent the PowerPC target from being compiled/used.

--disable-target-alpha (default=enabled)
  This will prevent the Alpha target from being compiled/used.

--disable-target-ia64 (default=enabled)
  This will prevent the IA64 target from being compiled/used.

Note that without any of these options, the default behavior is to build
all targets, as is the current practice.

All these options do is set up the substititution variable TARGETS_TO_BUILD
which contains the targets that should be compiled/used. The variable is
intended to be used in the makefiles. Those changes will come later.

llvm-svn: 21445
2005-04-22 07:27:28 +00:00
Tanya Lattner 42ed14860b Updated dependence analyzer. Fixed numerous bugs. Same stage scheduling, etc.
llvm-svn: 21444
2005-04-22 06:32:48 +00:00
Chris Lattner e25cfaee55 Malloc/Free have mod/ref effects. Do not allow CSE of function calls that
call malloc/free.  This fixes PR555.

llvm-svn: 21443
2005-04-22 05:36:59 +00:00
Chris Lattner 16431f7b3c remove 'another common example', which doesn't work with VC++, and indent
another example properly

llvm-svn: 21442
2005-04-22 04:49:59 +00:00
Jeff Cohen 88e7b7288a Eliminate tabs and trailing spaces
llvm-svn: 21441
2005-04-22 04:13:13 +00:00
Misha Brukman 5191b4b2d0 Convert tabs to spaces
llvm-svn: 21440
2005-04-22 04:08:30 +00:00
Misha Brukman 774511633d Convert tabs to spaces
llvm-svn: 21439
2005-04-22 04:01:18 +00:00
Misha Brukman 1fabffbf37 Convert tabs to spaces
llvm-svn: 21438
2005-04-22 03:46:24 +00:00
Misha Brukman 4b45ec0be0 Convert tabs to spaces
llvm-svn: 21437
2005-04-22 03:35:49 +00:00
Misha Brukman 204572af9d Convert tabs to spaces
llvm-svn: 21436
2005-04-22 03:27:20 +00:00
Misha Brukman 8c0ca76517 Convert tabs to spaces
llvm-svn: 21433
2005-04-22 03:18:56 +00:00
Reid Spencer a3d4e04da8 Add the RUN: prefix to the start of the run line so this test doesn't fail.
BTW .. isn't the date on this funky? We haven't reachec 2005-05-09 yet???

llvm-svn: 21432
2005-04-22 02:49:25 +00:00
Reid Spencer 7275e3fb31 Change some old-style casts to C++ style casts to avoid warnings in XPS
compilation. This change has been waiting in the wings for a long time but
since Misha just did a global change, I figured now was the time to commit
it.

llvm-svn: 21431
2005-04-22 02:31:56 +00:00
Reid Spencer d6312210d1 There is no =head3. Convert to =head2.
llvm-svn: 21430
2005-04-22 02:16:19 +00:00
Reid Spencer 84f3911b09 Correct the documentation to match the program.
llvm-svn: 21429
2005-04-22 02:12:41 +00:00
Misha Brukman 650ba8eb56 Remove trailing whitespace
llvm-svn: 21428
2005-04-22 00:00:37 +00:00
Misha Brukman b1c9317bb4 Remove trailing whitespace
llvm-svn: 21427
2005-04-21 23:48:37 +00:00
Misha Brukman c88330ad13 * Remove trailing whitespace
* Convert tabs to spaces

llvm-svn: 21426
2005-04-21 23:38:14 +00:00
Misha Brukman b440243e94 Remove trailing whitespace
llvm-svn: 21425
2005-04-21 23:30:14 +00:00
Misha Brukman 89b8c8d215 Remove trailing whitespace
llvm-svn: 21424
2005-04-21 23:13:11 +00:00
Misha Brukman 10468d8a3c Remove trailing whitespace
llvm-svn: 21422
2005-04-21 22:55:34 +00:00
Misha Brukman 91fb9ab60b * Remove trailing whitespace
* Convert tabs to spaces

llvm-svn: 21421
2005-04-21 22:43:08 +00:00
Misha Brukman 835702a094 Remove trailing whitespace
llvm-svn: 21420
2005-04-21 22:36:52 +00:00
Misha Brukman b47d28bfe8 * Remove trailing whitespace
* Convert tabs to spaces

llvm-svn: 21418
2005-04-21 21:48:46 +00:00
Misha Brukman 2ecc34dd3c Remove trailing whitespace
llvm-svn: 21417
2005-04-21 21:44:41 +00:00
Misha Brukman 01808caded Remove trailing whitespace
llvm-svn: 21416
2005-04-21 21:13:18 +00:00
Misha Brukman 13f332cd3f * Remove trailing whitespace
* Convert tabs to spaces

llvm-svn: 21415
2005-04-21 21:10:11 +00:00
Chris Lattner 95e43ae162 Check for eqv matching
llvm-svn: 21414
2005-04-21 21:10:07 +00:00
Chris Lattner 3590ef1164 Match another form of eqv
llvm-svn: 21413
2005-04-21 21:09:11 +00:00
Misha Brukman df586aa20e Remove trailing whitespace
llvm-svn: 21412
2005-04-21 20:59:05 +00:00
Misha Brukman 95aab4ef6d Remove trailing whitespace
llvm-svn: 21411
2005-04-21 20:48:15 +00:00
Chris Lattner 5c9ef1ba2d this passes on darwin
llvm-svn: 21410
2005-04-21 20:48:08 +00:00
Misha Brukman 01230b24ae Remove trailing whitespace
llvm-svn: 21409
2005-04-21 20:39:54 +00:00
Misha Brukman 01cada8797 Remove trailing whitespace
llvm-svn: 21408
2005-04-21 20:19:05 +00:00
Chris Lattner 486a1ec909 Handle stores of global address as stores of immediates. Instead of:
test1:
        movl $N, %eax
        movl %eax, G
        ret

emit:

test1:
        movl $N, G
        ret

llvm-svn: 21407
2005-04-21 19:11:03 +00:00
Chris Lattner adcfc1748b Handle (store &GV -> mem) as a store immediate. This often occurs for
printf format strings and other stuff.  Instead of generating this:

        movl $l1__2E_str_1, %eax
        movl %eax, (%esp)

we now emit:

        movl $l1__2E_str_1, (%esp)

llvm-svn: 21406
2005-04-21 19:03:24 +00:00
Reid Spencer c8b5d60937 Use the actual uid/gid for defaulting the fields in the archive.
llvm-svn: 21405
2005-04-21 17:49:57 +00:00
Chris Lattner a3159af703 Fix a bug where we would not promote calls to invokes if they occured in
the same block as the setjmp.  Thanks to Greg Pettyjohn for noticing this!

llvm-svn: 21403
2005-04-21 16:46:46 +00:00
Reid Spencer ce7ce1628f Eliminate calls to system dependent function getuid by using
the newly implemented sys::Process::GetCurrentUserId function. Replace
similarly for getgid.

llvm-svn: 21402
2005-04-21 16:15:19 +00:00
Reid Spencer 2d45e25125 Provide an implementation of the GetCurrentUserId and GetCurrentGroupId
methods that were recently added to the interface.

llvm-svn: 21401
2005-04-21 16:12:57 +00:00
Reid Spencer 5e92ead30d Add two new methods for getting the User Id and Group Id values for the
current process.

llvm-svn: 21400
2005-04-21 16:12:04 +00:00
Chris Lattner c346bf59ee Add doxygen comments, patch contributed by Evan Jones.
llvm-svn: 21397
2005-04-21 16:10:03 +00:00
Chris Lattner 4c5c96f35f add support for taking and resolving the address of free.
llvm-svn: 21396
2005-04-21 16:09:43 +00:00
Chris Lattner 631ee94316 add support for taking the address of free.
llvm-svn: 21395
2005-04-21 16:08:59 +00:00
Chris Lattner 954c64d532 Improve doxygen, from part of Evan's patch that didn't apply.
llvm-svn: 21394
2005-04-21 16:06:03 +00:00
Chris Lattner 7ceb081f3f Improve doxygen documentation, patch contributed by Evan Jones!
llvm-svn: 21393
2005-04-21 16:04:49 +00:00
Chris Lattner f6302441f0 Improve and elimination. On PPC, for:
bool %test(int %X) {
        %Y = and int %X, 8
        %Z = setne int %Y, 0
        ret bool %Z
}

we now generate this:

        rlwinm r2, r3, 0, 28, 28
        srwi r3, r2, 3

instead of this:

        rlwinm r2, r3, 0, 28, 28
        srwi r2, r2, 3
        rlwinm r3, r2, 0, 31, 31

I'll leave it to Nate to get it down to one instruction. :)

---------------------------------------------------------------------

llvm-svn: 21391
2005-04-21 06:28:15 +00:00
Chris Lattner ab1ed77570 Fold (x & 8) != 0 and (x & 8) == 8 into (x & 8) >> 3.
This turns this PPC code:

        rlwinm r2, r3, 0, 28, 28
        cmpwi cr7, r2, 8
        mfcr r2
        rlwinm r3, r2, 31, 31, 31

into this:

        rlwinm r2, r3, 0, 28, 28
        srwi r2, r2, 3
        rlwinm r3, r2, 0, 31, 31

Next up, nuking the extra and.

llvm-svn: 21390
2005-04-21 06:12:41 +00:00
Chris Lattner 374e659466 Instcombine this:
%shortcirc_val = select bool %tmp.1, bool true, bool %tmp.4             ; <bool> [#uses=1]
        %tmp.6 = cast bool %shortcirc_val to int                ; <int> [#uses=1]

into this:

        %shortcirc_val = or bool %tmp.1, %tmp.4         ; <bool> [#uses=1]
        %tmp.6 = cast bool %shortcirc_val to int                ; <int> [#uses=1]

not this:

        %tmp.4.cast = cast bool %tmp.4 to int           ; <int> [#uses=1]
        %tmp.6 = select bool %tmp.1, int 1, int %tmp.4.cast             ; <int> [#uses=1]

llvm-svn: 21389
2005-04-21 05:43:13 +00:00
Chris Lattner b38b443b15 Teach simplifycfg that setcc is cheap and non-trapping, so that it can
convert this:

        %tmp.1 = seteq int %i, 0                ; <bool> [#uses=1]
        br bool %tmp.1, label %shortcirc_done, label %shortcirc_next

shortcirc_next:         ; preds = %entry
        %tmp.4 = seteq int %j, 0                ; <bool> [#uses=1]
        br label %shortcirc_done

shortcirc_done:         ; preds = %shortcirc_next, %entry
        %shortcirc_val = phi bool [ %tmp.4, %shortcirc_next ], [ true, %entry ]         ; <bool> [#uses=1]

to this:
        %tmp.1 = seteq int %i, 0                ; <bool> [#uses=1]
        %tmp.4 = seteq int %j, 0                ; <bool> [#uses=1]
        %shortcirc_val = select bool %tmp.1, bool true, bool %tmp.4             ; <bool> [#uses=1]

... which is later simplified by instcombine into an or.

llvm-svn: 21388
2005-04-21 05:31:13 +00:00
Chris Lattner b7848974cd Fix some broken links, taking care of PR554
llvm-svn: 21387
2005-04-21 04:53:58 +00:00
Chris Lattner 0727518f81 update to match build changes.
llvm-svn: 21386
2005-04-21 04:52:37 +00:00
Reid Spencer 8424ba373e For Bug 543:
Standardize the error messages to be in "path: what failed: why" format.
Also attempt to use the correct errno to ThrowErrno in situations where
the errno value is erased by subsequent system calls.

llvm-svn: 21385
2005-04-21 02:50:10 +00:00
Reid Spencer b02566dc1c For Bug 543:
Allow the ThrowErrno function to optionally accept an error number
parameter so that callers can specify the error number to be used.

llvm-svn: 21384
2005-04-21 02:30:32 +00:00
Misha Brukman 2f72bafb60 Remove trailing whitespace at the end of lines
llvm-svn: 21380
2005-04-20 16:42:34 +00:00
Misha Brukman ea548c0cb1 Remove trailing whitespace, patch by Markus Oberhumer.
llvm-svn: 21379
2005-04-20 16:05:03 +00:00
Misha Brukman 5e7bac21d5 Add FIXME by Markus Oberhumer from bug 545: not checking for "." in $PATH may
result in returning executable files that won't be runnable.

llvm-svn: 21378
2005-04-20 15:42:11 +00:00
Misha Brukman a9a8c1b65b Do not mark directories as `executable', we only want program files
Patch by Markus Oberhumer.

llvm-svn: 21377
2005-04-20 15:33:22 +00:00
Misha Brukman ee6770f1a3 #include system headers after all LLVM headers
llvm-svn: 21374
2005-04-20 04:51:29 +00:00
Misha Brukman 17092bd0a4 Eliminate trailing spaces at end-of-line
llvm-svn: 21372
2005-04-20 04:08:35 +00:00
Misha Brukman 3f4fe46796 Consistently eschew space between `*' or `&' and function argument name
llvm-svn: 21371
2005-04-20 04:07:47 +00:00
Misha Brukman 1001aea4d3 Ignore dangling symlinks in getDirectoryContents()
Thanks to Markus Oberhumer for the patch!

llvm-svn: 21370
2005-04-20 04:04:07 +00:00
Misha Brukman 8cd50bf269 Initialize fields mode, uid, and gid.
Patch by Markus Oberhumer.  Thanks!

llvm-svn: 21369
2005-04-20 03:55:35 +00:00
Misha Brukman bebcaeb816 Align comments together for consistency
llvm-svn: 21368
2005-04-20 03:52:59 +00:00
Misha Brukman 64a8c3ed91 * Print commands as we execute them with `-v'
* Add option `-save-temps'
Patch contributed by Markus Oberhumer.

llvm-svn: 21367
2005-04-20 03:22:18 +00:00
Chris Lattner 8cb10a1775 Wrap some long lines.
Make IPSCCP strip off dead constant exprs that are using functions, making
them appear as though their address is taken.  This allows us to propagate
some more pool descriptors, lowering the overhead of pool alloc.

llvm-svn: 21363
2005-04-19 19:16:19 +00:00
Chris Lattner 14db4a2895 ignore generated files
llvm-svn: 21362
2005-04-19 15:34:36 +00:00
Chris Lattner b17483028f fix bogus warning
llvm-svn: 21361
2005-04-19 15:32:30 +00:00
Chris Lattner 07ad98dbe2 fix PR549
llvm-svn: 21360
2005-04-19 15:27:29 +00:00
Chris Lattner 181c818373 Bug fixed
llvm-svn: 21355
2005-04-19 06:08:04 +00:00
Chris Lattner 5c219469a0 Eliminate a broken transformation, fixing PR548
llvm-svn: 21354
2005-04-19 06:04:18 +00:00
Chris Lattner 53c40624f9 Add completely untested support for mtcrf/mfcrf encoding
llvm-svn: 21353
2005-04-19 05:41:52 +00:00
Chris Lattner baa9be572b switch over the rest of the formats that use RC to use isDOT
llvm-svn: 21352
2005-04-19 05:21:30 +00:00
Chris Lattner f9172e14c9 Convert the XForm instrs and XSForm instruction over to use isDOT
llvm-svn: 21351
2005-04-19 05:15:18 +00:00
Chris Lattner 5b78da4571 Now that the ppc64 and vmx operands of I are always 0, forward substitute
them away.

llvm-svn: 21350
2005-04-19 05:05:22 +00:00
Chris Lattner 116a9e5a34 convert over bform and iform instructions
llvm-svn: 21349
2005-04-19 05:00:59 +00:00
Chris Lattner b2367e398e Convert over DForm and DSForm instructions
llvm-svn: 21348
2005-04-19 04:59:28 +00:00
Chris Lattner 15709c2c33 Convert XLForm and XForm instructions over to use PPC64 when appropriate.
llvm-svn: 21347
2005-04-19 04:51:30 +00:00
Chris Lattner d790d22f22 Convert XO XS and XFX forms to use isPPC64
llvm-svn: 21346
2005-04-19 04:40:07 +00:00
Chris Lattner c7cb8c77fb Turn PPC64 and VMX into classes that can be added to instructions instead of
bits that must be passed up the inheritance hierarchy.  Convert MForm and AForm
instructions over

llvm-svn: 21345
2005-04-19 04:32:54 +00:00
Chris Lattner ef94374a1c Major change to tblgen: instead of resolving values every time a class is
finished up, only resolve fully when the def is defined.  This allows things
to be changed and all uses to be propagated through.  This implements
TableGen/LazyChange.td and fixes TemplateArgRename.td in the process.

None of the .td files used in LLVM backends are changed at all by this
patch.

llvm-svn: 21344
2005-04-19 03:36:21 +00:00
Chris Lattner ab77740715 New testcase for a changing values late and allowing them to propagate
llvm-svn: 21343
2005-04-19 03:34:58 +00:00
Chris Lattner d90d566dee Make this significantly harder
llvm-svn: 21342
2005-04-19 02:58:57 +00:00
Chris Lattner 17bd7c5a88 Add a real run line
llvm-svn: 21341
2005-04-19 02:53:26 +00:00
Chris Lattner c00f712fc0 fix this testcase
llvm-svn: 21340
2005-04-19 02:52:04 +00:00
Chris Lattner 2b76da7d1f new testcase
llvm-svn: 21339
2005-04-19 02:26:23 +00:00
Chris Lattner f2fab50974 add a run line
llvm-svn: 21338
2005-04-19 01:37:24 +00:00
Chris Lattner ed8335e35b Tell dj to run the tests in this directory
llvm-svn: 21337
2005-04-19 01:36:41 +00:00
Chris Lattner 3ff0e11294 implementing shifting of literal integers
llvm-svn: 21336
2005-04-19 01:17:35 +00:00
Chris Lattner 101fc501d0 Add initial lexer and parser support for shifting values. Every use of this
will lead to it being rejected though.

llvm-svn: 21335
2005-04-19 01:11:03 +00:00
Nate Begeman 2331c061ee Next round of PPC CR optimizations. For the following code:
int %bar(float %a, float %b, float %c, float %d) {
entry:
    %tmp.1 = setlt float %a, %d
    %tmp.2 = setlt float %b, %d
    %or = or bool %tmp.1, %tmp.2
    %tmp.3 = setgt float %c, %d
    %tmp.4 = or bool %or, %tmp.3
    %tmp.5 = and bool %tmp.4, true
    %retval = cast bool %tmp.5 to int
    ret int %retval
}

We now emit:

_bar:
.LBB_bar_0:     ; entry
        fcmpu cr0, f1, f4
        fcmpu cr1, f2, f4
        cror 0, 0, 4
        fcmpu cr1, f3, f4
        cror 28, 0, 5
        mfcr r2
        rlwinm r3, r2, 29, 31, 31
        blr

Instead of:

_bar:
.LBB_bar_0:     ; entry
        fcmpu cr7, f1, f4
        mfcr r2
        rlwinm r2, r2, 29, 31, 31
        fcmpu cr7, f2, f4
        mfcr r3
        rlwinm r3, r3, 29, 31, 31
        or r2, r2, r3
        fcmpu cr7, f3, f4
        mfcr r3
        rlwinm r3, r3, 30, 31, 31
        or r3, r2, r3
        blr

llvm-svn: 21321
2005-04-18 07:48:09 +00:00
Chris Lattner ee84413730 silence a bogus warning
llvm-svn: 21320
2005-04-18 05:26:21 +00:00
Chris Lattner b61ecb5875 Fold setcc of MVT::i1 operands into logical operations
llvm-svn: 21319
2005-04-18 04:48:12 +00:00
Chris Lattner 6d40fd01fe Another minor simplification: handle setcc (zero_extend x), c -> setcc(x, c')
llvm-svn: 21318
2005-04-18 04:30:45 +00:00
Chris Lattner 868d473009 Another simple xform
llvm-svn: 21317
2005-04-18 04:11:19 +00:00
Chris Lattner bd22d83d15 Fold:
// (X != 0) | (Y != 0) -> (X|Y != 0)
        // (X == 0) & (Y == 0) -> (X|Y == 0)

Compiling this:

int %bar(int %a, int %b) {
        entry:
        %tmp.1 = setne int %a, 0
        %tmp.2 = setne int %b, 0
        %tmp.3 = or bool %tmp.1, %tmp.2
        %retval = cast bool %tmp.3 to int
        ret int %retval
        }

to this:

_bar:
        or r2, r3, r4
        addic r3, r2, -1
        subfe r3, r3, r2
        blr

instead of:

_bar:
        addic r2, r3, -1
        subfe r2, r2, r3
        addic r3, r4, -1
        subfe r3, r3, r4
        or r3, r2, r3
        blr

llvm-svn: 21316
2005-04-18 03:59:53 +00:00
Chris Lattner d929f8bcd3 Make the AND elimination operation recursive and significantly more powerful,
eliminating an and for Nate's testcase:

int %bar(int %a, int %b) {
        entry:
        %tmp.1 = setne int %a, 0
        %tmp.2 = setne int %b, 0
        %tmp.3 = or bool %tmp.1, %tmp.2
        %retval = cast bool %tmp.3 to int
        ret int %retval
        }

generating:

_bar:
        addic r2, r3, -1
        subfe r2, r2, r3
        addic r3, r4, -1
        subfe r3, r3, r4
        or r3, r2, r3
        blr

instead of:

_bar:
        addic r2, r3, -1
        subfe r2, r2, r3
        addic r3, r4, -1
        subfe r3, r3, r4
        or r2, r2, r3
        rlwinm r3, r2, 0, 31, 31
        blr

llvm-svn: 21315
2005-04-18 03:48:41 +00:00
Nate Begeman 602a45f415 Change codegen for setcc to read the bit directly out of the condition
register.  Added support in the .td file for the g5-specific variant
  of cr -> gpr moves that executes faster, but we currently don't
  generate it.

llvm-svn: 21314
2005-04-18 02:43:24 +00:00
Chris Lattner ed5189da51 Add support for targets that require stubs for external functions.
llvm-svn: 21313
2005-04-18 01:44:27 +00:00
Chris Lattner f281f791b5 Handle ExternalSymbol operands in the PPC JIT
llvm-svn: 21312
2005-04-18 00:46:10 +00:00
Nate Begeman f24225d4d7 Update dejagnu tests to use the new pattern isel flag
llvm-svn: 21311
2005-04-16 04:25:48 +00:00
Jeff Cohen df4f480498 Add CondPropagate.cpp to VC++ Transforms project
llvm-svn: 21310
2005-04-16 02:51:44 +00:00
Nate Begeman 779c5cbb44 Make pattern isel default for ppc
Add new ppc beta option related to using condition registers
Make pattern isel control flag (-enable-pattern-isel) global and tristate
  0 == off
  1 == on
  2 == target default

llvm-svn: 21309
2005-04-15 22:12:16 +00:00
Chris Lattner e0a9d042e2 new pass
llvm-svn: 21307
2005-04-15 21:13:16 +00:00
Chris Lattner 16a50fd0a0 a new simple pass, which will be extended to be more useful in the future.
This pass forward branches through conditions when it can show that the
conditions is either always true or false for a predecessor.  This currently
only handles the most simple cases of this, but is successful at threading
across 2489 branches and 65 switch instructions in 176.gcc, which isn't bad.

llvm-svn: 21306
2005-04-15 19:28:32 +00:00
Chris Lattner d041242256 add a new prototype
llvm-svn: 21305
2005-04-15 19:24:49 +00:00
Chris Lattner 8579c2c474 new testcase
llvm-svn: 21304
2005-04-15 19:24:36 +00:00
Andrew Lenharth 00ce283b3f fix calls
llvm-svn: 21303
2005-04-14 17:34:20 +00:00
Andrew Lenharth 7ae3aba5aa a 21264 fix, and fix the operator precidence on an and -> zap check (should fix hundreds of test cases
llvm-svn: 21302
2005-04-14 16:24:00 +00:00
Andrew Lenharth 10b7bceb8e added a random and mask test
llvm-svn: 21301
2005-04-14 16:17:49 +00:00
Duraid Madina 0a7c2b9078 print negative 64 bit immediates as negative numbers, makes things a little
easier on the eyes, not that numbers like 18446744073709541376 are bad or
anything

llvm-svn: 21300
2005-04-14 10:08:01 +00:00
Duraid Madina dfbbcc098b oops, this stopped us turning movl r4=0xFFFFFFFF;; and rX, r4 into zxt4
llvm-svn: 21299
2005-04-14 10:06:35 +00:00
Nate Begeman 53d3eccbe2 Implement multi-way branches through logical ops on condition registers.
This can generate considerably shorter code, reducing the size of crafty
by almost 1%.  Also fix the printing of mcrf.  The code is currently
disabled until it gets a bit more testing, but should work as-is.

llvm-svn: 21298
2005-04-14 09:45:08 +00:00
Nate Begeman 80c095f422 Add a couple missing transforms in getSetCC that were triggering assertions
in the PPC Pattern ISel

llvm-svn: 21297
2005-04-14 08:56:52 +00:00
Duraid Madina f6b666fb06 we have zextloads, not sextloads!
llvm-svn: 21296
2005-04-14 08:37:32 +00:00
Nate Begeman 65a82c562e Add the necessary support to codegen condition register logical ops with
register allocated condition registers.  Make sure that the printed
  output is gas compatible.

llvm-svn: 21295
2005-04-14 03:20:38 +00:00
Nate Begeman be21011911 Start allocating condition registers. Almost all explicit uses of CR0 are
now gone.  Next step is to get rid of the remaining ones and then start
allocating bools to CRs where appropriate.

llvm-svn: 21294
2005-04-13 23:15:44 +00:00