Commit Graph

6813 Commits

Author SHA1 Message Date
Vikram S. Adve 49155b50ba Include vector into these two files to ensure that specializations like
stl_bvector.h are correctly included into *anything* that includes hash_map
or hash_set.  ext/hash_map includes stl_vector.h directly and leaves
out the specializations, causing truly nasty bugs due to inconsistent
versions of vector<> being used for vector<bool> in different files.

llvm-svn: 7303
2003-07-25 14:06:13 +00:00
Misha Brukman 0fd3172754 Made a bunch of cleanups, as per Chris' recommendations:
* Removed unused global and member variables
* Fixed comments (CodeGeneratorBug.cpp)
* Check for possibly failing GCC::create() and CBE::create()
* Remove generated files after diffing the output (e.g., shared object)
* Instead of using std::for_each, use explicit loops as std::for_each may
  duplicate the functor, and ours carries state
* Changed member var from cl::opt<std::string> to just std::string
* Fixed doxygen comments
* Fixed string comparisons to use [ str.empty() ] instead of [ str == "" ]
* Cache instances of CBE and GCC in BugDriver across compilations and executions
  while testing tools.

llvm-svn: 7302
2003-07-24 21:59:10 +00:00
Brian Gaeke 356f3289fe Cleanups:
Mangler.cpp: Constify parameter to makeNameProper, and use const_iterator.
 Make Count an unsigned int, and use utostr().
 Don't name parameters things that start with underscore.
Mangler.h: All of the above, and also: Add Emacs mode-line.  Include <set>.

llvm-svn: 7301
2003-07-24 21:37:57 +00:00
Brian Gaeke d4dff190a4 Factor out name-mangling from X86/Printer, which is derived from CWriter,
into this new support class.

llvm-svn: 7300
2003-07-24 20:20:58 +00:00
Brian Gaeke 46f8b71376 Use unified CWriter-X86/Printer name mangler. Do not bother using
SlotCalculator in CWriter.  (Unfortunately, all this means a lot of
X86/Printer's methods have to be de-constified again.  Oh well.)

llvm-svn: 7299
2003-07-24 20:20:44 +00:00
Chris Lattner daff644d47 More testcases, which I'll implement later
llvm-svn: 7298
2003-07-24 19:44:51 +00:00
Chris Lattner 4f6a4119c3 Modernize testcase
llvm-svn: 7297
2003-07-24 19:42:28 +00:00
Chris Lattner 6dc37abe72 New testcase
llvm-svn: 7296
2003-07-24 19:31:08 +00:00
Chris Lattner ab780dfab5 Instcombine: (A >> c1) << c2 for signed integers
llvm-svn: 7295
2003-07-24 18:38:56 +00:00
Chris Lattner 9e2dc8924a New testcases for signed shifts
llvm-svn: 7294
2003-07-24 18:38:09 +00:00
Misha Brukman d792c9bb46 Major addition to bugpoint: ability to debug code generators (LLC and LLI).
The C backend is assumed correct and is used to generate shared objects to be
loaded by the other two code generators.

LLC debugging should be functional now, LLI needs a few more additions to work,
the major one is renaming of external functions to call the JIT lazy function
resolver.

Bugpoint now has a command-line switch -mode with options 'compile' and
'codegen' to debug appropriate portions of tools.

ExecutionDriver.cpp: Added implementations of AbstractInterpreter for LLC and
GCC, broke out common code within other tools, and added ability to generate C
code with CBE individually, without executing the program, and the GCC tool can
generate executables shared objects or executables.

If no reference output is specified to Bugpoint, it will be generated with CBE,
because it is already assumed to be correct for the purposes of debugging using
this method. As a result, many functions now accept as an optional parameter a
shared object to be loaded in, if specified.

llvm-svn: 7293
2003-07-24 18:17:43 +00:00
Chris Lattner 3204d4ed4e Reorganization of code, no functional changes.
Now it shoudl be a bit more efficient

llvm-svn: 7292
2003-07-24 17:52:58 +00:00
Brian Gaeke 0054c3b5b3 It doesn't appear that we need to #include these.
llvm-svn: 7291
2003-07-24 17:48:53 +00:00
Chris Lattner dfae8be3c9 Allow folding several instructions into casts, which can simplify a lot
of codes.  For example,
short kernel (short t1) {
  t1 >>= 8; t1 <<= 8;
  return t1;
}

became:

short %kernel(short %t1.1) {
        %tmp.3 = shr short %t1.1, ubyte 8               ; <short> [#uses=1]
        %tmp.5 = cast short %tmp.3 to int               ; <int> [#uses=1]
        %tmp.7 = shl int %tmp.5, ubyte 8                ; <int> [#uses=1]
        %tmp.8 = cast int %tmp.7 to short               ; <short> [#uses=1]
        ret short %tmp.8
}

before, now it becomes:
short %kernel(short %t1.1) {
        %tmp.3 = shr short %t1.1, ubyte 8               ; <short> [#uses=1]
        %tmp.8 = shl short %tmp.3, ubyte 8              ; <short> [#uses=1]
        ret short %tmp.8
}

which will become:
short %kernel(short %t1.1) {
        %tmp.3 = and short %t1.1, 0xFF00
        ret short %tmp.3
}

This implements cast-set.ll:test4 and test5

llvm-svn: 7290
2003-07-24 17:35:25 +00:00
Chris Lattner 727c03a665 Minor cleanups
llvm-svn: 7289
2003-07-24 17:31:56 +00:00
Brian Gaeke 391f69b0ff Constify most methods. We could have constified doInitialization and
doFinalization too except that would have made them shadow, not override,
the parent class :-P.

Allow *any* constant cast expression between pointers and longs,
or vice-versa, or any widening (not just same-size) conversion that
isLosslesslyConvertibleTo approves. This fixes oopack.

llvm-svn: 7288
2003-07-24 17:30:45 +00:00
Chris Lattner 256e28f916 Disable sample project until it works
llvm-svn: 7287
2003-07-23 23:28:57 +00:00
Chris Lattner 14f7522071 Add new tests, make existing tests more difficult
llvm-svn: 7286
2003-07-23 23:21:08 +00:00
Chris Lattner e9340228c9 Fix bug: FunctionResolve/2003-07-23-CPR-Reference.ll
This fixes a long time annoyance which caused prototypes for bzero, bcopy,
bcmp, fputs, and fputs_unlocked to never get deleted.  Grr.

llvm-svn: 7285
2003-07-23 22:03:18 +00:00
Chris Lattner 092fb6c66c New testcase
llvm-svn: 7284
2003-07-23 22:02:39 +00:00
Chris Lattner bfb1d03159 Add comments
llvm-svn: 7283
2003-07-23 21:41:57 +00:00
Chris Lattner 9763859e8d Remove explicit check for: not (not X) = X, it is already handled because xor is commutative
- InstCombine: (X & C1) ^ C2 --> (X & C1) | C2 iff (C1&C2) == 0
  - InstCombine: (X | C1) ^ C2 --> (X | C1) & ~C2 iff (C1&C2) == C2

llvm-svn: 7282
2003-07-23 21:37:07 +00:00
Chris Lattner 2326ef6484 New testcases
llvm-svn: 7281
2003-07-23 21:36:01 +00:00
Chris Lattner fbfe819ec6 Renumber tests sequentially
llvm-svn: 7280
2003-07-23 21:11:56 +00:00
Chris Lattner 2cc064c96f Split the or and xor tests into two separate files
llvm-svn: 7279
2003-07-23 21:10:55 +00:00
Chris Lattner 177cc120f9 Remove obscure test
llvm-svn: 7278
2003-07-23 21:06:34 +00:00
Chris Lattner 8820aaf1e6 Check in old testcase sitting in my tree
llvm-svn: 7277
2003-07-23 20:48:03 +00:00
Chris Lattner bbc2bc1790 Fix program: SingleSource/UnitTests/2003-07-09-SignedArgs with the CBE
llvm-svn: 7276
2003-07-23 20:45:31 +00:00
Brian Gaeke a92dce471b Printer.cpp: Ditch addRequired/getAnalysis, because they leave
Printer::doFinalization() out in the cold.  Now we pass in a TargetMachine
  to Printer's constructor and get the TargetData from the TargetMachine.
 Don't pass TargetMachine or MRegisterInfo objects around in the Printer.
 Constify TargetData references.
X86.h: Update comment and prototype of createX86CodePrinterPass().
X86TargetMachine.cpp: Update callers of createX86CodePrinterPass().

llvm-svn: 7275
2003-07-23 20:25:08 +00:00
Chris Lattner 4b4dacd838 Make Module::getNamedFunction prefer non-external functions if there is more than
one function of the same name

llvm-svn: 7274
2003-07-23 20:21:30 +00:00
Chris Lattner 1442020798 Fix space
llvm-svn: 7273
2003-07-23 20:21:06 +00:00
Chris Lattner 33217db4d9 InstCombine: (X ^ C1) & C2 --> (X & C2) iff (C1&C2) == 0
llvm-svn: 7272
2003-07-23 19:36:21 +00:00
Chris Lattner b69f30c115 New testcase
llvm-svn: 7271
2003-07-23 19:35:51 +00:00
Chris Lattner 16464b36ff - InstCombine: (X | C1) & C2 --> X & C2 iff C1 & C1 == 0
- InstCombine: (X | C) & C --> C
  - InstCombine: (X | C1) & C2 --> (X | (C1&C2)) & C2

llvm-svn: 7269
2003-07-23 19:25:52 +00:00
Chris Lattner fcd1efbbc0 New testcase
llvm-svn: 7267
2003-07-23 19:24:34 +00:00
Chris Lattner a439aaf71e New testcase
llvm-svn: 7266
2003-07-23 19:05:29 +00:00
Brian Gaeke c3998cb090 Add, rewrite, and/or reformat many comments.
Stop passing ostreams around: we already have one perfectly good ostream
and we can all share it.

Stop stashing a pointer to TargetData in the Pass object, because that will
lead to a crash if there are no functions in the module (ouch!)  Instead,
use addRequired() and getAnalysis(), like we always should have done.

Move the check for ConstantExpr up before the check for isPrimitiveType,
because we need to be able to catch e.g. ubyte (cast bool false to ubyte),
whose type is primitive but which is nevertheless a ConstantExpr, by calling
our specialized handler instead of the AsmWriter. This would result in
assembler errors when we would try to output something like ".byte (cast
bool false to ubyte)".

GC some unused variable declarations.

llvm-svn: 7265
2003-07-23 18:37:06 +00:00
Chris Lattner 8f0d15601a IC: (X & C1) | C2 --> (X | C2) & (C1|C2)
IC: (X ^ C1) | C2 --> (X | C2) ^ (C1&~C2)

We are now guaranteed that all 'or's will be inside of 'and's, and all 'and's
will be inside of 'xor's, if the second operands are constants.

llvm-svn: 7264
2003-07-23 18:29:44 +00:00
Chris Lattner d5663230b4 New testcases
llvm-svn: 7263
2003-07-23 18:28:42 +00:00
Chris Lattner 49b47ae565 IC: (X ^ C1) & C2 --> (X & C2) ^ (C1&C2)
Minor code cleanup

llvm-svn: 7262
2003-07-23 17:57:01 +00:00
Chris Lattner aeef93ccdb New testcase
llvm-svn: 7261
2003-07-23 17:56:34 +00:00
Chris Lattner cfbce7c880 InstCombine: (X ^ 4) == 8 --> X == 12
llvm-svn: 7260
2003-07-23 17:26:36 +00:00
Chris Lattner 2309b410f3 New testcase
llvm-svn: 7259
2003-07-23 17:25:55 +00:00
Chris Lattner 0fa0e3f2ea Add support for ~ operator on constants
llvm-svn: 7258
2003-07-23 17:21:17 +00:00
Chris Lattner d492a0b7b4 IC: (X & 5) == 13 --> false
IC: (X | 8) == 4  --> false

llvm-svn: 7257
2003-07-23 17:02:11 +00:00
Chris Lattner a4f252d0fe New tests
llvm-svn: 7256
2003-07-23 17:01:18 +00:00
John Criswell 8d3a83cef7 Renamed libtool to mklib for your tab completion pleasure.
llvm-svn: 7255
2003-07-23 16:52:50 +00:00
Chris Lattner 625eef3e41 Remove redundant const qualifier
llvm-svn: 7254
2003-07-23 15:30:32 +00:00
Chris Lattner f26a8ee580 Remove redundant const qualifiers from cast<> expressions
llvm-svn: 7253
2003-07-23 15:30:06 +00:00
Chris Lattner 6077c3195f Simplify code by using ConstantInt::getRawValue instead of checking to see
whether the constant is signed or unsigned, then casting

llvm-svn: 7252
2003-07-23 15:22:26 +00:00
Chris Lattner 79f22fe02f Remove unnecessary casts
llvm-svn: 7250
2003-07-23 15:17:51 +00:00
Chris Lattner 3bc9b251b9 Fit code into 80 columns
llvm-svn: 7249
2003-07-23 15:17:01 +00:00
Chris Lattner 23801c571e Eliminate old-style cast
llvm-svn: 7248
2003-07-23 15:16:40 +00:00
Chris Lattner b976da9ecf Random cleanups
llvm-svn: 7247
2003-07-23 14:59:40 +00:00
Chris Lattner 0470412961 Remove using decl
llvm-svn: 7246
2003-07-23 14:55:59 +00:00
Chris Lattner c5372125b9 Remove explicit const qualifiers
llvm-svn: 7245
2003-07-23 14:54:33 +00:00
Chris Lattner dc4016b44c Add more doxygen comments, add new ConstantInt::getRawValue method
llvm-svn: 7244
2003-07-23 14:49:06 +00:00
Chris Lattner d78ebd0c6b Fix bug: TailDup/2003-07-22-InfiniteLoop.ll
llvm-svn: 7243
2003-07-23 03:32:41 +00:00
Chris Lattner 96b9038998 New testcase that caused infinite loop in taildup
llvm-svn: 7242
2003-07-23 03:32:11 +00:00
Chris Lattner bdb0ce0605 - InstCombine (cast (xor A, B) to bool) ==> (setne A, B)
- InstCombine (cast (and X, (1 << size(X)-1)) to bool) ==> x < 0

llvm-svn: 7241
2003-07-22 21:46:59 +00:00
Chris Lattner 9af9880ddc New testcases
llvm-svn: 7240
2003-07-22 21:44:06 +00:00
John Criswell b65ddad4f4 Repaired the --enable and --disable options.
llvm-svn: 7239
2003-07-22 21:00:24 +00:00
John Criswell 5ec24d8733 Fixed the enable/disable options. The AC_ARG_ENABLE macro does not perform
the *action-if-not-given* code when the --disable option is used.
Rather, the AC_ARG_ENABLE macro sets the $enableval variable, which then needs
to be checked to determine if --enable, --disable, or neither was specified.

llvm-svn: 7238
2003-07-22 20:59:52 +00:00
Brian Gaeke 673ef4d7fb Add documentation for runOnMachineFunction()
llvm-svn: 7237
2003-07-22 20:53:20 +00:00
John Criswell cc0e805844 Made some corrections to the enable-llc_diffs option.
This should keep it from breaking for now.

llvm-svn: 7236
2003-07-22 20:07:49 +00:00
John Criswell c933eeb12b Generated a new configure script.
This script uses files within the new autoconf subdirectory and includes
changes from Brian Gaeke's recent changes to configure.ac.

llvm-svn: 7235
2003-07-22 19:18:09 +00:00
John Criswell 59bd6d6b9f Updated to use files within the autoconf subdirectory.
llvm-svn: 7234
2003-07-22 19:17:35 +00:00
John Criswell 7a3334d518 These are the autoconf files in their new home.
llvm-svn: 7233
2003-07-22 19:13:20 +00:00
John Criswell c0ffad16e0 Moving these files to the llvm/autoconf directory.
llvm-svn: 7232
2003-07-22 19:12:02 +00:00
John Criswell d92168a56f Moved configure.ac to the autoconf directory.
llvm-svn: 7231
2003-07-22 19:10:58 +00:00
Brian Gaeke a0a339af04 turn off DISABLE_LLC_DIFFS for x86.
llvm-svn: 7230
2003-07-22 18:28:17 +00:00
Chris Lattner 4f22f7e7d0 Add new testcase
llvm-svn: 7229
2003-07-22 16:18:09 +00:00
Vikram S. Adve c3c1a9ccdc (1) Pass 'VAR=string' arguments to gmake
(2) Detect LLVMDIR using the LEVEL variable in Makefile.
(3) To perform #2 propertly, use the same Makefile search rules as gmake.

llvm-svn: 7228
2003-07-22 12:35:28 +00:00
Vikram S. Adve eb04c29378 Fix comment.
llvm-svn: 7227
2003-07-22 12:08:58 +00:00
John Criswell ed81b4f310 Updated from the discussion on July 21, 2003.
Expanded upon testing priorities.

llvm-svn: 7225
2003-07-21 22:22:48 +00:00
Misha Brukman 6a6587ab02 Fixed misspelling.
llvm-svn: 7223
2003-07-21 21:58:16 +00:00
Chris Lattner c783297812 Simplify code a bit
llvm-svn: 7217
2003-07-21 19:56:49 +00:00
John Criswell d6dcbc6ce8 Added code that checks to see if a global variable is external before replacing
a load of the global variable with the variable's constant value.

llvm-svn: 7216
2003-07-21 19:42:57 +00:00
John Criswell 57886cb4da Regression test for the Instruction Combining optimizization.
This test helps to see if the optimization correctly handles variables that
are declared constant and external.

llvm-svn: 7215
2003-07-21 19:41:51 +00:00
Chris Lattner 37dc32a4b2 Remove unneccesary #ifdefs
llvm-svn: 7214
2003-07-21 19:23:31 +00:00
Chris Lattner 4d52e214bb Fix warnings
llvm-svn: 7213
2003-07-21 19:20:44 +00:00
Chris Lattner 361e9c8b97 Remove instloops library
llvm-svn: 7210
2003-07-21 19:07:27 +00:00
Misha Brukman 96c8d59c9c Eliminated dead code.
llvm-svn: 7209
2003-07-21 16:34:35 +00:00
Anand Shukla bd2d0577fb Added special consideration for instrumentation strategy
llvm-svn: 7208
2003-07-20 15:39:30 +00:00
Misha Brukman 63e14b5a4a Initialize the target architecture based on compiler defines, so if compiled on
x86 or Sparc, LLC will automatically default to that platform, no guessing
required. On another platform, it will default to `noarch' and will have to
guess which architecture to compile to.

llvm-svn: 7207
2003-07-18 22:21:40 +00:00
Anand Shukla 1db75a0f7c Added check for inlinable function
llvm-svn: 7206
2003-07-18 20:55:26 +00:00
Brian Gaeke 26bb3c1df6 Please, save your applause^H^H^H^H^H^H^H^Hflames for the end...
Avoid a fall-through in the (stubby) treatment of the longjmp intrinsic
call which causes llc & lli to core-dump.

Add a sort-of treatment of cast double to ulong. I am not really sure
what a user should expect to see upon casting a negative FP value to
unsigned long long. But with what is given here, I was able to write
a program that could cast -123.456 to ulong and back and get -123.0,
which seems like a step in the right direction.  GCC seems to give you
0. I don't know if I'd consider that useful.

These cases were coming up in GNU coreutils-5.0.

llvm-svn: 7205
2003-07-18 20:23:43 +00:00
Misha Brukman 1f6feb7bf4 Cleaned up the code which chooses the appropriate value for the file descriptor
to pass to dlsym() -- Linux/x86 wants 0 while Sparc/Solaris wants RTLD_SELF,
which is not zero. Thanks to Chris for the suggestion.

llvm-svn: 7204
2003-07-18 18:33:38 +00:00
Misha Brukman ba943afa97 Added a DEBUG() guard to a debug information printout.
llvm-svn: 7203
2003-07-18 18:03:45 +00:00
Anand Shukla 6d79113343 Added pass to instrument backedges for lightweight tracing
llvm-svn: 7202
2003-07-18 16:25:40 +00:00
Anand Shukla 89233e1c9a A pass to combine multiple backedges that go to same target
llvm-svn: 7201
2003-07-18 16:08:32 +00:00
Brian Gaeke ac7c5a5241 Use getClassB for load and store; we don't want to abort when we
try to load or store through a bool*.

llvm-svn: 7195
2003-07-17 21:30:06 +00:00
Brian Gaeke c55a920283 Fix typo in call to isUnresolvableFunc, which was breaking the build.
llvm-svn: 7194
2003-07-17 19:07:46 +00:00
John Criswell 0643ceafcf Dinakar and I fixed a bug where we were trying to get the initializer of
an external constant.  Since external constants don't have initializers, we
were failing on an assert() call in llvm/GlobalVariable.h.

llvm-svn: 7193
2003-07-17 19:06:55 +00:00
Brian Gaeke 110f07b5fe Added bits about MachineFunctionPass
llvm-svn: 7192
2003-07-17 18:53:20 +00:00
Vikram S. Adve aa694a6f47 Tests for globals with different kinds of behavior in DS Analysis.
llvm-svn: 7191
2003-07-16 21:48:38 +00:00
Vikram S. Adve d3bf70c006 (1) Added DSGraph::cloneReachableSubgraph and DSGraph::cloneReachableNodes
to clone the subgraph reachable from a set of root nodes, into the
    current graph, merging the global nodes into those in the current graph.
(2) Added DSGraph::updateFromGlobalGraph() to rematerialize nodes from the
    globals graph into the current graph in both BU and TD passes.
(3) Added hash_set<const GlobalValue*> InlinedGlobals: a set of globals to
    track which globals have been inlined into the current graph from
    callers or callees.  In the TD pass, such globals are up-to-date and
    do not need to be rematerialized from the GlobalsGraph.
(4) Added StripIncompleteBit/KeepIncompleteBit to remove incomplete bit
    when cloning nodes into the globals graph.

llvm-svn: 7190
2003-07-16 21:45:15 +00:00
Vikram S. Adve cf01ed5f75 Rematerialize nodes from the globals graph into the current graph
after all callees are inlined into the current graph.

NOTE: There's also a major bug fix for the BU pass in DataStructure.cpp,
which ensures that resolvable indirect calls are not moved out to the
globals graph, so that they are eventually inlined (if possible).

llvm-svn: 7189
2003-07-16 21:42:03 +00:00
Vikram S. Adve 03be4a96f3 (1) Rematerialize nodes from the globals graph into the current graph
after all callers are inlined into the current graph.
(2) Optimize the way a graph is inlined into its callees in the TD phase:
    (a) Use DSGraph::cloneReachableSubgraph to clone only a subgraph at
        each call site, for faster inlining.
    (b) Clone separately for the same callee at different call sites,
        since only the reachable subgraph is being cloned, not the entire
        caller graph.

llvm-svn: 7188
2003-07-16 21:40:28 +00:00
Vikram S. Adve dce6694ff4 Implement 2 important changes: (1) rematerialization from the globals graph,
and (2) faster inlining by cloning only reachable nodes.  In particular:
(1) Added DSGraph::cloneReachableSubgraph and DSGraph::cloneReachableNodes
    to clone the subgraph reachable from a set of root nodes, into the
    current graph, merging the global nodes into thos in the current graph.
    The TD pass now uses this for faster inlining, and so does the
    next function.
(2) Added DSGraph::updateFromGlobalGraph() to rematerialize nodes from the
    globals graph into the current graph in both BU and TD passes.
(3) `I' flags are removed from all nodes in the globals graph, because they
    are difficult to maintain correctly and are not needed anyway.
(4) Aux. function calls are only removed to the globals graph if they
    will never be resovled.  (This is what fixed gap.)  The immediate
    reason is that if we took these out of a function (and moved them to
    the globals graph) we would need to rematerialize these nodes into the
    function graph for every function in the BU pass.  The longer term
    problem is that we would need to find a way to remove them from the
    globals graph iff they have been resolved on all paths through the
    call graph.

llvm-svn: 7187
2003-07-16 21:36:31 +00:00