1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-24 05:23:45 +02:00
Commit Graph

6821 Commits

Author SHA1 Message Date
Chris Lattner
d776276bda Regardless of whether C provides assert.h, C++ source can always include
<cassert>, making this header unneeded.

llvm-svn: 7311
2003-07-25 17:35:03 +00:00
Chris Lattner
9390472890 Use the C++ <cassert> header, not the C <assert.h> header
llvm-svn: 7310
2003-07-25 17:34:17 +00:00
Chris Lattner
1adb1fcb82 This header works with GCC 3.3
llvm-svn: 7309
2003-07-25 17:33:45 +00:00
Chris Lattner
89596df8dd Use C++ headers, not C headers
llvm-svn: 7308
2003-07-25 17:32:51 +00:00
Chris Lattner
754138fc7d Add includes of assert
llvm-svn: 7307
2003-07-25 17:23:27 +00:00
Chris Lattner
63d911d12e Fix accessibility problems GCC 3.3
llvm-svn: 7306
2003-07-25 17:23:13 +00:00
Chris Lattner
fa412837cb Add assert.h include
llvm-svn: 7305
2003-07-25 16:47:07 +00:00
Chris Lattner
72684e9492 Convert to C++ style comments
llvm-svn: 7304
2003-07-25 15:08:08 +00:00
Vikram S. Adve
be5721dddb 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
914429c42b 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
d9979a5529 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
e5ae59ad05 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
dc07ea6681 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
33030f30d6 More testcases, which I'll implement later
llvm-svn: 7298
2003-07-24 19:44:51 +00:00
Chris Lattner
74300fe9fd Modernize testcase
llvm-svn: 7297
2003-07-24 19:42:28 +00:00
Chris Lattner
e6255fa31c New testcase
llvm-svn: 7296
2003-07-24 19:31:08 +00:00
Chris Lattner
c5b0f39c96 Instcombine: (A >> c1) << c2 for signed integers
llvm-svn: 7295
2003-07-24 18:38:56 +00:00
Chris Lattner
ffcad975f1 New testcases for signed shifts
llvm-svn: 7294
2003-07-24 18:38:09 +00:00
Misha Brukman
e98a7e97d9 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
bf9589bf1f 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
77b077a109 It doesn't appear that we need to #include these.
llvm-svn: 7291
2003-07-24 17:48:53 +00:00
Chris Lattner
785e8453f0 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
9eb9ec67f7 Minor cleanups
llvm-svn: 7289
2003-07-24 17:31:56 +00:00
Brian Gaeke
4afe7aea5f 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
f516df0413 Disable sample project until it works
llvm-svn: 7287
2003-07-23 23:28:57 +00:00
Chris Lattner
2c1555180e Add new tests, make existing tests more difficult
llvm-svn: 7286
2003-07-23 23:21:08 +00:00
Chris Lattner
31224cdff9 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
e2f7f1c479 New testcase
llvm-svn: 7284
2003-07-23 22:02:39 +00:00
Chris Lattner
6d10220481 Add comments
llvm-svn: 7283
2003-07-23 21:41:57 +00:00
Chris Lattner
ac8a2be5e4 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
4fa5064a8e New testcases
llvm-svn: 7281
2003-07-23 21:36:01 +00:00
Chris Lattner
41a06297b5 Renumber tests sequentially
llvm-svn: 7280
2003-07-23 21:11:56 +00:00
Chris Lattner
477e2cfdf8 Split the or and xor tests into two separate files
llvm-svn: 7279
2003-07-23 21:10:55 +00:00
Chris Lattner
176b5899a6 Remove obscure test
llvm-svn: 7278
2003-07-23 21:06:34 +00:00
Chris Lattner
5b08fe9fbf Check in old testcase sitting in my tree
llvm-svn: 7277
2003-07-23 20:48:03 +00:00
Chris Lattner
7e3419a91c Fix program: SingleSource/UnitTests/2003-07-09-SignedArgs with the CBE
llvm-svn: 7276
2003-07-23 20:45:31 +00:00
Brian Gaeke
5674309dc1 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
d285263cd3 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
fc4a57d904 Fix space
llvm-svn: 7273
2003-07-23 20:21:06 +00:00
Chris Lattner
f453a39185 InstCombine: (X ^ C1) & C2 --> (X & C2) iff (C1&C2) == 0
llvm-svn: 7272
2003-07-23 19:36:21 +00:00
Chris Lattner
13c6cb7f5f New testcase
llvm-svn: 7271
2003-07-23 19:35:51 +00:00
Chris Lattner
80d9c3a900 - 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
df40438bd7 New testcase
llvm-svn: 7267
2003-07-23 19:24:34 +00:00
Chris Lattner
5a4bcac8b1 New testcase
llvm-svn: 7266
2003-07-23 19:05:29 +00:00
Brian Gaeke
9de468d398 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
76c1da471c 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
1bfbaa842e New testcases
llvm-svn: 7263
2003-07-23 18:28:42 +00:00
Chris Lattner
4b43cd9700 IC: (X ^ C1) & C2 --> (X & C2) ^ (C1&C2)
Minor code cleanup

llvm-svn: 7262
2003-07-23 17:57:01 +00:00
Chris Lattner
3847a79aa0 New testcase
llvm-svn: 7261
2003-07-23 17:56:34 +00:00
Chris Lattner
ae691a3068 InstCombine: (X ^ 4) == 8 --> X == 12
llvm-svn: 7260
2003-07-23 17:26:36 +00:00