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

3980 Commits

Author SHA1 Message Date
Misha Brukman
3b098f3fdd Reformatted code to match the prevalent LLVM style; fit code into 80 columns.
llvm-svn: 7586
2003-08-05 00:02:06 +00:00
Misha Brukman
1ada2fd28c ElectricFence found this bug where we were reading past the vector boundary.
llvm-svn: 7585
2003-08-04 23:48:40 +00:00
Chris Lattner
0e8197ad06 Don't bother calculating info unless its needed. May reduce number of stack slots created.
llvm-svn: 7584
2003-08-04 23:42:37 +00:00
Chris Lattner
8934560bd3 * Fix spelling of 'necessary'
* Add a lot more DEBUG output, which is better structured than before
* Fix bug: Jello/2003-08-04-PhysRegLiveFailure.llx

llvm-svn: 7583
2003-08-04 23:36:39 +00:00
Chris Lattner
cf51f31c3e Add patterns for (mov R, R) (mov R, I) and subtracts. The moves are to enable
testing, the subtracts are because I was in the neighborhood.

llvm-svn: 7581
2003-08-04 21:18:19 +00:00
Chris Lattner
900d31f5ba Change comments into something that TableGen can read!
llvm-svn: 7580
2003-08-04 21:08:29 +00:00
Chris Lattner
a06042d124 Allow instructions to have a DAG pattern associated with them.
Define a few preliminary node types.

llvm-svn: 7579
2003-08-04 21:07:37 +00:00
Chris Lattner
cd1aec5a9d Rename register classes to be upper case to make it obvious that they are X86
specific in the tree patterns

llvm-svn: 7578
2003-08-04 20:58:29 +00:00
Chris Lattner
f62d020c88 There is nothing special about noops anymore
llvm-svn: 7568
2003-08-04 05:11:37 +00:00
Chris Lattner
25d89c23aa There is nothing special about noops now
llvm-svn: 7567
2003-08-04 05:11:19 +00:00
Chris Lattner
94c11ac765 Transition to using 'let X = y' instead of 'set X = y'.
llvm-svn: 7565
2003-08-04 05:03:18 +00:00
Chris Lattner
0d7b042206 transition to using let instead of set
llvm-svn: 7564
2003-08-04 04:59:56 +00:00
Chris Lattner
7ca890525d Transition to using let instead of set
llvm-svn: 7563
2003-08-04 04:58:12 +00:00
Chris Lattner
15891a50c1 Fix Bug: test/Regression/Jello/2003-08-03-CallArgLiveRanges.llx
llvm-svn: 7558
2003-08-04 02:12:48 +00:00
Chris Lattner
b79989c60d Simplify some constant expressions
llvm-svn: 7556
2003-08-04 01:04:59 +00:00
Chris Lattner
52f4e7d96d Remove illegal, unsupported escapes. This fixes program: Ptrdist-bc
llvm-svn: 7552
2003-08-03 23:42:17 +00:00
Chris Lattner
96704b97ca * Sort #includes, remove dupliates
* Use .zero to emit padding between struct elements
* Emit .comm symbols when we can, this dramatically reduces the amount of gunk we have to print
* Print global variable identifiers next to initializer more nicely.

llvm-svn: 7551
2003-08-03 23:37:09 +00:00
Chris Lattner
e9a18e0f9f Specify custom name for registers to get the ()'s in the name.
llvm-svn: 7547
2003-08-03 22:12:47 +00:00
Chris Lattner
cc69139686 Allow specifying custom names for registers
llvm-svn: 7546
2003-08-03 22:12:37 +00:00
Chris Lattner
8cca0ab42b Start using tablegen'd instruction enum list
llvm-svn: 7542
2003-08-03 21:57:05 +00:00
Chris Lattner
21c04e759f Resort tables
llvm-svn: 7541
2003-08-03 21:56:36 +00:00
Chris Lattner
1bc88585c3 Lump the base opcode in with the X86 TargetSpecific flags
llvm-svn: 7540
2003-08-03 21:56:22 +00:00
Chris Lattner
128b75130d * Start using tablegen'd instruction descriptions
* Fix bug in the createNOP method, which was not marking the operands of the
  generated XCHG as useanddef.  I don't think this method is actually used,
  so it wasn't breaking anything, but it should be fixed anyway...

llvm-svn: 7539
2003-08-03 21:55:55 +00:00
Chris Lattner
4e20fd5a9b Start using tablegenerated instruction descriptions
llvm-svn: 7538
2003-08-03 21:54:59 +00:00
Chris Lattner
89b4a26e56 Add new TableGen instruction definitions
llvm-svn: 7537
2003-08-03 21:54:21 +00:00
Chris Lattner
9249afaa83 Remove the old .def file, it is now obsolete
llvm-svn: 7536
2003-08-03 21:54:06 +00:00
Chris Lattner
b62d30ec22 Rearrange fields yet again: Don't instantiate these lists ONCE PER INSTRUCTION.
llvm-svn: 7535
2003-08-03 21:52:28 +00:00
Chris Lattner
5dca2ea4bc Simplify code, eliminating the need for the X86 isVoid target instr flag
llvm-svn: 7534
2003-08-03 21:51:45 +00:00
Chris Lattner
77691b2c54 Set debug types
llvm-svn: 7533
2003-08-03 21:47:31 +00:00
Chris Lattner
25e28f61ab Set debug types
llvm-svn: 7532
2003-08-03 21:14:38 +00:00
Chris Lattner
eba995d624 Remove using decl
llvm-svn: 7531
2003-08-03 20:24:29 +00:00
Chris Lattner
7ef512fec1 Add Target class for X86 target
llvm-svn: 7523
2003-08-03 18:19:37 +00:00
Chris Lattner
6b3f365906 The RegisterInfo class is obsolete
llvm-svn: 7522
2003-08-03 18:18:48 +00:00
Chris Lattner
c485e85fa2 Remove the RegisterInfo class in favor of a general Target class. Add instrinfo stuff
llvm-svn: 7521
2003-08-03 18:18:31 +00:00
Chris Lattner
964738dd71 Tell CVS to ignore all .inc files
llvm-svn: 7513
2003-08-03 15:50:17 +00:00
Chris Lattner
5969ff707d Switch over to tablegen generated header files
llvm-svn: 7512
2003-08-03 15:48:55 +00:00
Chris Lattner
457b33f7e4 Switch over to TableGen generated register file description
llvm-svn: 7511
2003-08-03 15:48:14 +00:00
Chris Lattner
0891dd9161 Initial checkin of X86.td file
llvm-svn: 7510
2003-08-03 15:47:49 +00:00
Chris Lattner
f4bfcad4ea Initial checkin of X86 Register File description
llvm-svn: 7509
2003-08-03 15:47:25 +00:00
Chris Lattner
8aa04e1e4c Fix typeos in comments
llvm-svn: 7505
2003-08-03 13:50:14 +00:00
Chris Lattner
b33c691d7d Make it easier to debug by exposing a temporary
llvm-svn: 7504
2003-08-03 13:49:25 +00:00
Chris Lattner
a18bb98cf5 Wrap at 80 columns
llvm-svn: 7503
2003-08-03 13:49:03 +00:00
Chris Lattner
490d0d3351 Rename fields
llvm-svn: 7498
2003-08-01 22:21:49 +00:00
Chris Lattner
1baa706ab7 Move DEBUG to Debug.h
llvm-svn: 7497
2003-08-01 22:21:34 +00:00
Chris Lattner
277bb3482c DEBUG got moved to Debug.h
llvm-svn: 7495
2003-08-01 22:19:03 +00:00
Chris Lattner
ef90e1b189 Move debug functionality to Debug.cpp/Debug.h
llvm-svn: 7494
2003-08-01 22:15:41 +00:00
Chris Lattner
89bf5d3a60 Describe the value name
llvm-svn: 7493
2003-08-01 22:15:15 +00:00
Chris Lattner
686e94e760 DEBUG got moved to Support/Debug.h
llvm-svn: 7492
2003-08-01 22:15:03 +00:00
Chris Lattner
64fade1536 DEBUG got moved to Debug.h
llvm-svn: 7491
2003-08-01 22:13:59 +00:00
Chris Lattner
aa22e98e56 Check in the implementation of the FileUtilities!
llvm-svn: 7487
2003-08-01 21:16:14 +00:00
Chris Lattner
1e006b1e92 Remove makefile complexity by always running tablegen with its final output
directory.

llvm-svn: 7485
2003-08-01 20:34:56 +00:00
Chris Lattner
cba4e65559 Use the C++, more portable, deleter
llvm-svn: 7483
2003-08-01 20:29:18 +00:00
Chris Lattner
346760c6cb Move #include from a header to here
llvm-svn: 7480
2003-08-01 19:16:29 +00:00
Vikram S. Adve
eda4d9cb09 Add all arithmetic operators to ConstantExprToString().
Note that some generated operators (like &, | or ^) may
not be supported by the assembler -- but if they've got
this far, it's better to generate them and let the assembler decide.

llvm-svn: 7476
2003-08-01 15:55:53 +00:00
Vikram S. Adve
b68bd55363 *Both* operands of divide need sign-extension before divide (if smaller
than machine register size), not just the second operand.

llvm-svn: 7475
2003-08-01 15:54:38 +00:00
Vikram S. Adve
4576ae1530 Put back the separate pass to decompose multi-dimensional references
since it is *necessary* for correct code generation.  Only optional
transformations belong in the PreOpts pass (which needs to be renamed
from PreSelection to PreOpts).

llvm-svn: 7474
2003-08-01 15:53:24 +00:00
Chris Lattner
d96b821c8a encode size information into each ValueType
Add new RegisterInfo class

llvm-svn: 7469
2003-08-01 05:18:03 +00:00
Chris Lattner
8dce81478f This method is long dead
llvm-svn: 7460
2003-08-01 03:48:42 +00:00
Chris Lattner
5d1a43bb60 Fix the JIT in the Nightly tester. This was not a fun bug to track down.
See the comments in the patch for details.

llvm-svn: 7457
2003-07-31 19:38:34 +00:00
Chris Lattner
12defed07e Trivial cleanups: no need to include header twice. Global variable is local to file
llvm-svn: 7456
2003-07-31 19:31:21 +00:00
Chris Lattner
79a56ff370 Remove more obsolete comments
llvm-svn: 7455
2003-07-31 17:56:05 +00:00
Misha Brukman
f451b1f332 Changed pointer to the JIT code to its current location, under LLI.
llvm-svn: 7454
2003-07-31 17:50:35 +00:00
Chris Lattner
93dacfb0bd Unbreak the CBE output
llvm-svn: 7453
2003-07-31 17:47:24 +00:00
Brian Gaeke
4449b3c963 I think local symbols in X86 GAS have to start with .L, not just
.; so I have changed the basic block markers to start with .L.  I also
broke up a >80char line.

llvm-svn: 7452
2003-07-31 17:38:52 +00:00
John Criswell
9610326d63 Modified the code so that it generates (0) for setjmp() and abort() for
longjmp() (and does not include setjmp.h).
This is to fix some problems on Sparc while non-local jumps are still
unimplemented.

llvm-svn: 7449
2003-07-31 15:11:08 +00:00
Tanya Lattner
26f6e3b353 *** empty log message ***
llvm-svn: 7447
2003-07-31 05:06:09 +00:00
Tanya Lattner
8c2ac118ce Added function to determine if an Instruction may trap.
llvm-svn: 7442
2003-07-31 04:05:50 +00:00
Chris Lattner
d1b7716c86 Add comments
Make the register classes optionally take code fragments for allocation_order_*

llvm-svn: 7441
2003-07-30 22:16:41 +00:00
Chris Lattner
51504820c7 We no longer need to preprocess SparcV9.td before sending it through tablegen
llvm-svn: 7437
2003-07-30 21:00:37 +00:00
Chris Lattner
6457a808f0 Fix a bug that brian reported
llvm-svn: 7428
2003-07-30 19:04:37 +00:00
Chris Lattner
78f944d347 Add support for "named positional arguments"
llvm-svn: 7421
2003-07-30 17:34:02 +00:00
Vikram S. Adve
d4520885a0 When emitting a constant, check for ConstantExpr before
ordinary (primitive) types since ConstantExprs may be of primitive type!

llvm-svn: 7418
2003-07-30 12:54:47 +00:00
Chris Lattner
9e520e120b Conform to the new interface for describing target registers... even though
it's currently not used.

llvm-svn: 7416
2003-07-30 05:51:34 +00:00
Chris Lattner
d1b04c63c2 Add all of the necessary classes to describe the contents of the MRegister.h implementation
for a target.

llvm-svn: 7415
2003-07-30 05:50:12 +00:00
Chris Lattner
24ac5f5339 Only regenerate the .inc file if IT has changed, not just if the .td files
have changed.

llvm-svn: 7414
2003-07-30 05:49:17 +00:00
Chris Lattner
cf28d0f799 Use target specific interface instead of forcing it to be target-generic
llvm-svn: 7413
2003-07-30 05:33:48 +00:00
Chris Lattner
1933b89bfe No this file is not actually Sparc.td :)
llvm-svn: 7405
2003-07-29 23:07:13 +00:00
Chris Lattner
89619f07a3 Do not use 'cpp' directly
llvm-svn: 7404
2003-07-29 23:04:41 +00:00
Chris Lattner
f59d363766 Add namespace specifier, add flags used by the X86 BE
llvm-svn: 7403
2003-07-29 23:02:49 +00:00
Misha Brukman
d0aaeba334 * Cleaned up and corrected comments wrt instruction formats
* Enabled STXFSR instructions

llvm-svn: 7400
2003-07-29 21:21:20 +00:00
Misha Brukman
6f2a6a5279 Make emitFarCall() public, and add a few comments to functions.
llvm-svn: 7399
2003-07-29 20:52:56 +00:00
Vikram S. Adve
ae84838162 Unify all constant evaluations that depend on register size
in ConvertConstantToIntType.

llvm-svn: 7395
2003-07-29 19:59:23 +00:00
Vikram S. Adve
c8b8a4088d Rename 'dump-asm' to 'dump-input' and really print it just before code-gen.
llvm-svn: 7394
2003-07-29 19:58:00 +00:00
Vikram S. Adve
0a6bd349c2 Bug fix: don't unnecessarily pretty-print control-characters, some of
which were wrong (particularly, '\a' for '\007').

llvm-svn: 7393
2003-07-29 19:57:34 +00:00
Vikram S. Adve
98618cd85c Add ConvertConstantToIntType() to unify all constant handling
that depends on machine register size.
Moved insertCallerSavingCode() to PhyRegAlloc and
moved isRegVolatile and modifiedByCall to TargetRegInfo: they are all
machine independent.  Remove several dead functions.

llvm-svn: 7392
2003-07-29 19:54:41 +00:00
Vikram S. Adve
97e5e148b8 Add code to support stack spill/temp offsets that don't fit in the
immed. field.  Moved insertCallerSavingCode() to PhyRegAlloc: it is
now machine independent.  Remove all uses of PhyRegAlloc.

llvm-svn: 7391
2003-07-29 19:53:21 +00:00
Vikram S. Adve
1414fba288 All constant-evaluation code now unified into
TargetInstrInfo::ConvertConstantToIntType().

llvm-svn: 7390
2003-07-29 19:50:12 +00:00
Vikram S. Adve
b58f52ab45 1. Bug fix: Don't use branch operand reg. as temp. reg. when
spilling values used by an instruction in the delay slot of the branch
   (which will eventually be moved before the branch).
2. Bug fix:  Delete the delay slot instr, not the branch instr, when
   moving delay slot instr. out!!!!
3. Move code to insert caller-saves moved here from SparcRegInfo:
   it is now machine-independent.

llvm-svn: 7389
2003-07-29 19:49:21 +00:00
Vikram S. Adve
59e7da7437 Don't require a BB to look-up live variables, unless they may need to
be recomputed.

llvm-svn: 7388
2003-07-29 19:42:32 +00:00
Vikram S. Adve
42005e62b0 Add const version of getLiveRangeForValue().
llvm-svn: 7386
2003-07-29 19:38:22 +00:00
Vikram S. Adve
52859278d1 Code to insert caller-saves moved here from SparcRegInfo: it is now
machine-independent.
Fix problem with using branch operand reg. as temp. reg. when
spilling values used by an instruction in the delay slot of the branch
(which will eventually be moved before the branch).

llvm-svn: 7385
2003-07-29 19:37:41 +00:00
Misha Brukman
9bcbe0c3bc * Correctly emit a far call if the target address does not fit into 30 bits
instead of assert()ing
* Fixed a nasty bug where '07' was used instead of register 'o7'

llvm-svn: 7382
2003-07-29 19:00:58 +00:00
Misha Brukman
442175ec3b * Stop hard-coding a value for beginning of emitted code on Sparc since we can
now handle far calls (i.e., beyond the 30-bit limit in call instructions).
* As a side-effect, this allows us to unify and clean up the mmap() call and
  code around it.

llvm-svn: 7381
2003-07-29 16:57:16 +00:00
Chris Lattner
8fdf81b97e Move "register flags" definition the type of registers to be fully fledged
value types

llvm-svn: 7377
2003-07-29 05:14:16 +00:00
Chris Lattner
b6db3e9a88 Add support for Alpha intrinsics, contributed by Rahul Joshi
llvm-svn: 7373
2003-07-28 21:20:57 +00:00
Misha Brukman
c77e286633 Add rationale for the MAP_ANONYMOUS vs. MAP_ANON flags.
llvm-svn: 7368
2003-07-28 19:26:19 +00:00
Misha Brukman
bbfad09fa9 The RTLD_GLOBAL flag allows symbols to be globally accessible, which makes
resolution of symbols in the .so possible (currently assists debugging with
bugpoint).

llvm-svn: 7366
2003-07-28 19:19:58 +00:00
Misha Brukman
c0193ca460 Add ability for external C code to get pointers to functions given their name.
This us used by bugpoint -- when code is compiled to a shared object to be
JITted, it must use the JIT's lazy resolution method to find function addresses,
because some functions will not be available at .so load time, as they are in
the bytecode file.

llvm-svn: 7363
2003-07-28 19:09:06 +00:00
Misha Brukman
752c6f4548 Clean up code dealing with RTLD_SELF differences on Sparc and X86.
llvm-svn: 7362
2003-07-28 19:07:30 +00:00
Misha Brukman
cd6e03cb52 Fix reference to architecture.
llvm-svn: 7361
2003-07-28 19:06:50 +00:00
Misha Brukman
f4702ed4d1 Add in support to load shared objects (-load is provided by Support library).
llvm-svn: 7360
2003-07-28 19:06:19 +00:00
Chris Lattner
da51c38e57 Specify the value type for the register, not just the size.
llvm-svn: 7357
2003-07-28 04:25:36 +00:00
Chris Lattner
163559e702 Instead of specifying the SIZE of the register, go so far as to specify
what value type it is.

llvm-svn: 7356
2003-07-28 04:24:59 +00:00
Chris Lattner
40cc4c1392 Rename function to be more consistent with filename
llvm-svn: 7352
2003-07-26 23:49:58 +00:00
Chris Lattner
92dfc1ed32 Making this code const-correct would be a pain, so I'll hack it.
llvm-svn: 7350
2003-07-26 23:29:51 +00:00
Chris Lattner
2d6049baaf Const correctness fixes
llvm-svn: 7349
2003-07-26 23:24:56 +00:00
Chris Lattner
e39696972d Be const correct
llvm-svn: 7348
2003-07-26 23:23:41 +00:00
Chris Lattner
792286a084 Hrm, another necesary one :(
llvm-svn: 7347
2003-07-26 23:22:19 +00:00
Chris Lattner
f0df04752d We don't modify the LLVM rep, remain const correct
llvm-svn: 7345
2003-07-26 23:06:00 +00:00
Chris Lattner
b92653f037 If the pass changes _anything_ it must return true
llvm-svn: 7344
2003-07-26 23:05:37 +00:00
Chris Lattner
406d31b4c2 This code doesn't modify the LLVM structure, keep stuff const
llvm-svn: 7343
2003-07-26 23:04:00 +00:00
Chris Lattner
ecc0501a97 Remove #include
llvm-svn: 7342
2003-07-26 23:01:04 +00:00
Chris Lattner
9224631d6b Remove extraneous #includes
llvm-svn: 7341
2003-07-26 23:00:29 +00:00
Chris Lattner
36a7bf78fa Fix another minor bug
llvm-svn: 7340
2003-07-26 23:00:05 +00:00
Vikram S. Adve
48144de834 (1) Major fix to the way unused regs. are marked and found for the FP
Single and FP double reg types (which share the same reg class).
    Now all methods marking/finding unused regs consider the regType
    within the reg class, and SparcFloatRegClass specializes this code.
(2) Remove machine-specific regalloc. methods that are no longer needed.
    In particular, arguments and return value from a call do not need
    machine-specific code for allocation.
(3) Rename TargetRegInfo::getRegType variants to avoid unintentional
    overloading when an include file is omitted.

llvm-svn: 7334
2003-07-25 21:12:15 +00:00
Vikram S. Adve
a98599dc3b 1. Fix a case that was marking the invalid reg. num. (-1) as used,
causing a nasty array bound error later.
2. Fix silly typo causing logical shift of unsigned long to use
   SRL instead of SRLX.

llvm-svn: 7330
2003-07-25 21:08:58 +00:00
Vikram S. Adve
57eb4ab6bc (1) Change the way unused regs. are marked and found to consider regType
info (since multiple reg types may share the same reg class).
(2) Remove machine-specific regalloc. methods that are no longer needed.
    In particular, arguments and return value from a call do not need
    machine-specific code for allocation.
(3) Rename TargetRegInfo::getRegType variants to avoid unintentional
    overloading when an include file is omitted.

llvm-svn: 7329
2003-07-25 21:06:09 +00:00
Vikram S. Adve
714fee31fd Remove unused field. Change the way unused regs. are marked and
found to consider regType info (since multiple reg types may share
the same reg class, e.g., single and double on Sparc).

llvm-svn: 7327
2003-07-25 21:00:13 +00:00
Chris Lattner
752a4ca4c4 Dont' try to parse the colon
llvm-svn: 7323
2003-07-25 20:49:29 +00:00
Chris Lattner
915b998b3f Add a more general check-flags which can be used to ensure arbitrary flags are set
llvm-svn: 7322
2003-07-25 20:45:40 +00:00
Brian Gaeke
991f66b7e2 Include llvm/Support/Mangler.h first. Don't include <iostream>, <set>,
<string>, or llvm/Value.h.  Move up the inclusion of llvm/Support/Mangler.h.

llvm-svn: 7321
2003-07-25 20:21:20 +00:00
Brian Gaeke
11e6d7f2de Don't include llvm/SlotCalculator.h, or <set>.
Move up the inclusion of llvm/Support/Mangler.h.

llvm-svn: 7320
2003-07-25 20:21:06 +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
c5b0f39c96 Instcombine: (A >> c1) << c2 for signed integers
llvm-svn: 7295
2003-07-24 18:38:56 +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
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
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
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
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
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
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
ae691a3068 InstCombine: (X ^ 4) == 8 --> X == 12
llvm-svn: 7260
2003-07-23 17:26:36 +00:00
Chris Lattner
b07de65646 IC: (X & 5) == 13 --> false
IC: (X | 8) == 4  --> false

llvm-svn: 7257
2003-07-23 17:02:11 +00:00
Chris Lattner
dd48c4b1e4 Remove redundant const qualifier
llvm-svn: 7254
2003-07-23 15:30:32 +00:00
Chris Lattner
1351c304dc Remove redundant const qualifiers from cast<> expressions
llvm-svn: 7253
2003-07-23 15:30:06 +00:00
Chris Lattner
6ad460b336 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
9c569f48a0 Remove unnecessary casts
llvm-svn: 7250
2003-07-23 15:17:51 +00:00
Chris Lattner
bfe70df7fc Fit code into 80 columns
llvm-svn: 7249
2003-07-23 15:17:01 +00:00
Chris Lattner
0fce06e40e Eliminate old-style cast
llvm-svn: 7248
2003-07-23 15:16:40 +00:00
Chris Lattner
c1049acba1 Random cleanups
llvm-svn: 7247
2003-07-23 14:59:40 +00:00
Chris Lattner
67138b2c59 Remove using decl
llvm-svn: 7246
2003-07-23 14:55:59 +00:00
Chris Lattner
63ea851f94 Remove explicit const qualifiers
llvm-svn: 7245
2003-07-23 14:54:33 +00:00
Chris Lattner
74a266d229 Fix bug: TailDup/2003-07-22-InfiniteLoop.ll
llvm-svn: 7243
2003-07-23 03:32:41 +00:00
Chris Lattner
7594fa7280 - 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
Vikram S. Adve
420ec0bb0f Fix comment.
llvm-svn: 7227
2003-07-22 12:08:58 +00:00
Chris Lattner
9f501f98c8 Simplify code a bit
llvm-svn: 7217
2003-07-21 19:56:49 +00:00
John Criswell
98946bac5b 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
Misha Brukman
f7ca33f163 Eliminated dead code.
llvm-svn: 7209
2003-07-21 16:34:35 +00:00
Anand Shukla
351c0f6342 Added special consideration for instrumentation strategy
llvm-svn: 7208
2003-07-20 15:39:30 +00:00
Anand Shukla
d02a20b947 Added check for inlinable function
llvm-svn: 7206
2003-07-18 20:55:26 +00:00
Brian Gaeke
bf46d75365 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
755aa86ca3 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
Anand Shukla
bb730173d6 A pass to combine multiple backedges that go to same target
llvm-svn: 7201
2003-07-18 16:08:32 +00:00
Brian Gaeke
638e6ef31c 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
026c333f07 Fix typo in call to isUnresolvableFunc, which was breaking the build.
llvm-svn: 7194
2003-07-17 19:07:46 +00:00
John Criswell
dbaf5f719c 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
Vikram S. Adve
96abba3e01 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
e2993f34ed (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
d1a85b7860 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
Vikram S. Adve
0ce80bfa82 Factor out the test for unresolvable external functions into
isUnresolvableFunc() (I thought I needed this externally.
I don't, but it's still nicer this way.)

llvm-svn: 7186
2003-07-16 21:25:17 +00:00
Misha Brukman
8c9be85d5d Fixed the number translation scheme for the integer condition code registers: it
now works in instructions which require a 2-bit or 3-bit INTcc code.

Incidentally, that means that the representation of INTcc registers is now the
same in both integer and FP instructions. Thus, code became much simpler and
cleaner.

llvm-svn: 7185
2003-07-16 20:30:40 +00:00
Misha Brukman
5a52ebed46 The name should really be `simm11' to follow the naming convention, but this has
no change in functionality.

llvm-svn: 7184
2003-07-16 20:27:44 +00:00
Misha Brukman
10a63e248c No need for a second immediate field if the class already inherits one.
llvm-svn: 7182
2003-07-15 21:27:14 +00:00
Misha Brukman
250280cf79 Encode predict = 1 by default, because the Sparc assembler does this.
llvm-svn: 7181
2003-07-15 21:26:49 +00:00
Misha Brukman
8cd8690ad5 Correctly handle calls to functions which are further away than 2**32 bits will
allow, i.e. make a sequence of instructions to enable an indirect call using
jump-and-link and 2 temporary registers (which we save and ultimately restore).

Warning: if the delay slot of a function call is used to do meaningful work and
not just a NOP, this behavior is incorrect. However, the Sparc backend does not
yet utilize the delay slots effectively, so it is not necessary to make an
overly complicated algorithm for something that's not used.

llvm-svn: 7178
2003-07-15 19:09:43 +00:00
Misha Brukman
45dc28808e Clean up my last checkin: code is easier to read and explains the differences in
usage of the special file handle RTLD_SELF on Sparc/Solaris vs. 0 on Linux/x86.

llvm-svn: 7177
2003-07-15 15:58:26 +00:00
Misha Brukman
6a087a3a2f On Sparc/Solaris, the special handle RTLD_SELF is used as a handle referring to
the program's executing image, not 0 as it is on Linux/x86 and possibly other
systems.

llvm-svn: 7176
2003-07-15 15:55:32 +00:00
Misha Brukman
d594e21afa * Added support for the %ccr register
* FP double registers are now coded correctly
* Removed function which converted registers based on register types, it was
  broken (because regTypes are broken)

llvm-svn: 7175
2003-07-14 23:26:03 +00:00
Misha Brukman
0b5999cca1 The word separate' only has one e'.
llvm-svn: 7174
2003-07-14 17:26:34 +00:00
Misha Brukman
5de3e14206 The word separate' only has one e'.
llvm-svn: 7173
2003-07-14 17:20:40 +00:00
Vikram S. Adve
f5914c9bca Trace loads and stores as they happen (stores were being
remembered in valuesStoredInFunction, but never traced at function return,
and that's too late to be finding the error anyway).
Stores trace both the value and the address being stored to,
but after some experience I think only values should be traced.
The pointer hash table just fills up far too quickly if every
store address were traced.

llvm-svn: 7169
2003-07-11 21:57:43 +00:00
Brian Gaeke
89ce6ca0a6 If we have a constant pointer reference to a function, we were printing
out the entire llvm disassembly for the function at global constant-output
time, which caused the assembler to barf in 164.gzip. This fixes that
particular problem (though 164.gzip has other problems with X86 llc.)

llvm-svn: 7168
2003-07-11 21:57:01 +00:00
Brian Gaeke
efd836df31 Fix some serious floating-point bugs (fixes test cases such as Oscar,
Fhourstones, McCat-vor, and many others...)

Printer.cpp: Print implicit uses for AddRegFrm instructions.  Break gas
bug workarounds up into separate stanzas of code for each bug.  Add new
workarounds for fild and fistp.

X86InstrInfo.def: Add O_ST0 implicit uses for more FP instrs where they
obviously apply. Also add PrintImplUses flags for FP instrs where they
are necessary for gas to understand the output.

llvm-svn: 7165
2003-07-11 18:18:35 +00:00
Anand Shukla
cb78ec5ada Added functionality to instrmentation pass
llvm-svn: 7161
2003-07-10 21:55:57 +00:00
Misha Brukman
74d17238cb Fixed grammatical error.
llvm-svn: 7160
2003-07-10 21:38:28 +00:00
Vikram S. Adve
83dc6ef841 Several important bug fixes:
(1) Cannot use ANDN(ot), ORN, and XORN for boolean ops, only bitwise ops.

(2) Conditional move instructions must distinguish signed and unsigned
    condition codes, e.g., MOVLE vs. MOVLEU.

(3) Conditional-move-on-register was using the cond-move-on-cc opcodes,
    which produces a valid-looking instruction with bogus registers!

(4) Here's a really cute one: dividing-by-2^k for negative numbers needs to
    add 2^k-1 before shifting, not add 1 after shifting.  Sadly, these
    are the same when k=0 so our poor test case worked fine.

(5) Casting between signed and unsigned values was not correct:
    completely reimplemented.

(6) Zero-extension on unsigned values was bogus: I was only doing the
    SRL and not the SLLX before it.  Don't know WHAT I was thinking!

(7) And the most important class of changes: Sign-extensions on signed values.
    Signed values are not sign-extended after ordinary operations,
    so they must be sign-extended before the following cases:
	-- passing to an external or unknown function
	-- returning from a function
	-- using as operand 2 of DIV or REM
	-- using as either operand of condition-code setting operation
           (currently only SUBCC), with smaller than 32-bit operands


Also, a couple of improvements:

(1) Fold cast-to-bool into Not(bool).  Need to do this for And, Or, XOR also.

(2) Convert SetCC-Const into a conditional-move-on-register (case 41)
    if the constant is 0.  This was only being done for branch-on-SetCC-Const
    when the branch is folded with the SetCC-Const.

llvm-svn: 7159
2003-07-10 20:07:54 +00:00
Vikram S. Adve
87e97308fd Bug fix in creating constants: need 1U << 31, not 1 << 31.
llvm-svn: 7158
2003-07-10 19:48:19 +00:00
Vikram S. Adve
989afdffd6 Fold cast-to-bool into not. Later, this should also be folded into other
boolean operations: AND, OR, XOR.

llvm-svn: 7157
2003-07-10 19:47:42 +00:00
Vikram S. Adve
d8b600cb85 Values stored in CallArgsDescriptor cannot be const.
llvm-svn: 7156
2003-07-10 19:46:15 +00:00
Vikram S. Adve
b1496585b6 isMarkedForSpill() should be const.
llvm-svn: 7155
2003-07-10 19:45:28 +00:00
Vikram S. Adve
6aa3abf7fa Change interface to MachineInstr::substituteValue to specify more precisely
which args can be substituted: defsOnly, defsAndUses or usesOnly.

llvm-svn: 7154
2003-07-10 19:45:07 +00:00
Vikram S. Adve
0b23c58179 Print out all neighbors in interference graph, not just higher-numbered ones.
llvm-svn: 7153
2003-07-10 19:43:33 +00:00
Vikram S. Adve
00f3778923 Several fixes to handling of int CC register:
(1) An int CC live range must be spilled if there are any interferences,
    even if no other "neighbour" in the interf. graph has been allocated
    that reg. yet.  This is actually true of any class with only one reg!

(2) SparcIntCCRegClass::colorIGNode sets the color even if the LR must
    be spilled so that the machine-independent spill code doesn't have to
    make the machine-dependent decision of which CC name to use based on
    operand type: %xcc or %icc.  (These are two halves of the same
register.)

(3) LR->isMarkedForSpill() is no longer the same as LR->hasColor().
    These should never have been the same, and this is necessary now for #2.

(4) All RDCCR and WRCCR instructions are directly generated with the
    phony number for %ccr so that EmitAssembly/EmitBinary doesn't have to
    deal with this.

llvm-svn: 7152
2003-07-10 19:42:55 +00:00
Vikram S. Adve
8d30b76da6 Several fixes to handling of int CC register:
(1) An int CC live range must be spilled if there are any interferences,
    even if no other "neighbour" in the interf. graph has been allocated
    that reg. yet.  This is actually true of any class with only one reg!

(2) SparcIntCCRegClass::colorIGNode sets the color even if the LR must
    be spilled so that the machine-independent spill code doesn't have to
    make the machine-dependent decision of which CC name to use based on
    operand type: %xcc or %icc.  (These are two halves of the same register.)

(3) LR->isMarkedForSpill() is no longer the same as LR->hasColor().
    These should never have been the same, and this is necessary now for #2.

(4) All RDCCR and WRCCR instructions are directly generated with the
    phony number for %ccr so that EmitAssembly/EmitBinary doesn't have to
    deal with this.

llvm-svn: 7151
2003-07-10 19:42:11 +00:00
Misha Brukman
c12238543a Lowercase versions of `occurrence' need to be spelled correctly, too.
llvm-svn: 7142
2003-07-10 17:05:26 +00:00
Misha Brukman
14194dcdae Occurrence' has no a' and the `r' is doubled.
llvm-svn: 7140
2003-07-10 16:49:51 +00:00
Misha Brukman
c170ac78b6 Some beautification changes (tabs to spaces, removed extra blank lines);
no functionality changed.

llvm-svn: 7138
2003-07-09 17:33:50 +00:00
John Criswell
caef76fa72 Removed size_t from the parameter list of the malloc() prototype in generated C
code.  This prevents a compiler warning on Sparc that causes the tests to fail.

llvm-svn: 7125
2003-07-08 14:52:09 +00:00