1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-26 14:33:02 +02:00
Commit Graph

3031 Commits

Author SHA1 Message Date
Chris Lattner
1a915e0a5f generalize the instruction types permitted a bit
llvm-svn: 10274
2003-12-01 05:13:56 +00:00
Chris Lattner
f0f44f414b Finegrainify namespacification
llvm-svn: 10270
2003-11-30 06:13:25 +00:00
Brian Gaeke
29723ca977 Support constant casting constant pointers to ints/uints, and/or
the other way around, instead of failing a large, tumor-like assertion.

llvm-svn: 10171
2003-11-22 07:18:25 +00:00
Brian Gaeke
296546cf0c Constant shift expressions, meet InstSelectSimple. Yow!!
llvm-svn: 10170
2003-11-22 06:49:41 +00:00
Brian Gaeke
8c4c9f6f1e Stub for constant shift expr support.
llvm-svn: 10168
2003-11-22 05:18:35 +00:00
Chris Lattner
6677af8dee Fix PR123
llvm-svn: 10069
2003-11-18 17:47:05 +00:00
Brian Gaeke
d25f86d683 Put all LLVM code into the llvm namespace, as per bug 109.
llvm-svn: 9903
2003-11-11 22:41:34 +00:00
Chris Lattner
ca7a346fce Hopefully fix the objdir != srcdir issue
llvm-svn: 9761
2003-11-07 00:34:33 +00:00
Chris Lattner
e060df5b2c Fix warnings building on sparc
llvm-svn: 9758
2003-11-06 21:30:05 +00:00
Misha Brukman
c7c4e197fc We know exactly what the value of $< is, so instead of using basename $< to
get just the filename and not the full path, just use the filename directly.

llvm-svn: 9730
2003-11-05 06:43:36 +00:00
Alkis Evlogimenos
c6a7c83333 Change all machine basic block modifier functions in MRegisterInfo to
return the number of instructions added to/removed from the basic block
passed as their first argument.

Note: This is only needed because we use a std::vector instead of an
ilist to keep MachineBasicBlock instructions. Inserting an instruction
to a MachineBasicBlock invalidates all iterators to the basic
block. The return value can be used to update an index to the machine
basic block instruction vector and circumvent the iterator elimination
problem but this is really not needed if we move to a better
representation.

llvm-svn: 9704
2003-11-04 22:57:09 +00:00
Chris Lattner
c4cfc20335 Fix problems in previous changes. This fixes several regressions last night.
llvm-svn: 9694
2003-11-04 16:04:32 +00:00
Chris Lattner
414e572f11 Significantly simplify constant emission by unifying the stuff which used to build up
strings with the stuff that used to print to an ostream directly.  We now NEVER build
up big strings, only to print them once they are formed.

llvm-svn: 9686
2003-11-03 20:19:49 +00:00
Chris Lattner
f100e90240 Incorporate printSingleConstantValue into its single caller
llvm-svn: 9684
2003-11-03 19:44:05 +00:00
Chris Lattner
2943114bfd * Reformat some code
* Emit bools as 1/0 instead of true/false, fixing compilation of eon and
  PR 83 & Jello/2003-11-03-GlobalBool.llx

llvm-svn: 9683
2003-11-03 19:33:45 +00:00
Chris Lattner
0e32494c79 Delete unused EmitByteSwap method
Implement mul/div/rem constant expressions

llvm-svn: 9424
2003-10-23 17:21:43 +00:00
Misha Brukman
0f649c0045 * Order includes according to style guide
* Convert tabs to spaces
* Make code fit within 80 columns

llvm-svn: 9416
2003-10-23 16:22:08 +00:00
Misha Brukman
f8d45938f8 Converted tabs to spaces.
llvm-svn: 9360
2003-10-22 03:10:26 +00:00
John Criswell
de34542f41 Added LLVM copyright header.
llvm-svn: 9321
2003-10-21 15:17:13 +00:00
John Criswell
71d2894956 Added LLVM copyright notice to Makefiles.
llvm-svn: 9312
2003-10-20 22:26:57 +00:00
John Criswell
b402729b30 Added LLVM project notice to the top of every C++ source file.
Header files will be on the way.

llvm-svn: 9298
2003-10-20 19:43:21 +00:00
Brian Gaeke
9501118e3b Minor leftover fixups from replaceMachineCodeForFunction () change.
llvm-svn: 9295
2003-10-20 17:59:09 +00:00
Brian Gaeke
afbe8787cc Make replaceMachineCodeForFunction return void.
llvm-svn: 9288
2003-10-20 15:15:17 +00:00
Chris Lattner
c4f8226aaf Emit x86 instructions for: A = B op C, where A and B are 16-bit registers,
C is a constant which can be sign-extended from 8 bits without value loss,
and op is one of: add, sub, imul, and, or, xor.

This allows the JIT to emit the one byte version of the constant instead of
the two or 4 byte version.  Because these instructions are very common, this
can save a LOT of code space.  For example, I sampled two benchmarks, 176.gcc
and 254.gap.

BM        Old     New    Reduction
176.gcc 2673621 2548962  4.89%
254.gap  498261  475104  4.87%

Note that while the percentage is not spectacular, this did eliminate
124.6 _KILOBYTES_ of codespace from gcc.  Not bad.

Note that this doesn't effect the llc version at all, because the assembler
already does this optimization.

llvm-svn: 9284
2003-10-20 05:53:31 +00:00
Chris Lattner
c83d8249cb Further cleanups and simplifications
llvm-svn: 9282
2003-10-20 04:48:06 +00:00
Chris Lattner
fce0650cee Eliminate code for pointer size and endianness emulation.
llvm-svn: 9281
2003-10-20 04:11:23 +00:00
Misha Brukman
be506fc1c5 The Grammar Police was here.
llvm-svn: 9280
2003-10-20 04:03:10 +00:00
Chris Lattner
5a577c0b28 * Rename X86::IMULr16 -> X86::IMULrr16
* Implement R1 = R2 * C where R1 and R2 are 32 or 16 bits. This avoids an
  extra copy into a register, reducing register pressure.

llvm-svn: 9278
2003-10-20 03:42:58 +00:00
Chris Lattner
3d519c7bab * Multiplications by 2^X are turned into shifts. This factors code out of the
getelementptr code path for use by other code paths (like malloc and alloca).
* Optimize comparisons with zero
* Generate neg, not, inc, and dec instructions, when possible.

This gives some code size wins, which might translate into performance.  We'll
see tommorow in the nightly tester.

llvm-svn: 9267
2003-10-19 21:09:10 +00:00
Chris Lattner
57825f087d Add some new instructions. Wheee
llvm-svn: 9266
2003-10-19 19:25:35 +00:00
Chris Lattner
9107ee3a11 .string adds an implicit zero at the end. This is not what we wanted.
This fixes PR#44.

llvm-svn: 9252
2003-10-19 02:51:01 +00:00
Chris Lattner
de87c8a892 Fix bug: Jello/2003-10-18-PHINode-ConstantExpr-CondCode-Failure.llx
This also fixes miscompilation of 176.gcc.

llvm-svn: 9249
2003-10-19 00:26:11 +00:00
Chris Lattner
0a276257ae Add support for the new varargs intrinsics
llvm-svn: 9224
2003-10-18 05:56:40 +00:00
Brian Gaeke
821c0e653c You can't just blat the address into memory, you have to blat its
displacement.

llvm-svn: 9210
2003-10-17 21:47:25 +00:00
Brian Gaeke
21797d71d9 Implement replaceMachineCodeForFunction() for x86.
llvm-svn: 9204
2003-10-17 18:27:46 +00:00
Brian Gaeke
4380148f33 Add prototype for replaceMachineCodeForFunction().
llvm-svn: 9202
2003-10-17 18:27:25 +00:00
Brian Gaeke
edea9eca83 Fix typo in comment.
llvm-svn: 9187
2003-10-16 23:45:05 +00:00
Chris Lattner
f46c45682a Add support for 'weak' linkage.
llvm-svn: 9171
2003-10-16 18:29:00 +00:00
Chris Lattner
f2ed60c0b7 Decrease usage of use_size()
llvm-svn: 9135
2003-10-15 16:48:29 +00:00
Chris Lattner
c115e75755 Output a contorted sequence of instructions to make sure that we don't access
off the bottom of the stack.  This fixes PR#41

llvm-svn: 9114
2003-10-14 19:09:05 +00:00
Chris Lattner
907de53acb Disable the leaf function optimization, which is apparently not legal on
X86/linux.  :(  The problem is that a signal delivered while the function
is executing could clobber the functions stack.  This is a partial fix
for PR41.

llvm-svn: 9113
2003-10-14 18:52:41 +00:00
Misha Brukman
868eac95dd Fix spelling.
llvm-svn: 9027
2003-10-10 17:57:28 +00:00
Brian Gaeke
f9a4341b54 Add # of printed instructions statistic to both the SPARC and X86 LLC backends.
llvm-svn: 8892
2003-10-06 15:41:21 +00:00
Chris Lattner
fc3f9605a7 Instead of hacking in custom support for Invoke/Unwind, use the LowerInvoke pass
llvm-svn: 8871
2003-10-05 19:15:47 +00:00
Alkis Evlogimenos
a37b58ce09 Moved enum and command-line option in separate file. Also added function that returns the user selected register allocator to the caller.
llvm-svn: 8819
2003-10-02 16:57:49 +00:00
Alkis Evlogimenos
42a09316bb Change llc command line for register allocators
llvm-svn: 8815
2003-10-02 06:13:19 +00:00
Alkis Evlogimenos
a50598c684 Revert previous change. For some reason this went into the main branch
llvm-svn: 8805
2003-10-01 19:40:13 +00:00
Alkis Evlogimenos
e3af981096 Added command line option for linear scan allocator
llvm-svn: 8804
2003-10-01 19:38:10 +00:00
Chris Lattner
5468c196f3 Be a little more specific about what is begin generated. Only print
command line if VERBOSE=1

llvm-svn: 8453
2003-09-10 19:52:54 +00:00
Chris Lattner
f9db4af8bf Only emit inter-field-padding if the amount of padding is != 0
llvm-svn: 8452
2003-09-10 19:52:24 +00:00
John Criswell
e783801878 Updated to find source files using VPATH. This makes writing build rules
much cleaner and easier.
Labeled .td as a suffix for tblgen files in Makefile.rules.
Modified build rules so that source files generated during the build are placed
in the build directory and not the source directory (and not in a Debug
directory).  This makes the system cleaner and allows us to have a read-only
source tree.

llvm-svn: 8424
2003-09-09 20:57:03 +00:00
Chris Lattner
e35b8fabc4 * Simplify printConstantValueOnly by moving the tail padding stuff directly
into the struct case.
* Extend printConstantValueOnly to print .zero's if the initializer is zero
* Delete dead isConstantFunctionPointerRef function
* Emit the appropriate assembly for the various linkage types!

llvm-svn: 8417
2003-09-09 16:23:36 +00:00
Chris Lattner
e8ae7bf114 Eliminate support for the llvm.unwind intrinisic, using the Unwind instruction instead
llvm-svn: 8411
2003-09-08 19:44:26 +00:00
Chris Lattner
4ad8720f91 Add support for the unwind instruction
llvm-svn: 8408
2003-09-08 18:54:55 +00:00
John Criswell
bd1d21a0b4 Checkin of autoconf-style object root.
Adjusted Makefile to work with new autoconf-style object root.
Specifically, use the new -I option of tblgen to find include files.

llvm-svn: 8379
2003-09-06 14:50:22 +00:00
Chris Lattner
3d53c382ba OptInfo is no longer required
llvm-svn: 8312
2003-09-01 20:41:07 +00:00
Chris Lattner
062cc9d341 Add support for the llvm.unwind intrinsic, which we codegen to just do an abort
until we implement unwinding.
Add support for the invoke instruction, which codegens just like a call with
a branch after it.

The end effect of this change is that programs using the invoke instruction,
but never unwinding, will work fine.  Programs that unwind will abort until
we get unwind support.

llvm-svn: 8187
2003-08-28 21:23:43 +00:00
Chris Lattner
f31d84d7c5 Targets should configure themselves based on a Module, not some wierd flags
llvm-svn: 8132
2003-08-24 19:49:48 +00:00
Chris Lattner
d627d84e23 Implement: Jello/test-constantexpr.ll
llvm-svn: 8127
2003-08-24 19:19:47 +00:00
Chris Lattner
ce3c869e38 Change all #include'd files to be :: rules instead of : rules
llvm-svn: 8019
2003-08-21 20:37:17 +00:00
Chris Lattner
f54b131a49 Add support for the sig(set|long)jmp intrinsics
llvm-svn: 7951
2003-08-18 16:06:09 +00:00
Misha Brukman
56f7db4178 Spell `necessary' correctly.
llvm-svn: 7944
2003-08-18 14:43:39 +00:00
Chris Lattner
c5e9b1f3cd Fix ABI issue: Longs really do need to be only 4 byte aligned on X86.
This bug caused miscompilation of programs using 'struct stat', but only if
compiled with support for 64-bit filesystems.  This could in theory effect
other things, but only if the LLVM code shared data structures with native code.

llvm-svn: 7928
2003-08-17 23:20:40 +00:00
Chris Lattner
fb986e7b44 Adjust to new API, add expandCall stub
llvm-svn: 7873
2003-08-15 04:51:59 +00:00
Chris Lattner
8d79ae7383 Add support for unconditional branches and for emitting JE instructions
llvm-svn: 7872
2003-08-15 04:50:49 +00:00
Brian Gaeke
4fff8d3bd8 X86 static backend: smacked
Function at a time: smacked

Who you gonna call!!!  :-)

llvm-svn: 7826
2003-08-13 19:02:09 +00:00
Brian Gaeke
77c65be59e Factory methods for FunctionPasses now return type FunctionPass *.
llvm-svn: 7823
2003-08-13 18:18:15 +00:00
Brian Gaeke
299cf12f45 addPassesToJITCompile and addPassesToEmitMachineCode now take a
FunctionPassManager, to support function-at-a-time compilation and
 emission of code.

llvm-svn: 7821
2003-08-13 18:17:27 +00:00
Brian Gaeke
ccafb6e504 addPassesToJITCompile now takes a FunctionPassManager, to support
function-at-a-time compilation and emission of code.
Separate addPassesToEmitAssembly from addPassesToJITCompile, because
 the latter requires you to use FunctionPasses, and the former might
 diverge anyway.

llvm-svn: 7817
2003-08-13 18:15:52 +00:00
Brian Gaeke
feb6f95e87 Factory methods for FunctionPasses now return type FunctionPass *.
Correct one of the functions' comments.

llvm-svn: 7816
2003-08-13 18:15:29 +00:00
Brian Gaeke
a735c79a1b Factory methods for FunctionPasses now return type FunctionPass *.
Revert (to v1.55) one of the hunks of Chris's change that messed up the
 %-register workaround.

llvm-svn: 7815
2003-08-13 18:15:15 +00:00
Brian Gaeke
595d18ac2a Just incorporating some notes I wrote for myself into a place where they won't
get lost...

llvm-svn: 7798
2003-08-13 00:30:48 +00:00
Chris Lattner
be0530bab9 Add basic support for 16 and 32 bit function arguments!
llvm-svn: 7755
2003-08-11 21:30:00 +00:00
Chris Lattner
a577beaba5 Sort #includes, eliminate #include of "llvm/Type.h" which was redundant
llvm-svn: 7746
2003-08-11 20:06:16 +00:00
Chris Lattner
05b3cd4716 Cygwin apparently works with %'s on registers!
llvm-svn: 7745
2003-08-11 20:04:57 +00:00
Chris Lattner
d29a705b4b Whoops, accidental checkin. :(
llvm-svn: 7743
2003-08-11 19:35:46 +00:00
Chris Lattner
84e5185cbd Add a new -enable-cygwin-compatible-output argument, which make the output more
consumably by the cygwin assembler.  This is really just a nasty hack until we
get real target triple support.

llvm-svn: 7742
2003-08-11 19:35:26 +00:00
Brian Gaeke
e599cf3856 Print % signs before register names; turn off "noprefix" mode in gas output.
Fixes test case test/Programs/LLVMSource/2003-08-03-ReservedWordGlobal.ll.

Also: Refactor implicit-uses printing into its own method.
Remove a couple of unused variables.

llvm-svn: 7737
2003-08-11 19:05:46 +00:00
Chris Lattner
1ecd1818a0 Add (ret int) expander so that we can at least write testcases
llvm-svn: 7730
2003-08-11 15:48:00 +00:00
Misha Brukman
caed7aad11 Converted tabs to spaces.
llvm-svn: 7728
2003-08-11 15:38:50 +00:00
Misha Brukman
a0b2a82f8d Removed `-debug' so that spurious printouts of patterns are not seen at
compilation time.

llvm-svn: 7727
2003-08-11 15:30:20 +00:00
Chris Lattner
3f4b5cf09a Add patterns for multiply, and, or, and xor
llvm-svn: 7725
2003-08-11 15:23:25 +00:00
Chris Lattner
4650950aee Until the pattern matching instruction selector is finished, enable debug output from it
llvm-svn: 7722
2003-08-11 15:11:01 +00:00
Chris Lattner
3dc2860679 Add support for a pattern matching instruction selector. This is still in
the early implementation phases, so it is disabled by default

llvm-svn: 7719
2003-08-11 14:59:22 +00:00
Chris Lattner
a263312e82 This register is never used, disable it.
llvm-svn: 7661
2003-08-07 04:49:16 +00:00
Chris Lattner
07a484e6f6 Completely eliminate the isVoid TSFlag, shifting over all other fields
llvm-svn: 7636
2003-08-06 15:32:20 +00:00
Chris Lattner
83831c66fc add a pattern for RET, immediates no longer need to be explicitly typed
llvm-svn: 7635
2003-08-06 15:31:35 +00:00
Chris Lattner
6488844c2e Factor shared code
llvm-svn: 7600
2003-08-05 16:34:44 +00:00
Chris Lattner
17fc21b5fa This is the real fix for the previous register allocator problem.
Physical registers should not float around.

llvm-svn: 7587
2003-08-05 00:48:47 +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
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
0d7b042206 transition to using let instead of set
llvm-svn: 7564
2003-08-04 04:59:56 +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
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
25e28f61ab Set debug types
llvm-svn: 7532
2003-08-03 21:14:38 +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
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
1baa706ab7 Move DEBUG to Debug.h
llvm-svn: 7497
2003-08-01 22:21:34 +00:00
Chris Lattner
8dce81478f This method is long dead
llvm-svn: 7460
2003-08-01 03:48:42 +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
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
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
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
40cc4c1392 Rename function to be more consistent with filename
llvm-svn: 7352
2003-07-26 23:49:58 +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
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
Brian Gaeke
77b077a109 It doesn't appear that we need to #include these.
llvm-svn: 7291
2003-07-24 17:48:53 +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
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
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
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
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
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
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
Brian Gaeke
028985aa27 Insert workaround for GAS bug in assembling FLD/FSTP XWORD PTR [...]
instructions, by outputting them as bytes.

llvm-svn: 7115
2003-07-07 18:34:20 +00:00
John Criswell
258dfc0319 Merged in autoconf branch. This provides configuration via the autoconf
system.

llvm-svn: 7014
2003-06-30 21:59:07 +00:00
Chris Lattner
d212141d9e Setjmp should always return zero if we don't implement longjmp. This avoids
leaving trash in the register, fixing anagram

llvm-svn: 7013
2003-06-30 19:35:54 +00:00
Chris Lattner
6b31a873ee Until there is a setjmp/longjmp transformation pass, codegen setjmp as a noop
and longjmp as an abort!

llvm-svn: 6977
2003-06-29 16:42:32 +00:00
Brian Gaeke
6f2c46cd52 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.

llvm-svn: 6924
2003-06-27 00:00:48 +00:00
Brian Gaeke
7f1a3ef833 Number constants from constant pool as CPIf_i where f is the function index
and i is the constant pool index.

llvm-svn: 6920
2003-06-26 18:02:30 +00:00
Brian Gaeke
ff614a8a0c Integrate the C writer's name mangler.
llvm-svn: 6908
2003-06-25 22:00:39 +00:00
Brian Gaeke
065bf4bab2 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.

llvm-svn: 6907
2003-06-25 18:01:07 +00:00
Chris Lattner
38b7729915 Do not use the inefficient, fixed function, CBW, CDQ, ... instructions
llvm-svn: 6844
2003-06-22 03:31:18 +00:00
Chris Lattner
7fb273d416 Minor simplification to 64-bit instsel
llvm-svn: 6831
2003-06-21 18:15:27 +00:00
Chris Lattner
2840a1b4ee 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!

llvm-svn: 6830
2003-06-21 17:16:58 +00:00
Chris Lattner
2b10fcccd0 Add IMULr16 & IMULr32 instructions
llvm-svn: 6829
2003-06-21 17:13:35 +00:00
Chris Lattner
4a8d96567f Generate code for LONG indexes to getelementptr instructions more efficiently
llvm-svn: 6828
2003-06-21 16:01:24 +00:00
Brian Gaeke
a45dda3054 Fix output bug: Intel asm comment character is #, not ;.
llvm-svn: 6792
2003-06-19 19:58:32 +00:00
Brian Gaeke
9a1a7c9671 RECAPITALIZE all the names of pseudo-instructions, and add a comment explaining
the convention.

:-)

llvm-svn: 6791
2003-06-19 19:41:13 +00:00
Brian Gaeke
a734842f8a 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.

llvm-svn: 6790
2003-06-19 19:34:44 +00:00
Brian Gaeke
beb320af87 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.

llvm-svn: 6789
2003-06-19 19:32:32 +00:00
Brian Gaeke
7d145b44cc lib/Target/X86/X86TargetMachine.{cpp,h}: Add initial version
(non-working) of llc guts for X86, and add a prototype for it.

llvm-svn: 6779
2003-06-18 21:43:21 +00:00
Brian Gaeke
4681b27a92 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.

llvm-svn: 6723
2003-06-16 21:54:01 +00:00
Chris Lattner
d4e4130f0a Fix warnings on Sparc
llvm-svn: 6658
2003-06-06 18:25:33 +00:00
Chris Lattner
437985e52c Add statistic for # machine instrs emitted
Add GROSS HACK to get CompilationCallback to work when compiled in release mode

llvm-svn: 6646
2003-06-06 04:00:05 +00:00
Chris Lattner
6a3d2fc70e Implement generation of cmp R, C to not use an extra register
llvm-svn: 6627
2003-06-05 19:30:30 +00:00
Chris Lattner
ee044c3179 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. :)

llvm-svn: 6626
2003-06-05 18:28:55 +00:00
Chris Lattner
c1bc144c7d Add instructions for (add|sub|and|or|xor)ri(8|16|32)
llvm-svn: 6625
2003-06-05 18:25:08 +00:00
Chris Lattner
1cb899dd19 Remove usage of typedef
llvm-svn: 6583
2003-06-03 15:41:58 +00:00
Chris Lattner
92fba99afb Add namespace comments for doxygen
llvm-svn: 6581
2003-06-03 15:31:23 +00:00
Misha Brukman
cb7c80a95c Eliminated a compiler warning due to casting to a different-sized datatype.
llvm-svn: 6531
2003-06-02 04:13:58 +00:00
Misha Brukman
8ce9f2956e Renamed MachineCodeEmitter.cpp -> X86CodeEmitter.cpp as it conflicts with the
target-independent lib/CodeGen/MachineCodeEmitter.cpp; preserved CVS history.

llvm-svn: 6528
2003-06-02 03:28:00 +00:00
Chris Lattner
be569e986d Move X86 specific code out of the JIT into the X86 backend
llvm-svn: 6516
2003-06-01 23:23:50 +00:00
Chris Lattner
bf8929c4bb * Implement cast (long|ulong) to bool
* Fix cast of (short|ushort|int|uint) to bool to work right

llvm-svn: 6510
2003-06-01 03:38:24 +00:00
Chris Lattner
dce4ab92a4 Add RR forms of test instruction
llvm-svn: 6509
2003-06-01 03:37:46 +00:00
Chris Lattner
92eb5bbb15 Add support for shl and shr for 64 bit integer types
llvm-svn: 6499
2003-06-01 01:56:54 +00:00
Chris Lattner
96f7ec62fe Add definitions for TEST instructions
llvm-svn: 6498
2003-06-01 01:56:39 +00:00
Chris Lattner
f37c407475 Add new cmovne32 instruction
llvm-svn: 6496
2003-06-01 00:05:15 +00:00
Vikram S. Adve
743adbaff7 Renamed opIsDef to opIsDefOnly.
llvm-svn: 6340
2003-05-27 00:03:17 +00:00
Misha Brukman
6ffaa5b188 Reword to remove reference to how things worked in the past.
llvm-svn: 6323
2003-05-24 01:08:43 +00:00
Misha Brukman
b7a0d570a8 Implement the TargetInstrInfo's createNOPinstr() and isNOPinstr() interface.
llvm-svn: 6320
2003-05-24 00:09:50 +00:00
Chris Lattner
f365fdec06 Clean up #includes
llvm-svn: 6173
2003-05-13 20:21:19 +00:00
Chris Lattner
19ca50fe2a Make abort more explicit
llvm-svn: 6151
2003-05-12 21:16:26 +00:00
Chris Lattner
f1a6a1fde1 Remove the assertion failure of course... doh
llvm-svn: 6150
2003-05-12 20:39:39 +00:00
Chris Lattner
ed3b3d7c99 Implement casts from unsigned integers to floating point
llvm-svn: 6148
2003-05-12 20:36:13 +00:00
Chris Lattner
a9a5cdb2be Make error messages more useful than jsut an abort
llvm-svn: 6146
2003-05-12 20:16:58 +00:00
Chris Lattner
56f8186e3e Do not insert multiple initializations for the same value in a PHI node
llvm-svn: 6113
2003-05-12 14:22:21 +00:00
Chris Lattner
99520168c9 This blank line has GOT to go.
llvm-svn: 6057
2003-05-09 03:28:13 +00:00
Chris Lattner
78f5953056 Add support for Add, Sub, And, Or, & Xor constant exprs
llvm-svn: 6049
2003-05-08 20:49:25 +00:00
Chris Lattner
d747f762ff Add support for variable argument functions!
llvm-svn: 6046
2003-05-08 19:44:13 +00:00
Chris Lattner
59c46ee655 IMPLICIT_DEF was not the beautiful elegant solution I thought it was going
to be.  In fact, it made stuff worse.  :(

llvm-svn: 6013
2003-05-07 19:21:28 +00:00
Chris Lattner
54c4b56baf Emit pseudo instructions to indicate that some registers are live on entrance
and exit of the function.  This fixes bug: Jello/2003-05-06-LivenessClobber.llx
and the Fhourstones benchmark

llvm-svn: 6010
2003-05-06 21:32:22 +00:00
Chris Lattner
b6fab2a875 Don't have a cow with new pseudo instructions
llvm-svn: 6009
2003-05-06 21:31:47 +00:00
Chris Lattner
e4c33a0ca0 Add two new pseudo instructions
llvm-svn: 6008
2003-05-06 21:31:31 +00:00
Misha Brukman
bd9b827093 The Hyphenation-Adding Committee is now in session.
llvm-svn: 5986
2003-05-03 02:18:17 +00:00
Chris Lattner
bbe1aba425 Remove two fields from TargetData which are target specific.
llvm-svn: 5963
2003-04-26 20:11:09 +00:00
Chris Lattner
1f7fab6047 Fix bogus assert
llvm-svn: 5949
2003-04-25 21:58:54 +00:00
Chris Lattner
844b1148f4 Fix compatibility bug: X86 aligns doubles to 4 bytes, not 8!
llvm-svn: 5935
2003-04-25 06:05:57 +00:00
Chris Lattner
6ae5107de6 Fix iterator invalidation problem with cast instructions
llvm-svn: 5876
2003-04-23 17:57:48 +00:00
Chris Lattner
c40d8cd8cd Implement the constantexpr CAST instruction correctly
llvm-svn: 5875
2003-04-23 17:22:12 +00:00
Chris Lattner
ec5f9a7c4f Add support for the Switch instruction by running the lowerSwitch pass first
llvm-svn: 5867
2003-04-23 16:24:55 +00:00
Misha Brukman
4147d10d28 It's "necessary"...
llvm-svn: 5848
2003-04-22 20:20:11 +00:00
Misha Brukman
c06beb4c03 It's "necessary" to spell "necessarily" correctly.
llvm-svn: 5833
2003-04-22 17:54:23 +00:00
Chris Lattner
a48a91d095 Add support for a simple constantexpr: cast of one ptr type to another
llvm-svn: 5829
2003-04-21 21:33:44 +00:00
Chris Lattner
ea424f3aff Rename -no-* to -disable-*
llvm-svn: 5642
2003-02-26 20:00:41 +00:00
Chris Lattner
bf414ca145 Don't emit unneccesary branch instructions!
llvm-svn: 5328
2003-01-16 18:07:23 +00:00
Chris Lattner
0a6ac532e1 Fix problem with invalidated iterator
llvm-svn: 5327
2003-01-16 18:07:13 +00:00
Chris Lattner
7455428f21 Implement optimization folding setcc into branch.
llvm-svn: 5324
2003-01-16 16:43:00 +00:00
Chris Lattner
8b4e7a511b Add more flavors of branch instructions
llvm-svn: 5323
2003-01-16 16:42:45 +00:00
Chris Lattner
013ad21206 Implement code to keep the stack pointer aligned to an 8 byte boundary.
This improves the performance of the power benchmark by a few percent.
This will be neccesary for SSE code, which requires 16 byte alignment of
the stack.

llvm-svn: 5320
2003-01-16 02:20:12 +00:00
Chris Lattner
df631471bf Handle frame offset due to return address pushed on the stack
llvm-svn: 5319
2003-01-15 22:57:35 +00:00
Chris Lattner
1a7dbb190e X86 backend should never use addMReg
llvm-svn: 5288
2003-01-15 00:04:14 +00:00
Chris Lattner
b27d60ccf1 Rename MachineInstrInfo -> TargetInstrInfo
llvm-svn: 5272
2003-01-14 22:00:31 +00:00
Chris Lattner
fe32c9841d New files
llvm-svn: 5260
2003-01-13 01:01:59 +00:00
Chris Lattner
41b715c939 * No longer need lowerallocation pass
* Add X86 Stackifier pass
* Add peephole optimizer pass

llvm-svn: 5233
2003-01-13 00:51:23 +00:00
Chris Lattner
b3776320cf rename FP -> fp*
llvm-svn: 5232
2003-01-13 00:50:46 +00:00
Chris Lattner
b355b13a8e * Move frame and constant pool indexes to first argument of memory reference
so we can put an offset in there as well...
* Fix long/ulong stuff

llvm-svn: 5231
2003-01-13 00:50:33 +00:00
Chris Lattner
4f840c1292 * Some instructions take 64 bit integers, add an Arg type for it
* Add flags for different types of FP pseudo instrs

llvm-svn: 5230
2003-01-13 00:49:24 +00:00
Chris Lattner
902000e290 * Function calls clobber fp registers
* Use new M_TERMINATOR_FLAG flag
* Add ::Void flag on several instructions so def-use info is correct!
* Implement MANY FP instructions
* Finalize pseudo FP instructions
* Add set of Pseudo FP instruction description flags
* Add support for MOVim instrs
* Add support for 64 bit support instrs, like adc sbb, etc
* Add conditional move

llvm-svn: 5229
2003-01-13 00:48:46 +00:00
Chris Lattner
af51740068 Add support for frame and constant pool references
llvm-svn: 5228
2003-01-13 00:45:53 +00:00
Chris Lattner
b264e01cfe Move passes out to Passes.h
llvm-svn: 5227
2003-01-13 00:45:29 +00:00
Chris Lattner
9b01e3a012 Add speculation
llvm-svn: 5226
2003-01-13 00:35:08 +00:00
Chris Lattner
21c83b54c0 * Implement rudimentary output of the constant pool
* Implement support for MRMS?m instructions
* Add Arg64 support
* Add support for frame indexes and constant pool indexes
*

llvm-svn: 5225
2003-01-13 00:35:03 +00:00
Chris Lattner
d329d95d7f * Add support for FP registers ST*
* Add support for the constant pool & constant pool indices
* Add support for MRMS?m instructions
* Fix FP Prefix emission
* Add support for global addresses and external symbols

llvm-svn: 5224
2003-01-13 00:33:59 +00:00
Chris Lattner
f3989edae2 * Adjust to use new interfaces, eliminating CurReg stuff
* Support arbitrary FP constants
* Fix bugs in frame layout for function calls and incoming arguments
* Insert copies for constant arguments to PHI nodes into the BOTTOM of
  predecessor blocks, not the top.
* Implement _floating point_ support: setcc, return, load, store, cast
* Fix several bugs in the cast instruction
* Abstract out call emission and load/store for FP
* Implement malloc/free without previous lowering pass.
* Make use of new forms of MachineOperand
* Implement _long_ support!
* Fix many bugs in FP support
* Change branch from je/jne to je/jmp
* Simplify code generated for GEP instructions

llvm-svn: 5223
2003-01-13 00:32:26 +00:00
Chris Lattner
dfa3c21f1c More renamings of Target/Machine*Info to Target/Target*Info
llvm-svn: 5204
2002-12-29 03:13:05 +00:00
Chris Lattner
bff4411f3a Rename MachineOptInfo to TargetoptInfo
Rename MachineCacheInfo to TargetCacheInfo

llvm-svn: 5203
2002-12-29 02:50:35 +00:00
Chris Lattner
ea33ca1e96 Rename FunctionFrameInfo to MachineFrameInfo
llvm-svn: 5201
2002-12-28 21:08:28 +00:00
Chris Lattner
2407294a41 Rename MachineFrameInfo to TargetFrameInfo.h
llvm-svn: 5199
2002-12-28 21:00:25 +00:00
Chris Lattner
105b7d86fb Implement the TargetFrameInfo interface
llvm-svn: 5189
2002-12-28 20:33:52 +00:00
Chris Lattner
c98a33844d * Initialize new FrameInfo member
* most pass ctors no longer take TM arguments
* New prolog/epilog insertion pass

llvm-svn: 5188
2002-12-28 20:33:32 +00:00
Chris Lattner
56a499f4ee Changes to match new MRegisterInfo api
llvm-svn: 5187
2002-12-28 20:32:54 +00:00
Chris Lattner
a2bb8607ab *** Implement frame pointer elimination on X86!
* Include contents of X86RegisterClasses.cpp into here
* Adjustments to register api to work with new frame manager
* Eliminate moveImm2Reg, getFramePointer, and getStackPointer
* Cleanup and simplify prolog/epilog code generation
* Prolog/epilog are MUCH more efficient now.

llvm-svn: 5186
2002-12-28 20:32:28 +00:00
Chris Lattner
df4f605836 Contents merged with X86RegisterInfo.cpp
llvm-svn: 5185
2002-12-28 20:30:15 +00:00
Chris Lattner
4c782b2fb2 * Remove implementations of previously pure virtual functions that are not any longer.
llvm-svn: 5184
2002-12-28 20:29:41 +00:00
Chris Lattner
edd79f7fe1 * Minor reformatting
* Remove some size suffixes [bwl]
* Add new ADJCALLSTACKDOWN & ADJCALLSTACKUP pseudo instrs
* Call instructions are M_CALL not M_BRANCH!
* Disable push and pop instructions
* Add new ANDri32 instr

llvm-svn: 5183
2002-12-28 20:29:14 +00:00
Chris Lattner
f6da2e0f4c New addFrameReference function
llvm-svn: 5182
2002-12-28 20:26:58 +00:00
Chris Lattner
2342bfb2f9 * Most pass ctor functions don't take TM arguments anymore
* New createPrologEpilogCodeInserter() function

llvm-svn: 5181
2002-12-28 20:26:16 +00:00
Chris Lattner
be4392473a * Convert to a MachineFunctionPass
* Don't take a TM as a ctor parameter
* Print [X - Y] instead of [X + -Y] when possible

llvm-svn: 5180
2002-12-28 20:25:38 +00:00
Chris Lattner
9f8812ec40 * Convert to a MachineFunctionPass
* ctor doesn't take TM argument
* handle direct ESP references correctly!

llvm-svn: 5179
2002-12-28 20:24:48 +00:00
Chris Lattner
f3b903dcc8 * Use the new Abstract Frame Manager to handle incoming arguments and
fixed size allocas
* Revamp call emission to work with new frame manager

llvm-svn: 5178
2002-12-28 20:24:02 +00:00
Chris Lattner
53e9d39bc2 * Simplify Value classes
* Add initial support for FP constants
* Add initial FP support for several instructions

llvm-svn: 5154
2002-12-25 05:13:53 +00:00
Chris Lattner
e639913b11 * Use new pseudo instr form for instructions
* Mark CALLpcrel as a RawFrm instruction as required
* Eliminate invalid BSWAP16 instruction
* Add xchg instructions
* Add initial support for FP instructions

llvm-svn: 5153
2002-12-25 05:11:46 +00:00
Chris Lattner
d4566a0a47 Add FP instr prefix byte support
Add Pseudo instr class

llvm-svn: 5152
2002-12-25 05:09:59 +00:00
Chris Lattner
c96e206d58 Add support for FP prefixes
llvm-svn: 5151
2002-12-25 05:09:21 +00:00
Chris Lattner
68a2c5d133 Add printer support for Pseudo instructions
llvm-svn: 5150
2002-12-25 05:09:01 +00:00
Chris Lattner
ab905c5375 Initial support for FP registers
llvm-svn: 5149
2002-12-25 05:08:03 +00:00
Chris Lattner
05a3f80d24 New simpler spill interface
llvm-svn: 5148
2002-12-25 05:07:09 +00:00
Chris Lattner
34940d2aa8 Adjustments to match new simpler spill interface
llvm-svn: 5147
2002-12-25 05:06:43 +00:00
Chris Lattner
31a733bd3a Free machine code
llvm-svn: 5146
2002-12-25 05:06:21 +00:00
Chris Lattner
886374c6bc Changes to allow for a configurable target machine that allows big endian and/or long pointer operation
llvm-svn: 5131
2002-12-24 00:04:01 +00:00
Chris Lattner
16378bf522 Changes to compile with GCC 2.96
Changes to support configurable pointer size and endianness

llvm-svn: 5130
2002-12-24 00:03:11 +00:00
Chris Lattner
8e628685d9 Fix compilation on gcc 2.96
llvm-svn: 5116
2002-12-23 23:46:55 +00:00
Chris Lattner
285f1458f0 Add definition for the bswap instruction
*** FIX: the encoding of the SUB instruction

llvm-svn: 5115
2002-12-23 23:46:31 +00:00
Chris Lattner
9e13907a4f Add support for the bswap instruction
llvm-svn: 5114
2002-12-23 23:46:00 +00:00
Chris Lattner
2dc1b58c11 Fix warning
llvm-svn: 5109
2002-12-20 04:13:28 +00:00
Chris Lattner
f8876bb77d CBW doesn't modify AL
llvm-svn: 5108
2002-12-20 04:13:11 +00:00
Chris Lattner
d838414ec1 fix warning
llvm-svn: 5107
2002-12-20 04:12:48 +00:00
Chris Lattner
c21fd773b8 Don't force setCC instructions into AL
llvm-svn: 5104
2002-12-18 01:44:31 +00:00
Chris Lattner
b1c74bb421 Add comments, switch uses/defs to match InstrInfo.def file
llvm-svn: 5102
2002-12-18 01:05:54 +00:00
Chris Lattner
0607e84008 Add reg clobber list for direct calls
Represent empty use/def list as a null pointer

llvm-svn: 5101
2002-12-18 01:05:31 +00:00
Chris Lattner
0b617b0e1d Update to use new interface for register info
llvm-svn: 5098
2002-12-17 04:19:17 +00:00
Chris Lattner
dbca3de031 Round number of bytes allocated on the stack up to a multiple of 4 so that the
stack remains aligned

llvm-svn: 5095
2002-12-17 03:15:26 +00:00
Chris Lattner
305d72e965 Local register allocator is now stable enough for use, it passes all tests
llvm-svn: 5094
2002-12-17 02:51:15 +00:00
Chris Lattner
4a60d804c2 Register allocator is responsible for spilling callee saved regs
llvm-svn: 5092
2002-12-17 02:48:57 +00:00
Chris Lattner
c7e6dd2341 Build add instructions of the correct form!
llvm-svn: 5090
2002-12-16 23:36:57 +00:00
Chris Lattner
f5da16f2f6 Two fixes:
* Only load incoming arguments into virtual registers once at the
    beginning of the function
  * Assign different virtual registers to each reference to constants/globals

llvm-svn: 5088
2002-12-16 22:54:46 +00:00
Chris Lattner
9d64c1e53a Fix prolog/epilog in the presence of alloca
llvm-svn: 5087
2002-12-16 22:29:30 +00:00
Chris Lattner
2e17697e81 Make sure stack manipulation refers to ESP the right number of times
llvm-svn: 5086
2002-12-16 22:29:06 +00:00
Chris Lattner
de4d89ef9f Add some special cases to make common getelementptr cases easier to read/faster
llvm-svn: 5084
2002-12-16 19:32:50 +00:00
Chris Lattner
4576429b7c Finish implementation of alias list impl
llvm-svn: 5083
2002-12-16 19:31:48 +00:00
Chris Lattner
4d0ca4b442 Add mechanism to select register allocator to use
llvm-svn: 5079
2002-12-16 16:15:51 +00:00
Chris Lattner
b833239d6b Try #2 to get alias set stuff to work
llvm-svn: 5077
2002-12-16 16:14:51 +00:00
Chris Lattner
eae93bdb93 Add comments
llvm-svn: 5076
2002-12-16 15:57:44 +00:00
Chris Lattner
fd065b6b1a Add info about register aliases, add prototype for createLocalRegisterAllocator
llvm-svn: 5075
2002-12-16 15:55:51 +00:00
Chris Lattner
b413ce63d5 Add info about register file aliasing
llvm-svn: 5074
2002-12-16 15:55:25 +00:00
Chris Lattner
e6ad4941fc Add information about register file aliasing
llvm-svn: 5073
2002-12-16 15:54:59 +00:00
Chris Lattner
68af8985f4 Add call clobber info
llvm-svn: 5072
2002-12-16 15:54:42 +00:00
Chris Lattner
566fb4c7b7 Rename createSimpleX86RegisterAllocator to createSimpleRegisterAllocator
llvm-svn: 5071
2002-12-16 14:38:13 +00:00
Brian Gaeke
e4da1d5de6 brg
Fix some bugs in use of MBB vs. BB and iterators that are invalidated before
we use them.

Reference targetClass by enum name, not by number.

llvm-svn: 5069
2002-12-16 04:23:29 +00:00
Chris Lattner
4964e751cd Correct the setting of Def flags on registers that are modified!
llvm-svn: 5065
2002-12-15 22:38:47 +00:00
Chris Lattner
ea2d8ad746 Give passes nice names!
llvm-svn: 5059
2002-12-15 21:13:40 +00:00
Chris Lattner
4214ac384a Simplify interfaces used by regalloc to insert code
llvm-svn: 5052
2002-12-15 20:06:35 +00:00
Chris Lattner
ce23fdeee2 Changes to make new TargetRegisterClass interface.
llvm-svn: 5050
2002-12-15 19:29:34 +00:00
Chris Lattner
caa325a559 * Simplify TargetRegisterClass implementations
* Change regclass iterators to use an extra level of pointers

llvm-svn: 5047
2002-12-15 18:40:36 +00:00
Chris Lattner
50d99540cf Add support to cast from a bool type
Add support for boolean constants
add getClassB method

llvm-svn: 5034
2002-12-15 08:02:15 +00:00
Chris Lattner
534876a78c Use MachineOperand::isFoo methods instead of our own global functions
llvm-svn: 5033
2002-12-15 08:01:39 +00:00
Chris Lattner
bd4d66147f Implement indirect function calls
llvm-svn: 5024
2002-12-13 14:13:27 +00:00
Misha Brukman
3587ffc7b1 Make function code generation printing debug-only.
llvm-svn: 5023
2002-12-13 13:16:14 +00:00
Chris Lattner
c7db3e855f Fix bork in doMultiply
llvm-svn: 5021
2002-12-13 13:07:42 +00:00
Chris Lattner
7d5d4f7ab4 Add sanity checks
llvm-svn: 5020
2002-12-13 13:04:04 +00:00
Misha Brukman
2f2cf00a9f Cleaned up the code: factored out switch/case into a separate function, put
constants in an array for quick lookup. Stole the idea from elsewhere in
Jello.

llvm-svn: 5017
2002-12-13 12:00:06 +00:00
Chris Lattner
de2f97c5e6 Insert phi code at top of block
llvm-svn: 5015
2002-12-13 11:52:34 +00:00
Brian Gaeke
460fe53768 lib/Target/X86/InstSelectSimple.cpp:
The MachineBasicBlock variable name patrol hereby fines Chris Lattner
one bag of nachos, for shadowing global names while his license to do so
was under suspension.

llvm-svn: 5014
2002-12-13 11:39:18 +00:00
Chris Lattner
2c2a5f128e Implement cast bool to X
llvm-svn: 5012
2002-12-13 11:31:59 +00:00
Brian Gaeke
b101130d19 Rename all BMI MachineBasicBlock operands to MBB.
Try to mess around with emitGEPOperation's elementSizeReg to make it work,
again.

llvm-svn: 5011
2002-12-13 11:22:48 +00:00
Chris Lattner
cad7e99ea1 Finish up iterator stuph
llvm-svn: 5009
2002-12-13 10:50:40 +00:00
Misha Brukman
b6fb990276 Treat longs as ints => pretend they're all 32-bit values and squeeze them into
32-bit registers.

llvm-svn: 5008
2002-12-13 10:43:09 +00:00
Chris Lattner
416a9ca8f1 Code gen phi's correctly
llvm-svn: 5004
2002-12-13 10:09:43 +00:00
Chris Lattner
505ace489e Print X86 PHI nodes in a sane manner
llvm-svn: 5003
2002-12-13 09:59:26 +00:00
Misha Brukman
fb02408496 Added moveReg2Reg() and moveImm2Reg() to accomodate moving data around due to
PHI nodes.

llvm-svn: 5001
2002-12-13 09:54:12 +00:00
Brian Gaeke
34ad176df5 lib/Target/X86/InstSelectSimple.cpp: Start counting arguments with 2,
because arguments start two stack slots off of EBP. Break out of the
 for loop once the argument is found. Increment the counter at the end
 of the loop instead of the beginning. Use addRegOffset and compute
 the scale * index part at compile time instead of using the fancy
 load instruction. Just because an instruction set has wacky addressing
 modes doesn't mean we ought to use them (at least, if you believe Dave
 Patterson).

lib/Target/X86/X86InstrBuilder.h: Add some comments.

test/Regression/Jello/test-loadstore.ll:  Let main return int 0.

llvm-svn: 4999
2002-12-13 09:28:50 +00:00
Brian Gaeke
5da234a1d7 InstSelectSimple.cpp: Give promote32 a comment. Add initial
implementation of getReg() for arguments.

MachineCodeEmitter.cpp: Fix using EBP with index, scale and no
 displacement (whew!) due to Chris.

Printer.cpp: Fix printing out index and scale in memory references.

llvm-svn: 4998
2002-12-13 07:56:18 +00:00
Chris Lattner
9e7b73b55f Implement getelementptr constant exprs
Implement ConstantPointerRefs
Treat long/ulongs as if they were integers.  A hack, but an effective one

llvm-svn: 4995
2002-12-13 06:56:29 +00:00
Brian Gaeke
641c6fa60a brg
InstSelectSimple.cpp: Add stub implementation of visitFreeInst.
 Add comments that mention how we are failing to implement malloc/free.
 Add initial implementation of visitAllocaInst.

X86TargetMachine.cpp: Include llvm/Transforms/Scalar.h.
 Add LowerAllocations pass before instruction selection.

jello/Makefile: Add scalaropts.a.

llvm-svn: 4994
2002-12-13 06:46:31 +00:00
Chris Lattner
62454d83f0 Emit the right form of mod/rm mod field
llvm-svn: 4986
2002-12-13 05:05:05 +00:00
Chris Lattner
7ec625a157 Nicify a bit
llvm-svn: 4985
2002-12-13 05:04:37 +00:00
Chris Lattner
4cc9894c71 Fix encoding of CBW instruction
llvm-svn: 4983
2002-12-13 04:41:31 +00:00
Misha Brukman
20c9c61c6d Moves now select correct opcode based on the data size.
llvm-svn: 4981
2002-12-13 04:24:53 +00:00
Chris Lattner
10f305cec7 Remove extranous #include
llvm-svn: 4980
2002-12-13 04:12:24 +00:00
Chris Lattner
723ca2522d Rename MemArg* to Arg*
llvm-svn: 4979
2002-12-13 03:51:55 +00:00
Chris Lattner
b698cd8236 Make mem size an assert
Add mem size flags to all instructions using an imm

llvm-svn: 4978
2002-12-13 03:50:13 +00:00
Misha Brukman
6a5788bb6f This is supposed to provide correct size for datatypes. Supposedly.
llvm-svn: 4977
2002-12-13 02:13:15 +00:00
Misha Brukman
bf2857eb5c Added the flag to mark instructions which are really 2-address instructions in
X86, but would be 3-address in any normail architecture.

llvm-svn: 4974
2002-12-12 23:19:11 +00:00
Brian Gaeke
9b38597288 This checkin is brought to you by the brian gaeke allnighter fund.
(lib/Target/X86) InstSelectSimple.cpp:
 Include llvm/DerivedTypes.h and iostream.
 Refactor visitMul out into a wrapper around doMultiply(), so that we
  can do multiplications on temporary values when we are doing
  getelementptrs.
 Refactor part of getReg out into makeAnotherReg, so that we can create
  registers willy-nilly to hold temporary values, when we are doing
  getelementptrs.
 Add stub implementations of visitMallocInst and visitAllocaInst.
 Add initial implementation of visitGetElementPtrInst.
 In copyConstantToRegister:
  We throw a *lot* of our asserts here. So, when we want to throw an
   assert, print out to stderr whatever expr or whatever constant made
   us barf.
  Support copying ConstantPointerNull to register, using a move immediate
   of zero.
 Rename FLDr4 and FLDr8 to FLDr32 and FLDr64, so that they match the meanings
  of the numbers in the other instruction names. All uses modified.
 Teach visitCallInst to extract byte- and short-class return values
  from subregs of EAX.  Add a FIXME note about how we would do it for
  float-class return values.
 Add a FIXME note about how we would cast float to int and back.

X86InstrInfo.def:
 Rename FLDr4 and FLDr8 to FLDr32 and FLDr64, so that they match the meanings
  of the numbers in the other instruction names. All uses modified.

(tools/jello) GlobalVars.cpp:
 Include iostream.
 If we have to emit a floating-point constant to memory, gamble and use
  the same method as for ints.
 If we have to emit a ConstantPointerNull to memory, try using a "void *"
  and "NULL".
 Otherwise, if we are going to throw an assert, print out whatever constant
  made us barf, first.

llvm-svn: 4973
2002-12-12 15:33:40 +00:00
Brian Gaeke
250d5a3e95 Implement a lot of cast functionality (no FP or 64)
llvm-svn: 4944
2002-12-06 10:49:33 +00:00
Brian Gaeke
dbc34a2a95 Target/X86/Printer.cpp: Add sizePtr function, and use it instead of
" <SIZE> PTR " string when emitting assembly.

Target/X86/X86InstrInfo.def: Tidy up a bit:
 Squashed everything down to 118 chars wide, wrapping lines so that
 comment is at the same point on each line. Rename "NoImpRegs" as
 "NoIR". (most instructions have NoImpRegs twice on a line, so this
 saves 10 columns).

 Also, annotate various instructions with flags for size of memory operand.
  (MemArg16, MemArg32, MemArg64, etc.)

Target/X86/X86InstrInfo.h: Define flags for size of memory operand.
 (MemArg16, MemArg32, MemArg64, etc.)

llvm-svn: 4932
2002-12-05 08:30:40 +00:00
Misha Brukman
7dc6877ce2 Implemented functions for emitting prologues and epilogues;
removed EBP from the list of callee-saved registers (it isn't one).

llvm-svn: 4929
2002-12-04 23:57:03 +00:00
Misha Brukman
e93c7f9d32 Added push and pop instructions.
llvm-svn: 4928
2002-12-04 23:56:26 +00:00
Chris Lattner
70aa4e41ce Fix handling of function calls that return void
llvm-svn: 4925
2002-12-04 23:50:28 +00:00
Chris Lattner
b71d7b4dab Implement initial support for return values from call instructions
llvm-svn: 4924
2002-12-04 23:45:28 +00:00
Misha Brukman
f8634130dc Adjust the stack pointer after a function call, proportional to the number of
arguments pushed onto the stack.

llvm-svn: 4922
2002-12-04 19:22:53 +00:00
Misha Brukman
cf80ad35f3 Added instructions to add/subtract imm32 to/from a reg32.
llvm-svn: 4921
2002-12-04 19:15:22 +00:00
Chris Lattner
96edaabdb2 Fix bogus assertion failures
llvm-svn: 4919
2002-12-04 17:32:52 +00:00
Chris Lattner
b538ae0dba Avoid bad assertion
llvm-svn: 4918
2002-12-04 17:28:40 +00:00
Chris Lattner
feeb16616e Remove think-o assertion
llvm-svn: 4917
2002-12-04 17:18:30 +00:00
Chris Lattner
e21cfc9b6c Avoid crashing on Arguments, just silently miscompile
llvm-svn: 4916
2002-12-04 17:15:34 +00:00
Misha Brukman
101076f586 storeReg2RegOffset() and loadRegOffset2Reg() now take the iterator by value
instead of by reference, since they return the modified iterator.

llvm-svn: 4914
2002-12-04 17:14:13 +00:00
Misha Brukman
6e1c4851ea Moved buildReg2RegClassMap() into from X86RegisterInfo to MRegisterInfo, since
it is target-independent.

llvm-svn: 4911
2002-12-04 16:47:04 +00:00
Chris Lattner
29f4c79239 Add a "Lazy Function Resolution in Jello" section
Remove some todo's

llvm-svn: 4910
2002-12-04 16:12:54 +00:00
Chris Lattner
6c1a85e870 Fix a bug I introduced in a previous change
llvm-svn: 4909
2002-12-04 06:56:56 +00:00
Chris Lattner
73ac28801e Add support for referencing global variables/functions
llvm-svn: 4907
2002-12-04 06:45:19 +00:00
Misha Brukman
5639a6279e Added support for callee- and caller-save registers.
llvm-svn: 4897
2002-12-03 23:11:21 +00:00
Chris Lattner
8cadeb99ab Fix broken ret opcode, grr...
llvm-svn: 4895
2002-12-03 22:50:02 +00:00
Chris Lattner
a31be4e958 Fix instsel for calls
llvm-svn: 4891
2002-12-03 20:30:12 +00:00
Chris Lattner
5629544811 Fix the build
llvm-svn: 4884
2002-12-03 18:15:59 +00:00
Brian Gaeke
c850694f49 brg
Add support for cast ... to bool in visitCastInst (it's a start, anyways...)

llvm-svn: 4883
2002-12-03 07:36:03 +00:00
Chris Lattner
5f0614914e Split the machine code emitter completely out of the printer
llvm-svn: 4882
2002-12-03 06:34:06 +00:00
Chris Lattner
99e7784512 * Move information about Implicit Defs/Uses into X86InstrInfo.def.
* Expose information about implicit defs/uses of register through the
  MachineInstrInfo.h file.

llvm-svn: 4877
2002-12-03 05:42:53 +00:00
Brian Gaeke
48759a6af9 brg
X86Implicit.cpp, X86Implicit.h: New files.
InstSelectSimple.cpp: Add some clarifications in visitCallInst comments.

llvm-svn: 4874
2002-12-03 00:51:09 +00:00
Chris Lattner
e66d3e90ce More support for machine code emission: raw instructions
llvm-svn: 4872
2002-12-02 21:56:18 +00:00
Chris Lattner
c1d0d21002 Expose explicit type
llvm-svn: 4871
2002-12-02 21:50:41 +00:00
Chris Lattner
f48a330fd8 Start implementing MachineCodeEmitter
llvm-svn: 4870
2002-12-02 21:44:34 +00:00
Chris Lattner
cd65711437 Eliminate OtherFrm
llvm-svn: 4868
2002-12-02 21:40:58 +00:00
Chris Lattner
e8640c05cc Remove comment
Remove handling of OtherFrm

llvm-svn: 4867
2002-12-02 21:40:46 +00:00
Chris Lattner
8227eea4fe Initial support for machine code emission
llvm-svn: 4866
2002-12-02 21:24:12 +00:00
Misha Brukman
0b310e3359 Fix order of operands on a store from reg to [reg+offset].
llvm-svn: 4857
2002-12-02 21:10:35 +00:00
Chris Lattner
89de3f1fc5 Add rawfrm flags
llvm-svn: 4841
2002-12-01 23:25:59 +00:00
Chris Lattner
d7ae75d381 Don't add implicit regs
llvm-svn: 4840
2002-12-01 23:24:58 +00:00
Brian Gaeke
1700fefdeb brg
InstSelectSimple.cpp: Refactor out conversion of byte, short -> int
  from visitReturnInst() to new method, promote32().
 Use it in both visitReturnInst() and visitCallInst().

llvm-svn: 4839
2002-11-30 11:57:28 +00:00
Brian Gaeke
b6fc905124 brg
InstSelectSimple.cpp: First draft of visitCallInst method, handling
 int/float args.
X86InstrInfo.def: Add entries for CALL with 32-bit pc relative arg, and
 PUSH with 32-bit reg arg.

llvm-svn: 4838
2002-11-29 12:01:58 +00:00
Brian Gaeke
d944e15946 brg
InstSelectSimple.cpp: Add some comments that say what I'm going to do for
 calls and casts.

llvm-svn: 4832
2002-11-26 10:43:30 +00:00
Misha Brukman
3ba057b8c4 Oops. Got the MOVrm and MOVmr mixed up. Fixed. We can now print out
instructions correctly.

llvm-svn: 4830
2002-11-22 23:15:27 +00:00
Misha Brukman
a301022017 Enable the register allocator pass.
llvm-svn: 4829
2002-11-22 22:45:07 +00:00
Misha Brukman
02c0acabb9 Added methods to read/write values to stack in .h, fixed implementation in
.cpp to return the iterator correctly.

llvm-svn: 4827
2002-11-22 22:43:47 +00:00
Misha Brukman
23d923ff18 Added -*- C++ -*- mode to the comments.
llvm-svn: 4826
2002-11-22 22:42:50 +00:00
Misha Brukman
e43fe85591 Add a simple way to add memory locations of format [reg+offset]
llvm-svn: 4825
2002-11-22 22:42:12 +00:00
Brian Gaeke
2d771c7b5f lib/Target/X86/InstSelectSimple.cpp: Add visitCallInst, visitCastInst.
llvm-svn: 4821
2002-11-22 11:07:01 +00:00
Chris Lattner
fe85dd13d2 Handle cmp Reg, 0 correctly
llvm-svn: 4819
2002-11-21 23:30:00 +00:00
Chris Lattner
6021c0d120 Printing support for more stuff
llvm-svn: 4818
2002-11-21 22:49:46 +00:00
Chris Lattner
a147d38780 Don't add implicit operands
llvm-svn: 4817
2002-11-21 22:49:20 +00:00
Chris Lattner
de36dd3a36 Fix off by one bug
llvm-svn: 4816
2002-11-21 22:48:15 +00:00
Chris Lattner
de6d53e549 Add fixme
llvm-svn: 4815
2002-11-21 22:48:01 +00:00
Chris Lattner
93c5c3ff44 Minor code cleanups
llvm-svn: 4814
2002-11-21 21:04:50 +00:00
Chris Lattner
af8c29b47d Implement printing of store instructions
llvm-svn: 4813
2002-11-21 21:03:39 +00:00
Chris Lattner
918179475a The big change here is to handle printing/emission of X86II::MRMSrcMem
instructions.  Right now the only users are load instructions, and Misha's
spill code

llvm-svn: 4812
2002-11-21 20:44:15 +00:00
Chris Lattner
2112a6d7b8 Remove implicit information from instruction selector
llvm-svn: 4811
2002-11-21 18:54:29 +00:00
Chris Lattner
c9e824d750 Add printing information for MUL and DIV
llvm-svn: 4810
2002-11-21 18:54:14 +00:00
Chris Lattner
d2207d5464 Fix a bug that prevented compilation of multiple functions
llvm-svn: 4809
2002-11-21 17:26:58 +00:00
Chris Lattner
fab5468d86 Remove opcode information for instructions that are completely defined now
llvm-svn: 4805
2002-11-21 17:12:55 +00:00
Chris Lattner
d432d2f75e Add printing support for sahf & setcc
llvm-svn: 4804
2002-11-21 17:10:57 +00:00
Chris Lattner
766d0da035 Add printing support for /0 /1 type instructions
llvm-svn: 4803
2002-11-21 17:09:01 +00:00
Chris Lattner
9f9d6aef08 Add support for /0 /1, etc type instructions
llvm-svn: 4802
2002-11-21 17:08:49 +00:00
Chris Lattner
b1b5855551 Rename the SetCC X86 instructions to reflect the fact that they are the
register versions

llvm-svn: 4800
2002-11-21 16:19:42 +00:00
Chris Lattner
d6236d8100 Simplify setcc code a bit
llvm-svn: 4799
2002-11-21 15:52:38 +00:00
Chris Lattner
2f9488d131 Support Registers of the form (B8+ rd) for example
llvm-svn: 4798
2002-11-21 02:00:20 +00:00
Chris Lattner
32bfb6a115 Dont' set flags
llvm-svn: 4797
2002-11-21 01:59:50 +00:00
Chris Lattner
aa8aa73902 Implement printing more, implement opcode output more
llvm-svn: 4796
2002-11-21 01:33:44 +00:00
Chris Lattner
53a9c9aac6 Huge diff do to reindeinting comments.
Basically just adds OpSize flags for instructions that need them.

llvm-svn: 4795
2002-11-21 01:33:28 +00:00
Chris Lattner
92a3c2c77d Add new prefix flag
llvm-svn: 4794
2002-11-21 01:32:55 +00:00
Chris Lattner
228180c2ae Print another class of instructions correctly, giving us: xorl EDX, EDX
for example.

llvm-svn: 4793
2002-11-21 00:30:01 +00:00
Misha Brukman
5d89dbcf41 Booleans are types too. And they get stored in bytes. And InstructionSelection
doesn't assert fail. And everyone's happy. Yay!

llvm-svn: 4792
2002-11-21 00:25:56 +00:00
Misha Brukman
96283090dc Add definitions for function headers from MRegisterInfo.h:
Some functions are in X86RegisterInfo.cpp, others, because of the data they
need, are in X86RegisterClasses.cpp, which also defines some register classes:
byte, short, and int.

llvm-svn: 4784
2002-11-20 18:59:43 +00:00
Misha Brukman
42f51b24e1 Check not only for MO_VirtualRegister, but MO_MachineRegister as well when
printing out assembly. After all, we want the real thing too.

llvm-svn: 4783
2002-11-20 18:56:41 +00:00
Misha Brukman
505ca2e419 Add mapping in MachineFunction from SSA regs to Register Classes. Also,
uncovered a bug where registers were not being put in a map if they were not
found...

llvm-svn: 4776
2002-11-20 00:58:23 +00:00
Misha Brukman
8d3bef2e1b Sigh. Fixed some speling.
llvm-svn: 4775
2002-11-20 00:56:42 +00:00
Misha Brukman
00d8343760 Thanks to the R8, R16, and R32 macros, I can now deal with registers that
belong to different register classes easier.

llvm-svn: 4773
2002-11-20 00:47:40 +00:00
Brian Gaeke
49acd3c0ba Brian Gaeke says:
lib/Target/X86/InstSelectSimple.cpp: Add a little something to
 visitBranchInst which supports conditional branches.
lib/Target/X86/X86InstrInfo.def: Add defs of JNE, JE, CMPri8

llvm-svn: 4755
2002-11-19 09:08:47 +00:00
Chris Lattner
cd1f56fc36 Start trying to print instructions more correctly. For now we also print out the opcode for each instruction as well.
llvm-svn: 4743
2002-11-18 06:56:51 +00:00
Chris Lattner
8301d751ee Expose base opcode
llvm-svn: 4742
2002-11-18 06:56:24 +00:00
Chris Lattner
54bb9d64a3 Start to add more information to instr.def
llvm-svn: 4741
2002-11-18 05:37:11 +00:00
Chris Lattner
e921369cf7 Add instruction annotation about whether it has a 0x0F opcode prefix
llvm-svn: 4740
2002-11-18 01:59:28 +00:00
Chris Lattner
acf38562df Add more void flags
llvm-svn: 4739
2002-11-18 01:37:48 +00:00
Chris Lattner
7a67557e29 Set the void flag on instructions that should get it
llvm-svn: 4738
2002-11-18 01:34:36 +00:00
Chris Lattner
a7d7b16161 Arrange to have a TargetMachine available in X86InstrInfo::print
llvm-svn: 4734
2002-11-17 23:20:37 +00:00
Chris Lattner
700e8f6a01 Wow, I'm incapable of the simplest things today...
llvm-svn: 4732
2002-11-17 23:05:21 +00:00
Chris Lattner
1cd77c9933 Rename registers to follow the intel style of all caps
llvm-svn: 4731
2002-11-17 23:03:46 +00:00
Chris Lattner
5374a3be97 Reorganize printing interface a bit
llvm-svn: 4728
2002-11-17 22:53:13 +00:00
Chris Lattner
970ae6d569 Fix minor detail
llvm-svn: 4725
2002-11-17 22:33:26 +00:00
Chris Lattner
72e99c8344 Fix Mul/Div clobbers
llvm-svn: 4718
2002-11-17 21:56:38 +00:00
Chris Lattner
dcb6f1dbf9 Fix a few typos, implement load/store
llvm-svn: 4716
2002-11-17 21:11:55 +00:00
Chris Lattner
06066e17c3 Add functions to buld X86 specific constructs
llvm-svn: 4714
2002-11-17 21:03:35 +00:00
Chris Lattner
5e21732045 Add information about memory index representation
llvm-svn: 4712
2002-11-17 20:33:26 +00:00
Chris Lattner
99b5e2f073 Add load/store instructions
llvm-svn: 4711
2002-11-17 20:33:12 +00:00
Chris Lattner
fb67938381 Switch visitRet to use getClass()
llvm-svn: 4710
2002-11-17 20:07:45 +00:00
Brian Gaeke
492e05ba01 include/llvm/CodeGen/MachineInstrBuilder.h: Add addClobber() inline
convenience method.  Fix typo in comment.
lib/Target/X86/InstSelectSimple.cpp: Explicitly specify some implicit uses.
 Use MOVZX/MOVSX instead of MOV instructions with sign extend instructions.
 Take out LEAVE instructions.
 32-bit IDIV and DIV use CDQ, not CWQ (CWQ is a typo).
 Fix typo in comment and remove some FIXME comments.
lib/Target/X86/Printer.cpp: Include X86InstrInfo.h and llvm/Function.h.
 Add some simple code to Printer::runOnFunction to iterate over
  MachineBasicBlocks and call X86InstrInfo::print().
lib/Target/X86/X86InstrInfo.def: Make some more instructions with
 implicit defs "Void".  Add more sign/zero extending "move" insns
 (movsx, movzx).
lib/Target/X86/X86RegisterInfo.def: Add EFLAGS as a register.

llvm-svn: 4707
2002-11-14 22:32:30 +00:00
Brian Gaeke
8cfe5d95f1 InstSelectSimple.cpp: (visitReturnInst) Add return instructions with return
values.
X86InstrInfo.def: add LEAVE instruction.

llvm-svn: 4691
2002-11-11 19:37:09 +00:00
Brian Gaeke
100510d2a8 Add instruction selection code and tests for setcc instructions
llvm-svn: 4603
2002-11-07 17:59:21 +00:00
Chris Lattner
79296d7609 Implement signed and unsigned division and remainder
llvm-svn: 4508
2002-11-02 20:54:46 +00:00
Chris Lattner
234cc2848a Implement multiply operator
llvm-svn: 4506
2002-11-02 20:28:58 +00:00
Chris Lattner
efa2b8226f * Implement subtract
* Merge add code into logical code

llvm-svn: 4503
2002-11-02 20:13:22 +00:00
Chris Lattner
5d1648c792 shuffle code around a bit, implement and, or, xor
llvm-svn: 4502
2002-11-02 20:04:26 +00:00
Chris Lattner
45000f0eb7 Add PHI node support, add comment for branch function
llvm-svn: 4500
2002-11-02 19:45:49 +00:00
Chris Lattner
d4010481a7 Implement unconditional branching support
llvm-svn: 4498
2002-11-02 19:27:56 +00:00
Chris Lattner
2634141328 * Fix nonconstant shift case
* Turn table into 2d table

llvm-svn: 4496
2002-11-02 01:41:55 +00:00
Chris Lattner
14ce86f5b0 Use a more table driven approach to handling types. Seems to simplify the
code a bit

llvm-svn: 4493
2002-11-02 01:15:18 +00:00
Chris Lattner
ef1d6548bb Make switch statements denser, but only because of the follow-on patch
llvm-svn: 4492
2002-11-02 00:49:56 +00:00
Chris Lattner
b3e08ace0c * Remove dead variable
* Shift amount is always guaranteed to be 8 bits

llvm-svn: 4491
2002-11-02 00:44:25 +00:00
Brian Gaeke
2ad8a9cf8b InstSelectSimple.cpp: Include llvm/iOther.h for ShiftInst.
Add ISel::visitShiftInst() to instruction select shift instructions.
 Add a comment in visitAdd about how to do 64 bit adds.

X86InstrInfo.def: Add register-to-register move opcodes and shift opcodes.

llvm-svn: 4477
2002-10-31 23:03:59 +00:00
Chris Lattner
47bbeeac43 Add lots more info
llvm-svn: 4450
2002-10-30 06:04:46 +00:00
Chris Lattner
cbbc96bd8d Make sure to set the destination register correctly
llvm-svn: 4444
2002-10-30 01:49:01 +00:00
Chris Lattner
d18210e53f Set the destination register field based on the target specific flags
llvm-svn: 4442
2002-10-30 01:15:31 +00:00
Chris Lattner
80f1f696e8 Add flag to specify when no value is produced by an instruction
llvm-svn: 4441
2002-10-30 01:09:34 +00:00
Chris Lattner
a8069b87b3 Implement the new optional getRegisterInfo
llvm-svn: 4437
2002-10-30 00:56:18 +00:00
Chris Lattner
faa5c82486 Print machine code after instruction selection
llvm-svn: 4434
2002-10-30 00:47:49 +00:00
Chris Lattner
40d5ff97c1 Make sure to pass the LLVM basic block in
llvm-svn: 4433
2002-10-30 00:47:40 +00:00
Chris Lattner
4352ba0640 Construct annotation, to make sure it's attached to function
llvm-svn: 4429
2002-10-29 23:40:58 +00:00
Chris Lattner
d3b57a0084 Convert backend to use passes, implement X86TargetMachine
llvm-svn: 4421
2002-10-29 22:37:54 +00:00
Chris Lattner
82479f668c Rename X86InstructionInfo to X86InstrInfo
llvm-svn: 4413
2002-10-29 21:05:24 +00:00
Chris Lattner
0518ad4aea Minor renaming
llvm-svn: 4410
2002-10-29 20:48:56 +00:00
Chris Lattner
af52d6564a Switch to generating machineinstr's instead of MInstructions
llvm-svn: 4396
2002-10-29 17:43:55 +00:00
Chris Lattner
483afe2221 Be compatible with sparc backend
llvm-svn: 4395
2002-10-29 17:43:38 +00:00
Chris Lattner
9e3867d6d3 Implement MachineInstrInfo interface
llvm-svn: 4394
2002-10-29 17:43:19 +00:00
Chris Lattner
f963781fcb Switch to different flag set
llvm-svn: 4393
2002-10-29 17:42:40 +00:00
Chris Lattner
152b53fc64 Initial stab at MachineInstr'ication
llvm-svn: 4367
2002-10-28 23:55:19 +00:00
Misha Brukman
c4be791be2 Fixed spelling and grammar.
llvm-svn: 4353
2002-10-28 20:01:52 +00:00
Chris Lattner
28d6f5bc40 Remove dead fixme
llvm-svn: 4300
2002-10-27 21:23:43 +00:00
Chris Lattner
e4e731b30c Instruction select constant arguments correctly
llvm-svn: 4297
2002-10-27 21:16:59 +00:00
Chris Lattner
046cb65220 Add instruction definitions for mov r, imm instructions
llvm-svn: 4296
2002-10-27 21:16:44 +00:00
Chris Lattner
d25a097994 Initial checkin of X86 backend.
We can instruction select exactly one instruction 'ret void'.  Wow.

llvm-svn: 4284
2002-10-25 22:55:53 +00:00