Commit Graph

302 Commits

Author SHA1 Message Date
Brian Gaeke
92bdfe6951 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7265 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23 18:37:06 +00:00
Chris Lattner
c07736a397 Simplify code by using ConstantInt::getRawValue instead of checking to see
whether the constant is signed or unsigned, then casting


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7252 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-23 15:22:26 +00:00
Brian Gaeke
d461505efd 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7205 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-18 20:23:43 +00:00
Brian Gaeke
bfedb912cd Use getClassB for load and store; we don't want to abort when we
try to load or store through a bool*.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7195 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-17 21:30:06 +00:00
Brian Gaeke
0517c5ac92 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.)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7168 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-11 21:57:01 +00:00
Brian Gaeke
1aa476edf0 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.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7165 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-11 18:18:35 +00:00
Brian Gaeke
b44210d768 Insert workaround for GAS bug in assembling FLD/FSTP XWORD PTR [...]
instructions, by outputting them as bytes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7115 91177308-0d34-0410-b5e6-96231b3b80d8
2003-07-07 18:34:20 +00:00
John Criswell
7a73b80b90 Merged in autoconf branch. This provides configuration via the autoconf
system.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7014 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-30 21:59:07 +00:00
Chris Lattner
eb093fbf6f Setjmp should always return zero if we don't implement longjmp. This avoids
leaving trash in the register, fixing anagram


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7013 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-30 19:35:54 +00:00
Chris Lattner
c151e4f415 Until there is a setjmp/longjmp transformation pass, codegen setjmp as a noop
and longjmp as an abort!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6977 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-29 16:42:32 +00:00
Brian Gaeke
d7908f679e Nice tasty llc fixes. These should fix LLC for x86 for everything in
SingleSource except oopack and Oscar.  (Sorry, Oscar.)

include/llvm/Target/TargetInstrInfo.h: Remove virtual print method. Add
 accessors for ImplicitUses/Defs.
lib/Target/TargetInstrInfo.cpp: Remove virtual print method. If you
 really wanted this, just use MI->print(O, TM); instead...
lib/Target/X86:
FloatingPoint.cpp: ...like this.
X86InstrInfo.h: Remove virtual print method. Define the PrintImplUses
 target-specific flag bit.
X86InstrInfo.def: Add the PrintImplUses flag to all the instructions
 which implicitly use CL, because the assembler needs to see the CL in
 order to generate the right instruction.
Printer.cpp: Ditch fnIndex at Chris's request. Now we use CurrentFnName
  to name constants in the constant pool for each function instead. This
  avoids keeping state between runOnMachineFunction() invocations, which
  is a no-no. Having MangledGlobals be global is a bogon I'd like to get
  rid of too, but making it a static member of Printer causes link errors
  (why???).
 Make NumberForBB into a member of Printer instead of a global, too.
 Make printOp and printMemReference into methods of Printer.
 X86InstrInfo::print is now Printer::printMachineInstruction, because
  TargetInstrInfo::print is history. (Because of this, we have to qualify
  the names of some TargetInstrInfo methods we call.)
 Print out the ImplicitUses field of any instruction we print that has
  the PrintImplUses bit set.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6924 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-27 00:00:48 +00:00
Brian Gaeke
5e00157c5a Number constants from constant pool as CPIf_i where f is the function index
and i is the constant pool index.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6920 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-26 18:02:30 +00:00
Brian Gaeke
bc601fe3e7 Integrate the C writer's name mangler.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6908 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-25 22:00:39 +00:00
Brian Gaeke
01d79ff86d First draft of X86 LLC backend. This should be OK for small programs like
Shootout, but it has some issues with bigger programs. Work in progress.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6907 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-25 18:01:07 +00:00
Chris Lattner
7b52c036f4 Do not use the inefficient, fixed function, CBW, CDQ, ... instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6844 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-22 03:31:18 +00:00
Chris Lattner
034acf0a3d Minor simplification to 64-bit instsel
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6831 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-21 18:15:27 +00:00
Chris Lattner
0f1c461423 For 16 and 32-bit multiplies, use the IMUL instruction instead of the MUL instruction.
This allows us to not force the use of the EAX/AX registers!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6830 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-21 17:16:58 +00:00
Chris Lattner
a8cb100706 Add IMULr16 & IMULr32 instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6829 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-21 17:13:35 +00:00
Chris Lattner
f58544712b Generate code for LONG indexes to getelementptr instructions more efficiently
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6828 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-21 16:01:24 +00:00
Brian Gaeke
3387e7f7a2 Fix output bug: Intel asm comment character is #, not ;.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6792 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-19 19:58:32 +00:00
Brian Gaeke
088fa1162d RECAPITALIZE all the names of pseudo-instructions, and add a comment explaining
the convention.

:-)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6791 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-19 19:41:13 +00:00
Brian Gaeke
96b07e54dd Rename many instructions to their Intel asm-compatible names. This
involves removing the [bwl] suffixes from instruction names, as well
as some other distinguishing marks (32/64/80 on fp insns, _i suffixes, etc.)

Lowercase all instr. names as well for consistency's sake.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6790 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-19 19:34:44 +00:00
Brian Gaeke
9e474c4ec8 Add Initialization and Finalization methods for the Printer pass,
to print various things on a module-by-module basis (currently, only the
former is used).

Don't print < > around names. The assembler can't take it.

Print pseudoinstructions only as comments. The poor little assembler can't
take that, either.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6789 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-19 19:32:32 +00:00
Brian Gaeke
de3aa4f77f lib/Target/X86/X86TargetMachine.{cpp,h}: Add initial version
(non-working) of llc guts for X86, and add a prototype for it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6779 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-18 21:43:21 +00:00
Brian Gaeke
ad95d9ef50 Isolate machine-dependent use of <alloca.h> in "Support/Alloca.h",
so that we can easily change its use to be conditional on the result of
an autoconf test later.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6723 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-16 21:54:01 +00:00
Chris Lattner
30d002bd66 Fix warnings on Sparc
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6658 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-06 18:25:33 +00:00
Chris Lattner
302de59001 Add statistic for # machine instrs emitted
Add GROSS HACK to get CompilationCallback to work when compiled in release mode


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6646 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-06 04:00:05 +00:00
Chris Lattner
333864d81b Implement generation of cmp R, C to not use an extra register
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6627 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-05 19:30:30 +00:00
Chris Lattner
35333e16ee Special case simple binary operator X op C
This avoid generating a register to hold C, which in turn speeds up the
  register allocator by a lot: ~9% on 164.gzip and ~17% on 256.bzip2.  This
  also speeds up other passes.  This also speeds up execution of the program
  marginally, and makes the asm much easier to read. :)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6626 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-05 18:28:55 +00:00
Chris Lattner
76594014f2 Add instructions for (add|sub|and|or|xor)ri(8|16|32)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6625 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-05 18:25:08 +00:00
Chris Lattner
8cc72d2968 Remove usage of typedef
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6583 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-03 15:41:58 +00:00
Chris Lattner
ff3261ae86 Add namespace comments for doxygen
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6581 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-03 15:31:23 +00:00
Misha Brukman
bc80b2249a Eliminated a compiler warning due to casting to a different-sized datatype.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6531 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-02 04:13:58 +00:00
Misha Brukman
cd60313915 Renamed MachineCodeEmitter.cpp -> X86CodeEmitter.cpp as it conflicts with the
target-independent lib/CodeGen/MachineCodeEmitter.cpp; preserved CVS history.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6528 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-02 03:28:00 +00:00
Chris Lattner
04b0b309c4 Move X86 specific code out of the JIT into the X86 backend
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6516 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-01 23:23:50 +00:00
Chris Lattner
20772547c5 * Implement cast (long|ulong) to bool
* Fix cast of (short|ushort|int|uint) to bool to work right


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6510 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-01 03:38:24 +00:00
Chris Lattner
6c8125fa56 Add RR forms of test instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6509 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-01 03:37:46 +00:00
Chris Lattner
9171ef5e8d Add support for shl and shr for 64 bit integer types
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6499 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-01 01:56:54 +00:00
Chris Lattner
3f7905bdec Add definitions for TEST instructions
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6498 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-01 01:56:39 +00:00
Chris Lattner
8d8e0c6e83 Add new cmovne32 instruction
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6496 91177308-0d34-0410-b5e6-96231b3b80d8
2003-06-01 00:05:15 +00:00
Vikram S. Adve
49cab03c81 Renamed opIsDef to opIsDefOnly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6340 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-27 00:03:17 +00:00
Misha Brukman
12745c55e1 Reword to remove reference to how things worked in the past.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6323 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-24 01:08:43 +00:00
Misha Brukman
e9d883828a Implement the TargetInstrInfo's createNOPinstr() and isNOPinstr() interface.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6320 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-24 00:09:50 +00:00
Chris Lattner
67580ed715 Clean up #includes
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6173 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-13 20:21:19 +00:00
Chris Lattner
9d6d118837 Make abort more explicit
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6151 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-12 21:16:26 +00:00
Chris Lattner
b70c1381b4 Remove the assertion failure of course... doh
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6150 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-12 20:39:39 +00:00
Chris Lattner
4d5a50a7a6 Implement casts from unsigned integers to floating point
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6148 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-12 20:36:13 +00:00
Chris Lattner
c53544af06 Make error messages more useful than jsut an abort
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6146 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-12 20:16:58 +00:00
Chris Lattner
a6e73f1956 Do not insert multiple initializations for the same value in a PHI node
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6113 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-12 14:22:21 +00:00
Chris Lattner
992ab561f0 This blank line has GOT to go.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@6057 91177308-0d34-0410-b5e6-96231b3b80d8
2003-05-09 03:28:13 +00:00