Compare commits

...

2854 Commits

Author SHA1 Message Date
John Criswell
1c962223f4 Add PR#566; something I should have done before.
llvm-svn: 22118
2005-05-18 15:37:06 +00:00
John Criswell
c1dd9b667a Updated for LLVM 1.5.
llvm-svn: 22117
2005-05-18 14:41:07 +00:00
John Criswell
8e6ae64167 Fix name of LLVM CFE source tarball.
llvm-svn: 22110
2005-05-17 21:14:58 +00:00
John Criswell
762895b3f9 Fixed the descriptions of llvmc and llvm-ld to not be version specific.
Fixed some typos.

llvm-svn: 22108
2005-05-17 16:57:10 +00:00
John Criswell
6d9c9a176a Added Linux/Itanium back. Linux/PPC is the platform that we haven't used
yet.

llvm-svn: 22107
2005-05-17 16:19:48 +00:00
John Criswell
687343547a Merged from Mainline.
llvm-svn: 22106
2005-05-17 16:09:30 +00:00
John Criswell
4447fc67ef Merged Misha Modifications from Mainline.
llvm-svn: 22105
2005-05-17 16:08:29 +00:00
John Criswell
4d9d10c757 Updated from mainline.
llvm-svn: 22104
2005-05-17 16:07:32 +00:00
John Criswell
21c9bf15f5 Merged from mainline.
llvm-svn: 22103
2005-05-17 16:07:08 +00:00
John Criswell
033f60f6d4 Removed Linux/Itanium as we don't really know if it works.
Made other minor corrections.

llvm-svn: 22102
2005-05-17 16:05:22 +00:00
John Criswell
25b91e4ae0 Updated the version to 1.5.
llvm-svn: 22095
2005-05-16 19:30:22 +00:00
CVS to SVN Conversion
f2fed73d14 This commit was manufactured by cvs2svn to create branch 'release_15'.
llvm-svn: 22089
2005-05-16 17:13:10 +00:00
Chris Lattner
cb5596d51b more minor edits
llvm-svn: 22088
2005-05-16 17:13:10 +00:00
Chris Lattner
683a847c26 more edits
llvm-svn: 22087
2005-05-16 17:06:29 +00:00
Chris Lattner
7e1f26256d more edits, include stuff from the status update
llvm-svn: 22086
2005-05-16 16:56:09 +00:00
Duraid Madina
e5ee0d0730 pretty tiny change (looks like adding the HP-UX detection and line number
changes to me)

- not committing autoconf/configure.ac (oops, already committed that!)
- not committing include/llvm/Config/config.h.in (it remains unchanged)

llvm-svn: 22085
2005-05-16 16:33:34 +00:00
Chris Lattner
0ca648f813 flush on the right and indented on the left looks a bit weird.
llvm-svn: 22084
2005-05-16 16:30:10 +00:00
John Criswell
88190562e6 Added a note about how the type can be omitted in call instructions.
Added a note about how getelementptr can be used to index into structures
or arrays.
Fixed some typos, spelling, etc.

llvm-svn: 22083
2005-05-16 16:17:45 +00:00
Chris Lattner
15c74de0dd fix a typo duraid noticed
llvm-svn: 22082
2005-05-16 15:37:19 +00:00
Duraid Madina
3dbbc88f52 comment the hpux bit
llvm-svn: 22081
2005-05-16 06:59:53 +00:00
Chris Lattner
a3ea6446da more edits
llvm-svn: 22080
2005-05-16 06:58:39 +00:00
Duraid Madina
33464ad3a2 HP-UX system headers make a mess of isinf(), so much so that gcc fixincludes
can't patch it up for c++ (works in C though)

llvm-svn: 22079
2005-05-16 06:45:57 +00:00
Duraid Madina
60c9a3c171 hp-ux needs this to get through the System/Support libs
llvm-svn: 22078
2005-05-16 06:38:09 +00:00
Duraid Madina
5ea2ba8bae detect HP-UX when configuring
llvm-svn: 22077
2005-05-16 05:39:00 +00:00
Chris Lattner
a1a1e93da9 remove deprecated methods
llvm-svn: 22076
2005-05-16 01:49:23 +00:00
Chris Lattner
7caf6f6ca7 GCC4 + IA64 = badnews
llvm-svn: 22075
2005-05-15 22:26:45 +00:00
Reid Spencer
7ed7930dff Remove the check for the ffsll function. Its no longer needed by the
simplify-libcalls pass (pass now computes it without a call to ffsll).

llvm-svn: 22074
2005-05-15 22:15:11 +00:00
Chris Lattner
b57b28fbbf Improve statement
llvm-svn: 22073
2005-05-15 21:38:32 +00:00
Reid Spencer
f0b186e49e Don't eliminate a test case, just the form of the test case, from the
previous revision.

llvm-svn: 22072
2005-05-15 21:35:26 +00:00
Chris Lattner
847f580c7c This does not belong
llvm-svn: 22071
2005-05-15 21:31:36 +00:00
Reid Spencer
74305a6233 Don't look for __builtin_ffs, we'll never see it from llvm-gcc and there's
not reason to include it for other front ends.

llvm-svn: 22070
2005-05-15 21:27:34 +00:00
Reid Spencer
597618f9f8 Add a case with non-constant argument for testing the transform:
ffs(x) -> (x == 0 ? 0 : llvm.cttz(0)+1)

llvm-svn: 22069
2005-05-15 21:26:59 +00:00
Reid Spencer
17f7784c5d Provide this optimization as well:
ffs(x) -> (x == 0 ? 0 : 1+llvm.cttz(x))

llvm-svn: 22068
2005-05-15 21:19:45 +00:00
Chris Lattner
4e5a3a6df6 PPC "branch and link" instructions are branches in the PPC sense, but not
in the LLVM code generator sense (they are calls).  Don't mark them as such,
which fixes the regressions on the ppc tester last night

llvm-svn: 22065
2005-05-15 20:11:44 +00:00
Chris Lattner
0ae9b08916 Fix andrews changes to fit in 80 columns
llvm-svn: 22064
2005-05-15 19:54:37 +00:00
Chris Lattner
efa20fab2d ctlz = most signficant bits, cttz = least sig
llvm-svn: 22061
2005-05-15 19:39:26 +00:00
Chris Lattner
04d6ed5ef0 fix warning
llvm-svn: 22060
2005-05-15 17:25:14 +00:00
Chris Lattner
7f910cd444 fix compiler warning
llvm-svn: 22059
2005-05-15 17:23:19 +00:00
Reid Spencer
3de98ee643 Duh .. you actually have to #include Config/config.h before you can test
for one of the values that it defines!

llvm-svn: 22058
2005-05-15 17:20:47 +00:00
Reid Spencer
294715b33e Some cleanups for compilation with GCC 4.0.0 to remove warnings:
* Use C++ style casts, not C style casts
* Abstract base classes should have virtual destructor.

llvm-svn: 22057
2005-05-15 16:13:11 +00:00
Chris Lattner
b62a5f0c03 add a sparcv8 section, make this validate
llvm-svn: 22056
2005-05-15 16:01:20 +00:00
Chris Lattner
8563e39c01 more edits, add anchors
llvm-svn: 22055
2005-05-15 15:33:21 +00:00
Duraid Madina
9f406cb29b make angry compilers happy again
llvm-svn: 22054
2005-05-15 14:44:13 +00:00
Duraid Madina
73c4dbae23 aCC and STLport complained about this, because they're like that
llvm-svn: 22053
2005-05-15 13:05:48 +00:00
Chris Lattner
17b2e4837b edits to the simplify-libcalls element, move it higher in the list.
llvm-svn: 22052
2005-05-15 06:09:55 +00:00
Chris Lattner
55f987b45c add generated code
llvm-svn: 22051
2005-05-15 06:07:40 +00:00
Chris Lattner
1a61fa460f don't reserve space for tailcall arg areas. It explicitly managed.
llvm-svn: 22050
2005-05-15 06:07:10 +00:00
Reid Spencer
ea77685e20 Make note of the -simplify-libcalls pass.
llvm-svn: 22049
2005-05-15 06:05:11 +00:00
Chris Lattner
6e3decb6ea add test to check for tail calls
llvm-svn: 22048
2005-05-15 05:52:51 +00:00
Chris Lattner
97e3b65652 Teach reginfo how to deal with ADJSTACKPTRri, allowing us to generate:
add %ESP, 20
        jmp %EDX  # TAIL CALL

instead of:
        add %ESP, -8
        add %ESP, 28
        jmp %EDX  # TAIL CALL

llvm-svn: 22047
2005-05-15 05:49:58 +00:00
Chris Lattner
dd66a41e0e Implement proper tail calls in the X86 backend for all fastcc->fastcc
tail calls.

llvm-svn: 22046
2005-05-15 05:46:45 +00:00
Chris Lattner
406bddfb3a Substantial edits for the release notes.
llvm-svn: 22045
2005-05-15 05:44:51 +00:00
Chris Lattner
51836bbc82 Add some simplifications for MULH[SU]. This allows us to compile this:
long %bar(long %X) {
  %Y = mul long %X, 4294967297
  ret long %Y
}

to this:

l1_bar:
        mov %EAX, DWORD PTR [%ESP + 4]
        mov %EDX, %EAX
        add %EDX, DWORD PTR [%ESP + 8]
        ret

instead of:

l1_bar:
        mov %ECX, DWORD PTR [%ESP + 4]
        mov %EDX, 1
        mov %EAX, %ECX
        mul %EDX
        add %EDX, %ECX
        add %EDX, DWORD PTR [%ESP + 8]
        mov %EAX, %ECX
        ret

llvm-svn: 22044
2005-05-15 05:39:08 +00:00
Chris Lattner
3f5a98d1f4 Add markers in the asm file for tail calls, add a new ADJSTACKPTRri
sorta-pseudo-instruction

llvm-svn: 22042
2005-05-15 03:10:37 +00:00
Chris Lattner
468b9577b6 When inserting callee-save register reloads, make sure to skip over any
terminator instructions before the 'ret' in case the target has a
multi-instruction return sequence.

llvm-svn: 22041
2005-05-15 03:09:58 +00:00
Chris Lattner
6b5fa91a63 Yes, calltarget is the operand of the day.
llvm-svn: 22040
2005-05-15 01:10:30 +00:00
Chris Lattner
8d1ea49603 Make sure this is not eligible for tail-call-elimination so that we test
the correct thing.

llvm-svn: 22039
2005-05-14 23:54:55 +00:00
Chris Lattner
5366c859a7 When emitting the function epilog, check to see if there already a stack
adjustment.  If so, we merge the adjustment into the existing one.  This
allows us to generate:

caller2:
        sub %ESP, 12
        mov DWORD PTR [%ESP], 0
        mov %EAX, 1234567890
        mov %EDX, 0
        call func2
        add %ESP, 8
        ret 4

intead of:

caller2:
        sub %ESP, 12
        mov DWORD PTR [%ESP], 0
        mov %EAX, 1234567890
        mov %EDX, 0
        call func2
        sub %ESP, 4
        add %ESP, 12
        ret 4

for X86/fast-cc-merge-stack-adj.ll

llvm-svn: 22038
2005-05-14 23:53:43 +00:00
Chris Lattner
fe2ebdef4d new testcase
llvm-svn: 22037
2005-05-14 23:52:09 +00:00
Chris Lattner
f0649db870 Add some new instructions
llvm-svn: 22036
2005-05-14 23:35:21 +00:00
Chris Lattner
14b780fae5 add x86-64 abi
llvm-svn: 22035
2005-05-14 22:06:42 +00:00
Reid Spencer
6ed7d1ea62 * Truncate a long line.
* By default, doxygen output formatted for printing on letter size paper
  not A4.

llvm-svn: 22034
2005-05-14 20:06:31 +00:00
Reid Spencer
c51ced3e6b Forgot to commit this earlier. Its part of the simplify-libcalls
enhancement for ffs, ffsl, and ffsll optimizations. We can't do the opt
unless we also have the at least ffsll function. Notably SVR4 doesn't.

llvm-svn: 22033
2005-05-14 20:04:19 +00:00
Andrew Lenharth
8ecaa45625 mention the C++ exception problems on alpha
llvm-svn: 22029
2005-05-14 17:43:00 +00:00
Reid Spencer
5b3c66676c Add a test case for testing ffs libcall conversion to constant
llvm-svn: 22028
2005-05-14 16:44:43 +00:00
Reid Spencer
b195fcd5ef Changes for ffs lib call simplification:
* Check for availability of ffsll call in configure script
* Support ffs, ffsl, and ffsll conversion to constant value if the argument
  is constant.

llvm-svn: 22027
2005-05-14 16:42:52 +00:00
Chris Lattner
e4f71d036f Fix construction of ioport intrinsics, fixing X86/io.llx and io-port.llx
llvm-svn: 22026
2005-05-14 13:56:55 +00:00
Chris Lattner
403d1c204c Preserve calling conv when hacking on calls
llvm-svn: 22025
2005-05-14 12:28:32 +00:00
Chris Lattner
05c703ea85 preserve calling conventions when hacking on code
llvm-svn: 22024
2005-05-14 12:25:32 +00:00
Chris Lattner
bcefcf8552 Make sure to preserve the calling convention when changing an invoke into
a call.  This fixes Prolangs-C++/deriv2, kimwitu++, and Misc-C++/bigfib
on X86 with -enable-x86-fastcc.

llvm-svn: 22023
2005-05-14 12:21:56 +00:00
Chris Lattner
18b2c2f13c Pass i64 values correctly split in reg/mem to fastcc calls.
This fixes fourinarow with -enable-x86-fastcc.

llvm-svn: 22022
2005-05-14 12:03:10 +00:00
Chris Lattner
1b3520c90b Use target-specific nodes for calls. This allows the fastcc code to not have
to do ugly hackery to avoid emitting code like this:

   call foo
   mov vreg, EAX
   adjcallstackup ...

If foo is a fastcc call and if vreg gets spilled, we might end up with this:

   call foo
   mov [ESP+offset], EAX     ;; Offset doesn't consider the 12!
   sub ESP, 12

Which is bad.  The previous hacky code to deal with this was A) gross B) not
good enough.  In particular, it could miss cases and emit the bad code above.
Now we always emit this:

   call foo
   adjcallstackup ...
   mov vreg, EAX

directly.

This makes fastcc with callees poping the stack work much better.  Next
stop (finally!) really is tail calls.

llvm-svn: 22021
2005-05-14 08:48:15 +00:00
Chris Lattner
3268f244e6 allow token chain at start or end of node
llvm-svn: 22020
2005-05-14 08:34:53 +00:00
Chris Lattner
865359958b remove special case hacks for readport/readio from the binary operator
codepath

llvm-svn: 22019
2005-05-14 07:45:46 +00:00
Chris Lattner
566307f92a Implement fixme's by memoizing nodes.
llvm-svn: 22018
2005-05-14 07:42:29 +00:00
Chris Lattner
b76fb15aad add a new map
llvm-svn: 22017
2005-05-14 07:36:02 +00:00
Chris Lattner
833a4fbdc5 Turn this into a wrapper for a simpler version of getNode.
llvm-svn: 22016
2005-05-14 07:32:14 +00:00
Chris Lattner
96c262e24b Eliminate special purpose hacks for dynamic_stack_alloc.
llvm-svn: 22015
2005-05-14 07:29:57 +00:00
Chris Lattner
669e8c2c9c Use the general mechanism for creating multi-value nodes instead of using
special case hacks.

llvm-svn: 22014
2005-05-14 07:25:05 +00:00
Chris Lattner
024e1922e6 Ensure these casts are done with the hardware fildll instruction
llvm-svn: 22013
2005-05-14 07:09:25 +00:00
Chris Lattner
a36117b360 use a target-specific node and custom expander to lower long->FP to FILD64m.
This should fix some missing symbols problems on BSD and improve performance
of programs that use that operation.

llvm-svn: 22012
2005-05-14 06:52:07 +00:00
Chris Lattner
006f56b177 Wrap long line, actually add node to the graph.
llvm-svn: 22011
2005-05-14 06:42:57 +00:00
Chris Lattner
3eb8693279 legalize target-specific operations
llvm-svn: 22010
2005-05-14 06:34:48 +00:00
Chris Lattner
d553133308 add a getNode() version that allows construction of any node type.
llvm-svn: 22009
2005-05-14 06:20:26 +00:00
Chris Lattner
71595c95d6 Add a way to construct an arbitrary node, cleanly.
llvm-svn: 22008
2005-05-14 06:20:08 +00:00
Chris Lattner
eaff95da8f add accessors
llvm-svn: 22007
2005-05-14 06:19:11 +00:00
Reid Spencer
a27d7a67f7 Some minor adjustments for the 1.5 release.
llvm-svn: 22006
2005-05-14 05:52:07 +00:00
Chris Lattner
dbbdd165a6 Pass the dag into LowerOperation
llvm-svn: 22005
2005-05-14 05:51:05 +00:00
Chris Lattner
29dcc71d83 LowerOperation takes a dag
llvm-svn: 22004
2005-05-14 05:50:48 +00:00
Duraid Madina
9a449003d0 add a bit about the known problems on IA64
llvm-svn: 22003
2005-05-14 05:48:13 +00:00
Chris Lattner
c08d786ba5 Print the symbolic register name in a register allocator debug dump.
llvm-svn: 22002
2005-05-14 05:34:15 +00:00
Chris Lattner
d3cc996a47 Allow targets to have a custom int64->fp expander if desired
llvm-svn: 22001
2005-05-14 05:33:54 +00:00
Chris Lattner
b42e8723b0 this passes
llvm-svn: 22000
2005-05-14 02:35:38 +00:00
Chris Lattner
a11e367ae5 Fix this
llvm-svn: 21999
2005-05-14 02:33:20 +00:00
Chris Lattner
f47e4c174b minor changes
llvm-svn: 21998
2005-05-14 01:30:15 +00:00
Chris Lattner
48ec173312 user ops are not encoded in the bc format
llvm-svn: 21997
2005-05-14 01:26:46 +00:00
Reid Spencer
621fd111b5 Document the pseudo-instruction opcodes in opcode range 56-63. These are
used to support things like volatile load/store, tail calls, and calling
conventions without reserving space for the additional information.

llvm-svn: 21996
2005-05-14 00:06:06 +00:00
Chris Lattner
9b29fe2008 Make sure the start of the arg area and the end (after the RA is pushed)
is always 8-byte aligned for fastcc

llvm-svn: 21995
2005-05-13 23:49:10 +00:00
Chris Lattner
4e63e3f5c8 fix the assertion
llvm-svn: 21994
2005-05-13 23:35:47 +00:00
Chris Lattner
cbefe72fb2 Align doubles on 8-byte boundaries if possible.
llvm-svn: 21993
2005-05-13 23:14:17 +00:00
Chris Lattner
77b220f3d5 print stack object alignment in -print-machineinstr dumps
llvm-svn: 21992
2005-05-13 22:54:44 +00:00
Chris Lattner
5011ff0179 fix typo
llvm-svn: 21991
2005-05-13 22:46:57 +00:00
John Criswell
4a3327eead Minor fixup of typos.
llvm-svn: 21990
2005-05-13 22:25:59 +00:00
Chris Lattner
5900197232 new testcase
llvm-svn: 21989
2005-05-13 22:15:26 +00:00
Chris Lattner
2267d67941 Fix the problems with callee popped argument lists
llvm-svn: 21988
2005-05-13 22:13:49 +00:00
John Criswell
ca6db82fc4 Removed PPC Linux support, as no one seems to have used it yet.
llvm-svn: 21987
2005-05-13 21:55:49 +00:00
Chris Lattner
79e9fa5de1 Don't emit SAR X, 0 in the case of sdiv Y, 2
llvm-svn: 21986
2005-05-13 21:50:27 +00:00
Chris Lattner
7d387d207d Fix UnitTests/2005-05-13-SDivTwo.c
llvm-svn: 21985
2005-05-13 21:48:20 +00:00
Chris Lattner
c0e369ed66 switch to having the callee pop stack operands for fastcc. This is currently buggy
do not use

llvm-svn: 21984
2005-05-13 21:44:04 +00:00
Chris Lattner
f6fb5e91b2 Tolerate instrs with extra args
llvm-svn: 21982
2005-05-13 21:07:15 +00:00
John Criswell
4876135a51 Add a note about SPARC V8.
llvm-svn: 21981
2005-05-13 20:54:44 +00:00
Chris Lattner
1a12476531 allow RETI
llvm-svn: 21980
2005-05-13 20:46:35 +00:00
Chris Lattner
e4df5e4681 add support for fastcc and friends
llvm-svn: 21979
2005-05-13 20:40:52 +00:00
John Criswell
608f4805f3 Minor fixes.
llvm-svn: 21978
2005-05-13 20:38:44 +00:00
Chris Lattner
8abab9b0c7 treat TAILCALL nodes identically to CALL nodes
llvm-svn: 21977
2005-05-13 20:29:26 +00:00
Chris Lattner
f27e31d690 Build TAILCALL nodes in LowerCallTo, treat them like normal calls everywhere.
llvm-svn: 21976
2005-05-13 20:29:13 +00:00
John Criswell
d523492fcd Added some missing platforms.
Fixed some wording to be more accurate (I hope).

llvm-svn: 21975
2005-05-13 20:28:15 +00:00
John Criswell
61617f7843 More typo and wording fixes.
llvm-svn: 21974
2005-05-13 20:25:49 +00:00
Chris Lattner
153827b086 Add reassociation, minor cleanups.
llvm-svn: 21973
2005-05-13 20:18:49 +00:00
Chris Lattner
e59cddf838 close off B< tag
llvm-svn: 21972
2005-05-13 20:14:06 +00:00
Chris Lattner
91a649a28e remove htmlisms
llvm-svn: 21971
2005-05-13 20:13:39 +00:00
Chris Lattner
3ea0d3f6f0 fix typo
llvm-svn: 21970
2005-05-13 20:10:13 +00:00
Chris Lattner
d941d9c6a0 note how to disable inlining
llvm-svn: 21969
2005-05-13 20:09:33 +00:00
Chris Lattner
4aefdd0f62 fix link to llvm-ar
llvm-svn: 21968
2005-05-13 20:08:34 +00:00
Chris Lattner
9b3e5950b2 these don't use passes
llvm-svn: 21967
2005-05-13 20:04:33 +00:00
Chris Lattner
2d542fc8c0 this detail is not needed here
llvm-svn: 21966
2005-05-13 20:03:17 +00:00
Chris Lattner
6953a6e799 update this manual
llvm-svn: 21965
2005-05-13 20:01:11 +00:00
Chris Lattner
88bb4457fc Capitalize
llvm-svn: 21964
2005-05-13 19:49:09 +00:00
Andrew Lenharth
805fcb9f1a fix regression tests
llvm-svn: 21963
2005-05-13 19:49:02 +00:00
Chris Lattner
6fec835461 capitalize
llvm-svn: 21962
2005-05-13 19:48:34 +00:00
John Criswell
417cb0aec4 Minor corrections and clarifications.
llvm-svn: 21961
2005-05-13 19:48:07 +00:00
Chris Lattner
f4cfcc48f6 clarify that these are v9 options
llvm-svn: 21960
2005-05-13 19:45:45 +00:00
Chris Lattner
f9a4d96038 hide this option
llvm-svn: 21959
2005-05-13 19:44:21 +00:00
Chris Lattner
2e77db6af6 Add an isTailCall flag to LowerCallTo
llvm-svn: 21958
2005-05-13 18:50:42 +00:00
Chris Lattner
d0feb64443 Handle TAILCALL node
llvm-svn: 21957
2005-05-13 18:43:43 +00:00
Chris Lattner
46db599b61 add TAILCALL node
llvm-svn: 21956
2005-05-13 18:40:17 +00:00
Chris Lattner
57e3597583 This passes on sparc
llvm-svn: 21955
2005-05-13 18:37:58 +00:00
Reid Spencer
83745dda88 * Make some warning messages stand out a bit by putting **** at the end
* Fix a typo that prevents BuildMode from being printed

llvm-svn: 21954
2005-05-13 18:32:54 +00:00
Reid Spencer
6ab4ba4030 Fix the "stacker doesn't build without llvm-gcc" problem. The configure
script was defaulting the LLVMGCC variable to "llvm-gcc" if it couldn't
find llvm-gcc and --with-llvmgccdir was not specified. In this case, there
is no llvm-gcc available on the system so we shouldn't assume that the
user's path will find it any better than configure could. The fix is to
default it to an empty string. If LLVMGCC is empty, the makefiles will
avoid building things that depend on llvm-gcc and give a nice warning
message to that effect.

llvm-svn: 21953
2005-05-13 18:30:13 +00:00
Chris Lattner
e622357fbf remove test
llvm-svn: 21952
2005-05-13 18:19:29 +00:00
Chris Lattner
6e4c2302e6 add 'ret imm' instruction
llvm-svn: 21945
2005-05-13 17:56:48 +00:00
Reid Spencer
daeb5f0900 The previous hack didn't work because tools-only isn't defined and isn't
a target at this level of build. There shouldn't be a problem with building
the runtime library without llvm-gcc because the Makefile.rules checks
for an empty LLVMGCC variable before building bytecode modules.

llvm-svn: 21942
2005-05-13 17:42:54 +00:00
John Criswell
2d4fc4c676 These tests are currently expected to fail.
llvm-svn: 21941
2005-05-13 17:36:00 +00:00
Chris Lattner
5b256d67cc Force x86 backend
llvm-svn: 21940
2005-05-13 16:20:59 +00:00
Chris Lattner
6756f2f795 Realize that we don't support fmod directly, fixing CodeGen/Generic/print-arith-fp.ll
llvm-svn: 21939
2005-05-13 16:20:22 +00:00
Reid Spencer
74905e0fb5 Don't build runtime if tools-only :)
llvm-svn: 21938
2005-05-13 16:17:58 +00:00
Chris Lattner
0f0e75dfad fix buggy test
llvm-svn: 21937
2005-05-13 15:51:31 +00:00
Chris Lattner
bf33da2952 Fix buggy test
llvm-svn: 21936
2005-05-13 15:48:41 +00:00
Chris Lattner
1df9ffa483 let dj run this
llvm-svn: 21935
2005-05-13 15:44:55 +00:00
Andrew Lenharth
5dcd5c8896 fixed test case
llvm-svn: 21934
2005-05-13 15:42:07 +00:00
Chris Lattner
0b17b45a96 Do not CopyFromReg physregs for live-in values. Instead, create a vreg for
each live in, and copy the regs from the vregs.  As the very first thing we
do in the function, insert copies from the pregs to the vregs.  This fixes
problems where the token chain of CopyFromReg was not enough to allow reordering
of the copyfromreg nodes and other unchained nodes (e.g. div, which clobbers
eax on intel).

llvm-svn: 21932
2005-05-13 07:38:09 +00:00
Chris Lattner
d0b0ecca3f Emit function entry code after lowering hte arguments.
llvm-svn: 21931
2005-05-13 07:33:32 +00:00
Chris Lattner
0220b2952f Allow targets to emit code into the entry block of each function
llvm-svn: 21930
2005-05-13 07:23:21 +00:00
Chris Lattner
d705b39476 add a new method
llvm-svn: 21929
2005-05-13 07:23:03 +00:00
Chris Lattner
61d9d81770 calling a function with the wrong CC is undefined, turn it into an unreachable
instruction.  This is useful for catching optimizers that don't preserve
calling conventions

llvm-svn: 21928
2005-05-13 07:09:09 +00:00
Chris Lattner
91caf1d039 allow a virtual register to be associated with live-in values.
llvm-svn: 21927
2005-05-13 07:08:07 +00:00
Reid Spencer
39ec7f049d Make sure that decompression checks for the case that bzip2 returns
BZ_OK (meaning more data is expected) but there is no more input data. In
this case, the input file is probably truncated. Generate an exception that
indicates this case when its detected.

llvm-svn: 21926
2005-05-13 07:05:37 +00:00
Chris Lattner
ca968393ab When lowering invokes to calls, amke sure to preserve the calling conv. This
fixes Ptrdist/anagram with x86 llcbeta

llvm-svn: 21925
2005-05-13 06:27:02 +00:00
Chris Lattner
ae186e012c Prefer int 0 instead of long 0 for GEP arguments.
llvm-svn: 21924
2005-05-13 06:10:12 +00:00
Chris Lattner
bb1d60de9c Fix a problem that nate reduced for me.
llvm-svn: 21923
2005-05-13 05:17:00 +00:00
Chris Lattner
5a14c8a18e rename variables and functions to match renamed DAG nodes. Bonus feature:
I can actually remember which one is which now!

llvm-svn: 21922
2005-05-13 05:09:11 +00:00
Chris Lattner
4339c4b05a disable this test for now.
llvm-svn: 21920
2005-05-13 04:51:58 +00:00
Chris Lattner
2a4f7312cd do not call expandop on the same value more than once. This fixes
X86/2004-02-22-Casts.llx

llvm-svn: 21919
2005-05-13 04:45:13 +00:00
Chris Lattner
f26c015929 add a correct run line
llvm-svn: 21918
2005-05-13 04:20:57 +00:00
Chris Lattner
e3677d6354 fix a bad typeo
llvm-svn: 21917
2005-05-12 23:51:40 +00:00
Chris Lattner
d34cd28aa7 update comment
llvm-svn: 21916
2005-05-12 23:24:44 +00:00
Chris Lattner
2dce703710 rename the ADJCALLSTACKDOWN/ADJCALLSTACKUP nodes to be CALLSEQ_START/BEGIN.
llvm-svn: 21915
2005-05-12 23:24:06 +00:00
Chris Lattner
53eadd159b reg test
llvm-svn: 21914
2005-05-12 23:09:04 +00:00
Chris Lattner
7ce7a8fc81 Add a new -enable-x86-fastcc option that enables passing the first
two integer values in registers for the fastcc calling conv.

llvm-svn: 21912
2005-05-12 23:06:28 +00:00
Misha Brukman
16948006b6 * Remove reference to llvm-fefw
* Fix copyright line

llvm-svn: 21910
2005-05-12 22:15:34 +00:00
Misha Brukman
b151770b4a llvm-fefw doesn't exist (yet)
llvm-svn: 21907
2005-05-12 21:56:03 +00:00
Misha Brukman
cb3fc5ca75 Remove extraneous `U ' in copyright line
llvm-svn: 21906
2005-05-12 21:49:11 +00:00
Misha Brukman
f1ed8ede29 * Fix wording of the warning
* Add autoindent, smartindent, and smarttab options to the file

llvm-svn: 21905
2005-05-12 21:41:48 +00:00
Misha Brukman
7ced60afcc Remove extraneous colons after program names for consistency
llvm-svn: 21904
2005-05-12 21:39:01 +00:00
John Criswell
d85e1a85bf Shameless update of copyright years.
llvm-svn: 21903
2005-05-12 21:25:32 +00:00
John Criswell
878a202e89 Fix this test on Solaris.
Solaris grep is more traditional and (AFAIK) does not support regexs.
Also, single quotes should disable all shell interpretation, so no
backslashes should be needed (and, in fact, keep Solaris from working).

llvm-svn: 21902
2005-05-12 21:06:05 +00:00
Chris Lattner
33d1b6d28f LowerCallTo now takes the cc to use
llvm-svn: 21901
2005-05-12 19:57:08 +00:00
Chris Lattner
111778e665 Pass calling convention to use into lower call to
llvm-svn: 21900
2005-05-12 19:56:57 +00:00
Chris Lattner
36674a123e Pass in Calling Convention to use into LowerCallTo
llvm-svn: 21899
2005-05-12 19:56:45 +00:00
Chris Lattner
b5ff4e5e10 Enable pattern isel by default
llvm-svn: 21898
2005-05-12 19:56:09 +00:00
Chris Lattner
0bfd177e89 fix expansion of ct[lt]z nodes
llvm-svn: 21896
2005-05-12 19:27:51 +00:00
Chris Lattner
cf5f6b0ccb Expand 64-bit ctlz/cttz nodes for 32-bit targets
llvm-svn: 21895
2005-05-12 19:05:01 +00:00
Chris Lattner
26f0317f46 Fix uint->fp casts on PPC, allowing UnitTests/2005-05-12-Int64ToFP to
work on it.

llvm-svn: 21894
2005-05-12 18:52:34 +00:00
John Criswell
c932bef114 Correct a detail with the alloca instruction.
Functions do not exit with invoke; they exit with unwind.

llvm-svn: 21893
2005-05-12 16:55:34 +00:00
Chris Lattner
b5a78e0873 Allow something to be legalized multiple times. This can be used to reduce
legalization iteration

llvm-svn: 21892
2005-05-12 16:53:42 +00:00
John Criswell
02fdc6fab4 Fixed some typos.
llvm-svn: 21891
2005-05-12 16:52:32 +00:00
Chris Lattner
153587e555 Oops, don't do this after we figure out where to insert the call chains.
llvm-svn: 21890
2005-05-12 07:00:44 +00:00
Chris Lattner
8a5ad8468a Make sure to expand all nodes, avoiding unintentional node duplication.
llvm-svn: 21889
2005-05-12 06:54:21 +00:00
Chris Lattner
d2fb9ea262 handle a common case generated by the uint64 -> FP code path better
llvm-svn: 21888
2005-05-12 06:27:02 +00:00
Chris Lattner
f09c0b435b add fixme
llvm-svn: 21887
2005-05-12 06:04:14 +00:00
Chris Lattner
646c0f0234 Fix a really horrible problem that causes the JIT to miscompile any program
that use 64-bit integers on 32-bit hosts.

llvm-svn: 21886
2005-05-12 06:01:28 +00:00
Chris Lattner
a5bf1030bf Fix a problem where early legalization can cause token chain problems.
llvm-svn: 21885
2005-05-12 04:49:08 +00:00
Chris Lattner
f80969f29b These targets don't like setcc
llvm-svn: 21884
2005-05-12 02:06:00 +00:00
Chris Lattner
515f53d4fa Add a little hook
llvm-svn: 21883
2005-05-12 02:02:21 +00:00
Chris Lattner
8005e91432 Make legalize a bit more efficient, and canonicalize sub X, C -> add X, -C
llvm-svn: 21882
2005-05-12 00:17:04 +00:00
Nate Begeman
4ce1dea8af Add testcase for legalizing ISD::CTTZ efficiently. On PPC, ctlz(int) is
now codegen'd as this:

        addi r2, r3, -1
        andc r2, r2, r3
        cntlzw r2, r2
        subfic r3, r2, 32
        blr

llvm-svn: 21881
2005-05-11 23:45:54 +00:00
Nate Begeman
99fa5bc1fa Necessary changes to codegen cttz efficiently on PowerPC
1. Teach LegalizeDAG how to better legalize CTTZ if the target doesn't have
   CTPOP, but does have CTLZ
2. Teach PPC32 how to do sub x, const -> add x, -const for valid consts
3. Teach PPC32 how to do and (xor a, -1) b -> andc b, a
4. Teach PPC32 that ISD::CTLZ -> PPC::CNTLZW

llvm-svn: 21880
2005-05-11 23:43:56 +00:00
John Criswell
e5121fad61 Regression test for PR#563.
llvm-svn: 21879
2005-05-11 21:47:35 +00:00
Tanya Lattner
96726a46c7 Fixed issue that broke ssa.
llvm-svn: 21878
2005-05-11 21:45:03 +00:00
Chris Lattner
9c64b0cc18 fix some GCC 4 warnings
llvm-svn: 21877
2005-05-11 21:40:40 +00:00
John Criswell
72002e87cc Added support for decomposing constant expressions containing shr and shl
instructions.
Review of this commit would be greatly appreciated.

llvm-svn: 21876
2005-05-11 21:16:42 +00:00
Chris Lattner
991ce36798 Fix lowering of ctlz, so now UnitTests/2005-05-11-Popcount-ffs-fls passes
with the CBE

llvm-svn: 21875
2005-05-11 20:24:12 +00:00
Chris Lattner
fe5759b022 Fix lowering of cttz to work with signed values
llvm-svn: 21874
2005-05-11 20:02:14 +00:00
Chris Lattner
9ec975a4b5 fix and concisify intinsic lowering for ctpop. Unfortunately, this code
looks completely untested. :(

llvm-svn: 21873
2005-05-11 19:42:05 +00:00
Chris Lattner
06bbeb646f Fix the last remaining bug preventing us from switching the X86 BE over
from the simple isel to the pattern isel.  This forces inserted libcalls
to serialize against other function calls, which was breaking
UnitTests/2005-05-12-Int64ToFP.  Hopefully this will fix issues on other
targets as well.

llvm-svn: 21872
2005-05-11 19:02:11 +00:00
Chris Lattner
724f7eec77 Do not memoize ADJCALLSTACKDOWN nodes, provide a method to hack on them.
llvm-svn: 21871
2005-05-11 18:57:39 +00:00
Chris Lattner
490769c5b6 wrap long line
llvm-svn: 21870
2005-05-11 18:57:06 +00:00
Chris Lattner
7933dcdb6e new method
llvm-svn: 21869
2005-05-11 18:56:45 +00:00
Chris Lattner
56add05671 Make sure to legalize generated ctpop nodes, convert tabs to spaces
llvm-svn: 21868
2005-05-11 18:35:21 +00:00
Andrew Lenharth
0409e1e6d5 Legalize for CTLZ generates a ctpop, but this ctpop is not expanded.
This is bad.  It is generated if you are ctlz a type that is not
legal for the arch (aka ctlz of bytes on alpha legalize fine).

llvm-svn: 21867
2005-05-11 17:23:41 +00:00
Duraid Madina
a1ebbac9c0 expand count-leading/trailing-zeros; the test 2005-05-11-Popcount-ffs-fls.c
should now pass (the "LLVM" and "REF" results should be identical)

llvm-svn: 21866
2005-05-11 08:45:08 +00:00
Chris Lattner
446b611401 include the other bit count intrinsics
llvm-svn: 21863
2005-05-11 05:31:01 +00:00
Chris Lattner
7247324047 Add some notes for expanding clz/ctz
llvm-svn: 21862
2005-05-11 05:27:09 +00:00
Chris Lattner
05309bf58e Simplify this code, use the proper shift amount
llvm-svn: 21861
2005-05-11 05:21:31 +00:00
Duraid Madina
25163d8d60 add the popcount instruction and support this in the isel
the primary user of this will probably end up being find-first-set-bit/find-
last-set-bit, which i'll get around to...

llvm-svn: 21860
2005-05-11 05:16:09 +00:00
Chris Lattner
3740f39883 Legalize this correctly
llvm-svn: 21859
2005-05-11 05:09:47 +00:00
Chris Lattner
669c3b17eb No really IA*64* :)
llvm-svn: 21858
2005-05-11 05:03:56 +00:00
Chris Lattner
05ad4b8369 X86 has more than just 32-bit registers
llvm-svn: 21857
2005-05-11 05:00:34 +00:00
Chris Lattner
55e9cde37c implement expansion of ctpop nodes, implementing CodeGen/Generic/llvm-ct-intrinsics.ll
llvm-svn: 21856
2005-05-11 04:51:16 +00:00
Chris Lattner
93f4f5f467 Print bit count nodes correctly
llvm-svn: 21855
2005-05-11 04:50:30 +00:00
Chris Lattner
d08a2de07d new testcase
llvm-svn: 21854
2005-05-11 04:22:47 +00:00
Chris Lattner
0a338a6ba9 update this to reflect the new selection daggy world
llvm-svn: 21853
2005-05-11 03:53:53 +00:00
Chris Lattner
90391c1899 don't duplicate information, particularly when it's out of date!
llvm-svn: 21852
2005-05-11 03:35:57 +00:00
Chris Lattner
c18e92f3cd Do not use "" as a sentinal for a missing argument! This fixes PR560.
llvm-svn: 21850
2005-05-10 23:20:17 +00:00
Chris Lattner
afcc1a854b new testcase for PR562
llvm-svn: 21849
2005-05-10 22:32:29 +00:00
Misha Brukman
c3967716a8 Remove vim modeline; this should go into ~/.vimrc
llvm-svn: 21848
2005-05-10 22:06:41 +00:00
Misha Brukman
689f247ef4 Remove vim modeline, this belongs in ~/.vimrc
llvm-svn: 21847
2005-05-10 22:06:14 +00:00
Misha Brukman
3f2fa8de02 Consistently surround `cl::' code structures with <b> and <tt> to make them
stand out as code

llvm-svn: 21846
2005-05-10 22:05:27 +00:00
Misha Brukman
308a715acc Why output multiple strings, let the compiler concatenate them for us for free
llvm-svn: 21845
2005-05-10 22:03:50 +00:00
Misha Brukman
8b47707b5c * Convert tabs to spaces, fix code alignment
* Remove trailing whitespace
* Wrap long lines

llvm-svn: 21844
2005-05-10 22:02:28 +00:00
Duraid Madina
332b16aaeb note HP-UX support
llvm-svn: 21841
2005-05-10 06:57:53 +00:00
Chris Lattner
d8145bcd5b Convert feature of the simple isel over for the pattern isel to use.
llvm-svn: 21840
2005-05-10 03:53:18 +00:00
Chris Lattner
31c667e234 Fix Reassociate/shifttest.ll
llvm-svn: 21839
2005-05-10 03:39:25 +00:00
Jeff Cohen
915594d884 Silence some VC++ warnings
llvm-svn: 21838
2005-05-10 02:22:38 +00:00
Chris Lattner
abb36674a8 new testcase
llvm-svn: 21837
2005-05-10 00:33:36 +00:00
Chris Lattner
bfc796f622 If a function contains no allocas, all of the calls in it are trivially
suitable for tail calls.

llvm-svn: 21836
2005-05-09 23:51:13 +00:00
Chris Lattner
2d8b55c476 The semantics of cast X to bool are a comparison against zero, not a truncation!
llvm-svn: 21833
2005-05-09 22:17:13 +00:00
Chris Lattner
763a9e8c9b testcase I've had in my tree
llvm-svn: 21832
2005-05-09 21:21:10 +00:00
Chris Lattner
70ea07cfd2 Implement READPORT/WRITEPORT, implementing the last X86 regression tests
that were failing with the pattern selector.  Note that the support that
existed in the simple selector was clearly broken in several ways though
(which has also been fixed).

llvm-svn: 21831
2005-05-09 21:17:38 +00:00
Chris Lattner
e53158e21d do not emit illegal instructions
llvm-svn: 21830
2005-05-09 21:06:04 +00:00
Chris Lattner
46b5ca4310 Fix the syntax of the i/o instructions, these are obviously unused.
llvm-svn: 21829
2005-05-09 20:49:20 +00:00
Chris Lattner
6c6a39a7b8 legalize readio/writeio into load/stores, fixing CodeGen/X86/io.llx with
the pattern isel.

llvm-svn: 21828
2005-05-09 20:37:29 +00:00
Chris Lattner
ba45e6c432 legalize readio/writeio into a load/store if requested
llvm-svn: 21827
2005-05-09 20:36:57 +00:00
Chris Lattner
5385db5523 legalize READPORT, WRITEPORT, READIO, WRITEIO, at least in the basic cases
where they are directly supported by the architecture.  Wrap a bunch of
long lines :(

llvm-svn: 21826
2005-05-09 20:23:03 +00:00
Chris Lattner
20eaeae966 Add support for matching the READPORT, WRITEPORT, READIO, WRITEIO intrinsics
llvm-svn: 21825
2005-05-09 20:22:36 +00:00
Chris Lattner
67ab94510d Add support for READPORT, WRITEPORT, READIO, WRITEIO
llvm-svn: 21824
2005-05-09 20:22:17 +00:00
Chris Lattner
61171e59b2 Add READPORT, WRITEPORT, READIO, WRITEIO nodes, wrap long lines
llvm-svn: 21823
2005-05-09 20:21:27 +00:00
John Criswell
b3235830b6 Tell tblgen exactly where to find the include file.
llvm-svn: 21822
2005-05-09 19:32:08 +00:00
Chris Lattner
4ccd1f603c restore some non-dead code I removed last night breaking double casts to
uint

llvm-svn: 21821
2005-05-09 18:37:02 +00:00
Chris Lattner
129c5fea44 fold and (shl X, C1), C2 -> rlwinm when possible. Many other cases are possible,
include and (srl)    and the inverses (shl and) etc.

llvm-svn: 21820
2005-05-09 17:39:48 +00:00
Chris Lattner
0d9a700b39 new testcase
llvm-svn: 21819
2005-05-09 17:09:31 +00:00
Chris Lattner
1ab1691da9 Fold shifts into subsequent SHL's. These shifts often arise due to addrses
arithmetic lowering.

llvm-svn: 21818
2005-05-09 17:06:45 +00:00
John Criswell
05990f3302 Updated the list of code generators for LLVM 1.5.
Added information on getting LLVM 1.5 from CVS (hopefully readers will
understand that the label will work *after* LLVM 1.5 is released).

llvm-svn: 21817
2005-05-09 16:49:59 +00:00
John Criswell
cfdeb5cf72 Little corrections.
llvm-svn: 21816
2005-05-09 16:39:27 +00:00
Chris Lattner
7bd6ddb6f7 Fix bug noticed by Tzu-Chien Chiu, thanks!
llvm-svn: 21815
2005-05-09 15:41:03 +00:00
Duraid Madina
74a01fa211 fix and cleanup constmul code a bit, this fixes mediabench/toast and
probably a couple of other tests.

llvm-svn: 21814
2005-05-09 13:18:34 +00:00
Chris Lattner
a7fc3d9119 tweak test to accept the (good) code emitted by the pattern isel
llvm-svn: 21812
2005-05-09 05:54:27 +00:00
Chris Lattner
daa064d8fd Wrap long lines, remove dead code that is now handled by legalize
llvm-svn: 21811
2005-05-09 05:40:26 +00:00
Chris Lattner
e62661185c Fix FP -> bool casts
llvm-svn: 21810
2005-05-09 05:33:18 +00:00
Chris Lattner
b62f5082c5 implement and.ll:test33
llvm-svn: 21809
2005-05-09 04:58:36 +00:00
Chris Lattner
19519b3792 New testcase
llvm-svn: 21808
2005-05-09 04:54:18 +00:00
Reid Spencer
3992dbd2a0 Add note to self to complete the testing of all intrinsic functions as
specified in the LangRef document.

llvm-svn: 21807
2005-05-09 04:47:32 +00:00
Chris Lattner
57d294f2ac Don't use the load/store instruction as the source pointer, use the pointer
being stored/loaded through!

llvm-svn: 21806
2005-05-09 04:28:51 +00:00
Chris Lattner
c14f354895 memoize all nodes, even null Value* nodes. Do not add two token chain outputs
llvm-svn: 21805
2005-05-09 04:14:13 +00:00
Chris Lattner
f5675a0813 wrap long lines
llvm-svn: 21804
2005-05-09 04:08:33 +00:00
Chris Lattner
9440d6e260 Print SrcValue nodes correctly
llvm-svn: 21803
2005-05-09 04:08:27 +00:00
Chris Lattner
6972c31ab5 Fix X86/2005-05-08-FPStackifierPHI.ll: ugly gross hack.
llvm-svn: 21801
2005-05-09 03:36:39 +00:00
Chris Lattner
85013ae74a New testcase that crashes the pattern isel
llvm-svn: 21800
2005-05-09 03:36:11 +00:00
Chris Lattner
e251b5ca89 Preserve CC's when linking modules
llvm-svn: 21799
2005-05-09 01:09:39 +00:00
Chris Lattner
d0525a29d1 Preserve calling conventions when doing IPO
llvm-svn: 21798
2005-05-09 01:05:50 +00:00
Chris Lattner
21d1dde72a wrap long lines, preserve calling conventions when cloning functions and
turning calls into invokes

llvm-svn: 21797
2005-05-09 01:04:34 +00:00
Chris Lattner
bb0bfc4702 By definition, 'tail' calls cannot access the stack frame of their caller.
Expose this as a simple form of mod/ref information.  This implements
BasicAA/tailcall-modref.ll

llvm-svn: 21796
2005-05-08 23:58:12 +00:00
Chris Lattner
af008dcdd1 New testacse for information exposed by the 'tail' call marker.
llvm-svn: 21795
2005-05-08 23:57:34 +00:00
Chris Lattner
2ad5aa8334 Verify that varargs functions all have ccc
llvm-svn: 21792
2005-05-08 22:27:09 +00:00
Chris Lattner
a4c8022caf Convert non-address taken functions with C calling conventions to fastcc.
llvm-svn: 21791
2005-05-08 22:18:06 +00:00
Chris Lattner
257008beff If loopextract breaks the program provide output so that we can repro the
problem.

llvm-svn: 21790
2005-05-08 21:54:56 +00:00
Chris Lattner
2cbd1337ce add a testcase for a case we do not handle yet
llvm-svn: 21789
2005-05-08 21:47:42 +00:00
Chris Lattner
df3332660f Implement Reassociate/mul-neg-add.ll
llvm-svn: 21788
2005-05-08 21:41:35 +00:00
Chris Lattner
ce7d145b20 new testcase
llvm-svn: 21787
2005-05-08 21:41:18 +00:00
Chris Lattner
c4f8e2b0ed Bail out earlier
llvm-svn: 21786
2005-05-08 21:33:47 +00:00
Chris Lattner
877b114037 Teach reassociate that 0-X === X*-1
llvm-svn: 21785
2005-05-08 21:28:52 +00:00
Chris Lattner
90723bacb9 new testcase
llvm-svn: 21784
2005-05-08 21:28:33 +00:00
Chris Lattner
9f284e0a3c Fix PR557 and basictest[34].ll.
This makes reassociate realize that loads should be treated as unmovable, and
gives distinct ranks to distinct values defined in the same basic block, allowing
reassociate to do its thing.

llvm-svn: 21783
2005-05-08 20:57:04 +00:00
Chris Lattner
f9a33ede62 new testcases for PR557
llvm-svn: 21782
2005-05-08 20:56:02 +00:00
Chris Lattner
9187f3905e Add debugging information
llvm-svn: 21781
2005-05-08 20:09:57 +00:00
Chris Lattner
08582be283 eliminate gotos
llvm-svn: 21780
2005-05-08 19:48:43 +00:00
Chris Lattner
9acd314ba3 Wrap long lines. Fix "warning: conflicting types for built-in function 'memset'"
warning from the CBE+GCC.

llvm-svn: 21779
2005-05-08 19:46:29 +00:00
Chris Lattner
5847e5e10c Improve reassociation handling of inverses, implementing inverses.ll.
llvm-svn: 21778
2005-05-08 18:59:37 +00:00
Chris Lattner
2f1b13255d new testcase
llvm-svn: 21777
2005-05-08 18:54:40 +00:00
Chris Lattner
4922118dc4 clean up and modernize this pass.
llvm-svn: 21776
2005-05-08 18:45:26 +00:00
Chris Lattner
b18dbbfff5 Strength reduce SAR into SHR if there is no way sign bits could be shifted
in.  This tends to get cases like this:

  X = cast ubyte to int
  Y = shr int X, ...

Tested by: shift.ll:test24

llvm-svn: 21775
2005-05-08 17:34:56 +00:00
Chris Lattner
5140c15f08 new testcase
llvm-svn: 21774
2005-05-08 17:31:24 +00:00
Jeff Cohen
b127267a5a Update my info
llvm-svn: 21773
2005-05-08 01:07:48 +00:00
Chris Lattner
e1850b86b6 Refactor some code
llvm-svn: 21772
2005-05-08 00:19:31 +00:00
Chris Lattner
6e2086d7e4 Handle some simple cases where we can see that values get annihilated.
llvm-svn: 21771
2005-05-08 00:08:33 +00:00
Chris Lattner
4294cec0f1 Fix a miscompilation of crafty by clobbering the "A" variable.
llvm-svn: 21770
2005-05-07 23:49:08 +00:00
Chris Lattner
041f8b59c1 Move licm after reassociate, add some cond-propagate passes
llvm-svn: 21769
2005-05-07 22:45:35 +00:00
Chris Lattner
1e5065052a Rewrite the guts of the reassociate pass to be more efficient and logical. Instead
of trying to do local reassociation tweaks at each level, only process an expression
tree once (at its root).  This does not improve the reassociation pass in any real way.

llvm-svn: 21768
2005-05-07 21:59:39 +00:00
Reid Spencer
f2ff439c4b * Break tests into individual cases so its easier to see what's going on.
* Add four new cases to handle the new optimizations for strlen, dealing
  with:
    strlen(x) != 0 -> *x != 0
    strlen(x) == 0 -> *x == 0
  for each of two cases: strlen(x) != 0 and strlen(x) == 0

llvm-svn: 21767
2005-05-07 20:21:04 +00:00
Reid Spencer
170ae7ff70 * Add two strlen optimizations:
strlen(x) != 0 -> *x != 0
    strlen(x) == 0 -> *x == 0
* Change nested statistics to use style of other LLVM statistics so that
  only the name of the optimization (simplify-libcalls) is used as the
  statistic name, and the description indicates which specific all is
  optimized. Cuts down on some redundancy and saves a few bytes of space.
* Make note of stpcpy optimization that could be done.

llvm-svn: 21766
2005-05-07 20:15:59 +00:00
Reid Spencer
4f01a822b4 Don't increment the counter unless the debug flag is set.
llvm-svn: 21762
2005-05-07 04:59:45 +00:00
Chris Lattner
cea579932d Convert shifts to muls to assist reassociation. This implements
Reassociate/shifttest.ll

llvm-svn: 21761
2005-05-07 04:24:13 +00:00
Chris Lattner
30555b0d14 test that reassociate can handle shifts
llvm-svn: 21760
2005-05-07 04:23:29 +00:00
Chris Lattner
f43e974abd Simplify the code and rearrange it. No major functionality changes here.
llvm-svn: 21759
2005-05-07 04:08:02 +00:00
Jeff Cohen
6dc6672840 Silence VC++ warnings about unsafe mixing of ints and bools with the | operator.
llvm-svn: 21758
2005-05-07 02:44:04 +00:00
Chris Lattner
b34b273386 add note about bit builtins newly supported
llvm-svn: 21757
2005-05-07 02:21:21 +00:00
Chris Lattner
6ea3be51f8 new testcase
llvm-svn: 21756
2005-05-07 02:16:08 +00:00
Chris Lattner
573f64ecb5 fix bugs in my previous commit clarify the return type of the bit ops
llvm-svn: 21755
2005-05-07 01:46:40 +00:00
Chris Lattner
c792eb342c add a couple of notes
llvm-svn: 21754
2005-05-06 23:08:23 +00:00
Chris Lattner
0132affa89 document calling convention extensions
llvm-svn: 21753
2005-05-06 22:57:40 +00:00
Chris Lattner
9bbe58628b remove some dead (always dynamically false) flags
llvm-svn: 21752
2005-05-06 22:35:09 +00:00
Chris Lattner
129535c787 encode calling conventions for call/invoke instructions.
llvm-svn: 21751
2005-05-06 22:34:01 +00:00
Chris Lattner
f71853e277 new testcase
llvm-svn: 21750
2005-05-06 22:33:44 +00:00
Chris Lattner
f2e1c1969f encode function calling convs in the bytecode file. invoke and call are
still to come.

llvm-svn: 21749
2005-05-06 20:42:57 +00:00
Chris Lattner
53bdd31211 parse new calling conv specifiers
llvm-svn: 21748
2005-05-06 20:27:19 +00:00
Chris Lattner
b25b6304b7 wrap a longline
llvm-svn: 21747
2005-05-06 20:27:03 +00:00
Chris Lattner
f7b6d3191b add support for explicit calling conventions
llvm-svn: 21746
2005-05-06 20:26:43 +00:00
Chris Lattner
4147522d71 Add support for explicit calling conventions
llvm-svn: 21745
2005-05-06 20:26:26 +00:00
Chris Lattner
e29e1ff1e8 New file
llvm-svn: 21744
2005-05-06 19:59:08 +00:00
Chris Lattner
6d817c5486 use splice instead of remove/insert for a minor speedup
llvm-svn: 21743
2005-05-06 19:58:35 +00:00
Chris Lattner
6409f3490a remove some ugly hacks that are no longer needed since andrew removed the
varargs munging code

llvm-svn: 21742
2005-05-06 19:49:51 +00:00
Chris Lattner
7effa0ed06 BAD typeo which caused many testsuite failures last night. Note to self, do
not change code after testing it without retesting!

llvm-svn: 21741
2005-05-06 17:13:16 +00:00
Chris Lattner
18335f8925 clean up the CBE output a bit
llvm-svn: 21740
2005-05-06 06:58:42 +00:00
Chris Lattner
561b7eb9e1 add tail marker as a comment
llvm-svn: 21739
2005-05-06 06:53:07 +00:00
Chris Lattner
ec7773e9e8 Make the stub functions be tail calls
llvm-svn: 21738
2005-05-06 06:48:54 +00:00
Chris Lattner
6aacb0f9da Preserve tail marker
llvm-svn: 21737
2005-05-06 06:48:21 +00:00
Chris Lattner
9f3dced2c7 Implement Transforms/Inline/inline-tail.ll
llvm-svn: 21736
2005-05-06 06:47:52 +00:00
Chris Lattner
318e328fc4 Make sure to not accidentally get a bogus tail marker
llvm-svn: 21735
2005-05-06 06:47:37 +00:00
Chris Lattner
324d2eedb2 preserve the tail marker
llvm-svn: 21734
2005-05-06 06:46:58 +00:00
Chris Lattner
2db10ece5c add a default arg
llvm-svn: 21733
2005-05-06 06:22:10 +00:00
Chris Lattner
5879f9c24d Don't forget these are calls
llvm-svn: 21730
2005-05-06 06:21:59 +00:00
Chris Lattner
ca4d4bd2db lex tail
llvm-svn: 21729
2005-05-06 06:20:33 +00:00
Chris Lattner
2c9a46e758 test that tail call survives bytecodification
llvm-svn: 21728
2005-05-06 06:18:33 +00:00
Chris Lattner
fb6f1746f4 add bytecode reader support for tail calls
llvm-svn: 21727
2005-05-06 06:13:34 +00:00
Chris Lattner
abb5bd78ca Hilight tail
llvm-svn: 21726
2005-05-06 06:07:34 +00:00
Chris Lattner
eaf625dc5c These are legal for tail calls
llvm-svn: 21723
2005-05-06 05:59:50 +00:00
Chris Lattner
0603845a49 Add a 'tail' marker for call instructions, patch contributed by
Alexander Friedman.

llvm-svn: 21722
2005-05-06 05:51:46 +00:00
Chris Lattner
e23c139836 Add info on new 'tail' marker
llvm-svn: 21721
2005-05-06 05:47:36 +00:00
Chris Lattner
53db546b97 Wrap long lines
llvm-svn: 21720
2005-05-06 05:34:40 +00:00
Chris Lattner
a36d525741 DCE intrinsic instructions without side effects.
llvm-svn: 21719
2005-05-06 05:27:34 +00:00
Chris Lattner
b2d3ac8349 These intrinsics do not access memory
llvm-svn: 21718
2005-05-06 05:21:04 +00:00
Chris Lattner
ef298a3b8a Teach instcombine propagate zeroness through shl instructions, implementing
and.ll:test31

llvm-svn: 21717
2005-05-06 04:53:20 +00:00
Chris Lattner
8d83be2bf0 new testcases
llvm-svn: 21716
2005-05-06 04:52:46 +00:00
Chris Lattner
873804168e Implement shift.ll:test23. If we are shifting right then immediately truncating
the result, turn signed shift rights into unsigned shift rights if possible.

This leads to later simplification and happens *often* in 176.gcc.  For example,
this testcase:

struct xxx { unsigned int code : 8; };
enum codes { A, B, C, D, E, F };
int foo(struct xxx *P) {
  if ((enum codes)P->code == A)
     bar();
}

used to be compiled to:

int %foo(%struct.xxx* %P) {
        %tmp.1 = getelementptr %struct.xxx* %P, int 0, uint 0           ; <uint*> [#uses=1]
        %tmp.2 = load uint* %tmp.1              ; <uint> [#uses=1]
        %tmp.3 = cast uint %tmp.2 to int                ; <int> [#uses=1]
        %tmp.4 = shl int %tmp.3, ubyte 24               ; <int> [#uses=1]
        %tmp.5 = shr int %tmp.4, ubyte 24               ; <int> [#uses=1]
        %tmp.6 = cast int %tmp.5 to sbyte               ; <sbyte> [#uses=1]
        %tmp.8 = seteq sbyte %tmp.6, 0          ; <bool> [#uses=1]
        br bool %tmp.8, label %then, label %UnifiedReturnBlock

Now it is compiled to:

        %tmp.1 = getelementptr %struct.xxx* %P, int 0, uint 0           ; <uint*> [#uses=1]
        %tmp.2 = load uint* %tmp.1              ; <uint> [#uses=1]
        %tmp.2 = cast uint %tmp.2 to sbyte              ; <sbyte> [#uses=1]
        %tmp.8 = seteq sbyte %tmp.2, 0          ; <bool> [#uses=1]
        br bool %tmp.8, label %then, label %UnifiedReturnBlock

which is the difference between this:

foo:
        subl $4, %esp
        movl 8(%esp), %eax
        movl (%eax), %eax
        shll $24, %eax
        sarl $24, %eax
        testb %al, %al
        jne .LBBfoo_2

and this:

foo:
        subl $4, %esp
        movl 8(%esp), %eax
        movl (%eax), %eax
        testb %al, %al
        jne .LBBfoo_2

This occurs 3243 times total in the External tests, 215x in povray,
6x in each f2c'd program, 1451x in 176.gcc, 7x in crafty, 20x in perl,
25x in gap, 3x in m88ksim, 25x in ijpeg.

Maybe this will cause a little jump on gcc tommorow :)

llvm-svn: 21715
2005-05-06 04:18:52 +00:00
Chris Lattner
1524489f22 new testcase
llvm-svn: 21714
2005-05-06 04:11:32 +00:00
Chris Lattner
7208616ec0 Implement xor.ll:test22
llvm-svn: 21713
2005-05-06 02:07:39 +00:00
Chris Lattner
4c2d3781aa implement and.ll:test30 and set.ll:test21
llvm-svn: 21712
2005-05-06 01:53:19 +00:00
Chris Lattner
8169e16268 new testcase for unneeded and
llvm-svn: 21711
2005-05-06 01:52:52 +00:00
Chris Lattner
838dae0991 new testcase
llvm-svn: 21710
2005-05-06 01:51:05 +00:00
Chris Lattner
dd1e562ec3 implement or.ll:test20
llvm-svn: 21709
2005-05-06 00:58:50 +00:00
Chris Lattner
ce8dd82d66 new testcase
llvm-svn: 21708
2005-05-06 00:58:09 +00:00
Misha Brukman
584ed83d4a * Order #includes alphabetically
* Remove commented-out debug printouts

llvm-svn: 21707
2005-05-05 23:45:17 +00:00
Misha Brukman
c0aac8e858 Remove extra blank line
llvm-svn: 21706
2005-05-05 23:43:47 +00:00
Misha Brukman
3f670d29dc * Use consistent spacing for function arguments
* Output single-character strings as chars

llvm-svn: 21705
2005-05-05 22:38:21 +00:00
Misha Brukman
291f6b7223 Remove vim settings from source code; people should use llvm/utils/vim/vimrc
llvm-svn: 21704
2005-05-05 22:33:09 +00:00
Misha Brukman
08d66b4e10 Convert tabs to spaces
llvm-svn: 21703
2005-05-05 22:30:40 +00:00
Chris Lattner
4a454c80db new testcase for PR541
llvm-svn: 21702
2005-05-05 22:23:10 +00:00
Chris Lattner
1243e1c9f1 add support for undef values of opaque type, addressing PR541
llvm-svn: 21701
2005-05-05 22:21:19 +00:00
Chris Lattner
7ddaeb448b Add some extra checks. Opaque types don't have a null marker.
llvm-svn: 21700
2005-05-05 20:57:00 +00:00
Chris Lattner
2cc59a8066 new testcase
llvm-svn: 21699
2005-05-05 17:57:24 +00:00
Chris Lattner
7876156ba0 When hitting an unsupported intrinsic, actually print it
Lower debug info to noops.

llvm-svn: 21698
2005-05-05 17:55:17 +00:00
Andrew Lenharth
2dbbb3ab84 ctpop lowering in legalize
llvm-svn: 21697
2005-05-05 15:55:21 +00:00
Chris Lattner
807aa20f67 Fix a bug compimling Ruby, fixing this testcase:
LowerSetJmp/2005-05-05-OldUses.ll

llvm-svn: 21696
2005-05-05 15:47:43 +00:00
Chris Lattner
fa58898845 new testcase for a bug Jim found
llvm-svn: 21695
2005-05-05 15:47:16 +00:00
Andrew Lenharth
b8e94c3499 fix typo
llvm-svn: 21693
2005-05-04 19:25:37 +00:00
Andrew Lenharth
aed06a0e92 Well, add support for ct* for 21264 only.
21164 is broken until expand works.

llvm-svn: 21692
2005-05-04 19:12:09 +00:00
Andrew Lenharth
dd426dd04d Make promoteOp work for CT*
Proof?

ubyte %bar(ubyte %x) {
entry:
        %tmp.1 = call ubyte %llvm.ctlz( ubyte %x )
        ret ubyte %tmp.1
}

==>

zapnot $16,1,$0
CTLZ $0,$0
subq $0,56,$0
zapnot $0,1,$0
ret $31,($26),1

llvm-svn: 21691
2005-05-04 19:11:05 +00:00
Chris Lattner
809dfac421 Instcombine: cast (X != 0) to int, cast (X == 1) to int -> X iff X has only the low bit set.
This implements set.ll:test20.

This triggers 2x on povray, 9x on mesa, 11x on gcc, 2x on crafty, 1x on eon,
6x on perlbmk and 11x on m88ksim.

It allows us to compile these two functions into the same code:

struct s { unsigned int bit : 1; };
unsigned foo(struct s *p) {
  if (p->bit)
    return 1;
  else
    return 0;
}
unsigned bar(struct s *p) { return p->bit; }

llvm-svn: 21690
2005-05-04 19:10:26 +00:00
Chris Lattner
3538a4f6cc new testcase
llvm-svn: 21689
2005-05-04 19:05:02 +00:00
Reid Spencer
282d057485 Implement the IsDigitOptimization for simplifying calls to the isdigit
library function:
  isdigit(chr) -> 0 or 1 if chr is constant
  isdigit(chr) -> chr - '0' <= 9 otherwise

Although there are many calls to isdigit in llvm-test, most of them are
compiled away by macros leaving only this:

2 MultiSource/Applications/hexxagon

llvm-svn: 21688
2005-05-04 18:58:28 +00:00
Reid Spencer
f9a4a9681d Make sure both optimization cases get tested.
llvm-svn: 21687
2005-05-04 17:45:10 +00:00
Reid Spencer
190bb26157 Add a test case for the IsDigitOptimization class.
llvm-svn: 21686
2005-05-04 17:34:55 +00:00
Andrew Lenharth
702859084b comment fix
llvm-svn: 21685
2005-05-04 15:56:34 +00:00
Andrew Lenharth
dd9d3ac72b see if the legalize code propery compensates for the additional zeros introduced
llvm-svn: 21684
2005-05-04 15:51:07 +00:00
Reid Spencer
e84ee1bcd0 Correct the descriptions of WHILE...END and RROT. Thanks to Lalo Martins
for pointing out these errors.

llvm-svn: 21683
2005-05-04 15:43:40 +00:00
Reid Spencer
7063d1aa71 WHILE does not "pop" a value, it "examines" to top of stack. Make this
clear in the applicable comment.

llvm-svn: 21682
2005-05-04 15:33:48 +00:00
Andrew Lenharth
6b551024ac added a use of ctpop to debug stuff with
llvm-svn: 21681
2005-05-04 15:20:16 +00:00
Andrew Lenharth
5be6f131e6 fixup argument
llvm-svn: 21680
2005-05-04 14:58:31 +00:00
Reid Spencer
1e520fd661 * Correct the function prototypes for some of the functions to match the
actual spec (int -> uint)
* Add the ability to get/cache the strlen function prototype.
* Make sure generated values are appropriately named for debugging purposes
* Add the SPrintFOptimiation for 4 casts of sprintf optimization:
    sprintf(str,cstr) -> llvm.memcpy(str,cstr) (if cstr has no %)
    sprintf(str,"")   -> store sbyte 0, str
    sprintf(str,"%s",src) -> llvm.memcpy(str,src) (if src is constant)
    sprintf(str,"%c",chr) -> store chr, str   ; store sbyte 0, str+1

The sprintf optimization didn't fire as much as I had hoped:

  2 MultiSource/Applications/SPASS
  5 MultiSource/Benchmarks/McCat/18-imp
 22 MultiSource/Benchmarks/Prolangs-C/TimberWolfMC
  1 MultiSource/Benchmarks/Prolangs-C/assembler
  6 MultiSource/Benchmarks/Prolangs-C/unix-smail
  2 MultiSource/Benchmarks/mediabench/mpeg2/mpeg2dec

llvm-svn: 21679
2005-05-04 03:20:21 +00:00
Misha Brukman
23e9f163ad Minor clean-ups
llvm-svn: 21678
2005-05-03 20:30:34 +00:00
Andrew Lenharth
1d463526b4 initial descriptions of count intrinsics
llvm-svn: 21677
2005-05-03 18:01:48 +00:00
Andrew Lenharth
5e177826fd Implement count leading zeros (ctlz), count trailing zeros (cttz), and count
population (ctpop).  Generic lowering is implemented, however only promotion
is implemented for SelectionDAG at the moment.

More coming soon.

llvm-svn: 21676
2005-05-03 17:19:30 +00:00
Reid Spencer
f436286cf6 Fix this test to succeed even if "strchr" is on a call instruction.
llvm-svn: 21675
2005-05-03 17:09:38 +00:00
Reid Spencer
a6bbd18023 Add a test case for SPrintFOptimization.
llvm-svn: 21674
2005-05-03 17:08:45 +00:00
Andrew Lenharth
38cc7bacb4 yea yea yea
llvm-svn: 21673
2005-05-03 17:00:48 +00:00
Andrew Lenharth
2e18c628c4 note the vararg change, and other stuff
llvm-svn: 21672
2005-05-03 16:59:09 +00:00
Andrew Lenharth
bf50ff58ae pre add count tests
llvm-svn: 21671
2005-05-03 16:49:48 +00:00
Chris Lattner
c22333348e fix a bug in the 1 index GEP handling code
llvm-svn: 21670
2005-05-03 16:44:45 +00:00
Reid Spencer
38cabd7265 Implement optimizations for the strchr and llvm.memset library calls.
Neither of these activated as many times as was hoped:

strchr:
9 MultiSource/Applications/siod
1 MultiSource/Applications/d
2 MultiSource/Prolangs-C/archie-client
1 External/SPEC/CINT2000/176.gcc/176.gcc

llvm.memset:
no hits

llvm-svn: 21669
2005-05-03 07:23:44 +00:00
Reid Spencer
a064a84067 Add a test case for StrChrOptimizer for -simplify-libcalls
llvm-svn: 21668
2005-05-03 06:22:41 +00:00
Misha Brukman
d317d937b2 Clean up and correct llvmc configurations for C and C++
llvm-svn: 21667
2005-05-03 06:13:18 +00:00
Misha Brukman
18aa1d6438 std::string(NULL) does not a proper constructor make
llvm-svn: 21666
2005-05-03 06:10:51 +00:00
Chris Lattner
8298120f17 add direct support for making GEP instrs with one index
llvm-svn: 21665
2005-05-03 05:43:30 +00:00
Misha Brukman
cc42755633 Omit periods at the end of command-line switch explanations for consistency
llvm-svn: 21664
2005-05-03 05:36:14 +00:00
Reid Spencer
d18dbcbf4c A new test case for the LLVMMemSetOptimization.
llvm-svn: 21663
2005-05-03 04:00:24 +00:00
Jeff Cohen
4e3aedeaa6 Use ANSI-approved way of getting the value infinity (otherwise VC++ won't compile it)
llvm-svn: 21662
2005-05-03 03:13:01 +00:00
Reid Spencer
95d8efdfcf Avoid garbage output in the statistics display by ensuring that the
strings passed to Statistic's constructor are not destructable. The stats
are printed during static destruction and the SimplifyLibCalls module was
getting destructed before the statistics.

llvm-svn: 21661
2005-05-03 02:54:54 +00:00
Reid Spencer
49fa070401 Add the StrNCmpOptimization which is similar to strcmp.
Unfortunately, this optimization didn't trigger on any llvm-test tests.

llvm-svn: 21660
2005-05-03 01:43:45 +00:00
Reid Spencer
8204531db1 Correct the title and the success criteria: strcmp -> strncmp
llvm-svn: 21659
2005-05-03 00:52:19 +00:00
Reid Spencer
0a23afbedb Add a new test case for the StrNCmpOptimization.
llvm-svn: 21658
2005-05-03 00:50:43 +00:00
Reid Spencer
2d5c7beebd Implement the fprintf optimization which converts calls like this:
fprintf(F,"hello") -> fwrite("hello",strlen("hello"),1,F)
  fprintf(F,"%s","hello") -> fwrite("hello",strlen("hello"),1,F)
  fprintf(F,"%c",'x') -> fputc('c',F)

This optimization fires severals times in llvm-test:

313 MultiSource/Applications/Burg
302 MultiSource/Benchmarks/Prolangs-C/TimberWolfMC
189 MultiSource/Benchmarks/Prolangs-C/mybison
175 MultiSource/Benchmarks/Prolangs-C/football
130 MultiSource/Benchmarks/Prolangs-C/unix-tbl

llvm-svn: 21657
2005-05-02 23:59:26 +00:00
Reid Spencer
59605a1b57 Add a test case for testing the FPrintFOptimization.
llvm-svn: 21656
2005-05-02 23:07:14 +00:00
Andrew Lenharth
c73e633a41 fold fp div by 0 to inf, the way gcc does. This is legal according to the FP spec
llvm-svn: 21655
2005-05-02 21:25:47 +00:00
Andrew Lenharth
f5d58d1bc3 Remove support for 1.0 style varargs
amusing of course, because we will have to go back to those semantics soon

llvm-svn: 21654
2005-05-02 19:07:27 +00:00
John Criswell
f42ed7bdaf Fixed a comment.
llvm-svn: 21653
2005-05-02 14:47:42 +00:00
Duraid Madina
7acd5d5f06 support multiplication by constant negative integers
this constmul code is still buggy though, so beware. mul by 7427 is currently
broken, for example. will fix it when I get a moment :)

llvm-svn: 21652
2005-05-02 07:27:14 +00:00
Duraid Madina
0e73188c10 add support for bools to SELECT, this fixes Prolangs-C/bison from the
testsuite, however 09-vor is still dead (hopefully for other reasons!)

llvm-svn: 21651
2005-05-02 06:41:13 +00:00
Reid Spencer
d845d160f6 Mention that arguments to functions must be first class types.
llvm-svn: 21650
2005-05-01 22:22:57 +00:00
Tanya Lattner
846b8b00e2 Add accessor method,
llvm-svn: 21649
2005-05-01 16:22:41 +00:00
Tanya Lattner
c187835632 Adding ModuloSched SB.
llvm-svn: 21648
2005-05-01 16:14:34 +00:00
Chris Lattner
a816eee427 Implement getelementptr.ll:test11
llvm-svn: 21647
2005-05-01 04:42:15 +00:00
Chris Lattner
cdb2465152 new testcase
llvm-svn: 21646
2005-05-01 04:41:57 +00:00
Chris Lattner
a9d84e3388 Check for volatile loads only once.
Implement load.ll:test7

llvm-svn: 21645
2005-05-01 04:24:53 +00:00
Chris Lattner
da96eeb2d5 add a new testcase
llvm-svn: 21644
2005-05-01 04:24:15 +00:00
Tanya Lattner
9d43c75a55 SMS for superblocks.
llvm-svn: 21643
2005-05-01 01:27:47 +00:00
Tanya Lattner
bdfb9e61a0 Added extra constructor for superblocks.
llvm-svn: 21642
2005-05-01 01:25:53 +00:00
Tanya Lattner
4d0ee754e3 Fixed bug in searchPath function for finding nodes between two recurrences.
Changed dependence analyzer to only use dep distances of 2 or less.
This is experimental.

Changed MSchedGraph to be able to represent more then one BB (first steps).

llvm-svn: 21641
2005-04-30 23:07:59 +00:00
Andrew Lenharth
537332eba8 I was sure I had thought about this and there was a reason it should work.
But it is entirely possible I am just crazy.

llvm-svn: 21640
2005-04-30 14:19:13 +00:00
Alkis Evlogimenos
d7e534b2b3 Do not use deprecated APIs
llvm-svn: 21639
2005-04-30 07:13:31 +00:00
Reid Spencer
16449a9eb0 Fix a comment that stated the wrong thing.
llvm-svn: 21638
2005-04-30 06:45:47 +00:00
Chris Lattner
c8a6633dea Eliminate some random whitespace
llvm-svn: 21637
2005-04-30 04:44:07 +00:00
Chris Lattner
8002640eab Codegen and legalize sin/cos/llvm.sqrt as FSIN/FCOS/FSQRT calls. This patch
was contributed by Morten Ofstad, with some minor tweaks and bug fixes added
by me.

llvm-svn: 21636
2005-04-30 04:43:14 +00:00
Chris Lattner
9efa7e7533 add sin/cos tests
llvm-svn: 21635
2005-04-30 04:41:27 +00:00
Chris Lattner
9993823876 Doesn't support these nodes
llvm-svn: 21634
2005-04-30 04:26:56 +00:00
Chris Lattner
9c6bbafc15 This target doesn't support the FSIN/FCOS/FSQRT nodes yet
llvm-svn: 21633
2005-04-30 04:26:06 +00:00
Chris Lattner
db68d39a01 Add support for FSIN/FCOS when unsafe math ops are enabled. Patch contributed by
Morten Ofstad!

llvm-svn: 21632
2005-04-30 04:25:35 +00:00
Chris Lattner
3b20386551 Add support for llvm.sqrt and sin/cos if unsafe math optimizations are enabled.
llvm-svn: 21631
2005-04-30 04:12:40 +00:00
Chris Lattner
4a2cc6603d Expose an option allowing unsafe math optimizations. Patch contributed by
Morten Ofstad!

llvm-svn: 21630
2005-04-30 04:09:52 +00:00
Chris Lattner
30fe4ac2fb Lower llvm.sqrt -> fsqrt/sqrt
llvm-svn: 21629
2005-04-30 04:07:50 +00:00
Chris Lattner
7100fcde6c Add a test for llvm.sqrt
llvm-svn: 21628
2005-04-30 04:07:15 +00:00
Chris Lattner
1c636f1118 Add llvm.sqrt intrinsic, patch contributed by Morten Ofstad
llvm-svn: 21627
2005-04-30 03:44:07 +00:00
Reid Spencer
4c444fe007 * Don't depend on "guessing" what a FILE* is, just require that the actual
type be obtained from a CallInst we're optimizing.
* Make it possible for getConstantStringLength to return the ConstantArray
  that it extracts in case the content is needed by an Optimization.
* Implement the strcmp optimization
* Implement the toascii optimization

This pass is now firing several to many times in the following MultiSource
tests:

Applications/Burg      -   7 (strcat,strcpy)
Applications/siod      -  13 (strcat,strcpy,strlen)
Applications/spiff     - 120 (exit,fputs,strcat,strcpy,strlen)
Applications/treecc    -  66 (exit,fputs,strcat,strcpy)
Applications/kimwitu++ -  34 (strcmp,strcpy,strlen)
Applications/SPASS     - 588 (exit,fputs,strcat,strcpy,strlen)

llvm-svn: 21626
2005-04-30 03:17:54 +00:00
Reid Spencer
29c6b848db * Fix signed/unsigned usage problem
* Rearrange for readability.

llvm-svn: 21625
2005-04-30 03:06:36 +00:00
Reid Spencer
10e99b2667 A new test case for the ToAsciiOptimizer.
llvm-svn: 21624
2005-04-30 01:00:52 +00:00
Reid Spencer
89339ffb22 A new test case for the StrCmpOptimization in -simplify-libcalls.
llvm-svn: 21623
2005-04-30 00:52:04 +00:00
Reid Spencer
1279398b1c This is StrCpy, NOT StrCat!
llvm-svn: 21622
2005-04-29 23:02:15 +00:00
Reid Spencer
cadbe2bbf1 Get the name of the pass right in the documentation.
llvm-svn: 21621
2005-04-29 23:01:21 +00:00
Reid Spencer
a2ddce3119 Fix the success criteria for the test to make call instructions with "pow"
not just any occurrence of "pow".

llvm-svn: 21620
2005-04-29 10:11:23 +00:00
Reid Spencer
9610da2670 Actually make this pass test something related to fputs.
llvm-svn: 21619
2005-04-29 10:10:17 +00:00
Reid Spencer
9361697f93 Implement the optimizations for "pow" and "fputs" library calls.
llvm-svn: 21618
2005-04-29 09:39:47 +00:00
Reid Spencer
fc4cf1d435 Add a test case for the puts libcall optimization.
llvm-svn: 21616
2005-04-29 07:19:00 +00:00
Reid Spencer
2645640325 Add a testcase for optimizing the strcpy libcall.
llvm-svn: 21615
2005-04-29 06:01:28 +00:00
Reid Spencer
c968ea0495 Remove optimizations that don't require both operands to be constant. These
are moved to simplify-libcalls pass.

llvm-svn: 21614
2005-04-29 05:55:35 +00:00
Reid Spencer
a8b889490e New test case for testing pow(3) math library optimizations.
llvm-svn: 21613
2005-04-29 05:47:05 +00:00
Jeff Cohen
4bc952f703 Consistently use 'class' to silence VC++
llvm-svn: 21612
2005-04-29 03:05:44 +00:00
Reid Spencer
ed55a6b5e0 * Add constant folding for additional floating point library calls such as
sinh, cosh, etc.
* Make the name comparisons for the fp libcalls a little more efficient by
  switching on the first character of the name before doing comparisons.

llvm-svn: 21611
2005-04-28 23:01:59 +00:00
Chris Lattner
014d2c42e7 Add support for FSQRT node, patch contributed by Morten Ofstad
llvm-svn: 21610
2005-04-28 22:07:18 +00:00
Chris Lattner
59ecb57e4a These functions can set errno!
llvm-svn: 21609
2005-04-28 21:52:31 +00:00
Chris Lattner
61827484c7 Add some new X86 instrs, patch contributed by Morten Ofstad
llvm-svn: 21608
2005-04-28 21:50:05 +00:00
Chris Lattner
effaec5436 Codegen fabs/fabsf as FABS. Patch contributed by Morten Ofstad
llvm-svn: 21607
2005-04-28 21:48:42 +00:00
Chris Lattner
9d6fa98ec7 Legalize FSQRT, FSIN, FCOS nodes, patch contributed by Morten Ofstad
llvm-svn: 21606
2005-04-28 21:44:33 +00:00
Chris Lattner
2f82d2d58a Add FSQRT, FSIN, FCOS nodes, patch contributed by Morten Ofstad
llvm-svn: 21605
2005-04-28 21:44:03 +00:00
Reid Spencer
16983ca865 Remove from the TODO list those optimizations that are already handled by
constant folding implemented in lib/Transforms/Utils/Local.cpp.

llvm-svn: 21604
2005-04-28 18:05:16 +00:00
Reid Spencer
649ac283e4 Document additional libcall transformations that need to be written.
Help Wanted!

There's a lot of them to write.

llvm-svn: 21603
2005-04-28 04:40:06 +00:00
Reid Spencer
7ddcfb3375 Doxygenate.
llvm-svn: 21602
2005-04-27 21:29:20 +00:00
Chris Lattner
36ffb1ff37 remove 'statement with no effect' warning
llvm-svn: 21600
2005-04-27 20:12:17 +00:00
Andrew Lenharth
4a73c2cfdc Implement Value* tracking for loads and stores in the selection DAG. This enables one to use alias analysis in the backends.
(TRUNK)Stores and (EXT|ZEXT|SEXT)Loads have an extra SDOperand which is a SrcValueSDNode which contains the Value*.  Note that if the operation is introduced by the backend, it will still have the operand, but the value* will be null.

llvm-svn: 21599
2005-04-27 20:10:01 +00:00
Chris Lattner
0a6f42ac1d Unbreak the sparc backend.
llvm-svn: 21598
2005-04-27 18:57:15 +00:00
Reid Spencer
08b4940509 More Cleanup:
* Name the instructions by appending to name of original
* Factor common part out of a switch statement.

llvm-svn: 21597
2005-04-27 17:46:54 +00:00
Andrew Lenharth
3b63291fc1 import fix and plot multiple lines at once
llvm-svn: 21596
2005-04-27 17:32:41 +00:00
Andrew Lenharth
438225a8cb Generate a gnuplot script for any program and any test (like llc or gcc)
llvm-svn: 21593
2005-04-27 16:41:50 +00:00
Andrew Lenharth
e81871331f So you want to import nightly tester data into a data base? Have we got the perl script for you
llvm-svn: 21592
2005-04-27 16:03:01 +00:00
Andrew Lenharth
be6ce82937 fix for parse, and a start at db import. Using CVS as scp :)
llvm-svn: 21591
2005-04-27 14:57:26 +00:00
Duraid Madina
b071bef66a clean up some warnings
llvm-svn: 21590
2005-04-27 11:57:39 +00:00
Reid Spencer
e249a82e73 This is a cleanup commit:
* Correct stale documentation in a few places
* Re-order the file to better associate things and reduce line count
* Make the pass thread safe by caching the Function* objects needed by the
  optimizers in the pass object instead of globally.
* Provide the SimplifyLibCalls pass object to the optimizer classes so they
  can access cached Function* objects and TargetData info
* Make sure the pass resets its cache if the Module passed to runOnModule
  changes
* Rename CallOptimizer LibCallOptimization. All the classes are named
  *Optimization while the objects are *Optimizer.
* Don't cache Function* in the optimizer objects because they could be used
  by multiple PassManager's running in multiple threads
* Add an optimization for strcpy which is similar to strcat
* Add a "TODO" list at the end of the file for ideas on additional libcall
  optimizations that could be added (get ideas from other compilers).

Sorry for the huge diff. Its mostly reorganization of code. That won't
happen again as I believe the design and infrastructure for this pass is
now done or close to it.

llvm-svn: 21589
2005-04-27 07:54:40 +00:00
Chris Lattner
93f4e9dd26 detect functions that never return, and turn the instruction following a
call to them into an 'unreachable' instruction.

This triggers a bunch of times, particularly on gcc:

gzip: 36
gcc: 601
eon: 12
bzip: 38
llvm-svn: 21587
2005-04-27 04:52:23 +00:00
Chris Lattner
356cbfef73 Test the noreturn function optimization
llvm-svn: 21586
2005-04-27 04:51:01 +00:00
Reid Spencer
a21f83f809 Add the simplify-libcalls pass.
llvm-svn: 21585
2005-04-27 02:22:47 +00:00
Andrew Lenharth
9b3114d4ed A first step towards being able to do more interesting things with the nightly tester data. Moreinteresting things will come soon, so tune in
llvm-svn: 21584
2005-04-27 02:13:20 +00:00
Reid Spencer
dc11db68b6 Prefix the debug statistics so they group together.
llvm-svn: 21583
2005-04-27 00:20:23 +00:00
Reid Spencer
e95a647b2a In debug builds, make a statistic for each kind of call optimization. This
helps track down what gets triggered in the pass so its easier to identify
good test cases.

llvm-svn: 21582
2005-04-27 00:05:45 +00:00
Chris Lattner
7f4f773e9f This analysis doesn't take 'throwing' into consideration, it looks at
'unwinding'

llvm-svn: 21581
2005-04-26 23:53:25 +00:00
Reid Spencer
f9d4be187f Fix up the debug statement to actually use a newline .. radical concept.
llvm-svn: 21580
2005-04-26 23:07:08 +00:00
Reid Spencer
18b998192f Uh, this isn't argpromotion.
llvm-svn: 21579
2005-04-26 23:05:17 +00:00
Reid Spencer
2bc7a4f82a Add some debugging output so we can tell which calls are getting triggered
llvm-svn: 21578
2005-04-26 23:02:16 +00:00
Chris Lattner
2bfe36214d no parens
llvm-svn: 21577
2005-04-26 22:57:07 +00:00
Chris Lattner
730a5da1af update some paths
llvm-svn: 21576
2005-04-26 22:56:16 +00:00
Reid Spencer
f8c03d9db6 No, seriously folks, memcpy really does return void.
llvm-svn: 21575
2005-04-26 22:49:48 +00:00
Reid Spencer
aaca170867 memcpy returns void!!!!!
llvm-svn: 21574
2005-04-26 22:46:23 +00:00
Reid Spencer
7821d06c24 Convert the remainder of the intrinsic function prototypes to "declare"
form from the "call" form.

llvm-svn: 21573
2005-04-26 20:50:44 +00:00
Reid Spencer
cf669d87d0 Use the declare syntax not the call syntax for intrinsic prototypes so
the uninitiated reader is not confused.

llvm-svn: 21572
2005-04-26 20:41:16 +00:00
Chris Lattner
41d183ed8d don't let Reid build void*'s :)
llvm-svn: 21571
2005-04-26 20:03:33 +00:00
Reid Spencer
4855ebf622 Fix some bugs found by running on llvm-test:
* MemCpyOptimization can only be optimized if the 3rd and 4th arguments are
  constants and we weren't checking for that.
* The result of llvm.memcpy (and llvm.memmove) is void* not sbyte*, put in
  a cast.

llvm-svn: 21570
2005-04-26 19:55:57 +00:00
Reid Spencer
bb92b4fdfb Changes From Review Feedback:
* Have the SimplifyLibCalls pass acquire the TargetData and pass it down to
  the optimization classes so they can use it to make better choices for
  the signatures of functions, etc.
* Rearrange the code a little so the utility functions are closer to their
  usage and keep the core of the pass near the top of the files.
* Adjust the StrLen pass to get/use the correct prototype depending on the
  TargetData::getIntPtrType() result. The result of strlen is size_t which
  could be either uint or ulong depending on the platform.
* Clean up some coding nits (cast vs. dyn_cast, remove redundant items from
  a switch, etc.)
* Implement the MemMoveOptimization as a twin of MemCpyOptimization (they
  only differ in name).

llvm-svn: 21569
2005-04-26 19:13:17 +00:00
Reid Spencer
61a18b84cc Add a test case for MemMove.ll
llvm-svn: 21568
2005-04-26 19:05:51 +00:00
Reid Spencer
abeb186371 Result of strlen is size_t which is either uint or ulong, not int.
llvm-svn: 21567
2005-04-26 19:04:46 +00:00
Chris Lattner
eb2a461acf Make interval partition print correctly, patch contributed by
Vladimir Prus!

llvm-svn: 21566
2005-04-26 14:48:28 +00:00
Chris Lattner
bd43b9db9d Fix the compile failures from last night.
llvm-svn: 21565
2005-04-26 14:40:41 +00:00
Duraid Madina
e06ef80244 constmul bugfix: multiply by 27611 was broken
llvm-svn: 21564
2005-04-26 09:42:50 +00:00
Duraid Madina
bbd0cd71a8 clean up the code! (oops) lots more cleaning left, however.
llvm-svn: 21563
2005-04-26 08:43:47 +00:00
Reid Spencer
b4f7b83dce * Merge get_GVInitializer and getCharArrayLength into a single function
named getConstantStringLength. This is the common part of StrCpy and
  StrLen optimizations and probably several others, yet to be written. It
  performs all the validity checks for looking at constant arrays that are
  supposed to be null-terminated strings and then computes the actual
  length of the string.
* Implement the MemCpyOptimization class. This just turns memcpy of 1, 2, 4
  and 8 byte data blocks that are properly aligned on those boundaries into
  a load and a store. Much more could be done here but alignment
  restrictions and lack of knowledge of the target instruction set prevent
  use from doing significantly more. That will have to be delegated to the
  code generators as they lower llvm.memcpy calls.

llvm-svn: 21562
2005-04-26 07:45:18 +00:00
Reid Spencer
89011b6f3c Add a new test case for the llvm.memcpy simplification case.
llvm-svn: 21561
2005-04-26 07:40:40 +00:00
Duraid Madina
81ebb57771 * Add code to reduce multiplies by constant integers to shifts, adds and
subtracts. This is a very rough and nasty implementation of Lefevre's
  "pattern finding" algorithm. With a few small changes though, it should
  end up beating most other methods in common use, regardless of the size
  of the constant (currently, it's often one or two shifts worse)

  TODO: rewrite it so it's not hideously ugly (this is a translation from
        perl, which doesn't help ;)
        bypass most of it for multiplies by 2^n+1
	(eventually) teach it that some combinations of shift+add are
	cheaper than others (e.g. shladd on ia64, scaled adds on alpha)
	get it to try multiple booth encodings in search of the cheapest
	routine
	make it work for negative constants

  This is hacked up as a DAG->DAG transform, so once I clean it up I hope
  it'll be pulled out of here and put somewhere else. The only thing backends
  should really have to worry about for now is where to draw the line
  between using this code vs. going ahead and doing an integer multiply
  anyway.

llvm-svn: 21560
2005-04-26 07:23:02 +00:00
Reid Spencer
76dab9a523 * Implement StrLenOptimization
* Factor out commonalities between StrLenOptimization and StrCatOptimization
* Make sure that signatures return sbyte* not void*

llvm-svn: 21559
2005-04-26 05:24:00 +00:00
Reid Spencer
3f2710e64e * Add a test case for StrLenOptimization
* Rename ExitInMain and StrCat tests so they don't have the date the
  regression was entered since they are feature tests, not regressions.

llvm-svn: 21558
2005-04-26 05:22:38 +00:00
Reid Spencer
8ee5aacc38 Incorporate feedback from Chris:
* Change signatures of OptimizeCall and ValidateCalledFunction so they are
  non-const, allowing the optimization object to be modified. This is in
  support of caching things used across multiple calls.
* Provide two functions for constructing and caching function types
* Modify the StrCatOptimization to cache Function objects for strlen and
  llvm.memcpy so it doesn't regenerate them on each call site. Make sure
  these are invalidated each time we start the pass.
* Handle both a GEP Instruction and a GEP ConstantExpr
* Add additional checks to make sure we really are dealing with an arary of
  sbyte and that all the element initializers are ConstantInt or
  ConstantExpr that reduce to ConstantInt.
* Make sure the GlobalVariable is constant!
* Don't use ConstantArray::getString as it can fail and it doesn't give us
  the right thing. We must check for null bytes in the middle of the array.
* Use llvm.memcpy instead of memcpy so we can factor alignment into it.
* Don't use void* types in signatures, replace with sbyte* instead.

llvm-svn: 21555
2005-04-26 03:26:15 +00:00
Jeff Cohen
d45bdb45c1 Add SimplyLibCalls.cpp to VC++ build
llvm-svn: 21554
2005-04-26 02:57:49 +00:00
Reid Spencer
342fe9a833 Fix RUN: line to not always pass.
llvm-svn: 21553
2005-04-26 02:33:25 +00:00
Chris Lattner
cfa7ddd6e2 Fold (X > -1) | (Y > -1) --> (X&Y > -1)
llvm-svn: 21552
2005-04-26 01:18:33 +00:00
Reid Spencer
fe91dfec91 Changes due to code review and new implementation:
* Don't use std::string for the function names, const char* will suffice
* Allow each CallOptimizer to validate the function signature before
  doing anything
* Repeatedly loop over the functions until an iteration produces
  no more optimizations. This allows one optimization to insert a
  call that is optimized by another optimization.
* Implement the ConstantArray portion of the StrCatOptimization
* Provide a template for the MemCpyOptimization
* Make ExitInMainOptimization split the block, not delete everything
  after the return instruction.
(This covers revision 1.3 and 1.4, as the 1.3 comments were botched)

llvm-svn: 21548
2005-04-25 21:20:38 +00:00
Chris Lattner
f806459d90 implement some more logical compares with constants, so that:
int foo1(int x, int y) {
  int t1 = x >= 0;
  int t2 = y >= 0;
  return t1 & t2;
}
int foo2(int x, int y) {
  int t1 = x == -1;
  int t2 = y == -1;
  return t1 & t2;
}

produces:

_foo1:
        or r2, r4, r3
        srwi r2, r2, 31
        xori r3, r2, 1
        blr
_foo2:
        and r2, r4, r3
        addic r2, r2, 1
        li r2, 0
        addze r3, r2
        blr

instead of:

_foo1:
        srwi r2, r4, 31
        xori r2, r2, 1
        srwi r3, r3, 31
        xori r3, r3, 1
        and r3, r2, r3
        blr
_foo2:
        addic r2, r4, 1
        li r2, 0
        addze r2, r2
        addic r3, r3, 1
        li r3, 0
        addze r3, r3
        and r3, r2, r3
        blr

llvm-svn: 21547
2005-04-25 21:20:28 +00:00
Reid Spencer
f2534c7291 Lots of changes based on review and new functionality:
* Use a 

llvm-svn: 21546
2005-04-25 21:11:48 +00:00
Reid Spencer
172e9155c1 Update the test case to handle a few more (degenerate) cases and remove
the restriction that it is an XFAIL because it now passes.

llvm-svn: 21545
2005-04-25 21:08:34 +00:00
Chris Lattner
d373ff64aa Codegen x < 0 | y < 0 as (x|y) < 0. This allows us to compile this to:
_foo:
        or r2, r4, r3
        srwi r3, r2, 31
        blr

instead of:

_foo:
        srwi r2, r4, 31
        srwi r3, r3, 31
        or r3, r2, r3
        blr

llvm-svn: 21544
2005-04-25 21:03:25 +00:00
Chris Lattner
e093c6f565 Make dominates(A,B) work with post dominators. Patch contributed by
Naveen Neelakantam, thanks!

llvm-svn: 21543
2005-04-25 20:50:33 +00:00
Tanya Lattner
af0ac2744e Added question about turning off all optimizations. I think this has been asked once or twice.
llvm-svn: 21542
2005-04-25 20:36:56 +00:00
Chris Lattner
a21bf8d1be implement getelementptr.ll:test10
llvm-svn: 21541
2005-04-25 20:17:30 +00:00
Chris Lattner
20621b1e94 rename fn
llvm-svn: 21540
2005-04-25 20:17:16 +00:00
Chris Lattner
e680ee2a48 new testcase
llvm-svn: 21539
2005-04-25 20:17:00 +00:00
Chris Lattner
ecac782786 Correctly handle global-argument aliases induced in main
llvm-svn: 21537
2005-04-25 19:16:31 +00:00
Chris Lattner
5965359d8f Don't mess up SCC traversal when a node has null edges out of it.
llvm-svn: 21536
2005-04-25 19:16:17 +00:00
Chris Lattner
37b6b097ff document 'opaque' types
llvm-svn: 21535
2005-04-25 17:34:15 +00:00
Chris Lattner
d1039cc581 Add feedback from Vikram
llvm-svn: 21534
2005-04-25 15:47:57 +00:00
Reid Spencer
478d3b930a Make sure the target buffer is null terminated so we don't blow up
strcat when its called.

llvm-svn: 21533
2005-04-25 15:40:35 +00:00
Reid Spencer
20b0e43e1f A test case for testing the StrCatOptimizer, currently XFAILed everywhere.
llvm-svn: 21532
2005-04-25 07:29:30 +00:00
Reid Spencer
9bbaa2ab7f Post-Review Cleanup:
* Fix comments at top of file
* Change algorithm for running the call optimizations from n*n to something
  closer to n.
* Use a hash_map to store and lookup the optimizations since there will
  eventually (or potentially) be a large number of them. This gets lookup
  based on the name of the function to O(1). Each CallOptimizer now has a
  std::string member named func_name that tracks the name of the function
  that it applies to. It is this string that is entered into the hash_map
  for fast comparison against the function names encountered in the module.
* Cleanup some style issues pertaining to iterator invalidation
* Don't pass the Function pointer to the OptimizeCall function because if
  the optimization needs it, it can get it from the CallInst passed in.
* Add the skeleton for a new CallOptimizer, StrCatOptimizer which will
  eventually replace strcat's of constant strings with direct copies.

llvm-svn: 21526
2005-04-25 03:59:26 +00:00
Reid Spencer
23423346f8 Use the %name rather than the "name" format so those familiar with the
llvm-dis output don't go blind.

llvm-svn: 21525
2005-04-25 03:18:19 +00:00
Reid Spencer
ff7b16c1d6 Shut GCC 4.0 up about classes that have virtual functions but a non-virtual
destructor. Just add the do-nothing virtual destructor.

llvm-svn: 21524
2005-04-25 02:55:55 +00:00
Reid Spencer
0c2d046aa4 Declare a function to create the SimplifyLibCalls pass.
llvm-svn: 21523
2005-04-25 02:54:00 +00:00
Reid Spencer
39a762d149 A new pass to provide specific optimizations for certain well-known library
calls. The pass visits all external functions in the module and determines
if such function calls can be optimized. The optimizations are specific to
the library calls involved. This initial version only optimizes calls to
exit(3) when they occur in main(): it changes them to ret instructions.

llvm-svn: 21522
2005-04-25 02:53:12 +00:00
Reid Spencer
985f484263 A test case for the the ExitInMain libcall simplification.
llvm-svn: 21521
2005-04-25 02:50:08 +00:00
Reid Spencer
8edc8beacf Older compilers won't like the inline virtual destructor in the header file
so we put the destructor in Pass.cpp and make it non-inline.

llvm-svn: 21520
2005-04-25 01:01:35 +00:00
Chris Lattner
fc104de06d fix some bugs
llvm-svn: 21515
2005-04-25 00:38:52 +00:00
Reid Spencer
756d049c06 Fix a thinko in the documentation of the splitBasicBlock method. The branch
instruction is added to the original block, not the new block.

llvm-svn: 21513
2005-04-25 00:31:53 +00:00
Reid Spencer
9c47b25868 Shut GCC 4.0 up about classes with virtual functions but no virtual
destructor.

llvm-svn: 21510
2005-04-24 22:27:20 +00:00
Reid Spencer
ad750a80eb Shut GCC 4.0 up when it complains about classes with virtual functions that
don't have virtual destructors.

llvm-svn: 21507
2005-04-24 22:20:32 +00:00
Reid Spencer
4da978466d Make this readable for newbies and those who can only understand one set of
grammar rules for the English language.

llvm-svn: 21503
2005-04-24 20:56:18 +00:00
Misha Brukman
6818b33096 extract has been renamed to llvm-extract to avoid conflicting with another tool
llvm-svn: 21501
2005-04-24 17:46:58 +00:00
Chris Lattner
2f1457fd83 Eliminate cases where we could << by 64, which is undefined in C.
llvm-svn: 21500
2005-04-24 17:46:05 +00:00
Misha Brukman
ca1e0c6ae0 There are still uses for spaces in Makefiles -- to make text line up together,
regardless of the tab size/stop settings on the developer side

llvm-svn: 21499
2005-04-24 17:43:41 +00:00
Misha Brukman
e22594f3d7 extract has been renamed to llvm-extract to avoid conflicting with another tool
llvm-svn: 21498
2005-04-24 17:36:05 +00:00
Misha Brukman
3e9634eaa0 elisp code to help with LLVM code standards compliance
llvm-svn: 21497
2005-04-24 17:09:19 +00:00
Misha Brukman
831ad84eea .vimrc file to aid in LLVM coding standards conformance
llvm-svn: 21496
2005-04-24 17:05:04 +00:00
Chris Lattner
d6f636a340 Implement xor.ll:test21: select (not C), A, B -> select C, B, A
llvm-svn: 21495
2005-04-24 07:30:14 +00:00
Chris Lattner
b57d040464 Test that xor/select are folded into a select with inverted operands.
llvm-svn: 21494
2005-04-24 07:28:53 +00:00
Chris Lattner
2c7d177d25 Allow these methods to take a generic Value* to simplify clients. Use
const_cast instead of c casts.

llvm-svn: 21493
2005-04-24 07:28:37 +00:00
Chris Lattner
b220952aca allow these to take a generic Value*
llvm-svn: 21492
2005-04-24 07:28:04 +00:00
Chris Lattner
d1f46d3bf9 Use getPrimitiveSizeInBits() instead of getPrimitiveSize()*8
Completely rework the 'setcc (cast x to larger), y' code.  This code has
the advantage of implementing setcc.ll:test19 (being more general than
the previous code) and being correct in all cases.

This allows us to unxfail 2004-11-27-SetCCForCastLargerAndConstant.ll,
and close PR454.

llvm-svn: 21491
2005-04-24 06:59:08 +00:00
Chris Lattner
0de0638522 unxfail this.
llvm-svn: 21490
2005-04-24 06:55:40 +00:00
Chris Lattner
624d5cb006 add a new testcase which occurs in 181.mcf
llvm-svn: 21489
2005-04-24 06:55:33 +00:00
Misha Brukman
1c8d93b08f * The aesthetic police is on patrol!!...
* ... but it wasn't so busy as to not smell the roses and doxygenify comments

llvm-svn: 21487
2005-04-23 22:35:26 +00:00
Chris Lattner
396890d3ac Add a helper method
llvm-svn: 21486
2005-04-23 22:20:22 +00:00
Chris Lattner
8a878ccb25 Fix a bug in my previous checkin
llvm-svn: 21485
2005-04-23 22:01:39 +00:00
Chris Lattner
2908bc1e7a This file is never referenced
llvm-svn: 21484
2005-04-23 22:00:26 +00:00
Chris Lattner
6263766133 Add a method, remove last use of Type.def
llvm-svn: 21483
2005-04-23 22:00:09 +00:00
Chris Lattner
816394d7ad add a method, remove a dead #include
llvm-svn: 21482
2005-04-23 21:59:42 +00:00
Chris Lattner
6226f941b0 Types.def is going away
llvm-svn: 21481
2005-04-23 21:59:11 +00:00
Jeff Cohen
82639853c0 Eliminate tabs and trailing spaces
llvm-svn: 21480
2005-04-23 21:38:35 +00:00
Jeff Cohen
8047f13a88 Eliminate tabs and trailing spaces
llvm-svn: 21479
2005-04-23 21:26:11 +00:00
Chris Lattner
4bbf66b7a2 Propagate eq sets through the bu graphs to the cbu and eq graphs, fixing
a crash of the sfv on 188.ammp

llvm-svn: 21478
2005-04-23 21:11:05 +00:00
Chris Lattner
fdfb25a9e1 add a bunch of documentation about the LLVM type resolution machinery
llvm-svn: 21475
2005-04-23 17:27:36 +00:00
Reid Spencer
7fa89cfc9b Make the CBackend actually get included in llc by using USEDLIBS instead of
USEDLIB as the variable to which "CBackend" is appended. The surrounding
if clause is safe because currently the configure script ensures that the
CBackend target is always added to TARGETS_TO_BUILD. By using a non-hard
coded construct in the makefile, we gain uniformity and the ability to
change the default set of targets by only changing the configure script.

llvm-svn: 21474
2005-04-23 17:24:33 +00:00
Chris Lattner
c6ce71d434 make an advanced topics section, move symtab to it
llvm-svn: 21473
2005-04-23 16:10:52 +00:00
Chris Lattner
7eae28b9d9 This is not needed
llvm-svn: 21472
2005-04-23 16:00:27 +00:00
Chris Lattner
c5ad1ca942 add a search box for the documentation
llvm-svn: 21471
2005-04-23 15:55:18 +00:00
Chris Lattner
77c32c34d7 Generalize the setcc -> PHI and Select folding optimizations to work with
any constant RHS, not just a constant integer RHS.  This implements
select.ll:test17

llvm-svn: 21470
2005-04-23 15:31:55 +00:00
Chris Lattner
64a8a7f9b7 add a new testcase
llvm-svn: 21469
2005-04-23 15:31:03 +00:00
Chris Lattner
01c81ab706 Always enable the C backend. This fixes a *vast* number of failures on the
testers last night, as llc was not getting the cbe linked in.

llvm-svn: 21468
2005-04-23 14:36:22 +00:00
Alkis Evlogimenos
0166db6529 Add method to return the type this type will be promoted to if it is
passed through a variable argument function.

llvm-svn: 21462
2005-04-23 00:11:21 +00:00
Reid Spencer
51efcefa49 Mention the --enable-targets= option to configure.
llvm-svn: 21459
2005-04-22 20:27:33 +00:00
Misha Brukman
7937b07940 * Order #includes as per style guide
* Combine multiple ``std::cerr <<'' statements into one for simplicity

llvm-svn: 21458
2005-04-22 19:13:22 +00:00
Misha Brukman
fd8c2265fa Convert tabs to spaces
llvm-svn: 21457
2005-04-22 18:06:01 +00:00
Misha Brukman
36c6bc1bf4 Hyphenate the adjective `n-bit' when used to describe values and processors
llvm-svn: 21456
2005-04-22 18:02:52 +00:00
Misha Brukman
d5da38c9aa Build the `Skeleton' target when building "all" targets
llvm-svn: 21455
2005-04-22 18:00:34 +00:00
Reid Spencer
1e195bdd41 Document the --enable-targets= feature of the configure script.
llvm-svn: 21454
2005-04-22 17:58:03 +00:00
Alkis Evlogimenos
7afc9558e0 Silence gcc-4.0.0 warnings.
llvm-svn: 21453
2005-04-22 17:56:01 +00:00
Misha Brukman
e73e76dc42 Convert tabs to spaces
llvm-svn: 21452
2005-04-22 17:54:37 +00:00
Reid Spencer
948f453254 Don't always build CBackend and Skeleton. Make use of the TARGETS_TO_BUILD
parameter instead which will correctly list the set of targets to be built.

llvm-svn: 21451
2005-04-22 17:32:05 +00:00
Reid Spencer
e4481c7c82 Implement the --enable-targets= feature of the configure script. The make
variable TARGETS_TO_BUILD is used to determine which targets in lib/Target
are built and which libraries are linked into llc. This effectively
implements the feature. One item remains: disabling targets in the dejagnu
test suite.

llvm-svn: 21450
2005-04-22 17:20:11 +00:00
Reid Spencer
ce9612b23c Two changes:
1. Get rid of TOOLLINKOPTS as it is a hold over from llvm-test and only
   used to communicate additional libraries to the linker. The *standard*
   way to do that is with the LIBS variable which this change supports.

2. Allow the TARGETS_TO_BUILD variable to be set from the configuration
   substitution. This is the result of the --enable-target= parameter to
   the configure script.

llvm-svn: 21449
2005-04-22 17:14:14 +00:00
Reid Spencer
90dd65e4a7 Make sure the CBackend is always a target that is built.
llvm-svn: 21448
2005-04-22 17:06:18 +00:00
Reid Spencer
e482ca8bfa Consolidate the target selection options into a single option,
--enable-target which can take values "all", "host-only" or a comma
separated list of target names (alpha,ia64,powerpc,skeleton,sparc,x86)

llvm-svn: 21447
2005-04-22 17:02:18 +00:00
Andrew Lenharth
8f4081a8c9 keep track of max depth stats
llvm-svn: 21446
2005-04-22 13:35:18 +00:00
Reid Spencer
4742804864 First step in avoiding compilation/usage of non-relevant targets. New
options have been added to the configure script that control which targets
will be used. The options are:

--enable-target-this (default=disabled)
  This will specify that the target corresponding to the build host is
  the target that will be compiled/used. You can't use this with any of
  the other options (they'll be ignored). This is what most people want.

--disable-target-x86 (default=enabled)
  This will prevent the X86 target(s) from being compiled/used.

--disable-target-sparc (default=enabled)
  This will prevent both SparcV8 and SparcV9 from being compiled/used.

--disable-target-powerpc (default=enabled)
  This will prevent the PowerPC target from being compiled/used.

--disable-target-alpha (default=enabled)
  This will prevent the Alpha target from being compiled/used.

--disable-target-ia64 (default=enabled)
  This will prevent the IA64 target from being compiled/used.

Note that without any of these options, the default behavior is to build
all targets, as is the current practice.

All these options do is set up the substititution variable TARGETS_TO_BUILD
which contains the targets that should be compiled/used. The variable is
intended to be used in the makefiles. Those changes will come later.

llvm-svn: 21445
2005-04-22 07:27:28 +00:00
Tanya Lattner
42ed14860b Updated dependence analyzer. Fixed numerous bugs. Same stage scheduling, etc.
llvm-svn: 21444
2005-04-22 06:32:48 +00:00
Chris Lattner
e25cfaee55 Malloc/Free have mod/ref effects. Do not allow CSE of function calls that
call malloc/free.  This fixes PR555.

llvm-svn: 21443
2005-04-22 05:36:59 +00:00
Chris Lattner
16431f7b3c remove 'another common example', which doesn't work with VC++, and indent
another example properly

llvm-svn: 21442
2005-04-22 04:49:59 +00:00
Jeff Cohen
88e7b7288a Eliminate tabs and trailing spaces
llvm-svn: 21441
2005-04-22 04:13:13 +00:00
Misha Brukman
5191b4b2d0 Convert tabs to spaces
llvm-svn: 21440
2005-04-22 04:08:30 +00:00
Misha Brukman
774511633d Convert tabs to spaces
llvm-svn: 21439
2005-04-22 04:01:18 +00:00
Misha Brukman
1fabffbf37 Convert tabs to spaces
llvm-svn: 21438
2005-04-22 03:46:24 +00:00
Misha Brukman
4b45ec0be0 Convert tabs to spaces
llvm-svn: 21437
2005-04-22 03:35:49 +00:00
Misha Brukman
204572af9d Convert tabs to spaces
llvm-svn: 21436
2005-04-22 03:27:20 +00:00
Misha Brukman
8c0ca76517 Convert tabs to spaces
llvm-svn: 21433
2005-04-22 03:18:56 +00:00
Reid Spencer
a3d4e04da8 Add the RUN: prefix to the start of the run line so this test doesn't fail.
BTW .. isn't the date on this funky? We haven't reachec 2005-05-09 yet???

llvm-svn: 21432
2005-04-22 02:49:25 +00:00
Reid Spencer
7275e3fb31 Change some old-style casts to C++ style casts to avoid warnings in XPS
compilation. This change has been waiting in the wings for a long time but
since Misha just did a global change, I figured now was the time to commit
it.

llvm-svn: 21431
2005-04-22 02:31:56 +00:00
Reid Spencer
d6312210d1 There is no =head3. Convert to =head2.
llvm-svn: 21430
2005-04-22 02:16:19 +00:00
Reid Spencer
84f3911b09 Correct the documentation to match the program.
llvm-svn: 21429
2005-04-22 02:12:41 +00:00
Misha Brukman
650ba8eb56 Remove trailing whitespace
llvm-svn: 21428
2005-04-22 00:00:37 +00:00
Misha Brukman
b1c9317bb4 Remove trailing whitespace
llvm-svn: 21427
2005-04-21 23:48:37 +00:00
Misha Brukman
c88330ad13 * Remove trailing whitespace
* Convert tabs to spaces

llvm-svn: 21426
2005-04-21 23:38:14 +00:00
Misha Brukman
b440243e94 Remove trailing whitespace
llvm-svn: 21425
2005-04-21 23:30:14 +00:00
Misha Brukman
89b8c8d215 Remove trailing whitespace
llvm-svn: 21424
2005-04-21 23:13:11 +00:00
Misha Brukman
10468d8a3c Remove trailing whitespace
llvm-svn: 21422
2005-04-21 22:55:34 +00:00
Misha Brukman
91fb9ab60b * Remove trailing whitespace
* Convert tabs to spaces

llvm-svn: 21421
2005-04-21 22:43:08 +00:00
Misha Brukman
835702a094 Remove trailing whitespace
llvm-svn: 21420
2005-04-21 22:36:52 +00:00
Misha Brukman
b47d28bfe8 * Remove trailing whitespace
* Convert tabs to spaces

llvm-svn: 21418
2005-04-21 21:48:46 +00:00
Misha Brukman
2ecc34dd3c Remove trailing whitespace
llvm-svn: 21417
2005-04-21 21:44:41 +00:00
Misha Brukman
01808caded Remove trailing whitespace
llvm-svn: 21416
2005-04-21 21:13:18 +00:00
Misha Brukman
13f332cd3f * Remove trailing whitespace
* Convert tabs to spaces

llvm-svn: 21415
2005-04-21 21:10:11 +00:00
Chris Lattner
95e43ae162 Check for eqv matching
llvm-svn: 21414
2005-04-21 21:10:07 +00:00
Chris Lattner
3590ef1164 Match another form of eqv
llvm-svn: 21413
2005-04-21 21:09:11 +00:00
Misha Brukman
df586aa20e Remove trailing whitespace
llvm-svn: 21412
2005-04-21 20:59:05 +00:00
Misha Brukman
95aab4ef6d Remove trailing whitespace
llvm-svn: 21411
2005-04-21 20:48:15 +00:00
Chris Lattner
5c9ef1ba2d this passes on darwin
llvm-svn: 21410
2005-04-21 20:48:08 +00:00
Misha Brukman
01230b24ae Remove trailing whitespace
llvm-svn: 21409
2005-04-21 20:39:54 +00:00
Misha Brukman
01cada8797 Remove trailing whitespace
llvm-svn: 21408
2005-04-21 20:19:05 +00:00
Chris Lattner
486a1ec909 Handle stores of global address as stores of immediates. Instead of:
test1:
        movl $N, %eax
        movl %eax, G
        ret

emit:

test1:
        movl $N, G
        ret

llvm-svn: 21407
2005-04-21 19:11:03 +00:00
Chris Lattner
adcfc1748b Handle (store &GV -> mem) as a store immediate. This often occurs for
printf format strings and other stuff.  Instead of generating this:

        movl $l1__2E_str_1, %eax
        movl %eax, (%esp)

we now emit:

        movl $l1__2E_str_1, (%esp)

llvm-svn: 21406
2005-04-21 19:03:24 +00:00
Reid Spencer
c8b5d60937 Use the actual uid/gid for defaulting the fields in the archive.
llvm-svn: 21405
2005-04-21 17:49:57 +00:00
Chris Lattner
a3159af703 Fix a bug where we would not promote calls to invokes if they occured in
the same block as the setjmp.  Thanks to Greg Pettyjohn for noticing this!

llvm-svn: 21403
2005-04-21 16:46:46 +00:00
Reid Spencer
ce7ce1628f Eliminate calls to system dependent function getuid by using
the newly implemented sys::Process::GetCurrentUserId function. Replace
similarly for getgid.

llvm-svn: 21402
2005-04-21 16:15:19 +00:00
Reid Spencer
2d45e25125 Provide an implementation of the GetCurrentUserId and GetCurrentGroupId
methods that were recently added to the interface.

llvm-svn: 21401
2005-04-21 16:12:57 +00:00
Reid Spencer
5e92ead30d Add two new methods for getting the User Id and Group Id values for the
current process.

llvm-svn: 21400
2005-04-21 16:12:04 +00:00
Chris Lattner
c346bf59ee Add doxygen comments, patch contributed by Evan Jones.
llvm-svn: 21397
2005-04-21 16:10:03 +00:00
Chris Lattner
4c5c96f35f add support for taking and resolving the address of free.
llvm-svn: 21396
2005-04-21 16:09:43 +00:00
Chris Lattner
631ee94316 add support for taking the address of free.
llvm-svn: 21395
2005-04-21 16:08:59 +00:00
Chris Lattner
954c64d532 Improve doxygen, from part of Evan's patch that didn't apply.
llvm-svn: 21394
2005-04-21 16:06:03 +00:00
Chris Lattner
7ceb081f3f Improve doxygen documentation, patch contributed by Evan Jones!
llvm-svn: 21393
2005-04-21 16:04:49 +00:00
Chris Lattner
f6302441f0 Improve and elimination. On PPC, for:
bool %test(int %X) {
        %Y = and int %X, 8
        %Z = setne int %Y, 0
        ret bool %Z
}

we now generate this:

        rlwinm r2, r3, 0, 28, 28
        srwi r3, r2, 3

instead of this:

        rlwinm r2, r3, 0, 28, 28
        srwi r2, r2, 3
        rlwinm r3, r2, 0, 31, 31

I'll leave it to Nate to get it down to one instruction. :)

---------------------------------------------------------------------

llvm-svn: 21391
2005-04-21 06:28:15 +00:00
Chris Lattner
ab1ed77570 Fold (x & 8) != 0 and (x & 8) == 8 into (x & 8) >> 3.
This turns this PPC code:

        rlwinm r2, r3, 0, 28, 28
        cmpwi cr7, r2, 8
        mfcr r2
        rlwinm r3, r2, 31, 31, 31

into this:

        rlwinm r2, r3, 0, 28, 28
        srwi r2, r2, 3
        rlwinm r3, r2, 0, 31, 31

Next up, nuking the extra and.

llvm-svn: 21390
2005-04-21 06:12:41 +00:00
Chris Lattner
374e659466 Instcombine this:
%shortcirc_val = select bool %tmp.1, bool true, bool %tmp.4             ; <bool> [#uses=1]
        %tmp.6 = cast bool %shortcirc_val to int                ; <int> [#uses=1]

into this:

        %shortcirc_val = or bool %tmp.1, %tmp.4         ; <bool> [#uses=1]
        %tmp.6 = cast bool %shortcirc_val to int                ; <int> [#uses=1]

not this:

        %tmp.4.cast = cast bool %tmp.4 to int           ; <int> [#uses=1]
        %tmp.6 = select bool %tmp.1, int 1, int %tmp.4.cast             ; <int> [#uses=1]

llvm-svn: 21389
2005-04-21 05:43:13 +00:00
Chris Lattner
b38b443b15 Teach simplifycfg that setcc is cheap and non-trapping, so that it can
convert this:

        %tmp.1 = seteq int %i, 0                ; <bool> [#uses=1]
        br bool %tmp.1, label %shortcirc_done, label %shortcirc_next

shortcirc_next:         ; preds = %entry
        %tmp.4 = seteq int %j, 0                ; <bool> [#uses=1]
        br label %shortcirc_done

shortcirc_done:         ; preds = %shortcirc_next, %entry
        %shortcirc_val = phi bool [ %tmp.4, %shortcirc_next ], [ true, %entry ]         ; <bool> [#uses=1]

to this:
        %tmp.1 = seteq int %i, 0                ; <bool> [#uses=1]
        %tmp.4 = seteq int %j, 0                ; <bool> [#uses=1]
        %shortcirc_val = select bool %tmp.1, bool true, bool %tmp.4             ; <bool> [#uses=1]

... which is later simplified by instcombine into an or.

llvm-svn: 21388
2005-04-21 05:31:13 +00:00
Chris Lattner
b7848974cd Fix some broken links, taking care of PR554
llvm-svn: 21387
2005-04-21 04:53:58 +00:00
Chris Lattner
0727518f81 update to match build changes.
llvm-svn: 21386
2005-04-21 04:52:37 +00:00
Reid Spencer
8424ba373e For Bug 543:
Standardize the error messages to be in "path: what failed: why" format.
Also attempt to use the correct errno to ThrowErrno in situations where
the errno value is erased by subsequent system calls.

llvm-svn: 21385
2005-04-21 02:50:10 +00:00
Reid Spencer
b02566dc1c For Bug 543:
Allow the ThrowErrno function to optionally accept an error number
parameter so that callers can specify the error number to be used.

llvm-svn: 21384
2005-04-21 02:30:32 +00:00
Misha Brukman
2f72bafb60 Remove trailing whitespace at the end of lines
llvm-svn: 21380
2005-04-20 16:42:34 +00:00
Misha Brukman
ea548c0cb1 Remove trailing whitespace, patch by Markus Oberhumer.
llvm-svn: 21379
2005-04-20 16:05:03 +00:00
Misha Brukman
5e7bac21d5 Add FIXME by Markus Oberhumer from bug 545: not checking for "." in $PATH may
result in returning executable files that won't be runnable.

llvm-svn: 21378
2005-04-20 15:42:11 +00:00
Misha Brukman
a9a8c1b65b Do not mark directories as `executable', we only want program files
Patch by Markus Oberhumer.

llvm-svn: 21377
2005-04-20 15:33:22 +00:00
Misha Brukman
ee6770f1a3 #include system headers after all LLVM headers
llvm-svn: 21374
2005-04-20 04:51:29 +00:00
Misha Brukman
17092bd0a4 Eliminate trailing spaces at end-of-line
llvm-svn: 21372
2005-04-20 04:08:35 +00:00
Misha Brukman
3f4fe46796 Consistently eschew space between *' or &' and function argument name
llvm-svn: 21371
2005-04-20 04:07:47 +00:00
Misha Brukman
1001aea4d3 Ignore dangling symlinks in getDirectoryContents()
Thanks to Markus Oberhumer for the patch!

llvm-svn: 21370
2005-04-20 04:04:07 +00:00
Misha Brukman
8cd50bf269 Initialize fields mode, uid, and gid.
Patch by Markus Oberhumer.  Thanks!

llvm-svn: 21369
2005-04-20 03:55:35 +00:00
Misha Brukman
bebcaeb816 Align comments together for consistency
llvm-svn: 21368
2005-04-20 03:52:59 +00:00
Misha Brukman
64a8c3ed91 * Print commands as we execute them with `-v'
* Add option `-save-temps'
Patch contributed by Markus Oberhumer.

llvm-svn: 21367
2005-04-20 03:22:18 +00:00
Chris Lattner
8cb10a1775 Wrap some long lines.
Make IPSCCP strip off dead constant exprs that are using functions, making
them appear as though their address is taken.  This allows us to propagate
some more pool descriptors, lowering the overhead of pool alloc.

llvm-svn: 21363
2005-04-19 19:16:19 +00:00
Chris Lattner
14db4a2895 ignore generated files
llvm-svn: 21362
2005-04-19 15:34:36 +00:00
Chris Lattner
b17483028f fix bogus warning
llvm-svn: 21361
2005-04-19 15:32:30 +00:00
Chris Lattner
07ad98dbe2 fix PR549
llvm-svn: 21360
2005-04-19 15:27:29 +00:00
Chris Lattner
181c818373 Bug fixed
llvm-svn: 21355
2005-04-19 06:08:04 +00:00
Chris Lattner
5c219469a0 Eliminate a broken transformation, fixing PR548
llvm-svn: 21354
2005-04-19 06:04:18 +00:00
Chris Lattner
53c40624f9 Add completely untested support for mtcrf/mfcrf encoding
llvm-svn: 21353
2005-04-19 05:41:52 +00:00
Chris Lattner
baa9be572b switch over the rest of the formats that use RC to use isDOT
llvm-svn: 21352
2005-04-19 05:21:30 +00:00
Chris Lattner
f9172e14c9 Convert the XForm instrs and XSForm instruction over to use isDOT
llvm-svn: 21351
2005-04-19 05:15:18 +00:00
Chris Lattner
5b78da4571 Now that the ppc64 and vmx operands of I are always 0, forward substitute
them away.

llvm-svn: 21350
2005-04-19 05:05:22 +00:00
Chris Lattner
116a9e5a34 convert over bform and iform instructions
llvm-svn: 21349
2005-04-19 05:00:59 +00:00
Chris Lattner
b2367e398e Convert over DForm and DSForm instructions
llvm-svn: 21348
2005-04-19 04:59:28 +00:00
Chris Lattner
15709c2c33 Convert XLForm and XForm instructions over to use PPC64 when appropriate.
llvm-svn: 21347
2005-04-19 04:51:30 +00:00
Chris Lattner
d790d22f22 Convert XO XS and XFX forms to use isPPC64
llvm-svn: 21346
2005-04-19 04:40:07 +00:00
Chris Lattner
c7cb8c77fb Turn PPC64 and VMX into classes that can be added to instructions instead of
bits that must be passed up the inheritance hierarchy.  Convert MForm and AForm
instructions over

llvm-svn: 21345
2005-04-19 04:32:54 +00:00
Chris Lattner
ef94374a1c Major change to tblgen: instead of resolving values every time a class is
finished up, only resolve fully when the def is defined.  This allows things
to be changed and all uses to be propagated through.  This implements
TableGen/LazyChange.td and fixes TemplateArgRename.td in the process.

None of the .td files used in LLVM backends are changed at all by this
patch.

llvm-svn: 21344
2005-04-19 03:36:21 +00:00
Chris Lattner
ab77740715 New testcase for a changing values late and allowing them to propagate
llvm-svn: 21343
2005-04-19 03:34:58 +00:00
Chris Lattner
d90d566dee Make this significantly harder
llvm-svn: 21342
2005-04-19 02:58:57 +00:00
Chris Lattner
17bd7c5a88 Add a real run line
llvm-svn: 21341
2005-04-19 02:53:26 +00:00
Chris Lattner
c00f712fc0 fix this testcase
llvm-svn: 21340
2005-04-19 02:52:04 +00:00
Chris Lattner
2b76da7d1f new testcase
llvm-svn: 21339
2005-04-19 02:26:23 +00:00
Chris Lattner
f2fab50974 add a run line
llvm-svn: 21338
2005-04-19 01:37:24 +00:00
Chris Lattner
ed8335e35b Tell dj to run the tests in this directory
llvm-svn: 21337
2005-04-19 01:36:41 +00:00
Chris Lattner
3ff0e11294 implementing shifting of literal integers
llvm-svn: 21336
2005-04-19 01:17:35 +00:00
Chris Lattner
101fc501d0 Add initial lexer and parser support for shifting values. Every use of this
will lead to it being rejected though.

llvm-svn: 21335
2005-04-19 01:11:03 +00:00
Nate Begeman
2331c061ee Next round of PPC CR optimizations. For the following code:
int %bar(float %a, float %b, float %c, float %d) {
entry:
    %tmp.1 = setlt float %a, %d
    %tmp.2 = setlt float %b, %d
    %or = or bool %tmp.1, %tmp.2
    %tmp.3 = setgt float %c, %d
    %tmp.4 = or bool %or, %tmp.3
    %tmp.5 = and bool %tmp.4, true
    %retval = cast bool %tmp.5 to int
    ret int %retval
}

We now emit:

_bar:
.LBB_bar_0:     ; entry
        fcmpu cr0, f1, f4
        fcmpu cr1, f2, f4
        cror 0, 0, 4
        fcmpu cr1, f3, f4
        cror 28, 0, 5
        mfcr r2
        rlwinm r3, r2, 29, 31, 31
        blr

Instead of:

_bar:
.LBB_bar_0:     ; entry
        fcmpu cr7, f1, f4
        mfcr r2
        rlwinm r2, r2, 29, 31, 31
        fcmpu cr7, f2, f4
        mfcr r3
        rlwinm r3, r3, 29, 31, 31
        or r2, r2, r3
        fcmpu cr7, f3, f4
        mfcr r3
        rlwinm r3, r3, 30, 31, 31
        or r3, r2, r3
        blr

llvm-svn: 21321
2005-04-18 07:48:09 +00:00
Chris Lattner
ee84413730 silence a bogus warning
llvm-svn: 21320
2005-04-18 05:26:21 +00:00
Chris Lattner
b61ecb5875 Fold setcc of MVT::i1 operands into logical operations
llvm-svn: 21319
2005-04-18 04:48:12 +00:00
Chris Lattner
6d40fd01fe Another minor simplification: handle setcc (zero_extend x), c -> setcc(x, c')
llvm-svn: 21318
2005-04-18 04:30:45 +00:00
Chris Lattner
868d473009 Another simple xform
llvm-svn: 21317
2005-04-18 04:11:19 +00:00
Chris Lattner
bd22d83d15 Fold:
// (X != 0) | (Y != 0) -> (X|Y != 0)
        // (X == 0) & (Y == 0) -> (X|Y == 0)

Compiling this:

int %bar(int %a, int %b) {
        entry:
        %tmp.1 = setne int %a, 0
        %tmp.2 = setne int %b, 0
        %tmp.3 = or bool %tmp.1, %tmp.2
        %retval = cast bool %tmp.3 to int
        ret int %retval
        }

to this:

_bar:
        or r2, r3, r4
        addic r3, r2, -1
        subfe r3, r3, r2
        blr

instead of:

_bar:
        addic r2, r3, -1
        subfe r2, r2, r3
        addic r3, r4, -1
        subfe r3, r3, r4
        or r3, r2, r3
        blr

llvm-svn: 21316
2005-04-18 03:59:53 +00:00
Chris Lattner
d929f8bcd3 Make the AND elimination operation recursive and significantly more powerful,
eliminating an and for Nate's testcase:

int %bar(int %a, int %b) {
        entry:
        %tmp.1 = setne int %a, 0
        %tmp.2 = setne int %b, 0
        %tmp.3 = or bool %tmp.1, %tmp.2
        %retval = cast bool %tmp.3 to int
        ret int %retval
        }

generating:

_bar:
        addic r2, r3, -1
        subfe r2, r2, r3
        addic r3, r4, -1
        subfe r3, r3, r4
        or r3, r2, r3
        blr

instead of:

_bar:
        addic r2, r3, -1
        subfe r2, r2, r3
        addic r3, r4, -1
        subfe r3, r3, r4
        or r2, r2, r3
        rlwinm r3, r2, 0, 31, 31
        blr

llvm-svn: 21315
2005-04-18 03:48:41 +00:00
Nate Begeman
602a45f415 Change codegen for setcc to read the bit directly out of the condition
register.  Added support in the .td file for the g5-specific variant
  of cr -> gpr moves that executes faster, but we currently don't
  generate it.

llvm-svn: 21314
2005-04-18 02:43:24 +00:00
Chris Lattner
ed5189da51 Add support for targets that require stubs for external functions.
llvm-svn: 21313
2005-04-18 01:44:27 +00:00
Chris Lattner
f281f791b5 Handle ExternalSymbol operands in the PPC JIT
llvm-svn: 21312
2005-04-18 00:46:10 +00:00
Nate Begeman
f24225d4d7 Update dejagnu tests to use the new pattern isel flag
llvm-svn: 21311
2005-04-16 04:25:48 +00:00
Jeff Cohen
df4f480498 Add CondPropagate.cpp to VC++ Transforms project
llvm-svn: 21310
2005-04-16 02:51:44 +00:00
Nate Begeman
779c5cbb44 Make pattern isel default for ppc
Add new ppc beta option related to using condition registers
Make pattern isel control flag (-enable-pattern-isel) global and tristate
  0 == off
  1 == on
  2 == target default

llvm-svn: 21309
2005-04-15 22:12:16 +00:00
Chris Lattner
e0a9d042e2 new pass
llvm-svn: 21307
2005-04-15 21:13:16 +00:00
Chris Lattner
16a50fd0a0 a new simple pass, which will be extended to be more useful in the future.
This pass forward branches through conditions when it can show that the
conditions is either always true or false for a predecessor.  This currently
only handles the most simple cases of this, but is successful at threading
across 2489 branches and 65 switch instructions in 176.gcc, which isn't bad.

llvm-svn: 21306
2005-04-15 19:28:32 +00:00
Chris Lattner
d041242256 add a new prototype
llvm-svn: 21305
2005-04-15 19:24:49 +00:00
Chris Lattner
8579c2c474 new testcase
llvm-svn: 21304
2005-04-15 19:24:36 +00:00
Andrew Lenharth
00ce283b3f fix calls
llvm-svn: 21303
2005-04-14 17:34:20 +00:00
Andrew Lenharth
7ae3aba5aa a 21264 fix, and fix the operator precidence on an and -> zap check (should fix hundreds of test cases
llvm-svn: 21302
2005-04-14 16:24:00 +00:00
Andrew Lenharth
10b7bceb8e added a random and mask test
llvm-svn: 21301
2005-04-14 16:17:49 +00:00
Duraid Madina
0a7c2b9078 print negative 64 bit immediates as negative numbers, makes things a little
easier on the eyes, not that numbers like 18446744073709541376 are bad or
anything

llvm-svn: 21300
2005-04-14 10:08:01 +00:00
Duraid Madina
dfbbcc098b oops, this stopped us turning movl r4=0xFFFFFFFF;; and rX, r4 into zxt4
llvm-svn: 21299
2005-04-14 10:06:35 +00:00
Nate Begeman
53d3eccbe2 Implement multi-way branches through logical ops on condition registers.
This can generate considerably shorter code, reducing the size of crafty
by almost 1%.  Also fix the printing of mcrf.  The code is currently
disabled until it gets a bit more testing, but should work as-is.

llvm-svn: 21298
2005-04-14 09:45:08 +00:00
Nate Begeman
80c095f422 Add a couple missing transforms in getSetCC that were triggering assertions
in the PPC Pattern ISel

llvm-svn: 21297
2005-04-14 08:56:52 +00:00
Duraid Madina
f6b666fb06 we have zextloads, not sextloads!
llvm-svn: 21296
2005-04-14 08:37:32 +00:00
Nate Begeman
65a82c562e Add the necessary support to codegen condition register logical ops with
register allocated condition registers.  Make sure that the printed
  output is gas compatible.

llvm-svn: 21295
2005-04-14 03:20:38 +00:00
Nate Begeman
be21011911 Start allocating condition registers. Almost all explicit uses of CR0 are
now gone.  Next step is to get rid of the remaining ones and then start
allocating bools to CRs where appropriate.

llvm-svn: 21294
2005-04-13 23:15:44 +00:00
Nate Begeman
dd1bb81d04 Implement the fold shift X, zext(Y) -> shift X, Y at the target level,
where it is safe to do so.

llvm-svn: 21293
2005-04-13 22:14:14 +00:00
Nate Begeman
04ae873648 Add CodeGen tests for the recent SelectionDAG transforms
llvm-svn: 21292
2005-04-13 21:45:13 +00:00
Nate Begeman
4ddd81657b Disbale the broken fold of shift + sz[ext] for now
Move the transform for select (a < 0) ? b : 0 into the dag from ppc isel
Enable the dag to fold and (setcc, 1) -> setcc for targets where setcc
  always produces zero or one.

llvm-svn: 21291
2005-04-13 21:23:31 +00:00
Chris Lattner
56d177a344 fix an infinite loop
llvm-svn: 21289
2005-04-13 20:06:29 +00:00
Chris Lattner
e3d17d8225 fix some serious miscompiles on ia64, alpha, and ppc
llvm-svn: 21288
2005-04-13 19:53:40 +00:00
Chris Lattner
8c3d409dc7 avoid work when possible, perhaps fix the problem nate and andrew are seeing
with != 0 comparisons vanishing.

llvm-svn: 21287
2005-04-13 19:41:05 +00:00
Andrew Lenharth
93341a0f82 WOW, function calls still seem to work after this.
llvm-svn: 21286
2005-04-13 17:17:28 +00:00
Andrew Lenharth
c3621316ee prepare for func call optimization
llvm-svn: 21285
2005-04-13 16:19:50 +00:00
Andrew Lenharth
c2ff402c84 regression case for faster call sequence
llvm-svn: 21284
2005-04-13 16:16:01 +00:00
Andrew Lenharth
714dd6a0ec check that casts still use zap
llvm-svn: 21283
2005-04-13 13:00:16 +00:00
Duraid Madina
2f2312575b * add the shladd instruction
* fold left shifts of 1, 2, 3 or 4 bits into adds

  This doesn't save much now, but should get a serious workout once
  multiplies by constants get converted to shift/add/sub sequences.
  Hold on! :)

llvm-svn: 21282
2005-04-13 06:12:04 +00:00
Andrew Lenharth
c7287c8eda add matches for SxADDL and company, as well as simplify the SxADDQ code
llvm-svn: 21281
2005-04-13 05:19:55 +00:00
Chris Lattner
e69ad5fd12 Implement expansion of unsigned i64 -> FP.
Note that this probably only works for little endian targets, but is enough
to get siod working :)

llvm-svn: 21280
2005-04-13 05:09:42 +00:00
Duraid Madina
e7ef27bcfe * if ANDing with a constant of the form:
0x00000..00FFF..FF
      ^      ^
      ^      ^
    any number of
    0's followed by
    some number of
    1's

    then we use dep.z to just paste zeros over the input. For the special
    cases where this is zxt1/zxt2/zxt4, we use those instructions instead,
    because we're all about readability!!!
    that's what it's about!! readability!

  *twitch* ;D

llvm-svn: 21279
2005-04-13 04:50:54 +00:00
Andrew Lenharth
5cee4ef049 added s4addl matching test
llvm-svn: 21277
2005-04-13 04:41:06 +00:00
Andrew Lenharth
8eb82fb524 added all flavors of zap for anding
llvm-svn: 21276
2005-04-13 03:47:03 +00:00
Chris Lattner
0efd77eda7 Make expansion of uint->fp cast assert out instead of infinitely recurse.
llvm-svn: 21275
2005-04-13 03:42:14 +00:00
Chris Lattner
60c23bd169 Fix some mysteriously missing {}'s which cause the miscompilation of
Olden/mst, Ptrdist/bc, Obsequi, etc.

llvm-svn: 21274
2005-04-13 03:29:53 +00:00
Chris Lattner
b1f25ac188 add back the optimization that Nate added for shl X, (zext_inreg y)
llvm-svn: 21273
2005-04-13 02:58:13 +00:00
Chris Lattner
39844ac337 Oops, remove these too.
llvm-svn: 21272
2005-04-13 02:47:57 +00:00
Chris Lattner
e0efd1fa72 remove one more occurance of this that snuck in
llvm-svn: 21271
2005-04-13 02:46:17 +00:00
Chris Lattner
857624f47a Remove support for ZERO_EXTEND_INREG. This pessimizes code, genering stuff
like this:

        ldah $1,1($31)
        lda $1,-1($1)
        and $0,$1,$24

instead of this:

        zap $0,252,$24

To get this back, the selector should recognize the ISD::AND case where this
happens and emit the appropriate ZAP instruction.

llvm-svn: 21270
2005-04-13 02:43:40 +00:00
Chris Lattner
7f4c4179a6 Remove special handling of ZERO_EXTEND_INREG. This pessimizes code, causing
things like this:

       mov r9 = 65535;;
       and r8 = r8, r9;;

To be emitted instead of:

        zxt2 r8 = r8;;

To get this back, the selector for ISD::AND should recognize this case.

llvm-svn: 21269
2005-04-13 02:41:52 +00:00
Chris Lattner
83075510ee Elimate handling of ZERO_EXTEND_INREG. This causes the PPC backend to emit
andi instructions instead of rlwinm instructions for zero extend, but they
seem like they would take the same time.

llvm-svn: 21268
2005-04-13 02:40:26 +00:00
Chris Lattner
248fe6bda2 Z_E_I is gone
llvm-svn: 21267
2005-04-13 02:39:05 +00:00
Chris Lattner
0e852afb4c Instead of making ZERO_EXTEND_INREG nodes, use the helper method in
SelectionDAG to do the job with AND.  Don't legalize Z_E_I anymore as
it is gone

llvm-svn: 21266
2005-04-13 02:38:47 +00:00
Chris Lattner
2b4e3fca38 Remove all foldings of ZERO_EXTEND_INREG, moving them to work for AND nodes
instead.  OVerall, this increases the amount of folding we can do.

llvm-svn: 21265
2005-04-13 02:38:18 +00:00
Chris Lattner
50b63f7015 Add a new helper method which returns the and that is equivalent to what
ZERO_EXTEND_INREG was.

llvm-svn: 21264
2005-04-13 02:37:19 +00:00
Chris Lattner
71886d95d5 Remove the ZERO_EXTEND_INREG node which is redundant with AND
llvm-svn: 21263
2005-04-13 02:36:41 +00:00
Nate Begeman
ca916ba4a0 Fold shift x, [sz]ext(y) -> shift x, y
llvm-svn: 21262
2005-04-12 23:32:28 +00:00
Nate Begeman
af1c0f7a00 Fold shift by size larger than type size to undef
Make llvm undef values generate ISD::UNDEF nodes

llvm-svn: 21261
2005-04-12 23:12:17 +00:00
Nate Begeman
818eb6ddd2 Implement setcc op, -1 sequences
Remove dead setcc op, 0 sequences
Coming later: generalization of op, imm

llvm-svn: 21260
2005-04-12 21:22:28 +00:00
Chris Lattner
0b73a6d8bc promote extload i1 -> extload i8
llvm-svn: 21258
2005-04-12 20:30:10 +00:00
Chris Lattner
9daef352e9 add an argument to allow avoiding deleting phi nodes.
llvm-svn: 21255
2005-04-12 18:52:14 +00:00
Chris Lattner
eb958b0e45 add an argument.
llvm-svn: 21254
2005-04-12 18:51:53 +00:00
Chris Lattner
95f16a3ac4 Get rid of this for_each loop
llvm-svn: 21253
2005-04-12 18:51:33 +00:00
Duraid Madina
fd469bddac * OK, after changing to use liveIn/liveOut instead of IDEFs,
to avoid redundant mov out3=r44 type instructions, we need to
tell the register allocator the truth about out? registers.

FIXME: unfortunately, since the list of allocatable registers is immutable,
we can't simply 'delete r127' from the allocation order, say, if 'out0' is
used. The only correct thing we can do is have a linear order of regs:

out7, out6 ... out2, out1, out0, r32, r33, r34 ... r126, r127

and slide a 'window' of 96 registers along this line, depending on how many
of the out? regs a function actually uses. The only downside of this is
that the out? registers will be allocated _first_, which makes the
resulting assembly ugly. :( Note this in the README. Hope this gets fixed
soon. :) (note the 3rd person speech there)

llvm-svn: 21252
2005-04-12 18:42:59 +00:00
Andrew Lenharth
740f93ca10 Get rid of idefs for arguments (oops)
llvm-svn: 21251
2005-04-12 17:47:57 +00:00
Andrew Lenharth
10c6eb4be2 Get rid of idefs for arguments
llvm-svn: 21250
2005-04-12 17:35:16 +00:00
Chris Lattner
14f72885dd Put out* into the allocation order, allowing the register allocator to
coallesce moves into outgoing args.

llvm-svn: 21249
2005-04-12 15:12:51 +00:00
Chris Lattner
6b91767b77 Make sure to realize that calls use their argument regs
llvm-svn: 21248
2005-04-12 15:12:19 +00:00
Duraid Madina
b6dfb227b7 stop emitting IDEFs for args - change to using liveIn/liveOut
llvm-svn: 21247
2005-04-12 14:54:44 +00:00
Nate Begeman
f67f3bf627 Initial support for allocation condition registers
llvm-svn: 21246
2005-04-12 07:04:16 +00:00
Chris Lattner
6febe5ef40 Fix a crash analyzing MultiSource/Benchmarks/MallocBench/gs
llvm-svn: 21245
2005-04-12 03:59:27 +00:00
Chris Lattner
af5b25f139 Remove some redundant checks, add a couple of new ones. This allows us to
compile this:

int foo (unsigned long a, unsigned long long g) {
  return a >= g;
}

To:

foo:
        movl 8(%esp), %eax
        cmpl %eax, 4(%esp)
        setae %al
        cmpl $0, 12(%esp)
        sete %cl
        andb %al, %cl
        movzbl %cl, %eax
        ret

instead of:

foo:
        movl 8(%esp), %eax
        cmpl %eax, 4(%esp)
        setae %al
        movzbw %al, %cx
        movl 12(%esp), %edx
        cmpl $0, %edx
        sete %al
        movzbw %al, %ax
        cmpl $0, %edx
        cmove %cx, %ax
        movzbl %al, %eax
        ret

llvm-svn: 21244
2005-04-12 02:54:39 +00:00
Chris Lattner
aedcabe8db Emit comparisons against the sign bit better. Codegen this:
bool %test1(long %X) {
        %A = setlt long %X, 0
        ret bool %A
}

like this:

test1:
        cmpl $0, 8(%esp)
        setl %al
        movzbl %al, %eax
        ret

instead of:

test1:
        movl 8(%esp), %ecx
        cmpl $0, %ecx
        setl %al
        movzbw %al, %ax
        cmpl $0, 4(%esp)
        setb %dl
        movzbw %dl, %dx
        cmpl $0, %ecx
        cmove %dx, %ax
        movzbl %al, %eax
        ret

llvm-svn: 21243
2005-04-12 02:19:10 +00:00
Chris Lattner
71ff44e46c Emit long comparison against -1 better. Instead of this (x86):
test2:
        movl 8(%esp), %eax
        notl %eax
        movl 4(%esp), %ecx
        notl %ecx
        orl %eax, %ecx
        cmpl $0, %ecx
        sete %al
        movzbl %al, %eax
        ret

or this (PPC):

_test2:
        nor r2, r4, r4
        nor r3, r3, r3
        or r2, r2, r3
        cntlzw r2, r2
        srwi r3, r2, 5
        blr

Emit this:

test2:
        movl 8(%esp), %eax
        andl 4(%esp), %eax
        cmpl $-1, %eax
        sete %al
        movzbl %al, %eax
        ret

or this:

_test2:
.LBB_test2_0:   ;
        and r2, r4, r3
        cmpwi cr0, r2, -1
        li r3, 1
        li r2, 0
        beq .LBB_test2_2        ;
.LBB_test2_1:   ;
        or r3, r2, r2
.LBB_test2_2:   ;
        blr

it seems like the PPC isel could do better for R32 == -1 case.

llvm-svn: 21242
2005-04-12 01:46:05 +00:00
Chris Lattner
87bd69884a canonicalize x <u 1 -> x == 0. On this testcase:
unsigned long long g;
unsigned long foo (unsigned long a) {
  return (a >= g) ? 1 : 0;
}

It changes the ppc code from:

_foo:
.LBB_foo_0:     ; entry
        mflr r11
        stw r11, 8(r1)
        bl "L00000$pb"
"L00000$pb":
        mflr r2
        addis r2, r2, ha16(L_g$non_lazy_ptr-"L00000$pb")
        lwz r2, lo16(L_g$non_lazy_ptr-"L00000$pb")(r2)
        lwz r4, 0(r2)
        lwz r2, 4(r2)
        cmplw cr0, r3, r2
        li r2, 1
        li r3, 0
        bge .LBB_foo_2  ; entry
.LBB_foo_1:     ; entry
        or r2, r3, r3
.LBB_foo_2:     ; entry
        cmplwi cr0, r4, 1
        li r3, 1
        li r5, 0
        blt .LBB_foo_4  ; entry
.LBB_foo_3:     ; entry
        or r3, r5, r5
.LBB_foo_4:     ; entry
        cmpwi cr0, r4, 0
        beq .LBB_foo_6  ; entry
.LBB_foo_5:     ; entry
        or r2, r3, r3
.LBB_foo_6:     ; entry
        rlwinm r3, r2, 0, 31, 31
        lwz r11, 8(r1)
        mtlr r11
        blr


to:

_foo:
.LBB_foo_0:     ; entry
        mflr r11
        stw r11, 8(r1)
        bl "L00000$pb"
"L00000$pb":
        mflr r2
        addis r2, r2, ha16(L_g$non_lazy_ptr-"L00000$pb")
        lwz r2, lo16(L_g$non_lazy_ptr-"L00000$pb")(r2)
        lwz r4, 0(r2)
        lwz r2, 4(r2)
        cmplw cr0, r3, r2
        li r2, 1
        li r3, 0
        bge .LBB_foo_2  ; entry
.LBB_foo_1:     ; entry
        or r2, r3, r3
.LBB_foo_2:     ; entry
        cntlzw r3, r4
        srwi r3, r3, 5
        cmpwi cr0, r4, 0
        beq .LBB_foo_4  ; entry
.LBB_foo_3:     ; entry
        or r2, r3, r3
.LBB_foo_4:     ; entry
        rlwinm r3, r2, 0, 31, 31
        lwz r11, 8(r1)
        mtlr r11
        blr

llvm-svn: 21241
2005-04-12 00:28:49 +00:00
Nate Begeman
79a3bea4ca Implement bitfield clears
Implement divide by negative power of two

llvm-svn: 21240
2005-04-12 00:10:02 +00:00
Nate Begeman
08698cf644 Update PPC readme. Remove things that are done or aren't ppc specific
llvm-svn: 21232
2005-04-11 20:48:57 +00:00
Chris Lattner
8ffd004920 Teach the dag mechanism that this:
long long test2(unsigned A, unsigned B) {
        return ((unsigned long long)A << 32) + B;
}

is equivalent to this:

long long test1(unsigned A, unsigned B) {
        return ((unsigned long long)A << 32) | B;
}

Now they are both codegen'd to this on ppc:

_test2:
        blr

or this on x86:

test2:
        movl 4(%esp), %edx
        movl 8(%esp), %eax
        ret

llvm-svn: 21231
2005-04-11 20:29:59 +00:00
Chris Lattner
edd197062f Fix expansion of shifts by exactly NVT bits on arch's (like X86) that have
masking shifts.

This fixes the miscompilation of this:

long long test1(unsigned A, unsigned B) {
        return ((unsigned long long)A << 32) | B;
}

into this:

test1:
        movl 4(%esp), %edx
        movl %edx, %eax
        orl 8(%esp), %eax
        ret

allowing us to generate this instead:

test1:
        movl 4(%esp), %edx
        movl 8(%esp), %eax
        ret

llvm-svn: 21230
2005-04-11 20:08:52 +00:00
Chris Lattner
607bd26b38 IA64 supports this operation.
llvm-svn: 21228
2005-04-11 18:55:36 +00:00
Chris Lattner
67291ea580 ORo sets CR0
llvm-svn: 21227
2005-04-11 15:03:48 +00:00
Chris Lattner
f29cc88210 Revert the previous patch, which I didn't mean to check in.
llvm-svn: 21226
2005-04-11 15:03:41 +00:00
Chris Lattner
d3dc31009f Fix a minor bug (ORo didn't mark that it set CR0).
Refactor how . instructions are handled.  In particular, instead of passing
the RC flag all the way up the inheritance hierarchy, just make a new tblgen
class 'DOT' which can be added to an instruction definition.

For example, instead of this:

-def AND  : XForm_6<31,  28, 0, 0, 0, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB),
-let Defs = [CR0] in
-def ANDo : XForm_6<31,  28, 1, 0, 0, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB),
-                   "and. $rA, $rS, $rB">;

We now have this:

+def AND  : XForm_6<31,  28, 0, 0, (ops GPRC:$rA, GPRC:$rS, GPRC:$rB),
                    "and $rA, $rS, $rB">;

llvm-svn: 21225
2005-04-11 15:01:39 +00:00
Duraid Madina
8de7ac092d hmm, should probably change addImm() to take 64-bit arguments one day anyway.
llvm-svn: 21224
2005-04-11 07:16:39 +00:00
Duraid Madina
247def9c2b rename addU64Imm() to addImm64()
llvm-svn: 21223
2005-04-11 07:14:41 +00:00
Nate Begeman
bebefac791 Add recording variants of ISD::AND and ISD::OR. This kills almost 1000
(1.5%) instructions in 186.crafty

llvm-svn: 21222
2005-04-11 06:34:10 +00:00
Duraid Madina
fb43ef78c5 assorted fixes:
* clean up immediates (we use 14, 22 and 64 bit immediates now. sane.)
  * fold r0/f0/f1 registers into comparisons against 0/0.0/1.0
  * fix nasty thinko - didn't use two-address form of conditional add
    for extending bools to integers, so occasionally there would be
    garbage in the result. it's amazing how often zeros are just
    sitting around in registers ;) - this should fix a bunch of tests.

llvm-svn: 21221
2005-04-11 05:55:56 +00:00
Reid Spencer
7a763bfbc5 Ensure that the arguments passed to sys::Program::ExecuteAndWait include
the program name as the first argument. Thanks go to Markus Oberhumer for
noticing this problem.

llvm-svn: 21220
2005-04-11 05:48:04 +00:00
Jeff Cohen
a3b1458175 Eliminate tabs
llvm-svn: 21216
2005-04-11 03:44:22 +00:00
Jeff Cohen
ecbfa98ce7 Eliminate major source of VC++ "possible loss of data" warnings.
llvm-svn: 21215
2005-04-11 03:38:28 +00:00
Nate Begeman
add0c63ad2 Fix libcall code to not pass a NULL Chain to LowerCallTo
Fix libcall code to not crash or assert looking for an ADJCALLSTACKUP node
  when it is known that there is no ADJCALLSTACKDOWN to match.
Expand i64 multiply when ISD::MULHU is legal for the target.

llvm-svn: 21214
2005-04-11 03:01:51 +00:00
Chris Lattner
e2427c9afc Don't bother sign/zext_inreg'ing the result of an and operation if we know
the result does change as a result of the extend.

This improves codegen for Alpha on this testcase:

int %a(ushort* %i) {
        %tmp.1 = load ushort* %i
        %tmp.2 = cast ushort %tmp.1 to int
        %tmp.4 = and int %tmp.2, 1
        ret int %tmp.4
}

Generating:

a:
        ldgp $29, 0($27)
        ldwu $0,0($16)
        and $0,1,$0
        ret $31,($26),1

instead of:

a:
        ldgp $29, 0($27)
        ldwu $0,0($16)
        and $0,1,$0
        addl $0,0,$0
        ret $31,($26),1

btw, alpha really should switch to livein/outs for args :)

llvm-svn: 21213
2005-04-10 23:37:16 +00:00
Chris Lattner
a3b7ef05f4 Teach legalize to deal with targets that don't support some SEXTLOAD/ZEXTLOADs
llvm-svn: 21212
2005-04-10 22:54:25 +00:00
Chris Lattner
672fe7267b The first argument to ExecuteAndWait should be the program name, but pointed
out by Markus F.X.J. Oberhumer.

llvm-svn: 21211
2005-04-10 20:59:38 +00:00
Chris Lattner
751cc5f49f fix this testcase so the regex doesn't match the function name
llvm-svn: 21210
2005-04-10 20:45:35 +00:00
Chris Lattner
391a351ede don't zextload fp values!
llvm-svn: 21209
2005-04-10 17:40:35 +00:00
Duraid Madina
7b0287b78d * store immediate values as int64_t, not int. come on, we should be happy
when there are immediates, let's not worry about the memory overhead of
this :)

* add addU64Imm(uint64_t val) to machineinstrbuilder

(seriously: this seems required to support 64-bit immediates cleanly. if it
_really_ gets on your nerves, feel free to pull it out ;) )

coming up next week: "all your floating point constants are belong to us"

llvm-svn: 21208
2005-04-10 09:18:55 +00:00
Nate Begeman
492370311d Fix another fixme: factor out the constant fp generation code.
llvm-svn: 21207
2005-04-10 06:06:10 +00:00
Nate Begeman
941a01802f Fix 64 bit argument loading that straddles the args in regs / args on stack
boundary.

llvm-svn: 21206
2005-04-10 05:53:14 +00:00
Chris Lattner
c53cd501b5 Until we have a dag combiner, promote using zextload's instead of extloads.
This gives the optimizer a bit of information about the top-part of the
value.

llvm-svn: 21205
2005-04-10 04:33:47 +00:00
Chris Lattner
f74c794ccf Fold zext_inreg(zextload), likewise for sext's
llvm-svn: 21204
2005-04-10 04:33:08 +00:00
Chris Lattner
f2bff92411 add a simple xform
llvm-svn: 21203
2005-04-10 04:04:49 +00:00
Nate Begeman
b076731713 Remove unnecessary Implicit Defs. Since r0 is not in allocation, we do not
have to inform the register allocator it might be stepped on.

llvm-svn: 21202
2005-04-10 03:59:42 +00:00
Chris Lattner
2de306ba83 make this harder
llvm-svn: 21201
2005-04-10 03:18:18 +00:00
Chris Lattner
d65632a9ca oops add ~
llvm-svn: 21200
2005-04-10 03:07:25 +00:00
Chris Lattner
38b1ae75fc new testcase for previously unsupported unary complex operators
llvm-svn: 21199
2005-04-10 03:06:27 +00:00
Nate Begeman
6566e8ac06 Make sure that BRCOND branches can be converted into long branches too.
llvm-svn: 21198
2005-04-10 01:48:29 +00:00
Nate Begeman
3345eadc37 Don't hand ISD::CALL nodes off to SelectExprFP. This fixes siod.
llvm-svn: 21197
2005-04-10 01:14:13 +00:00
Chris Lattner
d8cbfe82ba Fix a thinko. If the operand is promoted, pass the promoted value into
the new zero extend, not the original operand.  This fixes cast bool -> long
on ppc.

Add an unrelated fixme

llvm-svn: 21196
2005-04-10 01:13:15 +00:00
Chris Lattner
9ff4b4190f rename getPPCOpcodeForSetCCNumber -> getPPCOpcodeForSetCCOpode to be more
correct.  Remove the EmitComparison retvalue, as it is always the first arg.

Fix a place where we incorrectly passed in the setcc opcode instead of the
setcc number, causing us to miscompile crafty.  Crafty now works!

llvm-svn: 21195
2005-04-10 01:03:31 +00:00
Nate Begeman
2121a54868 fix ISD::BRCONDTWOWAY codegen to not deference the end() iterator
llvm-svn: 21193
2005-04-09 23:35:05 +00:00
Chris Lattner
228fed92e6 Fix CodeGen/Generic/2005-05-09-GlobalInPHI.ll, which was reduced from 254.gap.
This caused the "use before a def" assertion on some programs.

With this patch, 254.gap now passes with the PPC backend.

llvm-svn: 21191
2005-04-09 22:05:17 +00:00
Chris Lattner
db32a632c9 new testcase that used to crash the ppc fe. It could effect any simpleisel
that is not careful, so I'm checking it into the generic tests.

llvm-svn: 21190
2005-04-09 22:03:10 +00:00
Chris Lattner
da504741da add a little peephole optimization. This allows us to codegen:
int a(short i) {
        return i & 1;
}

as

_a:
        andi. r3, r3, 1
        blr

instead of:

_a:
        rlwinm r2, r3, 0, 16, 31
        andi. r3, r2, 1
        blr

on ppc.  It should also help the other risc targets.

llvm-svn: 21189
2005-04-09 21:43:54 +00:00
Chris Lattner
e8e070dbfb do not set the root to null if an argument is dead
llvm-svn: 21188
2005-04-09 21:23:24 +00:00
Nate Begeman
8309a333dd Add rlwnm instruction for variable rotate
Generate rotate left/right immediate
Generate code for brcondtwoway
Use new livein/liveout functionality

llvm-svn: 21187
2005-04-09 20:09:12 +00:00
Chris Lattner
3a7f5768c5 Fix a crash on 173.applu by asking for a constant bigger than 32-bits.
llvm-svn: 21185
2005-04-09 19:47:21 +00:00
Chris Lattner
a55a5f2580 Switch this instruction selector over to using liveins and liveouts, eliminating
implicit defs on entry to the function.  yaay :)

llvm-svn: 21184
2005-04-09 16:32:30 +00:00
Chris Lattner
1a44855f8f there is no need to remove this instruction, linscan does it already as it
removes noop moves.

llvm-svn: 21183
2005-04-09 16:24:20 +00:00
Chris Lattner
0b1681bce1 Adjust live intervals to support a livein set
llvm-svn: 21182
2005-04-09 16:17:50 +00:00
Chris Lattner
b59006c4a1 Use live out sets for return values instead of imp_defs, which is cleaner and faster.
llvm-svn: 21181
2005-04-09 15:23:56 +00:00
Chris Lattner
4c6ab01a20 Consider the livein/out set for a function, allowing targets to not have to
use ugly imp_def/imp_uses for arguments and return values.

llvm-svn: 21180
2005-04-09 15:23:25 +00:00
Chris Lattner
576db37185 add routines to track the livein/out set for a function
llvm-svn: 21179
2005-04-09 15:22:53 +00:00
Duraid Madina
46aa06cfed ok, the "ia64 has a boatload of registers" joke stopped being funny today ;)
* fix overallocation of integer (stacked) registers: we can't allocate
  registers for local use if they are required as output registers

this fixes 'toast' in the test suite, and all sorts of larger programs
like bzip2 etc.

llvm-svn: 21178
2005-04-09 11:53:00 +00:00
Nate Begeman
2f64122319 Optimize FSEL a bit for fneg arguments. This fixes the recently added test
case so that we emit

_test_fneg_sel:
.LBB_test_fneg_sel_0:   ;
        fsel f1, f1, f3, f2
        blr

instead of:

_test_fneg_sel:
.LBB_test_fneg_sel_0:   ;
        fneg f0, f1
        fneg f0, f0
        fsel f1, f0, f3, f2
        blr

llvm-svn: 21177
2005-04-09 09:33:07 +00:00
Nate Begeman
7d3e44fb12 Add a testcase to make sure that we don't emit two fneg instructions back
to back for certain fsel instructions.

llvm-svn: 21176
2005-04-09 09:30:09 +00:00
Nate Begeman
968e44a900 Add cases to cover the rest of the patterns we should be matching
llvm-svn: 21175
2005-04-09 08:29:59 +00:00
Chris Lattner
888c5fdcc2 Fix CodeGen/SparcV9/2005-05-09-GEP-Crash.ll a crash on some specfp program
lets hope this doesn't break other programs with induced entropy

llvm-svn: 21174
2005-04-09 06:27:14 +00:00
Chris Lattner
3aa6ec0dda New testcase that the sparc backend crashes on
llvm-svn: 21173
2005-04-09 06:26:27 +00:00
Chris Lattner
6a31b878f8 recognize some patterns as fabs operations, so that fabs at the source level
is deconstructed then reconstructed here.  This catches 19 fabs's in 177.mesa
9 in 168.wupwise, 5 in 171.swim, 3 in 172.mgrid, and 14 in 173.applu out of
specfp2000.

This allows the X86 code generator to make MUCH better code than before for
each of these and saves one instr on ppc.

This depends on the previous CFE patch to expose these correctly.

llvm-svn: 21171
2005-04-09 05:15:53 +00:00
Chris Lattner
d9748bcae5 make this test more interesting
llvm-svn: 21170
2005-04-09 04:55:14 +00:00
Chris Lattner
ec90861662 add a test for fnabs
llvm-svn: 21169
2005-04-09 04:03:16 +00:00
Chris Lattner
b9a11b8b7f add a partial test for the fma operations that ppc supports. I'm sure I'm
missing some and not all of these match yet, but I'm sure that Nate will
clean up my mess :)

llvm-svn: 21168
2005-04-09 04:01:32 +00:00
Chris Lattner
8a98c7f337 Emit BRCONDTWOWAY when possible.
llvm-svn: 21167
2005-04-09 03:30:29 +00:00
Chris Lattner
fd98678a8a Legalize BRCONDTWOWAY into a BRCOND/BR pair if a target doesn't support it.
llvm-svn: 21166
2005-04-09 03:30:19 +00:00
Chris Lattner
b0713c74a2 print and fold BRCONDTWOWAY correctly
llvm-svn: 21165
2005-04-09 03:27:28 +00:00
Chris Lattner
a3a135a9f7 This target does not support/want ISD::BRCONDTWOWAY
llvm-svn: 21164
2005-04-09 03:22:37 +00:00
Chris Lattner
4f77badaa3 This target does not yet support ISD::BRCONDTWOWAY
llvm-svn: 21163
2005-04-09 03:22:30 +00:00
Chris Lattner
4b1323e846 Add a new node
llvm-svn: 21162
2005-04-09 03:21:50 +00:00
Nate Begeman
e8ce0cda40 64b: Expand S/UREM
32b: No longer pattern match fneg(fsub(fmul)) as fnmsub
     Pattern match fsub a, mul(b, c) as fnmsub
     Pattern match fadd a, mul(b, c) as fmadd
Those changes speed up hydro2d by 2.5%, distray by 6%, and scimark by 8%

llvm-svn: 21161
2005-04-09 03:05:51 +00:00
Chris Lattner
0ea81f9db4 canonicalize a bunch of operations involving fneg
llvm-svn: 21160
2005-04-09 03:02:46 +00:00
Nate Begeman
f50b597f67 Fix 64b shifts
llvm-svn: 21159
2005-04-08 23:45:01 +00:00
Chris Lattner
61b6f04ae9 fix this method for 64-bit constants
llvm-svn: 21158
2005-04-08 21:31:29 +00:00
Nate Begeman
705d3c18e8 Match Mac OS X 64 bit calling conventions
llvm-svn: 21157
2005-04-08 21:26:05 +00:00
Andrew Lenharth
de5aed3f12 collect a few statistics, factor constants (constant loading and mult), fix logic operation pattern matchs, supress FP div when int dividing by a constant
llvm-svn: 21156
2005-04-08 17:28:49 +00:00
Andrew Lenharth
ce9e043c78 oops
llvm-svn: 21155
2005-04-08 16:55:15 +00:00
Andrew Lenharth
2e184e2522 added some tests to check stupid pattern matching mistakes
llvm-svn: 21154
2005-04-08 16:46:44 +00:00
Duraid Madina
41ff502549 fix bogus division-by-power-of-2 (was wrong for negative input, adds extr insn)
fix hack in division (clean up frcpa instruction)

llvm-svn: 21153
2005-04-08 10:01:48 +00:00
Chris Lattner
4236261930 Fix bug: InstCombine/2005-05-07-UDivSelectCrash.ll
llvm-svn: 21152
2005-04-08 04:03:26 +00:00
Chris Lattner
9e2b5fc65a new testcase that crashes the instcombiner.
llvm-svn: 21151
2005-04-08 03:58:21 +00:00
Nate Begeman
b1f66d1af2 Optimized code sequences for setcc reg, 0
Optimized code sequence for (a < 0) ? b : 0

llvm-svn: 21150
2005-04-07 20:30:01 +00:00
Andrew Lenharth
534eebb317 Alpha zero extends setcc results
llvm-svn: 21149
2005-04-07 20:11:32 +00:00
Chris Lattner
b32d9318d2 If a target zero or sign extends the result of its setcc, allow folding of
this into sign/zero extension instructions later.

On PPC, for example, this testcase:

%G = external global sbyte
implementation
void %test(int %X, int %Y) {
  %C = setlt int %X, %Y
  %D = cast bool %C to sbyte
  store sbyte %D, sbyte* %G
  ret void
}

Now codegens to:

        cmpw cr0, r3, r4
        li r3, 1
        li r4, 0
        blt .LBB_test_2 ;
.LBB_test_1:    ;
        or r3, r4, r4
.LBB_test_2:    ;
        addis r2, r2, ha16(L_G$non_lazy_ptr-"L00000$pb")
        lwz r2, lo16(L_G$non_lazy_ptr-"L00000$pb")(r2)
        stb r3, 0(r2)

instead of:

        cmpw cr0, r3, r4
        li r3, 1
        li r4, 0
        blt .LBB_test_2 ;
.LBB_test_1:    ;
        or r3, r4, r4
.LBB_test_2:    ;
***     rlwinm r3, r3, 0, 31, 31
        addis r2, r2, ha16(L_G$non_lazy_ptr-"L00000$pb")
        lwz r2, lo16(L_G$non_lazy_ptr-"L00000$pb")(r2)
        stb r3, 0(r2)

llvm-svn: 21148
2005-04-07 19:43:53 +00:00
Chris Lattner
532ac79122 PowerPC zero extends setcc results
llvm-svn: 21147
2005-04-07 19:41:49 +00:00
Chris Lattner
38fd97084b X86 zero extends setcc results
llvm-svn: 21146
2005-04-07 19:41:46 +00:00
Chris Lattner
693e797be9 Allow targets which produce setcc results in non-MVT::i1 registers to describe
what the contents of the top bits of these registers are, in the common cases
of targets that sign and zero extend the results.

llvm-svn: 21145
2005-04-07 19:41:18 +00:00
Chris Lattner
dfed7355c9 Remove somethign I had for testing
llvm-svn: 21144
2005-04-07 18:58:54 +00:00
Andrew Lenharth
9807ac5d3c fix a small optimization opertunity and make gcc happy
llvm-svn: 21143
2005-04-07 18:15:28 +00:00
Chris Lattner
6b03a0cba1 This patch does two things. First, it canonicalizes 'X >= C' -> 'X > C-1'
(likewise for <= >=u >=u).

Second, it implements a special case hack to turn 'X gtu SINTMAX' -> 'X lt 0'

On powerpc, for example, this changes this:

        lis r2, 32767
        ori r2, r2, 65535
        cmplw cr0, r3, r2
        bgt .LBB_test_2

into:

        cmpwi cr0, r3, 0
        blt .LBB_test_2

llvm-svn: 21142
2005-04-07 18:14:58 +00:00
Andrew Lenharth
31f5e2f73f match case change in codegen
llvm-svn: 21141
2005-04-07 17:47:00 +00:00
Andrew Lenharth
6b492bec30 fixup magic constant making code. tested by thousands of random divisions.... by 10000. ok, so random divisors would be good too, but this at least fixes some things
llvm-svn: 21140
2005-04-07 17:19:16 +00:00
Andrew Lenharth
d2da7177f2 lowercase instructions, makes diff happier
llvm-svn: 21139
2005-04-07 17:17:48 +00:00
Chris Lattner
4706046e68 Implement the following xforms:
(X-Y)-X --> -Y
A + (B - A) --> B
(B - A) + A --> B

llvm-svn: 21138
2005-04-07 17:14:51 +00:00
Chris Lattner
679c1119e8 new test
llvm-svn: 21137
2005-04-07 16:41:45 +00:00
Chris Lattner
c7f3c1a00e Implement InstCombine/add.ll:test28, transforming C1-(X+C2) --> (C1-C2)-X.
This occurs several dozen times in specint2k, particularly in crafty and gcc
apparently.

llvm-svn: 21136
2005-04-07 16:28:01 +00:00
Chris Lattner
dd83183c1e new testcase
llvm-svn: 21135
2005-04-07 16:24:59 +00:00
Chris Lattner
a9be4490d8 Transform X-(X+Y) == -Y and X-(Y+X) == -Y
llvm-svn: 21134
2005-04-07 16:15:25 +00:00
Andrew Lenharth
05e51d92e0 It wasn't happy about this either
llvm-svn: 21133
2005-04-07 14:18:13 +00:00
Andrew Lenharth
85f34a5682 Yea, it wasn't happy
llvm-svn: 21132
2005-04-07 13:55:53 +00:00
Duraid Madina
a7abda3989 teach asmprinter to print s8/s14 operands
llvm-svn: 21131
2005-04-07 12:34:36 +00:00
Duraid Madina
8419da8acf codegen immediate forms of add/sub/shift
llvm-svn: 21130
2005-04-07 12:33:38 +00:00
Duraid Madina
b484f7c55e add immediate forms of add, sub, shift
llvm-svn: 21129
2005-04-07 12:32:24 +00:00
Chris Lattner
7d13eae254 Fix a really scary bug that Nate found where we weren't deleting the right
elements auto of the autoCSE maps.

llvm-svn: 21128
2005-04-07 00:30:13 +00:00
Nate Begeman
d20628ff7d Pattern match bitfield insert, which helps shift long by immediate, among
other things.

llvm-svn: 21127
2005-04-06 23:51:40 +00:00
Nate Begeman
505f6b760d Fix some shift bugs
llvm-svn: 21126
2005-04-06 22:42:08 +00:00
Alkis Evlogimenos
7ca0947274 Make these 64 bit constants so that this compiles on x86-32 as well.
llvm-svn: 21125
2005-04-06 22:09:40 +00:00
Andrew Lenharth
3ea17c6cfe added sdiv by 2^k and works for neg divisors also
llvm-svn: 21124
2005-04-06 22:03:13 +00:00
Chris Lattner
747eee2707 Don't make this require loopsimplify. It works BETTER with loop simplify
but should not require it.

llvm-svn: 21123
2005-04-06 21:45:00 +00:00
Nate Begeman
b067492535 Teach ExpandShift how to handle shifts by a constant. This allows targets
like PowerPC to codegen long shifts in many fewer instructions.

llvm-svn: 21122
2005-04-06 21:13:14 +00:00
Andrew Lenharth
df3256aa7f fix copy/paste errors, and add imm support to SxADDQ and SxSUBQ
llvm-svn: 21121
2005-04-06 20:59:59 +00:00
Chris Lattner
bd32728a98 Fix SingleSource/Regression/C/2005-05-06-LongLongSignedShift.c, we were not
properly sign extending the top of the result of a 64-bit shift right by
a constant > 32.

llvm-svn: 21120
2005-04-06 20:59:35 +00:00
Andrew Lenharth
249bf7bee4 simplified
llvm-svn: 21119
2005-04-06 20:59:03 +00:00
Andrew Lenharth
99edcfe3f8 added first alpha codegen regression test
llvm-svn: 21117
2005-04-06 20:39:17 +00:00
Andrew Lenharth
1d4747c302 Added Nate's div by constant stuff, also scaled operations!
llvm-svn: 21116
2005-04-06 20:25:34 +00:00
Chris Lattner
70b8b96d6c Fix a namespace issue, reported by Vladimir Merzliakov!
llvm-svn: 21115
2005-04-06 19:45:39 +00:00
Duraid Madina
c36b6c3b1a steal sampo's div-by-constant-power-of-2 stuff
thanks sampo!!

llvm-svn: 21113
2005-04-06 09:55:17 +00:00
Duraid Madina
03c530786c add fms instruction
llvm-svn: 21112
2005-04-06 09:54:09 +00:00
Nate Begeman
39ef2f1d43 Fixed version of optimized integer divide is now fixed. Calculate the
quotient, not the remainder.  Also, make sure to remove the old div operand
from the ExprMap and let SelectExpr insert the new one.

llvm-svn: 21111
2005-04-06 06:44:57 +00:00
Duraid Madina
c0e9adf3cc lie a bit and say that r1/r12 (GP/SP) _aren't_ callee-save, as we take
care of this ourselves

llvm-svn: 21110
2005-04-06 06:18:36 +00:00
Duraid Madina
df0ecbd4cc make sure 'special' registers don't get allocated
llvm-svn: 21109
2005-04-06 06:17:54 +00:00
Chris Lattner
9953d17a44 document these nodes, as they are nonobvious
llvm-svn: 21108
2005-04-06 04:21:29 +00:00
Chris Lattner
4fbb4af5d1 Add (untested) support for MULHS and MULHU.
llvm-svn: 21107
2005-04-06 04:21:07 +00:00
Chris Lattner
c21db6b15c add signed versions of the extra precision multiplies
llvm-svn: 21106
2005-04-06 04:19:22 +00:00
Nate Begeman
dd397119b0 Turn off the div -> mul optimization until it works correctly 100% of the
time.

llvm-svn: 21105
2005-04-06 03:36:33 +00:00
Nate Begeman
4164c4baac Add support for MULHS and MULHU nodes
Have LegalizeDAG handle SREM and UREM for us
Codegen SDIV and UDIV by constant as a multiply by magic constant instead
of integer divide, which is very slow.

llvm-svn: 21104
2005-04-06 00:25:27 +00:00
Nate Begeman
20b7d2a36f Expand SREM and UREM for targets that claim not to have them, like PowerPC
llvm-svn: 21103
2005-04-06 00:23:54 +00:00
Nate Begeman
55e8625c69 Add MULHU and MULHS nodes for the high part of an (un)signed 32x32=64b
multiply.

llvm-svn: 21102
2005-04-05 22:36:56 +00:00
Andrew Lenharth
43f78bc2da added lowerargs support for varargs
llvm-svn: 21101
2005-04-05 20:51:46 +00:00
Nate Begeman
524417357c Behold, rlwinm with certain immediate arguments is printed as the much more
readable slwi or srwi (shift left/right word immediate).

llvm-svn: 21099
2005-04-05 18:19:50 +00:00
Nate Begeman
a188b698a2 Fix cut & paste errors (32->64), and codegen float->int more optimally.
llvm-svn: 21098
2005-04-05 17:32:30 +00:00
Tanya Lattner
8d64e9a90d Updated to use dep analyzer.
llvm-svn: 21097
2005-04-05 16:36:44 +00:00
Nate Begeman
9203e169a7 Remove 64 bit simple ISel, it never worked correctly
Add initial (buggy) implementation of 64 bit pattern ISel

llvm-svn: 21096
2005-04-05 08:51:15 +00:00
Nate Begeman
4bde071216 Back out the previous change to SelectBranchCC, since there are cases it
could miscompile.  A correct solution will be found in the near future.

llvm-svn: 21095
2005-04-05 04:32:16 +00:00
Nate Begeman
9049e4beec Rename canUseAsImmediateForOpcode to getImmediateForOpcode to better
indicate that it is not a boolean function.
Properly emit the pseudo instruction for conditional branch, so that we
  can fix up conditional branches whose displacements are too large.
Reserve the right amount of opcode space for said pseudo instructions.

llvm-svn: 21094
2005-04-05 04:22:58 +00:00
Chris Lattner
7e0a534cba do not crash when using -debug
llvm-svn: 21092
2005-04-05 01:12:03 +00:00
Nate Begeman
d6933f5078 Implement SDIV by power of 2 as srawi/addze rather than load imm, divw
llvm-svn: 21091
2005-04-05 00:15:08 +00:00
Nate Begeman
1d5d767a09 Pattern match fp mul-add, mul-sub, neg-mul-add, and neg-mul-sub
llvm-svn: 21090
2005-04-04 23:40:36 +00:00
Nate Begeman
d96350095c Add support for multiply-add, multiply-sub, and their negated versions
llvm-svn: 21089
2005-04-04 23:01:51 +00:00
Chris Lattner
b919b21777 do not dereference an extra layer of pointers to determine if an external
call can modify a memory location.  This fixes
test/Regression/Analysis/Andersens/modreftest.ll

llvm-svn: 21088
2005-04-04 22:23:21 +00:00
Chris Lattner
0933766e2b new testcase
llvm-svn: 21087
2005-04-04 22:22:30 +00:00
Nate Begeman
1194531057 Make sure that arg regs used by the call instruction are marked as such, so
that regalloc doesn't cleverly reuse early arg regs loading later arg regs.
This fixes almost all outstanding failures in the pattern isel.

llvm-svn: 21086
2005-04-04 22:17:48 +00:00
Nate Begeman
c7186025de Remove unnecessary register copy now that regalloc is fixed
llvm-svn: 21085
2005-04-04 21:48:13 +00:00
Chris Lattner
6a6056e93d Make sure to notice that explicit physregs are used in the function
llvm-svn: 21084
2005-04-04 21:35:34 +00:00
Nate Begeman
d753765460 i1 loads should also be from the low byte of the argument word.
llvm-svn: 21077
2005-04-04 09:09:00 +00:00
Nate Begeman
1ce4839890 Fix i64 return, fix CopyFromReg
llvm-svn: 21076
2005-04-04 06:52:38 +00:00
Duraid Madina
9935f44fb8 fix SREM/UREM, which gave incorrect results for x%y if x was zero. This is
an ugly hack, but it seems to work. I should fix this properly and add a test
as well.

fixes multisource/obsequi (maybe others)

llvm-svn: 21075
2005-04-04 05:05:52 +00:00
Duraid Madina
dbc810022b add implicit use op
llvm-svn: 21074
2005-04-04 04:50:57 +00:00
Nate Begeman
cc00a7c42d Handle expanding arguments to ISD::TRUNCATE. This happens on PowerPC when
you have something like i16 = truncate i64.  This fixes Regression/C/casts

llvm-svn: 21073
2005-04-04 00:57:08 +00:00
Chris Lattner
4784489de2 Fix sign_extend and zero_extend of promoted value types to expanded value
types.  This occurs when casting short to long on PPC for example.

llvm-svn: 21072
2005-04-03 23:41:52 +00:00
Nate Begeman
629cdaea39 Full varargs support. All of UnitTests now passes
llvm-svn: 21070
2005-04-03 23:11:17 +00:00
Nate Begeman
7a3e929efc Pass the correct value for the chain to the store
llvm-svn: 21066
2005-04-03 22:22:56 +00:00
Nate Begeman
f6dc43bd46 Fix SHL_PARTS
Start implementation of integer varargs

llvm-svn: 21065
2005-04-03 22:13:27 +00:00
Andrew Lenharth
79e727e8a7 is this simpler? I think it is simpler.
llvm-svn: 21064
2005-04-03 20:35:21 +00:00
Andrew Lenharth
7ce5740de9 fix 101 regressions
llvm-svn: 21063
2005-04-03 18:24:50 +00:00
Duraid Madina
2f472ecb11 a wise man once said:
"!!!!!!!! IF YOU CHANGE SPACES TO TABS, YOU WILL BE KILLED!!!!!!"

llvm-svn: 21062
2005-04-03 14:57:35 +00:00
Duraid Madina
6c9afaead4 .bss is no problem here.
llvm-svn: 21061
2005-04-03 14:52:01 +00:00
Nate Begeman
34cc5b329f Keeping up with the Joneses.
Implement not, nor, nand, and eqv

llvm-svn: 21060
2005-04-03 11:20:20 +00:00
Andrew Lenharth
46897ab49e Select optimization
llvm-svn: 21051
2005-04-02 22:32:39 +00:00
Andrew Lenharth
f029d795f0 Try several things. 1) drop /i from FP ops 2) factor out FP to Int moves and provide 21264 support for those 3) match not 4) match ornot andnot xornot
llvm-svn: 21046
2005-04-02 21:06:51 +00:00
Chris Lattner
d2df8ca403 fix some VC compilation problems, thanks to Jeff C for pointing this out!
llvm-svn: 21044
2005-04-02 20:17:09 +00:00
Chris Lattner
a7913e66e1 EquivClassGraphs is now in DataStructure.h
llvm-svn: 21042
2005-04-02 20:08:17 +00:00
Chris Lattner
745c960672 merge EquivClassGraphs.h into DataStructure.h with the other DSA pass definitions.
llvm-svn: 21041
2005-04-02 20:08:06 +00:00
Chris Lattner
526cc17b55 use a callee_iterator typedef.
llvm-svn: 21038
2005-04-02 20:02:41 +00:00
Chris Lattner
63e3a262d8 add and use a callee_iterator typedef
llvm-svn: 21037
2005-04-02 20:02:32 +00:00
Chris Lattner
990ed1d201 Change the ActualCallees callgraph from hash_multimap<Instruction,Function>
to std::set<std::pair<Inst,Func>> to avoid duplicate entries.

This speeds up the CompleteBU pass from 1.99s to .15s on povray and the
eqgraph passes from 1.5s to .16s on the same.

llvm-svn: 21031
2005-04-02 19:17:18 +00:00
Chris Lattner
637e42022f Change the ActualCallees callgraph from hash_multimap<Instruction,Function>
to std::set<std::pair<Inst,Func>> to avoid duplicate entries.

llvm-svn: 21030
2005-04-02 19:15:15 +00:00
Andrew Lenharth
e7ae400bc8 FNEG/FABS/UNDEF
llvm-svn: 21029
2005-04-02 19:11:07 +00:00
Andrew Lenharth
7ad3697e1e FNEG/FABS
llvm-svn: 21028
2005-04-02 19:04:58 +00:00
Chris Lattner
04e0515937 this has now been fixed
llvm-svn: 21026
2005-04-02 16:17:57 +00:00
Duraid Madina
50b339b7fa ia64 asmprinter fixes:
- turn off assembler's autoalignment
  - set FunctionAddrPrefix/Suffix so that .data8 entries pointing to
    functions have their value wrapped in @fptr(), so that a function
    descriptor will be materialized for that function.

llvm-svn: 21025
2005-04-02 12:30:47 +00:00
Duraid Madina
73a316d712 add support for prefix/suffix strings to go around GlobalValue(s)
(which may or be function pointers) in the asmprinter. For the moment,
this changes nothing, except the IA64 backend which can use this to write:

  data8.ua  @fptr(blah__blah__mangled_function_name)

  (by setting FunctionAddrPrefix/Suffix to "@fptr(" / ")")

llvm-svn: 21024
2005-04-02 12:21:51 +00:00
Duraid Madina
c935c833d1 support IDEF, fnegabs (thanks sampo)
llvm-svn: 21023
2005-04-02 10:33:53 +00:00
Duraid Madina
0ccac38ed3 add fnegabs op
llvm-svn: 21022
2005-04-02 10:06:27 +00:00
Nate Begeman
165cf4844e Set shift amount to Extend
Implement ISD::FABS and ISD::FNEG nodes
Implement SHL_PARTS, SRL_PARTS, and SRA_PARTS
Generate PowerPC 'fneg', 'fabs', and 'fnabs' instructions

llvm-svn: 21018
2005-04-02 05:59:34 +00:00
Chris Lattner
1d7052fad5 don't forget to use the right code generator :)
llvm-svn: 21017
2005-04-02 05:40:03 +00:00
Chris Lattner
b4e122c59f new testcase
llvm-svn: 21016
2005-04-02 05:35:00 +00:00
Chris Lattner
0e0b599d29 add support for FABS and FNEG
llvm-svn: 21015
2005-04-02 05:30:17 +00:00
Chris Lattner
0c14000760 transform fabs/fabsf calls into FABS nodes.
llvm-svn: 21014
2005-04-02 05:26:53 +00:00
Chris Lattner
a0c72cf289 Expand fabs into fneg
llvm-svn: 21013
2005-04-02 05:26:37 +00:00
Duraid Madina
0720dc14ed add support FNEG and FABS
llvm-svn: 21012
2005-04-02 05:18:38 +00:00
Chris Lattner
f68fd0b533 Turn -0.0 - X -> fneg
llvm-svn: 21011
2005-04-02 05:04:50 +00:00
Chris Lattner
0b7e4cd107 This target doesn't support fabs/fneg yet.
llvm-svn: 21010
2005-04-02 05:03:24 +00:00
Chris Lattner
13fe99c807 Several changes mixed up here. First when legalizing a DAG with pcmarker,
dont' regen the whole dag if unneccesary.  Second, fix and ugly bug with
the _PARTS nodes that caused legalize to produce multiples of them.
Finally, implement initial support for FABS and FNEG.  Currently FNEG is
the only one to be trusted though.

llvm-svn: 21009
2005-04-02 05:00:07 +00:00
Chris Lattner
c4a2046a88 print fneg/fabs
llvm-svn: 21008
2005-04-02 04:58:41 +00:00
Chris Lattner
b3183de8c6 Add two happy new nodes for FABS and FNEG
llvm-svn: 21007
2005-04-02 04:58:28 +00:00
Chris Lattner
2d451658a6 add an fabs instr
llvm-svn: 21006
2005-04-02 04:31:56 +00:00
Chris Lattner
a31d4c7548 Add support for 64-bit shifts.
llvm-svn: 21005
2005-04-02 04:01:14 +00:00
Chris Lattner
4157c417a1 fix some bugs in the implementation of SHL_PARTS and friends.
llvm-svn: 21004
2005-04-02 04:00:59 +00:00
Chris Lattner
6f28fd388a fix a comment
llvm-svn: 21003
2005-04-02 03:59:45 +00:00
Chris Lattner
2e5872c671 Turn expanded shift operations into (e.g.) SHL_PARTS if the target supports it.
llvm-svn: 21002
2005-04-02 03:38:53 +00:00
Chris Lattner
5b7bb56ef8 Print some new nodes
llvm-svn: 21001
2005-04-02 03:30:42 +00:00
Chris Lattner
dbd130cf46 add some new nodes.
llvm-svn: 21000
2005-04-02 03:30:33 +00:00
Chris Lattner
07f97d5f55 Fix a bug when inserting a libcall into a function with no other calls.
llvm-svn: 20999
2005-04-02 03:22:40 +00:00
Chris Lattner
07e3f7e1ff new generic testcsae
llvm-svn: 20996
2005-04-02 02:41:55 +00:00
Nate Begeman
cfc452d088 Fix i64 returns
Generate PowerPC 'subfic' instruction when appropriate

llvm-svn: 20995
2005-04-02 00:42:16 +00:00
Nate Begeman
69d39433c4 Fix a warning about an unhandled switch case
llvm-svn: 20994
2005-04-02 00:41:14 +00:00
John Criswell
9f680da784 For Sparc, this xfails. I don't think sparc has the C99 complex data
type support.

llvm-svn: 20993
2005-04-01 23:16:23 +00:00
Chris Lattner
f4b985d1f6 Add support for ISD::UNDEF to the X86 be
llvm-svn: 20990
2005-04-01 22:46:45 +00:00
Nate Begeman
cda9aa7fa9 Add ISD::UNDEF node
Teach the SelectionDAG code how to expand and promote it
Have PPC32 LowerCallTo generate ISD::UNDEF for int arg regs used up by fp
  arguments, but not shadowing their value.  This allows us to do the right
  thing with both fixed and vararg floating point arguments.

llvm-svn: 20988
2005-04-01 22:34:39 +00:00
Chris Lattner
5053ea85fc Fix another PATypeHolder error, contributed by Bill Wendling!
llvm-svn: 20983
2005-04-01 15:41:30 +00:00
Duraid Madina
617af97040 repair mindless SELECT waste.
llvm-svn: 20982
2005-04-01 10:35:00 +00:00
Nate Begeman
1c3aea6019 Fix Olden/bh, CR0 was being set in the wrong order
LowerCallTo and ISD::CALL are going to need to be modified, regs are being
set in the wrong order.

llvm-svn: 20981
2005-04-01 08:57:43 +00:00
Nate Begeman
c9e50238c5 Also apply Chris's fix to FP select and SETCC
llvm-svn: 20979
2005-04-01 07:21:30 +00:00
Chris Lattner
9122b4c9c0 new testcase
llvm-svn: 20978
2005-04-01 07:19:06 +00:00
Chris Lattner
ffc7f243fe Move the selection of the arms of the select operation up to the conditional
part to make sure we get the side effects and to avoid confusing the CFG.

llvm-svn: 20977
2005-04-01 07:10:02 +00:00
Chris Lattner
329c14a8bc print the machine CFG in the -print-machineinstrs dump
llvm-svn: 20976
2005-04-01 06:48:38 +00:00
Nate Begeman
2095f3b06b Fix stores to global addresses
Fix calls with no arguments

llvm-svn: 20975
2005-04-01 05:57:17 +00:00
Nate Begeman
839b34c367 Support indexed loads and stores. This drops Shootout/matrix time from
18.8 to 14.8 seconds.  The Pattern ISel is now often faster than the
Simple ISel, esp. on memory intensive code.

llvm-svn: 20973
2005-04-01 04:45:11 +00:00
Nate Begeman
f4d91610ff Implement FP_TO_SINT and FP_TO_UINT
llvm-svn: 20972
2005-04-01 02:59:27 +00:00
Nate Begeman
508aac2ca8 Add support for adding 0.0 and -0.0 to the constant pool, since we lie and
say that we support them, for the purposes of generating fsel instructions.

llvm-svn: 20970
2005-04-01 01:08:07 +00:00
Nate Begeman
4f3a9860d3 Factor out common code, support FP comparison in folded SetCC
llvm-svn: 20969
2005-04-01 00:32:34 +00:00
Nate Begeman
6215b35918 fsel generation for f32 and f64 select
generate compare immediate for integer compare with constant
fold setcc into branch
fold setcc into select

Code generation quality for Shootout is now on par with the Simple ISel

llvm-svn: 20968
2005-03-31 23:55:40 +00:00
Andrew Lenharth
3bf6f80588 make fp div trick dependend on flag
llvm-svn: 20967
2005-03-31 22:02:25 +00:00
Misha Brukman
9337e4c5ab Fix spelling of `corresponds'
llvm-svn: 20966
2005-03-31 21:30:35 +00:00
Andrew Lenharth
dec53920b4 PCMarker support for DAG and Alpha
llvm-svn: 20965
2005-03-31 21:24:06 +00:00
Duraid Madina
21ce5f7a66 Assorted fixes:
* Stop being pessimistic about output register allocation
  * Start to handle function descriptors: compute target GPs and so on
  when doing indirect calls etc. Not there yet, though. For the moment,
  we try to use _indirect_ branches wherever possible, to stress test
  function descriptors.
  * FP divide-by-zero should work now
  * add varargs (it doesn't work, though)

At this point, all of SingleSource passes (modulo C++ tests that are due
to issues with the CFE, see note in the README.) Much of MultiSource also
passes although there's still a ton of bugs around. Something for me to
work on tomorrow, then. :)

llvm-svn: 20960
2005-03-31 12:31:11 +00:00
Duraid Madina
ffb9d14bb3 * declare local common symbols as such (.lcomm, not merely .common)
* begin great adventure into correct function descriptor materialization

llvm-svn: 20956
2005-03-31 07:40:24 +00:00
Duraid Madina
8106f12d33 daintyness
llvm-svn: 20955
2005-03-31 07:36:43 +00:00
Duraid Madina
73c2777a0e add what we need to fudge a 'floating point conditional move', this is
used to get FP div-by-zero working properly (shunt the right answer
depending on how frcpa sets its predicate output)

llvm-svn: 20954
2005-03-31 07:32:32 +00:00
Nate Begeman
eddfff338a Pass the correct values to the chain argument for node construction during
LowerCallTo.
Handle ISD::ADD in SelectAddr, allowing us to have nonzero immediates for
loads and stores, amazing!

llvm-svn: 20946
2005-03-31 02:05:53 +00:00
Nate Begeman
9de7ddf7d5 Rewrite LowerCallTo and Select(ISD::CALL) to properly handle float varargs
Tell the SelectionDAG ISel to expand SEXTLOAD of i1 and i8, rather than
  complicate the code in ISD::SEXTLOAD to do it by hand
Combine the FP and Int ISD::LOAD codegen
Generate better code for constant pool loads

As a result, all of Shootout, and likely many other programs are now
working.

llvm-svn: 20945
2005-03-31 00:15:26 +00:00
Nate Begeman
4c0780cf42 Fix calls whose arguments fit entirely in registers to not break the Chain.
Implement SINT_TO_FP and UINT_TO_FP
Remove some dead code from the simple ISel

llvm-svn: 20944
2005-03-30 19:38:35 +00:00
Misha Brukman
9615809383 * Put command-line switches and function names in <tt>
* Add links to mailing lists and publications

llvm-svn: 20943
2005-03-30 19:14:24 +00:00
Andrew Lenharth
e3d9f8c4f9 yea, fine Duraid
llvm-svn: 20942
2005-03-30 18:22:52 +00:00
Duraid Madina
722d514025 Add section for Itanium
llvm-svn: 20941
2005-03-30 05:33:54 +00:00
Nate Begeman
a8114a0f48 Fix frame index code to generate legal PowerPC instructions. About half of
Shootout now works.

llvm-svn: 20940
2005-03-30 02:23:08 +00:00
Nate Begeman
5851a66128 Fix external symbol printing in the AsmPrinter. Tell the ISel that we
don't support things like memcpy directly.  This allows a handful of the
Shootout programs to work, yay!

llvm-svn: 20939
2005-03-30 01:45:43 +00:00
Misha Brukman
650d1742f7 * Add section for Alpha
* Remove extraneous subsections

llvm-svn: 20938
2005-03-30 01:14:38 +00:00
Chris Lattner
5ca31d9831 Instead of setting up the CFG edges at selectiondag construction time, set
them up after the code has been emitted.  This allows targets to select one
mbb as multiple mbb's as needed.

llvm-svn: 20937
2005-03-30 01:10:47 +00:00
Chris Lattner
472a265ef6 don't depend on the cfg being set up yet
llvm-svn: 20936
2005-03-30 01:10:00 +00:00
Nate Begeman
9c40e9c61f Fix BranchCC (it's still dumb), and implement FP select (also dumb)
llvm-svn: 20935
2005-03-29 22:48:55 +00:00
Nate Begeman
28145edd30 Implement integer select and i1 sign extend
llvm-svn: 20934
2005-03-29 22:24:51 +00:00
Nate Begeman
28c5ac9ff4 Implement SetCC, fix ZERO_EXTEND_INREG
llvm-svn: 20933
2005-03-29 21:54:38 +00:00
Chris Lattner
af4d93cd39 import all of the rest of the stubs that dsa uses for direct comparison
llvm-svn: 20932
2005-03-29 20:36:05 +00:00
Tanya Lattner
91964490e2 Compare dependence analysis with llvm instructions versus machine instrutions. the problem with using machine instructions and alias analysis is that aa does not handle tmp instructions.
llvm-svn: 20931
2005-03-29 20:35:10 +00:00
Tanya Lattner
6e19b21e30 Dependence analyzer that just determines dependences within a loop for loads and stores using alias analysis.
llvm-svn: 20930
2005-03-29 20:33:42 +00:00
Chris Lattner
4dba2ee974 learn about some more functions.
llvm-svn: 20929
2005-03-29 20:04:24 +00:00
Andrew Lenharth
93d008990e Fix up some types and constants
llvm-svn: 20928
2005-03-29 19:24:04 +00:00
Chris Lattner
2e1971c19d Fix a problem where we not marking incoming arguments to functions with
external linkage as incomplete.

llvm-svn: 20927
2005-03-29 19:16:59 +00:00
Chris Lattner
db45f7d763 Fix a bug that andrew noticed where we do not correctly sign/zero extend
returned integer values all of the way to 64-bits (we only did it to 32-bits
leaving the top bits undefined).  This causes problems for targets like alpha
whose ABI's define the top bits too.

llvm-svn: 20926
2005-03-29 19:09:56 +00:00
Chris Lattner
8de8b7bf40 there is no point comparing against null pointer.
llvm-svn: 20925
2005-03-29 17:44:52 +00:00
Chris Lattner
ca85130b0a Fix a major problem with global variable initializers. This could cause
us to have stuff pointing to the null pointer, which makes no sense
(the null ptr is an ssa value, not the null object)

llvm-svn: 20922
2005-03-29 17:21:53 +00:00
Chris Lattner
1ce9aacf2e fix a warning in the optimized build
llvm-svn: 20920
2005-03-29 15:13:27 +00:00
Chris Lattner
dd94b2d01e add some more functions, ignore setcc for constraints!
llvm-svn: 20917
2005-03-29 06:52:20 +00:00
Chris Lattner
ecfa9b5810 disable this transformation in the one obscure case that really pessimizes
pointer analysis.

llvm-svn: 20916
2005-03-29 06:37:47 +00:00
Chris Lattner
2c95fac918 there is no reason to run -instcombine -instcombine!
llvm-svn: 20915
2005-03-29 06:25:11 +00:00
Chris Lattner
7617e886c1 Handle "known" external calls context sensitively, add support for realloc
and a couple of other functions that are important.

Handle aggregate undef values for gv initializers

llvm-svn: 20914
2005-03-29 06:09:07 +00:00
Nate Begeman
60956dd52f Implement div, rem, and frameindex
llvm-svn: 20907
2005-03-29 00:03:27 +00:00
Nate Begeman
731bed10c7 Pattern ISel: fix argument loading for i64s (thanks chris)
Simple  ISel: fix i64 subtract

llvm-svn: 20903
2005-03-28 23:08:54 +00:00
Nate Begeman
66acad746f Remove fake instruction 'subc' (mnemonic for subfc).
More pattern isel updates

llvm-svn: 20902
2005-03-28 22:28:37 +00:00
Chris Lattner
32e08b7c06 implement legalization of build_pair for nate
llvm-svn: 20901
2005-03-28 22:03:13 +00:00
Andrew Lenharth
b442791124 First step in adding pcmarker intrinsic. Second step (soon) is adding backend support.
llvm-svn: 20900
2005-03-28 20:05:49 +00:00
Nate Begeman
5bdfc63516 Implement proper loads and zero-extends of all types
llvm-svn: 20897
2005-03-28 19:36:43 +00:00
Duraid Madina
bdbf8ba2d0 Emit .global @function and .global @object entries so the Intel ias
assembler may be used; identify LLVM output as such.

llvm-svn: 20892
2005-03-28 15:21:43 +00:00
Chris Lattner
81b6d86a3a Teach andersens that non-escaping memory cannot be mod/ref'd by external fn calls.
llvm-svn: 20891
2005-03-28 06:21:17 +00:00
Misha Brukman
009585d2ac Fix grammar
llvm-svn: 20890
2005-03-28 04:32:12 +00:00
Chris Lattner
a8ad8b2826 Make anders-aa much more precise by not being completely pessimistic about
external functions.  Teach it about a few important ones.

llvm-svn: 20889
2005-03-28 04:03:52 +00:00
Jeff Cohen
03332ecf17 Fix VC++ build breakage
llvm-svn: 20888
2005-03-28 02:52:28 +00:00
Alkis Evlogimenos
9ead0d7b4c Rename createPromoteMemoryToRegister() to
createPromoteMemoryToRegisterPass() to be consistent with other pass
creation functions.

llvm-svn: 20885
2005-03-28 02:01:12 +00:00
Chris Lattner
147f8b789c wrap some long lines
llvm-svn: 20884
2005-03-27 22:03:46 +00:00
Chris Lattner
2db10ba297 remove ...
llvm-svn: 20883
2005-03-27 21:57:09 +00:00
Chris Lattner
f290da862d speed up steens by using spliceFrom, improve its precision by realizing that
an incomplete node cannot alias a complete node.

llvm-svn: 20882
2005-03-27 21:56:55 +00:00
Chris Lattner
ea69f1f9e8 teach andersens about undef
llvm-svn: 20881
2005-03-27 18:58:23 +00:00
Chris Lattner
82166467c3 Don't give up completely, maybe other AA can say something about this.
llvm-svn: 20873
2005-03-27 00:02:33 +00:00
Chris Lattner
3f08e7899f Factor out percentage printing into its own function. Make two changes to
the function: print more precision XX.X% instead of XX%, and cast to ULL
before scaling by 100/1000 to avoid wrap around for large numbers of queries
(such as occur for 253.perlbmk and 176.gcc)

llvm-svn: 20872
2005-03-26 23:56:33 +00:00
Chris Lattner
2ba37389c9 Cache mapping information for a call site after computing it for a mod/ref
query.  If the next mod/ref query happens to be for the same call site
(which is extremely likely), use the cache instead of recomputing the
callee/caller mapping.  This makes -aa-eval ***MUCH*** faster with
ds-aa

llvm-svn: 20871
2005-03-26 23:29:03 +00:00
Chris Lattner
139f43b340 Remove more long dead code: dsa doesn't provide must alias info
llvm-svn: 20870
2005-03-26 22:54:46 +00:00
Chris Lattner
1a02d15dab remove some unsafe code that has long been dead
llvm-svn: 20869
2005-03-26 22:48:42 +00:00
Chris Lattner
9cc932d3b3 slightly improve mod/ref for DSAA by checking the globals graph for fallback
llvm-svn: 20868
2005-03-26 22:47:03 +00:00
Chris Lattner
b3baff1830 Teach steens-aa two things about mod/ref information:
1. If memory never escapes the program, it cannot be mod/ref'd by external
     functions.
  2. If memory is global never mod/ref'd in the program, it cannot be mod/ref'd
     by any call.

llvm-svn: 20867
2005-03-26 22:43:20 +00:00
Chris Lattner
68ee8f572c Interchange this loop so that we test all pointers against one call site
before moving on to the next call site.  This will be a more efficient way
to compute the mod/ref set for AA implementations like DSA.

llvm-svn: 20866
2005-03-26 22:16:44 +00:00
Nate Begeman
518a994b7d Fix that pesky floats in integer regs problem by assigning the f32 type to
the correct register class.  Also remove the loading of float data into int
regs part of varargs; it will need to be implemented differently later.

llvm-svn: 20857
2005-03-26 08:25:22 +00:00
Nate Begeman
dcad53e7bd Get closer to having varargs working. There's still something strange
going on with copies between floating point and integer register files
being generated.  Once that is solved, varargs will be done.

llvm-svn: 20856
2005-03-26 07:46:36 +00:00
Nate Begeman
c95bf7b226 Make 64bit args and float args work correct with calls. Thanks to Chris
for explaining EXTRACT_ELEMENT to me.

llvm-svn: 20847
2005-03-26 02:17:46 +00:00
Nate Begeman
0bea1090dd Change LowerCallTo to take a boolean isVarArg argument. This is needed
by the PowerPC backend, and probably others in the future.

llvm-svn: 20843
2005-03-26 01:30:30 +00:00
Nate Begeman
f656525cb6 Change interface to LowerCallTo to take a boolean isVarArg argument.
llvm-svn: 20842
2005-03-26 01:29:23 +00:00
Nate Begeman
e70b5c79f8 Next round of pattern isel changes, mostly dealing with calls.
llvm-svn: 20841
2005-03-26 01:28:53 +00:00
Nate Begeman
5d7610de65 Correct a documention link
llvm-svn: 20840
2005-03-26 01:28:05 +00:00
Chris Lattner
d21e220035 no really, don't double count these nodes either!
llvm-svn: 20837
2005-03-25 20:54:45 +00:00
Chris Lattner
b7ffd50537 Don't count all of the nodes in the SCC once for each function in the SCC.
llvm-svn: 20836
2005-03-25 20:37:32 +00:00
Chris Lattner
5ecec08ab5 Grow the EQ classes for globals at the end of the BU pass. This shrinks
memory usage in the TD pass for 254.gap from 31.3MB to 3.9MB.

llvm-svn: 20834
2005-03-25 16:45:43 +00:00
Chris Lattner
d6e6b38918 fix the RUN line on this testcase so it passes.
llvm-svn: 20833
2005-03-25 15:36:19 +00:00
Nate Begeman
0ad33afe22 Support global addresses and fix call returns. Varargs still aren't
handled correctly for floating point arguments, or more than 8 arguemnts.
This does however, allow hello world to run.

llvm-svn: 20832
2005-03-25 08:34:25 +00:00
Chris Lattner
514e843e89 Enhance loopsimplify to preserve alias analysis instead of clobbering it.
This prevents crashes on some programs when using -ds-aa -licm.

llvm-svn: 20831
2005-03-25 06:37:22 +00:00
Chris Lattner
8d9f3735cd Treat free operations as volatile, since they cannot be moved. This fixes
Transforms/LICM/2005-03-24-LICM-Aggregate-Crash.ll

llvm-svn: 20830
2005-03-25 05:49:37 +00:00
Chris Lattner
b99c93c93b New testcase that crashes licm.
llvm-svn: 20829
2005-03-25 05:49:13 +00:00
Chris Lattner
faf7791fea Fix a bug where LICM was not updating AA information properly when sinking
a pointer value out of a loop causing it to be duplicated.

llvm-svn: 20828
2005-03-25 00:22:36 +00:00
Chris Lattner
3322e28f75 remove a debugging timer.
llvm-svn: 20827
2005-03-25 00:06:09 +00:00
Chris Lattner
278bac843c Two changes here:
1. Instead of copying Local graphs to the BU graphs to start with, use
     spliceFrom to do the job (which is constant time in this case).  On
     176.gcc, this chops off .17s from the bu pass.
  2. When building SCC graphs, simplify the logic and use spliceFrom to
     do the heavy lifting, instead of cloneInto/delete.  This slices
     another .14s off 176.gcc.

llvm-svn: 20826
2005-03-25 00:05:04 +00:00
Chris Lattner
a396eb8ae9 Make the spliceFrom case where one graph is completely empty be constant time.
llvm-svn: 20825
2005-03-25 00:02:41 +00:00
Chris Lattner
127dd12427 add a new DSGraph::spliceFrom method, which violently takes the content of
one graph and plops it into another, without breaking a sweat.

llvm-svn: 20824
2005-03-24 23:46:04 +00:00
Chris Lattner
56787258e7 add new spliceFrom methods.
llvm-svn: 20823
2005-03-24 23:45:20 +00:00
Nate Begeman
ad5151d785 Implement next round of Pattern ISel fixes
1. void returns
2. multiplies
3. calls

llvm-svn: 20822
2005-03-24 23:35:30 +00:00
Nate Begeman
3a9a2f9ec7 Fix an incorrect argument being passed to BuildMI for indirect calls.
llvm-svn: 20821
2005-03-24 23:34:38 +00:00
Chris Lattner
301764e28c This replaces the correct but slow code with a more aggressive scc-finder
based approach to find globals and call sites that need to be copied.  This
speeds up the BU pass on 176.gcc from 22s back up to 2.3s.  Not as good
as 1.5s, but at least it's correct :)

llvm-svn: 20820
2005-03-24 23:06:02 +00:00
Chris Lattner
1b5b559011 only look at successors of globals. This gets us down to "only" 22s in the
bu pass for 176.gcc

llvm-svn: 20818
2005-03-24 21:17:27 +00:00
Chris Lattner
189d7bb9ee Unfortunately, a previous patch was not safe. Revert it, reimplement
something correct. Unfortunately this takes 176.gcc's BU phase back
up to 29s from 1.5.  This fixes DSGraph/2005-03-24-Global-Arg-Alias.ll

llvm-svn: 20817
2005-03-24 21:07:47 +00:00
Nate Begeman
d73c87a424 Commit Gabor Greif's patch to use iterators in lowering intrinsics.
llvm-svn: 20816
2005-03-24 20:07:16 +00:00
Chris Lattner
923d925953 don't bother |'ing in 0's
llvm-svn: 20815
2005-03-24 18:42:51 +00:00
Chris Lattner
ba6006d84b be more aggressive about incompleteness marking
llvm-svn: 20814
2005-03-24 18:42:28 +00:00
Chris Lattner
299be4b42f new testcase that DS-AA is causing to be miscompiled.
llvm-svn: 20813
2005-03-24 17:57:43 +00:00
Chris Lattner
b15317b74a eliminate dead variables, patch contributed by Gabor Greif!
llvm-svn: 20812
2005-03-24 17:32:20 +00:00
Nate Begeman
7ec19b4d5a Implement more of the PPC32 Pattern ISel:
1) dynamic stack alloc
2) loads
3) shifts
4) subtract
5) immediate form of add, and, or, xor
6) change flag from -pattern-isel to -enable-ppc-pattern-isel

Remove dead arguments from getGlobalBaseReg in the simple ISel

llvm-svn: 20810
2005-03-24 06:28:42 +00:00
Chris Lattner
a3abb4c01a Fix silly "no newline at end of file" warning
llvm-svn: 20809
2005-03-24 06:16:18 +00:00
Chris Lattner
d6888355fa Fix compilation errors, patch contributed by the fabulous Bill Wendling!
llvm-svn: 20808
2005-03-24 05:13:53 +00:00
Chris Lattner
fed2a42895 fix a compilation error, patch contributed by Bill Wendling!
llvm-svn: 20807
2005-03-24 05:12:48 +00:00
Nate Begeman
20e7e28ee7 Addition of the PPC32 Pattern ISel. While it is far from complete, it will
be brought up to parity with the current simple ISel in the coming days.
Currently, -pattern-isel is required to trigger it.

llvm-svn: 20805
2005-03-24 04:41:43 +00:00
Nate Begeman
952105220e Remove comments that are now meaningless from the pattern ISels, at Chris's
request.

llvm-svn: 20804
2005-03-24 04:39:54 +00:00
Chris Lattner
19d7f2883d Fix a crash while promoting a value out of a loop from a global variable
when using ds-aa

llvm-svn: 20802
2005-03-24 04:22:04 +00:00
Chris Lattner
f0d919ece9 teach ds-aa about mod/ref for external function calls.
llvm-svn: 20801
2005-03-24 03:04:50 +00:00
Chris Lattner
aff85ac552 Simplify dead code into a fixme :)
llvm-svn: 20800
2005-03-24 02:41:19 +00:00
Chris Lattner
85a1d92323 fix a compiler crash in runtime/libprofile
llvm-svn: 20799
2005-03-24 01:22:52 +00:00
Chris Lattner
6a3f5fd623 wrap a long line
llvm-svn: 20797
2005-03-23 23:51:12 +00:00
Chris Lattner
2a7358064e If we are calling an external function, chain to another AA to potentially
decide, don't just immediately give up.

This implements GlobalsModRef/chaining-analysis.ll

llvm-svn: 20796
2005-03-23 23:49:47 +00:00
Chris Lattner
4baa138fad GlobalMR should be able to analyze this function.
llvm-svn: 20795
2005-03-23 23:48:56 +00:00
Chris Lattner
18ae9b911a if a function doesn't access memory at all, it definitely doesn't read it.
llvm-svn: 20794
2005-03-23 23:27:34 +00:00
Chris Lattner
8424b0f82e Make this more efficient by only making one virtual method call.
llvm-svn: 20793
2005-03-23 23:26:58 +00:00
Chris Lattner
07eac1e698 Make this a bit more aggressive
llvm-svn: 20792
2005-03-23 22:06:41 +00:00
Chris Lattner
9f9da538d6 a hack to allow count-aa to work with ds-aa :(
llvm-svn: 20791
2005-03-23 21:59:34 +00:00
Chris Lattner
ccb6faad7e Add two options to allow -count-aa to print queries either (1) all queries,
or (2) only queries that are not successful (e.g. return may alias)

llvm-svn: 20790
2005-03-23 21:59:07 +00:00
Misha Brukman
9c64d9c2b5 Fix grammar
llvm-svn: 20789
2005-03-23 21:14:33 +00:00
Chris Lattner
1c790bf656 enable -debug-only=licm
llvm-svn: 20788
2005-03-23 21:00:12 +00:00
Chris Lattner
61130216ec turn a dead conditional into an assert.
llvm-svn: 20787
2005-03-23 20:12:08 +00:00
Chris Lattner
01f0879c48 Totally gut mergeInGraph. There is absolutely no reason to be merging
global roots in from callees to callers.  The BU graphs do not have accurate
globals information and all of the clients know it.  Instead, just make sure
the GG is up-to-date, and they will be perfectly satiated.

This speeds up the BU pass on 176.gcc from 5.5s to 1.5s, and Loc+BU+TD
from 7s to 2.7s.

llvm-svn: 20786
2005-03-23 20:08:59 +00:00
Chris Lattner
048ae36b93 wrap a long line
llvm-svn: 20785
2005-03-23 16:43:11 +00:00
Andrew Lenharth
82f364515c don't lie to the register allocator
llvm-svn: 20784
2005-03-23 15:20:01 +00:00
Chris Lattner
e36d77b726 Make -steens-aa more conservative (aka correct) by making sure to obey
incompleteness flags.

Make it more aggressive by taking field sensitive information into
account.

llvm-svn: 20781
2005-03-23 01:48:09 +00:00
Tanya Lattner
13417b5be3 Added alias analysis.
Fixed many many bugs.
This now works on almost all Singlesource , and most of MultiSource.

llvm-svn: 20780
2005-03-23 01:47:20 +00:00
Chris Lattner
7d3df410ab implement Analysis/DSGraph/field-sensitive.ll
llvm-svn: 20779
2005-03-23 01:47:19 +00:00
Chris Lattner
17011d972a new testcase to verify that we have field sensitive alias analysis info. This
test cannot be satisfied without interprocedural information.

llvm-svn: 20778
2005-03-23 01:46:59 +00:00
Chris Lattner
70a402b9b8 make sure this test tests the intended target.
llvm-svn: 20777
2005-03-23 01:32:03 +00:00
Chris Lattner
dcb82f5d0a don't crash in some bad cases.
llvm-svn: 20776
2005-03-23 01:29:26 +00:00
Chris Lattner
310d1a3882 Several changes here:
1. Increase max node size from 64->256 to avoid collapsing an important
   structure in 181.mcf
2. If we have multiple calls to an indirect call node with an indirect
   callee, fold these call nodes together, to avoid DSA turning apoc into
   a flaming fireball of death when analyzing 176.gcc.
  With this change, 176.gcc now takes ~7s to analyze for loc+bu+td, with
  5.7s of that in the BU pass.

llvm-svn: 20775
2005-03-22 23:54:52 +00:00
Chris Lattner
5c971a0072 We might as well check the TD graphs as well, even though they are fine.
llvm-svn: 20774
2005-03-22 22:11:22 +00:00
Chris Lattner
ca174306f0 Mark external globals incomplete in the BU Globals graph, fixing
Analysis/DSGraph/2005-03-22-IncompleteGlobal.ll

llvm-svn: 20773
2005-03-22 22:10:22 +00:00
Chris Lattner
537dcf017c New testcase, the BU pass is marking the global complete in the globals graph.
llvm-svn: 20772
2005-03-22 22:07:15 +00:00
Tanya Lattner
8b953a1c32 Updating my entry.
llvm-svn: 20771
2005-03-22 21:33:19 +00:00
Chris Lattner
ecdc1ed631 Fix a serious bug where we didn't insert globals into the globalset when
cloning a graph.

llvm-svn: 20770
2005-03-22 19:44:11 +00:00
Andrew Lenharth
8180e87e51 hum, it is good to use real instructions
llvm-svn: 20769
2005-03-22 16:42:52 +00:00
Chris Lattner
f00684079a Directly count the number of memory instructions.
llvm-svn: 20766
2005-03-22 03:55:10 +00:00
Chris Lattner
24922c7a2b Timers SHOULD NOT record the time taken to count the bytes allocated in the heap!
llvm-svn: 20765
2005-03-22 03:20:38 +00:00
Chris Lattner
495f00946e Remove an iteration pass over the entire scalarmap for each function created
by not allowing integer constants to get into the scalar map in the first
place.

llvm-svn: 20764
2005-03-22 02:45:13 +00:00
Chris Lattner
250726ec25 When making a clone of a DSGraph from the BU pass, make sure to remember that
this clone is supposed to be used for *ALL* of the functions in the SCC.

This fixes the memory explosion problem the TD pass was having, reducing the
memory growth from 24MB -> 3.5MB on povray and 270MB ->8.3MB on perlbmk!
This obviously also speeds up the TD pass *a lot*.

llvm-svn: 20763
2005-03-22 01:50:42 +00:00
Chris Lattner
e05c633099 Don't use operator[], use the new method instead, which is faster. This speeds
up the TD pass about 30% for povray and perlbmk.  It's still not clear why
copying a 5MB set of graphs turns into a 25MB set of graphs though :(

llvm-svn: 20762
2005-03-22 01:42:59 +00:00
Chris Lattner
d0949a00be add a method
llvm-svn: 20761
2005-03-22 01:42:10 +00:00
Chris Lattner
fcae88f280 Now that the dead ctor is gone, nothing uses the old node mapping exported by
cloneInto: make it an internally used mapping.

llvm-svn: 20760
2005-03-22 00:36:51 +00:00
Chris Lattner
8016c975c9 remove a dead ctor
llvm-svn: 20759
2005-03-22 00:33:35 +00:00
Chris Lattner
ea2c02bcca now that the second argument is always this->ReturnNodes, don't bother passing it.
llvm-svn: 20758
2005-03-22 00:29:44 +00:00
Chris Lattner
571578143c instead of using a local RetValMap, just use the graph we are cloning into
for the return node map.

llvm-svn: 20757
2005-03-22 00:25:52 +00:00
Andrew Lenharth
6294dee913 two things: 1)evilness reduction patch, reduces the number of instructions hiding in the small jump CC moving code. 2)implement div of small data types by FP DIV (also reduces evilness and should speed things up)
llvm-svn: 20756
2005-03-22 00:24:07 +00:00
Chris Lattner
d05ab9cab4 now that the valuemapping is always the local scalar map, we can eliminate
this identity merge.

llvm-svn: 20755
2005-03-22 00:22:45 +00:00
Chris Lattner
19944fade3 remove the second argument to cloneInto
llvm-svn: 20754
2005-03-22 00:21:05 +00:00
Chris Lattner
d22030f8db drop the second argument to cloneInto, which is always the local scalar map.
llvm-svn: 20753
2005-03-22 00:20:56 +00:00
Chris Lattner
03b7f99338 add some timers, don't clone aux nodes
llvm-svn: 20752
2005-03-22 00:12:00 +00:00
Chris Lattner
410da35a1f move this out of line
llvm-svn: 20751
2005-03-22 00:09:45 +00:00
Chris Lattner
7b5fe1bdb6 move this stuff out of line
llvm-svn: 20750
2005-03-22 00:09:36 +00:00
Chris Lattner
5f10e6dda1 don't generate temporary scalarmaps.
llvm-svn: 20749
2005-03-22 00:04:21 +00:00
Chris Lattner
848ef879c5 allow passing clone flags down to cloneInto
llvm-svn: 20748
2005-03-21 22:49:53 +00:00
Chris Lattner
f9ef3f0bb4 allow passing clone flags into the ctor
llvm-svn: 20747
2005-03-21 22:49:43 +00:00
Chris Lattner
c1439d539f Enhance the TD pass to build composite graphs when we have indirect call
sites that target multiple callees.  If we have a function table, for
example, with N callees, and M callers call through it, we used to have
to perform O(M*N) graph inlinings.  Now we perform O(M+N) inlinings.

This speeds up the td pass on perlbmk from 36.26s to 25.75s.

llvm-svn: 20743
2005-03-21 20:31:29 +00:00
Chris Lattner
650cd59f28 add a new map
llvm-svn: 20742
2005-03-21 20:29:56 +00:00
Chris Lattner
d90f5bab82 make this const correct
llvm-svn: 20741
2005-03-21 20:28:50 +00:00
Chris Lattner
040426aee0 Fix a major problem where we didn't add call graph edges for call sites with
more than 1 callee.  This fixes Analysis/DSGraph/FunctionPointerTable-const.ll

llvm-svn: 20740
2005-03-21 20:20:49 +00:00
Chris Lattner
032b364fc4 New testcase, which is important to handle correctly.
llvm-svn: 20739
2005-03-21 20:18:51 +00:00
Misha Brukman
82ae9e1dda We may be adding functions to the Module during initialization, so
conservatively, it's modified

llvm-svn: 20735
2005-03-21 19:22:14 +00:00
Chris Lattner
bad17144d0 This error message changed.
llvm-svn: 20734
2005-03-21 17:55:41 +00:00
Chris Lattner
e8a43291cd Ugh, for some reason, I can't call this unless the reference is const!?!?!?
llvm-svn: 20732
2005-03-21 10:00:45 +00:00
Chris Lattner
13429dc5af The reachability cloner should add arguments to merged calls when the RHS of
the merge has more operands than the LHS.

llvm-svn: 20731
2005-03-21 09:39:51 +00:00
Chris Lattner
aa32b37885 Make the first operand of this method be modifiable.
llvm-svn: 20730
2005-03-21 09:39:20 +00:00
Chris Lattner
8632462267 add a method
llvm-svn: 20729
2005-03-21 09:38:39 +00:00
Chris Lattner
5204115d09 If merging two calls like: foo(A) and bar(B, C), make sure the result has two
arguments, not one.

llvm-svn: 20728
2005-03-21 09:18:39 +00:00
Chris Lattner
7269f15e8f 'note to self'
llvm-svn: 20727
2005-03-21 08:43:32 +00:00
Chris Lattner
a5f4b773d9 Remove a bunch of cruft and dead code for handling the case when types were
defined in function constant pools.  The assembler grammar has long
disallowed functions from having constant pools, so all of this stuff is
dead.

This makes it an immediate error for functions to refer to nonexisting
types, fixing Regression/Verifier/2005-03-21-UndefinedTypeReference.ll.

Before, references to non-existing types in functions would only be
detected when the subsequent function was parsed, due to the call to
"ResolveTypes".  "ResolveTypes" has not resolved any types for a long time,
instead it emitted an error message if no resolved types are left.  Since
the only caller of this method is in the module code, just inline it.

llvm-svn: 20726
2005-03-21 06:27:42 +00:00
Chris Lattner
a825b14278 New testcase that the assembler incorrectly accepts.
llvm-svn: 20725
2005-03-21 06:24:53 +00:00
Tanya Lattner
87ee2ba48d Make this method non-const. Making it const causes the const version of
getIGroup to be called instead of the non-const one.  These two methods
have (??) different behavior, so this change fixes bugs.

llvm-svn: 20724
2005-03-21 06:07:43 +00:00
Chris Lattner
98f7e1c370 Change the way that the TD pass inlines graphs. Instead of inlining each
graph into all of the functions it calls when we visit a graph, change it so
that the graph visitor inlines all of the callers of a graph into the current
graph when it visits it.

While we're at it, inline global information from the GG instead of from each
of the callers.  The GG contains a superset of the info that the callers do
anyway, and this way we only need to do it one time (not one for each caller).

This speeds up the TD pass substantially on several programs, and there is
still room for improvement.  For example, the TD pass used to take 147s
on perlbmk, it now takes 36s.  On povray, we went from about 5s to 1.97s.
134.perl is down from ~1s for Loc+BU+TD to .6s.

The TD pass needs a lot of improvement though, which will occur with later
patches.

llvm-svn: 20723
2005-03-21 04:55:35 +00:00
Chris Lattner
6a67d4a804 rename a method add a data structure.
llvm-svn: 20722
2005-03-21 04:46:35 +00:00
Chris Lattner
c8b4b7e314 Provide a guaranteed definition of intptr_t. Thansk to Evan Jones for
pointing this out!

llvm-svn: 20721
2005-03-21 01:36:35 +00:00
Chris Lattner
c5cdc2260d Don't strip modref bits when inlining down the call graph. This fixes
the DSGraph/2003-06-30-TopDownResolve.ll regression from last night.

llvm-svn: 20717
2005-03-20 18:02:56 +00:00
Chris Lattner
21ef7678d6 Remove the ability to keep track of inlined globals, which is always dead.
llvm-svn: 20716
2005-03-20 04:30:30 +00:00
Chris Lattner
6abefe7639 Remove the InlinedGlobals set which is always empty.
llvm-svn: 20715
2005-03-20 04:30:16 +00:00
Chris Lattner
571c62a008 This call is always a noop, remove it.
llvm-svn: 20714
2005-03-20 04:29:54 +00:00
Chris Lattner
b1cabb6541 remove some pointless asserts
llvm-svn: 20713
2005-03-20 04:29:39 +00:00
Chris Lattner
ded489ec3b -steens doesn't use the inlined globals facility.
llvm-svn: 20712
2005-03-20 04:23:57 +00:00
Chris Lattner
ff634f4e32 Build EC's for globals twice. The first is after constructing the initial
Globals Graph for the local pass, the second is after all of the locals
graphs have been constructed.  This allows for many additional global EC's
to be recognized that weren't before.  This speeds up analysis of programs
like 177.mesa, where it changes DSA from taking 0.712s to 0.4018s.

llvm-svn: 20711
2005-03-20 03:32:35 +00:00
Chris Lattner
36a810ac40 Add a new DSNode::removeGlobal method.
llvm-svn: 20710
2005-03-20 03:29:54 +00:00
Chris Lattner
0ebba657df add a method
llvm-svn: 20709
2005-03-20 03:29:39 +00:00
Chris Lattner
5ae215248f Transform BU pass to not use the horrible DSCallSiteIterator class.
llvm-svn: 20708
2005-03-20 02:42:07 +00:00
Chris Lattner
a550a5b173 Implement new methods for dealing with DSNode global lists, rename uses of
old methods.

llvm-svn: 20707
2005-03-20 02:41:38 +00:00
Chris Lattner
e68e808bcd use simpler methods.
llvm-svn: 20706
2005-03-20 02:41:16 +00:00
Chris Lattner
1ffdd57e0a method was renamed.
llvm-svn: 20705
2005-03-20 02:40:27 +00:00
Chris Lattner
5635a88fcb print out equiv class info.
llvm-svn: 20704
2005-03-20 02:40:11 +00:00
Chris Lattner
e7a8e8677e some methods got renamed
llvm-svn: 20703
2005-03-20 02:40:04 +00:00
Chris Lattner
711e083c26 Make use of simpler DSNode methods.
llvm-svn: 20702
2005-03-20 02:39:49 +00:00
Chris Lattner
9991eeb575 rename some methods and add some new methods for dealing with the globals list
in a DSNode.

llvm-svn: 20701
2005-03-20 02:38:39 +00:00
Chris Lattner
61f3befdc8 #ifdef out a function only used by #ifdef'd code.
llvm-svn: 20700
2005-03-20 02:14:15 +00:00
Chris Lattner
e965bd16bb comment cleanup
llvm-svn: 20699
2005-03-20 01:18:00 +00:00
Misha Brukman
42f1cfd637 Constant-propagate the value of `isL' variable and eliminate it.
llvm-svn: 20698
2005-03-19 23:39:50 +00:00
Jeff Cohen
f4ab9e5965 Silence VC++ warning about mixing intptr_t and bool, and about unused variable isL.
llvm-svn: 20697
2005-03-19 22:36:39 +00:00
Chris Lattner
9379e69af9 Create an equivalence class of global variables that DSA will never be able
to tell apart anyway, and only track the leader for of these equivalence
classes in our graphs.

This dramatically reduces the number of GlobalValue*'s that appear in scalar
maps, which A) reduces memory usage, by eliminating many many scalarmap entries
and B) reduces time for operations that need to execute an operation for each
global in the scalar map.

As an example, this reduces the memory used to analyze 176.gcc from 1GB to
511MB, which (while it's still way too much) is better because it doesn't hit
swap anymore.  On eon, this shrinks the local graphs from 14MB to 6.8MB,
shrinks the bu+td graphs of povray from 50M to 40M, shrinks the TD graphs of
130.li from 8.8M to 3.6M, etc.

This change also speeds up DSA on large programs where this makes a big
difference.  For example, 130.li goes from 1.17s -> 0.56s, 134.perl goes
from 2.14 -> 0.93s, povray goes from 15.63s->7.99s (!!!).

This also apparently either fixes the problem that caused DSA to crash on
perlbmk and gcc, or it hides it, because DSA now works on these.  These
both take entirely too much time in the TD pass (147s for perl, 538s for
gcc, vs 7.67/5.9s in the bu pass for either one), but this is a known
problem that I'll deal with later.

llvm-svn: 20696
2005-03-19 22:23:45 +00:00
Chris Lattner
4037048300 Make each scalar map contain a reference to an equivalence class of global
variables.  Do not insert a global into the scalar map unless it is the
leader of its equivalence class.

llvm-svn: 20695
2005-03-19 22:13:13 +00:00
Chris Lattner
1ce80fb008 Each DS collection now contains an equivalence class of globals values.
llvm-svn: 20694
2005-03-19 22:12:33 +00:00
Chris Lattner
6c5b90f36c add a method to clear globals from a node
llvm-svn: 20693
2005-03-19 22:12:03 +00:00
Chris Lattner
300dc0bc90 Two fixes for the copy ctor/operator=:
1. Make sure to clear() 'this' before adding elements to it
  2. Make sure that the leaders of the RHS EC are the leaders of the LHS EC.

llvm-svn: 20692
2005-03-19 21:02:12 +00:00
Chris Lattner
325f234d79 add some methods, fix a major bug in getLeader() that was causing things to
not be unified correctly.

llvm-svn: 20691
2005-03-19 20:42:43 +00:00
Chris Lattner
e6364c2702 implement a proper copy ctor, operator= and add a helper method.
llvm-svn: 20690
2005-03-19 19:26:14 +00:00
Chris Lattner
484bfc4d26 Fix the 3 regressions last night, due to my buggy patch from yesterday.
llvm-svn: 20689
2005-03-19 17:35:11 +00:00
Alkis Evlogimenos
9160d5fd8b Add new function getPtrPtrFromArrayPtr().
llvm-svn: 20684
2005-03-19 11:40:31 +00:00
Alkis Evlogimenos
1a48561432 Stop using deprecated interface.
llvm-svn: 20679
2005-03-19 09:22:17 +00:00
Chris Lattner
c1b9b56a2c Switch to use the new interface for the EquivalenceClasses class, and fix
a bug involving SCC's who have multiple members that are part of an EC.

llvm-svn: 20678
2005-03-19 05:15:27 +00:00
Chris Lattner
c3256647e7 Rewrite this class, making the following improvements:
1. It now actually uses tarjan's algorithm, so it is a efficient inverse
     ackerman's function for union operations, not linear time.
  2. It now stores one copy of the data in the set instead of two.
  3. It now works for elements other than pointers.
  4. It now has a more STL-like interface that exposes iterators instead
     of internal implementation details.

llvm-svn: 20677
2005-03-19 05:14:29 +00:00
Chris Lattner
bed1c18a44 do not bother inlining nullary functions without return values. The only
effect these calls can have is due to global variables, and these passes
all use the globals graph to capture their effect anyway.  This speeds up
the BU pass very slightly on perlbmk, reducing the number of dsnodes
allocated from 98913 to 96423.

llvm-svn: 20676
2005-03-18 23:19:47 +00:00
Chris Lattner
30525a04c1 fix a bogus assertion
llvm-svn: 20675
2005-03-18 23:18:30 +00:00
Chris Lattner
5bd948b4d7 another fastpath
llvm-svn: 20674
2005-03-18 23:18:20 +00:00
Chris Lattner
bed9657ff6 remove use of getPrev() and getNext() on ilist nodes.
llvm-svn: 20673
2005-03-18 16:12:37 +00:00
Chris Lattner
e29503a805 expose this pass to both opt and analyze
llvm-svn: 20672
2005-03-18 05:27:57 +00:00
Misha Brukman
f12594d56f We shall have IA64 as a new experimental backend released with LLVM 1.5
llvm-svn: 20671
2005-03-18 00:48:56 +00:00
Chris Lattner
a8e1a5250a remove a bogus optimization. This only works if there are no globals in the
graph, and the combination of a function that does not reference globals, takes
not arguments and returns no value is pretty rare.

llvm-svn: 20670
2005-03-18 00:23:59 +00:00
Chris Lattner
3f181d7880 Rewrite DSAA::getModRefInfo to compute the mapping between caller and callee
to determine mod/ref behavior, instead of creating a *copy* of the caller
graph and inlining the callee graph into the copy.

This speeds up aa-eval on Ptrdist/yacr2 from 109.13s to 3.98s, and gives
identical results.  The speedup is similar on other programs.

llvm-svn: 20669
2005-03-18 00:21:03 +00:00
Chris Lattner
b8d85c1a74 implement a new method.
llvm-svn: 20668
2005-03-17 23:45:54 +00:00
Chris Lattner
49ec9eeede add 3 methods
llvm-svn: 20667
2005-03-17 23:45:35 +00:00
Misha Brukman
72c27e6112 Recognize an IA64 when we see one
llvm-svn: 20666
2005-03-17 20:56:22 +00:00
Chris Lattner
488a80a292 add some possibly bogus assertions.
llvm-svn: 20665
2005-03-17 20:33:27 +00:00
Chris Lattner
9c9f68c42f Do not include the Function* for direct call/invoke instructions in the
alias evaluation.  Clients really don't care.

llvm-svn: 20664
2005-03-17 20:25:04 +00:00
Duraid Madina
8a3aa43422 typo/denial
llvm-svn: 20663
2005-03-17 20:23:27 +00:00
Chris Lattner
b5525529bd simplify this function a bit, allow DS-AA to build on/improve the mod/ref
results returned by AA, not just use one or the other.

llvm-svn: 20662
2005-03-17 20:16:58 +00:00
Chris Lattner
8dd1491e71 Clean up some code, handle null pointer specially to avoid an assertion
llvm-svn: 20660
2005-03-17 19:56:56 +00:00
Chris Lattner
ea7e6548dc Two changes:
1. Chain to the parent implementation of M/R analysis if we can't find
     any information.  It has some heuristics that often do well.
  2. Do not clear all flags, this can make invalid nodes by turning nodes
     that used to be collapsed into non-collapsed nodes (fixing crashes)

llvm-svn: 20659
2005-03-17 19:56:18 +00:00
Duraid Madina
df642ff2ae clean up warnings when building in release mode
llvm-svn: 20658
2005-03-17 19:00:40 +00:00
Duraid Madina
bf01370fc3 now the angry bug reports have somewhere to go!
llvm-svn: 20657
2005-03-17 18:57:02 +00:00
Chris Lattner
206f2ecaf2 statically link ia64 into llc
llvm-svn: 20656
2005-03-17 18:39:06 +00:00
Duraid Madina
a06265a119 OK, IA64 is statically linked into llc
llvm-svn: 20655
2005-03-17 18:37:05 +00:00
Duraid Madina
f5cc2c453d build the IA64 target as a .so for now
llvm-svn: 20654
2005-03-17 18:29:04 +00:00
Duraid Madina
e20f4cd1b0 dainty
llvm-svn: 20653
2005-03-17 18:23:22 +00:00
Duraid Madina
91ed0a11cf and so it begins...
PHASE 1: write instruction selector
PHASE 2: ???
PHASE 3: profit!

llvm-svn: 20652
2005-03-17 18:17:03 +00:00
Chris Lattner
43832b049e Don't emit two comparisons when comparing a FP value against zero!
llvm-svn: 20651
2005-03-17 16:29:26 +00:00
Chris Lattner
9fcfb35e1a spiff up the nightly tester output one more notch
llvm-svn: 20650
2005-03-17 16:07:45 +00:00
Chris Lattner
7b9020a059 Fix the missing symbols problem Bill was hitting. Patch contributed by
Bill Wendling!!

llvm-svn: 20649
2005-03-17 15:38:16 +00:00
Chris Lattner
5251047abd Do not create ridiculously huge DSNodes, as described in the comments.
This speeds up the BU pass on 172.mgrid from 62.3 -> 0.1242s.

llvm-svn: 20648
2005-03-17 05:25:34 +00:00
Chris Lattner
252f546ceb Fix a bug where we would consider " .99" and "1.0" different because of the
leading whitespace.

llvm-svn: 20647
2005-03-17 04:49:04 +00:00
Chris Lattner
6b6bdf602b remove compat_iterator, which is dead in the tree.
llvm-svn: 20644
2005-03-16 22:42:45 +00:00
Chris Lattner
62462c2314 remove use of compat_iterator.
llvm-svn: 20643
2005-03-16 22:42:19 +00:00
Chris Lattner
4559d5f5c0 remove use of compat_iterator
llvm-svn: 20642
2005-03-16 22:42:01 +00:00
Chris Lattner
267cfa042b Print out who commits and what files were modified at the bottom of the test summary log sent to llvm-commits.
llvm-svn: 20641
2005-03-16 17:09:53 +00:00
Jeff Cohen
44af33905a Do #include HashExtras.h with VC++
llvm-svn: 20640
2005-03-16 05:49:58 +00:00
Jeff Cohen
d4cc65f39d Don't provide default hash struct instantiation.
llvm-svn: 20639
2005-03-16 05:49:06 +00:00
Misha Brukman
96eb878f2a Convert tabs to spaces
llvm-svn: 20638
2005-03-16 05:42:00 +00:00
Jeff Cohen
9f15b5eb40 Add adapter class to let VC++ hash_map use GCC's hash struct.
llvm-svn: 20637
2005-03-16 05:25:09 +00:00
Jeff Cohen
2419195c1e Remove deleted files from VC++ project.
llvm-svn: 20636
2005-03-16 05:09:59 +00:00
Misha Brukman
3f922a3a37 Fix grammar wrt apostrophe's
llvm-svn: 20635
2005-03-16 03:54:50 +00:00
Misha Brukman
7fa86b98c3 Convert tabs to spaces
llvm-svn: 20634
2005-03-16 03:46:55 +00:00
Chris Lattner
018b093c79 fix some 80 column violations
Add support for programs that define main in a .a file, such as f2c'd programs.

llvm-svn: 20631
2005-03-15 23:03:34 +00:00
Chris Lattner
ebaf17875e consolidate LinkFiles into LinkItems, use lib_* iterators.
llvm-svn: 20630
2005-03-15 22:55:17 +00:00
Chris Lattner
d3d086d679 consolidate LinkLibraries into LinkItems
llvm-svn: 20629
2005-03-15 22:51:40 +00:00
Chris Lattner
f901355379 make sure to mark nodes in the globals graph incomplete after computing it
so that external globals (and whatever they point to) are marked incomplete.

llvm-svn: 20628
2005-03-15 22:47:18 +00:00
Chris Lattner
21a79edb27 fix crashes when we only have a prototype for main.
llvm-svn: 20627
2005-03-15 22:10:04 +00:00
Chris Lattner
dadf4b369e Fix a crash that happens when mapping something like this:
{ short, short }

to
  short

where the second short maps onto the second field of the first struct.  In
this case, the struct index is not aligned, so we should avoid calling
getLink(2), which asserts out.

llvm-svn: 20626
2005-03-15 21:36:50 +00:00
Andrew Lenharth
aa254d5f79 sure, I can set a flag, but if I never check it, why bother setting it? Should fix 20 programs :)
llvm-svn: 20623
2005-03-15 19:51:19 +00:00
Chris Lattner
dd3fb83f32 Make computeGGToGMapping compute an invnodemap
llvm-svn: 20622
2005-03-15 17:52:18 +00:00
Chris Lattner
6cd5d1adb6 remove warning, make computeGGToGMapping return an invnodemap.
llvm-svn: 20621
2005-03-15 17:52:07 +00:00
Chris Lattner
3918419c77 add support for hashing nodehandles.
llvm-svn: 20620
2005-03-15 17:51:51 +00:00
Chris Lattner
d31a3d0e82 Finally fix (the right way) the problem where functions like this:
void foo() {
  G = 1;
}

would have an empty DSGraph even though G (a global) is directly used
in the function.

llvm-svn: 20619
2005-03-15 17:14:09 +00:00
Chris Lattner
92d0c1c1ba Start using retnodes_* for iteration.
llvm-svn: 20618
2005-03-15 16:55:04 +00:00
Chris Lattner
f8c924bfcf add iterators for return nodes list.
llvm-svn: 20617
2005-03-15 16:46:11 +00:00
Chris Lattner
0bda00642f method renamed
llvm-svn: 20616
2005-03-15 15:48:22 +00:00
Chris Lattner
22b216a59e Replace more a*'s with arg_*'s, thanks to Gabor Greif!
llvm-svn: 20615
2005-03-15 15:48:06 +00:00
Chris Lattner
3779fd6521 add missing copyright header
llvm-svn: 20614
2005-03-15 15:46:23 +00:00
Alkis Evlogimenos
222dcd44ff Stop using abegin and aend.
llvm-svn: 20610
2005-03-15 07:20:55 +00:00
Alkis Evlogimenos
84adfd8c4f Stop using abegin.
llvm-svn: 20609
2005-03-15 07:12:30 +00:00
Alkis Evlogimenos
a67bafa568 Use arg_iterator and arg_begin and arg_end functions.
llvm-svn: 20608
2005-03-15 07:02:26 +00:00
Jeff Cohen
9bc0cc890e Add EquivClassGraphs.cpp to VC++ project.
llvm-svn: 20607
2005-03-15 06:31:46 +00:00
Chris Lattner
451fa32685 avoid varialbe name collisions
llvm-svn: 20606
2005-03-15 06:29:12 +00:00
Jeff Cohen
99c15a5d48 Do it right...
llvm-svn: 20605
2005-03-15 06:21:40 +00:00
Jeff Cohen
10be0f6f1b Fix VC++ breakage.
llvm-svn: 20604
2005-03-15 06:15:08 +00:00
Chris Lattner
6cb4559369 stop using method.
llvm-svn: 20603
2005-03-15 05:19:49 +00:00
Chris Lattner
bc18ef02ce methods removed.
llvm-svn: 20602
2005-03-15 05:19:20 +00:00
Chris Lattner
4d6b6d4d6e remove reverse BB iterators.
llvm-svn: 20601
2005-03-15 05:17:48 +00:00
Chris Lattner
57b2cd665b remove a whole bunch of dead methods. Noone should use reverse iterators anyway.
llvm-svn: 20600
2005-03-15 05:13:47 +00:00
Chris Lattner
fb972add4f stop using arg_front
llvm-svn: 20599
2005-03-15 05:03:36 +00:00
Chris Lattner
31c8a9d41a stop using arg_back
llvm-svn: 20598
2005-03-15 04:59:17 +00:00
Chris Lattner
531f9e92d4 This mega patch converts us from using Function::a{iterator|begin|end} to
using Function::arg_{iterator|begin|end}.  Likewise Module::g* -> Module::global_*.

This patch is contributed by Gabor Greif, thanks!

llvm-svn: 20597
2005-03-15 04:54:21 +00:00
Chris Lattner
5ce25cdc6d switch from a* to arg_* and g* to global_* for argument/global var iterators
llvm-svn: 20596
2005-03-15 04:48:32 +00:00
Chris Lattner
28f1caa639 Don't crash if computing a mapping to a node with zero size
llvm-svn: 20595
2005-03-15 04:40:24 +00:00
Chris Lattner
26415d7432 rename method, add counterpart
llvm-svn: 20593
2005-03-15 00:58:16 +00:00
Chris Lattner
9468d19ce9 Rename method, add counterpart.
llvm-svn: 20592
2005-03-15 00:58:09 +00:00
Chris Lattner
91e6ed6e36 Remove the reverse iterators for arguments and global vars.
Rename argument iterators arg_* instead of a*
Remove global variable iterators global_* instead of g*.

Keep the old names for temporary compatibility.

Patch contributed by Gabor Greif!

llvm-svn: 20591
2005-03-14 23:49:40 +00:00
Andrew Lenharth
0b9096bcc5 FP 0.0 setcc optimization, and generate short branch sequence for setcc(FP) rather than stack usage
llvm-svn: 20589
2005-03-14 19:23:45 +00:00
Chris Lattner
1bdb8b7e7e add a method to compute a commonly used mapping.
llvm-svn: 20588
2005-03-14 19:22:47 +00:00
Chris Lattner
40e2b71f7a Add a useful method.
llvm-svn: 20587
2005-03-14 19:22:33 +00:00
Chris Lattner
9071175625 regardless of whether or not the client things we should mark globals incomplete,
ALWAYS mark them incomplete if they are external!

llvm-svn: 20586
2005-03-13 20:36:01 +00:00
Chris Lattner
b9e2a4dec0 Make sure to remove incomplete markers before we add to them! :)
llvm-svn: 20585
2005-03-13 20:32:26 +00:00
Chris Lattner
5a6609771a The incoming arguments to main (the argv list) are not complete!
llvm-svn: 20584
2005-03-13 20:22:10 +00:00
Chris Lattner
2eff970892 After finishing BU analysis, move all global variables from the globals
graph into main and mark them complete.

llvm-svn: 20583
2005-03-13 20:15:06 +00:00
Chris Lattner
68c3caccb1 ADd support for printing eqgraphs.
llvm-svn: 20582
2005-03-13 19:51:24 +00:00
Chris Lattner
db98a9745a Add support for printing EQ graphs
llvm-svn: 20581
2005-03-13 19:50:40 +00:00
Chris Lattner
9cc2c3e9d6 Replace linear search with logrithmic one.
llvm-svn: 20580
2005-03-13 19:05:05 +00:00
Chris Lattner
3434004dce add a StructLayout::getElementContainingOffset method.
llvm-svn: 20579
2005-03-13 19:04:41 +00:00
Chris Lattner
e15f891bf0 add a helper method
llvm-svn: 20578
2005-03-13 19:04:04 +00:00
Andrew Lenharth
af9a15fe64 Should fix mesa
llvm-svn: 20577
2005-03-13 00:43:20 +00:00
Chris Lattner
97ac0a8780 make sure to mark nodes returned from functions as incomplete
llvm-svn: 20576
2005-03-12 14:58:28 +00:00
Chris Lattner
dd6bcbe820 remove this from the PA namespace, leaving it in the llvm ns
llvm-svn: 20574
2005-03-12 12:08:52 +00:00
Chris Lattner
2dd9a09837 Move this from the pool allocator project to here, where it logically belongs.
llvm-svn: 20570
2005-03-12 11:51:30 +00:00
Chris Lattner
a945923045 this doesn't fail on the suns either!
llvm-svn: 20567
2005-03-12 03:43:38 +00:00
Misha Brukman
8f3df64397 Move link to GCC prefetch info here, since it's gone from Open Projects page
llvm-svn: 20566
2005-03-11 21:18:18 +00:00
Chris Lattner
90e6ff073c this passes on darwin
llvm-svn: 20565
2005-03-11 21:18:00 +00:00
Chris Lattner
5490aae863 Fix computation of compiled objects, contributed by Vladimir Merzliakov!
llvm-svn: 20564
2005-03-11 20:17:04 +00:00
Andrew Lenharth
27a3df07a0 remove a pseudo instruction and improve inline constant generation
llvm-svn: 20563
2005-03-11 17:48:05 +00:00
Chris Lattner
db302f899a prefetch is now supported.
llvm-svn: 20562
2005-03-11 06:16:26 +00:00
Chris Lattner
c2fdf33162 new testcase for __builtin_prefetch support.
llvm-svn: 20561
2005-03-11 06:14:23 +00:00
Misha Brukman
9d72af0489 * Remove extraneous spaces
* Convert some tabs to spaces

llvm-svn: 20560
2005-03-11 04:15:18 +00:00
Nate Begeman
5f399bb2fe Add SelectionDAG library to PPC JIT so that lli will link when
PPC32ISelPattern.cpp is present.

llvm-svn: 20559
2005-03-11 03:58:53 +00:00
Chris Lattner
8227a51c10 Fix some crashes noted by John Mellor-Crummey's group.
llvm-svn: 20558
2005-03-11 00:00:56 +00:00
Misha Brukman
922bf92b08 Sprinkle code examples and command-line interaction examples with some style
llvm-svn: 20557
2005-03-11 00:00:33 +00:00
Misha Brukman
5da60ba6aa * Add directions to send output of nightly test script to llvm-testresults@cs
* Use the doc_code class to nightly test script example
* Enclose file names in <tt> tags
* Achieve compliance with HTML-4.01 Strict

llvm-svn: 20556
2005-03-10 22:51:59 +00:00
Chris Lattner
6f6ecad995 I didn't mean to check this in. :(
llvm-svn: 20555
2005-03-10 20:59:51 +00:00
Chris Lattner
85e7163947 Fix a bug where we would incorrectly do a sign ext instead of a zero ext
because we were checking the wrong thing.  Thanks to andrew for pointing
this out!

llvm-svn: 20554
2005-03-10 20:55:51 +00:00
Andrew Lenharth
7054073bb6 yay for camel_cvs diff
llvm-svn: 20552
2005-03-10 20:15:09 +00:00
Andrew Lenharth
7728eb7b80 some typoes and .bss isn't liked, at all
llvm-svn: 20542
2005-03-10 19:02:02 +00:00
Misha Brukman
df5b6d3921 Replace tabs with spaces, separate function arguments with a space
llvm-svn: 20538
2005-03-10 16:32:33 +00:00
Chris Lattner
2aade22c67 Improve formatting of the sent mail for the dj test results.
llvm-svn: 20537
2005-03-10 16:26:50 +00:00
Chris Lattner
76aa8e071b Allow the live interval analysis pass to be a bit more aggressive about
numbering values in live ranges for physical registers.

The alpha backend currently generates code that looks like this:

  vreg = preg
...
  preg = vreg
  use preg
...
  preg = vreg
  use preg

etc.  Because vreg contains the value of preg coming in, each of the
copies back into preg contain that initial value as well.

In the case of the Alpha, this allows this testcase:

void "foo"(int %blah) {
        store int 5, int *%MyVar
        store int 12, int* %MyVar2
        ret void
}

to compile to:

foo:
        ldgp $29, 0($27)
        ldiq $0,5
        stl $0,MyVar
        ldiq $0,12
        stl $0,MyVar2
        ret $31,($26),1

instead of:

foo:
        ldgp $29, 0($27)
        bis $29,$29,$0
        ldiq $1,5
        bis $0,$0,$29
        stl $1,MyVar
        ldiq $1,12
        bis $0,$0,$29
        stl $1,MyVar2
        ret $31,($26),1

This does not seem to have any noticable effect on X86 code.

This fixes PR535.

llvm-svn: 20536
2005-03-09 23:05:19 +00:00
Andrew Lenharth
8145fec740 minor correction for Register that isn't used
llvm-svn: 20535
2005-03-09 20:48:23 +00:00
Chris Lattner
7f26946709 constant fold FP_ROUND_INREG, ZERO_EXTEND_INREG, and SIGN_EXTEND_INREG
This allows the alpha backend to compile:

bool %test(uint %P) {
        %c = seteq uint %P, 0
        ret bool %c
}

into:

test:
        ldgp $29, 0($27)
        ZAP $16,240,$0
        CMPEQ $0,0,$0
        AND $0,1,$0
        ret $31,($26),1

instead of:

test:
        ldgp $29, 0($27)
        ZAP $16,240,$0
        ldiq $1,0
        ZAP $1,240,$1
        CMPEQ $0,$1,$0
        AND $0,1,$0
        ret $31,($26),1

... and fixes PR534.

llvm-svn: 20534
2005-03-09 18:37:12 +00:00
Chris Lattner
b1d901427a correct the computation of the isAbstract bit for types.
llvm-svn: 20533
2005-03-09 17:34:27 +00:00
Chris Lattner
562c180879 Fix Regression/Analysis/BasicAA/2005-03-09-BrokenBasicAA.ll, a miscompilation
that Alkis found with Java, thanks Alkis!

llvm-svn: 20531
2005-03-09 16:29:52 +00:00
Chris Lattner
623bb75d35 new testcase for a -basicaa bug that Alkis found with Java.
llvm-svn: 20530
2005-03-09 16:29:22 +00:00
Reid Spencer
f064bb2617 Fix a typo in an assertion comment.
Patch contributed by Vladimir Merzliakov.

llvm-svn: 20529
2005-03-09 15:19:41 +00:00
Chris Lattner
4dc39d447d Use static_cast and #include Instructions.h
llvm-svn: 20528
2005-03-09 05:35:16 +00:00
Chris Lattner
adb043c2d8 Export two methods for getting -X and A-B.
llvm-svn: 20527
2005-03-09 05:34:41 +00:00
Chris Lattner
bc6b18e6d3 export two methods
llvm-svn: 20526
2005-03-09 05:34:23 +00:00
Chris Lattner
b9f0cebeb5 get bugpoint working on ia64, by building .so's with -fpic. :)
llvm-svn: 20525
2005-03-09 03:31:02 +00:00
Chris Lattner
1f1462fafa Fix a crash handling 'undef bool', fixing an llc crash on 186.crafty
llvm-svn: 20523
2005-03-08 22:53:09 +00:00
Reid Spencer
00658b80fb Patch to make assembly output compatible with mingw compilation (identical
to cygwin)

llvm-svn: 20520
2005-03-08 17:02:05 +00:00
Chris Lattner
ea50620eec Make sure to remove all dead type names from the symbol table, not just
struct types.  This fixes Regression/CodeGen/CBackend/2005-03-08-RecursiveTypeCrash.ll,
a crash on Java output that Alkis reported.

llvm-svn: 20519
2005-03-08 16:19:59 +00:00
Chris Lattner
7c303235b4 new testcase that crashes the CBE.
llvm-svn: 20518
2005-03-08 16:19:02 +00:00
Jeff Cohen
e77909805b Clarify inability to generate assembly, and note that VC++ Express works.
llvm-svn: 20516
2005-03-08 03:56:50 +00:00
Misha Brukman
20238eb963 Single characters should be printed out as chars, not strings.
llvm-svn: 20515
2005-03-08 00:26:08 +00:00
Chris Lattner
455fc8c917 Various cleanups and clarifications, thanks to Gabor Greif for contributing this patch!
llvm-svn: 20514
2005-03-07 22:13:59 +00:00
Chris Lattner
4604436b29 Fix problems compiling with G++ 4.x.x with -pedantic. Thanks to
Vladimir Merzliakov for the patch!

llvm-svn: 20513
2005-03-07 20:35:45 +00:00
Chris Lattner
d3e641c2ab fix another typo
llvm-svn: 20512
2005-03-07 20:31:38 +00:00
Chris Lattner
2e6eb5f40d fix typeo that Gabor Greif noticed!
llvm-svn: 20511
2005-03-07 20:30:51 +00:00
Chris Lattner
a9beaacac6 move the reassociation pass after the LICM pass. This speeds up mgrid
from 10.27s to 9.57s with the CBE.

llvm-svn: 20508
2005-03-07 03:19:50 +00:00
Chris Lattner
e9328b319c Fix an apparent ambiguity compiling on PPC
llvm-svn: 20507
2005-03-07 02:59:36 +00:00
Chris Lattner
8c79559443 fix a bug where we thought arguments were constants :(
llvm-svn: 20506
2005-03-06 22:52:29 +00:00
Chris Lattner
2ce303b406 Fix Regression/Transforms/LoopStrengthReduce/dont_insert_redundant_ops.ll,
hopefully not breaking too many other things.

llvm-svn: 20505
2005-03-06 22:36:12 +00:00
Chris Lattner
5991cf77b2 cleanup the test
llvm-svn: 20504
2005-03-06 22:24:45 +00:00
Chris Lattner
1173c52d82 check that we only insert one phi node per loop
llvm-svn: 20503
2005-03-06 22:23:31 +00:00
Chris Lattner
392a0bba42 Add testcase for this:
(3) Do not reduce element sizes of small power of two:

  char s[10];
  for (i)
    ...s[i] ...

when the indvar is not eliminable.

llvm-svn: 20502
2005-03-06 22:15:24 +00:00
Chris Lattner
45403e5052 implement Transforms/LoopStrengthReduce/invariant_value_first_arg.ll
llvm-svn: 20501
2005-03-06 22:06:22 +00:00
Chris Lattner
656a6e37e1 testcase for A[invariant][indvar] where invariant is an instruction.
llvm-svn: 20500
2005-03-06 22:06:09 +00:00
Chris Lattner
ab00dc30df add test for this:
(1) Allow loop invariant expressions to come before the induction variable (instead of just
constants):

   int x;
   for (i)
    ...a[x][i]

llvm-svn: 20499
2005-03-06 22:04:27 +00:00
Chris Lattner
97b8cbff7c Add test for this:
Allow operands after the induction variable (no restrictions):

  int x;
  for (i)
   j = .....
   a[i][x][j]

llvm-svn: 20498
2005-03-06 22:01:42 +00:00
Chris Lattner
d3874fad44 minor simplifications of the code.
llvm-svn: 20497
2005-03-06 21:58:22 +00:00
Chris Lattner
9cd727c2ee a regtest
llvm-svn: 20496
2005-03-06 21:47:40 +00:00
Chris Lattner
78f166c6ab new directory
llvm-svn: 20495
2005-03-06 21:42:59 +00:00
Chris Lattner
dd3ec92085 trivial simplification
llvm-svn: 20494
2005-03-06 21:35:38 +00:00
Chris Lattner
238f6df546 Fix a bug where we could corrupt a parent loop's header info if we unrolled
a nested loop.  This fixes Transforms/LoopUnroll/2005-03-06-BadLoopInfoUpdate.ll
and PR532

llvm-svn: 20493
2005-03-06 20:57:32 +00:00
Chris Lattner
1c69aab68b New testcase for PR532
llvm-svn: 20492
2005-03-06 20:56:55 +00:00
Chris Lattner
6aa5f97a05 new helper method
llvm-svn: 20491
2005-03-06 20:55:34 +00:00
Chris Lattner
a93419c8df new testcase reduced from the MultiSource/Applications/d failure last night.
llvm-svn: 20490
2005-03-06 19:40:19 +00:00
Chris Lattner
5de9dec0d1 move some method declarations around to make it clear that users should
not call insert(Value *Val), remove(Value* Val), or
changeName(Value *V, const std::string &Name)

llvm-svn: 20488
2005-03-06 06:03:44 +00:00
Chris Lattner
96b7bf6244 this method is never called.
llvm-svn: 20487
2005-03-06 06:00:24 +00:00
Chris Lattner
897cc8e1ec cleanup some html
remove a statement that is no longer true
remove comment about a dead method.

llvm-svn: 20486
2005-03-06 06:00:13 +00:00
Chris Lattner
19d1c03311 the only caller of insertEntry is insert, inline it and remove insertEntry
llvm-svn: 20485
2005-03-06 05:56:02 +00:00
Chris Lattner
86fe3a1fdb rename insertEntry to insert
llvm-svn: 20484
2005-03-06 05:55:40 +00:00
Chris Lattner
533805e6da Merge SymbolTable::removeEntry into SymbolTable::remove, its only caller
llvm-svn: 20483
2005-03-06 05:51:09 +00:00
Chris Lattner
7dfb29d5cb remove this method.
llvm-svn: 20482
2005-03-06 05:50:49 +00:00
Chris Lattner
290d881f84 Delete the really inefficient method: void remove(const Type* Typ);
Speed up the symbol stripping code by avoiding a linear search of the
type table.

Get rid of removeEntry(type_iterator), since 'remove' is exactly the same
operation.

llvm-svn: 20481
2005-03-06 05:46:41 +00:00
Chris Lattner
aa4138a5da Delete the really inefficient method: void remove(const Type* Typ);
Get rid of removeEntry(type_iterator), since 'remove' is exactly the same
operation.

llvm-svn: 20480
2005-03-06 05:46:00 +00:00
Chris Lattner
1b032f59e7 Make this MUCH faster by avoiding a linear search in the symbol table code.
llvm-svn: 20479
2005-03-06 05:42:36 +00:00
Chris Lattner
bcd8393d50 InternallyInconsistent is dead!
llvm-svn: 20478
2005-03-06 05:22:05 +00:00
Chris Lattner
bad0e7e2d9 Remove some really gross and hard to understand code now that
InternallyInconsistent is always false.

llvm-svn: 20477
2005-03-06 05:21:40 +00:00
Chris Lattner
cd56f5a8e4 Simplify some code.
llvm-svn: 20476
2005-03-06 05:13:42 +00:00
Chris Lattner
6be3b418e7 remove these dead methods.
llvm-svn: 20475
2005-03-06 02:38:24 +00:00
Chris Lattner
eb9a12cbce remove these methods.
llvm-svn: 20474
2005-03-06 02:37:47 +00:00
Chris Lattner
807db03233 These methods are removed.
llvm-svn: 20473
2005-03-06 02:37:21 +00:00
Chris Lattner
8a982e10be simplify and speed up some code
llvm-svn: 20472
2005-03-06 02:32:00 +00:00
Chris Lattner
c9b0984666 simplify some code.
llvm-svn: 20471
2005-03-06 02:28:23 +00:00
Chris Lattner
8344ba0dac nuke some dead methods.
llvm-svn: 20470
2005-03-06 02:25:02 +00:00
Chris Lattner
ffb3778f87 This fixes PR531, a crash when running the CBE on a bytecode file.
The problem is that Function::renameLocalSymbols is iterating through
the symbol table planes, occasionally calling setName to rename a value
(which used to do a symbol table remove/insert pair).

The problem is that if there is only a single value in a particular type
plane that the remove will nuke the symbol table plane, and the insert
will create and insert a new one.  This hoses Function::renameLocalSymbols
because it has an iterator to the old plane, under the (very reasonable)
assumption that simply renaming a value won't cause the type plane to
disappear.

This patch fixes the bug by making the rename operation a single atomic
operation, which has a side effect of making the whole thing faster too. :)

llvm-svn: 20469
2005-03-06 02:14:28 +00:00
Chris Lattner
bb28bfdcbf Add a new method, allow symtab to poke name.
llvm-svn: 20468
2005-03-06 02:10:40 +00:00
Jeff Cohen
4abcea3a69 Reformat comments to fix 80 columns.
llvm-svn: 20467
2005-03-05 22:45:40 +00:00
Jeff Cohen
be37fa07fd Reuse induction variables created for strength-reduced GEPs by other similar GEPs.
llvm-svn: 20466
2005-03-05 22:40:34 +00:00
Chris Lattner
9d0ac507ba remove extraneous spaces from argument lists.
llvm-svn: 20465
2005-03-05 19:58:40 +00:00
Chris Lattner
cdb9bfc150 remove all of the various setName implementations, consolidating them into
Value::setName, which is no longer virtual.

llvm-svn: 20464
2005-03-05 19:51:50 +00:00
Chris Lattner
6d0a24c608 second argument to Value::setName is now gone.
llvm-svn: 20463
2005-03-05 19:05:20 +00:00
Chris Lattner
7c832fb0b2 Make sure the two arguments of a setcc instruction point to the same node.
llvm-svn: 20462
2005-03-05 19:04:31 +00:00
Chris Lattner
aa72c889a6 zap
llvm-svn: 20461
2005-03-05 19:04:07 +00:00
Chris Lattner
f66165674f 2nd arg to setName goes away.
llvm-svn: 20460
2005-03-05 19:02:15 +00:00
Chris Lattner
cc77b84fcb Constants never get names.
llvm-svn: 20459
2005-03-05 19:01:59 +00:00
Chris Lattner
ed2fb1cf93 Remove the 2nd argument to Value::setName
llvm-svn: 20458
2005-03-05 19:01:49 +00:00
Chris Lattner
f18c871b58 Remove the second argument to Value::setName, it is never needed.
llvm-svn: 20457
2005-03-05 18:59:36 +00:00
Chris Lattner
15ac102737 New testcase for PR533
llvm-svn: 20456
2005-03-05 18:47:28 +00:00
Chris Lattner
f246ef3e2f don't break the build on 32-bit hosts.
llvm-svn: 20455
2005-03-05 17:47:38 +00:00
Chris Lattner
02f0d7bcc9 This file is all commented out.
llvm-svn: 20454
2005-03-05 17:28:37 +00:00
Andrew Lenharth
7c954c6d13 fix data size stuff for architectures with bit challenged data types
llvm-svn: 20453
2005-03-05 15:30:33 +00:00
Chris Lattner
cfe2822cdf Do not compute 1ULL << 64, which is undefined. This fixes Ptrdist/ks on the
sparc, and testcase Regression/Transforms/InstCombine/2005-03-04-ShiftOverflow.ll

llvm-svn: 20445
2005-03-04 23:21:33 +00:00
Chris Lattner
6cc4ee0f24 Testcase for a bug that caused us to miscompile ptrdist/ks on sparc.
llvm-svn: 20444
2005-03-04 23:20:46 +00:00
Andrew Lenharth
f3cd1477c3 fix up stack pointer adjustments
llvm-svn: 20442
2005-03-04 21:40:02 +00:00
Chris Lattner
c01e2f76c3 Trivial cleanup patch
llvm-svn: 20436
2005-03-04 20:27:46 +00:00
Andrew Lenharth
8df62dda57 fix FCMOVxx typo, set rem and div to hardcode target reg to be the same as the one the assembler uese, update ISel to put values in regs used by assembler for rem and div
llvm-svn: 20434
2005-03-04 20:09:23 +00:00
Jeff Cohen
a2c59b7423 Add support for not strength reducing GEPs where the element size is a small
power of two.  This emphatically includes the zeroeth power of two.

llvm-svn: 20429
2005-03-04 04:04:26 +00:00
Andrew Lenharth
f0ab14aa24 turn on IEEE for compares
llvm-svn: 20425
2005-03-03 22:12:11 +00:00
Andrew Lenharth
6a5f52d15a beter Select on FP
llvm-svn: 20424
2005-03-03 21:47:53 +00:00
Chris Lattner
00ee68c612 Print -X like this:
double test(double l1_X) {
  return (-l1_X);
}

instead of like this:

double test(double l1_X) {
  return (-0x0p+0 - l1_X);
}

llvm-svn: 20423
2005-03-03 21:12:04 +00:00
Andrew Lenharth
00348ce902 LSR cleanup patch
llvm-svn: 20422
2005-03-03 19:03:21 +00:00
Chris Lattner
1a678c67c9 Do not lower malloc's to pass "sizeof" expressions like this:
ltmp_0_7 = malloc(((unsigned )(&(((signed char (*)[784])/*NULL*/0)[1u]))));

Instead, just emit the literal constant, like this:

  ltmp_0_7 = malloc(784u);

This works around a bug in ICC 8.1 compiling the CBE generated code.  :-(

llvm-svn: 20415
2005-03-03 01:04:50 +00:00
Chris Lattner
ef1e989e4f Add an optional argument to lower to a specific constant value instead of
to a "sizeof" expression.

llvm-svn: 20414
2005-03-03 01:03:43 +00:00
Chris Lattner
3b5667c579 Add an argument.
llvm-svn: 20413
2005-03-03 01:03:10 +00:00
Misha Brukman
f090d1b3ab Fix the spelling of the word `the'
llvm-svn: 20412
2005-03-02 23:17:31 +00:00
Chris Lattner
4d8689edcb Print the module ID as a comment.
llvm-svn: 20411
2005-03-02 23:12:40 +00:00
Chris Lattner
5b5caaf3cd cleanup the cfg after lsr
llvm-svn: 20410
2005-03-02 21:56:00 +00:00
Andrew Lenharth
180a04a4bb remove 32 sign extend after 32 sextload and handle small negative constant
llvm-svn: 20408
2005-03-02 17:23:03 +00:00
Andrew Lenharth
ed4b6488a7 Added LSR as a beta pass for alpha
llvm-svn: 20407
2005-03-02 17:21:38 +00:00
Chris Lattner
c8bb99760a Add a temporary option for llc-beta: -enable-lsr-for-ppc, which turns on
Loop Strength Reduction.

llvm-svn: 20399
2005-03-02 06:19:22 +00:00
Reid Spencer
a556669219 Be slightly more accurate in an error message.
llvm-svn: 20397
2005-03-02 05:45:56 +00:00
Chris Lattner
fe760deb75 Fix a nasty order of evaluation bug that Gabor Greif ran into. Here's an
explanation from IRC:

	|sabre|	I think it's an order of evaluation thing
	|sabre|	for me, the RHS of the assignment is evaluated first
	|sabre|	getTypeDescription checks to see if ConcreteTypeDescription[Ty] contains anything
	|sabre|	since it doesn't, it computes and returns the value
	|sabre|	this gets put into the map.
	|sabre|	For you, the LHS is evaluated first.
	|sabre|	Map[Ty] (aka ConcreteTypeDescriptions[Ty]) inserts an empty string into the map, returning a reference
	|sabre|	getTypeDesc then sees the empty string in the map
	|sabre|	and returns it
	|sabre|	bork :)

llvm-svn: 20394
2005-03-02 03:54:43 +00:00
Chris Lattner
884ebd4c79 Now that type does not derive from Value, these do not need to be virtual.
llvm-svn: 20393
2005-03-02 03:43:55 +00:00
Misha Brukman
e4fad6b70f Fix HTML-4.01 Strict compliance
llvm-svn: 20386
2005-03-01 17:19:21 +00:00
Misha Brukman
a9b8676393 Use a colon instead of a period since we're introducing a command list
llvm-svn: 20385
2005-03-01 17:15:23 +00:00
Reid Spencer
fefb9ea94d Correct a typo in Makefile.rules.
Patch idea contributed by Vladimir Merzliakov.

llvm-svn: 20384
2005-03-01 16:27:06 +00:00
Jeff Cohen
8ea6f9e821 Fixed the following LSR bugs:
* Loop invariant code does not dominate the loop header, but rather
    the end of the loop preheader.

  * The base for a reduced GEP isn't a constant unless all of its
    operands (preceding the induction variable) are constant.

  * Allow induction variable elimination for the simple case after all.

Also made changes recommended by Chris for properly deleting
instructions.

llvm-svn: 20383
2005-03-01 03:46:11 +00:00
Alkis Evlogimenos
b3846f4b06 Lower llvm.isunordered(a, b) into a != a | b != b.
llvm-svn: 20382
2005-03-01 02:07:58 +00:00
Chris Lattner
ff851073f6 cleanup my miswording
llvm-svn: 20381
2005-02-28 19:47:14 +00:00
Chris Lattner
12328e9378 Remove tabs from file.
llvm-svn: 20380
2005-02-28 19:36:15 +00:00
Chris Lattner
5d43cbc6ac Add a test for llvm.prefetch.
llvm-svn: 20379
2005-02-28 19:31:42 +00:00
Chris Lattner
811107350a Add support to the C backend for llvm.prefetch. Patch contributed by
Justin Wick!

llvm-svn: 20378
2005-02-28 19:29:46 +00:00
Chris Lattner
1772c1a672 recognize llvm.prefetch. Patch contributed by Justin Wick!
llvm-svn: 20377
2005-02-28 19:28:00 +00:00
Chris Lattner
39637ef023 Verify llvm.prefetch.
llvm-svn: 20376
2005-02-28 19:27:42 +00:00
Chris Lattner
c87e03aeea Lower prefetch to a noop, patch contributed by Justin Wick!
llvm-svn: 20375
2005-02-28 19:27:23 +00:00
Chris Lattner
816cc5e10d Add a prefetch intrinsic, patch contributed by Justin Wick!
llvm-svn: 20374
2005-02-28 19:25:57 +00:00
Chris Lattner
c8a2c22f36 Document llvm.prefetch, patch contributed by Justin Wick!
llvm-svn: 20373
2005-02-28 19:24:19 +00:00
Andrew Lenharth
76eff48195 fix integer division and stuff
llvm-svn: 20372
2005-02-28 17:22:18 +00:00
Chris Lattner
81c1dd2a06 Adam Treat implemented this :)
llvm-svn: 20371
2005-02-28 16:52:28 +00:00
Reid Spencer
9947c42037 Changes to enable creation of native executables directly from gccld and to
ensure that -L paths don't contain both bytecode and native libraries.
This patch contributed by Adam Treat.

llvm-svn: 20370
2005-02-28 08:45:35 +00:00
Reid Spencer
35cb2f49c4 A few small steps toward HTML 4.01 Strict compliance.
llvm-svn: 20369
2005-02-28 01:10:48 +00:00
Reid Spencer
da132f2fdf Add a little more detail about the configuration process for projects.
llvm-svn: 20368
2005-02-28 00:40:29 +00:00
Jeff Cohen
dcaa48b5c4 Fix crash in LSR due to attempt to remove original induction variable. However,
for reasons explained in the comments, I also deactivated this code as it needs
more thought.

llvm-svn: 20367
2005-02-28 00:08:56 +00:00
Jeff Cohen
fd63d3af0d PHI nodes were incorrectly placed when more than one GEP is reduced in a loop.
llvm-svn: 20360
2005-02-27 21:08:04 +00:00
Jeff Cohen
39751c3b7c First pass at improved Loop Strength Reduction. Still not yet ready for prime time.
llvm-svn: 20358
2005-02-27 19:37:07 +00:00
Chris Lattner
c6e3380fd7 Bug fixed
llvm-svn: 20357
2005-02-27 19:31:02 +00:00
Chris Lattner
cf1359ddf5 New testcase for PR529
llvm-svn: 20356
2005-02-27 19:28:30 +00:00
Chris Lattner
2fe7b71936 Fix this to create a recursive mutex. Patch by Evan Jones!
llvm-svn: 20355
2005-02-27 19:07:36 +00:00
Chris Lattner
7f32c4aa36 Use const iterators where possible. Patch by Evan Jones!
llvm-svn: 20354
2005-02-27 19:06:10 +00:00
Chris Lattner
eeffe8eea3 Rename include guard, patch contributed by Evan Jones!
llvm-svn: 20353
2005-02-27 19:05:24 +00:00
Chris Lattner
7561ca1d15 Teach globalopt how memset/cpy/move affect memory, to allow better optimization.
llvm-svn: 20352
2005-02-27 18:58:52 +00:00
Chris Lattner
a1079acb0a new testcase globalopt should handle.
llvm-svn: 20351
2005-02-27 18:48:19 +00:00
Chris Lattner
19d4ab642f new testcase globalopt should implement
llvm-svn: 20350
2005-02-27 18:47:17 +00:00
Chris Lattner
5042453bb8 Test that a global is marked constant when it can be.
llvm-svn: 20349
2005-02-27 18:19:26 +00:00
Alkis Evlogimenos
24340589c0 Add llc to tools.
llvm-svn: 20345
2005-02-27 10:21:37 +00:00
Chris Lattner
0ce80cd542 Fix spelling, patch contributed by Gabor Greif!
llvm-svn: 20343
2005-02-27 06:18:25 +00:00
Chris Lattner
dc166eb8f7 Fix spelling, patch contributed by Gabor Greif
llvm-svn: 20342
2005-02-27 06:15:51 +00:00
Chris Lattner
600420647f Fix misspellings, patch contributed by Gabor Greif!
llvm-svn: 20341
2005-02-27 06:14:21 +00:00
Chris Lattner
5315aa0ec6 Remove some stuff I checked in accidentally
llvm-svn: 20340
2005-02-27 04:32:35 +00:00
Chris Lattner
0b0f3520cb DCE a dead function
llvm-svn: 20339
2005-02-26 23:36:45 +00:00
Reid Spencer
709e10ed92 Implement an isBytecodeArchive method to determine if an archive contains
bytecode file members or not.
Patch Contributed By Adam Treat

llvm-svn: 20338
2005-02-26 22:00:32 +00:00
Chris Lattner
f05d2b3178 1 + 100 + 51 == 152, not 52.
If we fold three constants together (c1+c2+c3), make sure to keep
LHSC updated, instead of reusing (in this case), the 1 instead of the
partial sum.

llvm-svn: 20337
2005-02-26 18:50:19 +00:00
Chris Lattner
67bf757d0a A testcase that we miscompile, noticed from the demo page.
llvm-svn: 20336
2005-02-26 18:49:04 +00:00
Chris Lattner
435829f89b Fix a case where we incorrectly returned hasComputableLoopEvolution for
a ternary commutative expr.  Remove FIXME that does not need to be fixed
(can't happen).

llvm-svn: 20335
2005-02-26 18:40:02 +00:00
Chris Lattner
cc6d75fddf remove extraneous cast
llvm-svn: 20334
2005-02-26 18:33:28 +00:00
Andrew Lenharth
10bc4c0ff6 make BB labels be exported for debuging, add fp negation optimization, further pecimise the FP instructions
llvm-svn: 20332
2005-02-25 22:55:15 +00:00
Chris Lattner
37d554759b add an entry, add links to entries for demo page.
llvm-svn: 20328
2005-02-25 20:30:21 +00:00
Chris Lattner
e99ee2b35d Handle null a bit more carefully.
Actually teach dsa about select instructions.  This doesn't affect the
graph in any way other than not setting a spurious U marker on pointer
nodes that are selected.

llvm-svn: 20324
2005-02-25 01:27:48 +00:00
Reid Spencer
e447fce542 Use DataInstall macro instead of INSTALL.
llvm-svn: 20322
2005-02-24 21:43:43 +00:00
Reid Spencer
895e00b418 Remove a -C I forgot to remove earlier.
llvm-svn: 20321
2005-02-24 21:41:26 +00:00
Reid Spencer
dcc5375d49 Don't try to strip bytecode files!
llvm-svn: 20320
2005-02-24 21:36:32 +00:00
Reid Spencer
d77a4c0660 The install program doesn't know how to strip bytecode files so install
bytecode as data, not program.

llvm-svn: 20319
2005-02-24 21:30:37 +00:00
Reid Spencer
e6684c8c82 For PR528:
Use the DataInstall and MKDIR macros instead of using $(INSTALL) directly

llvm-svn: 20318
2005-02-24 21:28:08 +00:00
Chris Lattner
468fd33abb This instruction:
X = gep null, ...

Used to not create a scalar map entry for X, which caused clients to barf.
This is bad.

llvm-svn: 20316
2005-02-24 19:55:31 +00:00
Reid Spencer
eeedeaff99 Adjust to changes needed to more easily support projects via the new
LLVM_CONFIG_PROJECT macro.

llvm-svn: 20313
2005-02-24 19:05:19 +00:00
Reid Spencer
206bed0b97 Update to reflect various changes in the autoconf directory. THe
recommended configuration of projects is now much simplified and depends
on LLVM file presence rather than local project file presence.

llvm-svn: 20312
2005-02-24 18:53:47 +00:00
Reid Spencer
51d736301a Remove auxilliary files that are now picked up from llvm/autoconf. This
avoids version conflict problems with ltmain.sh (libtool), mkinstalldirs
and install-sh. This prevents projects from becoming stale when the LLVM
build system is upgraded or modified.

llvm-svn: 20311
2005-02-24 18:52:22 +00:00
Reid Spencer
0354a9ce35 * Move all the "standard" configuration stuff to the start of the file
* Make the auxilliary directory be llvm/autoconf not the project's
* Use the LLVM_CONFIG_PROJECT macro to get the --with-llvm{src,obj} args

llvm-svn: 20310
2005-02-24 18:50:53 +00:00
Reid Spencer
797f910736 Don't put generated files into CVS.
llvm-svn: 20309
2005-02-24 18:49:37 +00:00
Chris Lattner
d13cc49e19 Fix a bug introduced by revision 1.187 of this file.
llvm-svn: 20308
2005-02-24 18:48:07 +00:00
Reid Spencer
07068a53ab * Fix an output message
* Make aclocal look in LLVM's autoconf/m4 directory for macros
* Don't force generation of missing files

llvm-svn: 20307
2005-02-24 18:42:34 +00:00
Andrew Lenharth
904650cdd0 fix Allocas. Really. I mean it this time.
llvm-svn: 20306
2005-02-24 18:36:32 +00:00
Reid Spencer
f3102c287d Add a call to AC_CONFIG_COMMANDS to ensure that llvm_src is set properly
in the config.status script. This allows the AC_CONFIG_MAKEFILE macro to
work properly after it was changed to support sub-projects.

llvm-svn: 20305
2005-02-24 18:31:27 +00:00
Reid Spencer
28f7cd3216 This macro cannot assume that the location of install-sh and mkinstalldirs
is in ${srcdir}/autoconf because that is only true if the project is LLVM.
For other projects (e.g. sample), we don't want to have to distribute the
mkinstalldirs or install-sh programs because it opens a window of breakage
for projects. So, this change requires that the llvm_src variable be set
up via another AC_CONFIG_COMMANDS call. For LLVM this is done in the
configure.ac. For projects its done in the LLVM_CONFIG_PROJECT macro.

llvm-svn: 20304
2005-02-24 18:28:20 +00:00
Reid Spencer
76d99df157 Add a new macro for configuring projects, LLVM_CONFIG_PROJECT. This macro
takes care of the --with-llvmsrc and --with-llvmobj options for the project
It was moved here from the project's configure.ac file because there is
some tricky handling of the llvm_src variable to tell the project where the
llvm source tree is (for mkinstalldirs and install-sh commands).

llvm-svn: 20303
2005-02-24 18:25:24 +00:00
Chris Lattner
08f7d0c262 Fix some problems where the verifier would crash on invalid input instead of
reporting the problem and exiting.

llvm-svn: 20302
2005-02-24 16:58:29 +00:00
Reid Spencer
247a10e729 Fix the other half of PR528 .. don't try to strip header files!
llvm-svn: 20301
2005-02-24 07:12:43 +00:00
Chris Lattner
1cca959e5d Implement Transforms/SimplifyCFG/switch_thread.ll
This does a simple form of "jump threading", which eliminates CFG edges that
are provably dead.  This triggers 90 times in the external tests, and
eliminating CFG edges is always always a good thing! :)

llvm-svn: 20300
2005-02-24 06:17:52 +00:00
Chris Lattner
c0968c72ff new testcase for a simple optimization that simplifycfg is about to do.
All CFG edges to DEAD should be eliminated.

llvm-svn: 20299
2005-02-24 06:15:27 +00:00
Chris Lattner
47ac187c08 switch instructions only allow constantints for their values, be more specific.
llvm-svn: 20298
2005-02-24 05:32:09 +00:00
Chris Lattner
75f5b42624 use more specific cast.
llvm-svn: 20297
2005-02-24 05:26:04 +00:00
Chris Lattner
fc824c1a7e add more checking
llvm-svn: 20296
2005-02-24 05:25:17 +00:00
Chris Lattner
5f0df0c1e6 Do not read free'd memory when printing an error message.
llvm-svn: 20295
2005-02-24 04:59:49 +00:00
Reid Spencer
c43b1d403e For PR528:
* Consolidate all "install" usage to the install program/script found by
  autoconf which includes the autoconf/install-sh script if necessary
* Change Makefile.rules to not use the -D flag to install but use the
  MKDIR command as necessary.
* Change Makefile.rules to differentiate between installation of executable
  files and regular data files to get the permission modes correct.

llvm-svn: 20294
2005-02-24 03:56:32 +00:00
Chris Lattner
ce046ac9c6 add a new method.
llvm-svn: 20293
2005-02-24 02:37:26 +00:00
Tanya Lattner
ee47100d44 Only print out machine instructions before modulo scheduling if we are actually doing modulo scheduling! :)
llvm-svn: 20292
2005-02-24 02:14:44 +00:00
Chris Lattner
272f3527a3 add another testcase to make sure it gets turned into a switch (answer: yes it does)
llvm-svn: 20291
2005-02-24 02:13:50 +00:00
Andrew Lenharth
27cf4eb1c7 Ah the problems you have to fix when you stray from the One True Way (TM)
llvm-svn: 20290
2005-02-23 17:33:42 +00:00
Chris Lattner
25169caa80 make this more efficient. Scan up to 16 nodes, not the whole list.
llvm-svn: 20289
2005-02-23 16:53:04 +00:00
Chris Lattner
d36552f34f new method
llvm-svn: 20288
2005-02-23 16:51:11 +00:00
Chris Lattner
8a504447f7 Add new method.
llvm-svn: 20287
2005-02-23 16:50:59 +00:00
Chris Lattner
cf08c21f2c Reduce the amount of searching this assertion does. On a testcase of mine,
this reduces the time for -simplifycfg in a debug build from 106s to 14.82s

llvm-svn: 20286
2005-02-23 07:09:08 +00:00
Chris Lattner
5e166a5f3e Fix a bugpoint crash that JeffC noticed, looking like this:
*** Attempting to perform final cleanups: Final cleanups failed.  Sorry. :(  Ple
ase report a bug!

<llc>llc.exe: bytecode didn't read correctly.
llc.exe: bytecode didn't read correctly.
<crash>
Assertion failed: M && "You can't write a null module!!", file c:\llvm\lib\bytec
ode\writer\writer.cpp, line 1094


The fact that llc bombed (in this case) is ok, but bugpoint shouldn't crash after this.

llvm-svn: 20285
2005-02-23 06:12:11 +00:00
Chris Lattner
80c5b97046 Silence some uninit variable warnings.
llvm-svn: 20284
2005-02-23 05:57:21 +00:00
Tanya Lattner
a31ad5172e Fixed bug in findAllcircuits. Fixed branch addition to schedule. Added debug information.
llvm-svn: 20280
2005-02-23 02:01:42 +00:00
Chris Lattner
5cf3521883 remove some more dead templates and a dead macro.
llvm-svn: 20279
2005-02-22 23:36:37 +00:00
Andrew Lenharth
ccdfdd7aee oops
llvm-svn: 20278
2005-02-22 23:29:25 +00:00
Chris Lattner
3166471603 Remove use of bind_obj, deleter, and finegrainify namespacification.
llvm-svn: 20277
2005-02-22 23:27:21 +00:00
Chris Lattner
52e931b37d Remove use of bind_obj
llvm-svn: 20276
2005-02-22 23:22:58 +00:00
Chris Lattner
2c07348696 Remove a bunch of dead templates.
llvm-svn: 20275
2005-02-22 23:19:42 +00:00
Chris Lattner
06b6c4bbde C++ is not a functional programming language.
llvm-svn: 20274
2005-02-22 23:13:58 +00:00
Andrew Lenharth
7ac0143fa6 dynamic stack allocas
llvm-svn: 20273
2005-02-22 21:59:48 +00:00
Chris Lattner
a474313902 Fix a bug in the 'store fpimm, ptr' -> 'store intimm, ptr' handling code.
Changing 'op' here caused us to not enter the store into a map, causing
reemission of the code!!  In practice, a simple loop like this:

no_exit:                ; preds = %no_exit, %entry
        %indvar = phi uint [ %indvar.next, %no_exit ], [ 0, %entry ]            ; <uint> [#uses=3]
        %tmp.4 = getelementptr "complex long double"* %P, uint %indvar, uint 0          ; <double*> [#uses=1]
        store double 0.000000e+00, double* %tmp.4
        %indvar.next = add uint %indvar, 1              ; <uint> [#uses=2]
        %exitcond = seteq uint %indvar.next, %N         ; <bool> [#uses=1]
        br bool %exitcond, label %return, label %no_exit

was being code gen'd to:

.LBBtest_1:     # no_exit
        movl %edx, %esi
        shll $4, %esi
        movl $0, 4(%eax,%esi)
        movl $0, (%eax,%esi)
        incl %edx
        movl $0, (%eax,%esi)
        movl $0, 4(%eax,%esi)
        cmpl %ecx, %edx
        jne .LBBtest_1  # no_exit

Note that we are doing 4 32-bit stores instead of 2.  Now we generate:

.LBBtest_1:     # no_exit
        movl %edx, %esi
        incl %esi
        shll $4, %edx
        movl $0, (%eax,%edx)
        movl $0, 4(%eax,%edx)
        cmpl %ecx, %esi
        movl %esi, %edx
        jne .LBBtest_1  # no_exit

This is much happier, though it would be even better if the increment of ESI
was scheduled after the compare :-/

llvm-svn: 20265
2005-02-22 07:23:39 +00:00
Andrew Lenharth
5ab3986e49 no longer build as a shared library
llvm-svn: 20264
2005-02-22 04:58:26 +00:00
Chris Lattner
25170b0177 add another plausible reason
llvm-svn: 20262
2005-02-21 16:35:31 +00:00
Chris Lattner
b3dd24435f new testcase for PR523
llvm-svn: 20261
2005-02-21 04:03:32 +00:00
Chris Lattner
3a8f68e4cb Bug fixed.
llvm-svn: 20260
2005-02-20 23:31:49 +00:00
Chris Lattner
8a8f9032c3 New testcase for PR522.
llvm-svn: 20259
2005-02-20 23:29:23 +00:00
Chris Lattner
ec3f094489 Fix problems running the HowToUseJIT on powerpc, and probably problems with
ANY program that does not have all functions internalized.

llvm-svn: 20258
2005-02-20 18:43:35 +00:00
Jeff Cohen
18cf7ebcee Fix silly mistake.
llvm-svn: 20256
2005-02-20 02:48:51 +00:00
Jeff Cohen
4220bf5726 Implement standard I/O redirection in ExecuteAndWait().
llvm-svn: 20255
2005-02-20 02:43:04 +00:00
Chris Lattner
e68dae0eb6 Add support for ".so" files compiled with LLVM which contain LLVM bytecode.
llvm-svn: 20253
2005-02-19 18:30:29 +00:00
Chris Lattner
fe723a7c05 Eliminate silly warnings from the linker of the form:
WARNING: Type conflict between types named 'union.._604.'.
    Src=' %union.._604.'.
   Dest=' %union.._604.'
llvm-svn: 20252
2005-02-19 17:52:37 +00:00
Chris Lattner
3d6194f8cc typeo
llvm-svn: 20251
2005-02-19 17:17:32 +00:00
Chris Lattner
fdff9e7d0d New entry.
llvm-svn: 20250
2005-02-19 17:14:24 +00:00
Chris Lattner
6a3ae64639 Bug fixed.
llvm-svn: 20249
2005-02-19 17:13:20 +00:00
Chris Lattner
e98b480b2e Testcase for PR520
llvm-svn: 20248
2005-02-19 17:07:48 +00:00
Chris Lattner
a94f9ffd0e Adjust this test to pass after recent CFE changes. We now generate:
%XX = global int cast (int* getelementptr ([2 x int]* getelementptr (%struct.S* null, int 0, uint 0), int 0, int 1) to int)

which is the literal translation of the testcase :)

llvm-svn: 20247
2005-02-19 07:31:54 +00:00
Chris Lattner
48c23141a2 Bug fixed.
llvm-svn: 20246
2005-02-19 07:29:25 +00:00
Chris Lattner
4fec95cd4d Make this testcase harder, to test the read case as well.
llvm-svn: 20245
2005-02-19 06:56:46 +00:00
Chris Lattner
e22674c706 new testcase.
llvm-svn: 20244
2005-02-19 06:54:44 +00:00
Jeff Cohen
07e22ba2c7 Change __MINGW to __MINGW32__. Patch submitted by Henrik Bach.
llvm-svn: 20243
2005-02-19 03:01:13 +00:00
Chris Lattner
16fb0037c4 Fix a bug.
llvm-svn: 20242
2005-02-19 02:22:14 +00:00
Reid Spencer
9756aea1cb Quote the value of the PATH variable so that Cygwin and Windows can have
spaces in path names and not confuse the shell.

llvm-svn: 20241
2005-02-18 20:24:09 +00:00
Reid Spencer
75542d4e78 Allow dejagnu tests to run on Windows/Cygwin. Quote the value of the PATH
variable so that spaces don't screw it up.

llvm-svn: 20240
2005-02-18 20:17:44 +00:00
Reid Spencer
63eb0aa52a Adjust the help output so that it will fit cleanly within 80 columns.
llvm-svn: 20239
2005-02-18 20:00:05 +00:00
Misha Brukman
634b0a3b7e * llvmc does not have a -V switch
* --config-file is really --config-dir, according to `llvmc --help'

llvm-svn: 20238
2005-02-18 18:00:53 +00:00
Jeff Cohen
81549a57b8 Make PreventCoreFiles() do the right thing on Windows.
llvm-svn: 20237
2005-02-18 07:05:18 +00:00
Misha Brukman
3703685b1a Remove colloquialisms from the documentation.
llvm-svn: 20233
2005-02-17 22:22:24 +00:00
Misha Brukman
20430321c2 Fix compilation errors with VS 2005, patch contributed by Aaron Gray.
llvm-svn: 20232
2005-02-17 21:40:27 +00:00
Misha Brukman
73e929f89d Fix compilation errors with VS 2005, patch by Aaron Gray.
llvm-svn: 20231
2005-02-17 21:39:27 +00:00
Chris Lattner
381dddc90c Don't rely on doubles comparing identical to each other, which doesn't work
for 0.0 and -0.0.

llvm-svn: 20230
2005-02-17 20:17:32 +00:00
Chris Lattner
67395c2002 Map doubles from integers, not the double itself.
llvm-svn: 20229
2005-02-17 20:16:58 +00:00
Chris Lattner
0c56a548ed Don't sink argument loads into loops or other bad places. This disables folding of argument loads with instructions that are not in the entry block.
llvm-svn: 20228
2005-02-17 19:40:32 +00:00
Chris Lattner
7b5d9e2217 Do not mark obviously unreachable blocks live when processing PHI nodes,
and handle incomplete control dependences correctly.  This fixes:

Regression/Transforms/ADCE/dead-phi-edge.ll
  -> a missed optimization

Regression/Transforms/ADCE/dead-phi-edge.ll
  -> a compiler crash distilled from QT4

llvm-svn: 20227
2005-02-17 19:28:49 +00:00
Chris Lattner
854c086e0f New files, testing for a crash in ADCE compiling QT and a missed optimization.
llvm-svn: 20226
2005-02-17 19:27:44 +00:00
Chris Lattner
47555decfb Scary typo that fixes Regression/Transforms/IndVarsSimplify/2005-02-17-TruncateExprCrash.ll
and PR515.

llvm-svn: 20224
2005-02-17 16:54:16 +00:00
Chris Lattner
02fd7d1d56 new testcase for PR515
llvm-svn: 20223
2005-02-17 16:53:41 +00:00
Reid Spencer
53e86c13f6 Remove the "pax" program from the list of those needed to support LLVM.
The install target in Makefile.rules no longer uses pax but just uses find
and "install" instead.

llvm-svn: 20216
2005-02-16 16:21:00 +00:00
Reid Spencer
e386b72d21 Fix installation of configuration files.
llvm-svn: 20215
2005-02-16 16:17:11 +00:00
Reid Spencer
fe0a01ee25 * Don't flatten the directory hierarchy when installing headers
* Make it possible to have the Install program run in verbose mode when
  the TOOL_VERBOSE=1 option is set
* Ensure non-executable installed files do not install with execute perms.

llvm-svn: 20214
2005-02-16 16:13:02 +00:00
Reid Spencer
48a82f49bd Don't use pax for installing header files. Use the install program instead.
llvm-svn: 20213
2005-02-16 15:54:03 +00:00
Jeff Cohen
cce4b92601 Somehow tablegen.exe got moved... fix up tablegen invocations to match.
llvm-svn: 20212
2005-02-16 05:06:52 +00:00
Jeff Cohen
81d26d168d Get bugpoint compiling with VC++ again, not that it works anyway.
llvm-svn: 20211
2005-02-16 05:05:31 +00:00
Jeff Cohen
97a41e238e Arg list already has program name in it.
llvm-svn: 20208
2005-02-16 04:43:45 +00:00
Tanya Lattner
c28fd0db2e Fixed node deletion bug.
llvm-svn: 20207
2005-02-16 04:00:59 +00:00
Chris Lattner
3e7a193bd7 Instead of doing a manual comparison loop, just use memcmp, thanks to JohnC
for the suggestion! :)

llvm-svn: 20203
2005-02-15 22:12:10 +00:00
Chris Lattner
9d0db6f602 Make this more efficient now that we know both files are the same length.
llvm-svn: 20202
2005-02-15 22:01:43 +00:00
Misha Brukman
f232a4582d Fix spelling
llvm-svn: 20201
2005-02-15 21:59:53 +00:00
Reid Spencer
f4425b0208 Adjust DiffFilesWithTolerance to help poor cygwin's mmap facility by
handling zero length files a little more intelligently. If both files are
zero length then we return 0 (true) indicating a match. If only one of the
files is zero length then we return 1 (false) indicating that the files
differ. If the files don't agree in length then they can't match so we
skip the first loop that looks for a quick match.

llvm-svn: 20200
2005-02-15 21:47:02 +00:00
Andrew Lenharth
5f7c53599e add Alpha to llc
llvm-svn: 20198
2005-02-15 21:14:09 +00:00
Chris Lattner
915fd0de4b Fix a problem where the PPC backend lost track of the fact that it had
to save and restore the LR register on entry and exit of a leaf function
that needed to access globals or the constant pool.  This should hopefully
fix oscar from sending the PPC tester spinning out of control.

llvm-svn: 20197
2005-02-15 20:26:49 +00:00
Chris Lattner
3e708301d2 Add a sanity check.
llvm-svn: 20195
2005-02-15 18:48:48 +00:00
Chris Lattner
219002ed8f Add a new method to make it easy to update graphs.
llvm-svn: 20194
2005-02-15 18:40:55 +00:00
Chris Lattner
385a47394a Bug fixed
llvm-svn: 20193
2005-02-15 07:02:12 +00:00
Chris Lattner
3bef66fcf3 Fix volatile load/store of pointers. Consider this testcase:
void %test(int** %P) {
  %A = volatile load int** %P
  ret void
}

void %test2(int*** %Q) {
  %P = load int*** %Q
  volatile store int** %P, int*** %Q
  ret void
}

instead of emitting:

void test(int **l1_P) {
  int *l2_A;

  l2_A = (int **((volatile int **)l1_P));
  return;
}
void test2(int ***l2_Q) {
  int **l1_P;

  l1_P = *l2_Q;
  *((volatile int ***)l2_Q) = l1_P;
  return;
}

... which is loading/storing volatile pointers, not through volatile pointers,
emit this (which is right):

void test(int **l1_P) {
  int *l3_A;

  l3_A = *((int * volatile*)l1_P);
  return;
}
void test2(int ***l2_Q) {
  int **l1_P;

  l1_P = *l2_Q;
  *((int ** volatile*)l2_Q) = l1_P;
  return;
}

llvm-svn: 20191
2005-02-15 05:52:14 +00:00
Chris Lattner
1f031b20fe Bug fixed.
llvm-svn: 20190
2005-02-15 05:28:06 +00:00
Chris Lattner
1a9cbe67ed New testcase for PR510.
llvm-svn: 20189
2005-02-15 05:18:05 +00:00
Chris Lattner
be895eda63 wow, interesting typo :)
llvm-svn: 20187
2005-02-14 22:58:38 +00:00
Chris Lattner
7027143f0a execution tests shouldn't go here. This was killing the PPC nightly tester.
llvm-svn: 20186
2005-02-14 21:54:32 +00:00
Reid Spencer
e9fa5444c5 For PR496:
When llvm-gcc is not available, bypass rules for Modules and Bytecode
Libraries that require llvm-gcc and emit instead a warning that llvm-gcc
is not available. This permits "make LLVMGCC=" to build LLVM completely
without error and provides warnings about the modules and bc libs that
could not be constructed.

llvm-svn: 20185
2005-02-14 21:54:08 +00:00
Chris Lattner
6e528dce90 Fix a bug in my previous change to this, which broke the build on sparcs.
llvm-svn: 20184
2005-02-14 21:42:10 +00:00
Chris Lattner
145569b076 Print GEP offsets as signed values instead of unsigned values. On X86, this
prints:

getelementptr (int* %A, int -1)

as: "(A) - 4" instead of "(A) + 18446744073709551612", which makes the
assembler much happier.

This fixes test/Regression/CodeGen/X86/2005-02-14-IllegalAssembler.ll,
and Benchmarks/Prolangs-C/cdecl with LLC on X86.

llvm-svn: 20183
2005-02-14 21:40:26 +00:00
Chris Lattner
3d2881066b A testcase that LLC produces illegal asm on for Prolangs-C/cdecl now.
llvm-svn: 20182
2005-02-14 21:31:41 +00:00
Chris Lattner
31f3382b3b Fix the second bug attached to PR504.
llvm-svn: 20181
2005-02-14 20:11:45 +00:00
Chris Lattner
a3a55bf997 Work around GCC PR19958, which causes programs to sometimes crash after
printing help output or version info.

llvm-svn: 20180
2005-02-14 19:17:29 +00:00
Misha Brukman
2b1e10031f Write out single characters as chars, not strings.
llvm-svn: 20179
2005-02-14 18:52:35 +00:00
Chris Lattner
1c75b25546 Bugs fixed
llvm-svn: 20178
2005-02-14 16:57:55 +00:00
Chris Lattner
7afbdcad15 Implement CodeGen/CBackend/2005-02-14-VolatileOperations.ll
Volatile loads and stores need to emit volatile pointer operations in C.

llvm-svn: 20177
2005-02-14 16:47:52 +00:00
Chris Lattner
4c13ab61b3 new testcase
llvm-svn: 20176
2005-02-14 16:45:38 +00:00
Reid Spencer
9c7fbaef9b Update makefile to use PROJ_* makefile variables intead of BUILD_* as
required by changes to the Makefile.rules. Patch contributed by Vladimir
Merzliakov.

llvm-svn: 20175
2005-02-14 16:04:28 +00:00
Reid Spencer
8c47826c9f Update comments to reflect new variable names. Patch contributed by
Vladimir Merzliakov.

llvm-svn: 20174
2005-02-14 16:02:19 +00:00
Misha Brukman
e71cbb82ba Give props to Andrew for the Alpha backend
llvm-svn: 20173
2005-02-14 09:07:23 +00:00
Andrew Lenharth
cae2f21e3b fix setcc on floats, fixes singlesource:pi, perhaps others
llvm-svn: 20172
2005-02-14 05:41:43 +00:00
Chris Lattner
71ff539ed6 new testcase for PR509
llvm-svn: 20171
2005-02-14 02:54:41 +00:00
Chris Lattner
259df2bf3c Fix the llvm bootstrap
llvm-svn: 20170
2005-02-13 23:37:09 +00:00
Chris Lattner
5f429c3347 Move private helper function into the only .cpp file that uses it.
llvm-svn: 20169
2005-02-13 23:14:06 +00:00
Chris Lattner
dc01c3f058 Move helper function here.
llvm-svn: 20168
2005-02-13 23:13:47 +00:00
Chris Lattner
9db0eccc42 Conform to the documented interface by null terminating argument lists!
llvm-svn: 20167
2005-02-13 23:10:45 +00:00
Chris Lattner
61a31c9fe2 Make sure to null terminate argument lists!
llvm-svn: 20166
2005-02-13 23:02:34 +00:00
Chris Lattner
743dd2cd80 If errno is zero strerror_r does not modify the buffer, leaving it unterminated.
This causes garbage to be printed out after error messages.

llvm-svn: 20165
2005-02-13 22:46:37 +00:00
Chris Lattner
e14babd141 Add some updates
llvm-svn: 20164
2005-02-13 22:27:24 +00:00
Chris Lattner
5824762378 SuSE 3.3.3 is also borken.
llvm-svn: 20163
2005-02-13 22:20:49 +00:00
Chris Lattner
5881b91bd7 Do not replace ostream << Module*, only ostream << Module&.
llvm-svn: 20157
2005-02-13 19:15:01 +00:00
Chris Lattner
6983f5d2ed Print the module, not the pointer.
llvm-svn: 20156
2005-02-13 19:12:31 +00:00
Reid Spencer
8d0f126b74 Make the check for global variables the same as the one for functions. In
both cases they are looking for non-external variables/functions that do
not have internal linkage. Using "!isExternal()" is a little more
understandable than "hasInitializer()"

llvm-svn: 20155
2005-02-13 18:12:20 +00:00
Chris Lattner
8d54dd37c9 Nuke blank line.
llvm-svn: 20154
2005-02-13 17:54:21 +00:00
Chris Lattner
08a5eb3cf0 Minor cleanup. No need to explicitly tell the compiler the template arguments.
llvm-svn: 20153
2005-02-13 17:50:16 +00:00
Chris Lattner
147c561432 Make sure to clear the LazyFunctionLoadMap after we ParseAllFunctionBodies.
Otherwise, clients who call ParseAllFunctionBodies will attempt to parse
the function bodies twice, which is (uh) very very bad (tm).

This fixes gccld on python.

llvm-svn: 20152
2005-02-13 17:48:18 +00:00
Chris Lattner
1b9f9c5f67 Do not put internal symbols into the symbol table. This shrinks the symbol
table for archives in common cases, and prevents trying to resolve a
external reference with an internal reference.  This shrinks the libpython.a
symbol table from 126302 to 19770 bytes.

llvm-svn: 20151
2005-02-13 17:42:11 +00:00
Chris Lattner
38a3ba0234 Include local time on the web page for start/end times.
llvm-svn: 20150
2005-02-13 16:08:30 +00:00
Chris Lattner
71a44087d4 Print something useful for gccld -v with an archive.
llvm-svn: 20148
2005-02-13 15:26:14 +00:00
Reid Spencer
9f219c79aa Fix PR506:
* Use error returned from Archive::OpenAndLoad
* Make sure only std::string is thrown so it gets caught and printed.

llvm-svn: 20147
2005-02-13 07:34:17 +00:00
Chris Lattner
7b0fbe7ccf Correct the recursive PHI node handling routines in a way that CANNOT induce
infinite loops (using the new replaceSymbolicValuesWithConcrete method).

This patch reverts this patch:
http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20050131/023830.html

... which was an attempted fix for this problem.  Unfortunately, that patch
caused test/Regression/Transforms/IndVarsSimplify/exit_value_tests.llx to fail
and slightly castrated the entire analysis.  This patch fixes it right.

This patch is dedicated to jeffc, for making me deal with this.  :)

llvm-svn: 20146
2005-02-13 04:37:18 +00:00
Chris Lattner
b06944e813 Add a new replaceSymbolicValuesWithConcrete method to the SCEV class,
adjust const'ness a bit to be more correct.

llvm-svn: 20145
2005-02-13 04:34:51 +00:00
Andrew Lenharth
9a98def106 non-ieee arith crashes passes on alpha
llvm-svn: 20144
2005-02-13 03:41:10 +00:00
Andrew Lenharth
d39febfc66 try to do better match for i32 adds
llvm-svn: 20143
2005-02-12 21:11:17 +00:00
Andrew Lenharth
ab4db0522a make FP conversion more conservative (matches gcc)
llvm-svn: 20142
2005-02-12 21:10:58 +00:00
Andrew Lenharth
df5cd0868f oops, I was sure this had already gond though the nightly tester
llvm-svn: 20141
2005-02-12 20:42:09 +00:00
Chris Lattner
e254e2ffcc Add note about broken GCC
llvm-svn: 20138
2005-02-12 20:11:13 +00:00
Andrew Lenharth
76c5d97750 added sign extend for boolean
llvm-svn: 20137
2005-02-12 19:35:12 +00:00
Chris Lattner
5d5aede33b Document the newly generalized model for constant globals.
llvm-svn: 20136
2005-02-12 19:30:21 +00:00
Chris Lattner
16277c1775 Allow globals to be of different const'nesses when we link.
This finally resolves PR502, PR450,
and test/Regression/Linker/2005-02-12-ConstantGlobals{,-2}.ll correctly

llvm-svn: 20135
2005-02-12 19:20:28 +00:00
Chris Lattner
36f3eb82a1 New test, adjust other test.
llvm-svn: 20134
2005-02-12 19:19:36 +00:00
Chris Lattner
6af31478ef Reinstate this test, it is correct after all.
llvm-svn: 20133
2005-02-12 19:14:11 +00:00
Chris Lattner
3b4f6c4a73 This test is invalid
llvm-svn: 20131
2005-02-12 19:02:30 +00:00
Chris Lattner
e616fea3bc Fix for testcase Transforms/IndVarsSimplify/2005-02-11-InvokeCrash.ll
and PR504.

llvm-svn: 20129
2005-02-12 03:26:49 +00:00
Chris Lattner
4c916478e5 new testcase for PR504
llvm-svn: 20128
2005-02-12 03:26:30 +00:00
Chris Lattner
82e87e4d0c Actually, this testcase is invalid, the bug is in the C++ FE.
llvm-svn: 20123
2005-02-11 23:18:40 +00:00
Chris Lattner
1afcaf601f New testcase that manyoso found compiling QT 4.0.
llvm-svn: 20122
2005-02-11 23:08:34 +00:00
Chris Lattner
bebf14d28e Slightly expand on the instructions.
llvm-svn: 20121
2005-02-11 21:17:26 +00:00
Chris Lattner
2a38aea0a7 Bug fixed
llvm-svn: 20118
2005-02-11 19:29:52 +00:00
Chris Lattner
e6138f4240 New testcase for PR501
llvm-svn: 20117
2005-02-11 19:26:06 +00:00
Chris Lattner
72b5054afb The pool allocator is now the llvm-poolalloc module in public CVS
llvm-svn: 20116
2005-02-11 04:46:58 +00:00
Andrew Lenharth
b301af712e fix a bunch of regressions due to call behavior
llvm-svn: 20110
2005-02-10 20:10:38 +00:00
Alkis Evlogimenos
c4a44c6b3d Localize globals if they are only used in main(). This replaces the
global with an alloca, which eventually gets promoted into a
register. This enables a lot of other optimizations later on.

llvm-svn: 20109
2005-02-10 18:36:30 +00:00
Tanya Lattner
56807c6f4a Added new circuit finding alogrithm.
Fixed bug in graph so that phi ite diff edges are added.

llvm-svn: 20108
2005-02-10 17:02:58 +00:00
Tanya Lattner
1137d7c6a1 Allow modsched and local scheduling to both be run.
llvm-svn: 20107
2005-02-10 17:02:06 +00:00
Andrew Lenharth
e0b789fdf5 so, if you beat on it, you too can talk emacs into having a sane indenting policy... Also, optimize many function calls with pc-relative calls (partial prologue skipping for that case coming soon), try to fix the random jumps to strange places problem by pesimizing div et. al. register usage and fixing up GP before using, some calling convention tweaks, and make frame pointer unallocatable (not strickly necessary, but let's go for correctness first)
llvm-svn: 20106
2005-02-10 06:25:22 +00:00
Andrew Lenharth
f70ef47ee1 fix fp branch
llvm-svn: 20105
2005-02-10 05:17:38 +00:00
Misha Brukman
8d343e77f8 Give props to Brian for V8 backend
llvm-svn: 20104
2005-02-10 02:07:57 +00:00
Misha Brukman
06a1d47f96 * Fix spelling of `volatile'
* Align comments with tablegen elements

llvm-svn: 20103
2005-02-10 01:52:22 +00:00
Chris Lattner
38de952115 This will be moved elsewhere.
llvm-svn: 20101
2005-02-09 22:52:46 +00:00
Misha Brukman
b139a7dbb9 * Use doc_code style for blocks of code
* Convert < to &lt; in <pre> block
* Use doc_hilite instead of doc_red style
* Put some classes and options in <tt> blocks

llvm-svn: 20100
2005-02-09 22:49:05 +00:00
Misha Brukman
64f8d07090 Do not mention colors in style names, we might want to change styles themselves
llvm-svn: 20099
2005-02-09 22:47:47 +00:00
Misha Brukman
0c4b8b6db4 * Use an HTML list <ol> instead of custom superscripts in the platform notes
* Reorder software requirements list to show relative importance
* Use superscripts for footnotes in software list rather than "Note 1"
* Use new doc_notes class to separate footnotes from main doc text

llvm-svn: 20098
2005-02-09 22:38:47 +00:00
Misha Brukman
649b77858d Add style to display notes on a different background than the main text
llvm-svn: 20097
2005-02-09 22:36:44 +00:00
Chris Lattner
ac648f5375 Turn footnotes into links, make the page validate.
llvm-svn: 20096
2005-02-09 21:15:51 +00:00
Chris Lattner
59a486ace6 If needed, this should be in the 'how to compile the cfe' doc.
llvm-svn: 20095
2005-02-09 21:07:21 +00:00
Chris Lattner
09cc355153 this should be incorporated into the build
llvm-svn: 20094
2005-02-09 21:05:01 +00:00
Misha Brukman
7772309b70 * Separate superscript footnotes with a comma, otherwise it's a 2-digit number
* Make a URL into an HTML link using anchor tag
* Put code in fixed-width font
* Since the MinGW footnote is significantly more than the rest of the footnotes
  combined, it needs to have a border and background color to separate it from
  the regular flow of text for readability purposes.

llvm-svn: 20093
2005-02-09 21:01:26 +00:00
Chris Lattner
093ffb0a5c Add instructions for MINGW, contributed by Henrik Bach
llvm-svn: 20092
2005-02-09 20:43:48 +00:00
Chris Lattner
610ce2c678 Don't print a 'Total Execution Time' line for the 'Miscellaneous Ungrouped
Timers' section.  Since these are random timers in the program it doesn't
make sense to sum them up.

llvm-svn: 20090
2005-02-09 18:41:32 +00:00
Chris Lattner
159485ff1b Fix test/Regression/Assembler/2005-02-09-AsmWriterStoreBug.ll
llvm-svn: 20089
2005-02-09 17:45:03 +00:00
Chris Lattner
60fb167b6e New testcase that the asmwriter botches.
llvm-svn: 20088
2005-02-09 17:42:24 +00:00
Chris Lattner
5ce5a094aa Use new edge iterators to simplify some code.
llvm-svn: 20086
2005-02-09 03:20:43 +00:00
Chris Lattner
06e353c5a9 Add some iterators that should have come in long ago
llvm-svn: 20085
2005-02-09 03:14:29 +00:00
Chris Lattner
81bfc9eda8 Fix installation of configured headers when objdir != srcdir. Patch
contributed by Vladimir Merzliakov!

llvm-svn: 20084
2005-02-09 02:24:00 +00:00
Andrew Lenharth
8ec0a2b13a BranchCC, nifty
llvm-svn: 20067
2005-02-08 00:40:03 +00:00
Andrew Lenharth
d4f440de0f fix store issue and an FP conversion (segfault) issue
llvm-svn: 20066
2005-02-07 23:02:23 +00:00
Chris Lattner
863d9c9068 IndCallGraphMap is now a pointer to a new'd map.
llvm-svn: 20065
2005-02-07 16:09:15 +00:00
Chris Lattner
67aeddc423 Hopefully fix the build on Darwin with GCC 3.3
llvm-svn: 20064
2005-02-07 16:09:01 +00:00
Andrew Lenharth
9d3f7704fd copytoreg fix
llvm-svn: 20063
2005-02-07 06:31:44 +00:00
Andrew Lenharth
57047720ce copyfromreg fix
llvm-svn: 20062
2005-02-07 06:21:37 +00:00
Andrew Lenharth
351df0c2dc fix load bug
llvm-svn: 20061
2005-02-07 05:55:55 +00:00
Andrew Lenharth
5d004edc3d more FP load store fixes and Load store simplifications
llvm-svn: 20060
2005-02-07 05:33:15 +00:00
Andrew Lenharth
5fb9b53060 clean up load and stores alot
llvm-svn: 20059
2005-02-07 05:18:02 +00:00
Andrew Lenharth
a9e02156ce teach all loads and stores about the stack
llvm-svn: 20058
2005-02-07 05:07:00 +00:00
Andrew Lenharth
0021f55863 prefer FP scratch registers and more check in LowerArguments
llvm-svn: 20057
2005-02-06 21:07:31 +00:00
Andrew Lenharth
eefd410522 fix oopso
llvm-svn: 20056
2005-02-06 16:22:15 +00:00
Andrew Lenharth
6c018f77d1 smarter loads and stores. can now handle base+offset.
llvm-svn: 20055
2005-02-06 15:40:40 +00:00
Andrew Lenharth
d9bf7b81eb fix build
llvm-svn: 20053
2005-02-05 19:46:51 +00:00
Andrew Lenharth
7be9854594 clean up
llvm-svn: 20051
2005-02-05 17:41:39 +00:00
Andrew Lenharth
ea9224a69a fix f32 setcc, and fp select
llvm-svn: 20050
2005-02-05 16:41:03 +00:00
Andrew Lenharth
060d58b88f added ugly support for fp compares
llvm-svn: 20049
2005-02-05 13:19:12 +00:00
Misha Brukman
ffe9968b5a Make the rest of file header comments consistent in format and style
llvm-svn: 20048
2005-02-05 02:24:26 +00:00
Chris Lattner
423c04c75c Eliminate the explicit opcode field in ConstantExpr, using the SubclassData
field to hold it instead.  This shrinks memory usage for 176.gcc from
57628728 to 57598144 bytes, a small reduction of about 30K.

llvm-svn: 20047
2005-02-05 02:00:12 +00:00
Chris Lattner
0a9a2e734b Eliminate the explicit volatile fields in LoadInst and StoreInst. This shrinks
LoadInst from 60 -> 56 bytes and StoreInst from 76 -> 72 bytes.

Note however, that this doesn't actually save any memory on common systems
where 'malloc' returns 8-byte aligned memory, as the saved space is replaced
by useless alignment padding.  :(

llvm-svn: 20046
2005-02-05 01:44:18 +00:00
Chris Lattner
df57a02be4 Instead of initializing the volatile field, use accessors to set it.
llvm-svn: 20045
2005-02-05 01:38:38 +00:00
Chris Lattner
a29c92ffdd Initialize new field.
llvm-svn: 20044
2005-02-05 01:37:58 +00:00
Chris Lattner
9cd92de64b SubclassID is really a small field. Split it into half and let subclasses
play with the unused part.

llvm-svn: 20043
2005-02-05 01:37:44 +00:00
Chris Lattner
f60c170ea5 Add support for .cc and .hpp files. Patch contributed by Vladimir Merzliakov!
llvm-svn: 20042
2005-02-04 21:28:50 +00:00
Misha Brukman
076b9f4507 Make file header comment consistent: extend the whole 80 cols to fill the line
llvm-svn: 20039
2005-02-04 20:25:52 +00:00
Chris Lattner
4585abd549 If we have an indirect call site that calls N functions, inline the N functions
into a temporary graph, remember it for later, then inline the tmp graph into
the call site.

In the case where there are other call sites to the same set of functions, this
permits us to just inline the temporary graph instead of all of the callees.

This turns N*M inlining situations into an N+M inlining situation.

llvm-svn: 20036
2005-02-04 19:59:49 +00:00
Chris Lattner
d1000686cd Split mergeInGraph into two methods.
llvm-svn: 20035
2005-02-04 19:58:28 +00:00
Chris Lattner
377507b125 Add some new members
llvm-svn: 20034
2005-02-04 19:58:06 +00:00
Chris Lattner
28bfbb70dd add new member
llvm-svn: 20033
2005-02-04 19:57:57 +00:00
Chris Lattner
ba954f3284 Fix the Regression/Transforms/DSAnalysis/recursion.ll regression.
llvm-svn: 20031
2005-02-04 18:58:04 +00:00
Chris Lattner
0559691163 Fix a case where were incorrectly compiled cast from short to int on 64-bit
targets.

llvm-svn: 20030
2005-02-04 18:39:19 +00:00
Andrew Lenharth
5152be292a alignment
llvm-svn: 20028
2005-02-04 14:09:38 +00:00
Andrew Lenharth
202011fcc7 get alignment printing correctly and get rid of __main hack
llvm-svn: 20027
2005-02-04 14:01:21 +00:00
Andrew Lenharth
c8770aa507 fix constant pointer outputing on 64 bit machines
llvm-svn: 20026
2005-02-04 13:47:16 +00:00
Misha Brukman
20b8a65627 * Fix broken link to directions to get llvm, llvm-gcc, and llvm-test from CVS
* Remove duplicated CVS directions and refer reader to the CVS section
* Clean up directions to be brief

llvm-svn: 20023
2005-02-03 22:25:23 +00:00
Andrew Lenharth
799479138e FP fixes
llvm-svn: 20019
2005-02-03 21:01:15 +00:00
Chris Lattner
3dd3df2b55 Refactor getFunctionArgumentsForCall out of mergeInGraph.
llvm-svn: 20018
2005-02-03 18:40:25 +00:00
Chris Lattner
446b15f3a3 Add a new method.
llvm-svn: 20017
2005-02-03 18:40:05 +00:00
Misha Brukman
cd673250ba * Clearly mark LLVM_LIB_SEARCH_PATH as being optional
* llvmgcc and llvmg++ aliases are no longer needed (binaries have llvm- prefix)

llvm-svn: 20016
2005-02-03 18:28:08 +00:00
Chris Lattner
45a6a18393 This is no longer needed. Global variables with undef initializers can be
initialized to anything, including garbage.

llvm-svn: 20010
2005-02-02 20:50:50 +00:00
Misha Brukman
d4528ea031 * Instead of fixing the version numbers before every release, mark them as x.y
* Eliminate the redundant "This is the..." in released file listing
* Fix grammar

llvm-svn: 20005
2005-02-02 18:01:57 +00:00
Andrew Lenharth
75c6225f32 Store fix
llvm-svn: 20004
2005-02-02 17:32:39 +00:00
Andrew Lenharth
cf2e21e879 oops
llvm-svn: 20003
2005-02-02 17:01:31 +00:00
Andrew Lenharth
fe6e7a30c0 prevent register allocator from using the stack pointer :)
llvm-svn: 20002
2005-02-02 17:00:21 +00:00
Andrew Lenharth
c7042c2d8b fix loading of floats
llvm-svn: 19997
2005-02-02 15:05:33 +00:00
Jeff Cohen
fc9f146966 Put libraries in a common directory
llvm-svn: 19995
2005-02-02 06:33:11 +00:00
Andrew Lenharth
0f42d92ca0 marked mem* as not supported
llvm-svn: 19992
2005-02-02 05:49:42 +00:00
Jeff Cohen
d44e5dae0f Add additional source of Win32 GNU utilities.
llvm-svn: 19991
2005-02-02 05:46:20 +00:00
Alkis Evlogimenos
346bb20409 Fix crash on MallocInsts of unsized types.
llvm-svn: 19988
2005-02-02 04:43:37 +00:00
Andrew Lenharth
07c0b0d92b fix Load bug
llvm-svn: 19987
2005-02-02 04:35:44 +00:00
Chris Lattner
5aa75e4ce5 Fix yet another memset issue.
llvm-svn: 19986
2005-02-02 03:44:41 +00:00
Andrew Lenharth
c7e55f430c try to make a bug bugpointable, add yet more constant pool stuff, fixup constant loads for FP
llvm-svn: 19985
2005-02-02 03:36:35 +00:00
Andrew Lenharth
ae88b6a8a8 better constant handling, should fix many remaining cases
llvm-svn: 19984
2005-02-02 00:51:15 +00:00
Alkis Evlogimenos
7c04a3ddb6 Add variable for bugpoint.
llvm-svn: 19981
2005-02-02 00:40:15 +00:00
Chris Lattner
16a53243c6 Eliminate some duplicated debug code
llvm-svn: 19980
2005-02-01 21:55:40 +00:00
Chris Lattner
5ce51e83af Eliminate self-recursion as a special case.
llvm-svn: 19979
2005-02-01 21:49:43 +00:00
Chris Lattner
50cebc6b9b Eliminate use of DSCallSiteIterator in key loop. This is a half step to
a tasty speedup.

llvm-svn: 19978
2005-02-01 21:37:27 +00:00
Chris Lattner
eb5febea34 remove dead method
llvm-svn: 19977
2005-02-01 21:37:06 +00:00
Andrew Lenharth
9df6a764b9 fix FP arg passing bug, Add unsigned to/from int, fix SELECT, fix Constant pool
llvm-svn: 19976
2005-02-01 20:40:27 +00:00
Andrew Lenharth
20d8b2ff71 Print the Constant pool
llvm-svn: 19975
2005-02-01 20:38:53 +00:00
Andrew Lenharth
32124c0a70 Make cmov work right and loads for fp from constant pool
llvm-svn: 19974
2005-02-01 20:36:44 +00:00
Andrew Lenharth
c777d4f03d Correct stack stuff for FP
llvm-svn: 19973
2005-02-01 20:35:57 +00:00
Andrew Lenharth
8fb0d5002b try to match alpha pattern
llvm-svn: 19972
2005-02-01 20:35:11 +00:00
Andrew Lenharth
7703d1ab25 fix register names
llvm-svn: 19971
2005-02-01 20:34:29 +00:00
Chris Lattner
63a46cee87 Signficantly speed up printing by not emitting the same file twice with
different names.  Large SCC's tend to be big, so this saves a lot of time.

llvm-svn: 19970
2005-02-01 19:10:48 +00:00
Chris Lattner
4487b2e5a6 Fix some bugs andrew noticed legalizing memset for alpha
llvm-svn: 19969
2005-02-01 18:38:28 +00:00
Chris Lattner
d6106a41fe Do not revisit nodes in the SCC traversal. This speeds up the BU pass a bit.
llvm-svn: 19968
2005-02-01 17:35:52 +00:00
Jeff Cohen
c04c0dbd19 Put finishing touches on GettingStartedVS.html and link it to the index.
llvm-svn: 19967
2005-02-01 15:59:28 +00:00
Chris Lattner
085c981345 Fix test/Regression/Assembler/2005-01-31-CallingAggregateFunction.ll
llvm-svn: 19966
2005-02-01 01:47:42 +00:00
Chris Lattner
29b97d53c1 Apparently := confuses makellvm
llvm-svn: 19965
2005-02-01 01:47:12 +00:00
Chris Lattner
4298e1fea4 This bug crashes the assembler, distilled from a testcase produced by Andrew.
llvm-svn: 19964
2005-02-01 01:44:54 +00:00
Andrew Lenharth
cdc9e33ae5 pecimise loads, put indirect call addr in right register. still doesn't fix methcall
llvm-svn: 19963
2005-02-01 01:37:24 +00:00
Chris Lattner
f87e05be26 Update speedup and shrinkage info
llvm-svn: 19962
2005-02-01 01:33:52 +00:00
Chris Lattner
4947e67c4f Updates for new use list changes.
llvm-svn: 19961
2005-02-01 01:24:21 +00:00
Chris Lattner
b6c21dbb1e Update for API change.
llvm-svn: 19960
2005-02-01 01:24:01 +00:00
Chris Lattner
82b42c5d85 API change.
llvm-svn: 19959
2005-02-01 01:23:49 +00:00
Chris Lattner
d6a4492f81 Adjust to changes in APIs
llvm-svn: 19958
2005-02-01 01:23:31 +00:00
Chris Lattner
f98a7bffb3 Hacks to make this ugly ugly code work with the new use lists.
llvm-svn: 19957
2005-02-01 01:22:56 +00:00
Chris Lattner
ef55a1a775 Switch from using an ilist for uses to using a custom doubly linked list.
This list does not provide the ability to go backwards in the list (its
more of an unordered collection, stored in the shape of a list).

This change means that use iterators are now only forward iterators, not
bidirectional.

This improves the memory usage of use lists from '5 + 4*#use' per value to
'1 + 4*#use'.  While it would be better to reduce the multiplied factor,
I'm not smart enough to do so.  This list also has slightly more efficient
operators for manipulating list nodes (a few less loads/stores), due to not
needing to be able to iterate backwards through the list.

This change reduces the memory footprint required to hold 176.gcc from
66.025M -> 57.687M, a 14% reduction.  It also speeds up the compiler,
7.73% in the case of bytecode loading alone (release build loading 176.gcc).

llvm-svn: 19956
2005-02-01 01:22:06 +00:00
Chris Lattner
1230cf25ba Fix a problem where we could infinitely recurse on phi nodes.
llvm-svn: 19955
2005-02-01 00:18:30 +00:00
Misha Brukman
8dfa2e4465 Fix hyphenation in output comment
llvm-svn: 19954
2005-01-31 06:19:57 +00:00
Chris Lattner
72684fecf8 Implement InstCombine/cast.ll:test25, a case that occurs many times
in spec

llvm-svn: 19953
2005-01-31 05:51:45 +00:00
Chris Lattner
46452d4558 New testcase
llvm-svn: 19952
2005-01-31 05:51:18 +00:00
Jeff Cohen
1b0d750ade Add LLVM with Visual Studio overview
llvm-svn: 19951
2005-01-31 05:42:10 +00:00
Chris Lattner
31f486c775 Implement the trivial cases in InstCombine/store.ll
llvm-svn: 19950
2005-01-31 05:36:43 +00:00
Chris Lattner
2357f255ca New testcase
llvm-svn: 19949
2005-01-31 05:36:19 +00:00
Chris Lattner
c456eac1b9 Rename these to start with %c, as they are the only ones that are checked.
No change to the tests themselves.

llvm-svn: 19948
2005-01-31 05:17:31 +00:00
Chris Lattner
fe1b0b8b24 Implement Transforms/InstCombine/cast-load-gep.ll, which allows us to devirtualize
11 indirect calls in perlbmk.

llvm-svn: 19947
2005-01-31 04:50:46 +00:00
Chris Lattner
340ab5bbbb New testcase
llvm-svn: 19946
2005-01-31 04:49:22 +00:00
Andrew Lenharth
ae25bb1dc5 indirect call fix
llvm-svn: 19945
2005-01-31 03:19:31 +00:00
Andrew Lenharth
c40d156dc9 fp to int and back conversion sequences
llvm-svn: 19944
2005-01-31 01:44:26 +00:00
Chris Lattner
ccf22fb182 Fix the regressions my User changes introduced. Apparently some parts of
LLVM make the very reasonable assumption that constant expressions will
have at least one operand! :)

llvm-svn: 19943
2005-01-31 01:11:13 +00:00
Chris Lattner
2ca79d339e Rename variables to work with VC++'s hokey scoping rules.
llvm-svn: 19942
2005-01-31 00:10:58 +00:00
Chris Lattner
2977b857c2 Fix some scary bugs that VC++ detected.
llvm-svn: 19941
2005-01-31 00:10:45 +00:00
Chris Lattner
e9772aea47 Make things more const-correct, adjust to changes in DSA interfaces.
llvm-svn: 19940
2005-01-30 23:51:25 +00:00
Chris Lattner
a1b39fa5ad * Make some methods more const correct.
* Change the FunctionCalls and AuxFunctionCalls vectors into std::lists.
  This makes many operations on these lists much more natural, and avoids
  *exteremely* expensive copying of DSCallSites (e.g. moving nodes around
  between lists, erasing a node from not the end of the vector, etc).

With a profile build of analyze, this speeds up BU DS from 25.14s to
12.59s on 176.gcc.  I expect that it would help TD even more, but I don't
have data for it.

This effectively eliminates removeIdenticalCalls and children from the
profile, going from 6.53 to 0.27s.

llvm-svn: 19939
2005-01-30 23:51:02 +00:00
Andrew Lenharth
7141334f98 added fp extend and removed a forgotten assert in more than 6 arg support (should break somewhere else now :) ) and fix an incorrect asm sequence for indirect calls
llvm-svn: 19938
2005-01-30 20:42:36 +00:00
Jeff Cohen
391380ee97 Silence VC++ warnings about using 'this' in base member initializations.
llvm-svn: 19937
2005-01-30 17:54:12 +00:00
Chris Lattner
8e62f434cd This code is really unreachable.
llvm-svn: 19934
2005-01-30 16:33:46 +00:00
Chris Lattner
bfa060c5d2 Fix warnings.
llvm-svn: 19933
2005-01-30 16:32:48 +00:00
Andrew Lenharth
918a29fc51 support for larger calls
llvm-svn: 19932
2005-01-30 00:35:27 +00:00
Chris Lattner
79a85fada1 Improve spelling
llvm-svn: 19931
2005-01-30 00:13:34 +00:00
Chris Lattner
f6c93e36c7 Improve conformance with the Misha spelling benchmark suite
llvm-svn: 19930
2005-01-30 00:09:23 +00:00
Tanya Lattner
5ca41e2b68 Make this work on systems where size_t == unsigned and where they are not
the same.

llvm-svn: 19929
2005-01-29 23:29:55 +00:00
Tanya Lattner
238cf92000 Make this work on systems where size_t is not the same as unsigned.
llvm-svn: 19928
2005-01-29 23:08:01 +00:00
Chris Lattner
fdec565f1f Unbreak the build :(
llvm-svn: 19926
2005-01-29 19:27:28 +00:00
Chris Lattner
2f0a1108ff Adjust to ilist changes.
Based on the ilist changes avoid allocating an entire Use object for the
end of the Use chain.  This saves 8 bytes of memory for each Value allocated
in the program.  For 176.gcc, this reduces us from 69.5M -> 66.0M, a 5.3%
memory savings.

llvm-svn: 19925
2005-01-29 18:43:28 +00:00
Chris Lattner
e6074aa08b adjust to ilist changes.
llvm-svn: 19924
2005-01-29 18:41:25 +00:00
Chris Lattner
e5c7b9a215 Adjust to ilist changes.
llvm-svn: 19923
2005-01-29 18:41:12 +00:00
Chris Lattner
f84ecca5f3 Adjust to changes in ilist
llvm-svn: 19922
2005-01-29 18:41:00 +00:00
Chris Lattner
02ccc2d7a0 Rename createNode -> createSentinal.
Add a new method, destroySentinal, that is used to delete it (instead of
requiring use of delete.

llvm-svn: 19921
2005-01-29 18:40:19 +00:00
Chris Lattner
0174b52dd9 clean up comments
llvm-svn: 19920
2005-01-29 17:29:05 +00:00
Chris Lattner
e89f022ba7 This has been deprecated for long enough, nuke it.
llvm-svn: 19919
2005-01-29 17:27:26 +00:00
Chris Lattner
800b72445f This file was schizophrenic when it came to representing sizes. In some
cases it represented them as 'unsigned's, which are not enough for 64-bit
hosts.  In other cases, it represented them as uint64_t's, which are
inefficient for 32-bit hosts.

This patch unifies all of the sizes to use size_t instead.

llvm-svn: 19918
2005-01-29 17:17:18 +00:00
Chris Lattner
0701b78768 There is no reason to include ostream here, include iosfwd instead.
This file was schizophrenic when it came to representing sizes.  In some
cases it represented them as 'unsigneds', which are not enough for 64-bit
hosts.  In other cases, it represented them as uint64_t's, which are
inefficient for 32-bit hosts.

This patch unifies all of the sizes to use size_t instead.

llvm-svn: 19917
2005-01-29 17:16:07 +00:00
Chris Lattner
bb4384ba71 After reading in a bc file, trim the resultant buffer down to what we
really need.  This reduces 4M of memory consumption reading 176.gcc.

llvm-svn: 19916
2005-01-29 17:05:56 +00:00
Chris Lattner
173340640a Finegrainify namespacification
llvm-svn: 19915
2005-01-29 16:53:02 +00:00
Andrew Lenharth
41bc2c2897 first step towards a correct and complete stack. also add some forms for things that were getting stuck in the nightly tester.
llvm-svn: 19914
2005-01-29 15:42:07 +00:00
Chris Lattner
1ec230e665 Due to previous simplifications, we can simplify the data structures being
used here.

llvm-svn: 19913
2005-01-29 07:04:10 +00:00
Chris Lattner
ce0fa4c109 Properly handle volatile.
llvm-svn: 19912
2005-01-29 06:42:34 +00:00
Chris Lattner
a194357025 Remove some useless map operations. Loads/stores that are in the same
BB as the load are not included in the Cand* sets at all.

llvm-svn: 19911
2005-01-29 06:39:25 +00:00
Chris Lattner
be62e72273 Before doing expensive global analysis, check to make sure the pointer is
not invalidated on entry and on exit of the block.  This fixes some N^2
behavior in common cases, and speeds up gcc another 5% to 22.35s.

llvm-svn: 19910
2005-01-29 06:31:53 +00:00
Chris Lattner
afdbae2b55 Fix quotes.
llvm-svn: 19909
2005-01-29 06:29:45 +00:00
Jeff Cohen
b49177f017 Unbreak VC++ build
llvm-svn: 19908
2005-01-29 06:27:16 +00:00
Chris Lattner
fe7a9a242e Minor simplification/speedup. Replaces a set lookup with a pointer comparison.
This speeds up 176.gcc from 25.73s to 23.48s, which is 9.5%

llvm-svn: 19907
2005-01-29 06:20:55 +00:00
Chris Lattner
787aed675d Eliminate generality that is not buying us anything. In particular, this
will cause us to miss cases where the input pointer to a load could be value
numbered to another load.  Something like this:


  %X = load int* %P1
  %Y = load int* %P2

Those are obviously the same if P1/P2 are the same.  The code this patch
removes attempts to handle that.  However, since GCSE iterates, this doesn't
actually buy us anything: GCSE will first replace P1 or P2 with the other
one, then the load can be value numbered as equal.

Removing this code speeds up gcse a lot.  On 176.gcc in debug mode, this
speeds up gcse from 29.08s -> 25.73s, a 13% savings.

llvm-svn: 19906
2005-01-29 06:11:16 +00:00
Chris Lattner
b25abcb1fa If we see:
%A = alloca int
  %V = load int* %A

value number %V to undef, not 0.

llvm-svn: 19905
2005-01-29 05:57:01 +00:00
Chris Lattner
2295d0b7de Memory used is a delta between memuse at the start of the time and the
memuse at the end, thus it is signed.

llvm-svn: 19904
2005-01-29 05:21:16 +00:00
Jeff Cohen
a7f83cf6b3 Unbreak VC++ build
llvm-svn: 19903
2005-01-29 03:32:49 +00:00
Chris Lattner
f711f8db41 Make sure that we always grow a multiple of 2 operands.
llvm-svn: 19902
2005-01-29 01:05:12 +00:00
Chris Lattner
e9c61fbb51 noteworthy.
llvm-svn: 19901
2005-01-29 00:44:22 +00:00
Chris Lattner
d8e20188c6 Adjust to changes in instruction interfaces.
llvm-svn: 19900
2005-01-29 00:39:08 +00:00
Chris Lattner
a3f06fa2dd Switchinst takes a hint for the number of cases it will have.
llvm-svn: 19899
2005-01-29 00:38:45 +00:00
Chris Lattner
a35dfcedd3 switchinst ctor now takes a hint for the number of cases that it will have.
llvm-svn: 19898
2005-01-29 00:38:26 +00:00
Chris Lattner
84d3137da7 Adjust Valuehandle to hold its operand directly in it.
llvm-svn: 19897
2005-01-29 00:37:36 +00:00
Chris Lattner
3479f9cca8 Finegrainify namespacification.
Adjust TmpInstruction to work with the new User model.

llvm-svn: 19896
2005-01-29 00:36:59 +00:00
Chris Lattner
68afd89730 add namespace qualifier
llvm-svn: 19895
2005-01-29 00:36:38 +00:00
Chris Lattner
616b8fc630 Adjust to changes in User class and minor changes in instruction ctors.
llvm-svn: 19894
2005-01-29 00:36:19 +00:00
Chris Lattner
2c08949c62 Adjust to slight changes in instruction interfaces.
llvm-svn: 19893
2005-01-29 00:35:55 +00:00
Chris Lattner
5d1bc2c408 Adjust to changes in User class.
llvm-svn: 19892
2005-01-29 00:35:33 +00:00
Chris Lattner
afdb3de4d7 Merge InstrTypes.cpp into this file
Adjust to changes in the User class, operand handling is very different.
PHI node and switch statements must handle explicit resizing of operand
lists.

llvm-svn: 19891
2005-01-29 00:35:16 +00:00
Chris Lattner
d0df99ce86 Adjust to changes in User class. Aggregate constants now must explicitly
manage their operands.

llvm-svn: 19890
2005-01-29 00:34:39 +00:00
Chris Lattner
03adb1aa83 This file is now merged into Instructions.cpp
llvm-svn: 19889
2005-01-29 00:33:32 +00:00
Chris Lattner
00b82c25bc Adjust to changes in the User class.
llvm-svn: 19888
2005-01-29 00:33:00 +00:00
Chris Lattner
5e9de0e083 Adjust to changes in the User class. Introduce a new UnaryInstruction
class.

llvm-svn: 19887
2005-01-29 00:32:51 +00:00
Chris Lattner
9d8da6a9f4 Adjust to user changes.
llvm-svn: 19886
2005-01-29 00:32:00 +00:00
Chris Lattner
4921cdf9c0 Many changes to cope with the User.h changes. Instructions now generally
directly embed their operands.

llvm-svn: 19885
2005-01-29 00:31:36 +00:00
Chris Lattner
893314cd3a Adjust to User.h changes.
llvm-svn: 19884
2005-01-29 00:30:52 +00:00
Chris Lattner
f11ea56ef6 Instead of storing operands as std::vector<Use>, just maintain a pointer
and num operands in the User class.  this allows us to embed the operands
directly in the subclasses if possible.  For example, for binary operators
we store the two operands in the derived class.

The has several effects:
  1. it improves locality because the operands and instruction are together
  2. it makes accesses to operands faster (one less load) if you access them
     through the derived class pointer.  For example this:

Value *GetBinaryOperatorOp(BinaryOperator *I, int i) {
  return I->getOperand(i);
}

Was compiled to:

_Z19GetBinaryOperatorOpPN4llvm14BinaryOperatorEi:
        movl    4(%esp), %edx
        movl    8(%esp), %eax
        sall    $4, %eax
        movl    24(%edx), %ecx
        addl    %ecx, %eax
        movl    (%eax), %eax
        ret

and is now compiled to:

_Z19GetBinaryOperatorOpPN4llvm14BinaryOperatorEi:
        movl    8(%esp), %eax
        movl    4(%esp), %edx
        sall    $4, %eax
        addl    %edx, %eax
        movl    44(%eax), %eax
        ret

Accesses through "Instruction*" are unmodified.

   3. This reduces memory consumption (by about 3%) by eliminating 1 word of
      vector overhead and a malloc header on a seperate object.
   4. This speeds up gccas about 10% (both debug and release builds) on
      large things (such as 176.gcc).  For example, it takes a debug build
      from 172.9 -> 155.6s and a release gccas from 67.7 -> 61.8s

llvm-svn: 19883
2005-01-29 00:29:39 +00:00
Andrew Lenharth
4a0d200c13 fix ExprMap, partially teach about add long
llvm-svn: 19882
2005-01-28 23:17:54 +00:00
Chris Lattner
feaf92f7ad Fix a nasty thinko in my previous commit.
llvm-svn: 19881
2005-01-28 23:17:27 +00:00
Chris Lattner
bc7497d5f5 Alpha doesn't have a native f32 extload instruction.
llvm-svn: 19880
2005-01-28 22:58:25 +00:00
Chris Lattner
bf8c1ad313 implement legalization of truncates whose results and sources need to be
truncated, e.g. (truncate:i8 something:i16) on a 32 or 64-bit RISC.

llvm-svn: 19879
2005-01-28 22:52:50 +00:00
Chris Lattner
a4cfafe31a Get alpha working with memset/memcpy/memmove
llvm-svn: 19878
2005-01-28 22:29:18 +00:00
Reid Spencer
3a46875e54 Fix some typos in the Makefile.rules.
Patch contributed by Vladimer Merzliakov.

llvm-svn: 19877
2005-01-28 19:52:32 +00:00
Chris Lattner
cd96168c95 Hrm, who knows what 'uint' is, but it seems to work sometimes? Wierd.
llvm-svn: 19876
2005-01-28 19:37:35 +00:00
Chris Lattner
cd517ff0c7 * add some DEBUG statements
* Properly compile this:

struct a {};
int test() {
  struct a b[2];
  if (&b[0] != &b[1])
    abort ();
  return 0;
}

to 'return 0', not abort().

llvm-svn: 19875
2005-01-28 19:32:01 +00:00
Chris Lattner
60c47267a9 Fix ConstProp/2005-01-28-SetCCGEP.ll: indexing over zero sized elements does
not change the address.

llvm-svn: 19874
2005-01-28 19:09:51 +00:00
Chris Lattner
e3aa4c01d5 New testcase.
llvm-svn: 19873
2005-01-28 19:08:32 +00:00
Chris Lattner
54903b68f2 Add some initial documentation for the SelectionDAG based instruction selectors
llvm-svn: 19872
2005-01-28 17:22:53 +00:00
Chris Lattner
5d88f184e2 Do not clean up if the MappedFile was never used or if the client already
closed the file.  This unbreaks the build.

llvm-svn: 19871
2005-01-28 16:08:23 +00:00
Andrew Lenharth
579a324137 fix ExprMap and constant check in setcc
llvm-svn: 19870
2005-01-28 14:06:46 +00:00
Jeff Cohen
c723678541 Get VC++ compiling again
llvm-svn: 19869
2005-01-28 07:29:32 +00:00
Reid Spencer
adabeccd02 Convert some old C-style casts to C++ style.
llvm-svn: 19868
2005-01-28 07:22:20 +00:00
Andrew Lenharth
479bc61455 move FP into it's own select
llvm-svn: 19867
2005-01-28 06:57:18 +00:00
Chris Lattner
eb6614d719 CopyFromReg produces two values. Make sure that we remember that both are
legalized, and actually return the correct result when we legalize the chain first.

llvm-svn: 19866
2005-01-28 06:27:38 +00:00
Chris Lattner
38389b1633 These passes are no more.
llvm-svn: 19865
2005-01-28 06:13:52 +00:00
Chris Lattner
c782335e33 Remove this code as it is currently completely broken and unmaintained.
If needed, this can be resurrected from CVS.

Note that several of the interfaces (e.g. the IPModRef ones) are supersumed
by generic AliasAnalysis interfaces that have been written since this code
was developed (and they are not DSA specific).

llvm-svn: 19864
2005-01-28 06:12:46 +00:00
Jeff Cohen
971e03d74a Properly close mapped files.
llvm-svn: 19863
2005-01-28 01:17:07 +00:00
Misha Brukman
df77835166 Mark -parallel pass as `experimental'
llvm-svn: 19858
2005-01-27 17:59:51 +00:00
Andrew Lenharth
7c538a6593 stack frame fix and zero FP reg fix
llvm-svn: 19857
2005-01-27 08:31:19 +00:00
Andrew Lenharth
96515adad6 Floating point instructions like Floating point registers
llvm-svn: 19856
2005-01-27 07:58:15 +00:00
Andrew Lenharth
0cceb5165e int to float conversion and another setcc
llvm-svn: 19855
2005-01-27 07:50:35 +00:00
Misha Brukman
3852f652bf Fix grammar
llvm-svn: 19854
2005-01-27 06:46:38 +00:00
Andrew Lenharth
3c361fd6f7 teach isel about comparison with constants and zero extending bits
llvm-svn: 19853
2005-01-27 03:49:45 +00:00
Jeff Cohen
9671b213b6 Fix some Path bugs
llvm-svn: 19852
2005-01-27 03:49:03 +00:00
Andrew Lenharth
5374789198 perhaps this will let me have calls again
llvm-svn: 19851
2005-01-27 01:22:48 +00:00
Andrew Lenharth
9e27e54d70 minor bug fix
llvm-svn: 19850
2005-01-27 00:52:26 +00:00
Andrew Lenharth
9748b623a4 minor bug fix
llvm-svn: 19849
2005-01-27 00:51:05 +00:00
Andrew Lenharth
267908ad47 added instructions for fp to int to fp moves
llvm-svn: 19848
2005-01-26 23:56:48 +00:00
Andrew Lenharth
5ae5f81720 initial fp support
llvm-svn: 19847
2005-01-26 21:54:09 +00:00
Chris Lattner
651ffb1df8 xfail this.
llvm-svn: 19846
2005-01-26 07:09:44 +00:00
Chris Lattner
a710180bba XFAIL this for now.
llvm-svn: 19845
2005-01-26 07:08:42 +00:00
Andrew Lenharth
589304de7f hum, writing on one machine, testing on another...
llvm-svn: 19844
2005-01-26 02:53:56 +00:00
Andrew Lenharth
02c5459948 add some operations, fix others. should compile several more tests now
llvm-svn: 19843
2005-01-26 01:24:38 +00:00
Chris Lattner
1b20615173 We can fold promoted and non-promoted loads into divs also!
llvm-svn: 19835
2005-01-25 20:35:10 +00:00
Chris Lattner
30607ec66e Fold promoted loads into binary ops for FP, allowing us to generate m32 forms
of FP ops.

llvm-svn: 19834
2005-01-25 20:03:11 +00:00
Andrew Lenharth
ba2bcd867f problems with bools, and their work arounds
llvm-svn: 19833
2005-01-25 19:58:40 +00:00
Alkis Evlogimenos
fbd921987f Add a dependency to the trace library so that it gets pulled in
automatically.

llvm-svn: 19828
2005-01-25 16:23:57 +00:00
Reid Spencer
97f0f7646d Document the --load option.
llvm-svn: 19822
2005-01-25 05:04:49 +00:00
Andrew Lenharth
122489bcab more load choices, better add with imm
llvm-svn: 19821
2005-01-25 00:35:34 +00:00
Chris Lattner
2e2edef9c6 Make -ds-aa more useful, allowing it to be updated as xforms hack on the program.
llvm-svn: 19818
2005-01-24 20:00:14 +00:00
Chris Lattner
d64fafd937 Add some methods.
llvm-svn: 19817
2005-01-24 19:55:34 +00:00
Andrew Lenharth
2f0f845534 Clean ups, and taught the instruction selector about immediate forms
llvm-svn: 19816
2005-01-24 19:44:07 +00:00
Andrew Lenharth
6d1a96bccc Alpha JIT prune
llvm-svn: 19815
2005-01-24 18:48:22 +00:00
Andrew Lenharth
3c12772190 include prune and JIT prune
llvm-svn: 19814
2005-01-24 18:45:41 +00:00
Andrew Lenharth
4680f89526 Pruned includes
llvm-svn: 19813
2005-01-24 18:37:48 +00:00
Andrew Lenharth
f36418f618 let configure recognize Alphas
llvm-svn: 19811
2005-01-24 17:33:52 +00:00
Andrew Lenharth
3c3de91b79 let configure recognize Alphas
llvm-svn: 19810
2005-01-24 17:25:41 +00:00
Misha Brukman
454c06f5a4 Mark CVS versions different from releases
llvm-svn: 19809
2005-01-24 16:29:24 +00:00
Misha Brukman
664d251443 primitive' has no a'
llvm-svn: 19808
2005-01-24 16:28:03 +00:00
Chris Lattner
5b9c49b6f2 Do not return true from isSized for things without a size (like functions and
labels) even though they are concrete.  This fixes the DSA regressions from
last night.

llvm-svn: 19807
2005-01-24 16:00:52 +00:00
Chris Lattner
b6627702b4 This giant patch speeds up Type::isSized(). Before, this would have to search
large nested types over and over again to determine if they are sized or not.
Now, isSized() is able to make snap decisions about all concrete types, which
are a common occurance (and includes all primitives).

On 177.mesa, this speeds up DSE from 39.5s -> 21.3s and GCSE from
13.2s -> 11.3s, reducing gccas time from 80s -> 61s (this is a debug build).

DSE and GCSE are still too slow on this testcase, but this is a simple
improvement.

llvm-svn: 19800
2005-01-24 02:08:34 +00:00
Chris Lattner
39837024ae Fix a spurious warning.
llvm-svn: 19799
2005-01-24 01:40:18 +00:00
Chris Lattner
0e1de101a1 Silence a warning.
llvm-svn: 19798
2005-01-23 23:20:06 +00:00
Chris Lattner
0dfd7d3a0d Silence optimized warnings.
llvm-svn: 19797
2005-01-23 23:19:44 +00:00
Chris Lattner
debae1e3c3 Allow the FP stackifier to completely ignore functions that do not use FP at
all.  This should speed up the X86 backend fairly significantly on integer
codes.  Now if only we didn't have to compute livevar still... ;-)

llvm-svn: 19796
2005-01-23 23:13:59 +00:00
Chris Lattner
fb5614506e Simplify/speedup the PEI by not having to scan for uses of the callee saved
registers.  This information is computed directly by the register allocator
now.

llvm-svn: 19795
2005-01-23 23:13:12 +00:00
Chris Lattner
90b491f46a Add an accessor.
llvm-svn: 19794
2005-01-23 22:57:27 +00:00
Chris Lattner
3d527f7b61 Update physregsused info.
llvm-svn: 19793
2005-01-23 22:55:45 +00:00
Chris Lattner
24f0f0e28f Update this pass to set PhysRegsUsed info in MachineFunction.
llvm-svn: 19792
2005-01-23 22:51:56 +00:00
Chris Lattner
ae09d93b35 Update these register allocators to set the PhysRegUsed info in MachineFunction.
llvm-svn: 19791
2005-01-23 22:45:13 +00:00
Chris Lattner
304053c6ec Add support for the PhysRegsUsed array.
llvm-svn: 19789
2005-01-23 22:13:58 +00:00
Chris Lattner
1def519f3d Expose more information from register allocation to passes that run after
it.

llvm-svn: 19788
2005-01-23 22:13:36 +00:00
Chris Lattner
ef2de322c6 Speed this up a bit by making ModifiedRegs a vector<char> not vector<bool>
llvm-svn: 19787
2005-01-23 21:45:01 +00:00
Chris Lattner
9e2c7facb2 Get rid of a several dozen more and instructions in specint.
llvm-svn: 19786
2005-01-23 20:26:55 +00:00
Chris Lattner
6c43f5e5fe Fix crash comparing empty file against nonempty file.
llvm-svn: 19782
2005-01-23 06:02:40 +00:00
Chris Lattner
4add7e356f Adjust to changes in SelectionDAG interfaces
The first half of correct chain insertion for libcalls. This is not enough
to fix Fhourstones yet though.

llvm-svn: 19781
2005-01-23 04:42:50 +00:00
Chris Lattner
90b7c13f3a Remove the 3 HACK HACK HACKs I put in before, fixing them properly with
the new TLI that is available.

Implement support for handling out of range shifts.  This allows us to
compile this code (a 64-bit rotate):

unsigned long long f3(unsigned long long x) {
  return (x << 32) | (x >> (64-32));
}

into this:

f3:
        mov %EDX, DWORD PTR [%ESP + 4]
        mov %EAX, DWORD PTR [%ESP + 8]
        ret

GCC produces this:

$ gcc t.c -masm=intel -O3 -S -o - -fomit-frame-pointer
..
f3:
        push    %ebx
        mov     %ebx, DWORD PTR [%esp+12]
        mov     %ecx, DWORD PTR [%esp+8]
        mov     %eax, %ebx
        mov     %edx, %ecx
        pop     %ebx
        ret

The Simple ISEL produces (eww gross):

f3:
        sub %ESP, 4
        mov DWORD PTR [%ESP], %ESI
        mov %EDX, DWORD PTR [%ESP + 8]
        mov %ECX, DWORD PTR [%ESP + 12]
        mov %EAX, 0
        mov %ESI, 0
        or %EAX, %ECX
        or %EDX, %ESI
        mov %ESI, DWORD PTR [%ESP]
        add %ESP, 4
        ret

llvm-svn: 19780
2005-01-23 04:39:44 +00:00
Chris Lattner
ffcb0ae329 Adjust to changes in SelectionDAG interface.
llvm-svn: 19779
2005-01-23 04:36:26 +00:00
Chris Lattner
2877e9e826 Give SelectionDAG a TargetLowering instance instead of TM instance.
llvm-svn: 19778
2005-01-23 04:36:06 +00:00
Chris Lattner
28939a222e Build Alpha by default.
llvm-svn: 19777
2005-01-23 04:34:46 +00:00
Reid Spencer
d5d45b8d1a Fix alloca support for Cygwin. On cygwin its __alloca not __builtin_alloca
llvm-svn: 19776
2005-01-23 04:32:47 +00:00
Reid Spencer
30226da5b3 Support Cygwin assembly generation. The cygwin version of Gnu ASsembler
doesn't support certain directives and symbols on cygwin are prefixed with
an underscore. This patch makes the necessary adjustments to the output.

llvm-svn: 19775
2005-01-23 03:52:14 +00:00
Chris Lattner
ece10a420e Add support for fp tolerances
llvm-svn: 19774
2005-01-23 03:45:26 +00:00
Chris Lattner
580f5bfae3 This method takes sys::Path objects now.
llvm-svn: 19773
2005-01-23 03:32:16 +00:00
Chris Lattner
411bbeeac7 Adjust to changed interface.
llvm-svn: 19772
2005-01-23 03:31:39 +00:00
Chris Lattner
b782187b32 Make DiffFilesWithTolerance take sys::Path's instead of std::strings
Delete dead functions.

llvm-svn: 19771
2005-01-23 03:31:02 +00:00
Chris Lattner
7e264b2ec6 Remove two dead methods and improve the comments for DiffFilesWithTolerance.
Also, make DiffFilesWithTolerance take sys::Path objects instead of std::strings.

llvm-svn: 19770
2005-01-23 03:30:39 +00:00
Chris Lattner
364e8b771d Fix a bug in previous checkin
llvm-svn: 19769
2005-01-23 03:19:13 +00:00
Chris Lattner
dff29cd72e Drop dead #include
llvm-svn: 19768
2005-01-23 03:16:56 +00:00
Chris Lattner
c5a20a5dd4 The meat of this utility has been moved to FileUtilities, where it can be
used by other tools.

llvm-svn: 19767
2005-01-23 03:15:47 +00:00
Chris Lattner
16a4368c40 Add a new method, refactored out of fpcmp
llvm-svn: 19766
2005-01-23 03:13:43 +00:00
Chris Lattner
ca2bf0b67a New method.
llvm-svn: 19765
2005-01-23 03:11:38 +00:00
Andrew Lenharth
a1b5ca2b9d Let me introduce you to the early stages of the llvm backend for the alpha processor
llvm-svn: 19764
2005-01-22 23:41:55 +00:00
Chris Lattner
eccb73d57f Get this to work for 64-bit systems.
llvm-svn: 19763
2005-01-22 23:04:37 +00:00
Reid Spencer
12b25a12a6 We're working towards LLVM 1.5 now so bump the version number. This change
won't be propagated to the configure script until there's a need to change
configure.ac for some larger purpose.

llvm-svn: 19762
2005-01-22 21:29:42 +00:00
Chris Lattner
97cf8fd4a9 Minor fix.
llvm-svn: 19761
2005-01-22 20:59:38 +00:00
Chris Lattner
59a7f5c2f3 This is the final big of factoring. This shares cases in suboperand
differences, which means that identical instructions (after stripping off
the first literal string) do not run any different code at all.  On the X86,
this turns this code:

    switch (MI->getOpcode()) {
    case X86::ADC32mi: printOperand(MI, 4, MVT::i32); break;
    case X86::ADC32mi8: printOperand(MI, 4, MVT::i8); break;
    case X86::ADC32mr: printOperand(MI, 4, MVT::i32); break;
    case X86::ADD32mi: printOperand(MI, 4, MVT::i32); break;
    case X86::ADD32mi8: printOperand(MI, 4, MVT::i8); break;
    case X86::ADD32mr: printOperand(MI, 4, MVT::i32); break;
    case X86::AND32mi: printOperand(MI, 4, MVT::i32); break;
    case X86::AND32mi8: printOperand(MI, 4, MVT::i8); break;
    case X86::AND32mr: printOperand(MI, 4, MVT::i32); break;
    case X86::CMP32mi: printOperand(MI, 4, MVT::i32); break;
    case X86::CMP32mr: printOperand(MI, 4, MVT::i32); break;
    case X86::MOV32mi: printOperand(MI, 4, MVT::i32); break;
    case X86::MOV32mr: printOperand(MI, 4, MVT::i32); break;
    case X86::OR32mi: printOperand(MI, 4, MVT::i32); break;
    case X86::OR32mi8: printOperand(MI, 4, MVT::i8); break;
    case X86::OR32mr: printOperand(MI, 4, MVT::i32); break;
    case X86::ROL32mi: printOperand(MI, 4, MVT::i8); break;
    case X86::ROR32mi: printOperand(MI, 4, MVT::i8); break;
    case X86::SAR32mi: printOperand(MI, 4, MVT::i8); break;
    case X86::SBB32mi: printOperand(MI, 4, MVT::i32); break;
    case X86::SBB32mi8: printOperand(MI, 4, MVT::i8); break;
    case X86::SBB32mr: printOperand(MI, 4, MVT::i32); break;
    case X86::SHL32mi: printOperand(MI, 4, MVT::i8); break;
    case X86::SHLD32mrCL: printOperand(MI, 4, MVT::i32); break;
    case X86::SHR32mi: printOperand(MI, 4, MVT::i8); break;
    case X86::SHRD32mrCL: printOperand(MI, 4, MVT::i32); break;
    case X86::SUB32mi: printOperand(MI, 4, MVT::i32); break;
    case X86::SUB32mi8: printOperand(MI, 4, MVT::i8); break;
    case X86::SUB32mr: printOperand(MI, 4, MVT::i32); break;
    case X86::TEST32mi: printOperand(MI, 4, MVT::i32); break;
    case X86::TEST32mr: printOperand(MI, 4, MVT::i32); break;
    case X86::TEST8mi: printOperand(MI, 4, MVT::i8); break;
    case X86::XCHG32mr: printOperand(MI, 4, MVT::i32); break;
    case X86::XOR32mi: printOperand(MI, 4, MVT::i32); break;
    case X86::XOR32mi8: printOperand(MI, 4, MVT::i8); break;
    case X86::XOR32mr: printOperand(MI, 4, MVT::i32); break;
    }

into this:

    switch (MI->getOpcode()) {
    case X86::ADC32mi:
    case X86::ADC32mr:
    case X86::ADD32mi:
    case X86::ADD32mr:
    case X86::AND32mi:
    case X86::AND32mr:
    case X86::CMP32mi:
    case X86::CMP32mr:
    case X86::MOV32mi:
    case X86::MOV32mr:
    case X86::OR32mi:
    case X86::OR32mr:
    case X86::SBB32mi:
    case X86::SBB32mr:
    case X86::SHLD32mrCL:
    case X86::SHRD32mrCL:
    case X86::SUB32mi:
    case X86::SUB32mr:
    case X86::TEST32mi:
    case X86::TEST32mr:
    case X86::XCHG32mr:
    case X86::XOR32mi:
    case X86::XOR32mr: printOperand(MI, 4, MVT::i32); break;
    case X86::ADC32mi8:
    case X86::ADD32mi8:
    case X86::AND32mi8:
    case X86::OR32mi8:
    case X86::ROL32mi:
    case X86::ROR32mi:
    case X86::SAR32mi:
    case X86::SBB32mi8:
    case X86::SHL32mi:
    case X86::SHR32mi:
    case X86::SUB32mi8:
    case X86::TEST8mi:
    case X86::XOR32mi8: printOperand(MI, 4, MVT::i8); break;
    }

After this, the generated asmwriters look pretty much as though they were
generated by hand.  This shrinks the X86 asmwriter.inc files from 55101->39669
and 55429->39551 bytes each, and PPC from 16766->12859 bytes.

llvm-svn: 19760
2005-01-22 20:31:17 +00:00
Chris Lattner
92275bb6bb Implement *even more* factoring. In particular, if all of the instruction
strings starts out with a constant string, we emit the string first, using
a table lookup (instead of a switch statement).

Because this is usually the opcode portion of the asm string, the differences
between the instructions have now been greatly reduced.  This allows many
more case statements to be grouped together.

This patch also allows instruction cases to be grouped together when the
instruction patterns are exactly identical (common after the opcode string
has been ripped off), and when the differing operand is a MachineInstr
operand that needs to be formatted.

The end result of this is a mean and lean generated AsmPrinter!

llvm-svn: 19759
2005-01-22 19:22:23 +00:00
Chris Lattner
945e8655dd Refactor code for numbering instructions into CodeGenTarget.
llvm-svn: 19758
2005-01-22 18:58:51 +00:00
Jeff Cohen
da636b3783 Fix VC++ compilation error
llvm-svn: 19757
2005-01-22 18:50:10 +00:00
Chris Lattner
64d9d2b819 QOI feature implemented.
llvm-svn: 19756
2005-01-22 18:45:35 +00:00
Chris Lattner
9ceb7c8f23 Implement factoring of instruction pattern strings. In particular, instead of
emitting code like this:

  case PPC::ADD: O  << "add ";  printOperand(MI, 0, MVT::i64); O  << ", ";  prin
tOperand(MI, 1, MVT::i64); O  << ", ";  printOperand(MI, 2, MVT::i64); O  << '\n
'; break;
  case PPC::ADDC: O  << "addc ";  printOperand(MI, 0, MVT::i64); O  << ", ";  pr
intOperand(MI, 1, MVT::i64); O  << ", ";  printOperand(MI, 2, MVT::i64); O  << '
\n'; break;
  case PPC::ADDE: O  << "adde ";  printOperand(MI, 0, MVT::i64); O  << ", ";  pr
intOperand(MI, 1, MVT::i64); O  << ", ";  printOperand(MI, 2, MVT::i64); O  << '
\n'; break;
...

Emit code like this:

  case PPC::ADD:
  case PPC::ADDC:
  case PPC::ADDE:
  ...
    switch (MI->getOpcode()) {
    case PPC::ADD: O << "add "; break;
    case PPC::ADDC: O << "addc "; break;
    case PPC::ADDE: O << "adde "; break;
    ...
    }
    printOperand(MI, 0, MVT::i64);
    O << ", ";
    printOperand(MI, 1, MVT::i64);
    O << ", ";
    printOperand(MI, 2, MVT::i64);
    O << "\n";
    break;

This shrinks the PPC asm writer from 24785->15205 bytes (even though the new
asmwriter has much more whitespace than the old one), and the X86 printers shrink
quite a bit too.  The important implication of this is that GCC no longer hits swap
when building the PPC backend in optimized mode.  Thus this fixes PR448.

-Chris

llvm-svn: 19755
2005-01-22 18:38:13 +00:00
Chris Lattner
b6f5d9a82a Fix the ::: problem
llvm-svn: 19754
2005-01-22 18:18:59 +00:00
Chris Lattner
3baf682110 Minor refactoring, no functionality change.
llvm-svn: 19753
2005-01-22 17:40:38 +00:00
Jeff Cohen
ff696def84 oops
llvm-svn: 19752
2005-01-22 17:37:13 +00:00
Jeff Cohen
c8f1f4bc8e Use binary mode for reading/writing bytecode files
llvm-svn: 19751
2005-01-22 17:36:17 +00:00
Jeff Cohen
e90b0c5469 Add (non-working) project bugpoint to Visual Studio
llvm-svn: 19750
2005-01-22 17:35:30 +00:00
Chris Lattner
0c23ba5c0f Seperate asmstring parsing from emission. This allows the code to be simpler
and more understandable.  It also allows us to do simple things like fold
consequtive literal strings together.  For example, instead of emitting this
for the X86 backend:

  O  << "adc" << "l" << " ";

we now generate this:

  O << "adcl ";

*whoa* :)

This shrinks the X86 asmwriters from 62729->58267 and 65176->58644 bytes
for the intel/att asm writers respectively.

llvm-svn: 19749
2005-01-22 17:32:42 +00:00
Jeff Cohen
0e64c73e67 Don't exclude FileUtilies and ToolRunner from VC++ build
llvm-svn: 19748
2005-01-22 16:32:47 +00:00
Jeff Cohen
142b4a721f Fix VC++ complaint
llvm-svn: 19747
2005-01-22 16:30:58 +00:00
Jeff Cohen
ccbd3f0d57 Fix destroyDirectory bug
llvm-svn: 19746
2005-01-22 16:28:33 +00:00
Chris Lattner
52c97fbea9 Implicitly defined registers can clobber callee saved registers too!
This fixes the return-address-not-being-saved problem in the Alpha backend.

llvm-svn: 19741
2005-01-22 00:49:16 +00:00
Andrew Lenharth
67e2e21353 make double-dollar properly escape asmstrings
llvm-svn: 19740
2005-01-22 00:35:22 +00:00
Chris Lattner
3bc78b2e0b More bugfixes for IA64 shifts.
llvm-svn: 19739
2005-01-22 00:33:03 +00:00
Chris Lattner
ec2183713c Fix problems with non-x86 targets.
llvm-svn: 19738
2005-01-22 00:31:52 +00:00
Chris Lattner
d637c96fac Add a nasty hack to fix Alpha/IA64 multiplies by a power of two.
llvm-svn: 19737
2005-01-22 00:20:42 +00:00
Chris Lattner
d53e763f18 Remove unneeded line.
llvm-svn: 19736
2005-01-21 23:43:12 +00:00
Chris Lattner
4f987bf16d test commit
llvm-svn: 19735
2005-01-21 23:38:56 +00:00
Chris Lattner
fc4429e7c1 Handle comparisons of gep instructions that have different typed indices
as long as they are the same size.

llvm-svn: 19734
2005-01-21 23:06:49 +00:00
Chris Lattner
e70eb9da7d Speed up folding operations into loads.
llvm-svn: 19733
2005-01-21 21:43:02 +00:00
Chris Lattner
e85a8d8f92 Keep track of node depth for each node
llvm-svn: 19732
2005-01-21 21:39:38 +00:00
Chris Lattner
e1e844c416 The ever-important vanity pass name :)
llvm-svn: 19731
2005-01-21 21:35:14 +00:00
Chris Lattner
28edd69eb4 If the interpreter tries to execute an external function, kill it. Of course
since we are dirty, special case __main.  This should fix the infinite loop
horrible stuff that happens on linux-alpha when configuring llvm-gcc.  It
might also help cygwin, who knows??

llvm-svn: 19729
2005-01-21 19:59:37 +00:00
Chris Lattner
c78776d209 Fix a FIXME: realize that argument stores are all independent (don't alias)
llvm-svn: 19728
2005-01-21 19:46:38 +00:00
Chris Lattner
96e809c47d Unary token factor nodes are unneeded.
llvm-svn: 19727
2005-01-21 18:01:22 +00:00
Chris Lattner
aac464e6c0 Refactor libcall code a bit. Initial implementation of expanding int -> FP
operations for 64-bit integers.

llvm-svn: 19724
2005-01-21 06:05:23 +00:00
Chris Lattner
4105d5f249 Apparently destroyFile() now throws an exception. Since this class is
designed to be put on the stack, that's not cool.  Catch and ignore the
exception.

llvm-svn: 19723
2005-01-20 23:31:35 +00:00
Chris Lattner
ac4e5ef023 Remove this test. This test is already in PR269, so it should be
readded when the bug is fixed.

llvm-svn: 19722
2005-01-20 20:58:42 +00:00
Chris Lattner
4d25c04f94 Simplify the shift-expansion code.
llvm-svn: 19721
2005-01-20 20:29:23 +00:00
Chris Lattner
2a631fa406 Implement ADD_PARTS/SUB_PARTS so that 64-bit integer add/sub work. This
fixes most of the remaining llc-beta failures.

llvm-svn: 19716
2005-01-20 18:53:00 +00:00
Chris Lattner
b3f83b28a5 Expand add/sub into ADD_PARTS/SUB_PARTS instead of a non-existant libcall.
llvm-svn: 19715
2005-01-20 18:52:28 +00:00
Chris Lattner
1fe9b40981 implement add_parts/sub_parts.
llvm-svn: 19714
2005-01-20 18:50:55 +00:00
Chris Lattner
ad1ffcc358 Eliminate the unimplemented ADDC/SUBB operations, add ADD_PARTS/SUB_PARTS instead.
llvm-svn: 19713
2005-01-20 18:50:39 +00:00
Chris Lattner
28d15860bd Add missing entry.
llvm-svn: 19712
2005-01-20 17:32:28 +00:00
Chris Lattner
5b04f33405 Fix a crash compiling 134.perl.
llvm-svn: 19711
2005-01-20 16:50:16 +00:00
Jeff Cohen
90f0dc8fc6 Get analyze to show all analysis options when compiled with VC++
llvm-svn: 19710
2005-01-20 05:19:40 +00:00
Jeff Cohen
e1fde90bac Add analyze project to Visual Studio
llvm-svn: 19709
2005-01-20 04:52:59 +00:00
Jeff Cohen
6eaf83e172 Add project llvm-proj to Visual Studio
llvm-svn: 19708
2005-01-20 04:41:49 +00:00
Chris Lattner
96c26751ec Support targets that do not use i8 shift amounts.
llvm-svn: 19707
2005-01-19 22:31:21 +00:00
Chris Lattner
411336fe04 Add two optimizations. The first folds (X+Y)-X -> Y
The second folds operations into selects, e.g. (select C, (X+Y), (Y+Z))
-> (Y+(select C, X, Z)

This occurs a few times across spec, e.g.

         select    add/sub
mesa:    83        0
povray:  5         2
gcc      4         2
parser   0         22
perlbmk  13        30
twolf    0         3

llvm-svn: 19706
2005-01-19 21:50:18 +00:00
Chris Lattner
2547f05be8 Add some new tests
llvm-svn: 19705
2005-01-19 21:48:31 +00:00
Chris Lattner
f840289291 Add an assertion that would have made more sense to duraid
llvm-svn: 19704
2005-01-19 21:32:07 +00:00
Chris Lattner
3d95c14d94 Add support for targets that pass args in registers to calls.
llvm-svn: 19703
2005-01-19 20:24:35 +00:00
Chris Lattner
5695864a41 Add an accessor for targets that pass args in regs
llvm-svn: 19702
2005-01-19 20:19:58 +00:00
Chris Lattner
55562fa99a Fold single use token factor nodes into other token factor nodes.
llvm-svn: 19701
2005-01-19 19:10:54 +00:00
Chris Lattner
0d03eb45a8 Realize the individual pieces of an expanded copytoreg/store/load are
independent of each other.

llvm-svn: 19700
2005-01-19 18:02:17 +00:00
Chris Lattner
9b75e148fd Know some identities about tokenfactor nodes.
llvm-svn: 19699
2005-01-19 18:01:40 +00:00
Chris Lattner
32a5f02598 Know some simple identities. This improves codegen for (1LL << N).
llvm-svn: 19698
2005-01-19 17:29:49 +00:00
Chris Lattner
474aac4da9 Fix a problem where were were literally selecting for INCREASED register
pressure, not decreases register pressure.  Fix problem where we accidentally
swapped the operands of SHLD, which caused fourinarow to fail.  This fixes
fourinarow.

llvm-svn: 19697
2005-01-19 17:24:34 +00:00
Chris Lattner
1cffa73f2a Just in case, handle something that is both a use and a def.
llvm-svn: 19696
2005-01-19 17:11:51 +00:00
Chris Lattner
00c436824f When an instruction moves, make sure to update the VarInfo::Kills list as
well as all of teh other stuff in livevar. This fixes the compiler crash
on fourinarow last night.

llvm-svn: 19695
2005-01-19 17:09:15 +00:00
Chris Lattner
25be208e02 When commuting these instructions, make sure to actually swap the operands too.
llvm-svn: 19694
2005-01-19 16:55:52 +00:00
Chris Lattner
a3cc1835ad Fix 'raise' to work with packed types. Patch by Morten Ofstad.
llvm-svn: 19693
2005-01-19 16:16:35 +00:00
Chris Lattner
de87d146ab Implement Regression/CodeGen/X86/rotate.ll: emit rotate instructions (which
typically cost 1 cycle) instead of shld/shrd instruction (which are typically
6 or more cycles).  This also saves code space.

For example, instead of emitting:

rotr:
        mov %EAX, DWORD PTR [%ESP + 4]
        mov %CL, BYTE PTR [%ESP + 8]
        shrd %EAX, %EAX, %CL
        ret
rotli:
        mov %EAX, DWORD PTR [%ESP + 4]
        shrd %EAX, %EAX, 27
        ret

Emit:

rotr32:
        mov %CL, BYTE PTR [%ESP + 8]
        mov %EAX, DWORD PTR [%ESP + 4]
        ror %EAX, %CL
        ret
rotli32:
        mov %EAX, DWORD PTR [%ESP + 4]
        ror %EAX, 27
        ret

We also emit byte rotate instructions which do not have a sh[lr]d counterpart
at all.

llvm-svn: 19692
2005-01-19 08:07:05 +00:00
Chris Lattner
c4adfbbd0b New testcase for rotate instructions. Each function should codegen to a
rotate.

llvm-svn: 19691
2005-01-19 08:04:08 +00:00
Chris Lattner
0edf9535b9 Add rotate instructions.
llvm-svn: 19690
2005-01-19 07:50:03 +00:00
Chris Lattner
29f5819158 Match 16-bit shld/shrd instructions as well, implementing shift-double.llx:test5
llvm-svn: 19689
2005-01-19 07:37:26 +00:00
Chris Lattner
603677549f Add a test for 16-bit sh*d.
llvm-svn: 19688
2005-01-19 07:37:01 +00:00
Chris Lattner
d54845f530 Improve coverage of the X86 instruction set by adding 16-bit shift doubles.
llvm-svn: 19687
2005-01-19 07:31:24 +00:00
Chris Lattner
2947801735 Teach the code generator that shrd/shld is commutable if it has an immediate.
This allows us to generate this:

foo:
        mov %EAX, DWORD PTR [%ESP + 4]
        mov %EDX, DWORD PTR [%ESP + 8]
        shld %EDX, %EDX, 2
        shl %EAX, 2
        ret

instead of this:

foo:
        mov %EAX, DWORD PTR [%ESP + 4]
        mov %ECX, DWORD PTR [%ESP + 8]
        mov %EDX, %EAX
        shrd %EDX, %ECX, 30
        shl %EAX, 2
        ret

Note the magically transmogrifying immediate.

llvm-svn: 19686
2005-01-19 07:11:01 +00:00
Chris Lattner
ea42c15da9 Use the TargetInstrInfo::commuteInstruction method to commute instructions
instead of doing it manually.

llvm-svn: 19685
2005-01-19 07:08:42 +00:00
Chris Lattner
f6932b700b Finegrainify namespacification
Add default impl of commuteInstruction
Add notes about ugly V9 code.

llvm-svn: 19684
2005-01-19 06:53:34 +00:00
Chris Lattner
eadd41207d Add a new method, described in the comment.
llvm-svn: 19683
2005-01-19 06:53:02 +00:00
Chris Lattner
892336a1b5 Ensure that each these functions generates a sh[rl]d instruction.
llvm-svn: 19682
2005-01-19 06:30:36 +00:00
Chris Lattner
41fe201b61 Codegen long >> 2 to this:
foo:
        mov %EAX, DWORD PTR [%ESP + 4]
        mov %EDX, DWORD PTR [%ESP + 8]
        shrd %EAX, %EDX, 2
        sar %EDX, 2
        ret

instead of this:

test1:
        mov %ECX, DWORD PTR [%ESP + 4]
        shr %ECX, 2
        mov %EDX, DWORD PTR [%ESP + 8]
        mov %EAX, %EDX
        shl %EAX, 30
        or %EAX, %ECX
        sar %EDX, 2
        ret

and long << 2 to this:

foo:
        mov %EAX, DWORD PTR [%ESP + 4]
        mov %ECX, DWORD PTR [%ESP + 8]
***     mov %EDX, %EAX
        shrd %EDX, %ECX, 30
        shl %EAX, 2
        ret

instead of this:

foo:
        mov %EAX, DWORD PTR [%ESP + 4]
        mov %ECX, %EAX
        shr %ECX, 30
        mov %EDX, DWORD PTR [%ESP + 8]
        shl %EDX, 2
        or %EDX, %ECX
        shl %EAX, 2
        ret

The extra copy (marked ***) can be eliminated when I teach the code generator
that shrd32rri8 is really commutative.

llvm-svn: 19681
2005-01-19 06:18:43 +00:00
Jeff Cohen
7230239553 Add missing data types for VC++
llvm-svn: 19680
2005-01-19 05:08:31 +00:00
Chris Lattner
2a7f8a94f4 Implement a way of expanding shifts. This applies to targets that offer
select operations or to shifts that are by a constant.  This automatically
implements (with no special code) all of the special cases for shift by 32,
shift by < 32 and shift by > 32.

llvm-svn: 19679
2005-01-19 04:19:40 +00:00
Chris Lattner
d8d306601a X86 shifts mask the amount.
llvm-svn: 19678
2005-01-19 03:36:30 +00:00
Chris Lattner
a05cd83d2f Add a hook to find out how the target handles shift amounts that are out of
range.  Either they are undefined (the default), they mask the shift amount
to the size of the register (X86, Alpha, etc), or they extend the shift (PPC).

This defaults to undefined, which is conservatively correct.

llvm-svn: 19677
2005-01-19 03:36:14 +00:00
Chris Lattner
9aa4886283 Move all data members to the end of the class.
Add a hook to find out how the target handles shift amounts that are out of
range.  Either they are undefined (the default), they mask the shift amount
to the size of the register (X86, Alpha, etc), or they extend the shift (PPC).

This defaults to undefined, which is conservatively correct.

llvm-svn: 19676
2005-01-19 03:36:03 +00:00
Chris Lattner
42993e45b6 Zero is cheaper than sign extend.
llvm-svn: 19675
2005-01-18 21:57:59 +00:00
Chris Lattner
14947c34cc Code to handle FP_EXTEND is dead now. X86 doesn't support any data types to
FP_EXTEND from!

llvm-svn: 19674
2005-01-18 20:05:56 +00:00
Chris Lattner
c6e928cba5 Remove more dead code.
llvm-svn: 19673
2005-01-18 19:50:08 +00:00
Chris Lattner
0616fa6b9b The selection dag code handles the promotions from F32 to F64 for us, so we
don't need to even think about F32 in the X86 code anymore.

llvm-svn: 19672
2005-01-18 19:46:54 +00:00
Chris Lattner
d65c3f3118 Fix some fixmes (promoting bools for select and brcond), fix promotion
of zero and sign extends.

llvm-svn: 19671
2005-01-18 19:27:06 +00:00
Chris Lattner
a9d53f9fb9 Keep track of the retval type as well.
llvm-svn: 19670
2005-01-18 19:26:36 +00:00
Chris Lattner
8cd93be302 Keep track of the returned value type as well.
llvm-svn: 19669
2005-01-18 19:26:18 +00:00
Chris Lattner
9f2c4a5200 Teach legalize to promote copy(from|to)reg, instead of making the isel pass
do it.  This results in better code on X86 for floats (because if strict
precision is not required, we can elide some more expensive double -> float
conversions like the old isel did), and allows other targets to emit
CopyFromRegs that are not legal for arguments.

llvm-svn: 19668
2005-01-18 17:54:55 +00:00
Chris Lattner
479c7118e4 Fix 124.m88ksim.
llvm-svn: 19667
2005-01-18 17:35:28 +00:00
Jeff Cohen
cef394290f Add project llvm-ld to Visual Studio
llvm-svn: 19665
2005-01-18 05:44:50 +00:00
Jeff Cohen
18320b07d4 Add project llvm-nm to Visual Studio
llvm-svn: 19664
2005-01-18 05:44:25 +00:00
Jeff Cohen
1a6c167332 Add project llvm-ld to Visual Studio
llvm-svn: 19663
2005-01-18 05:39:37 +00:00
Jeff Cohen
c45440c72b Add llvm-bcanalyzer project to Visual Studio
llvm-svn: 19662
2005-01-18 05:31:34 +00:00
Chris Lattner
ed246ec0d2 Do not emit loads multiple times, potentially in the wrong places.
llvm-svn: 19661
2005-01-18 04:18:32 +00:00
Tanya Lattner
c227ad2640 Minor changes.
llvm-svn: 19660
2005-01-18 04:15:41 +00:00
Chris Lattner
28a205e01b Eliminate bad assertions.
llvm-svn: 19659
2005-01-18 04:00:54 +00:00
Chris Lattner
78d3028350 * Eliminate the TokenSet and just use the ExprMap for both tokens and values.
* Insert some really pedantic assertions that will notice when we emit the
  same loads more than one time, exposing bugs.  This turns a miscompilation in
  bzip2 into a compile-fail.  yaay.

llvm-svn: 19658
2005-01-18 03:51:59 +00:00
Chris Lattner
2cb338d7b5 Teach legalize to promote SetCC results.
llvm-svn: 19657
2005-01-18 02:59:52 +00:00
Chris Lattner
b07e2d2084 Allow setcc operations to have nonbool types.
llvm-svn: 19656
2005-01-18 02:52:03 +00:00
Chris Lattner
178219f913 Allow setcc operations to have non-bool types.
llvm-svn: 19655
2005-01-18 02:51:41 +00:00
Chris Lattner
d7f93950aa Rely on the code in MatchAddress to do this work. Otherwise we fail to
match (X+Y)+(Z << 1), because we match the X+Y first, consuming the index
register, then there is no place to put the Z.

llvm-svn: 19652
2005-01-18 02:25:52 +00:00
Chris Lattner
2b4b79581d Fix the completely broken FP constant folds for setcc's.
llvm-svn: 19651
2005-01-18 02:11:55 +00:00
Chris Lattner
a7acdda064 Fix a problem where probing for addressing modes caused expressions to be
emitted too early.  In particular, this fixes
Regression/CodeGen/X86/regpressure.ll:regpressure3.

This also improves the 2nd basic block in 164.gzip:flush_block, which went from

.LBBflush_block_1:      # loopentry.1.i
        movzx %EAX, WORD PTR [dyn_ltree + 20]
        movzx %ECX, WORD PTR [dyn_ltree + 16]
        mov DWORD PTR [%ESP + 32], %ECX
        movzx %ECX, WORD PTR [dyn_ltree + 12]
        movzx %EDX, WORD PTR [dyn_ltree + 8]
        movzx %EBX, WORD PTR [dyn_ltree + 4]
        mov DWORD PTR [%ESP + 36], %EBX
        movzx %EBX, WORD PTR [dyn_ltree]
        add DWORD PTR [%ESP + 36], %EBX
        add %EDX, DWORD PTR [%ESP + 36]
        add %ECX, %EDX
        add DWORD PTR [%ESP + 32], %ECX
        add %EAX, DWORD PTR [%ESP + 32]
        movzx %ECX, WORD PTR [dyn_ltree + 24]
        add %EAX, %ECX
        mov %ECX, 0
        mov %EDX, %ECX

to

.LBBflush_block_1:      # loopentry.1.i
        movzx %EAX, WORD PTR [dyn_ltree]
        movzx %ECX, WORD PTR [dyn_ltree + 4]
        add %ECX, %EAX
        movzx %EAX, WORD PTR [dyn_ltree + 8]
        add %EAX, %ECX
        movzx %ECX, WORD PTR [dyn_ltree + 12]
        add %ECX, %EAX
        movzx %EAX, WORD PTR [dyn_ltree + 16]
        add %EAX, %ECX
        movzx %ECX, WORD PTR [dyn_ltree + 20]
        add %ECX, %EAX
        movzx %EAX, WORD PTR [dyn_ltree + 24]
        add %ECX, %EAX
        mov %EAX, 0
        mov %EDX, %EAX

... which results in less spilling in the function.

This change alone speeds up 164.gzip from 37.23s to 36.24s on apoc.  The
default isel takes 37.31s.

llvm-svn: 19650
2005-01-18 01:06:26 +00:00
Chris Lattner
b93409f3e2 Fix indentation.
llvm-svn: 19649
2005-01-17 23:25:45 +00:00
Chris Lattner
81841af594 This is a carefully contrived testcase where the X86 ISel is emitting all loads
before other ops, causing it to spill like mad.  This occurs in
164.gzip:flush_block.

llvm-svn: 19648
2005-01-17 23:16:01 +00:00
Chris Lattner
a5d137f471 Don't bother using max here.
llvm-svn: 19647
2005-01-17 23:02:13 +00:00
Chris Lattner
ca318edb94 Do not give token factor nodes outrageous weights
llvm-svn: 19645
2005-01-17 22:56:09 +00:00
Chris Lattner
4d9651c760 Non-volatile loads can be freely reordered against each other. This fixes
X86/reg-pressure.ll again, and allows us to do nice things in other cases.
For example, we now codegen this sort of thing:

int %loadload(int *%X, int* %Y) {
  %Z = load int* %Y
  %Y = load int* %X      ;; load between %Z and store
  %Q = add int %Z, 1
  store int %Q, int* %Y
  ret int %Y
}

Into this:

loadload:
        mov %EAX, DWORD PTR [%ESP + 4]
        mov %EAX, DWORD PTR [%EAX]
        mov %ECX, DWORD PTR [%ESP + 8]
        inc DWORD PTR [%ECX]
        ret

where we weren't able to form the 'inc [mem]' before.  This also lets the
instruction selector emit loads in any order it wants to, which can be good
for register pressure as well.

llvm-svn: 19644
2005-01-17 22:19:26 +00:00
Chris Lattner
e86c933df7 Two changes:
1. Fold  [mem] += (1|-1) into inc [mem]/dec [mem] to save some icache space.
 2. Do not let token factor nodes prevent forming '[mem] op= val' folds.

llvm-svn: 19643
2005-01-17 22:10:42 +00:00
Chris Lattner
4108bb01cf Don't call SelectionDAG.getRoot() directly, go through a forwarding method.
llvm-svn: 19642
2005-01-17 19:43:36 +00:00
Chris Lattner
96113fd08f Refactor load/op/store folding into it's own method, no functionality changes.
llvm-svn: 19641
2005-01-17 19:25:26 +00:00
Chris Lattner
e3c2cf4854 Implement a target independent optimization to codegen arguments only into
the basic block that uses them if possible.  This is a big win on X86, as it
lets us fold the argument loads into instructions and reduce register pressure
(by not loading all of the arguments in the entry block).

For this (contrived to show the optimization) testcase:

int %argtest(int %A, int %B) {
        %X = sub int 12345, %A
        br label %L
L:
        %Y = add int %X, %B
        ret int %Y
}

we used to produce:

argtest:
        mov %ECX, DWORD PTR [%ESP + 4]
        mov %EAX, 12345
        sub %EAX, %ECX
        mov %EDX, DWORD PTR [%ESP + 8]
.LBBargtest_1:  # L
        add %EAX, %EDX
        ret


now we produce:

argtest:
        mov %EAX, 12345
        sub %EAX, DWORD PTR [%ESP + 4]
.LBBargtest_1:  # L
        add %EAX, DWORD PTR [%ESP + 8]
        ret

This also fixes the FIXME in the code.

BTW, this occurs in real code.  164.gzip shrinks from 8623 to 8608 lines of
.s file.  The stack frame in huft_build shrinks from 1644->1628 bytes,
inflate_codes shrinks from 116->108 bytes, and inflate_block from 2620->2612,
due to fewer spills.

Take that alkis. :-)

llvm-svn: 19639
2005-01-17 17:55:19 +00:00
Chris Lattner
9098879472 Fix a major regression last night that prevented us from producing [mem] op= reg
operations.

The body of the if is less indented but unmodified in this patch.

llvm-svn: 19638
2005-01-17 17:49:14 +00:00
Chris Lattner
16f64df93a Refactor code into a new method.
llvm-svn: 19635
2005-01-17 17:15:02 +00:00
Chris Lattner
b21b6b9e84 Make methods private, add a method.
llvm-svn: 19634
2005-01-17 17:14:43 +00:00
Chris Lattner
b72ea1b719 Codegen this:
int %foo(int %X) {
        %T = add int %X, 13
        %S = mul int %T, 3
        ret int %S
}

as this:

        mov %ECX, DWORD PTR [%ESP + 4]
        lea %EAX, DWORD PTR [%ECX + 2*%ECX + 39]
        ret

instead of this:

        mov %ECX, DWORD PTR [%ESP + 4]
        mov %EAX, %ECX
        add %EAX, 13
        imul %EAX, %EAX, 3
        ret

llvm-svn: 19633
2005-01-17 06:48:02 +00:00
Tanya Lattner
a8b2929f45 Added tmp instructions to preserve ssa.
llvm-svn: 19632
2005-01-17 06:47:26 +00:00
Chris Lattner
a56d29d517 Fix test/Regression/CodeGen/X86/2005-01-17-CycleInDAG.ll and 132.ijpeg.
Do not fold a load into an operation if it will induce a cycle in the DAG.

Repeat after me: dAg.

llvm-svn: 19631
2005-01-17 06:26:58 +00:00
Chris Lattner
9605c927d1 New testcase for a problem that occurred in 132.ijpeg
llvm-svn: 19630
2005-01-17 06:25:59 +00:00
Chris Lattner
715364364b Delete PHI nodes that are not dead but are locked in a cycle of single
useness.

llvm-svn: 19629
2005-01-17 05:10:15 +00:00
Chris Lattner
03f06f11aa Move code out of indentation one level to make it easier to read.
Disable the xform for < > cases.  It turns out that the following is being
miscompiled:

bool %test(sbyte %S) {
        %T = cast sbyte %S to uint
        %V = setgt uint %T, 255
        ret bool %V
}

llvm-svn: 19628
2005-01-17 03:20:02 +00:00
Chris Lattner
30d205e080 Add methods
llvm-svn: 19627
2005-01-17 02:24:59 +00:00
Chris Lattner
3be6cd57c9 Do not fold a load into a comparison that is used by more than one place.
The comparison will probably be folded, so this is not ok to do.
This fixed 197.parser.

llvm-svn: 19624
2005-01-17 01:34:14 +00:00
Reid Spencer
642de64ef9 sysconfdir -> PROJ_etcdir
llvm-svn: 19623
2005-01-17 00:42:31 +00:00
Chris Lattner
0cd6b9ae1e Do not codegen 'xor bool, true' as 'not reg'. not reg inverts the upper bits
of the bytereg.  This fixes yacr2, 300.twolf and probably others.

llvm-svn: 19622
2005-01-17 00:23:16 +00:00
Chris Lattner
f7648e7110 Fix typos noticed by Gabor Greif, thanks Gabor!
llvm-svn: 19621
2005-01-17 00:12:04 +00:00
Chris Lattner
c1f386c7b8 Set up the shift and setcc types.
If we emit a load because we followed a token chain to get to it, try to
fold it into its single user if possible.

llvm-svn: 19620
2005-01-17 00:00:33 +00:00
Chris Lattner
5f180e4645 Shift and setcc types default to the pointer type.
llvm-svn: 19619
2005-01-16 23:59:48 +00:00
Chris Lattner
12879e04cb Add comments
Add fields to hold the result type of setcc operations and shift amounts.

llvm-svn: 19618
2005-01-16 23:59:30 +00:00
Chris Lattner
5c8a85e2d8 Implement legalize of call nodes.
llvm-svn: 19617
2005-01-16 19:46:48 +00:00
Alkis Evlogimenos
a9c9f38498 Fix llvm-java project autconfiguration.
llvm-svn: 19616
2005-01-16 09:44:58 +00:00
Tanya Lattner
e4872342db Added paramters to a few functions in order to allow me to change the functions to preserve SSA
llvm-svn: 19615
2005-01-16 08:51:10 +00:00
Chris Lattner
b14a63aa1c * Adjust to changes in TargetLowering interfaces.
* Remove custom promotion for bool and byte select ops.  Legalize now
  promotes them for us.
* Allow folding ConstantPoolIndexes into EXTLOAD's, useful for float immediates.
* Declare which operations are not supported better.
* Add some hacky code for TRUNCSTORE to pretend that we have truncstore
  for i16 types.  This is useful for testing promotion code because I can
  just remove 16-bit registers all together and verify that programs work.

llvm-svn: 19614
2005-01-16 07:34:08 +00:00
Chris Lattner
3c0dd46a3b Revamp supported ops. Instead of just being supported or not, we now keep
track of how to deal with it, and provide the target with a hook that they
can use to legalize arbitrary operations in arbitrary ways.

Implement custom lowering for a couple of ops, implement promotion for select
operations (which x86 needs).

llvm-svn: 19613
2005-01-16 07:29:19 +00:00
Chris Lattner
897cd7dc0a add method stub
llvm-svn: 19612
2005-01-16 07:28:41 +00:00
Chris Lattner
2c331fbc8f Don't mash stuff together.
llvm-svn: 19611
2005-01-16 07:28:31 +00:00
Chris Lattner
6f8097951c Use enums, move virtual dtor out of line.
llvm-svn: 19610
2005-01-16 07:28:11 +00:00
Chris Lattner
328bc38c5c Revamp supported ops. Instead of just being supported or not, we now keep
track of how to deal with it, and provide the target with a hook that they
can use to legalize arbitrary operations in arbitrary ways.

llvm-svn: 19609
2005-01-16 07:27:49 +00:00
Reid Spencer
71e1e6220c * Revise the projects section and make reference to Projects.html
* the dist-clean target no longer implies a check

llvm-svn: 19608
2005-01-16 07:18:31 +00:00
Reid Spencer
12adad4b2f Don't confuse the LLVM_OBJ_DIR and the PROJ_OBJ_DIR because there might be
a symbolic link making the autoconf name for the directory (LLVM_OBJ_ROOT)
and the "make" name for the directory (PROJ_OBJ_ROOT) different.

llvm-svn: 19607
2005-01-16 06:53:48 +00:00
Chris Lattner
3ba56b3fe7 Implement some more missing promotions.
llvm-svn: 19606
2005-01-16 05:06:12 +00:00
Chris Lattner
8bdd0fc7aa Fix bugpoint
llvm-svn: 19605
2005-01-16 04:23:22 +00:00
Chris Lattner
d0a65013ab cycles_t -> CycleCount_t
llvm-svn: 19604
2005-01-16 04:20:30 +00:00
Jeff Cohen
fcd4587a75 Add some .cvsignores to the win32 hierarchy to account for generated files
llvm-svn: 19603
2005-01-16 03:18:23 +00:00
Reid Spencer
d9f4f3b141 Provide support for HP/UX aCC compiler's variant of hash_map and hash_set
(RogueWave). These are implemented in rw/stdex/hash_map.h and
rw/stdex/hash_set.h on HP/UX.

llvm-svn: 19600
2005-01-16 02:58:39 +00:00
Reid Spencer
64cee423c3 Fix locations of libraries and executables to match makefiles.
llvm-svn: 19599
2005-01-16 02:38:06 +00:00
Reid Spencer
44764d6406 BUILD_* to PROJ_*
llvm-svn: 19598
2005-01-16 02:35:47 +00:00
Chris Lattner
73b6977700 Clarify assertion.
llvm-svn: 19597
2005-01-16 02:23:34 +00:00
Chris Lattner
4e550ebb38 Add assertions.
llvm-svn: 19596
2005-01-16 02:23:22 +00:00
Chris Lattner
209f585033 Add support for promoted registers being live across blocks.
llvm-svn: 19595
2005-01-16 02:23:07 +00:00
Reid Spencer
22978217af Update per new Makefile requirements for projects
llvm-svn: 19594
2005-01-16 02:21:42 +00:00
Reid Spencer
0e48bf8a19 Rename BUILD_* to PROJ_*
llvm-svn: 19592
2005-01-16 02:21:29 +00:00
Reid Spencer
05a2e79221 Update documentation on how to set up a project
llvm-svn: 19591
2005-01-16 02:21:18 +00:00
Reid Spencer
ba6a3dbd2d Several changes:
* Rename BUILD_* to PROJ_*
* Differentiate between LLVM's Makefile.conf and the project's
* Use project specific install locations

llvm-svn: 19590
2005-01-16 02:20:54 +00:00
Reid Spencer
62ca901007 Several changes:
* Get rid of variables that are duplicates of autoconf variables.
* Rename BUILD_* to PROJ_*
* Define some project related install locations
* Don't assume LLVM's configured values are the project's

llvm-svn: 19589
2005-01-16 02:20:42 +00:00
Reid Spencer
5ee86be22b Make this file capable of being used by both LLVM and its projects
llvm-svn: 19588
2005-01-16 02:20:30 +00:00
Tanya Lattner
7462d192b8 Fixed a couple of instructions that broke SSA.
llvm-svn: 19587
2005-01-16 02:14:17 +00:00
Chris Lattner
cebb964fef Improve compatiblity with HPUX on Itanium, patch by Duraid Madina
llvm-svn: 19586
2005-01-16 01:31:31 +00:00
Chris Lattner
4fb0fa4309 Improve compatibility with aCC on HPUX. Patch by Duraid Madina
llvm-svn: 19585
2005-01-16 01:22:18 +00:00
Chris Lattner
8ec1dc5fc0 Set up identity transforms.
llvm-svn: 19584
2005-01-16 01:20:18 +00:00
Chris Lattner
87a769cbd4 Move some information into the TargetLowering object.
llvm-svn: 19583
2005-01-16 01:11:45 +00:00
Chris Lattner
d58384fca6 Use the new TLI method to get this.
llvm-svn: 19582
2005-01-16 01:11:19 +00:00
Chris Lattner
1bc93bac69 Move some information out of LegalizeDAG into the generic Target interface.
llvm-svn: 19581
2005-01-16 01:10:58 +00:00
Chris Lattner
71d7f6e86f legalize a bunch of operations that I missed.
llvm-svn: 19580
2005-01-16 00:38:00 +00:00
Chris Lattner
a8d34fb8c6 Add support for targets that require promotions.
llvm-svn: 19579
2005-01-16 00:37:38 +00:00
Chris Lattner
207a962c2c Fix some serious bugs in promotion.
llvm-svn: 19578
2005-01-16 00:17:42 +00:00
Chris Lattner
0fe7776da5 Eliminate unneeded extensions.
llvm-svn: 19577
2005-01-16 00:17:20 +00:00
Chris Lattner
4d97864e92 Implement promotion of a whole bunch more operators. I think that this is
basically everything.

llvm-svn: 19576
2005-01-15 22:16:26 +00:00
Chris Lattner
630d1937bf Print extra type for nodes with extra type info.
llvm-svn: 19575
2005-01-15 21:11:37 +00:00
Jeff Cohen
a2071f1247 Add new file to Visual Studio CodeGen project
llvm-svn: 19574
2005-01-15 07:33:52 +00:00
Chris Lattner
99222f706c Add support for legalizing FP_ROUND_INREG, SIGN_EXTEND_INREG, and
ZERO_EXTEND_INREG for targets that don't support them.

llvm-svn: 19573
2005-01-15 07:15:18 +00:00
Chris Lattner
09d1b3d01d Common code factored out.
llvm-svn: 19572
2005-01-15 07:14:32 +00:00
Chris Lattner
5d24d61ae8 implement these methods.
llvm-svn: 19571
2005-01-15 06:52:40 +00:00
Chris Lattner
efd434591d Add some helper methods.
llvm-svn: 19570
2005-01-15 06:52:18 +00:00
Chris Lattner
c6c9a5b07d Add support for promoting ADD/MUL.
Add support for new SIGN_EXTEND_INREG, ZERO_EXTEND_INREG, and FP_ROUND_INREG operators.
Realize that if we do any promotions, we need to iterate SelectionDAG
construction.

llvm-svn: 19569
2005-01-15 06:18:18 +00:00
Chris Lattner
1001c6e2cd Add new SIGN_EXTEND_INREG, ZERO_EXTEND_INREG, and FP_ROUND_INREG operators.
llvm-svn: 19568
2005-01-15 06:17:04 +00:00
Chris Lattner
9de5890211 Add a new target-independent code generator flag.
llvm-svn: 19567
2005-01-15 06:00:32 +00:00
Chris Lattner
e18a4c4c19 Add support for truncstore and *extload.
llvm-svn: 19566
2005-01-15 05:22:24 +00:00
Chris Lattner
1f2c9d82fa Add intitial support for promoting some operators.
llvm-svn: 19565
2005-01-15 05:21:40 +00:00
Chris Lattner
ea2fa46f53 Improve output precision.
llvm-svn: 19564
2005-01-15 00:07:19 +00:00
Reid Spencer
730e7cb048 We don't distribute the operating system specific directories any more.
llvm-svn: 19563
2005-01-14 22:43:01 +00:00
Chris Lattner
3b8e719d1d Adjust to CopyFromReg changes, implement deletion of truncating/extending
stores/loads.

llvm-svn: 19562
2005-01-14 22:38:01 +00:00
Chris Lattner
720a62e8c7 Adjust to CopyFromREg changes.
llvm-svn: 19561
2005-01-14 22:37:41 +00:00
Chris Lattner
868e9d79d7 Change CopyFromReg to take and produce a chain node, allowing it to be used
with physregs that are not live across the entire block.

llvm-svn: 19560
2005-01-14 22:37:20 +00:00
Chris Lattner
39c6744c9f Start implementing truncating stores and extending loads.
llvm-svn: 19559
2005-01-14 22:08:15 +00:00
Chris Lattner
4bdb582200 Start adding some new operators, give IMPLICIT_DEF a chain operand.
llvm-svn: 19558
2005-01-14 22:07:46 +00:00
Chris Lattner
d7bffad559 Fix Regression/CodeGen/PowerPC/2005-01-14-UndefLong.ll
llvm-svn: 19557
2005-01-14 20:22:02 +00:00
Chris Lattner
8025e8b9e6 New testcase, problem found by Rob.
llvm-svn: 19556
2005-01-14 20:21:51 +00:00
Chris Lattner
c3ed31f837 Fix: Regression/CodeGen/PowerPC/2005-01-14-SetSelectCrash.ll
llvm-svn: 19555
2005-01-14 19:31:00 +00:00
Chris Lattner
57fb55d750 Testcase that crashes the PPC backend. Thanks to Rob for finding this.
llvm-svn: 19554
2005-01-14 19:30:42 +00:00
Chris Lattner
51726c47fe Fix some bugs in an xform added yesterday. This fixes Prolangs-C/allroots.
llvm-svn: 19553
2005-01-14 17:35:12 +00:00
Chris Lattner
7aa41cfa88 Fix a compile crash on spiff
llvm-svn: 19552
2005-01-14 17:17:59 +00:00
Reid Spencer
b12e290f8a Allow the Echo and EchoCmd variables to be overridden.
llvm-svn: 19551
2005-01-14 16:33:36 +00:00
Reid Spencer
9dcfffd730 Fix the path from ../lib/Debug to ../Debug/lib per changes to Makefiles.
llvm-svn: 19550
2005-01-14 16:32:39 +00:00
Chris Lattner
0ad02bdd3d Improve compatibility with acc
llvm-svn: 19549
2005-01-14 15:54:24 +00:00
Chris Lattner
d3af59bec2 Make this compatible with the HP/intel compiler. Fix by Duraid, thanks!
llvm-svn: 19548
2005-01-14 15:53:26 +00:00
Alkis Evlogimenos
a938e629f6 Correctly update configure to configure the llvm-java project
llvm-svn: 19546
2005-01-14 07:52:28 +00:00
Jeff Cohen
e246cdc946 Fix and improve win32 path validation.
llvm-svn: 19545
2005-01-14 04:09:39 +00:00
Reid Spencer
cbeed3571a Make asctime_r work for HP/UX.
llvm-svn: 19544
2005-01-14 00:50:50 +00:00
Chris Lattner
144f6e3dee More testcases
llvm-svn: 19543
2005-01-14 00:26:25 +00:00
Chris Lattner
4fa89827e2 if two gep comparisons only differ by one index, compare that index directly.
This allows us to better optimize begin() -> end() comparisons in common cases.

llvm-svn: 19542
2005-01-14 00:20:05 +00:00
Chris Lattner
d35d210ea0 Do not overrun iterators. This fixes a 176.gcc crash
llvm-svn: 19541
2005-01-13 23:26:48 +00:00
Chris Lattner
8ea1e8b982 Add a method
llvm-svn: 19540
2005-01-13 23:26:28 +00:00
Chris Lattner
7db6765530 new testcase
llvm-svn: 19539
2005-01-13 23:26:14 +00:00
Chris Lattner
7d131a4b9c Add a method
llvm-svn: 19538
2005-01-13 22:58:50 +00:00
Chris Lattner
a04c904c4c Turn select C, (X+Y), (X-Y) --> (X+(select C, Y, (-Y))). This occurs in
the 'sim' program and probably elsewhere.  In sim, it comes up for cases
like this:

#define round(x) ((x)>0.0 ? (x)+0.5 : (x)-0.5)
double G;
void T(double X) { G = round(X); }

(it uses the round macro a lot).  This changes the LLVM code from:

        %tmp.1 = setgt double %X, 0.000000e+00          ; <bool> [#uses=1]
        %tmp.4 = add double %X, 5.000000e-01            ; <double> [#uses=1]
        %tmp.6 = sub double %X, 5.000000e-01            ; <double> [#uses=1]
        %mem_tmp.0 = select bool %tmp.1, double %tmp.4, double %tmp.6
        store double %mem_tmp.0, double* %G

to:

        %tmp.1 = setgt double %X, 0.000000e+00          ; <bool> [#uses=1]
        %mem_tmp.0.p = select bool %tmp.1, double 5.000000e-01, double -5.000000e-01
        %mem_tmp.0 = add double %mem_tmp.0.p, %X
        store double %mem_tmp.0, double* %G
        ret void

llvm-svn: 19537
2005-01-13 22:52:24 +00:00
Chris Lattner
81e8417614 Implement an optimization for == and != comparisons like this:
_Bool test2(int X, int Y) {
  return &arr[X][Y] == arr;
}

instead of generating this:

bool %test2(int %X, int %Y) {
        %tmp.3.idx = mul int %X, 160            ; <int> [#uses=1]
        %tmp.3.idx1 = shl int %Y, ubyte 2               ; <int> [#uses=1]
        %tmp.3.offs2 = sub int 0, %tmp.3.idx            ; <int> [#uses=1]
        %tmp.7 = seteq int %tmp.3.idx1, %tmp.3.offs2            ; <bool> [#uses=1]
        ret bool %tmp.7
}


generate this:

bool %test2(int %X, int %Y) {
        seteq int %X, 0         ; <bool>:0 [#uses=1]
        seteq int %Y, 0         ; <bool>:1 [#uses=1]
        %tmp.7 = and bool %0, %1                ; <bool> [#uses=1]
        ret bool %tmp.7
}

This idiom occurs in C++ programs when iterating from begin() to end(),
in a vector or array.  For example, we now compile this:

void test(int X, int Y) {
  for (int *i = arr; i != arr+100; ++i)
    foo(*i);
}

to this:

no_exit:                ; preds = %entry, %no_exit
	...
        %exitcond = seteq uint %indvar.next, 100                ; <bool> [#uses=1]
        br bool %exitcond, label %return, label %no_exit



instead of this:

no_exit:                ; preds = %entry, %no_exit
	...
        %inc5 = getelementptr [100 x [40 x int]]* %arr, int 0, int 0, int %inc.rec              ; <int*> [#uses=1]
        %tmp.8 = seteq int* %inc5, getelementptr ([100 x [40 x int]]* %arr, int 0, int 100, int 0)              ; <bool> [#uses=1]
        %indvar.next = add uint %indvar, 1              ; <uint> [#uses=1]
        br bool %tmp.8, label %return, label %no_exit

llvm-svn: 19536
2005-01-13 22:25:21 +00:00
Chris Lattner
e727af06c8 Add new ImplicitDef node, rename CopyRegSDNode class to RegSDNode.
llvm-svn: 19535
2005-01-13 20:50:02 +00:00
Chris Lattner
4cb9fa373b Fix some bugs in code I didn't mean to check in.
llvm-svn: 19534
2005-01-13 20:40:58 +00:00
Chris Lattner
0798af33a5 Fix a crash compiling 129.compress
llvm-svn: 19533
2005-01-13 20:14:25 +00:00
Chris Lattner
15bd19dd76 Codegen factor nodes more intelligently according to perceived register pressure.
llvm-svn: 19532
2005-01-13 19:56:00 +00:00
Chris Lattner
2451684678 Don't forget the existing root.
llvm-svn: 19531
2005-01-13 19:53:14 +00:00
Reid Spencer
74bc42304c Update the documentation about -enable-llcbeta vs. -enable-linscan
llvm-svn: 19530
2005-01-13 18:02:40 +00:00
Chris Lattner
c251fb6441 Initial trivial (but stupid) codegen for this node.
llvm-svn: 19529
2005-01-13 18:01:36 +00:00
Chris Lattner
718b5c2f82 Codegen independent ops as being independent.
llvm-svn: 19528
2005-01-13 17:59:43 +00:00
Chris Lattner
05b4e37e85 Legalize new node, add assertion.
llvm-svn: 19527
2005-01-13 17:59:25 +00:00
Chris Lattner
4b1be0dfeb Print new node.
llvm-svn: 19526
2005-01-13 17:59:10 +00:00
Chris Lattner
f510866785 Add a new node type, add comments.
llvm-svn: 19525
2005-01-13 17:58:35 +00:00
Reid Spencer
152733823e Turn on LOADABLE_MODULE so that profile.so can be loaded dynamically by
the JIT.

llvm-svn: 19524
2005-01-13 16:53:05 +00:00
Reid Spencer
9df352d469 Re-enable libprofile now that llvm-ar is working better.
llvm-svn: 19523
2005-01-13 16:51:19 +00:00
Chris Lattner
3676cd6fe2 Add some really pedantic assertions to the load folding code. Fix a bunch
of cases where we accidentally emitted a load folded once and unfolded
elsewhere.

llvm-svn: 19522
2005-01-13 05:53:16 +00:00
Chris Lattner
4dfd2cfc0c Do not fold (zero_ext (sign_ext V)) -> (sign_ext V), they are not the same.
This fixes llvm-test/SingleSource/Regression/C/casts.c

llvm-svn: 19519
2005-01-12 18:51:15 +00:00
Chris Lattner
7b1dae8032 We can only fold a load into an op if there is exactly one use of the value.
Checking to see if the load has two uses is not equivalent, as the chain
value may have zero uses.

llvm-svn: 19518
2005-01-12 18:38:26 +00:00
Chris Lattner
40e7982c2c New method
llvm-svn: 19517
2005-01-12 18:37:47 +00:00
Chris Lattner
373e8f5607 New method.
llvm-svn: 19516
2005-01-12 18:37:33 +00:00
Chris Lattner
9864b08f94 Fix sign extend to long. When coming from sbyte, we used to generate:
movsbl 4(%esp), %eax
        movl %eax, %edx
        sarl $7, %edx

Now we generate:

        movsbl 4(%esp), %eax
        movl %eax, %edx
        sarl $31, %edx

Which is right.

llvm-svn: 19515
2005-01-12 18:19:52 +00:00
Chris Lattner
1321754941 Update comments to indicate CopyFrom/ToReg take physregs as well as vregs.
llvm-svn: 19514
2005-01-12 18:11:36 +00:00
Chris Lattner
1755360db6 Try both ways to fold an add together. This allows us to generate this code
imul %EAX, %EAX, 400
        add %ECX, %EAX
        add %ESI, DWORD PTR [%ECX + 4*%EDX]
        inc %EDX
        cmp %EDX, 100

instead of this:

        imul %EAX, %EAX, 400
        add %ECX, %EAX
        mov %EAX, %EDX
        shl %EAX, 2
        add %ECX, %EAX
        add %ESI, DWORD PTR [%ECX]
        inc %EDX
        cmp %EDX, 100

llvm-svn: 19513
2005-01-12 18:08:53 +00:00
Reid Spencer
6dced92447 Shut up warnings with GCC 3.4.3 about uninitialized variables.
llvm-svn: 19512
2005-01-12 14:53:45 +00:00
Chris Lattner
42e7e98908 Fix a major miscompilation where we were overwriting the scale reg.
llvm-svn: 19511
2005-01-12 07:33:20 +00:00
Chris Lattner
db4b67c81e Do not use the type of the RHS constant to determine the type of the operation.
This fails for shifts because the constant is always 8 bits.

llvm-svn: 19508
2005-01-12 05:22:07 +00:00
Chris Lattner
bdb2e9dabc Do not lose the offset from teh global when peephole optimizing instructions.
This fixes FreeBench/pcompress

llvm-svn: 19507
2005-01-12 05:17:28 +00:00
Chris Lattner
2f8e4ad870 Silence VC++ warnings.
llvm-svn: 19506
2005-01-12 04:51:37 +00:00
Jeff Cohen
847b54101b Add new file to Visual Studio CodeGen project
llvm-svn: 19505
2005-01-12 04:32:42 +00:00
Jeff Cohen
407aa0198c Fix C++ more compilatiom errors
llvm-svn: 19504
2005-01-12 04:29:05 +00:00
Chris Lattner
efe90209ef Fix a compile error with VC++, which things that static const arrays need
to be dynamically initialized. :(

llvm-svn: 19503
2005-01-12 04:23:22 +00:00
Chris Lattner
6fba62d6ec Fix a bug that caused us to crash on povray. We weren't emitting an FP_REG_KILL into a block that had a successor with a FP PHI node.
llvm-svn: 19502
2005-01-12 04:21:28 +00:00
Chris Lattner
bb4c14f270 Print a load of a null pointer (in intel mode) like this:
mov %AX, WORD PTR [0]

instead of like this:

        mov %AX, WORD PTR []

llvm-svn: 19501
2005-01-12 04:07:11 +00:00
Chris Lattner
b372fab2be Print a load of a null pointer like this:
movw 0, %ax

instead of like this:

        movw , %ax

llvm-svn: 19500
2005-01-12 04:05:19 +00:00
Chris Lattner
f8f79c4192 Fix a crash compiling povray on UINT_TO_FP from i16.
llvm-svn: 19499
2005-01-12 04:00:00 +00:00
Chris Lattner
e05a461f1d Add an option to view the selection dags as they are generated.
llvm-svn: 19498
2005-01-12 03:41:21 +00:00
Misha Brukman
732daa5b9d Use and print out BuildStatus, we don't always have build errors.
llvm-svn: 19497
2005-01-12 03:31:38 +00:00
Chris Lattner
3278ce8871 There are no [mem] op= reg instructions for FP, so remove their entries.
llvm-svn: 19496
2005-01-12 03:16:09 +00:00
Chris Lattner
e49a335797 Fix a bug where we didn't insert FP_REG_KILL instructions into MBB's that
contain FP PHI nodes but no other FP defining instructions.  This fixes
183.equake

llvm-svn: 19495
2005-01-12 02:57:10 +00:00
Chris Lattner
b7fe57a0f1 Fold TRUNCATE (LOAD P) into a smaller load from P.
llvm-svn: 19494
2005-01-12 02:19:06 +00:00
Chris Lattner
2cfce6853b Be more careful about order of arg evalution for CopyToReg nodes. This shrinks
256.bzip2 from 7142 to 7103 lines of .s file.

Second, add initial support for folding loads into compares, though this code
is dynamically dead for now. :(

llvm-svn: 19493
2005-01-12 02:02:48 +00:00
Chris Lattner
021cfd2a80 Fold some more [mem] op= val operators. This allows us to things like this
several times in 256.bzip2:

        mov %EAX, DWORD PTR [%ESP + 204]
-       mov %EAX, DWORD PTR [%EAX]
-       or %EAX, 2097152
-       mov %ECX, DWORD PTR [%ESP + 204]
-       mov DWORD PTR [%ECX], %EAX
+       or DWORD PTR [%EAX], 2097152

llvm-svn: 19492
2005-01-12 01:28:00 +00:00
Chris Lattner
b0eef82b82 Fold loads into sign/zero extends. instead of:
mov %AL, BYTE PTR [%EDX + l18_length_code]
  movzx %EAX, %AL

Emit:

  movzx %EAX, BYTE PTR [%EDX + l18_length_code]

llvm-svn: 19489
2005-01-11 23:33:00 +00:00
Chris Lattner
75bac9f786 Comment out debug code :)
Select [mem] += Val operations.  For constants, we used to get:

  mov %ECX, -32768
  add %ECX, DWORD PTR [l4_match_start]
  mov DWORD PTR [l4_match_start], %ECX

Now we get:

  add DWORD PTR [l4_match_start], -32768

For other values we used to get:

  mov %EBP, %EDI   ;; because the add destroys the value
  add %EBP, DWORD PTR [l4_input_len]
  mov DWORD PTR [l4_input_len], %EBP

now we get:

  add DWORD PTR [l4_input_len], %EDI

Both of these use less registers than the alternative, are faster and smaller.

llvm-svn: 19488
2005-01-11 23:21:30 +00:00
Chris Lattner
d28ae12168 Handle the global address case here, not just the offset case.
llvm-svn: 19487
2005-01-11 22:58:43 +00:00
Chris Lattner
8aa10fcd1b Treat int constants as not requiring a register, since they are almost always
folded into an instruction.

llvm-svn: 19486
2005-01-11 22:29:12 +00:00
Chris Lattner
c2785562f1 Print the value types in the nodes of the graph
llvm-svn: 19485
2005-01-11 22:21:04 +00:00
Chris Lattner
613f79fcbb add an assertion, avoid creating copyfromreg/copytoreg pairs that are the
same for PHI nodes.

llvm-svn: 19484
2005-01-11 22:03:46 +00:00
Chris Lattner
62b22420be * Factor a bunch of binary operator cases into shared code.
* Fold loads into Add, sub, and, or, xor and mul when possible.
* Codegen shl X, 1 as add X, X

llvm-svn: 19483
2005-01-11 21:19:59 +00:00
Chris Lattner
4cbf1f0038 Clear the whole array, always.
llvm-svn: 19482
2005-01-11 20:25:26 +00:00
Misha Brukman
7b98f7407b No need to repeat the word build' since it's under Build status'
llvm-svn: 19481
2005-01-11 19:51:24 +00:00
Chris Lattner
8cf9cdae3d Fold multiplies by 3,5,9 into addressing modes when possible.
llvm-svn: 19480
2005-01-11 19:37:02 +00:00
Misha Brukman
870b872bfa We don't always have build errors, so call it status', not error'
llvm-svn: 19479
2005-01-11 18:27:16 +00:00
Chris Lattner
f49c27c65c Squelch optimized warning.
llvm-svn: 19475
2005-01-11 17:46:49 +00:00
Reid Spencer
792bbf02a2 Fix the documentation for executeAndWait so the argument comments are
actually attributed to the arguments by doxygen.

llvm-svn: 19473
2005-01-11 06:37:27 +00:00
Chris Lattner
b74ec4cd24 Instead of generating stuff like this:
mov %ECX, %EAX
        add %ECX, 32768
        mov %SI, WORD PTR [2*%ECX + l13_prev]

Generate this:

        mov %SI, WORD PTR [2*%ECX + l13_prev + 65536]

This occurs when you have a GEP instruction where an index is
"something + imm".

llvm-svn: 19472
2005-01-11 06:36:20 +00:00
Reid Spencer
4596db3509 Make the construction of doxygen documentation a repeatable process
llvm-svn: 19469
2005-01-11 06:26:27 +00:00
Chris Lattner
c07164e909 Implement MEMCPY natively in terms of rep movs*
llvm-svn: 19468
2005-01-11 06:19:26 +00:00
Chris Lattner
36f7848b26 Implement memset -> rep stos*
llvm-svn: 19467
2005-01-11 06:14:36 +00:00
Chris Lattner
a19f84240f Announce that we don't support mem ops yet.
llvm-svn: 19466
2005-01-11 05:57:36 +00:00
Chris Lattner
85d70c6fd5 Teach legalize to lower MEMSET/MEMCPY/MEMMOVE operations if the target
does not support them.

llvm-svn: 19465
2005-01-11 05:57:22 +00:00
Chris Lattner
844277fb1e Print new operations.
llvm-svn: 19464
2005-01-11 05:57:01 +00:00
Chris Lattner
875def9b71 Turn memset/memcpy/memmove into the corresponding operations.
llvm-svn: 19463
2005-01-11 05:56:49 +00:00
Chris Lattner
1d7b8e118b Add MEMSET/MEMCPY/MEMMOVE operations. Fix a really bad bug in the vector
SDNode ctor.

llvm-svn: 19462
2005-01-11 05:56:17 +00:00
Reid Spencer
4a1ab18fbf * Add the use of LOADABLE_MODULE=1 in the makefile example
* Change the names of the resulting module to Hello instead of libHello
* Change lib/Debug -> Debug/lib per new makefile implementation.

llvm-svn: 19459
2005-01-11 05:16:23 +00:00
Reid Spencer
1e008c200d * Describe the LOADABLE_MODULE feature
* Get rid of non-compliant <font> elements (how did that get in there?)

llvm-svn: 19458
2005-01-11 05:12:54 +00:00
Chris Lattner
378262d33b Teach the address selector to make 'reg+reg' addressing modes.
llvm-svn: 19457
2005-01-11 04:40:19 +00:00
Reid Spencer
134f02d0c7 Add the LOADABLE_MODULE=1 directive to indicate that this shared library is
intended to be a dlopenable module and not a "plain" shared library.

llvm-svn: 19456
2005-01-11 04:33:32 +00:00
Chris Lattner
9d7cf998ca Emit NOT instructions.
llvm-svn: 19455
2005-01-11 04:31:30 +00:00
Reid Spencer
87e645c5bd Implement the LOADABLE_MODULE option when building a shared library. This
passes the -module option on the libtool command line to ensure that the
shared library being built can be dlopened and dlsym can work on that
module. LOADABLE_MODULE should be sent only in conjunction with the
SHARED_LIBRARY directive. It should generally be used for any module that
is intended to be the target of an LLVM -load option. Note that loadable
modules will not have the lib prefix but otherwise look like shared
libraries. This is per the libtool recommendations and prevents these
special shared libraries from being linked in via -l option to the linker.

llvm-svn: 19454
2005-01-11 04:31:07 +00:00
Chris Lattner
a86fa4455b shift X, 0 -> X
llvm-svn: 19453
2005-01-11 04:25:13 +00:00
Chris Lattner
37ed28558f Fix a bug emitting branches that broke a lot of programs.
llvm-svn: 19452
2005-01-11 04:06:27 +00:00
Chris Lattner
e44e6d16fb Be more careful where we set ContainsFPCode. We were missing a set in the
int -> FP casting code.  Note that we don't have to set it for FP operations
that take FP values as operands: whatever produces the FP value will set the
flag.

llvm-svn: 19451
2005-01-11 03:50:45 +00:00
Chris Lattner
8fea42bd6d Fix a major bug in setcc/cmov folding, where we accidentally
inverted the sense of the comparison.

llvm-svn: 19450
2005-01-11 03:37:59 +00:00
Chris Lattner
0d1f82ac2f Take register pressure into account when we have to decide whether to
evaluate the LHS or the RHS of an operation first.  This causes good things
to happen.  For example, instead of compiling a loop to this:

.LBBstrength_result7_1: # loopentry
        movl 16(%esp), %edi
        movl (%edi), %edi             ;;; LOAD
        movl (%ecx), %ebx
        movl $2, (%eax,%ebx,4)
        movl (%edx), %ebx
        movl %esi, %ebp
        addl $21, %ebp
        addl $42, %esi
        cmpl $0, %edi                 ;;; USE
        cmovne %esi, %ebp
        cmpl %ebp, %ebx
        movl %ebp, %esi
        jg .LBBstrength_result7_1

We now compile it to this:

.LBBstrength_result7_1: # loopentry
        movl %edi, %ebx
        addl $42, %ebx
        addl $21, %edi
        movl (%ecx), %ebp              ;; LOAD
        cmpl $0, %ebp                  ;; USE
        cmovne %ebx, %edi
        movl (%edx), %ebx
        movl $2, (%eax,%ebx,4)
        movl (%esi), %ebx
        cmpl %edi, %ebx
        jg .LBBstrength_result7_1

Which reduces register pressure enough (in this case) to avoid spilling in the
loop.

As another example, consider the CodeGen/X86/regpressure.ll testcase.  We
used to generate this code for both cases:

regpressure1:
        subl $32, %esp
        movl %esi, 12(%esp)
        movl %edi, 8(%esp)
        movl %ebx, 4(%esp)
        movl %ebp, (%esp)
        movl 36(%esp), %ecx
        movl (%ecx), %eax
        movl 4(%ecx), %edx
        movl %edx, 24(%esp)
        movl 8(%ecx), %edx
        movl %edx, 16(%esp)
        movl 12(%ecx), %edx
        movl 16(%ecx), %esi
        movl 20(%ecx), %edi
        movl 24(%ecx), %ebx
        movl %ebx, 28(%esp)
        movl 28(%ecx), %ebx
        movl 32(%ecx), %ebp
        movl %ebp, 20(%esp)
        movl 36(%ecx), %ecx
        imull 24(%esp), %eax
        imull 16(%esp), %eax
        imull %edx, %eax
        imull %esi, %eax
        imull %edi, %eax
        imull 28(%esp), %eax
        imull %ebx, %eax
        imull 20(%esp), %eax
        imull %ecx, %eax
        movl (%esp), %ebp
        movl 4(%esp), %ebx
        movl 8(%esp), %edi
        movl 12(%esp), %esi
        addl $32, %esp
        ret

This code is basically trying to do all of the loads first, then execute all
of the multiplies.  Because we run out of registers, lots of spill code happens.
We now generate this code for both cases:

regpressure1:
        movl 4(%esp), %ecx
        movl (%ecx), %eax
        movl 4(%ecx), %edx
        imull %edx, %eax
        movl 8(%ecx), %edx
        imull %edx, %eax
        movl 12(%ecx), %edx
        imull %edx, %eax
        movl 16(%ecx), %edx
        imull %edx, %eax
        movl 20(%ecx), %edx
        imull %edx, %eax
        movl 24(%ecx), %edx
        imull %edx, %eax
        movl 28(%ecx), %edx
        imull %edx, %eax
        movl 32(%ecx), %edx
        imull %edx, %eax
        movl 36(%ecx), %ecx
        imull %ecx, %eax
        ret

which is much nicer (when we fold loads into the muls it will be even better).
The old instruction selector used to produce the good code for regpressure1
but not for regpressure2, as it depended on the order of operations in the
LLVM code.

llvm-svn: 19449
2005-01-11 03:11:44 +00:00
Chris Lattner
788bdba13d The pattern isel is aggressively codegen'ing all of the loads in these
functions together at the start of the basic block, causing massive spillage.
The old isel codegened the loads wherever they happened to land, so it
generated good code for the first case, but bad code for the second.

We really want the pattern isel to generate (the same) good code for both.

llvm-svn: 19448
2005-01-11 03:05:03 +00:00
Chris Lattner
1308b488ea Print SelectionDAGs bottom up, include extra info in the node labels
llvm-svn: 19447
2005-01-11 00:34:33 +00:00
Chris Lattner
39c5808fdb Add support for bottom-up graphs.
llvm-svn: 19446
2005-01-11 00:24:59 +00:00
Chris Lattner
b241b443b6 Add a marker for the graph root.
llvm-svn: 19445
2005-01-10 23:52:04 +00:00
Chris Lattner
12be02722f Put the operation name in each node, put the function name on the graph.
llvm-svn: 19444
2005-01-10 23:26:00 +00:00
Chris Lattner
9e4c76123c Split out SDNode::getOperationName into its own method.
llvm-svn: 19443
2005-01-10 23:25:25 +00:00
Chris Lattner
7fa992e976 Add a helper method.
llvm-svn: 19442
2005-01-10 23:25:04 +00:00
Chris Lattner
7f65075be3 Implement initial selectiondag printing support. This gets us a nice
graph with no labels! :)

llvm-svn: 19441
2005-01-10 23:08:40 +00:00
Chris Lattner
e32371bad6 Add support for graph operations, and add a viewGraph method to SelectionDAG.
llvm-svn: 19440
2005-01-10 23:05:53 +00:00
Chris Lattner
da7c050442 Add a helper method
llvm-svn: 19439
2005-01-10 23:05:07 +00:00
Chris Lattner
1d13a92af4 Fold setcc instructions into selects.
llvm-svn: 19438
2005-01-10 22:10:13 +00:00
Chris Lattner
5b589ec0c4 Add conditional moves for the parity flag.
llvm-svn: 19437
2005-01-10 22:09:33 +00:00
Chris Lattner
be02d430a9 Lower to the correct functions. This fixes FreeBench/fourinarow
llvm-svn: 19436
2005-01-10 21:02:37 +00:00
Chris Lattner
750d38b5b7 Implement 8-bit multiply for X86.
llvm-svn: 19435
2005-01-10 20:55:48 +00:00
Chris Lattner
5326f35715 Rework constant pool handling so that function constant pools are no longer
leaked to the system.  Now they are destroyed with the JITMemoryManager is
destroyed.

llvm-svn: 19434
2005-01-10 18:23:22 +00:00
Jeff Cohen
3e62e7c68b Apply feedback from Chris.
llvm-svn: 19432
2005-01-10 04:23:32 +00:00
Jeff Cohen
703f7db254 Apply feed back from Chris:
1. Rename createLoaderPass to CreateProfileLoaderPass
  2. Opt shouldn't use the pass registered in CodeGen.

llvm-svn: 19431
2005-01-10 03:56:27 +00:00
Chris Lattner
41b764144d Implement a couple of more simplifications. This lets us codegen:
int test2(int * P, int* Q, int A, int B) {
        return P+A == P;
}

into:

test2:
        movl 4(%esp), %eax
        movl 12(%esp), %eax
        shll $2, %eax
        cmpl $0, %eax
        sete %al
        movzbl %al, %eax
        ret

instead of:

test2:
        movl 4(%esp), %eax
        movl 12(%esp), %ecx
        leal (%eax,%ecx,4), %ecx
        cmpl %eax, %ecx
        sete %al
        movzbl %al, %eax
        ret

ICC is producing worse code:

test2:
        movl      4(%esp), %eax                                 #8.5
        movl      12(%esp), %edx                                #8.5
        lea       (%edx,%edx), %ecx                             #9.9
        addl      %ecx, %ecx                                    #9.9
        addl      %eax, %ecx                                    #9.9
        cmpl      %eax, %ecx                                    #9.16
        movl      $0, %eax                                      #9.16
        sete      %al                                           #9.16
        ret                                                     #9.16

as is GCC (looks like our old code):

test2:
        movl    4(%esp), %edx
        movl    12(%esp), %eax
        leal    (%edx,%eax,4), %ecx
        cmpl    %edx, %ecx
        sete    %al
        movzbl  %al, %eax
        ret

llvm-svn: 19430
2005-01-10 02:03:02 +00:00
Chris Lattner
00c231baa7 Fix incorrect constant folds, fixing Stepanov after the SHR patch.
llvm-svn: 19429
2005-01-10 01:16:03 +00:00
Jeff Cohen
c783e07a7c Update System project in Visual Studio to reflect renamed files.
llvm-svn: 19428
2005-01-10 00:50:11 +00:00
Chris Lattner
0966a75e76 Constant fold shifts, turning this loop:
.LBB_Z5test0PdS__3:     # no_exit.1
        fldl data(,%eax,8)
        fldl 24(%esp)
        faddp %st(1)
        fstl 24(%esp)
        incl %eax
        movl $16000, %ecx
        sarl $3, %ecx
        cmpl %eax, %ecx
        fstpl 16(%esp)
        #FP_REG_KILL
        jg .LBB_Z5test0PdS__3   # no_exit.1

into:

.LBB_Z5test0PdS__3:     # no_exit.1
        fldl data(,%eax,8)
        fldl 24(%esp)
        faddp %st(1)
        fstl 24(%esp)
        incl %eax
        cmpl $2000, %eax
        fstpl 16(%esp)
        #FP_REG_KILL
        jl .LBB_Z5test0PdS__3   # no_exit.1

llvm-svn: 19427
2005-01-10 00:07:15 +00:00
Reid Spencer
c892a0db9f Rename Unix/*.cpp and Win32/*.cpp to have a *.inc suffix so that the silly
gdb debugger doesn't get confused on which file it is reading (the one in
lib/System or the one in lib/System/{Win32,Unix})

llvm-svn: 19426
2005-01-09 23:29:00 +00:00
Chris Lattner
fde3a212e2 Add some folds for == and != comparisons. This allows us to
codegen this loop in stepanov:

no_exit.i:              ; preds = %entry, %no_exit.i, %then.i, %_Z5checkd.exit
        %i.0.0 = phi int [ 0, %entry ], [ %i.0.0, %no_exit.i ], [ %inc.0, %_Z5checkd.exit ], [ %inc.012, %then.i ]              ; <int> [#uses=3]
        %indvar = phi uint [ %indvar.next, %no_exit.i ], [ 0, %entry ], [ 0, %then.i ], [ 0, %_Z5checkd.exit ]          ; <uint> [#uses=3]
        %result_addr.i.0 = phi double [ %tmp.4.i.i, %no_exit.i ], [ 0.000000e+00, %entry ], [ 0.000000e+00, %then.i ], [ 0.000000e+00, %_Z5checkd.exit ]          ; <double> [#uses=1]
        %first_addr.0.i.2.rec = cast uint %indvar to int                ; <int> [#uses=1]
        %first_addr.0.i.2 = getelementptr [2000 x double]* %data, int 0, uint %indvar           ; <double*> [#uses=1]
        %inc.i.rec = add int %first_addr.0.i.2.rec, 1           ; <int> [#uses=1]
        %inc.i = getelementptr [2000 x double]* %data, int 0, int %inc.i.rec            ; <double*> [#uses=1]
        %tmp.3.i.i = load double* %first_addr.0.i.2             ; <double> [#uses=1]
        %tmp.4.i.i = add double %result_addr.i.0, %tmp.3.i.i            ; <double> [#uses=2]
        %tmp.2.i = seteq double* %inc.i, getelementptr ([2000 x double]* %data, int 0, int 2000)                ; <bool> [#uses=1]
        %indvar.next = add uint %indvar, 1              ; <uint> [#uses=1]
        br bool %tmp.2.i, label %_Z10accumulateIPddET0_T_S2_S1_.exit, label %no_exit.i

To this:

.LBB_Z4testIPddEvT_S1_T0__1:    # no_exit.i
        fldl data(,%eax,8)
        fldl 16(%esp)
        faddp %st(1)
        fstpl 16(%esp)
        incl %eax
        movl %eax, %ecx
        shll $3, %ecx
        cmpl $16000, %ecx
        #FP_REG_KILL
        jne .LBB_Z4testIPddEvT_S1_T0__1 # no_exit.i

instead of this:

.LBB_Z4testIPddEvT_S1_T0__1:    # no_exit.i
        fldl data(,%eax,8)
        fldl 16(%esp)
        faddp %st(1)
        fstpl 16(%esp)
        incl %eax
        leal data(,%eax,8), %ecx
        leal data+16000, %edx
        cmpl %edx, %ecx
        #FP_REG_KILL
        jne .LBB_Z4testIPddEvT_S1_T0__1 # no_exit.i

llvm-svn: 19425
2005-01-09 20:52:51 +00:00
Jeff Cohen
292845d2d9 Add last four createXxxPass functions
llvm-svn: 19424
2005-01-09 20:42:52 +00:00
Jeff Cohen
7d1670da3f Fix VC++ compilation error
llvm-svn: 19423
2005-01-09 20:41:56 +00:00
Chris Lattner
e6f7882c27 Print the DAG out more like a DAG in nested format.
llvm-svn: 19422
2005-01-09 20:38:33 +00:00
Chris Lattner
1270acc1ce Print out nodes sorted by their address to make it easier to find them in a list.
llvm-svn: 19421
2005-01-09 20:26:36 +00:00
Chris Lattner
cf8fd0c0db Codegen (Reg|imm)+&GV as an LEA, because we cannot put it into the immediate field
of an ADDri (due to current restrictions on MachineOperand :( ).  This allows
us to generate:

        leal Data+16000, %edx

instead of:

        movl $Data, %edx
        addl $16000, %edx

llvm-svn: 19420
2005-01-09 20:20:29 +00:00
Chris Lattner
3d5d5022d5 Add a simple transformation. This allows us to compile one of the inner
loops in stepanov to this:

.LBB_Z5test0PdS__2:     # no_exit.1
        fldl data(,%eax,8)
        fldl 24(%esp)
        faddp %st(1)
        fstl 24(%esp)
        incl %eax
        cmpl $2000, %eax
        fstpl 16(%esp)
        #FP_REG_KILL
        jl .LBB_Z5test0PdS__2

instead of this:

.LBB_Z5test0PdS__2:     # no_exit.1
        fldl data(,%eax,8)
        fldl 24(%esp)
        faddp %st(1)
        fstl 24(%esp)
        incl %eax
        movl $data, %ecx
        movl %ecx, %edx
        addl $16000, %edx
        subl %ecx, %edx
        movl %edx, %ecx
        sarl $2, %ecx
        shrl $29, %ecx
        addl %ecx, %edx
        sarl $3, %edx
        cmpl %edx, %eax
        fstpl 16(%esp)
        #FP_REG_KILL
        jl .LBB_Z5test0PdS__2

The old instruction selector produced:

.LBB_Z5test0PdS__2:     # no_exit.1
        fldl 24(%esp)
        faddl data(,%eax,8)
        fstl 24(%esp)
        movl %eax, %ecx
        incl %ecx
        incl %eax
        leal data+16000, %edx
        movl $data, %edi
        subl %edi, %edx
        movl %edx, %edi
        sarl $2, %edi
        shrl $29, %edi
        addl %edi, %edx
        sarl $3, %edx
        cmpl %edx, %ecx
        fstpl 16(%esp)
        #FP_REG_KILL
        jl .LBB_Z5test0PdS__2   # no_exit.1

Which is even worse!

llvm-svn: 19419
2005-01-09 20:09:57 +00:00
Chris Lattner
66d3430236 Fix copy and pasto's for FP -> Int. This fixes fldry
llvm-svn: 19418
2005-01-09 19:49:59 +00:00
Chris Lattner
9242c504da Fix a bug legalizing call instructions (make sure to remember all result
values), and eliminate some switch statements.

llvm-svn: 19417
2005-01-09 19:43:23 +00:00
Chris Lattner
02f5ce2077 Fix a minor bug legalizing dynamic_stackalloc. This allows us to compile
std::__pad<wchar_t, std::char_traits<wchar_t> >::_S_pad(std::ios_base&, wchar_t, wchar_t*, wchar_t const*, int, int, bool)

from libstdc++

llvm-svn: 19416
2005-01-09 19:07:54 +00:00
Chris Lattner
ec26b48d61 Teach legalize to deal with DYNAMIC_STACKALLOC (aka a dynamic llvm alloca)
llvm-svn: 19415
2005-01-09 19:03:49 +00:00
Chris Lattner
282781c797 Initial implementation of FP->INT and INT->FP casts
Also, fix zero_extend from bool to i8, which fixes Shootout/objinst.

llvm-svn: 19414
2005-01-09 18:52:44 +00:00
Jeff Cohen
14903e0148 Get lib/Analysis/DataStructure to compile with VC++
llvm-svn: 19412
2005-01-09 04:18:28 +00:00
Jeff Cohen
39b0644b42 Workaround a VC++ bug. Microsoft puts the hash_map class in namespace stdext, but
this classes uses a utility function in namespace std.  But Microsoft apparently
assumes everyone will "using namespace std;".  As LLVM doesn't....  Add a
"use std::_Distance;" to get it working.

llvm-svn: 19411
2005-01-09 04:13:09 +00:00
Chris Lattner
fb217c6b94 Fix a subtle bug involving constant expr casts from int to fp
llvm-svn: 19410
2005-01-09 01:49:29 +00:00
Chris Lattner
a2c5d9168c Handle static alloca arguments to PHI nodes.
llvm-svn: 19409
2005-01-09 01:16:24 +00:00
Chris Lattner
9f59d28d67 Implement varargs and returnaddress/frameaddress intrinsics. With this
patch, all of SingleSource/UnitTests passes.

llvm-svn: 19408
2005-01-09 00:01:27 +00:00
Chris Lattner
58cfd7945d Use new interfaces to correctly lower varargs and return/frame address intrinsics.
llvm-svn: 19407
2005-01-09 00:00:49 +00:00
Chris Lattner
ccab396d01 Add interfaces to lower varargs and return/frame address intrinsics.
llvm-svn: 19406
2005-01-09 00:00:31 +00:00
Jeff Cohen
529d0068c8 Test fails on all platforms, not just linux
llvm-svn: 19405
2005-01-08 23:44:03 +00:00
Chris Lattner
18d2b34637 Add support for llvm.setjmp and longjmp. Only 3 SingleSource/UnitTests fail now.
llvm-svn: 19404
2005-01-08 22:48:57 +00:00
Jeff Cohen
a1c2df7ae6 Fix VC++ compilation error
llvm-svn: 19403
2005-01-08 22:44:06 +00:00
Jeff Cohen
cede1ce95a Add even more missing createXxxPass functions.
llvm-svn: 19402
2005-01-08 22:01:16 +00:00
Chris Lattner
d7a3ee6d20 rename linscan -> LLCBETA as it should be
llvm-svn: 19401
2005-01-08 21:03:58 +00:00
Chris Lattner
313ddb59c9 Okay 15th time is the charm. Looking at the vector size is useless as it
gets clobbered by a previous statement.  This fixes all calls finally.

llvm-svn: 19399
2005-01-08 20:51:36 +00:00
Chris Lattner
f5bbe85879 Okay, my off by one was actually off by two. This fixes Generic/2003-07-07-BadLongConst.ll
llvm-svn: 19398
2005-01-08 20:39:31 +00:00
Chris Lattner
c0f31c5e96 Tighten up assertions.
llvm-svn: 19397
2005-01-08 20:35:13 +00:00
Chris Lattner
a183eb75eb Fix off by one error
llvm-svn: 19396
2005-01-08 20:31:34 +00:00
Chris Lattner
f806d9f2d0 Allow arrays to have more than 4G elements.
llvm-svn: 19395
2005-01-08 20:19:51 +00:00
Chris Lattner
d662b785ef Allow array types to have 64-bit size.
llvm-svn: 19394
2005-01-08 20:19:27 +00:00
Jeff Cohen
1a26d15c80 Use size_t instead of long to represent memory usage. long is 32 bits
on 64-bit Windows.

llvm-svn: 19393
2005-01-08 20:15:57 +00:00
Chris Lattner
4588542d39 Silence warnings
llvm-svn: 19392
2005-01-08 20:13:44 +00:00
Chris Lattner
df1f152420 Silence VS warnings.
llvm-svn: 19391
2005-01-08 20:13:19 +00:00
Chris Lattner
fa66dc7852 Silence VS warnings.
llvm-svn: 19390
2005-01-08 20:07:03 +00:00
Chris Lattner
feeab9f753 Silence VS warnings
llvm-svn: 19389
2005-01-08 20:05:34 +00:00
Chris Lattner
0b955fd2d5 Silence VS warnings
llvm-svn: 19388
2005-01-08 19:59:10 +00:00
Chris Lattner
a136c3b054 Adjust prototype
llvm-svn: 19387
2005-01-08 19:57:49 +00:00
Chris Lattner
e64ff1c4b2 Silence warnings from VS
llvm-svn: 19386
2005-01-08 19:55:00 +00:00
Chris Lattner
78100c41ca Silence VS warnings
llvm-svn: 19385
2005-01-08 19:53:50 +00:00
Chris Lattner
d006195517 Silence VS warnings.
llvm-svn: 19384
2005-01-08 19:52:31 +00:00
Chris Lattner
798e84f59e Fix VS warnings
llvm-svn: 19383
2005-01-08 19:48:40 +00:00
Chris Lattner
46fa04b531 Fix VS warnings.
llvm-svn: 19382
2005-01-08 19:45:31 +00:00
Chris Lattner
fdfe3e49fe Fix uint64_t -> unsigned VS warnings.
llvm-svn: 19381
2005-01-08 19:42:22 +00:00
Chris Lattner
47f395cd85 Silence VS warnings.
llvm-svn: 19380
2005-01-08 19:37:20 +00:00
Chris Lattner
ce274ce93d Silence warnings
llvm-svn: 19379
2005-01-08 19:34:41 +00:00
Chris Lattner
867158cefd Do not throw away bits for no reason
llvm-svn: 19378
2005-01-08 19:32:59 +00:00
Chris Lattner
2c5e4ed8f9 Silence a VS warning.
llvm-svn: 19377
2005-01-08 19:31:31 +00:00
Chris Lattner
b52e041c80 Adjust to changes in LowerCallTo interface
Minor bugfixes

llvm-svn: 19376
2005-01-08 19:28:19 +00:00
Chris Lattner
7e6eeba6c5 Implement handling of most long operators through libcalls.
Fix a bug legalizing "ret (Val,Val)"

llvm-svn: 19375
2005-01-08 19:27:05 +00:00
Chris Lattner
1f45cd7418 Adjust to changes in LowerCAllTo interfaces
llvm-svn: 19374
2005-01-08 19:26:18 +00:00
Chris Lattner
9660014f8c Make LowerCallTo more generic and useful.
llvm-svn: 19373
2005-01-08 19:25:39 +00:00
John Criswell
24a5692973 Another year, another copyright update.
llvm-svn: 19372
2005-01-08 19:10:44 +00:00
Jeff Cohen
a2c16d2555 Add a few more passes to LinkAllPasses.h
llvm-svn: 19371
2005-01-08 18:15:23 +00:00
Jeff Cohen
677babc4d4 Add more missing createXxxPass functions.
llvm-svn: 19370
2005-01-08 17:21:40 +00:00
Chris Lattner
2a6db3c351 Add support for FP->INT conversions and back.
llvm-svn: 19369
2005-01-08 08:08:56 +00:00
Chris Lattner
6209f1d294 Add operators for FP -> INT conversions and back.
llvm-svn: 19368
2005-01-08 08:08:49 +00:00
Chris Lattner
8da67af979 Wrap long line.
llvm-svn: 19367
2005-01-08 06:59:50 +00:00
Chris Lattner
e69daaf71d Implement the 'store FPIMM, Ptr' -> 'store INTIMM, Ptr' optimization for
all targets.

llvm-svn: 19366
2005-01-08 06:25:56 +00:00
Chris Lattner
9a97e4d5b6 1ULL << 64 is undefined, don't do it.
llvm-svn: 19365
2005-01-08 06:24:30 +00:00
Chris Lattner
b923438fe6 The X86 instruction selector already handles codegen of:
store float 123.45, float* %P

as an integer store.  This adds handling of float immediate stores as integers
for arguments passed function calls.

This is now tested by CodeGen/X86/store-fp-constant.ll

llvm-svn: 19364
2005-01-08 05:45:24 +00:00
Chris Lattner
e80eca3d1d New testcase.
llvm-svn: 19363
2005-01-08 05:44:07 +00:00
Misha Brukman
6cd5f89778 Eliminate empty sub-list
llvm-svn: 19362
2005-01-08 01:11:15 +00:00
Chris Lattner
e0f1fe181a Fix a pointer invalidation problem. This fixes Generic/badarg6.ll
llvm-svn: 19361
2005-01-07 23:32:00 +00:00
Chris Lattner
5c66e45b92 Fold conditional branches on constants away.
llvm-svn: 19360
2005-01-07 22:49:57 +00:00
Chris Lattner
cda3efa6e5 Fix a thinko in the reassociation code, fixing Generic/badlive.ll
llvm-svn: 19359
2005-01-07 22:44:09 +00:00
Chris Lattner
a65a2f0c36 Add support for truncating integer casts from long.
llvm-svn: 19358
2005-01-07 22:37:48 +00:00
Chris Lattner
ea4ca94cae Fix a bug in load expansion legalization and ret legalization. This fixes
CodeGen/Generic/select.ll:castconst.

llvm-svn: 19357
2005-01-07 22:28:47 +00:00
Chris Lattner
68a12140c0 Legalize unconditional branches too
llvm-svn: 19356
2005-01-07 22:12:08 +00:00
Chris Lattner
924d100bd1 Cleanup a bunch of tests. In particular do not allow target directives in
the .ll file or it forces the V9 backend.  This is the CodeGen/Generic dir,
so there is no use in doing that.

llvm-svn: 19355
2005-01-07 22:05:31 +00:00
Chris Lattner
19a83990e1 Implement support for long GEP indices on 32-bit archs and support for
int GEP indices on 64-bit archs.

llvm-svn: 19354
2005-01-07 21:56:57 +00:00
Chris Lattner
4d5ba99283 Simplify: truncate ({zero|sign}_extend (X))
llvm-svn: 19353
2005-01-07 21:56:24 +00:00
Chris Lattner
32f20bfa93 implement legalization of a bunch more operators.
llvm-svn: 19352
2005-01-07 21:45:56 +00:00
Chris Lattner
e3f06e9945 Make this test a bit more interesting by making there actually be a use of the
PHI node.

llvm-svn: 19351
2005-01-07 21:37:13 +00:00
Chris Lattner
fa854eb012 Fix another bug legalizing calls!
llvm-svn: 19350
2005-01-07 21:35:32 +00:00
Chris Lattner
8ea875fb05 Fix handling of dead PHI nodes.
llvm-svn: 19349
2005-01-07 21:34:19 +00:00
Chris Lattner
f025d6788c Fix a bug legalizing calls
llvm-svn: 19348
2005-01-07 21:34:13 +00:00
Chris Lattner
44b30c9abb modernize and clean up this test.
llvm-svn: 19347
2005-01-07 21:15:58 +00:00
Chris Lattner
473825ccec After legalizing a DAG, delete dead nodes to save space.
llvm-svn: 19346
2005-01-07 21:09:37 +00:00
Chris Lattner
9c667933c1 Implement RemoveDeadNodes
llvm-svn: 19345
2005-01-07 21:09:16 +00:00
Chris Lattner
49811fcab6 Add a new SelectionDAG::RemoveDeadNodes method
llvm-svn: 19344
2005-01-07 21:08:55 +00:00
Jeff Cohen
86bbb1c56b Fix include. Too easy to make mistakes like this on Windows :(
llvm-svn: 19343
2005-01-07 19:21:49 +00:00
Chris Lattner
6edb4d7b71 Remove the open projects page from the docs directory.
llvm-svn: 19342
2005-01-07 18:57:33 +00:00
Misha Brukman
a9ade831b6 Capitalize Bugpoint.
llvm-svn: 19341
2005-01-07 17:00:44 +00:00
Jeff Cohen
39c14e7bca Get new SelectionDAG stuff building with Visual Studio.
llvm-svn: 19340
2005-01-07 15:52:36 +00:00
Chris Lattner
ec3fe7c4a8 Teach legalize how to handle condbranches
llvm-svn: 19339
2005-01-07 08:19:42 +00:00
Chris Lattner
001467a08c Add a testcase I forgot to commit earlier.
llvm-svn: 19338
2005-01-07 07:56:08 +00:00
Chris Lattner
1ef74d6135 X86 BE requires SelectionDAG
llvm-svn: 19337
2005-01-07 07:51:25 +00:00
Chris Lattner
28ce94ce85 X86 JIT requires the selection dag library.
llvm-svn: 19336
2005-01-07 07:51:11 +00:00
Chris Lattner
ca4ca5520b Allow the selection-dag based selector to be diabled with -disable-pattern-isel.
For now, this is the default, as the current selector is missing some big pieces.
To enable the new selector, pass -disable-pattern-isel=false to llc or lli.

llvm-svn: 19335
2005-01-07 07:50:50 +00:00
Chris Lattner
88c8a23891 Reimplementation of the X86 pattern isel. This is still missing many large
pieces, but can already do amazing things in some cases.

llvm-svn: 19334
2005-01-07 07:49:41 +00:00
Chris Lattner
ce413c8c9f This file is now dead.
llvm-svn: 19333
2005-01-07 07:49:05 +00:00
Chris Lattner
ff9e21c8d3 Add a new prototype
llvm-svn: 19332
2005-01-07 07:48:33 +00:00
Chris Lattner
7a60d91953 Initial implementation of the SelectionDAGISel class. This contains most
of the code for lowering from LLVM code to a SelectionDAG.

llvm-svn: 19331
2005-01-07 07:47:53 +00:00
Chris Lattner
f8ba6987a4 This file is obsolete
llvm-svn: 19330
2005-01-07 07:47:23 +00:00
Chris Lattner
dc75059005 Initial implementation of the DAG legalization. This still has a long way
to go, but it does work for some non-trivial cases now.

llvm-svn: 19329
2005-01-07 07:47:09 +00:00
Jeff Cohen
510fa4bbf8 But not the identation of THAT line
llvm-svn: 19328
2005-01-07 07:46:40 +00:00
Chris Lattner
061a1ea9e3 Complete rewrite of the SelectionDAG class.
llvm-svn: 19327
2005-01-07 07:46:32 +00:00
Chris Lattner
56cc54f416 Common base class for SelectionDAG-based instruction selectors.
llvm-svn: 19326
2005-01-07 07:46:03 +00:00
Chris Lattner
78551084ef Initial implementation of the nodes in a SelectionDAG.
llvm-svn: 19325
2005-01-07 07:45:27 +00:00
Chris Lattner
3a4d1b2721 First draft of new Target interface
llvm-svn: 19324
2005-01-07 07:44:53 +00:00
Chris Lattner
09b37583a4 First draft of a new Target interface
llvm-svn: 19323
2005-01-07 07:44:22 +00:00
Jeff Cohen
70e3e10aa4 Correct indentation levels
llvm-svn: 19322
2005-01-07 07:44:02 +00:00
Chris Lattner
07b522d106 Add convenience method.
llvm-svn: 19321
2005-01-07 07:40:32 +00:00
Misha Brukman
417ca179a9 Convert tabs to spaces
llvm-svn: 19320
2005-01-07 07:05:34 +00:00
Jeff Cohen
9a7ac16214 Add missing createXxxPass functions
llvm-svn: 19319
2005-01-07 06:57:28 +00:00
Jeff Cohen
d97ad08ef8 Remove bogus project folder
llvm-svn: 19318
2005-01-07 06:54:58 +00:00
Misha Brukman
28e210a8f2 Fix spelling.
llvm-svn: 19317
2005-01-07 06:45:07 +00:00
Jeff Cohen
e48bd7fcd4 Update list of passes
llvm-svn: 19316
2005-01-07 06:12:41 +00:00
Jeff Cohen
844410b48e Add missing include
llvm-svn: 19315
2005-01-07 05:42:13 +00:00
Jeff Cohen
e15ae04fb3 Fix return type
llvm-svn: 19314
2005-01-07 05:41:39 +00:00
Chris Lattner
ae15482076 Codegen -1 and -0.0 more efficiently. This implements CodeGen/X86/negatize_zero.ll
llvm-svn: 19313
2005-01-06 21:19:16 +00:00
Chris Lattner
9eef99ef43 New testcase
llvm-svn: 19312
2005-01-06 21:18:53 +00:00
Chris Lattner
cd4003e228 No need to pessimize current code for future possibilities.
llvm-svn: 19311
2005-01-06 16:26:38 +00:00
Jeff Cohen
72f8f4cc3d Get the #ifdef right on LinkAllPasses.h.
llvm-svn: 19310
2005-01-06 07:01:08 +00:00
Jeff Cohen
13932fb27f Fix minor mistakes
llvm-svn: 19309
2005-01-06 06:29:42 +00:00
Jeff Cohen
11dca28b79 Get rid of those pesky tabs...
llvm-svn: 19308
2005-01-06 06:06:35 +00:00
Jeff Cohen
00d5508496 Add project opt to Visual Studio.
llvm-svn: 19307
2005-01-06 06:02:53 +00:00
Jeff Cohen
eca0d0f2da Put createLoopUnswitchPass() into proper namespace
llvm-svn: 19306
2005-01-06 05:47:18 +00:00
Jeff Cohen
27595a4aec Add missing include
llvm-svn: 19305
2005-01-06 05:46:44 +00:00
Jeff Cohen
56d649f574 Fix incorrect return type.
llvm-svn: 19304
2005-01-06 05:45:45 +00:00
Jeff Cohen
b56965be08 Fix CBE code so that it compiles with VC++.
llvm-svn: 19303
2005-01-06 04:21:49 +00:00
Chris Lattner
2812f0880b Add required #include
llvm-svn: 19302
2005-01-06 03:25:27 +00:00
Chris Lattner
a930a9ab5e Add a useful method
llvm-svn: 19301
2005-01-06 03:23:59 +00:00
Chris Lattner
770c354f7d Add a list end sentinal
llvm-svn: 19299
2005-01-05 22:14:14 +00:00
Reid Spencer
1d183c4ab8 Add the SystemLibrary.html document now that its done.
llvm-svn: 19298
2005-01-05 19:01:20 +00:00
Reid Spencer
9d4d097dd1 Add a missing <div>
llvm-svn: 19297
2005-01-05 18:21:39 +00:00
Reid Spencer
6b9542b338 Bulk upgrade of this document. Cruft removed, new stuff added, general
reorganization of the content. This is now "done".

llvm-svn: 19296
2005-01-05 18:17:10 +00:00
Alkis Evlogimenos
eccb209b6e The Java project now lives under projects/llvm-java.
llvm-svn: 19295
2005-01-05 17:57:28 +00:00
Reid Spencer
1fbccbe786 Make opt honor the quiet option when printing the bytecode warning.
llvm-svn: 19294
2005-01-05 17:31:55 +00:00
Reid Spencer
e153fb3523 1. Make sure that "dot" can be found in the path
2. Fix a bug where the lib directory specified also had to be cwd
3. Weight the output so archive->archive edges are shorter
4. Generate two different graphs: one for libraries, one for objects.
5. Adjust the properties of the graphs till it looks nice.

llvm-svn: 19293
2005-01-05 17:29:29 +00:00
Reid Spencer
c770a0f243 Ignore autoconf/aclocal generated stuff.
llvm-svn: 19292
2005-01-05 17:26:00 +00:00
Chris Lattner
1ee6dfa501 1. If a double FP constant must be put into a constant pool, but it can be
precisely represented as a float, put it into the constant pool as a
   float.
2. Use the cbw/cwd/cdq instructions instead of an explicit SAR for signed
   division.

llvm-svn: 19291
2005-01-05 16:30:14 +00:00
Chris Lattner
a0d572707a add an assertion
llvm-svn: 19290
2005-01-05 16:27:34 +00:00
Chris Lattner
0f7e786a6b Minor optimization to allocate R8 registers in a better order.
llvm-svn: 19289
2005-01-05 16:09:16 +00:00
Chris Lattner
132e400d73 ignore generated file
llvm-svn: 19288
2005-01-05 16:01:00 +00:00
Chris Lattner
05788f97f4 Ignore generated file
llvm-svn: 19287
2005-01-05 16:00:42 +00:00
Chris Lattner
3c6909423d Ignore .dir
llvm-svn: 19286
2005-01-05 16:00:00 +00:00
Chris Lattner
f0698314cd Update this test to pass.
llvm-svn: 19285
2005-01-05 15:23:06 +00:00
Reid Spencer
6a0c6f6bf1 Cleanup configuration for Cygwin
llvm-svn: 19284
2005-01-05 06:41:10 +00:00
Jeff Cohen
05af8cfbd5 Make bison/flex build steps output the same message in Visual Studio as
on Unix.

llvm-svn: 19283
2005-01-04 06:18:10 +00:00
Jeff Cohen
a272e9a839 Add C backend to llc in Visual Studio.
llvm-svn: 19282
2005-01-04 06:01:55 +00:00
Chris Lattner
9742ac8c7c Test that trivial constants are not printed in hex notation.
llvm-svn: 19281
2005-01-04 01:58:26 +00:00
Chris Lattner
472cc1062d To not break TBAA rules, use a union.
llvm-svn: 19280
2005-01-04 01:56:57 +00:00
Chris Lattner
623bacf418 Do not let 'ftostr' return a string that starts with spaces. This allows
the AsmWriter to emit FP constants like 1.0 in normal exponential notation
instead of hex notation.

llvm-svn: 19279
2005-01-04 01:56:28 +00:00
Chris Lattner
91197b0b6a Add a testcase to check that initializer that CAN be evaluated statically ARE.
These used to result in dynamic initializations.

llvm-svn: 19278
2005-01-03 22:27:58 +00:00
Chris Lattner
5dfdadde04 Fix this script to work with hyphenated llvm-gcc and friend.
llvm-svn: 19277
2005-01-03 22:26:38 +00:00
John Criswell
dc6650136a Quote the paths and not the assignment of the PATH variable.
This seems to make things happier.

llvm-svn: 19276
2005-01-03 17:42:57 +00:00
John Criswell
34f603fcd7 Joining the quote fray...
Reverting the quote patch.  For some reason, this breaks the building of
llvm/runtime (the shell doesn't like it for some reason).  I might play
with it to see if I can get the quotes done in such a way that the shell
like it, but no promises.

llvm-svn: 19275
2005-01-03 17:41:56 +00:00
Jeff Cohen
f544d36614 Add additional header file to VS project. Patch submitted by Morten.
llvm-svn: 19274
2005-01-03 16:37:16 +00:00
Jeff Cohen
68f28730b7 Revert elimination of global variable hack... still needed.
llvm-svn: 19273
2005-01-03 16:34:19 +00:00
Reid Spencer
f309b441dc Integrate dependency graphs.
Make it HTML 4.01 Strict compliant
Provide better explanations of the dependency information.

llvm-svn: 19272
2005-01-03 05:46:46 +00:00
Reid Spencer
1d3db42acf Add library dependency and object dependency graphs.
llvm-svn: 19271
2005-01-03 05:30:57 +00:00
Chris Lattner
588d9471f3 new testcase for PR481
llvm-svn: 19270
2005-01-03 04:39:16 +00:00
Chris Lattner
e1329f4472 Bug fixed
llvm-svn: 19269
2005-01-03 04:20:21 +00:00
Chris Lattner
1859e90a1e New testcase for PR487
llvm-svn: 19268
2005-01-03 04:15:11 +00:00
Reid Spencer
2f61775ee1 Make sure the path is properly set in the llvmgcc and llvmgxx variables.
llvm-svn: 19267
2005-01-03 04:05:32 +00:00
Reid Spencer
5041bdba19 Re-apply last (reverted) patch. Reverting doesn't solve the actual problem
and creates issues on other platforms like Cygwin and MingW.

llvm-svn: 19266
2005-01-03 04:04:54 +00:00
Jeff Cohen
c3d0ae2e48 Don't quote the PATH variable value just in case it has spaces in it, as
it breaks "gmake check".

llvm-svn: 19265
2005-01-03 02:44:54 +00:00
Chris Lattner
d4bb2bbce1 ADC and IMUL are also commutable.
llvm-svn: 19264
2005-01-03 01:27:59 +00:00
Chris Lattner
82787e90f3 This hunk:
-  unsigned TrueValue = getReg(TrueVal, BB, BB->begin());
+  unsigned TrueValue = getReg(TrueVal);

Fixes the PPC regressions from last night.

The other hunk is just a clarity improvement.

llvm-svn: 19263
2005-01-02 23:07:31 +00:00
Chris Lattner
73bb15ed9a Remove dead directories
llvm-svn: 19262
2005-01-02 22:55:16 +00:00
Chris Lattner
373f7faeca This lib is dead
llvm-svn: 19261
2005-01-02 22:53:52 +00:00
Chris Lattner
196715cfb4 Remove a bunch of useless empty libraries
llvm-svn: 19260
2005-01-02 22:52:28 +00:00
Chris Lattner
bb2840b272 This is no longer needed.
llvm-svn: 19259
2005-01-02 22:50:00 +00:00
Chris Lattner
0982708a11 Testcase for PR494
llvm-svn: 19258
2005-01-02 21:11:11 +00:00
Chris Lattner
179457f062 xfail these tests, whcih require more info in the code generator to implement
correctly.

llvm-svn: 19257
2005-01-02 19:01:33 +00:00
Reid Spencer
34982d8dc8 Avoid use of -fomit-frame-pointer on FreeBSD platforms. It causes thrown
exceptions to abort() in cases where it should not.

Many thanks to Duraid Madina for doing the heavy lifting on the analysis
of this problem.

llvm-svn: 19256
2005-01-02 17:43:20 +00:00
Reid Spencer
74100aba4a Quote the PATH variable value just in case it has spaces in it (like on
Cygwin).

llvm-svn: 19255
2005-01-02 09:45:54 +00:00
Reid Spencer
862ebf5277 Correct the case of a #include directory name, just in case.
llvm-svn: 19254
2005-01-02 09:45:04 +00:00
Jeff Cohen
70d13a979c Cleanup some Visual Studio project dependencies.
llvm-svn: 19253
2005-01-02 04:44:36 +00:00
Jeff Cohen
2cf40e142c Eliminate the use of the global variable hack in the X86 target that was used
to get Visual Studio to link in X86.lib to the executables that need it.  There
is another way of doing it.

llvm-svn: 19252
2005-01-02 04:23:12 +00:00
Chris Lattner
733aac1270 Disable 2->3 address promotion of add and inc instructions to LEA's. In
addition to being three address, LEA's don't set the flags.

This fixes 186.crafty.

llvm-svn: 19251
2005-01-02 04:18:17 +00:00
Chris Lattner
252b68cfc8 Check in an old test that never made it into CVS
llvm-svn: 19250
2005-01-02 02:46:29 +00:00
Chris Lattner
e7228736e0 Add a new method.
llvm-svn: 19249
2005-01-02 02:38:18 +00:00
Chris Lattner
b62b45b3fc Add support for SETNPr to lower to memory form.
llvm-svn: 19248
2005-01-02 02:37:46 +00:00
Chris Lattner
b7782d77c1 Implement the convertToThreeAddress method, add support for inverting JP/JNP
branches.

llvm-svn: 19247
2005-01-02 02:37:07 +00:00
Chris Lattner
295e45e60e Two changes here:
1. Add new instructions for checking parity flags: JP, JNP, SETP, SETNP.
2. Set the isCommutable and isPromotableTo3Address bits on several
   instructions.

llvm-svn: 19246
2005-01-02 02:35:46 +00:00
Chris Lattner
9590870a0d Make the 2-address instruction lowering pass smarter in two ways:
1. If we are two-addressing a commutable instruction and the LHS is not the
   last use of the variable, see if the instruction is the last use of the
   RHS.  If so, commute the instruction, allowing us to avoid a
   register-register copy in many cases for common instructions like ADD, OR,
   AND, etc on X86.
2. If #1 doesn't hold, and if this is an instruction that also existing in
   3-address form, promote the instruction to a 3-address instruction to
   avoid the register-register copy.  We can do this for several common
   instructions in X86, including ADDrr, INC, DEC, etc.

This patch implements test/Regression/CodeGen/X86/commute-two-addr.ll,
overlap-add.ll, and overlap-shift.ll when I check in the X86 support for it.

llvm-svn: 19245
2005-01-02 02:34:12 +00:00
Chris Lattner
835ae42300 Add several testcases for new optimizations in the code generator.
llvm-svn: 19244
2005-01-02 02:30:04 +00:00
Chris Lattner
733c82bfbf Expose isConvertibleToThreeAddress and isCommutable bits to the code generator.
llvm-svn: 19243
2005-01-02 02:29:04 +00:00
Chris Lattner
a1a6be7e6e Add some bits that can be set on instructions. Renumber existing bits so
they are dense.  Add a virtual method that targets can choose to implement.

llvm-svn: 19242
2005-01-02 02:28:31 +00:00
Chris Lattner
182db0cac0 Add some bits that can be set for instructions.
llvm-svn: 19241
2005-01-02 02:27:48 +00:00
Reid Spencer
4e8dd44733 Make printing a warning message optional in CheckBytecodeOutputToConsole.
llvm-svn: 19240
2005-01-02 00:10:03 +00:00
Reid Spencer
742af2f2eb Prevent output of bytecode to std::cout unless the --force flag is given.
This prevents bytecode splats with usage like: cat file.ll | llvm-as -

llvm-svn: 19239
2005-01-02 00:08:46 +00:00
Reid Spencer
c967184a50 Move the code for printing out a warning about bytecode output to a console
into lib/Support so it can be used with other tools.

llvm-svn: 19238
2005-01-01 23:57:01 +00:00
Reid Spencer
1263cfd14f Implement a function to print a warning if bytecode output is to be sent to
a terminal/console.

llvm-svn: 19237
2005-01-01 23:56:20 +00:00
Jeff Cohen
b90c31fb49 Add functions for determining if the stdin/out/err is connected to a
console or not.

llvm-svn: 19236
2005-01-01 22:54:05 +00:00
Jeff Cohen
e98c7b6f26 Add llvm-link, Linker projects to Visual Studio.
llvm-svn: 19235
2005-01-01 22:32:26 +00:00
Jeff Cohen
8db20fe964 Add missing header files to projects.
llvm-svn: 19234
2005-01-01 22:30:19 +00:00
Reid Spencer
6f802ba876 Add functions for determining if the stdin/out/err is connected to a
console or not.

llvm-svn: 19233
2005-01-01 22:29:26 +00:00
Jeff Cohen
ca7d19e2af Fix typo 'ompress' => 'compress'.
llvm-svn: 19232
2005-01-01 22:10:32 +00:00
Jeff Cohen
b06a83e285 Add llvm-ranlib project to Visual Studio.
llvm-svn: 19231
2005-01-01 22:05:56 +00:00
Jeff Cohen
5c3261e5f2 Add llvm-ar project to Visual Studio.
llvm-svn: 19230
2005-01-01 22:00:28 +00:00
Jeff Cohen
16034813e6 Add -v option to bison.
llvm-svn: 19229
2005-01-01 21:35:39 +00:00
Jeff Cohen
49123973f8 Add missing file SystemUtils.cpp to Support project.
llvm-svn: 19228
2005-01-01 21:34:18 +00:00
Jeff Cohen
1d2912470a Add llvm-as project to Visual Studio
llvm-svn: 19227
2005-01-01 20:51:41 +00:00
Jeff Cohen
980d6098b6 Add llvm-dis project to Visual Studio
llvm-svn: 19226
2005-01-01 20:18:03 +00:00
Jeff Cohen
08f30c0c33 Put executables into a single directory
llvm-svn: 19225
2005-01-01 19:37:14 +00:00
Jeff Cohen
4560c21dd2 Fix bountiful sources of VC++ 'possible loss of data' warnings
llvm-svn: 19224
2005-01-01 18:58:23 +00:00
Jeff Cohen
031c3d891c Improve TableGen dependencies
Move TableGen generated files out of the src tree
Add descriptions to the custom build steps

llvm-svn: 19223
2005-01-01 18:17:40 +00:00
Reid Spencer
3b8faf995d Add HAVE_SBRK
llvm-svn: 19222
2005-01-01 18:16:16 +00:00
Reid Spencer
9f0ce1772c Ignore some files
llvm-svn: 19221
2005-01-01 18:14:18 +00:00
Chris Lattner
86102b8ad5 This is a bulk commit that implements the following primary improvements:
* We can now fold cast instructions into select instructions that
    have at least one constant operand.
  * We now optimize expressions more aggressively based on bits that are
    known to be zero.  These optimizations occur a lot in code that uses
    bitfields even in simple ways.
  * We now turn more cast-cast sequences into AND instructions.  Before we
    would only do this if it if all types were unsigned.  Now only the
    middle type needs to be unsigned (guaranteeing a zero extend).
  * We transform sign extensions into zero extensions in several cases.

This corresponds to these test/Regression/Transforms/InstCombine testcases:
  2004-11-22-Missed-and-fold.ll
  and.ll: test28-29
  cast.ll: test21-24
  and-or-and.ll
  cast-cast-to-and.ll
  zeroext-and-reduce.ll

llvm-svn: 19220
2005-01-01 16:22:27 +00:00
Chris Lattner
da15d4ba49 New testcases that we should combine.
llvm-svn: 19219
2005-01-01 16:14:46 +00:00
Chris Lattner
584e38313b New testcase for common bitfield manipulation instruction sequences.
llvm-svn: 19218
2005-01-01 16:14:18 +00:00
Chris Lattner
421477885f Add a bunch of tests for cases that should be eliminated.
llvm-svn: 19217
2005-01-01 16:13:43 +00:00
Chris Lattner
329d0255ae Add a bunch of tests for ANDs that should be eliminated.
llvm-svn: 19216
2005-01-01 16:13:19 +00:00
Chris Lattner
ea4c66a083 This now works.
llvm-svn: 19215
2005-01-01 16:12:52 +00:00
Chris Lattner
83df5d25b7 Fix a FIXME: Select instructions on longs were miscompiled.
While we're at it, improve codegen of select instructions.  For this
testcase:

int %test(bool %C, int %A, int %B) {
  %D = select bool %C, int %A, int %B
  ret int %D
}

We used to generate this code:

_test:
        cmpwi cr0, r3, 0
        bne .LBB_test_2 ;
.LBB_test_1:    ;
        b .LBB_test_3   ;
.LBB_test_2:    ;
        or r5, r4, r4
.LBB_test_3:    ;
        or r3, r5, r5
        blr

Now we emit:

_test:
        cmpwi cr0, r3, 0
        bne .LBB_test_2 ;
.LBB_test_1:    ;
        or r4, r5, r5
.LBB_test_2:    ;
        or r3, r4, r4
        blr

-Chris

llvm-svn: 19214
2005-01-01 16:10:12 +00:00
Chris Lattner
78394258ae Substantially improve the code generated by non-folded setcc instructions.
In particular, instead of compiling this:

bool %test(int %A, int %B) {
  %C = setlt int %A, %B
  ret bool %C
}

to this:

test:
        save %sp, -96, %sp
        subcc %i0, %i1, %g0
        bl .LBBtest_1   !
        nop
        ba .LBBtest_2   !
        nop
.LBBtest_1:     !
        or %g0, 1, %i0
        ba .LBBtest_3   !
        nop
.LBBtest_2:     !
        or %g0, 0, %i0
        ba .LBBtest_3   !
        nop
.LBBtest_3:     !
        restore %g0, %g0, %g0
        retl
        nop

We now compile it to this:

test:
        save %sp, -96, %sp
        subcc %i0, %i1, %g0
        or %g0, 1, %i0
        bl .LBBtest_2   !
        nop
.LBBtest_1:     !
        or %g0, %g0, %i0
.LBBtest_2:     !
        restore %g0, %g0, %g0
        retl
        nop

llvm-svn: 19213
2005-01-01 16:06:57 +00:00
Chris Lattner
3215bb6049 Implement SimplifyCFG/DeadSetCC.ll
SimplifyCFG is one of those passes that we use for final cleanup: it should
not rely on other passes to clean up its garbage.  This fixes the "why are
trivially dead setcc's in the output of gccas" problem.

llvm-svn: 19212
2005-01-01 16:02:12 +00:00
Chris Lattner
21adf7d36e Add new test to make sure simplifycfg doesn't leave around trivially
dead instructions.

llvm-svn: 19211
2005-01-01 16:00:56 +00:00
Chris Lattner
1ece6f83ba Allow getZeroExtend and getSignExtend to work with boolean inputs.
llvm-svn: 19210
2005-01-01 15:59:57 +00:00
Chris Lattner
3196de7663 Add a useful accessor
llvm-svn: 19209
2005-01-01 15:58:55 +00:00
Chris Lattner
094e8b660b Add two helper functions.
llvm-svn: 19208
2005-01-01 15:58:41 +00:00
Reid Spencer
97d6cf262f Update to autoconf 2.59 standards.
llvm-svn: 19207
2005-01-01 09:26:55 +00:00
Reid Spencer
948499e820 Correct the conditional test for non-portable tools so that it will
correctly omit them for non-Unix operating systems.

llvm-svn: 19206
2004-12-31 22:56:14 +00:00
Reid Spencer
d7287e05e3 For PR351:
Make LLVM_ON_UNIX and LLVM_ON_WIN32 available in the makefiles

llvm-svn: 19205
2004-12-31 22:54:28 +00:00
Reid Spencer
cdf4d46551 Describe both objdir==srcdir and objdir!=srcdir methods of building LLVM
libraries and tools. Thanks to Henrik Bach for this suggestion.

llvm-svn: 19204
2004-12-31 19:48:59 +00:00
Jeff Cohen
b6ecaa2d1c Where do these tabs keep coming from???
llvm-svn: 19203
2004-12-31 19:03:31 +00:00
Jeff Cohen
25dcdcc973 Mostly cleanup, but also some bug fixes, for win32/Path.cpp
llvm-svn: 19202
2004-12-31 19:01:08 +00:00
Reid Spencer
0f371a1637 Fix a compilation error for the case where mallinfo() is not available.
llvm-svn: 19201
2004-12-31 05:53:27 +00:00
Reid Spencer
0fcca1262b For PR351:
* lib/System depends on sbrk(3), make sure we check for it.

llvm-svn: 19200
2004-12-31 05:49:15 +00:00
Jeff Cohen
63f13c4cbc Get rid of those nasty tabs...
llvm-svn: 19199
2004-12-31 05:07:26 +00:00
Jeff Cohen
98aff88c9b Bring win32/Path.cpp up to date with respect to Unix/Path.cpp
llvm-svn: 19198
2004-12-31 04:39:07 +00:00
Reid Spencer
234dc34c77 * Add missing libraries: Linker, Archive, SparcV8
* Make library descriptions consistently lower case.

llvm-svn: 19197
2004-12-31 00:13:14 +00:00
Reid Spencer
266325e6d8 * Don't include weak definitions as a definition
* Make subordinate libraries presented with a vertical list instead of all
  listed on a single line.

llvm-svn: 19196
2004-12-30 23:13:12 +00:00
Reid Spencer
72767f611c Add a section on library dependencies now that GenLibDeps.html is written.
llvm-svn: 19195
2004-12-30 23:12:04 +00:00
Reid Spencer
271ed74132 A Perl script to generate an HTML definition list containing the LLVM
library dependencies, for documentation purposes.

llvm-svn: 19194
2004-12-30 23:07:56 +00:00
Reid Spencer
e97198a38e Fix the help documentation to not imply multiple archive files can be
processed.

llvm-svn: 19193
2004-12-30 17:51:57 +00:00
Reid Spencer
996ec72d48 For PR351:
* Place a try/catch block around the entire tool to Make sure std::string
  exceptions are caught and printed before exiting the tool.
* Make sure we catch unhandled exceptions at the top level so that we don't
  abort with a useless message but indicate than an unhandled exception was
  generated.

llvm-svn: 19192
2004-12-30 05:36:08 +00:00
Jeff Cohen
a6d9c1415c Fix MINGW compilation errors
llvm-svn: 19190
2004-12-30 03:02:31 +00:00
Reid Spencer
3d745d4378 * Fix a bug in an m4 macro that used an incorrect test operator
* Add CAN_DLOPEN_SELF so we can determine if dlopen(0) will open the
  program or not.
* Correct a warning messages to be a little more specific on what it checks

llvm-svn: 19184
2004-12-29 07:07:57 +00:00
Reid Spencer
42eaef40d8 Fix a Bourne Shell syntax error in a test
llvm-svn: 19183
2004-12-29 06:59:36 +00:00
Reid Spencer
5309e843d3 Fix one of the names to not have a . in front of it.
llvm-svn: 19182
2004-12-29 05:47:04 +00:00
Chris Lattner
b5c253a58b Bug fixed
llvm-svn: 19181
2004-12-29 04:39:50 +00:00
Chris Lattner
13516fe2e7 Fix PR491 and testcase Transforms/DeadStoreElimination/2004-12-28-PartialStore.ll
llvm-svn: 19180
2004-12-29 04:36:02 +00:00
Chris Lattner
f2a5963737 Add a comment, add a new testcase
llvm-svn: 19179
2004-12-29 04:35:30 +00:00
Chris Lattner
44b225d4d4 New testcase for PR491
llvm-svn: 19178
2004-12-29 04:27:26 +00:00
Chris Lattner
c6141111a5 Bug fixed
llvm-svn: 19177
2004-12-29 04:03:23 +00:00
Chris Lattner
93feeb18f1 Fix PR490
Fix testcase CodeGen/CBackend/2004-12-28-LogicalConstantExprs.ll

llvm-svn: 19176
2004-12-29 04:00:09 +00:00
Chris Lattner
5c87df3b7b new testcase for PR490
llvm-svn: 19175
2004-12-29 03:57:25 +00:00
Reid Spencer
46f8f24f15 XFAIL this test everywhere.
llvm-svn: 19174
2004-12-29 03:17:30 +00:00
Reid Spencer
28d2ad3396 XFAIL this everywhere, the CFE doesn't support bitfield initialization.
llvm-svn: 19173
2004-12-29 03:16:40 +00:00
Reid Spencer
9f4bb585f5 Remove potential platform portability issue with size of "int".
llvm-svn: 19172
2004-12-29 01:20:24 +00:00
Reid Spencer
b9f8de6efe Correct the name of the variable for the LLVM examples directory so that
parallel builds don't attempt to create it twice.

llvm-svn: 19171
2004-12-28 07:59:22 +00:00
Reid Spencer
78d9e8763d Make the x86_64 target names match between def and use. Thanks Misha.
llvm-svn: 19170
2004-12-28 07:56:14 +00:00
Reid Spencer
307435c2ae Make the 64-bit x86 target named "x86_64" instead of "AMD64".
llvm-svn: 19169
2004-12-28 06:34:11 +00:00
Misha Brukman
c57b9eb581 Add a note about registering the backend so it's available in LLC and LLI
llvm-svn: 19168
2004-12-27 19:05:16 +00:00
Jeff Cohen
bb3d4a1b64 Bring VS projects up to date with respect to recent changes
llvm-svn: 19167
2004-12-27 16:49:34 +00:00
Reid Spencer
cf8f341c36 Don't create symbolic links for lib/System any more. It doesn't need them.
llvm-svn: 19166
2004-12-27 09:33:46 +00:00
Reid Spencer
c7f0a4733d Clean up some autoconf cruft
* Make the source detection use a file unique to Stacker
* Configure Makefile.common.in with AC_CONFIG_FILES not AC_CONFIG_MAKEFILE
* Use new autoconf format for invoking AC_OUTPUT

llvm-svn: 19165
2004-12-27 08:51:55 +00:00
Reid Spencer
c4f0c739c9 Make it possible to reconfigure a project as well as just LLVM main dir.
llvm-svn: 19164
2004-12-27 08:50:27 +00:00
Reid Spencer
ad7bdf7400 Fix a bug that made the nightly tester *really* slow. During changes for
portability, the --track-space option was inadvertently ignored. This patch
fixes that so that sys::Process::GetMallocUsage() is only invoked if the
--track-spaces option is given. Apparently the mallinfo() call that
GetMallocUsage() uses is *very* slow, especially when processing very large
modules like projects/llvm-test/MultiSource/Applications/kimwitu++.

llvm-svn: 19163
2004-12-27 08:03:04 +00:00
Reid Spencer
a079b69981 For PR351:
* sys::PreventCoreFiles -> sys::Process::PreventCoreFiles

llvm-svn: 19162
2004-12-27 06:18:02 +00:00
Reid Spencer
e925d8b8b2 For PR351:
* Ensure #includes are wrapped with appropriate HAVE_ guards
* Account for variations in time.h and sys/time.h inclusion.
* Add macros for getting wait(2) exit status correctly (per autoconf sugg.)
* Implement ThrowErrno in terms of strerror_r, strerror or none based on
  what is available on the platform.

llvm-svn: 19161
2004-12-27 06:17:50 +00:00
Reid Spencer
efda887fe2 For PR351:
* Remove redundant #includes that are now in Unix.h

llvm-svn: 19160
2004-12-27 06:17:39 +00:00
Reid Spencer
cf15b874e8 For PR351:
* Move implementation of sys::PreventCoreFiles function to this file from
  the now defunct SysConfig abstraction.

llvm-svn: 19159
2004-12-27 06:17:27 +00:00
Reid Spencer
d103e0851c For PR351:
* Ensure #includes are wrapped with appropriate HAVE_ guards
* Ensure variations in "dirent" structure are accounted for.

llvm-svn: 19158
2004-12-27 06:17:15 +00:00
Reid Spencer
47cd653411 For PR351:
* Ensure #includes are wrapped with appropriate HAVE_ guards
* Consolidate implementation from operating system specific directory.

llvm-svn: 19157
2004-12-27 06:17:03 +00:00
Reid Spencer
d554bbcefd For PR351:
* Ensure #includes are wrapped with appropriate HAVE_ guards

llvm-svn: 19156
2004-12-27 06:16:52 +00:00
Reid Spencer
af6d3d5c8f For PR351:
* Consolidate implementation for Unix systems into Unix/TimeValue.cpp
* Avoid use of symbolic link to #include platform-specific implementation.

llvm-svn: 19155
2004-12-27 06:16:38 +00:00
Reid Spencer
51ea06abf8 For PR351:
* Consolidate implementation for Unix systems into Unix/Program.cpp
* Avoid use of symbolic link to #include platform-specific implementation.

llvm-svn: 19154
2004-12-27 06:16:25 +00:00
Reid Spencer
844f3fec49 For PR351:
* Consolidate implementation for Unix systems into Unix/Signals.cpp
* Avoid use of symbolic link to #include platform-specific implementation.

llvm-svn: 19153
2004-12-27 06:16:11 +00:00
Reid Spencer
71383fb646 For PR351:
* Consolidate implementation for Unix systems into Unix/Memory.cpp
* Avoid use of symbolic link to #include platform-specific implementation.

llvm-svn: 19152
2004-12-27 06:15:57 +00:00
Reid Spencer
1a7a435b49 For PR351:
* Consolidate implementation for Unix systems into Unix/MappedFile.cpp
* Avoid use of symbolic link to #include platform-specific implementation.

llvm-svn: 19151
2004-12-27 06:15:43 +00:00
Reid Spencer
97d4a17f04 For PR351:
* Consolidate implementation for Unix systems into Unix/Process.cpp
* Avoid use of symbolic link to #include platform-specific implementation.

llvm-svn: 19150
2004-12-27 06:15:29 +00:00
Reid Spencer
0d1ad6ac34 For PR351:
SysConf abstraction was pointless because it had a single function in it that
pertained only to the current process. So merge it into the Process abstraction
and remove the files completely.

llvm-svn: 19149
2004-12-27 06:15:14 +00:00
Reid Spencer
b668158b7c For PR351:
* Add checks for sterror and strerror_r functions
* Add check to determine if /dev/zero is needed for allocating RWX memory.

llvm-svn: 19148
2004-12-27 06:15:02 +00:00
Reid Spencer
826da2a721 For PR351:
Provide a check to determine if /dev/zero is needed for AllocateRWX function.

llvm-svn: 19147
2004-12-27 06:14:48 +00:00
Reid Spencer
189c677549 Oops, reverse the logic on a test for WITH_LLVMGCCDIR to make it define
the path names correctly.

llvm-svn: 19146
2004-12-27 03:15:28 +00:00
Reid Spencer
474a09ca20 Provide a value for HAVE_MMAP_ANONYMOUS variable, for consistency with
other #define's.

llvm-svn: 19145
2004-12-27 03:14:43 +00:00
Reid Spencer
6bfa7a4f7b Describe the --with-llvmgccdir option to configure.
llvm-svn: 19144
2004-12-26 05:47:26 +00:00
Reid Spencer
d2020acea0 Revert the last patch so that the LLVMGCCDIR environment variable is
still viable and will make use of the resurrected --with-llvmgccdir
configure option.

llvm-svn: 19143
2004-12-26 05:21:13 +00:00
Reid Spencer
8bc110c097 For PR351:
* Make sure all headers used by lib/System have checks
* Use "standard" autoconf checks for certain problematic headers
For PR432:
* Resurrect --with-llvmgccdir so a specific llvm-gcc/llvm-g++ installation
  can be specified.

llvm-svn: 19142
2004-12-25 07:31:29 +00:00
Jeff Cohen
f365c33b62 mingw doesn't support the official debug API.
Old versions of the C runtime somehow get loaded into the process.  Make
sure they aren't searched for symbols.

llvm-svn: 19141
2004-12-25 04:50:17 +00:00
Jeff Cohen
683b1a5e3c Get VC++ building again
llvm-svn: 19140
2004-12-24 16:26:47 +00:00
Reid Spencer
d06d026715 Ignore the autom4te.cache directoy.
llvm-svn: 19139
2004-12-24 15:11:23 +00:00
Reid Spencer
c005fba17b Make sure llvm-g++ gets the right path for the llvm tools.
llvm-svn: 19138
2004-12-24 14:47:34 +00:00
Jeff Cohen
039b4abf6c Eliminate use of ltdl.c when doing a VC++ build. Because libtool isn't used,
ltdl's LGPL license would infect all of LLVM.

llvm-svn: 19137
2004-12-24 07:57:09 +00:00
Reid Spencer
c81ccb488a Make the symbolic link using the correct variable!
llvm-svn: 19136
2004-12-24 06:49:16 +00:00
Reid Spencer
920b83d709 Remove references to LLVMGCCDIR because it was only used to provide a
value for the --with-llvmgccdir configure option which is no longer
supported.

llvm-svn: 19135
2004-12-24 06:32:54 +00:00
Reid Spencer
20540311e1 For PR351:
Merge implementations of isValid and GetTemporaryDirectory into this file. There
is not any point having the operating system specific files for such little
variation between the Unix family of systems.

llvm-svn: 19134
2004-12-24 06:29:42 +00:00
Reid Spencer
e7c870364f For PR351:
This implementation is no longer needed, its been merged to Unix/Path.cpp since
there is such little variation between the platforms.

llvm-svn: 19133
2004-12-24 06:29:28 +00:00
Reid Spencer
328ee53573 For PR351:
Use the LLVM_ON_UNIX and LLVM_ON_WIN32 #defines to include the implementation
instead of relying upon the "platform" link

llvm-svn: 19132
2004-12-24 06:29:17 +00:00
Reid Spencer
d3d6d9d691 For PR351:
Create new variables LLVM_ON_UNIX and LLVM_ON_WIN32 so we can start getting
rid of reliance upon a symbolic link to switch implementations in lib/System

llvm-svn: 19131
2004-12-24 06:29:05 +00:00
Reid Spencer
4befbf3f14 Resurrect this file.
llvm-svn: 19130
2004-12-24 06:03:31 +00:00
Reid Spencer
265b02ed3a Remove these files as they are not being included any more. DynamicLibrary
is now implemented via ltdl.cpp which has its own way of dealing with
the different platforms.

llvm-svn: 19129
2004-12-24 03:59:46 +00:00
Reid Spencer
0f996fe02c Make sure LLVMGCCWITHPATH is used instead of just LLVMGCC so that the
CFE tools can find the correct LLVM tools to invoke.

llvm-svn: 19128
2004-12-24 03:44:24 +00:00
Reid Spencer
69d897cc22 The dejagnu scripts need a path for llvm-gcc/llvm-g++ as well so use the
correct variable to get a "set the path first" invocation of those tools.

llvm-svn: 19127
2004-12-24 03:38:01 +00:00
Reid Spencer
35655d69b5 Two corrections:
* When reconfiguring, make sure the config.cache file is blown away so that
  its (old) values don't short-circuit doing the tests. When a reconfigure
  is done, it should be done from scratch, without the cache.
* For dist-check, don't pass --with-llvmgccdir any more because configure
  doesn't have this option any more.

llvm-svn: 19126
2004-12-24 03:36:31 +00:00
Reid Spencer
b608aebc6c Change llvmgcc/llvmg++ to llvm-gcc and llvm-g++ respectively.
llvm-svn: 19125
2004-12-24 03:34:31 +00:00
Jeff Cohen
d567bb6af6 Fix VC++ compilation error
llvm-svn: 19124
2004-12-24 02:38:34 +00:00
Reid Spencer
657b7343f3 Fix a bug in libtool's ltmain.sh. On Cygwin the "$output.exp" expression
expands to a full path name. Substitute $outputname.exp" instead and it
makes a viable temporary file name. This gets around the problem with lli
on Cygwin linking but not having any "C" library functions linked into it.

llvm-svn: 19123
2004-12-24 00:15:20 +00:00
Reid Spencer
c84ee1aee0 Put CopyFile in the sys namespace.
llvm-svn: 19122
2004-12-23 22:14:32 +00:00
Misha Brukman
e50986b39f Wrap at 80 cols
llvm-svn: 19121
2004-12-23 21:17:41 +00:00
Reid Spencer
dee41307dc Correct the comments and file header.
llvm-svn: 19120
2004-12-23 21:16:46 +00:00
Reid Spencer
454a8afc6d Try to speed up gccld hot spot in BasicVN::getEqualNumberNodes by making
a function call at the core of the loop inline and removing unused
stack variables from an often called function. This doesn't improve things
much, the real saving will be by reducing the number of calls to this
function (100K+ when linking kimwitu++).

llvm-svn: 19119
2004-12-23 21:13:26 +00:00
Reid Spencer
0a54a58c63 Update the amd64 target detection checks.
Patch contributed by Markus F.X.J. Oberhumer.

llvm-svn: 19118
2004-12-23 21:08:52 +00:00
Reid Spencer
1097f7df5f Add a caution about using experimental versions of gnu binutils when
building Cygwin.

llvm-svn: 19117
2004-12-23 19:49:54 +00:00
Reid Spencer
a8acd82275 Be specific about version of GCC and binutils on Cygwin since it matters.
llvm-svn: 19116
2004-12-23 19:39:54 +00:00
Misha Brukman
5ac308f43a LLVM now builds and runs on Linux/amd64, but we don't have 64-bit codegen yet
llvm-svn: 19115
2004-12-23 07:14:56 +00:00
Jeff Cohen
cd80438755 Allow llc to recognize -march=x86. As it was, it didn't recognize any
architecture at all.

llvm-svn: 19114
2004-12-23 06:45:32 +00:00
Reid Spencer
864cee3355 Added support for detection of amd64 targets.
llvm-svn: 19113
2004-12-23 06:22:33 +00:00
Jeff Cohen
53fbecce6e Patch to fix mingw compilation problem contributed by Henrik.
llvm-svn: 19112
2004-12-23 03:44:40 +00:00
Brian Gaeke
737d3e8794 Fix the build on PowerPC/Darwin - it thought we were declaring a new
function or something. Since FileRemover takes a const reference to
sys::Path, we need to pass an actual sys::Path variable.

llvm-svn: 19111
2004-12-22 22:33:33 +00:00
Reid Spencer
e0699f7466 * Remove an unnecessary step.
* Correct a path.

llvm-svn: 19110
2004-12-22 16:19:05 +00:00
Reid Spencer
d94c5f8cc9 Correct compilation for Cygwin. FindExecutable now returns a sys::Path.
llvm-svn: 19109
2004-12-22 13:50:17 +00:00
Reid Spencer
3b21e3539a For PR351:
Include local FDHandle.h file now that FDHandle is local to this library
and not in lib/System/FileUtilities.

llvm-svn: 19108
2004-12-22 10:25:06 +00:00
Reid Spencer
756d023539 For PR351:
FDHandle class (non-portable) moved here from lib/Support/FileUtilities

llvm-svn: 19107
2004-12-22 10:24:55 +00:00
Reid Spencer
5260b5b46d For PR351:
Move non-portable FDHandle class to its only user: lib/Debugger

llvm-svn: 19106
2004-12-22 10:24:43 +00:00
Reid Spencer
3e41cd50b4 Add a blurb about using the GCC 3.4.3 compiler on Cygwin (which works) for
the CFE instead of the default GCC 3.3.3 compiler that comes with Cygwin.

llvm-svn: 19104
2004-12-22 09:52:30 +00:00
Reid Spencer
c5f858ca52 For PR432:
* Remove the idiotic windows environment setting, its not needed.
* Remove an extraneous "mkdir" instruction.

llvm-svn: 19103
2004-12-22 09:07:51 +00:00
Reid Spencer
296cf274fd Hopefully fix a link.
llvm-svn: 19102
2004-12-22 06:48:03 +00:00
Reid Spencer
85a38ded31 Fix the names of these executables now that they've been somewhat cast in
stone.

llvm-svn: 19101
2004-12-22 06:47:25 +00:00
Reid Spencer
31bf9a0371 Correct the name of the executables to which llvmgcc and llvmgxx variables
point to.

llvm-svn: 19100
2004-12-22 06:45:24 +00:00
Reid Spencer
c659a4b140 For PR432:
Rework the CFE build details to include the directions for using the
option --program-prefix=llvm- to the CFE's configure script. This ensures
that the CFE builds unique executable names and makes it possible to put
the $CFEINSTALL/bin directory into one's path.

llvm-svn: 19099
2004-12-22 06:40:29 +00:00
Reid Spencer
788b0fdab7 For PR432:
* llvmgcc -> llvm-gcc
* llvmg++ -> llvm-g++
* remove references to --with-llvmgccdir configure option

llvm-svn: 19098
2004-12-22 06:29:07 +00:00
Reid Spencer
c4de911191 For PR432:
* Use LLVMGCC and LLVMGXX variables instead of computing the name

llvm-svn: 19097
2004-12-22 05:57:50 +00:00
Reid Spencer
e301401118 For PR432:
* Variable name change: cferuntime_libdir -> CFERuntimeLibDir

llvm-svn: 19096
2004-12-22 05:57:33 +00:00
Reid Spencer
2bba41c760 For PR432:
* Cleanup LLVMGCXX and LLVMGCC by providing LLVMGXXWITHPATH and LLVMGCCWITHPATH
  variables that add the $(LLVMToolDir) to the path so the CFE tools can find
  the right LLVM tools they depend on.
* Standardize the name of a variable: cferuntime_libdir -> CFERuntimeLibDir

llvm-svn: 19095
2004-12-22 05:57:21 +00:00
Reid Spencer
0921255067 For PR432:
* Use new configuration variables to compute LLVMGCC and LLVMGXX variables.

llvm-svn: 19094
2004-12-22 05:57:09 +00:00
Reid Spencer
fd144e8655 For PR432:
* Remove --with-llvmgccdir, not needed any more
* Search path for llvm-gcc and llvm-gxx
* Compute LLVMGCCDIR based on install path of llvm-gcc

llvm-svn: 19093
2004-12-22 05:56:56 +00:00
Reid Spencer
2ac471060e Get rid of old automake stuff
llvm-svn: 19092
2004-12-22 05:56:41 +00:00
Reid Spencer
e2b14e52c7 Support the gas option --traditional-format which, for some reason, gets
passed to gccas when the --program-prefix option is used to configure CFE.

llvm-svn: 19091
2004-12-22 02:58:43 +00:00
Misha Brukman
2261bff1a5 Ignore generated files
llvm-svn: 19090
2004-12-22 01:49:53 +00:00
Reid Spencer
5fb7160b0e Revert last patch until we can figure out how to build executables named
llvmgcc and llvmg++ correctly.

llvm-svn: 19089
2004-12-22 01:37:47 +00:00
Misha Brukman
8295ac7098 Fix the Win32 build
llvm-svn: 19088
2004-12-22 01:37:33 +00:00
Reid Spencer
5d2d5db1b0 Revert last changes as they introduce CFE build problems.
llvm-svn: 19087
2004-12-22 01:36:27 +00:00
Reid Spencer
fc195422a5 Make parameters to CopyFile use explicit instantiation of sys::Path.
llvm-svn: 19086
2004-12-22 01:26:48 +00:00
Jeff Cohen
248192ac04 Add project Bytecode to Visual Studio
llvm-svn: 19085
2004-12-22 00:27:14 +00:00
Reid Spencer
0953cfc002 Remove instructions to make aliases for llvmgcc and llvmg++ as the CFE
Build instructions now direct the user to have the CFE generate executables
with those names via the --program-prefix=llvm configure option.

llvm-svn: 19084
2004-12-21 18:52:08 +00:00
Reid Spencer
7bb9d35be2 For PR432:
Add instructions for using the --program-prefix=llvm so that the CFE build
produces llvmgcc instead of gcc.

llvm-svn: 19083
2004-12-21 18:50:54 +00:00
Jeff Cohen
6486fab16d Fix VC++ compilation error
llvm-svn: 19082
2004-12-21 15:40:41 +00:00
Reid Spencer
9e7acd465e For PR351:
Remove unix specific code (use of errno and read) from the reader.
Thanks to Jeff Cohen for pointing this out.

llvm-svn: 19081
2004-12-21 07:51:33 +00:00
Jeff Cohen
fd0e3542f9 Visual Studio project Configure should place the configured header files
in the win32 subtree instead of the src subtree.

llvm-svn: 19080
2004-12-21 06:49:13 +00:00
Reid Spencer
107410613b Put the CopyFile function explicitly in the sys namespace.
llvm-svn: 19079
2004-12-21 03:27:08 +00:00
Reid Spencer
4acff4056f Use explicit construction of sys::Path from std::string because the
constructor is "explicit".

llvm-svn: 19078
2004-12-21 03:24:02 +00:00
Reid Spencer
fbad5d7d65 Include <cassert> for Cygwin.
llvm-svn: 19077
2004-12-21 00:22:51 +00:00
Reid Spencer
22dd8b15c0 Cygwin doesn't like .. through a link, so drop the ..
llvm-svn: 19076
2004-12-20 22:21:41 +00:00
Reid Spencer
92e8a5a0ea Fix a bug where system time always equals user time
llvm-svn: 19075
2004-12-20 21:44:27 +00:00
Reid Spencer
d4c6988809 Implement GetTimeUsage correctly.
llvm-svn: 19074
2004-12-20 21:43:33 +00:00
Reid Spencer
08b4bd7496 Allow compilers that can't distinguish between a class instantiation and
the declaration of a function to compile this.

llvm-svn: 19073
2004-12-20 19:16:12 +00:00
Reid Spencer
8005e66f0a Provide a getrusage based implementation of GetTotalMemoryUsage and use
the ru_maxrss field as an approximation.

llvm-svn: 19072
2004-12-20 16:33:37 +00:00
Reid Spencer
1cf74cee21 Consistently use the same #if style. Also, fix a bug testing for sbrk(3)
llvm-svn: 19071
2004-12-20 16:06:44 +00:00
Reid Spencer
1e10203375 Remove unnecessary #includes.
llvm-svn: 19070
2004-12-20 06:38:12 +00:00
Reid Spencer
cbd791c5e7 Be double sure about including sys/stat.h by wrapping the inclusion in
an "#if defined(HAVE_SYS_STAT_H)".

llvm-svn: 19069
2004-12-20 06:34:02 +00:00
Misha Brukman
db1fca91af llvm/Config/unistd.h has gone away, far, far away
llvm-svn: 19068
2004-12-20 05:36:57 +00:00
Reid Spencer
b5e10bb05d Remove the #include of llvm/Config/unistd.h as it is no longer needed.
llvm-svn: 19067
2004-12-20 04:52:04 +00:00
Reid Spencer
f3f9f4339f Remove this file as there are no LLVM users of it any more.
llvm-svn: 19066
2004-12-20 04:35:20 +00:00
Reid Spencer
a2ff4f4634 Incorporate the contents of include/llvm/Config/unistd.h as this is the
last file in LLVM to require the header. After ths commmit, our unistd.h
will go away.

llvm-svn: 19065
2004-12-20 04:34:36 +00:00
Reid Spencer
beece98d9d Remove this file as its not used by anything in LLVM any more. System
dependent behavior is now made through the lib/System interface.

llvm-svn: 19064
2004-12-20 04:25:53 +00:00
Reid Spencer
5e3a6d29bc Remove these files as they are included by nothing in LLVM any more. The
system dependent functionality has been moved to lib/System.

llvm-svn: 19063
2004-12-20 04:24:32 +00:00
Reid Spencer
e4bd5e577a Remove these headers. The files that used to #include them don't any more
as most system dependent behavior has been moved to lib/System.

llvm-svn: 19062
2004-12-20 04:20:37 +00:00
Reid Spencer
6b853b22cb Remove un-needed #includes.
llvm-svn: 19061
2004-12-20 04:15:44 +00:00
Reid Spencer
f3b99a9c02 Add HAVE_SYSCONF
llvm-svn: 19060
2004-12-20 04:08:58 +00:00
Brian Gaeke
fe4e48e14b Use Config/alloca.h instead of alloca.h - pointed out by Duraid and Misha
llvm-svn: 19059
2004-12-20 04:02:01 +00:00
Reid Spencer
ee556dd431 Put some header files back that Win32 needs.
llvm-svn: 19058
2004-12-20 03:59:23 +00:00
Jeff Cohen
7ae0bc7111 Keep up with lib/System changes
llvm-svn: 19057
2004-12-20 03:24:56 +00:00
Jeff Cohen
be92640355 Fix problems uncovered by VC++ (first time compiled by VC++)
llvm-svn: 19056
2004-12-20 03:23:46 +00:00
Reid Spencer
ac38f3a028 For PR351:
* Implement GetMallocUsage to get usage of malloc heap
* Implement GetMemoryUsage to get total memory usage of process
* Implement GetTimeUsage to get elapsed/user/system time

llvm-svn: 19055
2004-12-20 00:59:28 +00:00
Reid Spencer
27fa6c6d49 For PR351:
No need for Unix/SUS/Process.cpp any more, just ifdef it.

llvm-svn: 19054
2004-12-20 00:59:16 +00:00
Reid Spencer
2708881067 For PR351:
* Move system dependent implementation out of this file.
* Make implementation use sys::Process::GetMallocUsage where necessary.
* Make implementation use sys::Process::GetTimeUsage where necessary.

llvm-svn: 19053
2004-12-20 00:59:04 +00:00
Reid Spencer
8b44f87ef9 For PR351:
* Add checks for sbrk and getpagesize functions
* Alphebetize the checks for functions

llvm-svn: 19052
2004-12-20 00:59:04 +00:00
Reid Spencer
554368e4d9 For PR351:
* Add GetMallocUsage as a wrapper around mallinfo()
* Add GetTotalMemoryUsage to get approximate RSS size
* Add GetTimeUsage to get elapsed/system/user time

llvm-svn: 19051
2004-12-20 00:58:53 +00:00
Reid Spencer
47dff91dc2 Wrap long lines
llvm-svn: 19050
2004-12-20 00:58:41 +00:00
Reid Spencer
d816f9e935 For PR351:
This file is no longer needed as system dependent functions have been
encapsulated into lib/System.

llvm-svn: 19049
2004-12-20 00:58:25 +00:00
Misha Brukman
f06cb1db24 * Use "" for LLVM include files, not <>
* llvm/Config/alloca.h already #includes config.h
* Minor readability/stylistic changes

llvm-svn: 19048
2004-12-20 00:16:38 +00:00
Brian Gaeke
cb1b1e74eb Make this compile on Solaris.
llvm-svn: 19047
2004-12-19 21:08:07 +00:00
Misha Brukman
0eb431c04c Use <> for system #include files
llvm-svn: 19046
2004-12-19 19:27:11 +00:00
Brian Gaeke
8062bde121 Make references to 'struct sigaction' compile under Solaris.
llvm-svn: 19045
2004-12-19 18:58:11 +00:00
Reid Spencer
766ad0b77f For PR351:
* Support changes in sys::Program::ExecuteAndWait interface

llvm-svn: 19044
2004-12-19 18:00:56 +00:00
Reid Spencer
6cb551b279 For PR351:
Move the functionality of RunProgramWithTimeout into the ExecuteAndWait
function: support a timeout and I/O redirects

llvm-svn: 19043
2004-12-19 18:00:44 +00:00
Reid Spencer
72d1627d16 For PR351:
Add a needed include.

llvm-svn: 19042
2004-12-19 18:00:32 +00:00
Reid Spencer
2d76ff5c85 For PR351:
* Pass sys::Path instead of std::string for paths
* Correct the types of arguments passed to RunProgramWithTimeout due to its
  interface using sys::Path instead of std::string
* Replace "/dev/null" (not portable) with empty string which
  sys::Program::ExecuteAndWait recognizes as "redirect to bit bucket"

llvm-svn: 19041
2004-12-19 18:00:21 +00:00
Reid Spencer
d44f845213 For PR351:
* Remove unneeded header files.
* Move RedirectFD static function to lib/System/Unix/Program.cpp
* Delete RunProgramWithTimeout, now implemented by
  sys::Program::ExecuteAndWait. RunProgramWithTimeout is now a convenience func.

llvm-svn: 19040
2004-12-19 18:00:09 +00:00
Reid Spencer
4fea306f5e For PR351:
Incorporate the abilities of RunPRogramWithTimeout into
sys::Program::ExecuteAndWait so that redirection and a timeout are optionally
supported.

llvm-svn: 19039
2004-12-19 17:59:57 +00:00
Reid Spencer
8d3bdca1b4 For PR351:
Turn path instance variables into sys::Path instead of std::string

llvm-svn: 19038
2004-12-19 17:59:45 +00:00
Reid Spencer
fb741b2700 For PR351:
Replace RunProgramWithTimeout with an inline function that calls
sys::Program::ExecuteAndWait. This is now just a convenience function.

llvm-svn: 19037
2004-12-19 17:59:33 +00:00
Jeff Cohen
033fed0205 Add llc project to Visual Studio
llvm-svn: 19036
2004-12-19 17:53:47 +00:00
Jeff Cohen
e14dc8bb79 Add lli project to Visual Studio
llvm-svn: 19035
2004-12-19 06:40:39 +00:00
Jeff Cohen
b49205c550 Enable browse information in Visual Studio
llvm-svn: 19034
2004-12-19 02:29:00 +00:00
Jeff Cohen
45efd8df99 Improve dependency management for lib/system/win32/* files. Instead of copying the
files from win32/* to platform/*, create one line files in platform that include the
corresponding file in win32.  This makes life much more enjoyable!

The cruel irony is that NTFS has hard links just like Unix, but there's no way to
get to them from the DOS prompt!

llvm-svn: 19033
2004-12-18 08:01:43 +00:00
Jeff Cohen
ca9b7e66d0 Don't forget about release configuration...
llvm-svn: 19032
2004-12-18 07:05:59 +00:00
Jeff Cohen
c3ba60ece6 Rationalize warning suppression. First, 64-bit portability warnings are disabled. The
specific warnings they produced were being suppressed anyway.  The truncation warnings
that were suppressed are now enabled, and the few that still occur ought to be fixed.
The only warnings suppressed now are the "negating an unsigned is still unsigned", the
validity of which Chris does not accept, and the "implicit conversion of <type> to bool
performance warning".  Making the conversion explicit won't make it run any faster and
this is an easier way to shut the compiler up.

llvm-svn: 19031
2004-12-18 06:55:41 +00:00
Reid Spencer
5ababc6f33 sys::CopyFile returns void and throws an exception on error which will be
caught by llvm-ld's main function.

llvm-svn: 19030
2004-12-18 06:54:21 +00:00
Reid Spencer
8b086e3871 sys::CopyString throws an exception on error which will be caught by gccld
main function.

llvm-svn: 19029
2004-12-18 06:53:10 +00:00
Jeff Cohen
81184bb528 Fix win32 breakage
llvm-svn: 19028
2004-12-18 06:42:15 +00:00
Reid Spencer
16ce83c3a6 The CopyFile function got moved into the sys namespace.
llvm-svn: 19026
2004-12-18 00:19:32 +00:00
Reid Spencer
b3d3f1b579 Correct the name of the method. CopyFiles -> CopyFile.
llvm-svn: 19025
2004-12-18 00:14:24 +00:00
Chris Lattner
45382d34cc Remove unused enum value
llvm-svn: 19024
2004-12-17 22:41:46 +00:00
Tanya Lattner
96f6909ae1 Always print out DejagnuTest results to stdout so that it gets emailed to the nightly test manager. Eventually Dejagnu should be merged into the added/removed tests.
llvm-svn: 19023
2004-12-17 20:58:34 +00:00
Reid Spencer
181cf4ce17 Move the #include of sys/stat.h inside the linux "hack" for the stat
family of functions so it gets noticed if we ever remove this.

llvm-svn: 19022
2004-12-17 19:09:16 +00:00
Chris Lattner
227010bb31 Remove unused #include
llvm-svn: 19021
2004-12-17 19:07:04 +00:00
Reid Spencer
0575a63578 Only #include sys/stat.h if we're on linux where we have the PR274 problem.
llvm-svn: 19020
2004-12-17 18:56:29 +00:00
Chris Lattner
5e5e3f4409 Make this testcase a bit more challanging
llvm-svn: 19019
2004-12-17 17:14:00 +00:00
Chris Lattner
a12b5df616 Actually overload the virtual method. This fixes
Regression/Analysis/GlobalsModRef/purecse.ll.  Isn't this what the
-Woverload-whatever flag would warn about :)

llvm-svn: 19018
2004-12-17 17:12:24 +00:00
Chris Lattner
493cc12415 Change the test to check to see that CSE happens not dead call elim
llvm-svn: 19017
2004-12-17 17:11:41 +00:00
Chris Lattner
f953b24f4e Make code fit in 80 cols
llvm-svn: 19016
2004-12-17 17:02:54 +00:00
Reid Spencer
1abfe0d655 Reverse the logic for Win32 to ensure that bugpoint and llvm-db are NOT
built on this platform.

llvm-svn: 19015
2004-12-17 08:00:40 +00:00
Reid Spencer
120aa08e1c Fix this file to actually work. ifneq was incorrectly used. Subtract out
llvm-db and bugpoint for Win32 rather than add them in
subtr

llvm-svn: 19014
2004-12-17 07:59:53 +00:00
Reid Spencer
801643d737 Describe the new "reconfigure" and "spotless" targets.
llvm-svn: 19013
2004-12-17 07:46:45 +00:00
Reid Spencer
7ef8e66e50 Complete the implementation of the spotless rule and make it not depend on
the .. directory.

llvm-svn: 19012
2004-12-17 07:45:03 +00:00
Reid Spencer
19dd542a31 Makefile.JIT doesn't exist any more so it doesn't need to be distributed.
llvm-svn: 19009
2004-12-17 02:06:36 +00:00
Reid Spencer
0306c68c1f Disable bugpoint and llvm-db tools for Win32. They can't be supported on
that platform without a lot of work because they depend on process image
copy behavior of fork(2).

llvm-svn: 19008
2004-12-17 01:46:41 +00:00
Chris Lattner
db0bf10e4a Change the sentinal
llvm-svn: 19007
2004-12-17 00:46:51 +00:00
Chris Lattner
979b903916 Create a stack slot for the return address lazily instead of eagerly. This
save small amounts of time for functions that don't call llvm.returnaddress
or llvm.frameaddress (which is almost all functions).

llvm-svn: 19006
2004-12-17 00:07:46 +00:00
Tanya Lattner
991b5e9457 Chris is a pain ;) Removing reassociate.
llvm-svn: 19005
2004-12-16 23:16:16 +00:00
Tanya Lattner
a5528e89fd Removing commented out lines.
llvm-svn: 19004
2004-12-16 23:13:16 +00:00
Tanya Lattner
08e19bb412 Removed LICM and GCSE.
llvm-svn: 19003
2004-12-16 23:07:36 +00:00
Tanya Lattner
c3a7bd7d0c Linking in all of ScalarOpts.
llvm-svn: 19002
2004-12-16 23:07:13 +00:00
Reid Spencer
584cb0a8c1 For PR351:
* removeFile() -> sys::Path::destroyFile()
* remove extraneous toString() calls
* convert local variables representing path names from std::string to
  sys::Path
* Use sys::Path objects with FileRemove instead of std::string
* Use sys::Path methods for construction of path names

llvm-svn: 19001
2004-12-16 23:04:20 +00:00
Reid Spencer
beb9946af8 For PR351:
* Make the OutputC and OutputAsm functions work with sys::Path for the output
  file name instead of using std::string.
* Get rid of extraneous "toString" calls.
* Change "removeFile" to sys::Path::destroyFile()

llvm-svn: 19000
2004-12-16 23:01:34 +00:00
Reid Spencer
ea71e3c89b For PR351:
* Remove the "removeFile" function, now implemented by the
  sys::Path::destroyFile method.
* Make the FileRemove work with a sys::Path instead of a std::string

llvm-svn: 18999
2004-12-16 23:00:05 +00:00
Chris Lattner
867783adc4 X86 doesn't actually use SelectionDAG yet.
llvm-svn: 18996
2004-12-16 19:40:10 +00:00
Chris Lattner
eb5a2cf32b No targets actually use this library
llvm-svn: 18995
2004-12-16 19:39:45 +00:00
Chris Lattner
5a4c66cfe9 Remove dead #include
llvm-svn: 18994
2004-12-16 19:32:38 +00:00
Reid Spencer
b193ec5a13 Fix a compile error. config.h is now needed because DataTypes.h doesn't
include it any more.

llvm-svn: 18993
2004-12-16 19:19:24 +00:00
Reid Spencer
6b9c46de92 Get rid of inclusion of config.h because this file is autoconf'd.
llvm-svn: 18992
2004-12-16 18:47:17 +00:00
Reid Spencer
afdc82c259 Some minor upgrades
* Convert "cmp" usage to $(CMP)
* Convert "cp" usage to $(CP)
* Fix some build messages to reflect what's actually going on
* Add a "reconfigure" target for forcing a reconfigure. Helps with testing
  things like Chris's recent changes.

llvm-svn: 18991
2004-12-16 18:26:53 +00:00
Reid Spencer
d42d5d433f Add CMP and CP configuration variables for the unix cmp and cp programs.
llvm-svn: 18990
2004-12-16 17:48:14 +00:00
Chris Lattner
f86914daae Factor all of the .inc : .inc.tmp rules into one.
llvm-svn: 18989
2004-12-16 17:38:56 +00:00
Chris Lattner
22f937ae52 Add spaces between rule groups to make it more obvious which ones pair
Remove instrselector generation, remove Intel/ATT specifics from Makefile.rules.

llvm-svn: 18988
2004-12-16 17:34:04 +00:00
Chris Lattner
20d74fd986 Adjust to changes in asmwriter filenames
llvm-svn: 18987
2004-12-16 17:33:24 +00:00
Chris Lattner
2a02390beb When tblgen changes, regenerate all .inc files, but do not rebuild any .o
files that USE the .inc file unless the contents of the .inc file changes.

This should fix the problem where reconfiguring causes all targets to be
completely rebuilt (because config.h is usually modified, causing libsystem
to be rebuilt, causing tblgen to be rebuilt, causing .inc files to be
rebuilt, causing .o files to be rebuilt).

This patch also checks in a gross hack where .o files now explicitly depend
on $(BUILT_SOURCES), to avoid problems where the .inc files are not completely
generated before the .o files start to compile.

llvm-svn: 18986
2004-12-16 17:28:50 +00:00
Chris Lattner
a38954dd64 Specify all of the targets built.
llvm-svn: 18985
2004-12-16 17:26:44 +00:00
Chris Lattner
03227509c0 Use the rules in Makefile.rules to build SparcV9GenCodeEmitter.inc instead
of custom rules.

llvm-svn: 18984
2004-12-16 16:47:56 +00:00
Chris Lattner
0bc3333ff4 Fix header
llvm-svn: 18983
2004-12-16 16:47:03 +00:00
Chris Lattner
0782e27d85 Factor out common .td file chunks.
llvm-svn: 18982
2004-12-16 16:31:57 +00:00
Reid Spencer
5581437308 Add a "make spotless" rule for environments with BUILD_OBJ_ROOT not equal
to BUILD_OBJ_SRC. This will save the config.status and mklib files, then
wipe out the BUILD_OBJ_ROOT, copy back config.status and mklib, and then
run config.status to regenerate the makefiles. This target gives you a
completely clean/fresh BUILD_OBJ_ROOT.

llvm-svn: 18981
2004-12-16 08:00:46 +00:00
Reid Spencer
aeea3cf764 Get rid of extraneous dependencies on $(BUILT_SOURCES) now that we've fixed
the bug with BUILT_SOURCES being dependencies of the user targets.

llvm-svn: 18980
2004-12-16 07:36:08 +00:00
Reid Spencer
97e40f1eb6 Fix a major bug with BUILT_SOURCES. You actually have to dereference a
variable before you can filter its value. Duh!

llvm-svn: 18979
2004-12-16 07:15:16 +00:00
Reid Spencer
3c90f0e3ed Revert last patch which breaks PowerPC target because it fails to build
the 32bit and 64bit variants.

llvm-svn: 18978
2004-12-16 07:14:19 +00:00
Chris Lattner
56a874b0d6 Portability fix, thanks to Markus F.X.J. Oberhumer.
llvm-svn: 18977
2004-12-16 04:56:34 +00:00
Jeff Cohen
fc6ebc9cb7 Expository comment submitted by Henrik Bach
llvm-svn: 18976
2004-12-16 04:06:56 +00:00
Chris Lattner
b63ff380f1 Make %'s a bit more explicit
llvm-svn: 18975
2004-12-15 23:38:13 +00:00
Chris Lattner
298a7f8d8b Fix PR485, instead of emitting zero sized arrays, emit arrays of size 1.
llvm-svn: 18974
2004-12-15 23:13:15 +00:00
Reid Spencer
e56242780c Change the signatures of the destroyFile and destroyDirectory methods to
const because they affect the file system, not the Path object.

llvm-svn: 18973
2004-12-15 23:02:10 +00:00
Reid Spencer
e13f84b186 Adjust documentation of GetBytecodeLibraryPaths after removing LLVMGCCDIR
support from it.

llvm-svn: 18972
2004-12-15 22:49:18 +00:00
Reid Spencer
0fb34f9c12 Remove LLVMGCCDIR.
llvm-svn: 18971
2004-12-15 22:28:35 +00:00
Reid Spencer
0f6abe6b90 Remove LLVMGCCDIR from the set of defines.
llvm-svn: 18970
2004-12-15 22:27:51 +00:00
Reid Spencer
35d15bdf52 Remove the CFE's lib directory from the bytecode path because LLVM should
be agnostic to the needs of any specific FE.

llvm-svn: 18969
2004-12-15 22:22:51 +00:00
Reid Spencer
879f11df3d Remove automatic insertion of CFE's lib directory into the bytecode path
because LLVM should be agnostic to the needs of specific front ends.

llvm-svn: 18968
2004-12-15 22:21:42 +00:00
Reid Spencer
8240a916db Unbreak all archive reading operations introduced by the last patch which
always exited the program with exit code 1 in these cases, regardless of
whether an error occurred or not.

llvm-svn: 18966
2004-12-15 21:58:03 +00:00
Chris Lattner
e340065558 Add a verifier assertion
llvm-svn: 18965
2004-12-15 20:23:49 +00:00
Chris Lattner
aefd5fa18a Eliminate a virtual method call
llvm-svn: 18964
2004-12-15 18:14:04 +00:00
Chris Lattner
c0bd4b19b8 Make archive rules properly depend on llvm-ar.
llvm-svn: 18963
2004-12-15 17:14:06 +00:00
Chris Lattner
869d6a40a9 Fix a bug in -no-aa that caused two DSGraph tests to XPASS.
llvm-svn: 18962
2004-12-15 17:13:24 +00:00
Reid Spencer
98ce23ffb0 Fix a file overwrite bug in llvm-ar introduced by changes to
createTemporaryFile semantics where it doesn't create a fully unique name
if the basename doesn't exist. This functionality is now optionally
provided by the boolean reuse_current parameter to createTemporaryFile and
makeUnique. The default values differ because of the way these functions
are used in LLVM.

llvm-svn: 18961
2004-12-15 08:32:45 +00:00
Chris Lattner
5b489416c9 Disable libprofile as llvm-ar bus errors on it, and I don't want to break
the nightly testers.

llvm-svn: 18960
2004-12-15 08:15:48 +00:00
Chris Lattner
160a8a9725 Do not fail an assertion on a broken archive
llvm-svn: 18959
2004-12-15 07:44:15 +00:00
Chris Lattner
b17f3e13ec Adjust to new interfaces
llvm-svn: 18958
2004-12-15 07:22:25 +00:00
Chris Lattner
71d04bce55 Adjust to new alias analysis interfaces
llvm-svn: 18957
2004-12-15 07:22:13 +00:00
Chris Lattner
fac211f5c4 Make the AliasAnalysis interface more precise for common cases.
llvm-svn: 18956
2004-12-15 07:21:39 +00:00
Chris Lattner
e09dbe2732 Move virtual method call out of loop
llvm-svn: 18955
2004-12-15 07:04:32 +00:00
Jeff Cohen
92e02d40cb Make Win32 TimeValue::toString() re-entrant and work with mingw
llvm-svn: 18954
2004-12-15 04:28:44 +00:00
Jeff Cohen
e408341854 Fix VC++ compilation errors
llvm-svn: 18953
2004-12-15 04:08:15 +00:00
Reid Spencer
527ac0a1c7 Don't put newlines in AC macros that can't handle them!
llvm-svn: 18952
2004-12-15 04:01:48 +00:00
Reid Spencer
86960adfa3 Change LLVMGCCDIR/bytecode-libs -> LLVMGCCDIR/lib
llvm-svn: 18951
2004-12-15 01:54:37 +00:00
Reid Spencer
d8c5b71bd4 For PR351:
Remove #inclusion of Support/FileUtilities.h which isn't needed any more.

llvm-svn: 18950
2004-12-15 01:53:50 +00:00
Reid Spencer
30067f1eac For PR351:
* Convert use of getUniqueFilename to sys::Path::makeUnique();

llvm-svn: 18949
2004-12-15 01:53:08 +00:00
Reid Spencer
9329172767 For PR351:
* Remove #inclusion of FileUtilities.h, not needed any more.
* Convert getUniqueFilename -> sys::Pat::makeUnique()

llvm-svn: 18948
2004-12-15 01:51:56 +00:00
Reid Spencer
f66d93239e For PR351:
* Fix implementation and documentation about LLVMGCCDIR/bytecode-libs
* Add the makeUnique method, replacement for getUniqueFilename in Support.
* Add the sys::CopyFile function, replacement for CopyFile in Support.
* Move GetLLVMConfigDir() into generic code area since its generic.

llvm-svn: 18947
2004-12-15 01:50:13 +00:00
Reid Spencer
320a20ac45 For PR351:
Remove getUniqueFilename and CopyFile. These are now implemented by
sys::Path::makeUnique and sys::CopyFile, respectively.

llvm-svn: 18946
2004-12-15 01:46:54 +00:00
Reid Spencer
1b916e1ced Add some system specific functions we use
llvm-svn: 18945
2004-12-15 01:41:56 +00:00
Reid Spencer
360d6b71a3 Remove most references to LLVM_LIB_SEARCH_PATH. It now only exists in the
GettingStarted.html document in the environment section and only as an
optional feature.

llvm-svn: 18944
2004-12-15 00:14:01 +00:00
Reid Spencer
05d4d6026c Fix the default install directory of modules from / to $(libdir) !
Many thanks to Vladimir Merzliakov for pointing this out!

llvm-svn: 18942
2004-12-14 22:44:05 +00:00
Chris Lattner
2617b5033b Use user time, not wall time, for optimizer time.
llvm-svn: 18941
2004-12-14 22:42:59 +00:00
Reid Spencer
79e49cffb5 Correct documentation to reflect the change in location of the CFE runtime
libraries. They are now in $CFEINSTALL/lib not $CFEINSTALL/bytecode-lib.

llvm-svn: 18939
2004-12-14 22:07:29 +00:00
Chris Lattner
9ad0d55025 Constant exprs are not efficiently negatable in practice. This disables
turning X - (constantexpr) into X + (-constantexpr) among other things.

llvm-svn: 18935
2004-12-14 20:08:06 +00:00
Reid Spencer
c936ad1208 Add the getMagicNumber method.
Patch contributed by Henrik Bach. Thanks Henrik!

llvm-svn: 18933
2004-12-14 18:42:13 +00:00
Brian Gaeke
4bc39bef79 The mystery of Olden/tsp solved, and more opportunities for speedup.
llvm-svn: 18932
2004-12-14 09:10:10 +00:00
Brian Gaeke
36c14da84f Get rid of shifts by zero in most cases.
llvm-svn: 18931
2004-12-14 08:21:02 +00:00
Jeff Cohen
2b60d39499 Implement Win32 Path::getStatusInfo(), TimeValue::toString()
llvm-svn: 18930
2004-12-14 05:26:43 +00:00
Reid Spencer
eedafda7bb For PR351:
* Change ExecWait calls to sys::Program::ExecuteAndWait
* Convert to use sys::Path where it makes sense

llvm-svn: 18929
2004-12-14 04:20:08 +00:00
Reid Spencer
cdefe0aebc For PR351:
Implement the new environment pointer for ExecuteAndWait

llvm-svn: 18928
2004-12-14 04:18:51 +00:00
Reid Spencer
c2e22fea42 For PR351:
* Remove the ExecWait function. This is now in sys::Program::ExecuteAndWait

llvm-svn: 18927
2004-12-14 04:18:15 +00:00
Reid Spencer
a84c82f3bb For PR351:
* Fix commentary, wrap lines, etc.
* Add an environment pointer to the ExecuteAndWait function.

llvm-svn: 18926
2004-12-14 04:17:12 +00:00
Reid Spencer
87ad666bb3 Revert the last patch as it causes a static destruction ordering problem.
llvm-svn: 18925
2004-12-14 03:55:21 +00:00
Reid Spencer
79dc8b79bb For PR351:
Adjust to interface change for FindExecutable.

llvm-svn: 18920
2004-12-13 23:44:23 +00:00
Reid Spencer
d89ff0a5e1 For PR351:
Adjust to changes in the interface of FindExecutable, getting ToolRunner
ready for bigger things to come.

llvm-svn: 18919
2004-12-13 23:43:44 +00:00
Reid Spencer
dc49d865a1 For PR351:
* Remove isExecutable as its now implemented by sys::Path::executable
* Make FindExecutable a thin veneer over sys::Program::FindProgramByName.

llvm-svn: 18918
2004-12-13 23:41:37 +00:00
Reid Spencer
febc20eda1 For PR351:
* isExecutable -> sys::Path::executable()
* Adjust interface of FindExecutable to return a sys::Path

llvm-svn: 18917
2004-12-13 23:40:08 +00:00
Reid Spencer
b7c56070ca For PR351:
llee was a nice hack, but it wasn't portable so its gone, with Misha's
approval.  Operating systems have facilities available for making bytecode
directly executable without this utility.

llvm-svn: 18916
2004-12-13 23:15:32 +00:00
Chris Lattner
b3b1c279a2 When generating code for X86 targets, make sure the fp control word is set
to 64-bit precision, not 80 bits.

llvm-svn: 18915
2004-12-13 21:52:52 +00:00
Misha Brukman
318a44d867 Minor cleanups
llvm-svn: 18914
2004-12-13 21:42:16 +00:00
Brian Gaeke
f9639d2a74 Fix link error in PPC optimized build of 'opt'.
llvm-svn: 18913
2004-12-13 21:28:39 +00:00
Reid Spencer
e42f222d36 For PR351:
Remove AllocateRWXMemory as it is not used any more in LLVM. The function
has been replaced with sys::Memory::AllocateRWX several months ago.

llvm-svn: 18912
2004-12-13 20:14:30 +00:00
Chris Lattner
951e94e867 Add some notes
llvm-svn: 18911
2004-12-13 20:13:10 +00:00
Reid Spencer
6b8632850b For PR351:
Remove the MakeFileReadable and MakeFileExecutable functions which are no
longer present in LLVM. They have been replaced with the sys::Path methods
makeReadable and makeExecutable, respectively.

llvm-svn: 18910
2004-12-13 20:08:14 +00:00
Reid Spencer
249eb144d9 For PR351:
Replace MakeFileReadable and MakeFileExecutable (from FileUtilities) with
sys::Path::makeReadable and sys::Path:makeExecutable, respectively.

llvm-svn: 18909
2004-12-13 20:03:02 +00:00
Chris Lattner
8f430a3b59 Get rid of getSizeOf, using ConstantExpr::getSizeOf instead.
do not insert a prototype for malloc of: void* malloc(uint): on 64-bit u
targets this is not correct.  Instead of prototype it as void *malloc(...),
and pass the correct intptr_t through the "...".

Finally, fix Regression/CodeGen/SparcV9/2004-12-13-MallocCrash.ll, by not
forming constantexpr casts from pointer to uint.

llvm-svn: 18908
2004-12-13 20:00:02 +00:00
Reid Spencer
94bf2265df For PR351:
Implement three new functions to allow setting access/permission bits on
the file referenced by a path. The makeReadable and makeExecutable methods
replace the FileUtilities MakeFileReadable and MakeFileExecutable
functions. The makeWritable function is new and provided for consistency
since Path has a writable() method.

llvm-svn: 18907
2004-12-13 19:59:50 +00:00
Chris Lattner
acc4e54552 Change this method to return ulong, not uint, for 64-bit targets.
llvm-svn: 18906
2004-12-13 19:48:51 +00:00
Chris Lattner
5417117a8f New testcase that crashes the V9 backend.
llvm-svn: 18905
2004-12-13 19:10:32 +00:00
Reid Spencer
e05ab4a1ec Genericize implementation of GetDLLSuffix now that we have LTDL_SHLIB_EXT
available.

llvm-svn: 18904
2004-12-13 18:41:28 +00:00
Reid Spencer
73fc525557 For PR351:
The ReadFileIntoAddressSpace and UnmapFileFromAddressSpace functions are no
longer used by LLVM. Remove them. Replacement functionality for both
functions is now encapsulated in the sys::MappedFile class.

llvm-svn: 18903
2004-12-13 18:28:59 +00:00
Reid Spencer
cd89ca3040 For PR351:
Use sys::MappedFile instead of ReadFileIntoAddressSpace and
UnmapFileFromAddressSpace. sys::MappedFile has the nice property that it
cleans up after itself so exception handling can be removed.

llvm-svn: 18902
2004-12-13 18:25:27 +00:00
Alkis Evlogimenos
7c7705d108 Fix typo.
llvm-svn: 18901
2004-12-13 18:08:29 +00:00
Chris Lattner
2f65416429 Fix this test
llvm-svn: 18900
2004-12-13 17:53:11 +00:00
Alkis Evlogimenos
a20de02919 Add llvm tool variables.
llvm-svn: 18897
2004-12-13 17:44:14 +00:00
Reid Spencer
1a14e28ade For PR351:
* Change use of ReadFileIntoAddressSpace to sys::MappedFile use.
* Shorten a line > 80 chars.

llvm-svn: 18896
2004-12-13 17:41:13 +00:00
Chris Lattner
c97cac3d32 Set the rounding mode for the X86 FPU to 64-bits instead of 80-bits. We
don't support long double anyway, and this gives us FP results closer to
other targets.

This also speeds up 179.art from 41.4s to 18.32s, by eliminating a problem
with extra precision that causes an FP == comparison to fail (leading to
extra loop iterations).

llvm-svn: 18895
2004-12-13 17:23:11 +00:00
Reid Spencer
0afe178f21 Make the loop termination condition clear when building the set of items to
pass to the Linker::LinkInItems function.

llvm-svn: 18894
2004-12-13 17:18:19 +00:00
Reid Spencer
f51f490b7b For PR351: libLLVMSupport now depends on libLLVMSystem
llvm-svn: 18893
2004-12-13 17:02:08 +00:00
Reid Spencer
aa95684acd For PR351: \
The getFileTimestamp and getFileSize functions have been removed from  \
FileUtilities.{h,cpp}. They are replaced by Path::getTimestamp and  \
Path::getSize,respectively.

llvm-svn: 18892
2004-12-13 17:01:53 +00:00
Reid Spencer
0b4a4bf96a Added a size_type typedef to LLVM containers to make Visual Studio shut up
(and possibly to make LLVM more x86 64bit friendly).

llvm-svn: 18891
2004-12-13 16:28:53 +00:00
Reid Spencer
eb21d18b36 Add a convenience function for clearing the two global areas.
Patch contributed by Morten Ofsted.

llvm-svn: 18890
2004-12-13 16:22:32 +00:00
Reid Spencer
53bd3d0b1a Get rid of some leaks found by VC leak detector.
Patch contributed by Morten Ofsted.

llvm-svn: 18889
2004-12-13 16:04:04 +00:00
Reid Spencer
a125162bb0 Minor syntactical change to make this a little easier to comprehend.
llvm-svn: 18888
2004-12-13 09:37:41 +00:00
Reid Spencer
ff17d0439d Make use of the new Path inserter function.
llvm-svn: 18887
2004-12-13 08:53:36 +00:00
Reid Spencer
790100674a Fix a bug where "." or any single character file name doesn't get the
terminating / when setDirectory is called.

llvm-svn: 18886
2004-12-13 07:51:52 +00:00
Reid Spencer
a85abc23d5 Remove an always false clause from an if statement.
llvm-svn: 18885
2004-12-13 07:51:07 +00:00
Alkis Evlogimenos
5b1a05fb7c Fix a bug where directory names of length one or less where not set
properly (examples: "", ".", "a").

llvm-svn: 18883
2004-12-13 07:41:35 +00:00
Reid Spencer
c6de5b56a3 Use the new BYTECODE_DESTINATION to override the default bytecode install
destination for this library so that it goes to $(cferuntime_libdir) rather
than just $(libdir). Normal bytecode libraries should be installed in the
$(libdir), but these ones are "special" because they're part of the the
C/C++ front end.

llvm-svn: 18882
2004-12-13 07:40:50 +00:00
Reid Spencer
5ae8c5e5d6 More properly name bytecode_libdir cferuntime_libdir. This is only the
libdir for the CFE runtime libraries, not "all bytecode".

llvm-svn: 18881
2004-12-13 07:38:55 +00:00
Reid Spencer
efe3a82813 Finish the implementation of the BYTECODE_DESTINATION feature for modules
too and getting rid of the last remnants of bytecode_libdir.

llvm-svn: 18880
2004-12-13 07:38:07 +00:00
Reid Spencer
65086be55f Implement a new feature, BYTECODE_DESTINATION, to allow a user makefile to
specify where the bytecode library is to be installed. This allows the
default location ($prefix/lib) to be overridden, for special case runtime
libraries like the cfe runtime libs.

llvm-svn: 18879
2004-12-13 07:28:21 +00:00
Reid Spencer
0230a5eead * Add a std::ostream inserter for sys::Path
* Correct the std::string constructor to take a const reference.

llvm-svn: 18877
2004-12-13 06:57:15 +00:00
Jeff Cohen
ccd99b9b61 Fix recent breakage of win32 build
llvm-svn: 18876
2004-12-13 06:26:35 +00:00
Reid Spencer
85d55ad803 Make sure the archive doesn't have to exist before we remove it.
llvm-svn: 18873
2004-12-13 03:59:35 +00:00
Reid Spencer
72bf78d9f5 Always remove bytecode archives so that path mismatches don't cause the
contents to not be updated.

llvm-svn: 18872
2004-12-13 03:56:42 +00:00
Reid Spencer
92e97620be * Fix header block.
* Fix loop style per standards
* Don't create a new Module when the Linker's module is released.
* Add/fix function comments.

llvm-svn: 18871
2004-12-13 03:50:50 +00:00
Reid Spencer
bf63444a41 Add missing space in a comment.
llvm-svn: 18870
2004-12-13 03:23:13 +00:00
Reid Spencer
ac9fe82875 Make sure the Archive gets deleted if there's an error.
llvm-svn: 18869
2004-12-13 03:22:31 +00:00
Reid Spencer
22b7eac855 Remove commented out functions that have been replaced with lib/System
functionality.

llvm-svn: 18868
2004-12-13 03:15:47 +00:00
Reid Spencer
0005214558 Fix header and function comments.
llvm-svn: 18867
2004-12-13 03:13:18 +00:00
Reid Spencer
0a0d582719 Implement new functions per new interface
llvm-svn: 18866
2004-12-13 03:03:42 +00:00
Reid Spencer
17e7444a61 PR351: \
Use sys::Path not FileUtilities to check file types

llvm-svn: 18865
2004-12-13 03:01:26 +00:00
Reid Spencer
8d206908d8 Convert to use new Linker class interface
llvm-svn: 18864
2004-12-13 03:01:14 +00:00
Reid Spencer
0ebb926c0a LinkModules is now in the Linker class
llvm-svn: 18863
2004-12-13 03:01:03 +00:00
Reid Spencer
9b155dc4c0 For PR351: \
* Remove IsLibrary and GetLibraryPath, replaced by FindLibrary in ../Path.cpp \
* Implement GetSystemLibraryPaths and GetBytecodeLibraryPaths, instead of the \
  GetSystemLibraryPath1 and GetSystemLibraryPath2 methods

llvm-svn: 18862
2004-12-13 03:00:51 +00:00
Reid Spencer
66b8182866 For PR351: \
* Move generic isArchive method here from Unix/Path.cpp \
* Implement isDynamicLibrary \
* Implement FindLibrary for Linker

llvm-svn: 18861
2004-12-13 03:00:39 +00:00
Reid Spencer
4a23d3f8e5 This file contains basic Linker facilities needed by all tools
llvm-svn: 18860
2004-12-13 03:00:28 +00:00
Reid Spencer
c4e3153455 Make LinkModules a static member function
llvm-svn: 18859
2004-12-13 03:00:16 +00:00
Reid Spencer
9a5613962f This file contains only the Linker's library linking support
llvm-svn: 18858
2004-12-13 03:00:04 +00:00
Reid Spencer
ebd3d9f8fc For PR351: \
* Remove redundant static function LinkOneLibrary. \
* Remove unneded #includes \
* Convert FileSupport usage to sys::Path instead

llvm-svn: 18857
2004-12-13 02:59:52 +00:00
Reid Spencer
9ce11c3929 This file contains only the Linker's file linking support
llvm-svn: 18856
2004-12-13 02:59:41 +00:00
Reid Spencer
fe73bfcfdb For PR351: \
* Convert functions to Linker:: methods. \
* Remove unneeded #includes \
* Utilize sys::Path utilities not FileSupport utilities \
* Move File & Library linking functions to other source files

llvm-svn: 18855
2004-12-13 02:59:29 +00:00
Reid Spencer
3aa1f3ca4f For PR351: \
* Get file information from a MappedFile instance \
* Convert file type tests to sys::Path form

llvm-svn: 18854
2004-12-13 02:59:15 +00:00
Reid Spencer
a204547e32 Implement error handling in OpenAndLoad* functions so the Linker can handle it.
llvm-svn: 18853
2004-12-13 02:59:03 +00:00
Reid Spencer
35f16dd40b Make the size() method const
llvm-svn: 18852
2004-12-13 02:58:51 +00:00
Reid Spencer
15681d988e For PR351:\
* Modify file reading to use sys::MappedFile \
* Use sys::Path instead of std::string

llvm-svn: 18851
2004-12-13 02:58:40 +00:00
Reid Spencer
75bf03389f Add LLVMGCCDIR for path lookup
llvm-svn: 18850
2004-12-13 02:58:28 +00:00
Reid Spencer
1caba396c4 Make the OpenAndLoad functions have an ErrorMessage argument.
llvm-svn: 18849
2004-12-13 02:58:16 +00:00
Reid Spencer
2ba6854903 Completely rewrite the interface to be class based
llvm-svn: 18848
2004-12-13 02:58:05 +00:00
Reid Spencer
35105469c5 For PR351:\
* Consolidate path retrieval into just two methods. \
* Add FindLibrary as a convenience function. \
* Add isDynamicLibrary for testing for dynamic libs. \
* Make toString constant and reference clean.

llvm-svn: 18847
2004-12-13 02:57:53 +00:00
Reid Spencer
21d9ef9e82 For PR351:Remove the file type checking methods (now in sys::Path)
llvm-svn: 18846
2004-12-13 02:57:41 +00:00
Reid Spencer
ec8bc9157d Get LLVMGCCDIR into the #defines
llvm-svn: 18845
2004-12-13 02:16:51 +00:00
Brian Gaeke
cf2c1866cb Add V8 SPEC status.
llvm-svn: 18844
2004-12-13 00:27:35 +00:00
Chris Lattner
a199e3c1e2 Change indentation of a whole bunch of code, no real changes here.
llvm-svn: 18843
2004-12-12 23:49:37 +00:00
Chris Lattner
14d07db44d More substantial simplifications and speedups. This makes ADCE about 20% faster
in some cases.

llvm-svn: 18842
2004-12-12 23:40:17 +00:00
Chris Lattner
9115eb3024 More minor microoptimizations
llvm-svn: 18841
2004-12-12 22:44:30 +00:00
Chris Lattner
d4298781c1 Remove some more set operations
llvm-svn: 18840
2004-12-12 22:22:18 +00:00
Chris Lattner
a538439bf0 Reduce number of set operations.
llvm-svn: 18839
2004-12-12 22:16:13 +00:00
Chris Lattner
bf5b7cf638 Optimize div/rem + select combinations more.
In particular, implement div.ll:test10 and rem.ll:test4.

llvm-svn: 18838
2004-12-12 21:48:58 +00:00
Chris Lattner
9803a0a575 Add testcases for simple things we can handle that occur now in vortex.
llvm-svn: 18837
2004-12-12 21:40:22 +00:00
Chris Lattner
360cda5ffd Dejagnu doesn't work if you do TESTSUITE=.../
You can't pass the trailing / into Dejagnu, so make the makefile strip it off

llvm-svn: 18836
2004-12-12 21:39:49 +00:00
Chris Lattner
cbd47631ea Fix Regression/CodeGen/PowerPC/2004-12-12-ZeroSizeCommon.ll, and all programs
when compiled with debug information.

llvm-svn: 18835
2004-12-12 20:36:19 +00:00
Chris Lattner
a0dffecfbc New testcase that the PPC backend miscompiles. It is emitting
.comm _X,0

For X, which makes the linker thing that X is never defined.

llvm-svn: 18834
2004-12-12 20:34:06 +00:00
Chris Lattner
10b637eade CSE calls to getTypeSize.
llvm-svn: 18833
2004-12-12 20:31:00 +00:00
Chris Lattner
745196a5fc Properly implement copying of a global, fixing the 255.vortex & povray
failures from last night.

llvm-svn: 18832
2004-12-12 19:34:41 +00:00
Chris Lattner
88deefa303 Simplify code and do not invalidate iterators.
This fixes a crash compiling TimberWolfMC that was exposed due to recent
optimizer changes.

llvm-svn: 18831
2004-12-12 18:23:20 +00:00
Chris Lattner
17550c456c Use the target triple to pick this target.
llvm-svn: 18830
2004-12-12 17:40:28 +00:00
Chris Lattner
1adea147ba Get rid of subbullets for all of the "known problems" section. None of the
other sections have subbullets, and it make the TOC look like the whole
document is known problems!

llvm-svn: 18829
2004-12-12 17:20:23 +00:00
Brian Gaeke
23b2bc54b0 Complete the list of MultiSource failures.
llvm-svn: 18826
2004-12-12 08:22:11 +00:00
Chris Lattner
b92fd6006c Do not internalize a module if -link-as-library is passed.
llvm-svn: 18825
2004-12-12 07:53:51 +00:00
Brian Gaeke
ed9346820d hbd should be working now.
llvm-svn: 18824
2004-12-12 07:42:59 +00:00
Brian Gaeke
27358a44d1 Finally enable the setcc-branch folding code.
Also, fix a bug where ubyte 255 would sometimes be output as -1. This
was afflicting hbd.

llvm-svn: 18823
2004-12-12 07:42:58 +00:00
Brian Gaeke
e5351ad5f0 Add (currently disabled) code for canFoldSetCC
llvm-svn: 18820
2004-12-12 06:22:30 +00:00
Chris Lattner
1cbd5be7a1 Though the previous xform applies to literally dozens (hundreds?) of variables
in SPEC, the subsequent optimziations that we are after don't play with
with FP values, so disable this xform for them.  Really we just don't want
stuff like:

double G;   (always 0 or 412312.312)
  = G;

turning into:

bool G_b;
  = G_b ? 412312.312 : 0;

We'd rather just do the load.

-Chris

llvm-svn: 18819
2004-12-12 06:03:06 +00:00
Brian Gaeke
aa40b7d080 Add stubs for setcc-branch folding support.
llvm-svn: 18818
2004-12-12 06:01:26 +00:00
Chris Lattner
40e4cec9ee If a variable can only hold two values, and is not already a bool, shrink it
down to actually BE a bool.  This allows simple value range propagation
stuff work harder, deleting comparisons in bzip2 in some hot loops.

This implements GlobalOpt/integer-bool.ll, which is the essence of the
loop condition distilled into a testcase.

llvm-svn: 18817
2004-12-12 05:53:50 +00:00
Chris Lattner
17fbc80f31 New testcase. Shrinking the variable to a bool allows instcombine to delete
the condition.

llvm-svn: 18816
2004-12-12 05:52:12 +00:00
Chris Lattner
cbc0161d1f If one side of and/or is known to be 0/-1, it doesn't matter
if the other side is overdefined.

This allows us to fold conditions like:  if (X < Y || Y > Z) in some cases.

llvm-svn: 18807
2004-12-11 23:15:19 +00:00
Chris Lattner
2c14b32e2b New testcase. If one side of and/or is known to be 0/-1, it doesn't matter
if the other side is overdefined.

llvm-svn: 18806
2004-12-11 23:14:40 +00:00
Brian Gaeke
25ac83565e Print llvm code one function at a time.
llvm-svn: 18805
2004-12-11 22:17:07 +00:00
Chris Lattner
8d0b1b2a82 Check in the file I forgot last night, to solve all of the crashes in every
test in the suite.  :(

llvm-svn: 18804
2004-12-11 22:10:29 +00:00
Brian Gaeke
72daaa46eb JIT should print LLVM each function before selecting instructions for it.
llvm-svn: 18803
2004-12-11 18:41:09 +00:00
Reid Spencer
5625dec232 Rename Path::get -> Path::toString
llvm-svn: 18802
2004-12-11 17:37:01 +00:00
Chris Lattner
cc6037f8e6 Update test
llvm-svn: 18801
2004-12-11 17:13:19 +00:00
Chris Lattner
263b0a1669 Only cound if we actually made a change.
llvm-svn: 18800
2004-12-11 17:00:14 +00:00
Chris Lattner
ffefea0772 The split bb is really the exit of the old function
llvm-svn: 18799
2004-12-11 16:59:54 +00:00
Reid Spencer
8f72ce0fd2 A little cleanup on this file.
llvm-svn: 18798
2004-12-11 07:16:54 +00:00
Chris Lattner
7bf2e54dc2 New feature
llvm-svn: 18797
2004-12-11 06:10:52 +00:00
Chris Lattner
2f687fd9d6 Two bug fixes:
1. Actually increment the Statistic for the GV elim optzn
 2. When resolving undef branches, only resolve branches in executable blocks,
    avoiding marking a bunch of completely dead blocks live.  This has a big
    impact on the quality of the generated code.

With this patch, we positively rip up vortex, compiling Ut_MoveBytes to a
single memcpy call. In vortex we get this:

     12 ipsccp           - Number of globals found to be constant
    986 ipsccp           - Number of arguments constant propagated
   1378 ipsccp           - Number of basic blocks unreachable
   8919 ipsccp           - Number of instructions removed

llvm-svn: 18796
2004-12-11 06:05:53 +00:00
Chris Lattner
8525ebe465 Do not delete the entry block to a function.
llvm-svn: 18795
2004-12-11 05:32:19 +00:00
Brian Gaeke
b3095dd88f Bools are *also* not ints. Sigh. Furthermore, most of the TargetMachine
ctor parameters can be defaulted.

Print the transformed llvm code input to the instruction selector
when -print-machineinstrs is on, just like V9.

llvm-svn: 18794
2004-12-11 05:19:04 +00:00
Brian Gaeke
ba5e9f107c Look for many more moves to fold (previously, we only
*or g0, x      add g0, x          recognized * as a move)
 or  x, g0     add  x, g0
 or  0, x      add  0, x
 or  x, 0      add  x, 0

llvm-svn: 18793
2004-12-11 05:19:03 +00:00
Brian Gaeke
52a9ed63b5 Make GEPs not suck so much:
* Don't emit the Index * ElementSize multiply if Index is a constant.
* Use a shift, not a multiply, if ElementSize is 1/2/4/8.
* If ElementSize fits in the immediate field of SMUL, then put it there.

Fix a bug where struct offsets might be truncated (ConstantSInt::get is
now used instead of ConstantInt::get).

llvm-svn: 18792
2004-12-11 05:19:02 +00:00
Brian Gaeke
cba3135ba8 Update lists of failing benchmarks, including info on which
ones are failing in cbe.

llvm-svn: 18791
2004-12-11 05:19:01 +00:00
Chris Lattner
91dbae6fee Implement Transforms/SCCP/ipsccp-gvar.ll, by tracking values stored to
non-address-taken global variables.

llvm-svn: 18790
2004-12-11 05:15:59 +00:00
Chris Lattner
01bd4624c4 New testcase that ipsccp should handle.
llvm-svn: 18789
2004-12-11 05:14:55 +00:00
Reid Spencer
a179968c4e Fix some minor spellos and grammaros.
llvm-svn: 18788
2004-12-11 05:12:57 +00:00
Reid Spencer
d58e09a275 Revert the last patch. We really do need SimplyCFG.
llvm-svn: 18787
2004-12-11 03:03:54 +00:00
Chris Lattner
99e1295645 Fix a bug where we could delete dead invoke instructions with uses.
In functions where we fully constant prop the return value, replace all
ret instructions with 'ret undef'.

llvm-svn: 18786
2004-12-11 02:53:57 +00:00
Reid Spencer
5ccfd5a48b Path::get -> Path::toString
llvm-svn: 18785
2004-12-11 00:14:15 +00:00
Reid Spencer
eef4420578 Remove this pass as its no longer needed.
llvm-svn: 18783
2004-12-10 22:55:35 +00:00
Chris Lattner
dea2bde08f This pass is no longer needed.
llvm-svn: 18782
2004-12-10 22:30:32 +00:00
Chris Lattner
bae4b64553 Implement SCCP/ipsccp-conditional.ll, by totally deleting dead blocks.
llvm-svn: 18781
2004-12-10 22:29:08 +00:00
Chris Lattner
f92cc45975 New testcase
llvm-svn: 18780
2004-12-10 22:28:49 +00:00
Reid Spencer
2da81ceb3d Get rid of warning from flex.
llvm-svn: 18779
2004-12-10 21:59:47 +00:00
Chris Lattner
7285f43836 Fix SCCP/2004-12-10-UndefBranchBug.ll
llvm-svn: 18776
2004-12-10 20:41:50 +00:00
Chris Lattner
45c6251140 Add missing accessor.
llvm-svn: 18775
2004-12-10 20:35:47 +00:00
Chris Lattner
b7f5916e01 Make sure to link the target-triple as well, so it ends up in the .llvm.bc file
llvm-svn: 18774
2004-12-10 20:26:15 +00:00
Chris Lattner
9e8141fb3e New testcase that SCCP miscompiles. Luckily this is extremely unlikely to
happen in practice, but IP-SCCP can trigger it.

llvm-svn: 18773
2004-12-10 20:10:23 +00:00
Reid Spencer
993b95e796 Fix output for Flexing to not print full path of source.
llvm-svn: 18769
2004-12-10 19:44:16 +00:00
Chris Lattner
f13b7ee8aa Check in the right test
llvm-svn: 18767
2004-12-10 17:43:43 +00:00
Chris Lattner
4fc998da2e Fix Regression/Transforms/SimplifyCFG/2004-12-10-SimplifyCFGCrash.ll,
and the failure on make_dparser last night.

llvm-svn: 18766
2004-12-10 17:42:31 +00:00
Chris Lattner
88bd77c73d New testcase for a bug exposed by the ipsccp pass, causing dparser to fail
last night.

llvm-svn: 18765
2004-12-10 17:41:43 +00:00
Chris Lattner
7c0241ce9b Fix typo
llvm-svn: 18764
2004-12-10 16:27:34 +00:00
John Criswell
dfe6a86b0b Merged in RELEASE_14 changes.
llvm-svn: 18763
2004-12-10 15:51:16 +00:00
Brian Gaeke
2e2f3e26ba Move -lowerselect later in the chain; some select instructions were
slipping through into the instruction selector, which can't deal with
them yet.

llvm-svn: 18758
2004-12-10 08:39:30 +00:00
Brian Gaeke
2ccff7c256 Add the rest of the multiply instructions.
llvm-svn: 18757
2004-12-10 08:39:29 +00:00
Brian Gaeke
4bfd3f7c98 Support binary operations with immediates for <= cInt.
llvm-svn: 18756
2004-12-10 08:39:28 +00:00
Brian Gaeke
428037be05 Update lists of failing benchmarks (except C++...something is the
matter with my sparcv8 libstdc++.a) and to-do list.

llvm-svn: 18755
2004-12-10 08:39:27 +00:00
Chris Lattner
4a03a2d433 Turn on ipsccp by default instead of simple IPCP
llvm-svn: 18753
2004-12-10 08:03:43 +00:00
Chris Lattner
b439464c61 This is the initial implementation of IPSCCP, as requested by Brian.
This implements SCCP/ipsccp-basic.ll, rips apart Olden/mst (as described in
PR415), and does other nice things.

There is still more to come with this, but it's a start.

llvm-svn: 18752
2004-12-10 08:02:06 +00:00
Chris Lattner
3b33c7a3c6 New prototype
llvm-svn: 18751
2004-12-10 07:55:01 +00:00
Chris Lattner
c2965a6d0e New testcase
llvm-svn: 18750
2004-12-10 07:54:51 +00:00
Brian Gaeke
81c7fd2fce Emit correct prototype for __builtin_alloca on V8.
llvm-svn: 18745
2004-12-10 05:44:45 +00:00
Alkis Evlogimenos
991d6ad208 Fix writer to properly quote label names when they don't contain
simple characters.

llvm-svn: 18744
2004-12-10 05:41:10 +00:00
Alkis Evlogimenos
a93b4520a7 Do not allow empty label names.
llvm-svn: 18743
2004-12-10 05:40:19 +00:00
Alkis Evlogimenos
5b9754bd48 Update testcase
llvm-svn: 18742
2004-12-10 05:39:57 +00:00
Chris Lattner
fcec9d6dec Implement test/Feature/escaped_label.ll
llvm-svn: 18741
2004-12-10 05:27:29 +00:00
Chris Lattner
dfabbb29f2 Simple testcase for quoted label.
llvm-svn: 18740
2004-12-10 05:27:14 +00:00
Brian Gaeke
af10b76b6c Link V8 backend into llc.
llvm-svn: 18739
2004-12-10 05:04:13 +00:00
Brian Gaeke
836727ea84 Add SparcV8 target back into the build
llvm-svn: 18738
2004-12-10 04:54:21 +00:00
Brian Gaeke
1d0fe16906 Adjust paths: Sparc/V8 --> SparcV8
llvm-svn: 18737
2004-12-10 04:48:57 +00:00
Brian Gaeke
a14476c9bf Make this file self-contained.
llvm-svn: 18736
2004-12-10 04:46:30 +00:00
Brian Gaeke
cb3b98586d Update list of failing MultiSource benchmarks. It works out to +5 -5, but I
think some of these might be the CFE's fault; a rebuild should come soon.

llvm-svn: 18735
2004-12-10 04:42:46 +00:00
Brian Gaeke
5183f22a64 When FpMOVDs appeared in pairs, we were mistakenly skipping over the latter of
each pair. I think this fixes that.

One of these days, I swear I'm going to get the hang of C++ iterators.
Really.

llvm-svn: 18734
2004-12-10 04:42:45 +00:00
Misha Brukman
61cf9c8811 Missed moving bugpoint link over to CommandGuide/html/
llvm-svn: 18732
2004-12-09 23:28:09 +00:00
Misha Brukman
4f1f92e323 Generated HTML documentation is now back in CommandGuide/html/
llvm-svn: 18731
2004-12-09 23:25:59 +00:00
Chris Lattner
f3a7c24617 Rip out the guts of this document to prepare it for LLVM 1.5 progress
llvm-svn: 18726
2004-12-09 22:22:58 +00:00
Chris Lattner
0793bfc457 Clean up this man page
llvm-svn: 18724
2004-12-09 21:16:40 +00:00
Chris Lattner
6e8183063f Add new pseudo target
llvm-svn: 18723
2004-12-09 21:06:32 +00:00
Misha Brukman
32f139a169 The textual description is gone from this manpage, only the options and a quick
summary remain.  The manpage references Bugpoint.html as the repository for more
detailed info.

llvm-svn: 18722
2004-12-09 20:28:42 +00:00
Misha Brukman
cda6a9b9eb * Straighten a comment to a single line
* Block off the section correctly with <!-- ***** -->

llvm-svn: 18721
2004-12-09 20:27:37 +00:00
Misha Brukman
f4315374aa We now have a real Bugpoint doc, not just a huge man page.
llvm-svn: 18720
2004-12-09 20:26:53 +00:00
Misha Brukman
a078d57848 Convert from being a copy of the man page to a full-fledged document.
This doc keeps all the descriptive info from the man page, but not the options.

llvm-svn: 18719
2004-12-09 20:26:20 +00:00
Brian Gaeke
34f7c3d37a We're continuing to make progress on MultiSource.
llvm-svn: 18714
2004-12-09 18:54:31 +00:00
Brian Gaeke
847c05deef Bytes and shorts are aligned differently from words.
llvm-svn: 18713
2004-12-09 18:51:02 +00:00
Brian Gaeke
bac69b7df9 Fix asm-printing directives (how did we not see this before...apparently,
everything was an int!)

llvm-svn: 18712
2004-12-09 18:51:01 +00:00
Reid Spencer
641f5c9878 More grammaro's fixed.
llvm-svn: 18708
2004-12-09 18:13:12 +00:00
Reid Spencer
8f08d805d4 Clean up some grammaro's.
llvm-svn: 18705
2004-12-09 18:02:53 +00:00
Reid Spencer
098fce4727 Correct the version numbers for automake, Perl, and CVS.
llvm-svn: 18703
2004-12-09 17:55:37 +00:00
Chris Lattner
74d3f82b6e Fully document the LLVM constants. This should go into LLVM 1.4
llvm-svn: 18701
2004-12-09 17:30:23 +00:00
Chris Lattner
d79749a110 Reflow and clean up some of the HTML in the initial section, split linkage
types into its own section.

llvm-svn: 18697
2004-12-09 16:36:40 +00:00
Chris Lattner
6af02f3961 Move the "High Level Structure" to before "Type System"
llvm-svn: 18695
2004-12-09 16:11:40 +00:00
Reid Spencer
09e39d17d1 More QMTest cruft gone!
llvm-svn: 18694
2004-12-09 07:43:06 +00:00
Chris Lattner
36d39cecb4 note to self: Do not check in debugging code!
llvm-svn: 18693
2004-12-09 07:15:52 +00:00
Chris Lattner
f17a2fb849 Implement trivial sinking for load instructions. This causes us to sink 567 loads in spec
llvm-svn: 18692
2004-12-09 07:14:34 +00:00
Chris Lattner
6225146f20 Remove a dead field, make the map go to integer type ID to hash better and
avoid a getType.

llvm-svn: 18691
2004-12-09 06:19:44 +00:00
Jeff Cohen
07a900f0b7 Fix residual Visual Studio build problems
llvm-svn: 18688
2004-12-09 05:51:11 +00:00
Test Commit
ecf3c41054 Test commit
llvm-svn: 18687
2004-12-09 05:46:48 +00:00
Chris Lattner
2cdf54c0f0 Remove #include inadvertently added
llvm-svn: 18686
2004-12-09 04:53:17 +00:00
Chris Lattner
e44907012a Eliminate this ugly hack. This was put back in when replaceAllUsesOf used
a different algorithm that was extremely inefficient for instructions with
many operands.

This reduces the time of this code snippet from .23s for 176.gcc to 0.03s
in a debug build, which speeds up total llvm-dis time just barely.

It's more of a code cleanup than a speedup.

llvm-svn: 18685
2004-12-09 04:51:50 +00:00
Alkis Evlogimenos
346ee4c9fb Add testcase and fix for yet another case where we query the size an
abstract type.

llvm-svn: 18678
2004-12-08 23:56:15 +00:00
Chris Lattner
39c98bb31c Do extremely simple sinking of instructions when they are only used in a
successor block.  This turns cases like this:

x = a op b
if (c) {
  use x
}

into:

if (c) {
  x = a op b
  use x
}

This triggers 3965 times in spec, and is tested by
Regression/Transforms/InstCombine/sink_instruction.ll

This appears to expose a bug in the X86 backend for 177.mesa, which I'm
looking in to.

llvm-svn: 18677
2004-12-08 23:43:58 +00:00
Alkis Evlogimenos
b1ff6d7921 Add testcase and fix for another case where we query the size an
abstract type.

llvm-svn: 18676
2004-12-08 23:42:11 +00:00
Chris Lattner
8665367885 new testcase
llvm-svn: 18675
2004-12-08 23:41:16 +00:00
Alkis Evlogimenos
a1291a0679 Fix this regression and remove the XFAIL from this test.
llvm-svn: 18674
2004-12-08 23:10:30 +00:00
Reid Spencer
ca06c8e851 Remove last remnants of Python/QMTest support
llvm-svn: 18672
2004-12-08 23:07:27 +00:00
Reid Spencer
4e197480e1 Implement the LLVM_DO_NOT_BUILD feature. If a file of that name is
present in a directory that LLVM normally builds, it will skip building
the directory entirely. This is useful for allowing a bunch of projects to
live in the source tree but not be compiled from time to time.

llvm-svn: 18671
2004-12-08 22:58:34 +00:00
Chris Lattner
8f30caf549 Fix Transforms/InstCombine/2004-12-08-RemInfiniteLoop.ll
llvm-svn: 18670
2004-12-08 22:20:34 +00:00
Chris Lattner
ace35e9be6 This testcase causes the instruction combiner to go spiraling into
an infinite loop.

llvm-svn: 18669
2004-12-08 22:18:35 +00:00
Chris Lattner
f14c40dc57 Move method out of line
llvm-svn: 18666
2004-12-08 21:04:10 +00:00
Chris Lattner
5a0680245f Move method out of line for better ICC support
Add some ifdefs for some stuff I like to be able to toggle easily

llvm-svn: 18665
2004-12-08 21:03:56 +00:00
Chris Lattner
8351112192 Properly extern this.
llvm-svn: 18664
2004-12-08 21:00:59 +00:00
Chris Lattner
3e4445cd03 Define the pointer hash struct before the string one, to improve compatibility
with ICC.  Patch contributed by Bjørn Wennberg.

llvm-svn: 18663
2004-12-08 20:59:18 +00:00
John Criswell
6430772035 The noreturn GCC extension is now supported.
Fixed some minor typos.

llvm-svn: 18658
2004-12-08 20:35:47 +00:00
Chris Lattner
630729c97e Turn this error back into a warning, fixing the povray regression
llvm-svn: 18655
2004-12-08 20:01:10 +00:00
Chris Lattner
292e6602ac Test commit
llvm-svn: 18654
2004-12-08 19:05:44 +00:00
Reid Spencer
0601d01f43 Build the man and ps versions of the command guide as well when
BUILD_FOR_WEBSITE is set.

llvm-svn: 18653
2004-12-08 19:01:01 +00:00
Chris Lattner
923737fcff ignore generated file
llvm-svn: 18652
2004-12-08 19:00:45 +00:00
Alkis Evlogimenos
84d060ae7a Mark this as an XFAIL until a fix is worked out.
llvm-svn: 18651
2004-12-08 18:43:39 +00:00
Tanya Lattner
0e6622157a Fixed broken link to Bruce Eckle's book.
llvm-svn: 18650
2004-12-08 18:34:56 +00:00
Tanya Lattner
7591b82df6 Fixed a broken link to gcc manual.
llvm-svn: 18649
2004-12-08 18:29:38 +00:00
Tanya Lattner
6337134822 Fixed broken link.
llvm-svn: 18648
2004-12-08 18:25:34 +00:00
Tanya Lattner
9d2df71d38 Fixed broken links.
llvm-svn: 18647
2004-12-08 18:13:51 +00:00
John Criswell
945f80273f Mention in the exposition that lli can JIT on PowerPC now.
llvm-svn: 18646
2004-12-08 18:04:14 +00:00
John Criswell
ba739a8e56 We don't have python test classes anymore.
llvm-svn: 18645
2004-12-08 18:01:27 +00:00
Reid Spencer
92815e5483 Add llvm-ld tool
Note that both llvmc and llvm-ld are experimental in 1.4

llvm-svn: 18644
2004-12-08 18:00:30 +00:00
John Criswell
6ab273c032 Minor fixups.
llvm-svn: 18643
2004-12-08 17:53:54 +00:00
Tanya Lattner
d8697049e3 Fixed typo in Dejagnu section.
llvm-svn: 18642
2004-12-08 17:37:21 +00:00
Tanya Lattner
9a1b8935d6 Removed QMTest reference.
llvm-svn: 18641
2004-12-08 17:35:31 +00:00
Tanya Lattner
e6ebbd70ca Removed QMTest reference.
llvm-svn: 18640
2004-12-08 17:25:46 +00:00
Tanya Lattner
c31724bfe2 Removed QMTest referrences. Updated ordering of notes.
llvm-svn: 18639
2004-12-08 17:12:52 +00:00
John Criswell
33e0f06258 Fix spell'os.
llvm-svn: 18638
2004-12-08 16:55:27 +00:00
Reid Spencer
cce6755360 Move documentation for various configuration options applicabe only to the
llvm-test directory into this document from GettingStarted.html.

llvm-svn: 18637
2004-12-08 16:52:51 +00:00
Reid Spencer
dfcf790d28 Various 1.4ish corrections and additions.
llvm-svn: 18636
2004-12-08 16:51:31 +00:00
John Criswell
c8808f57dc Update the version numbers of the pre-built LLVM GCC frontends.
llvm-svn: 18635
2004-12-08 16:47:14 +00:00
John Criswell
241011e6b0 Fix llvmgcc to use the TestRunner substition mechanism.
llvm-svn: 18634
2004-12-08 16:41:34 +00:00
John Criswell
02fa673e6f xfail this across all platforms.
llvm-svn: 18633
2004-12-08 16:31:06 +00:00
Reid Spencer
3991dce79e * Change version numbers of tarballs from 1.3 to 1.4
* Add llvm-test-1.4.tar.gz as the tarball for the llvm-test module
* Highlight the tarball name a little.

llvm-svn: 18632
2004-12-08 16:25:25 +00:00
Chris Lattner
1c539a86c9 Work correctly with MSVC and ICC, patch contributed by Bjørn Wennberg
llvm-svn: 18631
2004-12-08 16:22:48 +00:00
Chris Lattner
d349d4a49c Work correctly with ICC, Patch contributed by Bjørn Wennberg
llvm-svn: 18630
2004-12-08 16:22:26 +00:00
Reid Spencer
5be4f0490f Add descriptions of missing top level directories.
llvm-svn: 18629
2004-12-08 16:18:26 +00:00
Chris Lattner
4270bcbab7 Add support for compilers with arg dependent name lookup, contributed by
Bjørn Wennberg

llvm-svn: 18628
2004-12-08 16:13:53 +00:00
Chris Lattner
674ce86cd0 Add support for compilers without argument dependent name lookup, contributed
by Bjørn Wennberg

llvm-svn: 18627
2004-12-08 16:12:20 +00:00
Chris Lattner
6ef473f53c Make this work with the ICC compiler, contributed by Bjørn Wennberg
llvm-svn: 18626
2004-12-08 16:10:52 +00:00
Chris Lattner
407000c497 Remove unneeded class qualifier, contributed by Bjørn Wennberg
llvm-svn: 18625
2004-12-08 16:05:02 +00:00
Alkis Evlogimenos
148215f758 Add regression
llvm-svn: 18624
2004-12-08 07:25:10 +00:00
Reid Spencer
359df30f3d When -link-as-library, add -l options to Module's deplibs
llvm-svn: 18617
2004-12-08 05:17:40 +00:00
Reid Spencer
8f59e90cef Make an alternate version of this Makefile that can be used in an
unconfigured tree for rebuilding the html files from POD sources for the
website update on cvs commit.

llvm-svn: 18616
2004-12-08 04:43:40 +00:00
Reid Spencer
cd7d6cf6a6 Remove -Woverloaded-virtual usage that was committed by accident.
llvm-svn: 18615
2004-12-08 04:34:51 +00:00
Reid Spencer
cc52c2ce8a Remove variables that are not used by any of the LLVM makefiles
llvm-svn: 18614
2004-12-08 04:26:23 +00:00
Reid Spencer
6838b3c245 Remove useless -L switch now that gccld -link-as-library bug is fixed.
llvm-svn: 18613
2004-12-08 04:22:47 +00:00
Alkis Evlogimenos
ca6a649c9d Use getOperand() and remove getElementAt() function.
llvm-svn: 18612
2004-12-08 03:45:20 +00:00
Chris Lattner
db38fe94ae Revert this disgusting hack, John has a much nicer solution
llvm-svn: 18611
2004-12-08 03:31:14 +00:00
Chris Lattner
79a993ea0d Add a disgusting hack to work around a libstdc++ issue. This code should
be removed when PR400 is resolved.

llvm-svn: 18610
2004-12-08 03:28:51 +00:00
Chris Lattner
040c3868b3 This test is xfail right now, to keep DJ clean, also mention the PR# in testcases.
llvm-svn: 18609
2004-12-08 02:25:32 +00:00
Reid Spencer
55684c3b26 * Eliminate redundancies
* Fix grammaro's
* HTML 4.01 Strict compliance

llvm-svn: 18604
2004-12-07 08:39:08 +00:00
Reid Spencer
9273d480ad For PR387:\
Add doInitialization method to avoid overloaded virtuals

llvm-svn: 18602
2004-12-07 08:11:36 +00:00
Reid Spencer
5c132bc3af For PR387:\
Add getModRefInfo method to avoid overloaded virtuals

llvm-svn: 18601
2004-12-07 08:11:24 +00:00
Reid Spencer
c332610d52 For PR387:\
Add runPass methods to remove -Woverloaded-virtual warnings are not \
present and circumvent possible inheritance bugs.

llvm-svn: 18600
2004-12-07 08:11:11 +00:00
Chris Lattner
b5bb597405 Commit the cleanup of the LLVM 1.4 release notes. This should clearly go
into the release :)

llvm-svn: 18599
2004-12-07 08:04:13 +00:00
Reid Spencer
b95f8ab3ef Revert the recent patches to "fix" ConstantFP::isValueValidForType. None
of them seem to work everywhere.

llvm-svn: 18598
2004-12-07 07:38:08 +00:00
Reid Spencer
ae056bdd36 Provide a missing header file.
llvm-svn: 18597
2004-12-07 07:08:08 +00:00
Reid Spencer
744d95e8c7 Fix some comments.
llvm-svn: 18596
2004-12-07 07:06:47 +00:00
Alkis Evlogimenos
2b91842092 Fix check for valid floats. Also use and HUGE_VALF instead
of std::numeric_limits, because they work in more platforms.

llvm-svn: 18593
2004-12-07 06:46:50 +00:00
Nate Begeman
784a0dcbd0 Move virtual function call out of loop to speed up getFreePhysReg by about
20%, shaving 0.1s off hbd compile time on my g5.  Yay.

llvm-svn: 18592
2004-12-07 05:25:53 +00:00
Reid Spencer
9083936835 For PR387:\
Make only one print method to avoid overloaded virtual warnings when \
compiled with -Woverloaded-virtual

llvm-svn: 18589
2004-12-07 04:03:45 +00:00
Reid Spencer
1c48c2deee For PR387:
Make this compile without warning when -Woverloaded-virtual is used.

llvm-svn: 18588
2004-12-06 23:42:37 +00:00
Reid Spencer
2ea2100e9d PR409 fixed.
llvm-svn: 18586
2004-12-06 22:32:33 +00:00
Reid Spencer
a8288d93ae For PR409: \
Test the range of float constants to ensure we are not attempting to create a \
float constant using a double value that is out of range for a float

llvm-svn: 18585
2004-12-06 22:18:37 +00:00
Reid Spencer
95044d0071 For PR409: \
Make sure to check isValueValidForType on floating point constants and give \
an error if the value is not valid, otherwise it would assert in the VMCore

llvm-svn: 18584
2004-12-06 22:18:25 +00:00
John Criswell
ff845b4f96 This test still fails on Darwin and Sparc/Solaris.
llvm-svn: 18583
2004-12-06 22:05:02 +00:00
Reid Spencer
10afebddcc Test case for PR409:
Make sure that floating point constant values outside the range of a float
cannot be assigned to a constant.

llvm-svn: 18582
2004-12-06 21:57:59 +00:00
John Criswell
b2249635ae Remove the last pieces of QMTest.
llvm-svn: 18581
2004-12-06 21:35:32 +00:00
Reid Spencer
46f5c4f214 Revert previous changes to remove -enable-linscan and the *BETA columns of
the nightly test. These are still needed for iterative linear scan testing.

llvm-svn: 18577
2004-12-06 20:14:45 +00:00
Reid Spencer
ecec7939bc Rather than break all the nightly test invocations, permit -enable-linscan
option to be specified, but do nothing with it.

llvm-svn: 18575
2004-12-06 18:33:54 +00:00
Reid Spencer
1443c4f039 Remove LLC-BETA and linear scan options as they are no longer reported.
llvm-svn: 18574
2004-12-06 18:29:14 +00:00
Reid Spencer
ca1baad120 Change check to check-local per Makefile.rules changes.
llvm-svn: 18568
2004-12-06 05:35:38 +00:00
Reid Spencer
3f5ed7b1f7 Upgrade documentation to reflect Makefile.rules changes.
llvm-svn: 18567
2004-12-06 05:35:25 +00:00
Reid Spencer
8b5ebe561e Add the check target so all projects can have this
functionality.

llvm-svn: 18566
2004-12-06 05:35:13 +00:00
Reid Spencer
876ae54f63 Remove the check target. Its now in Makefile.rules
llvm-svn: 18565
2004-12-06 05:35:00 +00:00
Tanya Lattner
4d69018fe9 Added DejaGNU information to the testing guide. This should go into the 1.4 release.
I left the QMTest stuff in place but made it appear to be optional.

llvm-svn: 18564
2004-12-06 02:11:52 +00:00
Reid Spencer
ffcf42329a PR139 fixed.
llvm-svn: 18551
2004-12-05 20:19:45 +00:00
Alkis Evlogimenos
75a93f23b3 Add accessors for Constants in a ConstantStruct.
llvm-svn: 18550
2004-12-05 20:09:18 +00:00
Reid Spencer
ef96665753 Fix PR139:\
When not linking as a library, use LinkItems to retain command line order of \
linking, otherwise use LinkFiles

llvm-svn: 18549
2004-12-05 19:15:29 +00:00
Reid Spencer
9f1cf33a54 Make use of the LLVMGCCStdCXXLibDir variable to link objects
llvm-svn: 18548
2004-12-05 19:15:06 +00:00
Reid Spencer
1014afc7ea Fix PR139: \
Implement LinkItems and BuildLinkItems interfaces.

llvm-svn: 18547
2004-12-05 19:14:55 +00:00
1281 changed files with 77769 additions and 52690 deletions

View File

@@ -3,3 +3,4 @@ Makefile.config
config.log
config.status
cvs.out
autom4te.cache

View File

@@ -17,12 +17,7 @@ D: MingW Win32 API portability layer
N: Nate Begeman
E: natebegeman@mac.com
D: Portions of the PowerPC backend
N: Tanya Brethour
E: tonic@nondot.org
W: http://nondot.org/~tonic/
D: The llvm-ar tool
D: Primary PowerPC backend developer
N: Misha Brukman
E: brukman+llvm@uiuc.edu
@@ -39,6 +34,8 @@ E: ccarter@uiuc.edu
D: Fixes to the Reassociation pass, various improvement patches
N: Jeff Cohen
E: jeffc@jolt-lang.org
W: http://jolt-lang.org
D: Native Win32 API portability layer
N: John T. Criswell
@@ -52,7 +49,7 @@ D: Linear scan register allocator, many codegen improvements, Java frontend
N: Brian Gaeke
E: gaeke@uiuc.edu
W: http://www.students.uiuc.edu/~gaeke/
D: Portions of X86 static and JIT compilers.
D: Portions of X86 static and JIT compilers; SparcV8 backend
D: Dynamic trace optimizer
D: FreeBSD/X86 compatibility fixes, the llvm-nm tool
@@ -76,6 +73,22 @@ E: sabre@nondot.org
W: http://nondot.org/~sabre/
D: Primary architect of LLVM
N: Tanya Lattner (formerly Tanya Brethour)
E: tonic@nondot.org
W: http://nondot.org/~tonic/
D: The initial llvm-ar tool, converted regression testsuite to dejagnu
D: Modulo scheduling in the SparcV9 backend
N: Andrew Lenharth
E: alenhar2@cs.uiuc.edu
W: http://www.lenharth.org/~andrewl/
D: Alpha backend
N: Duraid Madina
E: duraid@octopus.com.au
W: http://kinoko.c.u-tokyo.ac.jp/~duraid/
D: IA64 backend
N: Michael McCracken
E: michael.mccracken@gmail.com
D: Line number support for llvmgcc
@@ -105,6 +118,10 @@ E: rspencer@x10sys.com
W: http://llvm.x10sys.com/rspencer
D: Stacker, llvmc, bytecode, other. See web page for current notes.
N: Adam Treat
E: manyoso@yahoo.com
D: C++ bugs filed, and C++ front-end bug fixes.
N: Bill Wendling
E: wendling@isanbard.org
D: The `Lower Setjmp/Longjmp' pass, improvements to the -lowerswitch pass.

View File

@@ -4,7 +4,7 @@ LLVM Release License
University of Illinois/NCSA
Open Source License
Copyright (c) 2003, 2004 University of Illinois at Urbana-Champaign.
Copyright (c) 2003, 2004, 2005 University of Illinois at Urbana-Champaign.
All rights reserved.
Developed by:
@@ -64,9 +64,9 @@ Program Directory
System Library llvm/lib/System
Compiler Driver llvm/tools/llvmc
PowerPC Backend llvm/lib/Target/PowerPC
bzip2: llvm/lib/Support/bzip2/LICENSE
Autoconf: llvm/autoconf
bzip2 llvm/lib/Support/bzip2/LICENSE
Autoconf llvm/autoconf
llvm/projects/ModuleMaker/autoconf
llvm/projects/sample/autoconf
Burg: llvm/utils/Burg
GNU Libc: llvm/runtime/GCCLibraries/libc
Burg llvm/utils/Burg
GNU Libc llvm/runtime/GCCLibraries/libc

View File

@@ -41,7 +41,4 @@ dist-hook::
$(TopDistDir)/include/llvm/Support/DataTypes.h \
$(TopDistDir)/include/llvm/Support/ThreadSupport.h
check :
$(MAKE) -C test check TESTSUITE=$(TESTSUITE)
tools-only: all

View File

@@ -39,25 +39,29 @@
#
# 6. LLVM_SRC_ROOT - If specified, points to the top of the LLVM source tree.
#
# 8. BUILD_SRC_DIR - The directory which contains the current set of Makefiles
# 8. PROJ_SRC_DIR - The directory which contains the current set of Makefiles
# and usually the source code too (unless SourceDir is set).
#
# 9. BUILD_SRC_ROOT - The root directory of the source code being compiled.
# 9. PROJ_SRC_ROOT - The root directory of the source code being compiled.
#
# 10. BUILD_OBJ_DIR - The directory where object code should be placed.
# 10. PROJ_OBJ_DIR - The directory where object code should be placed.
#
# 11. BUILD_OBJ_ROOT - The root directory for where object code should be
# 11. PROJ_OBJ_ROOT - The root directory for where object code should be
# placed.
#
# For building,
# LLVM, LLVM_SRC_ROOT = BUILD_SRC_ROOT
# LLVM, LLVM_SRC_ROOT = PROJ_SRC_ROOT
#
#===-----------------------------------------------------------------------====
#
# Configuration file to set paths specific to local installation of LLVM
#
ifndef LLVM_OBJ_ROOT
include $(LEVEL)/Makefile.config
else
include $(LLVM_OBJ_ROOT)/Makefile.config
endif
#
# Include all of the build rules used for making LLVM

View File

@@ -12,20 +12,84 @@
#
#===------------------------------------------------------------------------===#
# Define LLVM speific info and directories
PACKAGE_NAME := @PACKAGE_NAME@
PACKAGE_VERSION := @PACKAGE_VERSION@
LLVM_PREFIX := @LLVM_PREFIX@
LLVM_BINDIR := @LLVM_BINDIR@
LLVM_LIBDIR := @LLVM_LIBDIR@
LLVM_DATADIR := @LLVM_DATADIR@
LLVM_DOCSDIR := @LLVM_DOCSDIR@
LLVM_ETCDIR := @LLVM_ETCDIR@
LLVM_INCLUDEDIR := @LLVM_INCLUDEDIR@
LLVM_INFODIR := @LLVM_INFODIR@
LLVM_MANDIR := @LLVM_MANDIR@
# Define LLVM specific info and directories based on the autoconf variables
LLVMPackageName := @PACKAGE_NAME@
LLVMVersion := @PACKAGE_VERSION@
LLVM_CONFIGTIME := @LLVM_CONFIGTIME@
LLVM_TARBALL_NAME := @PACKAGE_NAME@-@PACKAGE_VERSION@
###########################################################################
# Directory Configuration
# This section of the Makefile determines what is where. To be
# specific, there are several locations that need to be defined:
#
# o LLVM_SRC_ROOT : The root directory of the LLVM source code.
# o LLVM_OBJ_ROOT : The root directory containing the built LLVM code.
#
# o PROJ_SRC_DIR : The directory containing the code to build.
# o PROJ_SRC_ROOT : The root directory of the code to build.
#
# o PROJ_OBJ_DIR : The directory in which compiled code will be placed.
# o PROJ_OBJ_ROOT : The root directory in which compiled code is placed.
#
###########################################################################
# Set the project name to LLVM if its not defined
ifndef PROJECT_NAME
PROJECT_NAME := LLVM
endif
PROJ_OBJ_DIR := $(shell pwd)
PROJ_OBJ_ROOT := $(subst //,/,$(shell cd $(PROJ_OBJ_DIR)/$(LEVEL); pwd))
ifeq ($(PROJECT_NAME),LLVM)
LLVM_SRC_ROOT := @abs_top_srcdir@
LLVM_OBJ_ROOT := @abs_top_builddir@
PROJ_SRC_ROOT := $(LLVM_SRC_ROOT)
PROJ_SRC_DIR := $(subst //,/,$(LLVM_SRC_ROOT)/$(patsubst $(PROJ_OBJ_ROOT)%,%,$(PROJ_OBJ_DIR)))
PROJ_prefix := @prefix@
PROJ_bindir := @prefix@/bin
PROJ_libdir := @prefix@/lib
PROJ_datadir := @prefix@/share
PROJ_docsdir := @prefix@/docs/llvm
PROJ_etcdir := @prefix@/etc/llvm
PROJ_includedir := @prefix@/include
PROJ_infodir := @prefix@/info
PROJ_mandir := @prefix@/man
PROJ_VERSION := $(LLVMVersion)
else
ifndef PROJ_SRC_ROOT
$(error Projects must define PROJ_SRC_ROOT)
endif
ifndef PROJ_OBJ_ROOT
$(error Projects must define PROJ_OBJ_ROOT)
endif
ifndef PROJ_INSTALL_ROOT
$(error Projects must define PROJ_INSTALL_ROOT)
endif
ifndef LLVM_SRC_ROOT
$(error Projects must define LLVM_SRC_ROOT)
endif
ifndef LLVM_OBJ_ROOT
$(error Projects must define LLVM_OBJ_ROOT)
endif
PROJ_SRC_DIR := $(subst //,/,$(PROJ_SRC_ROOT)/$(patsubst $(PROJ_OBJ_ROOT)%,%,$(PROJ_OBJ_DIR)))
PROJ_prefix := $(PROJ_INSTALL_ROOT)
PROJ_bindir := $(PROJ_INSTALL_ROOT)/bin
PROJ_libdir := $(PROJ_INSTALL_ROOT)/lib
PROJ_datadir := $(PROJ_INSTALL_ROOT)/share
PROJ_docsdir := $(PROJ_INSTALL_ROOT)/docs/llvm
PROJ_etcdir := $(PROJ_INSTALL_ROOT)/etc/llvm
PROJ_includedir := $(PROJ_INSTALL_ROOT)/include
PROJ_infodir := $(PROJ_INSTALL_ROOT)/info
PROJ_mandir := $(PROJ_INSTALL_ROOT)/man
ifndef PROJ_VERSION
PROJ_VERSION := 1.0
endif
endif
# Determine if we're on a unix type operating system
LLVM_ON_UNIX:=@LLVM_ON_UNIX@
LLVM_ON_WIN32:=@LLVM_ON_WIN32@
# Target operating system for which LLVM will be compiled.
OS=@OS@
@@ -36,6 +100,9 @@ ARCH=@ARCH@
# Target triple (cpu-vendor-os) for which we should generate code
TARGET_TRIPLE=@target@
# Targets that we should build
TARGETS_TO_BUILD=@TARGETS_TO_BUILD@
# Endian-ness of the target
ENDIAN=@ENDIAN@
@@ -49,26 +116,20 @@ CC := @CC@
# Linker flags.
LDFLAGS+=@LDFLAGS@
# Libraries needed by tools
TOOLLINKOPTS=@LIBS@
# Path to the library archiver program.
AR_PATH = @AR@
# The pathnames of the programs we require to build
BISON := @BISON@
CMP := @CMP@
CP := @CP@
DATE := @DATE@
FIND := @FIND@
FLEX := @LEX@
GREP := @GREP@
INSTALL := @INSTALL@
INSTALL_SH := $(BUILD_SRC_ROOT)/autoconf/install-sh
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_DATA = @INSTALL_DATA@
MKDIR := @abs_top_srcdir@/autoconf/mkinstalldirs
MKDIR := $(LLVM_SRC_ROOT)/autoconf/mkinstalldirs
MV := @MV@
PAX := @PAX@
RANLIB := @RANLIB@
RM := @RM@
SED := @SED@
@@ -85,30 +146,30 @@ GROFF := @GROFF@
GZIP := @GZIP@
POD2HTML := @POD2HTML@
POD2MAN := @POD2MAN@
PYTHON := @PYTHON@
RUNTEST := @RUNTEST@
TCLSH := @TCLSH@
ZIP := @ZIP@
# Paths to miscellaneous programs we assume are present
RPWD := pwd
ECHO := echo
LIBS := @LIBS@
# Path to location for LLVM C/C++ front-end. You can modify this if you
# want to override the value set by configure.
LLVMGCCDIR := @LLVMGCCDIR@
# Determine the target for which LLVM should generate code.
LLVMGCCARCH := @target@/3.4-llvm
# Full pathnames of LLVM C/C++ front-end 'cc1' and 'cc1plus' binaries:
LCC1 = @LLVMCC1@
LCC1XX = @LLVMCC1PLUS@
LLVMGCC := @LLVMGCC@
LLVMGXX := @LLVMGXX@
LLVMCC1 := @LLVMCC1@
LLVMCC1PLUS := @LLVMCC1PLUS@
# Path to directory where object files should be stored during a build.
# Set OBJ_ROOT to "." if you do not want to use a separate place for
# object files.
OBJ_ROOT := .
# Path to location for LLVM C/C++ front-end. You can modify this if you
# want to override the value set by configure.
LLVMGCCDIR := @LLVMGCCDIR@
# These are options that can either be enabled here, or can be enabled on the
# make command line (ie, make ENABLE_PROFILING=1):
@@ -137,72 +198,5 @@ SHLIBEXT = @SHLIBEXT@
# Executable file extension for this platform.
EXEEXT = @EXEEXT@
###########################################################################
# Directory Configuration
# This section of the Makefile determines what is where. To be
# specific, there are several locations that need to be defined:
#
# o LLVM_SRC_ROOT : The root directory of the LLVM source code.
# o LLVM_OBJ_ROOT : The root directory containing the built LLVM code.
#
# o BUILD_SRC_DIR : The directory containing the code to build.
# o BUILD_SRC_ROOT : The root directory of the code to build.
#
# o BUILD_OBJ_DIR : The directory in which compiled code will be placed.
# o BUILD_OBJ_ROOT : The root directory in which compiled code is placed.
#
###########################################################################
# Set the object build directory. By default, it is the current directory.
ifndef BUILD_OBJ_DIR
BUILD_OBJ_DIR := $(subst //,/,$(shell $(RPWD)))
endif
# Set the root of the object directory.
ifndef BUILD_OBJ_ROOT
BUILD_OBJ_ROOT := $(subst //,/,$(shell cd $(BUILD_OBJ_DIR)/$(LEVEL); $(RPWD)))
endif
# Set the source build directory. That is almost always the current directory.
ifndef BUILD_SRC_DIR
BUILD_SRC_DIR := $(subst //,/,@abs_top_srcdir@/$(patsubst $(BUILD_OBJ_ROOT)%,%,$(BUILD_OBJ_DIR)))
endif
# Set the source root directory.
ifndef BUILD_SRC_ROOT
BUILD_SRC_ROOT := $(subst //,/,@abs_top_srcdir@)
endif
# Set the LLVM object directory.
ifndef LLVM_OBJ_ROOT
ifdef LLVM_SRC_ROOT
LLVM_OBJ_ROOT := $(shell cd $(LLVM_SRC_ROOT); $(RPWD))
else
LLVM_OBJ_ROOT := $(BUILD_OBJ_ROOT)
endif
endif
# Set the LLVM source directory.
# It is typically the root directory of what we're compiling now.
ifndef LLVM_SRC_ROOT
LLVM_SRC_ROOT := $(BUILD_SRC_ROOT)
endif
# Installation directories, as provided by the configure script.
abs_top_srcdir = @abs_top_srcdir@
abs_top_builddir = @abs_top_builddir@
exec_prefix = @exec_prefix@
prefix = @prefix@
program_transform_name = @program_transform_name@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
bytecode_libdir = $(LLVMGCCDIR)/bytecode-libs
includedir = @includedir@
infodir = @infodir@
mandir = @mandir@
# Things we just assume are "there"
ECHO := echo

File diff suppressed because it is too large Load Diff

2
llvm/autoconf/.cvsignore Normal file
View File

@@ -0,0 +1,2 @@
aclocal.m4
autom4te.cache

View File

@@ -3,17 +3,8 @@ die () {
echo "$@" 1>&2
exit 1
}
if test "$1" = --with-automake ; then
outfile=configure_am
configfile=configure.am
with_automake=1
elif test -z "$1" ; then
outfile=configure
configfile=configure.ac
with_automake=0
else
die "Invalid option: $1"
fi
test -d autoconf && test -f autoconf/$configfile && cd autoconf
test -f $configfile || die "Can't find 'autoconf' dir; please cd into it first"
autoconf --version | egrep '2\.59' > /dev/null

View File

@@ -8,20 +8,21 @@ If you are in the mood to upgrade libtool, you must do the following:
3. Copy <SRC>/ltdl.m4 to llvm/autoconf/m4
4. Copy <PFX>/share/aclocal/libtool.m4 to llvm/autoconf/m4/libtool.m4
5. Copy <PFX>/share/libtool/ltmain.sh to llvm/autoconf/ltmain.sh
6. Copy <PFX>/share/libtool/libltdl/ltdl.c to llvm/lib/System
7. Copy <PFX>/share/libtool/libltdl/ltdl.h to llvm/lib/System
8. Adjust the llvm/autoconf/m4/libtool.m4 file to ensure that the variable
6. Run sed -e 's/output.exp/outputname.exp/g' on ltmain.sh
7. Copy <PFX>/share/libtool/libltdl/ltdl.c to llvm/lib/System
8. Copy <PFX>/share/libtool/libltdl/ltdl.h to llvm/lib/System
9. Adjust the llvm/autoconf/m4/libtool.m4 file to ensure that the variable
default_ofile is set to "mklib" instead of "libtool"
9. Run "autoupdate libtool.m4 ltdl.m4" in the llvm/autoconf/m4 directory.
10. Run "autoupdate libtool.m4 ltdl.m4" in the llvm/autoconf/m4 directory.
This should correctly update the macro definitions in the libtool m4
files to match the version of autoconf that LLVM uses. This converts
AC_HELP_STRING to AS_HELP_STRING and AC_TRY_LINK to AC_LINK_IFELSE, amongst
other things. You may need to manually adjust the files.
10. Run AutoRegen.sh to get the new macros into configure script
11. If there are any warnings from configure, go to step 9.
12. Rebuild LLVM, making sure it reconfigured
13. Test the JIT which uses libltdl
14. If it all works, only THEN commit the changes.
11. Run AutoRegen.sh to get the new macros into configure script
12. If there are any warnings from configure, go to step 9.
13. Rebuild LLVM, making sure it reconfigured
14. Test the JIT which uses libltdl
15. If it all works, only THEN commit the changes.
Upgrading autoconf
===============================================================================

View File

@@ -31,11 +31,11 @@ dnl===
dnl===-----------------------------------------------------------------------===
dnl Initialize autoconf and define the package name, version number and
dnl email address for reporting bugs.
AC_INIT([[llvm]],[[1.4]],[llvmbugs@cs.uiuc.edu])
AC_INIT([[llvm]],[[1.5]],[llvmbugs@cs.uiuc.edu])
dnl Provide a copyright substitution and ensure the copyright notice is included
dnl in the output of --version option of the generated configure script.
AC_SUBST(LLVM_COPYRIGHT,["Copyright (c) 2003-2005 U University of Illinois at Urbana-Champaign."])
AC_SUBST(LLVM_COPYRIGHT,["Copyright (c) 2003-2005 University of Illinois at Urbana-Champaign."])
AC_COPYRIGHT($LLVM_COPYRIGHT)
dnl Indicate that we require autoconf 2.59 or later. Ths is needed because we
@@ -72,10 +72,9 @@ do
"llvm-test") AC_CONFIG_SUBDIRS([projects/llvm-test]) ;;
"llvm-reopt") AC_CONFIG_SUBDIRS([projects/llvm-reopt]);;
"llvm-gcc") AC_CONFIG_SUBDIRS([projects/llvm-gcc]) ;;
"Java") AC_CONFIG_SUBDIRS([projects/Java]) ;;
"llvm-java") AC_CONFIG_SUBDIRS([projects/llvm-java]) ;;
"llvm-tv") AC_CONFIG_SUBDIRS([projects/llvm-tv]) ;;
"llvm-fefw") AC_CONFIG_SUBDIRS([projects/llvm-fefw]) ;;
"poolalloc") AC_CONFIG_SUBDIRS([projects/poolalloc]) ;;
"llvm-poolalloc") AC_CONFIG_SUBDIRS([projects/llvm-poolalloc]) ;;
*)
AC_MSG_WARN([Unknown project (${i}) won't be configured automatically])
;;
@@ -97,34 +96,68 @@ AC_CANONICAL_TARGET
dnl Determine the platform type and cache its value. This helps us configure
dnl the System library to the correct build platform.
AC_CACHE_CHECK([support for generic build operating system],
[llvm_cv_platform_type],
AC_CACHE_CHECK([type of operating system we're on],
[llvm_cv_os_type],
[case $build in
*-*-aix*) llvm_cv_platform_type="AIX" ;;
*-*-cygwin*) llvm_cv_platform_type="Cygwin" ;;
*-*-darwin*) llvm_cv_platform_type="Darwin" ;;
*-*-freebsd*) llvm_cv_platform_type="FreeBSD" ;;
*-*-interix*) llvm_cv_platform_type="Interix" ;;
*-*-linux*) llvm_cv_platform_type="Linux" ;;
*-*-solaris*) llvm_cv_platform_type="SunOS" ;;
*-*-win32*) llvm_cv_platform_type="Win32" ;;
*-*-mingw*) llvm_cv_platform_type="Win32" ;;
*) llvm_cv_platform_type="Unknown" ;;
*-*-aix*)
llvm_cv_os_type="AIX"
llvm_cv_platform_type="Unix" ;;
*-*-cygwin*)
llvm_cv_os_type="Cygwin"
llvm_cv_platform_type="Unix" ;;
*-*-darwin*)
llvm_cv_os_type="Darwin"
llvm_cv_platform_type="Unix" ;;
*-*-freebsd*)
llvm_cv_os_type="FreeBSD"
llvm_cv_platform_type="Unix" ;;
*-*-hpux*)
llvm_cv_os_type="HP-UX"
llvm_cv_platform_type="Unix" ;;
*-*-interix*)
llvm_cv_os_type="Interix"
llvm_cv_platform_type="Unix" ;;
*-*-linux*)
llvm_cv_os_type="Linux"
llvm_cv_platform_type="Unix" ;;
*-*-solaris*)
llvm_cv_os_type="SunOS"
llvm_cv_platform_type="Unix" ;;
*-*-win32*)
llvm_cv_os_type="Win32"
llvm_cv_platform_type="Win32" ;;
*-*-mingw*)
llvm_cv_os_type="MingW"
llvm_cv_platform_type="Win32" ;;
*)
llvm_cv_os_type="Unknown"
llvm_cv_platform_type="Unknown" ;;
esac])
dnl Make sure we aren't attempting to configure for an unknown system
if test "$llvm_cv_platform_type" = "Unknown" ; then
AC_MSG_ERROR([Operating system platform is unknown, configure can't continue])
if test "$llvm_cv_os_type" = "Unknown" ; then
AC_MSG_ERROR([Operating system is unknown, configure can't continue])
fi
dnl Set the "OS" Makefile variable based on the platform type so the
dnl makefile can configure itself to specific build hosts
AC_SUBST(OS,$llvm_cv_platform_type)
AC_SUBST(OS,$llvm_cv_os_type)
dnl Make a link from lib/System/platform to lib/System/$llvm_cv_platform_type
dnl This helps the #inclusion of the system specific include files
dnl for the operating system abstraction library, lib/System.
AC_CONFIG_LINKS(lib/System/platform:lib/System/$llvm_cv_platform_type)
dnl Set the "LLVM_ON_*" variables based on llvm_cvs_platform_type
dnl This is used by lib/System to determine the basic kind of implementation
dnl to use.
case $llvm_cv_platform_type in
Unix)
AC_DEFINE([LLVM_ON_UNIX],[1],[Define if this is Unixish platform])
AC_SUBST(LLVM_ON_UNIX,[1])
AC_SUBST(LLVM_ON_WIN32,[0])
;;
Win32)
AC_DEFINE([LLVM_ON_WIN32],[1],[Define if this is Win32ish platform])
AC_SUBST(LLVM_ON_UNIX,[0])
AC_SUBST(LLVM_ON_WIN32,[1])
;;
esac
dnl If we are targetting a Sparc machine running Solaris, pretend that it is
dnl V9, since that is all that we support at the moment, and autoconf will only
@@ -139,9 +172,12 @@ dnl This will allow Makefiles to make a distinction between the hardware and
dnl the OS.
AC_CACHE_CHECK([target architecture],[llvm_cv_target_arch],
[case $target in
i*86-*) llvm_cv_target_arch="x86" ;;
i?86-*) llvm_cv_target_arch="x86" ;;
amd64-* | x86_64-*) llvm_cv_target_arch="x86_64" ;;
sparc*-*) llvm_cv_target_arch="Sparc" ;;
powerpc*-*) llvm_cv_target_arch="PowerPC" ;;
alpha*-*) llvm_cv_target_arch="Alpha" ;;
ia64-*) llvm_cv_target_arch="IA64" ;;
*) llvm_cv_target_arch="Unknown" ;;
esac])
@@ -183,6 +219,9 @@ else
x86) AC_SUBST(JIT,[[TARGET_HAS_JIT=1]]) ;;
Sparc) AC_SUBST(JIT,[[TARGET_HAS_JIT=1]]) ;;
PowerPC) AC_SUBST(JIT,[[TARGET_HAS_JIT=1]]) ;;
x86_64) AC_SUBST(JIT,[[]]) ;;
Alpha) AC_SUBST(JIT,[[]]) ;;
IA64) AC_SUBST(JIT,[[]]) ;;
*) AC_SUBST(JIT,[[]]) ;;
esac
fi
@@ -199,26 +238,52 @@ case "$enableval" in
*) AC_MSG_ERROR([Invalid setting for --enable-doxygen. Use "yes" or "no"]) ;;
esac
dnl Find the LLVM GCC-based C/C++ front end
AC_ARG_WITH(llvmgccdir,
AS_HELP_STRING(--with-llvmgccdir,[Location of LLVM GCC front-end]),
AC_SUBST(LLVMGCCDIR,[$withval]))
dnl Provide some defaults for LLVMGCC for UIUC environments.
if test "x$LLVMGCCDIR" = x ; then
case "$llvm_cv_platform_type" in
Linux)
if test -d /home/vadve/lattner/local/x86/llvm-gcc ; then
AC_SUBST(LLVMGCCDIR,[/home/vadve/lattner/local/x86/llvm-gcc/])
fi
dnl Allow specific targets to be specified for building (or not)
TARGETS_TO_BUILD=""
AC_ARG_ENABLE([targets],AS_HELP_STRING([--enable-target],
[Build specific host targets: all,host-only,{target-name} (default=all)]),,
enableval=all)
case "$enableval" in
all) TARGETS_TO_BUILD="X86 SparcV8 SparcV9 PowerPC Alpha IA64 Skeleton" ;;
host-only)
case "$llvm_cv_target_arch" in
x86) TARGETS_TO_BUILD="X86" ;;
x86_64) TARGETS_TO_BUILD="X86" ;;
Sparc) TARGETS_TO_BUILD="SparcV8 SparcV9" ;;
PowerPC) TARGETS_TO_BUILD="PowerPC" ;;
Alpha) TARGETS_TO_BUILD="Alpha" ;;
IA64) TARGETS_TO_BUILD="IA64" ;;
*) AC_MSG_ERROR([Can not set target to build]) ;;
esac
;;
SunOS)
if test -d /home/vadve/lattner/local/sparc/llvm-gcc ; then
AC_SUBST(LLVMGCCDIR,[/home/vadve/lattner/local/sparc/llvm-gcc/])
fi
*)for a_target in `echo $enableval|sed -e 's/,/ /g' ` ; do
case "$a_target" in
x86) TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;;
x86_64) TARGETS_TO_BUILD="X86 $TARGETS_TO_BUILD" ;;
sparc) TARGETS_TO_BUILD="SparcV8 SparcV9 $TARGETS_TO_BUILD" ;;
powerpc) TARGETS_TO_BUILD="PowerPC $TARGETS_TO_BUILD" ;;
alpha) TARGETS_TO_BUILD="Alpha $TARGETS_TO_BUILD" ;;
ia64) TARGETS_TO_BUILD="IA64 $TARGETS_TO_BUILD" ;;
skeleton)TARGETS_TO_BUILD="Skeleton $TARGETS_TO_BUILD";;
*) AC_MSG_ERROR([Unrecognized target $a_target]) ;;
esac
done
;;
esac
fi
TARGETS_TO_BUILD="CBackend $TARGETS_TO_BUILD"
AC_SUBST(TARGETS_TO_BUILD,$TARGETS_TO_BUILD)
dnl Allow a specific llvm-gcc/llvm-g++ pair to be used with this LLVM config.
AC_ARG_WITH(llvmgccdir,
AS_HELP_STRING([--with-llvmgccdir],
[Specify location of llvm-gcc install dir (default searches PATH)]),,
withval=default)
case "$withval" in
default) WITH_LLVMGCCDIR=default ;;
/*) WITH_LLVMGCCDIR=$withval ;;
*) AC_MSG_ERROR([Invalid path for --with-llvmgccdir. Provide full path]) ;;
esac
dnl===-----------------------------------------------------------------------===
dnl===
@@ -236,12 +301,13 @@ AC_PROG_BISON
dnl Check for the tools that the makefiles require
AC_CHECK_GNU_MAKE
AC_PROG_LN_S
AC_PATH_PROG(CMP, [cmp], [cmp])
AC_PATH_PROG(CP, [cp], [cp])
AC_PATH_PROG(DATE, [date], [date])
AC_PATH_PROG(FIND, [find], [find])
AC_PATH_PROG(GREP, [grep], [grep])
AC_PATH_PROG(MKDIR,[mkdir],[mkdir])
AC_PATH_PROG(MV, [mv], [mv])
AC_PATH_PROG(PAX, [pax], [pax])
AC_PROG_RANLIB
AC_PATH_PROG(RM, [rm], [rm])
AC_PATH_PROG(SED, [sed], [sed])
@@ -262,8 +328,6 @@ AC_PATH_PROG(GROFF,[groff],[true groff])
AC_PATH_PROG(GZIP,[gzip],[true gzip])
AC_PATH_PROG(POD2HTML,[pod2html],[true pod2html])
AC_PATH_PROG(POD2MAN,[pod2man],[true pod2man])
AC_PATH_PROG(PYTHON,[python],[true python])
AC_PATH_PROG(QMTEST,[qmtest],[true qmtest])
AC_PATH_PROG(RUNTEST,[runtest],[true runtest])
DJ_AC_PATH_TCLSH
AC_PATH_PROG(ZIP,[zip],[true zip])
@@ -278,6 +342,11 @@ AC_LIBTOOL_DLOPEN
AC_LIB_LTDL
AC_PROG_LIBTOOL
if test "$lt_cv_dlopen_self" = "yes" ; then
AC_DEFINE([CAN_DLOPEN_SELF],[1],
[Define if dlopen(0) will open the symbols of the program])
fi
dnl Check if we know how to tell etags we are using C++:
etags_version=`$ETAGS --version 2>&1`
case "$etags_version" in
@@ -287,25 +356,54 @@ case "$etags_version" in
esac
AC_SUBST(ETAGSFLAGS,$ETAGSFLAGS)
if test "$WITH_LLVMGCCDIR" = "default" ; then
AC_PATH_PROG(LLVMGCC, [llvm-gcc], [])
AC_PATH_PROG(LLVMGXX, [llvm-g++], [])
else
LLVMGCC=$WITH_LLVMGCCDIR/bin/llvm-gcc
LLVMGXX=$WITH_LLVMGCCDIR/bin/llvm-g++
AC_SUBST(LLVMGCC,$LLVMGCC)
AC_SUBST(LLVMGXX,$LLVMGXX)
fi
AC_MSG_CHECKING([tool compatibility])
dnl Ensure that compilation tools are GCC; we use GCC specific extensions
if test "$GCC" != "yes"
dnl Ensure that compilation tools are GCC or a GNU compatible compiler such as
dnl ICC; we use GCC specific options in the makefiles so the compiler needs
dnl to support those options.
dnl "icc" emits gcc signatures
dnl "icc -no-gcc" emits no gcc signature BUT is still compatible
ICC=no
IXX=no
case $CC in
icc*|icpc*)
ICC=yes
IXX=yes
;;
*)
;;
esac
if test "$GCC" != "yes" && test "$ICC" != "yes"
then
AC_MSG_ERROR([gcc required but not found])
AC_MSG_ERROR([gcc|icc required but not found])
fi
dnl Ensure that compilation tools are GCC; we use GCC specific extensions
if test "$GXX" != "yes"
if test "$GXX" != "yes" && test "$IXX" != "yes"
then
AC_MSG_ERROR([g++ required but not found])
AC_MSG_ERROR([g++|icc required but not found])
fi
dnl Verify that GCC is version 3.0 or higher
if test "$GCC" = "yes"
then
gccmajor=`$CC --version | head -n 1 | awk '{print $NF;}' | cut -d. -f1`
if test "$gccmajor" -lt "3"
then
AC_MSG_ERROR([gcc 3.x required, but you have a lower version])
fi
fi
dnl Check for GNU Make. We use its extensions, so don't build without it
if test -z "$llvm_cv_gnu_make_command"
@@ -316,31 +414,6 @@ fi
dnl Tool compatibility is okay if we make it here.
AC_MSG_RESULT([ok])
dnl Generate warnings for things not found but not strictly needed
if test "$PYTHON" = "false" ; then
AC_MSG_WARN([Python is required for the test suite, but it was not found])
fi
if test "$QMTEST" = "false" ; then
AC_MSG_WARN([QMTest is required for the test suite, but it was not found])
fi
if test "$RUNTEST" = "false" ; then
AC_MSG_WARN([runtest (Deja-Gnu) is required for the test sute, but it was not found])
fi
pyversion=`$PYTHON -V 2>&1 | cut -d\ -f2`
pymajor=`echo $pyversion | cut -d. -f1`
pyminor=`echo $pyversion | cut -d. -f2`
if test "$pymajor" -ge "2" ; then
if test "$pymajor" -eq "2" ; then
if test "$pyminor" -lt "2" ; then
AC_MSG_WARN([QMTest requires Python 2.2 or later])
fi
fi
else
AC_MSG_WARN([QMTest requires Python 2.2 or later])
fi
AC_MSG_RESULT([])
dnl===-----------------------------------------------------------------------===
dnl===
dnl=== SECTION 5: Check for libraries
@@ -377,23 +450,21 @@ dnl=== SECTION 6: Check for header files
dnl===
dnl===-----------------------------------------------------------------------===
dnl First, use autoconf provided macros for specific headers that we need
dnl We don't check for ancient stuff or things that are guaranteed to be there
dnl by the C++ standard. We always use the <cfoo> versions of <foo.h> C headers.
AC_HEADER_STDC
dnl However, we do need some system specific header files. Generally we're
dnl looking for POSIX headers.
AC_HEADER_SYS_WAIT
AC_CHECK_HEADERS([sys/time.h sys/mman.h sys/resource.h sys/time.h sys/types.h])
AC_CHECK_HEADERS([dlfcn.h execinfo.h fcntl.h limits.h link.h])
AC_CHECK_HEADERS([malloc.h unistd.h windows.h])
AC_HEADER_TIME
dnl Generally we're looking for POSIX headers.
AC_HEADER_DIRENT
AC_HEADER_MMAP_ANONYMOUS
AC_HEADER_STAT
AC_HEADER_STDC
AC_HEADER_SYS_WAIT
AC_HEADER_TIME
dnl Check for things that need to be included in public headers, and so
dnl for which we may not have access to a HAVE_* preprocessor #define.
dnl (primarily used in DataTypes.h)
AC_CHECK_HEADERS([inttypes.h stdint.h])
AC_CHECK_HEADERS([dlfcn.h execinfo.h fcntl.h inttypes.h limits.h link.h])
AC_CHECK_HEADERS([malloc.h signal.h stdint.h unistd.h utime.h windows.h])
AC_CHECK_HEADERS([sys/mman.h sys/param.h sys/resource.h sys/time.h sys/types.h])
AC_CHECK_HEADERS([rw/stdex/hash_map.h rw/stdex/hash_set.h])
dnl===-----------------------------------------------------------------------===
dnl===
@@ -416,8 +487,10 @@ dnl=== SECTION 8: Check for specific functions needed
dnl===
dnl===-----------------------------------------------------------------------===
AC_CHECK_FUNCS([backtrace getcwd gettimeofday isatty getrusage mkstemp])
AC_CHECK_FUNCS([strdup strtoq strtoll])
AC_CHECK_FUNCS([backtrace getcwd getpagesize getrusage gettimeofday ])
AC_CHECK_FUNCS([isatty mkdtemp mkstemp mktemp ])
AC_CHECK_FUNCS([realpath sbrk setrlimit strdup strerror strerror_r ])
AC_CHECK_FUNCS([strtoll strtoq sysconf])
AC_C_PRINTF_A
AC_FUNC_ALLOCA
AC_FUNC_RAND48
@@ -433,15 +506,17 @@ AC_FUNC_ISNAN
AC_FUNC_ISINF
dnl Check for mmap and mprotect support. We need both to do the JIT and for
dnl bytecode loading, etc.
dnl bytecode loading, etc. We also need to know if /dev/zero is required to
dnl be opened for allocating RWX memory.
AC_FUNC_MMAP
AC_FUNC_MMAP_FILE
AC_NEED_DEV_ZERO_FOR_MMAP
AC_CHECK_FUNC(mprotect,,
AC_MSG_ERROR([Function mprotect() required but not found]))
if test "$ac_cv_func_mmap_fixed_mapped" = "no"
then
AC_MSG_WARN([mmap() required but not found])
AC_MSG_WARN([mmap() of a fixed address required but not supported])
fi
if test "$ac_cv_func_mmap_file" = "no"
then
@@ -454,34 +529,26 @@ dnl=== SECTION 9: Additional checks, variables, etc.
dnl===
dnl===-----------------------------------------------------------------------===
dnl Figure out if there's an executable llvm-gcc in the llvmgccdir.
AC_CACHE_CHECK([for llvm-gcc],[llvm_cv_llvmgcc],
[llvm_cv_llvmgcc='llvmgcc_not_found'
if test -d "$LLVMGCCDIR" ; then
if test -x "$LLVMGCCDIR/bin/gcc" ; then
llvm_cv_llvmgcc="$LLVMGCCDIR/bin/gcc"
fi
fi])
dnl See if the llvmgcc executable can compile to LLVM assembly
dnl See if the llvm-gcc executable can compile to LLVM assembly
AC_CACHE_CHECK([whether llvm-gcc is sane],[llvm_cv_llvmgcc_sanity],
[llvm_cv_llvmgcc_sanity="no"
if test -x "$llvm_cv_llvmgcc" ; then
if test -x "$LLVMGCC" ; then
cp /dev/null conftest.c
"$llvm_cv_llvmgcc" -S -o - conftest.c | grep implementation > /dev/null 2>&1
"$LLVMGCC" -S -o - conftest.c | grep implementation > /dev/null 2>&1
if test $? -eq 0 ; then
llvm_cv_llvmgcc_sanity="yes"
fi
rm conftest.c
fi])
dnl Since we have a sane llvmgcc, identify it and its sub-tools
dnl Since we have a sane llvm-gcc, identify it and its sub-tools
if test "$llvm_cv_llvmgcc_sanity" = "yes" ; then
AC_SUBST(LLVMGCC,"$llvm_cv_llvmgcc")
llvmcc1path=`"$llvm_cv_llvmgcc" --print-prog-name=cc1`
llvmcc1path=`"$LLVMGCC" --print-prog-name=cc1`
AC_SUBST(LLVMCC1,$llvmcc1path)
llvmcc1pluspath=`"$llvm_cv_llvmgcc" --print-prog-name=cc1plus`
llvmcc1pluspath=`"$LLVMGCC" --print-prog-name=cc1plus`
AC_SUBST(LLVMCC1PLUS,$llvmcc1pluspath)
llvmgccdir=`echo "$llvmcc1path" | sed 's,/libexec/.*,,'`
AC_SUBST(LLVMGCCDIR,$llvmgccdir)
fi
dnl Propagate the shared library extension that the libltdl checks did to
@@ -560,6 +627,7 @@ dnl Configure doxygen's configuration file
AC_CONFIG_FILES([docs/doxygen.cfg])
dnl Do special configuration of Makefiles
AC_CONFIG_COMMANDS([setup],,[llvm_src="${srcdir}"])
AC_CONFIG_MAKEFILE(Makefile)
AC_CONFIG_MAKEFILE(Makefile.common)
AC_CONFIG_MAKEFILE(examples/Makefile)
@@ -567,8 +635,6 @@ AC_CONFIG_MAKEFILE(lib/Makefile)
AC_CONFIG_MAKEFILE(runtime/Makefile)
AC_CONFIG_MAKEFILE(test/Makefile)
AC_CONFIG_MAKEFILE(test/Makefile.tests)
AC_CONFIG_MAKEFILE(test/QMTest/llvm.py)
AC_CONFIG_MAKEFILE(test/QMTest/llvmdb.py)
AC_CONFIG_MAKEFILE(tools/Makefile)
AC_CONFIG_MAKEFILE(utils/Makefile)
AC_CONFIG_MAKEFILE(projects/Makefile)
@@ -578,10 +644,9 @@ AC_OUTPUT
dnl Warn loudly if llvm-gcc was not obviously working
if test "$llvm_cv_llvmgcc_sanity" = "no" ; then
AC_MSG_WARN([***** llvm C/C++ front end was not found, or does not])
AC_MSG_WARN([***** appear to be working.])
AC_MSG_WARN([***** ])
AC_MSG_WARN([***** Please check configure's --with-llvmgccdir option.])
AC_MSG_WARN([***** Runtime libraries (in llvm/runtime) will not be built,])
AC_MSG_WARN([***** but you should be able to build the llvm tools.])
AC_MSG_WARN([***** llvm-gcc/llvm-g++ was not found, or does not appear to be ])
AC_MSG_WARN([***** working. Please make sure you have llvmgcc and llvmg++ in])
AC_MSG_WARN([***** your path before configuring LLVM. The runtime libraries])
AC_MSG_WARN([***** (llvm/runtime) will not be built but you should be able to])
AC_MSG_WARN([***** build the llvm tools.])
fi

View File

@@ -4327,12 +4327,12 @@ extern \"C\" {
# Prepare the list of exported symbols
if test -z "$export_symbols"; then
export_symbols="$output_objdir/$output.exp"
export_symbols="$output_objdir/$outputname.exp"
$run $rm $export_symbols
$run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
else
$run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
$run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
$run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
$run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
$run eval 'mv "$nlist"T "$nlist"'
fi
fi

View File

@@ -6,12 +6,9 @@
# 2) BISON is set to bison
#
AC_DEFUN([AC_PROG_BISON],
[AC_CACHE_CHECK([],[llvm_cv_has_bison],
[AC_PROG_YACC()
])
[AC_CACHE_CHECK([],[llvm_cv_has_bison],[AC_PROG_YACC()])
if test "$YACC" != "bison -y"; then
AC_MSG_ERROR([bison not found but required])
else
AC_SUBST(BISON,[bison],[location of bison])
fi
])
fi])

View File

@@ -3,5 +3,7 @@
# date. This macro is unique to LLVM.
#
AC_DEFUN([AC_CONFIG_MAKEFILE],
[AC_CONFIG_COMMANDS($1,${SHELL} ${srcdir}/autoconf/install-sh -c ${srcdir}/$1 $1,${srcdir}/autoconf/mkinstalldirs `dirname $1`)
[AC_CONFIG_COMMANDS($1,
[${llvm_src}/autoconf/mkinstalldirs `dirname $1`
${SHELL} ${llvm_src}/autoconf/install-sh -c ${srcdir}/$1 $1])
])

View File

@@ -0,0 +1,14 @@
#
# Provide the arguments and other processing needed for an LLVM project
#
AC_DEFUN([LLVM_CONFIG_PROJECT],
[AC_ARG_WITH([llvmsrc],
AS_HELP_STRING([--with-llvmsrc],[Location of LLVM Source Code]),
[llvm_src="$withval"],[llvm_src=`cd ${srcdir}/../..; pwd`])
AC_SUBST(LLVM_SRC,$llvm_src)
AC_ARG_WITH([llvmobj],
AS_HELP_STRING([--with-llvmobj],[Location of LLVM Object Code]),
[llvm_obj="$withval"],[llvm_obj=`cd ../..; pwd`])
AC_SUBST(LLVM_OBJ,$llvm_obj)
AC_CONFIG_COMMANDS([setup],,[llvm_src="${LLVM_SRC}"])
])

View File

@@ -16,6 +16,6 @@ ac_cv_header_mmap_anon,
AC_LANG_POP([C])
])
if test "$ac_cv_header_mmap_anon" = yes; then
AC_DEFINE([HAVE_MMAP_ANONYMOUS],[],[Define if mmap() uses MAP_ANONYMOUS to map anonymous pages, or undefine if it uses MAP_ANON])
AC_DEFINE([HAVE_MMAP_ANONYMOUS],[1],[Define if mmap() uses MAP_ANONYMOUS to map anonymous pages, or undefine if it uses MAP_ANON])
fi
])

View File

@@ -0,0 +1,17 @@
#
# When allocating RWX memory, check whether we need to use /dev/zero
# as the file descriptor or not.
#
AC_DEFUN([AC_NEED_DEV_ZERO_FOR_MMAP],
[AC_CACHE_CHECK([if /dev/zero is needed for mmap],
ac_cv_need_dev_zero_for_mmap,
[if test "$llvm_cv_os_type" = "Interix" ; then
ac_cv_need_dev_zero_for_mmap=yes
else
ac_cv_need_dev_zero_for_mmap=no
fi
])
if test "$ac_cv_need_dev_zero_for_mmap" = yes; then
AC_DEFINE([NEED_DEV_ZERO_FOR_MMAP],[1],
[Define if /dev/zero should be used when mapping RWX memory, or undefine if its not necessary])
fi])

View File

@@ -24,7 +24,7 @@ fi
dnl see if one is installed
if test x"${ac_cv_path_tclsh}" = x ; then
AC_MSG_RESULT(none)
AC_PATH_PROGS([TCLSH],[tclsh8.4 tclsh8.4.8 tclsh8.4.7 tclsh8.4.6 tclsh8.4.5 tclsh8.4.4 tclsh8.4.3 tclsh8.4.2 tclsh8.4.1 tclsh8.4.0 tclsh8.3 tclsh8.3.5 tclsh8.3.4 tclsh8.3.3 .tclsh8.3.2 tclsh8.3.1 tclsh8.3.0 tclsh])
AC_PATH_PROGS([TCLSH],[tclsh8.4 tclsh8.4.8 tclsh8.4.7 tclsh8.4.6 tclsh8.4.5 tclsh8.4.4 tclsh8.4.3 tclsh8.4.2 tclsh8.4.1 tclsh8.4.0 tclsh8.3 tclsh8.3.5 tclsh8.3.4 tclsh8.3.3 tclsh8.3.2 tclsh8.3.1 tclsh8.3.0 tclsh])
if test x"${TCLSH}" = x ; then
ac_cv_path_tclsh='';
else

2515
llvm/configure vendored

File diff suppressed because it is too large Load Diff

2
llvm/docs/.cvsignore Normal file
View File

@@ -0,0 +1,2 @@
doxygen.cfg

View File

@@ -1,41 +1,63 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>LLVM: bugpoint tool</title>
<title>LLVM bugpoint tool: design and usage</title>
<link rel="stylesheet" href="llvm.css" type="text/css">
<meta name="author" content="Chris Lattner">
<meta name="description"
content="A tool for automatic test case reduction">
</head>
<html>
<body>
<center><h1>LLVM: <tt>bugpoint</tt> tool</h1></center>
<HR>
<div class="doc_title">
LLVM bugpoint tool: design and usage
</div>
<h3>NAME</h3>
<tt>bugpoint</tt>
<ul>
<li><a href="#desc">Description</a></li>
<li><a href="#design">Design Philosophy</a>
<ul>
<li><a href="#autoselect">Automatic Debugger Selection</a></li>
<li><a href="#crashdebug">Crash debugger</a></li>
<li><a href="#codegendebug">Code generator debugger</a></li>
<li><a href="#miscompilationdebug">Miscompilation debugger</a></li>
</ul></li>
<li><a href="#advice">Advice for using <tt>bugpoint</tt></a></li>
</ul>
<h3>SYNOPSIS</h3>
<tt>bugpoint [options] [input LLVM ll/bc files] [LLVM passes] --args &lt;program arguments&gt;...</tt>
<div class="doc_author">
<p>Written by <a href="mailto:sabre@nondot.org">Chris Lattner</a></p>
</div>
<img src="img/Debugging.gif" width=444 height=314 align=right>
<h3>DESCRIPTION</h3>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="desc">Description</a>
</div>
<!-- *********************************************************************** -->
The <tt>bugpoint</tt> tool narrows down the source of
problems in LLVM tools and passes. It can be used to debug three types of
failures: optimizer crashes, miscompilations by optimizers, or bad native
code generation (including problems in the static and JIT compilers). It aims
to reduce large test cases to small, useful ones. For example,
if <tt><a href="CommandGuide/html/gccas.html">gccas</a></tt> crashes while optimizing a file, it
will identify the optimization (or combination of optimizations) that causes the
crash, and reduce the file down to a small example which triggers the crash.<p>
<div class="doc_text">
<a name="designphilosophy">
<h4>Design Philosophy</h4>
<p><tt>bugpoint</tt> narrows down the source of problems in LLVM tools and
passes. It can be used to debug three types of failures: optimizer crashes,
miscompilations by optimizers, or bad native code generation (including problems
in the static and JIT compilers). It aims to reduce large test cases to small,
useful ones. For example, if <tt>gccas</tt> crashes while optimizing a
file, it will identify the optimization (or combination of optimizations) that
causes the crash, and reduce the file down to a small example which triggers the
crash.</p>
<tt>bugpoint</tt> is designed to be a useful tool without requiring any
<p>For detailed case scenarios, such as debugging <tt>gccas</tt>,
<tt>gccld</tt>, or one of the LLVM code generators, see <a
href="HowToSubmitABug.html">How To Submit a Bug Report document</a>.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="design">Design Philosophy</a>
</div>
<!-- *********************************************************************** -->
<div class="doc_text">
<p><tt>bugpoint</tt> is designed to be a useful tool without requiring any
hooks into the LLVM infrastructure at all. It works with any and all LLVM
passes and code generators, and does not need to "know" how they work. Because
of this, it may appear to do stupid things or miss obvious
@@ -44,47 +66,57 @@ time for computer time in the compiler-debugging process; consequently, it may
take a long period of (unattended) time to reduce a test case, but we feel it
is still worth it. Note that <tt>bugpoint</tt> is generally very quick unless
debugging a miscompilation where each test of the program (which requires
executing it) takes a long time.<p>
executing it) takes a long time.</p>
<a name="automaticdebuggerselection">
<h4>Automatic Debugger Selection</h4>
</div>
<tt>bugpoint</tt> reads each <tt>.bc</tt> or <tt>.ll</tt> file
specified on the command line and links them together into a single module,
called the test program. If any LLVM passes are
specified on the command line, it runs these passes on the test program. If
any of the passes crash, or if they produce malformed output (which causes the
verifier to abort),
<tt>bugpoint</tt> starts the <a href="#crashdebug">crash debugger</a>.<p>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="autoselect">Automatic Debugger Selection</a>
</div>
Otherwise, if the <a href="#opt_output"><tt>-output</tt></a> option was not
specified, <tt>bugpoint</tt> runs the test program with the C backend (which is
assumed to generate good code) to generate a reference output. Once
<tt>bugpoint</tt> has a reference output for the test program, it tries
executing it with the <a href="#opt_run-">selected</a> code generator. If the
selected code generator crashes, <tt>bugpoint</tt> starts the <a
href="#crashdebug">crash debugger</a> on the code generator. Otherwise, if the
resulting output differs from the reference output, it assumes the difference
resulted from a code generator failure, and starts the <a
href="#codegendebug">code generator debugger</a>.<p>
<div class="doc_text">
Finally, if the output of the selected code generator matches the reference
<p><tt>bugpoint</tt> reads each <tt>.bc</tt> or <tt>.ll</tt> file specified on
the command line and links them together into a single module, called the test
program. If any LLVM passes are specified on the command line, it runs these
passes on the test program. If any of the passes crash, or if they produce
malformed output (which causes the verifier to abort), <tt>bugpoint</tt> starts
the <a href="#crashdebug">crash debugger</a>.</p>
<p>Otherwise, if the <tt>-output</tt> option was not specified,
<tt>bugpoint</tt> runs the test program with the C backend (which is assumed to
generate good code) to generate a reference output. Once <tt>bugpoint</tt> has
a reference output for the test program, it tries executing it with the
selected code generator. If the selected code generator crashes,
<tt>bugpoint</tt> starts the <a href="#crashdebug">crash debugger</a> on the
code generator. Otherwise, if the resulting output differs from the reference
output, it assumes the difference resulted from a code generator failure, and
starts the <a href="#codegendebug">code generator debugger</a>.</p>
<p>Finally, if the output of the selected code generator matches the reference
output, <tt>bugpoint</tt> runs the test program after all of the LLVM passes
have been applied to it. If its output differs from the reference output, it
assumes the difference resulted from a failure in one of the LLVM passes, and
enters the <a href="#miscompilationdebug">miscompilation
debugger</a>. Otherwise, there is no problem <tt>bugpoint</tt> can debug.<p>
enters the <a href="#miscompilationdebug">miscompilation debugger</a>.
Otherwise, there is no problem <tt>bugpoint</tt> can debug.</p>
<a name="crashdebug">
<h4>Crash debugger</h4>
</div>
If an optimizer or code generator crashes, <tt>bugpoint</tt> will try as hard as
it can to reduce the list of passes (for optimizer crashes) and the size of the
test program. First, <tt>bugpoint</tt> figures out which combination of
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="crashdebug">Crash debugger</a>
</div>
<div class="doc_text">
<p>If an optimizer or code generator crashes, <tt>bugpoint</tt> will try as hard
as it can to reduce the list of passes (for optimizer crashes) and the size of
the test program. First, <tt>bugpoint</tt> figures out which combination of
optimizer passes triggers the bug. This is useful when debugging a problem
exposed by <tt>gccas</tt>, for example, because it runs over 38 passes.<p>
exposed by <tt>gccas</tt>, for example, because it runs over 38 passes.</p>
Next, <tt>bugpoint</tt> tries removing functions from the test program, to
<p>Next, <tt>bugpoint</tt> tries removing functions from the test program, to
reduce its size. Usually it is able to reduce a test program to a single
function, when debugging intraprocedural optimizations. Once the number of
functions has been reduced, it attempts to delete various edges in the control
@@ -92,38 +124,55 @@ flow graph, to reduce the size of the function as much as possible. Finally,
<tt>bugpoint</tt> deletes any individual LLVM instructions whose absence does
not eliminate the failure. At the end, <tt>bugpoint</tt> should tell you what
passes crash, give you a bytecode file, and give you instructions on how to
reproduce the failure with <tt><a href="CommandGuide/html/opt.html">opt</a></tt>, <tt><a
href="CommandGuide/html/analyze.html">analyze</a></tt>, or <tt><a href="CommandGuide/html/llc.html">llc</a></tt>.<p>
reproduce the failure with <tt>opt</tt>, <tt>analyze</tt>, or <tt>llc</tt>.</p>
<a name="codegendebug">
<h4>Code generator debugger</h4>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="codegendebug">Code generator debugger</a>
</div>
<div class="doc_text">
<p>The code generator debugger attempts to narrow down the amount of code that
is being miscompiled by the <a href="#opt_run-">selected</a> code generator. To
do this, it takes the test program and partitions it into two pieces: one piece
which it compiles with the C backend (into a shared object), and one piece which
it runs with either the JIT or the static LLC compiler. It uses several
techniques to reduce the amount of code pushed through the LLVM code generator,
to reduce the potential scope of the problem. After it is finished, it emits
two bytecode files (called "test" [to be compiled with the code generator] and
"safe" [to be compiled with the C backend], respectively), and instructions for
reproducing the problem. The code generator debugger assumes that the C backend
produces good code.</p>
is being miscompiled by the selected code generator. To do this, it takes the
test program and partitions it into two pieces: one piece which it compiles
with the C backend (into a shared object), and one piece which it runs with
either the JIT or the static LLC compiler. It uses several techniques to
reduce the amount of code pushed through the LLVM code generator, to reduce the
potential scope of the problem. After it is finished, it emits two bytecode
files (called "test" [to be compiled with the code generator] and "safe" [to be
compiled with the C backend], respectively), and instructions for reproducing
the problem. The code generator debugger assumes that the C backend produces
good code.</p>
<a name="miscompilationdebug">
<h4>Miscompilation debugger</h4>
</div>
The miscompilation debugger works similarly to the code generator
debugger. It works by splitting the test program into two pieces, running the
optimizations specified on one piece, linking the two pieces back together,
and then executing the result.
It attempts to narrow down the list of passes to the one (or few) which are
causing the miscompilation, then reduce the portion of the test program which is
being miscompiled. The miscompilation debugger assumes that the selected
code generator is working properly.<p>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="miscompilationdebug">Miscompilation debugger</a>
</div>
<a name="bugpoint notes">
<h4>Advice for using <tt>bugpoint</tt></h4>
<div class="doc_text">
<p>The miscompilation debugger works similarly to the code generator debugger.
It works by splitting the test program into two pieces, running the
optimizations specified on one piece, linking the two pieces back together, and
then executing the result. It attempts to narrow down the list of passes to
the one (or few) which are causing the miscompilation, then reduce the portion
of the test program which is being miscompiled. The miscompilation debugger
assumes that the selected code generator is working properly.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="advice">Advice for using bugpoint</a>
</div>
<!-- *********************************************************************** -->
<div class="doc_text">
<tt>bugpoint</tt> can be a remarkably useful tool, but it sometimes works in
non-obvious ways. Here are some hints and tips:<p>
@@ -131,10 +180,10 @@ non-obvious ways. Here are some hints and tips:<p>
<ol>
<li>In the code generator and miscompilation debuggers, <tt>bugpoint</tt> only
works with programs that have deterministic output. Thus, if the program
outputs <tt>argv[0]</tt>, the date, time, or any other "random" data, <tt>bugpoint</tt> may
misinterpret differences in these data, when output, as the result of a
miscompilation. Programs should be temporarily modified to disable
outputs that are likely to vary from run to run.
outputs <tt>argv[0]</tt>, the date, time, or any other "random" data,
<tt>bugpoint</tt> may misinterpret differences in these data, when output,
as the result of a miscompilation. Programs should be temporarily modified
to disable outputs that are likely to vary from run to run.
<li>In the code generator and miscompilation debuggers, debugging will go
faster if you manually modify the program or its inputs to reduce the
@@ -143,15 +192,19 @@ non-obvious ways. Here are some hints and tips:<p>
<li><tt>bugpoint</tt> is extremely useful when working on a new optimization:
it helps track down regressions quickly. To avoid having to relink
<tt>bugpoint</tt> every time you change your optimization however, have
<tt>bugpoint</tt> dynamically load your optimization with the <a
href="#opt_load"><tt>-load</tt></a> option.
<tt>bugpoint</tt> dynamically load your optimization with the
<tt>-load</tt> option.
<li><tt>bugpoint</tt> can generate a lot of output and run for a long period of
time. It is often useful to capture the output of the program to file. For
example, in the C shell, you can type:<br>
<tt>bugpoint ..... |&amp; tee bugpoint.log</tt>
<br>to get a copy of <tt>bugpoint</tt>'s output in the file
<tt>bugpoint.log</tt>, as well as on your terminal.
<li><p><tt>bugpoint</tt> can generate a lot of output and run for a long period
of time. It is often useful to capture the output of the program to file.
For example, in the C shell, you can run:</p>
<div class="doc_code">
<p><tt>bugpoint ... |&amp; tee bugpoint.log</tt></p>
</div>
<p>to get a copy of <tt>bugpoint</tt>'s output in the file
<tt>bugpoint.log</tt>, as well as on your terminal.</p>
<li><tt>bugpoint</tt> cannot debug problems with the LLVM linker. If
<tt>bugpoint</tt> crashes before you see its "All input ok" message,
@@ -165,89 +218,21 @@ non-obvious ways. Here are some hints and tips:<p>
</ol>
<h3>OPTIONS</h3>
</div>
<ul>
<li><tt>-additional-so &lt;library&gt;</tt><br>
Load <tt>&lt;library&gt;</tt> into the test program whenever it is run.
This is useful if you are debugging programs which depend on non-LLVM
libraries (such as the X or curses libraries) to run.<p>
<!-- *********************************************************************** -->
<li><tt>-args &lt;program args&gt;</tt><br>
Pass all arguments specified after <tt>-args</tt> to the
test program whenever it runs. Note that if any of
the <tt>&lt;program args&gt;</tt> start with a '-', you should use:
<p>
<tt>bugpoint &lt;bugpoint args&gt; -args -- &lt;program args&gt;</tt>
<p>
The "<tt>--</tt>" right after the <tt>-args</tt> option tells
<tt>bugpoint</tt> to consider any options starting with <tt>-</tt> to be
part of the <tt>-args</tt> option, not as options to <tt>bugpoint</tt>
itself.<p>
<hr>
<address>
<a href="http://jigsaw.w3.org/css-validator/check/referer"><img
src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a>
<a href="http://validator.w3.org/check/referer"><img
src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a>
<li><tt>-tool-args &lt;tool args&gt;</tt><br>
Pass all arguments specified after <tt>-tool-args</tt> to the
LLVM tool under test (llc, lli, etc.) whenever it runs.
You should use this option in the following way:
<p>
<tt>bugpoint &lt;bugpoint args&gt; -tool-args -- &lt;tool args&gt;</tt>
<p>
The "<tt>--</tt>" right after the <tt>-tool-args</tt> option tells
<tt>bugpoint</tt> to consider any options starting with <tt>-</tt> to be
part of the <tt>-tool-args</tt> option, not as options to
<tt>bugpoint</tt> itself. (See <tt>-args</tt>, above.)<p>
<a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
<a href="http://llvm.cs.uiuc.edu">LLVM Compiler Infrastructure</a><br>
Last modified: $Date$
</address>
<li><tt>-check-exit-code={true,false}</tt><br>
Assume a non-zero exit code or core dump from the test program is
a failure. Defaults to true.<p>
<li><tt>-disable-{dce,simplifycfg}</tt><br>
Do not run the specified passes to clean up and reduce the size of the
test program. By default, <tt>bugpoint</tt> uses these passes internally
when attempting to reduce test programs. If you're trying to find
a bug in one of these passes, <tt>bugpoint</tt> may crash.<p>
<li> <tt>-help</tt><br>
Print a summary of command line options.<p>
<a name="opt_input"><li><tt>-input &lt;filename&gt;</tt><br>
Open <tt>&lt;filename&gt;</tt> and redirect the standard input of the
test program, whenever it runs, to come from that file.
<p>
<a name="opt_load"><li> <tt>-load &lt;plugin&gt;</tt><br>
Load the dynamic object <tt>&lt;plugin&gt;</tt> into <tt>bugpoint</tt>
itself. This object should register new
optimization passes. Once loaded, the object will add new command line
options to enable various optimizations. To see the new complete list
of optimizations, use the -help and -load options together:
<p>
<tt>bugpoint -load &lt;plugin&gt; -help</tt>
<p>
<a name="opt_output"><li><tt>-output &lt;filename&gt;</tt><br>
Whenever the test program produces output on its standard output
stream, it should match the contents of <tt>&lt;filename&gt;</tt>
(the "reference output"). If you do not use this option,
<tt>bugpoint</tt> will attempt to generate a reference output by
compiling the program with the C backend and running it.<p>
<li><tt>-profile-info-file &lt;filename&gt;</tt><br>
Profile file loaded by -profile-loader.<p>
<a name="opt_run-"><li><tt>-run-{int,jit,llc,cbe}</tt><br>
Whenever the test program is compiled, <tt>bugpoint</tt> should generate
code for it using the specified code generator. These options allow
you to choose the interpreter, the JIT compiler, the static native
code compiler, or the C backend, respectively.<p>
</ul>
<h3>EXIT STATUS</h3>
If <tt>bugpoint</tt> succeeds in finding a problem, it will exit with 0.
Otherwise, if an error occurs, it will exit with a non-zero value.
<HR>
Maintained by the <a href="http://llvm.cs.uiuc.edu">LLVM Team</a>.
</body>
</html>

View File

@@ -1059,7 +1059,11 @@ href="#uint32_vbr">uint32_vbr</a> that describes the function.</p>
</tr>
<tr>
<td><a href="#bit">bit(0-3)</a></td>
<td class="td_left">Reserved for future use. Currently set to 0001.</td>
<td class="td_left">
Encodes the calling convention number of the function. If this number is
zero, this field is followed by a vbr indicating the CC#. Otherwise, the
CC number of the function is the value of this field minus one.
</td>
</tr>
<tr>
<td><a href="#bit">bit(4)</a></td>
@@ -1595,12 +1599,45 @@ single <a href="#uint32_vbr">uint32_vbr</a> as follows:</p>
<tr><td>VANext</td><td>32</td><td>1</td><td>1.0</td></tr>
<tr><td>VAArg</td><td>33</td><td>1</td><td>1.0</td></tr>
<tr><td>Select</td><td>34</td><td>2</td><td>1.2</td></tr>
<tr><td>UserOp1</td><td>35</td><td>1</td><td>1.0</td></tr>
<tr><td>UserOp2</td><td>36</td><td>1</td><td>1.0</td></tr>
<tr><td colspan="4">
<b>Pseudo Instructions<a href="#pi_note">*</a></b>
</td></tr>
<tr><td>Invoke+CC </td><td>56</td><td>5</td><td>1.5</td></tr>
<tr><td>Invoke+FastCC</td><td>57</td><td>5</td><td>1.5</td></tr>
<tr><td>Call+CC</td><td>58</td><td>5</td><td>1.5</td></tr>
<tr><td>Call+FastCC+TailCall</td><td>59</td><td>5</td><td>1.5</td></tr>
<tr><td>Call+FastCC</td><td>60</td><td>5</td><td>1.5</td></tr>
<tr><td>Call+CCC+TailCall</td><td>61</td><td>5</td><td>1.5</td></tr>
<tr><td>Load+Volatile</td><td>62</td><td>3</td><td>1.3</td></tr>
<tr><td>Store+Volatile</td><td>63</td><td>3</td><td>1.3</td></tr>
</tbody>
</table>
</div>
<p><b><a name="pi_note">* Note: </a></b>
These aren't really opcodes from an LLVM language prespeective. They encode
information into other opcodes without reserving space for that information.
For example, opcode=63 is a Volatile Store. The opcode for this
instruction is 25 (Store) but we encode it as 63 to indicate that is a Volatile
Store. The same is done for the calling conventions and tail calls.
In each of these entries in range 56-63, the opcode is documented as the base
opcode (Invoke, Call, Store) plus some set of modifiers, as follows:</p>
<dl>
<dt>CC</dt>
<dd>This means an arbitrary calling convention is specified
in a VBR that follows the opcode. This is used when the instruction cannot
be encoded with one of the more compact forms.
</dd>
<dt>FastCC</dt>
<dd>This indicates that the Call or Invoke is using the FastCC calling
convention.</dd>
<dt>CCC</dt>
<dd>This indicates that the Call or Invoke is using the native "C" calling
convention.</dd>
<dt>TailCall</dt>
<dd>This indicates that the Call has the 'tail' modifier.</dd>
</dl>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="symtab">Symbol Table</a> </div>
<div class="doc_text">

View File

@@ -45,8 +45,8 @@ process, and you should <b>only</b> try to do it if:</p>
<ol>
<li>you really, really, really can't use the binaries we distribute</li>
<li>you need GCC to fix some of the header files on your system</li>
<li>you are an elite GCC hacker.</li>
<li>you want to use the latest bits from CVS.</li>
</ol>
<p>We welcome patches to help make this process simpler.</p>
@@ -59,7 +59,7 @@ process, and you should <b>only</b> try to do it if:</p>
<!--=========================================================================-->
<div class="doc_text">
<p>If you are building LLVM and the C front-end under Cygwin, please note that
<p>If you are building LLVM and the GCC front-end under Cygwin, please note that
the LLVM and GCC makefiles do not correctly handle spaces in paths. To deal
with this issue, make sure that your LLVM and GCC source and build trees are
located in a top-level directory (like <tt>/cygdrive/c/llvm</tt> and
@@ -67,16 +67,25 @@ located in a top-level directory (like <tt>/cygdrive/c/llvm</tt> and
(which includes your "home directory", because it lives under the "Documents
and Settings" directory). We welcome patches to fix this issue.
</p>
<p>It has been found that the GCC 3.3.3 compiler provided with recent Cygwin
versions is incapable of compiling the LLVM CFE correctly. If your Cygwin
installation includes GCC 3.3.3, we <i>strongly</i> recommend that you download
GCC 3.4.3, build it separately, and use it for compiling LLVM CFE. This has been
shown to work correctly.</p>
<p>Some versions of Cygwin utilize an experimental version of GNU binutils that
will cause the GNU <tt>ld</tt> linker to fail an assertion when linking
components of the libstdc++. It is recommended that you replace the entire
binutils package with version 2.15 such that "<tt>ld --version</tt>" responds
with</p>
<pre>GNU ld version 2.15</pre>
not with:<br/>
<pre>GNU ld version 2.15.91 20040725</pre>
</div>
<!--=========================================================================-->
<div class="doc_subsection">
<a name="aix">Building under AIX</a>
</div>
<!--=========================================================================-->
<div class="doc_subsection"><a name="aix">Building under AIX</a></div>
<div class="doc_text">
<p>If you are building LLVM and the C front-end under AIX, do NOT use GNU
<p>If you are building LLVM and the GCC front-end under AIX, do NOT use GNU
Binutils. They are not stable under AIX and may produce incorrect and/or
invalid code. Instead, use the system assembler and linker.
</p>
@@ -91,12 +100,22 @@ invalid code. Instead, use the system assembler and linker.
<div class="doc_text">
<p>
<ol>
<li><p>Configure and build the LLVM libraries and tools using:</p>
<pre>
<li><p>Configure and build the LLVM libraries and tools. There are two ways to
do this: either with <i>objdir</i> == <i>srcdir</i> or
<i>objdir</i> != <i>srcdir</i>. It is recommended
that <i>srcdir</i> not be the same as <i>objdir</i>:</p>
<ul>
<li>With <i>objdir</i> != <i>srcdir</i>:<pre>
% cd <i>objdir</i>
% <i>srcdir</i>/configure --prefix=/some/path/you/can/install/to [options...]
% gmake tools-only
</pre></li>
<li>With <i>objdir</i> == <i>srcdir</i>:<pre>
% cd llvm
% ./configure --prefix=/some/path/you/can/install/to [options...]
% gmake tools-only
</pre>
</pre></li>
</ul>
<p>This will build all of the LLVM tools and libraries. The <tt>--prefix</tt>
option defaults to /usr/local (per configure standards) but unless you are a
system administrator, you probably won't be able to install LLVM there because
@@ -109,9 +128,11 @@ invalid code. Instead, use the system assembler and linker.
% set path = ( `cd llvm/Debug/bin &amp;&amp; pwd` $path )
</pre></li>
<li><p>Unpack the C/C++ front-end source into cfrontend/src.</p></li>
<li><p>Unpack the C/C++ front-end source into cfrontend/src, either by
untar'ing a cfrontend.source.tar.gz file or checking out CVS into this
directory.</p></li>
<li><p>Make "build" and "install" directories as siblings of the "src" tree.</p>
<li><p>Make "build" and "install" directories as siblings of the "src" tree:</p>
<pre>
% pwd
/usr/local/example/cfrontend/src
@@ -121,7 +142,7 @@ invalid code. Instead, use the system assembler and linker.
</pre></li>
<li><p>Configure, build, and install the C front-end:</p>
<li><p>Configure, build, and install the GCC front-end:</p>
<p>
<b>Linux/x86:</b><br>
@@ -132,9 +153,7 @@ invalid code. Instead, use the system assembler and linker.
<pre>
% cd build
% ../src/configure --prefix=$CFEINSTALL --disable-threads --disable-nls \
--disable-shared --enable-languages=c,c++
% gmake
% setenv LLVM_LIB_SEARCH_PATH `pwd`/gcc
--disable-shared --enable-languages=c,c++ --program-prefix=llvm-
% gmake all; gmake install
</pre>
@@ -143,17 +162,23 @@ invalid code. Instead, use the system assembler and linker.
<pre>
% cd build
% ../src/configure --prefix=$CFEINSTALL --disable-threads --disable-nls \
--disable-shared --enable-languages=c,c++ --disable-c-mbchar
% gmake
% setenv LLVM_LIB_SEARCH_PATH `pwd`/gcc
--disable-shared --enable-languages=c,c++ --disable-c-mbchar \
--program-prefix=llvm-
% gmake all; gmake install
</pre>
<p><b>Solaris/SPARC:</b></p>
<p>
For Solaris/SPARC, LLVM only supports the SPARC V9 architecture. Therefore,
the configure command line should specify sparcv9, as shown below. Also,
The GCC front-end can be configured for either SPARC V8 (32 bit) or SPARC V9 (64
bit). This changes, among other things, the sizes of integer types and the
macros defined for conditional compilation.
</p>
<p>
The SPARC V8 backend is still beta quality software. Unless you are working on
the SPARC V8 backend, you should specify sparcv9 on the configure command line,
as shown below. Also,
note that Solaris has trouble with various wide (multibyte) character
functions from C as referenced from C++, so we typically configure with
--disable-c-mbchar (cf. <a href="http://llvm.cs.uiuc.edu/PR206">Bug 206</a>).
@@ -163,9 +188,7 @@ functions from C as referenced from C++, so we typically configure with
% cd build
% ../src/configure --prefix=$CFEINSTALL --disable-threads --disable-nls \
--disable-shared --enable-languages=c,c++ --host=sparcv9-sun-solaris2.8 \
--disable-c-mbchar
% gmake
% setenv LLVM_LIB_SEARCH_PATH `pwd`/gcc
--disable-c-mbchar --program-prefix=llvm-
% gmake all; gmake install
</pre>
@@ -176,7 +199,7 @@ functions from C as referenced from C++, so we typically configure with
<ul>
<li><p><b>Fix 1:</b> If you have system header files that include
inline assembly, you may have to modify them to remove the inline
assembly, and install the modified versions in
assembly and install the modified versions in
<code>$CFEINSTALL/lib/gcc/<i>target-triplet</i>/3.4-llvm/include</code>.</li>
<li><b>Fix 2:</b> If you are building the C++ front-end on a CPU we
@@ -186,10 +209,10 @@ functions from C as referenced from C++, so we typically configure with
and apply a patch so that it does not use inline assembly.</li>
</ul>
<p><b>Porting to a new architecture:</b> If you are porting the new front-end
to a new architecture, or compiling in a different configuration that we have
previously, there are probably several changes you will have to make to the GCC
target to get it to work correctly. These include:<p>
<p><b>Porting to a new architecture:</b> If you are porting the front-end
to a new architecture or compiling in a configuration that we have
not tried previously, there are probably several changes you will have to make
to the GCC target to get it to work correctly. These include:<p>
<ul>
<li>Often targets include special assembler or linker flags which
@@ -214,39 +237,37 @@ functions from C as referenced from C++, so we typically configure with
</ul>
</li>
<li><p>Go back into the LLVM source tree proper. Rerun configure, using
the <code>--with-llvmgccdir=$CFEINSTALL</code> option to specify the path
to the newly built C front-end.</p></li>
<li><p>Put <tt>$CFEINSTALL/bin</tt> into your <tt>PATH</tt> environment
variable.</p>
<ul>
<li>sh: <tt>export PATH=$CFEINSTALL/bin:$PATH</tt></li>
<li>csh: <tt>setenv PATH $CFEINSTALL/bin:$PATH</tt></li>
</ul>
</li>
<li><p>If you edited header files during the C/C++ front-end build as
described in "Fix 1" above, you must now copy those header files from
<code>$CFEINSTALL/<i>target-triplet</i>/sys-include</code> to
<code>$CFEINSTALL/lib/gcc/<i>target-triplet</i>/3.4-llvm/include</code>.
(This should be the "include" directory in the same directory as the
libgcc.a library, which you can find by running
<code>$CFEINSTALL/bin/gcc --print-libgcc-file-name</code>.)</p></li>
<li><p>Go back into the LLVM source tree proper. Rerun configure, using
the same options as the last time. This will cause the configuration to now find
the newly built llvm-gcc and llvm-g++ executables. </p></li>
<li><p>Rebuild your CVS tree. This shouldn't cause the whole thing to be
rebuilt, but it should build the runtime libraries. After the tree is
built, install the runtime libraries into your C front-end build tree.
These are the commands you need.</p>
built, install the runtime libraries into your GCC front-end build tree.
These are the commands you need:</p>
<pre>
% gmake
% mkdir $CFEINSTALL/bytecode-libs
% gmake -C runtime install-bytecode
% setenv LLVM_LIB_SEARCH_PATH $CFEINSTALL/bytecode-libs
</pre></li>
<li><p>Optionally, build a symbol table for the newly installed runtime
libraries. Although this step is optional, you are encouraged to do this as the
symbol tables will make a significant difference in your link times. Use
the <tt>llvm-ranlib</tt> tool to do this, as follows:</p>
libraries. Although this step is optional, you are strongly encouraged to
do this as the symbol tables will make a significant difference in your
link times. Use the <tt>llvm-ranlib</tt> tool to do this, as follows:</p>
<pre>
% cd $CFEINSTALL/lib
% llvm-ranlib libiberty.a
% llvm-ranlib libstdc++.a
% llvm-ranlib libsupc++.a
% cd $CFEINSTALL/lib/<i>target-triplet</i>/3.4-llvm
% cd $CFEINSTALL/lib/gcc/<i>target-triplet</i>/3.4-llvm
% llvm-ranlib libgcc.a
% llvm-ranlib libgcov.a
</pre>
@@ -254,9 +275,9 @@ the <tt>llvm-ranlib</tt> tool to do this, as follows:</p>
<li><p>Test the newly-installed C frontend by one or more of the
following means:</p>
<ul>
<li> running the feature &amp; regression tests via <tt>make check</tt></li>
<li> compiling and running a "hello, LLVM" program in C and C++.</li>
<li> running the tests under <tt>test/Programs</tt> using <code>gmake -C
test/Programs</code></li>
<li> running the tests found in the <tt>llvm-test</tt> CVS module</li>
</ul></li>
</ol>
</div>
@@ -279,7 +300,7 @@ The software also has the following additional copyrights:
<pre>
Copyright (c) 2003, 2004 University of Illinois at Urbana-Champaign.
Copyright (c) 2003, 2004, 2005 University of Illinois at Urbana-Champaign.
All rights reserved.
Developed by:

View File

@@ -23,6 +23,7 @@
<ul>
<li><a href="#targetmachine">The <tt>TargetMachine</tt> class</a></li>
<li><a href="#targetdata">The <tt>TargetData</tt> class</a></li>
<li><a href="#targetlowering">The <tt>TargetLowering</tt> class</a></li>
<li><a href="#mregisterinfo">The <tt>MRegisterInfo</tt> class</a></li>
<li><a href="#targetinstrinfo">The <tt>TargetInstrInfo</tt> class</a></li>
<li><a href="#targetframeinfo">The <tt>TargetFrameInfo</tt> class</a></li>
@@ -35,6 +36,22 @@
</ul>
</li>
<li><a href="#codegenalgs">Target-independent code generation algorithms</a>
<ul>
<li><a href="#instselect">Instruction Selection</a>
<ul>
<li><a href="#selectiondag_intro">Introduction to SelectionDAGs</a></li>
<li><a href="#selectiondag_process">SelectionDAG Code Generation
Process</a></li>
<li><a href="#selectiondag_build">Initial SelectionDAG
Construction</a></li>
<li><a href="#selectiondag_legalize">SelectionDAG Legalize Phase</a></li>
<li><a href="#selectiondag_optimize">SelectionDAG Optimization
Phase</a></li>
<li><a href="#selectiondag_select">SelectionDAG Select Phase</a></li>
<li><a href="#selectiondag_future">Future directions for the
SelectionDAG</a></li>
</ul></li>
</ul>
</li>
<li><a href="#targetimpls">Target description implementations</a>
<ul>
@@ -120,7 +137,7 @@ classes, ensuring that it is portable.
code generator and the set of reusable components that can be used to build
target-specific backends. The two most important interfaces (<a
href="#targetmachine"><tt>TargetMachine</tt></a> and <a
href="#targetdata"><tt>TargetData</tt></a> classes) are the only ones that are
href="#targetdata"><tt>TargetData</tt></a>) are the only ones that are
required to be defined for a backend to fit into the LLVM system, but the others
must be defined if the reusable code generator components are going to be
used.</p>
@@ -159,41 +176,43 @@ predictable completion date.</p>
<div class="doc_text">
<p>The LLVM target-indendent code generator is designed to support efficient and
<p>The LLVM target-independent code generator is designed to support efficient and
quality code generation for standard register-based microprocessors. Code
generation in this model is divided into the following stages:</p>
<ol>
<li><b>Instruction Selection</b> - Determining an efficient implementation of the
input LLVM code in the target instruction set. This stage produces the initial
code for the program in the target instruction set, then makes use of virtual
registers in SSA form and physical registers that represent any required
register assignments due to target constraints or calling conventions.</li>
<li><b><a href="#instselect">Instruction Selection</a></b> - Determining an
efficient implementation of the input LLVM code in the target instruction set.
This stage produces the initial code for the program in the target instruction
set, then makes use of virtual registers in SSA form and physical registers that
represent any required register assignments due to target constraints or calling
conventions.</li>
<li><b>SSA-based Machine Code Optimizations</b> - This (optional) stage consists
of a series of machine-code optimizations that operate on the SSA-form produced
by the instruction selector. Optimizations like modulo-scheduling, normal
scheduling, or peephole optimization work here.</li>
<li><b><a href="#ssamco">SSA-based Machine Code Optimizations</a></b> - This
optional stage consists of a series of machine-code optimizations that
operate on the SSA-form produced by the instruction selector. Optimizations
like modulo-scheduling, normal scheduling, or peephole optimization work here.
</li>
<li><b>Register Allocation</b> - The target code is transformed from an infinite
virtual register file in SSA form to the concrete register file used by the
target. This phase introduces spill code and eliminates all virtual register
references from the program.</li>
<li><b><a name="#regalloc">Register Allocation</a></b> - The
target code is transformed from an infinite virtual register file in SSA form
to the concrete register file used by the target. This phase introduces spill
code and eliminates all virtual register references from the program.</li>
<li><b>Prolog/Epilog Code Insertion</b> - Once the machine code has been
generated for the function and the amount of stack space required is known (used
for LLVM alloca's and spill slots), the prolog and epilog code for the function
can be inserted and "abstract stack location references" can be eliminated.
This stage is responsible for implementing optimizations like frame-pointer
elimination and stack packing.</li>
<li><b><a name="#proepicode">Prolog/Epilog Code Insertion</a></b> - Once the
machine code has been generated for the function and the amount of stack space
required is known (used for LLVM alloca's and spill slots), the prolog and
epilog code for the function can be inserted and "abstract stack location
references" can be eliminated. This stage is responsible for implementing
optimizations like frame-pointer elimination and stack packing.</li>
<li><b>Late Machine Code Optimizations</b> - Optimizations that operate on
"final" machine code can go here, such as spill code scheduling and peephole
optimizations.</li>
<li><b><a name="latemco">Late Machine Code Optimizations</a></b> - Optimizations
that operate on "final" machine code can go here, such as spill code scheduling
and peephole optimizations.</li>
<li><b>Code Emission</b> - The final stage actually outputs the code for
the current function, either in the target assembler format or in machine
code.</li>
<li><b><a name="codemission">Code Emission</a></b> - The final stage actually
puts out the code for the current function, either in the target assembler
format or in machine code.</li>
</ol>
@@ -205,7 +224,7 @@ expansion and
aggressive iterative peephole optimization are much slower. This design
permits efficient compilation (important for JIT environments) and
aggressive optimization (used when generating code offline) by allowing
components of varying levels of sophisication to be used for any step of
components of varying levels of sophistication to be used for any step of
compilation.</p>
<p>
@@ -227,11 +246,13 @@ targets with unusual requirements can be supported with custom passes as needed.
<p>The target description classes require a detailed description of the target
architecture. These target descriptions often have a large amount of common
information (e.g., an add instruction is almost identical to a sub instruction).
information (e.g., an <tt>add</tt> instruction is almost identical to a
<tt>sub</tt> instruction).
In order to allow the maximum amount of commonality to be factored out, the LLVM
code generator uses the <a href="TableGenFundamentals.html">TableGen</a> tool to
describe big chunks of the target machine, which allows the use of domain- and
target-specific abstractions to reduce the amount of repetition.
describe big chunks of the target machine, which allows the use of
domain-specific and target-specific abstractions to reduce the amount of
repetition.
</p>
</div>
@@ -246,11 +267,11 @@ target-specific abstractions to reduce the amount of repetition.
<p>The LLVM target description classes (which are located in the
<tt>include/llvm/Target</tt> directory) provide an abstract description of the
target machine, independent of any particular client. These classes are
designed to capture the <i>abstract</i> properties of the target (such as what
instruction and registers it has), and do not incorporate any particular pieces
of code generation algorithms (these interfaces do not take interference graphs
as inputs or other algorithm-specific data structures).</p>
target machine; independent of any particular client. These classes are
designed to capture the <i>abstract</i> properties of the target (such as the
instructions and registers it has), and do not incorporate any particular pieces
of code generation algorithms. These interfaces do not take interference graphs
as inputs or other algorithm-specific data structures.</p>
<p>All of the target description classes (except the <tt><a
href="#targetdata">TargetData</a></tt> class) are designed to be subclassed by
@@ -270,8 +291,9 @@ should be implemented by the target.</p>
<p>The <tt>TargetMachine</tt> class provides virtual methods that are used to
access the target-specific implementations of the various target description
classes (with the <tt>getInstrInfo</tt>, <tt>getRegisterInfo</tt>,
<tt>getFrameInfo</tt>, ... methods). This class is designed to be specialized by
classes via the <tt>get*Info</tt> methods (<tt>getInstrInfo</tt>,
<tt>getRegisterInfo</tt>, <tt>getFrameInfo</tt>, etc.). This class is
designed to be specialized by
a concrete target implementation (e.g., <tt>X86TargetMachine</tt>) which
implements the various virtual methods. The only required target description
class is the <a href="#targetdata"><tt>TargetData</tt></a> class, but if the
@@ -289,13 +311,35 @@ implemented as well.</p>
<div class="doc_text">
<p>The <tt>TargetData</tt> class is the only required target description class,
and it is the only class that is not extensible (it cannot be derived from). It
specifies information about how the target lays out memory for structures, the
alignment requirements for various data types, the size of pointers in the
target, and whether the target is little- or big-endian.</p>
and it is the only class that is not extensible. You cannot derived a new
class from it. <tt>TargetData</tt> specifies information about how the target
lays out memory for structures, the alignment requirements for various data
types, the size of pointers in the target, and whether the target is
little-endian or big-endian.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="targetlowering">The <tt>TargetLowering</tt> class</a>
</div>
<div class="doc_text">
<p>The <tt>TargetLowering</tt> class is used by SelectionDAG based instruction
selectors primarily to describe how LLVM code should be lowered to SelectionDAG
operations. Among other things, this class indicates:
<ul><li>an initial register class to use for various ValueTypes,</li>
<li>which operations are natively supported by the target machine,</li>
<li>the return type of setcc operations, and</li>
<li>the type to use for shift amounts, etc</li>.
</ol></p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
@@ -378,14 +422,14 @@ representation for machine code, as well as a register allocated, non-SSA form.
<p>Target machine instructions are represented as instances of the
<tt>MachineInstr</tt> class. This class is an extremely abstract way of
representing machine instructions. In particular, all it keeps track of is
an opcode number and some number of operands.</p>
representing machine instructions. In particular, it only keeps track of
an opcode number and a set of operands.</p>
<p>The opcode number is an simple unsigned number that only has meaning to a
<p>The opcode number is a simple unsigned number that only has meaning to a
specific backend. All of the instructions for a target should be defined in
the <tt>*InstrInfo.td</tt> file for the target, and the opcode enum values
are autogenerated from this description. The <tt>MachineInstr</tt> class does
not have any information about how to intepret the instruction (i.e., what the
the <tt>*InstrInfo.td</tt> file for the target. The opcode enum values
are auto-generated from this description. The <tt>MachineInstr</tt> class does
not have any information about how to interpret the instruction (i.e., what the
semantics of the instruction are): for that you must refer to the
<tt><a href="#targetinstrinfo">TargetInstrInfo</a></tt> class.</p>
@@ -396,15 +440,15 @@ In addition, a machine operand should be marked as a def or a use of the value
<p>By convention, the LLVM code generator orders instruction operands so that
all register definitions come before the register uses, even on architectures
that are normally printed in other orders. For example, the sparc add
that are normally printed in other orders. For example, the SPARC add
instruction: "<tt>add %i1, %i2, %i3</tt>" adds the "%i1", and "%i2" registers
and stores the result into the "%i3" register. In the LLVM code generator,
the operands should be stored as "<tt>%i3, %i1, %i2</tt>": with the destination
first.</p>
<p>Keeping destination operands at the beginning of the operand list has several
advantages. In particular, the debugging printer will print the instruction
like this:</p>
<p>Keeping destination (definition) operands at the beginning of the operand
list has several advantages. In particular, the debugging printer will print
the instruction like this:</p>
<pre>
%r3 = add %i1, %i2
@@ -453,17 +497,18 @@ instructions. Usage of the <tt>BuildMI</tt> functions look like this:
<p>
The key thing to remember with the <tt>BuildMI</tt> functions is that you have
to specify the number of operands that the machine instruction will take
(allowing efficient memory allocation). Also, if operands default to be uses
of values, not definitions. If you need to add a definition operand (other
than the optional destination register), you must explicitly mark it as such.
to specify the number of operands that the machine instruction will take. This
allows for efficient memory allocation. You also need to specify if operands
default to be uses of values, not definitions. If you need to add a definition
operand (other than the optional destination register), you must explicitly
mark it as such.
</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<a name="fixedregs">Fixed (aka preassigned) registers</a>
<a name="fixedregs">Fixed (preassigned) registers</a>
</div>
<div class="doc_text">
@@ -472,7 +517,7 @@ than the optional destination register), you must explicitly mark it as such.
presence of fixed registers. In particular, there are often places in the
instruction stream where the register allocator <em>must</em> arrange for a
particular value to be in a particular register. This can occur due to
limitations in the instruction set (e.g., the X86 can only do a 32-bit divide
limitations of the instruction set (e.g., the X86 can only do a 32-bit divide
with the <tt>EAX</tt>/<tt>EDX</tt> registers), or external factors like calling
conventions. In any case, the instruction selector should emit code that
copies a virtual register into or out of a physical register when needed.</p>
@@ -503,7 +548,7 @@ and ret (use
ret
</pre>
<p>By the end of code generation, the register allocator has coallesced
<p>By the end of code generation, the register allocator has coalesced
the registers and deleted the resultant identity moves, producing the
following code:</p>
@@ -533,7 +578,7 @@ register.</p>
<div class="doc_text">
<p><tt>MachineInstr</tt>'s are initially instruction selected in SSA-form, and
<p><tt>MachineInstr</tt>'s are initially selected in SSA-form, and
are maintained in SSA-form until register allocation happens. For the most
part, this is trivially simple since LLVM is already in SSA form: LLVM PHI nodes
become machine code PHI nodes, and virtual registers are only allowed to have a
@@ -544,6 +589,318 @@ are no virtual registers left in the code.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="codegenalgs">Target-independent code generation algorithms</a>
</div>
<!-- *********************************************************************** -->
<div class="doc_text">
<p>This section documents the phases described in the <a
href="high-level-design">high-level design of the code generator</a>. It
explains how they work and some of the rationale behind their design.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="instselect">Instruction Selection</a>
</div>
<div class="doc_text">
<p>
Instruction Selection is the process of translating LLVM code presented to the
code generator into target-specific machine instructions. There are several
well-known ways to do this in the literature. In LLVM there are two main forms:
the old-style 'simple' instruction selector (which effectively peephole selects
each LLVM instruction into a series of machine instructions), and the new
SelectionDAG based instruction selector.
</p>
<p>The 'simple' instruction selectors are tedious to write, require a lot of
boiler plate code, and are difficult to get correct. Additionally, any
optimizations written for a simple instruction selector cannot be used by other
targets. For this reason, LLVM is moving to a new SelectionDAG based
instruction selector, which is described in this section. If you are starting a
new port, we recommend that you write the instruction selector using the
SelectionDAG infrastructure.</p>
<p>In time, most of the target-specific code for instruction selection will be
auto-generated from the target description (<tt>*.td</tt>) files. For now,
however, the <a href="#selectiondag_select">Select Phase</a> must still be
written by hand.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<a name="selectiondag_intro">Introduction to SelectionDAGs</a>
</div>
<div class="doc_text">
<p>
The SelectionDAG provides an abstraction for code representation in a way that
is amenable to instruction selection using automatic techniques
(e.g. dynamic-programming based optimal pattern matching selectors), It is also
well suited to other phases of code generation; in particular, instruction scheduling. Additionally, the SelectionDAG provides a host representation where a
large variety of very-low-level (but target-independent)
<a href="#selectiondag_optimize">optimizations</a> may be
performed: ones which require extensive information about the instructions
efficiently supported by the target.
</p>
<p>
The SelectionDAG is a Directed-Acyclic-Graph whose nodes are instances of the
<tt>SDNode</tt> class. The primary payload of the <tt>SDNode</tt> is its
operation code (Opcode) that indicates what operation the node performs.
The various operation node types are described at the top of the
<tt>include/llvm/CodeGen/SelectionDAGNodes.h</tt> file. Depending on the
operation, nodes may contain additional information (e.g. the condition code
for a SETCC node) contained in a derived class.</p>
<p>Although most operations define a single value, each node in the graph may
define multiple values. For example, a combined div/rem operation will define
both the dividend and the remainder. Many other situations require multiple
values as well. Each node also has some number of operands, which are edges
to the node defining the used value. Because nodes may define multiple values,
edges are represented by instances of the <tt>SDOperand</tt> class, which is
a &lt;SDNode, unsigned&gt; pair, indicating the node and result
value being used, respectively. Each value produced by an SDNode has an
associated MVT::ValueType, indicating what type the value is.
</p>
<p>
SelectionDAGs contain two different kinds of values: those that represent data
flow and those that represent control flow dependencies. Data values are simple
edges with an integer or floating point value type. Control edges are
represented as "chain" edges which are of type MVT::Other. These edges provide
an ordering between nodes that have side effects (such as
loads/stores/calls/return/etc). All nodes that have side effects should take a
token chain as input and produce a new one as output. By convention, token
chain inputs are always operand #0, and chain results are always the last
value produced by an operation.</p>
<p>
A SelectionDAG has designated "Entry" and "Root" nodes. The Entry node is
always a marker node with an Opcode of ISD::EntryToken. The Root node is the
final side-effecting node in the token chain. For example, in a single basic
block function, this would be the return node.
</p>
<p>
One important concept for SelectionDAGs is the notion of a "legal" vs. "illegal"
DAG. A legal DAG for a target is one that only uses supported operations and
supported types. On PowerPC, for example, a DAG with any values of i1, i8, i16,
or i64 type would be illegal. The <a href="#selectiondag_legalize">legalize</a>
phase is responsible for turning an illegal DAG into a legal DAG.
</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<a name="selectiondag_process">SelectionDAG Instruction Selection Process</a>
</div>
<div class="doc_text">
<p>
SelectionDAG-based instruction selection consists of the following steps:
</p>
<ol>
<li><a href="#selectiondag_build">Build initial DAG</a> - This stage performs
a simple translation from the input LLVM code to an illegal SelectionDAG.
</li>
<li><a href="#selectiondag_optimize">Optimize SelectionDAG</a> - This stage
performs simple optimizations on the SelectionDAG to simplify it and
recognize meta instructions (like rotates and div/rem pairs) for
targets that support these meta operations. This makes the resultant code
more efficient and the 'select instructions from DAG' phase (below) simpler.
</li>
<li><a href="#selectiondag_legalize">Legalize SelectionDAG</a> - This stage
converts the illegal SelectionDAG to a legal SelectionDAG, by eliminating
unsupported operations and data types.</li>
<li><a href="#selectiondag_optimize">Optimize SelectionDAG (#2)</a> - This
second run of the SelectionDAG optimized the newly legalized DAG, to
eliminate inefficiencies introduced by legalization.</li>
<li><a href="#selectiondag_select">Select instructions from DAG</a> - Finally,
the target instruction selector matches the DAG operations to target
instructions, emitting them and building the MachineFunction being
compiled.</li>
</ol>
<p>After all of these steps are complete, the SelectionDAG is destroyed and the
rest of the code generation passes are run.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<a name="selectiondag_build">Initial SelectionDAG Construction</a>
</div>
<div class="doc_text">
<p>
The initial SelectionDAG is naively peephole expanded from the LLVM input by
the <tt>SelectionDAGLowering</tt> class in the SelectionDAGISel.cpp file. The
intent of this pass is to expose as much low-level, target-specific details
to the SelectionDAG as possible. This pass is mostly hard-coded (e.g. an LLVM
add turns into an SDNode add while a geteelementptr is expanded into the obvious
arithmetic). This pass requires target-specific hooks to lower calls and
returns, varargs, etc. For these features, the TargetLowering interface is
used.
</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<a name="selectiondag_legalize">SelectionDAG Legalize Phase</a>
</div>
<div class="doc_text">
<p>The Legalize phase is in charge of converting a DAG to only use the types and
operations that are natively supported by the target. This involves two major
tasks:</p>
<ol>
<li><p>Convert values of unsupported types to values of supported types.</p>
<p>There are two main ways of doing this: promoting a small type to a larger
type (e.g. f32 -&gt; f64, or i16 -&gt; i32), and breaking up large
integer types
to smaller ones (e.g. implementing i64 with i32 operations where
possible). Type conversions can insert sign and zero extensions as
needed to make sure that the final code has the same behavior as the
input.</p>
</li>
<li><p>Eliminate operations that are not supported by the target in a supported
type.</p>
<p>Targets often have wierd constraints, such as not supporting every
operation on every supported datatype (e.g. X86 does not support byte
conditional moves). Legalize takes care of either open-coding another
sequence of operations to emulate the operation (this is known as
expansion), promoting to a larger type that supports the operation
(promotion), or using a target-specific hook to implement the
legalization.</p>
</li>
</ol>
<p>
Instead of using a Legalize pass, we could require that every target-specific
<a href="#selectiondag_optimize">selector</a> supports and expands every
operator and type even if they are not supported and may require many
instructions to implement (in fact, this is the approach taken by the
"simple" selectors). However, using a Legalize pass allows all of the
cannonicalization patterns to be shared across targets which makes it very
easy to optimize the cannonicalized code because it is still in the form of
a DAG.
</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<a name="selectiondag_optimize">SelectionDAG Optimization Phase</a>
</div>
<div class="doc_text">
<p>
The SelectionDAG optimization phase is run twice for code generation: once
immediately after the DAG is built and once after legalization. The first run
of the pass allows the initial code to be cleaned up (e.g. performing
optimizations that depend on knowing that the operators have restricted type
inputs). The second run of the pass cleans up the messy code generated by the
Legalize pass, allowing Legalize to be very simple since it can ignore many
special cases.
</p>
<p>
One important class of optimizations that this pass will do in the future is
optimizing inserted sign and zero extension instructions. Here are some good
papers on the subject:</p>
<p>
"<a href="http://www.eecs.harvard.edu/~nr/pubs/widen-abstract.html">Widening
integer arithmetic</a>"<br>
Kevin Redwine and Norman Ramsey<br>
International Conference on Compiler Construction (CC) 2004
</p>
<p>
"<a href="http://portal.acm.org/citation.cfm?doid=512529.512552">Effective
sign extension elimination</a>"<br>
Motohiro Kawahito, Hideaki Komatsu, and Toshio Nakatani<br>
Proceedings of the ACM SIGPLAN 2002 Conference on Programming Language Design
and Implementation.
</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<a name="selectiondag_select">SelectionDAG Select Phase</a>
</div>
<div class="doc_text">
<p>The Select phase is the bulk of the target-specific code for instruction
selection. This phase takes a legal SelectionDAG as input, and does simple
pattern matching on the DAG to generate code. In time, the Select phase will
be automatically generated from the target's InstrInfo.td file, which is why we
want to make the Select phase as simple and mechanical as possible.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<a name="selectiondag_future">Future directions for the SelectionDAG</a>
</div>
<div class="doc_text">
<ol>
<li>Optional whole-function selection.</li>
<li>Select is a graph translation phase.</li>
<li>Place the machine instructions resulting from Select according to register
pressure or a schedule.</li>
<li>DAG Scheduling.</li>
<li>Auto-generate the Select phase from the target description (*.td) files.
</li>
</ol>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="ssamco">SSA-based Machine Code Optimizations</a>
</div>
<div class="doc_text"><p>To Be Written</p></div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="regalloc">Register Allocation</a>
</div>
<div class="doc_text"><p>To Be Written</p></div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="proepicode">Prolog/Epilog Code Insertion</a>
</div>
<div class="doc_text"><p>To Be Written</p></div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="latemco">Late Machine Code Optimizations</a>
</div>
<div class="doc_text"><p>To Be Written</p></div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="codemission">Code Emission</a>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="targetimpls">Target description implementations</a>
@@ -552,7 +909,7 @@ are no virtual registers left in the code.</p>
<div class="doc_text">
<p>This section of the document explains any features or design decisions that
<p>This section of the document explains features or design decisions that
are specific to the code generator for a particular target.</p>
</div>
@@ -570,7 +927,7 @@ The X86 code generator lives in the <tt>lib/Target/X86</tt> directory. This
code generator currently targets a generic P6-like processor. As such, it
produces a few P6-and-above instructions (like conditional moves), but it does
not make use of newer features like MMX or SSE. In the future, the X86 backend
will have subtarget support added for specific processor families and
will have sub-target support added for specific processor families and
implementations.</p>
</div>
@@ -582,8 +939,7 @@ implementations.</p>
<div class="doc_text">
<p>
The x86 has a very, uhm, flexible, way of accessing memory. It is capable of
<p>The x86 has a very flexible way of accessing memory. It is capable of
forming memory addresses of the following expression directly in integer
instructions (which use ModR/M addressing):</p>
@@ -591,9 +947,9 @@ instructions (which use ModR/M addressing):</p>
Base+[1,2,4,8]*IndexReg+Disp32
</pre>
<p>Wow, that's crazy. In order to represent this, LLVM tracks no less than 4
operands for each memory operand of this form. This means that the "load" form
of 'mov' has the following "Operands" in this order:</p>
<p>In order to represent this, LLVM tracks no less than 4 operands for each
memory operand of this form. This means that the "load" form of 'mov' has the
following <tt>MachineOperand</tt>s in this order:</p>
<pre>
Index: 0 | 1 2 3 4
@@ -601,8 +957,8 @@ Meaning: DestReg, | BaseReg, Scale, IndexReg, Displacement
OperandTy: VirtReg, | VirtReg, UnsImm, VirtReg, SignExtImm
</pre>
<p>Stores and all other instructions treat the four memory operands in the same
way, in the same order.</p>
<p>Stores, and all other instructions, treat the four memory operands in the
same way, in the same order.</p>
</div>
@@ -614,9 +970,8 @@ way, in the same order.</p>
<div class="doc_text">
<p>
An instruction name consists of the base name, a default operand size
followed by a character per operand with an optional special size. For
example:</p>
An instruction name consists of the base name, a default operand size, and a
a character per operand with an optional special size. For example:</p>
<p>
<tt>ADD8rr</tt> -&gt; add, 8-bit register, 8-bit register<br>

View File

@@ -7,53 +7,88 @@
#
##===----------------------------------------------------------------------===##
ifdef BUILD_FOR_WEBSITE
# This special case is for keeping the CommandGuide on the LLVM web site
# up to date automatically as the documents are checked in. It must build
# the POD files to HTML only and keep them in the src directories. It must also
# build in an unconfigured tree, hence the ifdef. To use this, run
# make -s BUILD_FOR_WEBSITE=1 inside the cvs commit script.
POD := $(wildcard *.pod)
HTML := $(patsubst %.pod, html/%.html, $(POD))
MAN := $(patsubst %.pod, man/man1/%.1, $(POD))
PS := $(patsubst %.pod, ps/%.ps, $(POD))
all: $(HTML) $(MAN) $(PS)
.SUFFIXES:
.SUFFIXES: .html .pod .1 .ps
html/%.html: %.pod
pod2html --css=manpage.css --htmlroot=. \
--podpath=. --noindex --infile=$< --outfile=$@ --title=$*
man/man1/%.1: %.pod
pod2man --release=1.5 --center="LLVM Command Guide" $< $@
ps/%.ps: man/man1/%.1
groff -Tps -man $< > $@
clean:
rm -f pod2htm*.*~~ $(HTML) $(MAN) $(PS)
else
LEVEL := ../..
include $(LEVEL)/Makefile.common
POD := $(wildcard $(BUILD_SRC_DIR)/*.pod)
POD := $(wildcard $(PROJ_SRC_DIR)/*.pod)
EXTRA_DIST := $(POD) index.html
HTML = $(patsubst $(BUILD_SRC_DIR)/%.pod, $(BUILD_OBJ_DIR)/%.html, $(POD))
MAN = $(patsubst $(BUILD_SRC_DIR)/%.pod, $(BUILD_OBJ_DIR)/%.1, $(POD))
PS = $(patsubst $(BUILD_SRC_DIR)/%.pod, $(BUILD_OBJ_DIR)/%.ps, $(POD))
HTML = $(patsubst $(PROJ_SRC_DIR)/%.pod, $(PROJ_OBJ_DIR)/%.html, $(POD))
MAN = $(patsubst $(PROJ_SRC_DIR)/%.pod, $(PROJ_OBJ_DIR)/%.1, $(POD))
PS = $(patsubst $(PROJ_SRC_DIR)/%.pod, $(PROJ_OBJ_DIR)/%.ps, $(POD))
.SUFFIXES:
.SUFFIXES: .html .pod .1 .ps
$(HTML) : html/.dir man/.dir man/man1/.dir ps/.dir
$(BUILD_OBJ_DIR)/%.html: %.pod
html: $(HTML)
$(PROJ_OBJ_DIR)/%.html: %.pod
$(POD2HTML) --css=manpage.css --htmlroot=. --podpath=. \
--noindex --infile=$< --outfile=$@ --title=$*
$(BUILD_OBJ_DIR)/%.1: %.pod
$(POD2MAN) --release=$(PACKAGE_VERSION) \
$(PROJ_OBJ_DIR)/%.1: %.pod
$(POD2MAN) --release=$(LLVMVersion) \
--center="LLVM Command Guide" $< $@
$(BUILD_OBJ_DIR)/%.ps: $(BUILD_OBJ_DIR)/%.1
$(PROJ_OBJ_DIR)/%.ps: $(PROJ_OBJ_DIR)/%.1
$(GROFF) -Tps -man $< > $@
clean-local::
$(Verb) $(RM) -f pod2htm*.*~~ $(HTML) $(MAN) $(PS)
HTML_DIR := $(LLVM_DOCSDIR)/html/CommandGuide
MAN_DIR := $(LLVM_MANDIR)/man1
PS_DIR := $(LLVM_DOCSDIR)/ps
HTML_DIR := $(PROJ_docsdir)/html/CommandGuide
MAN_DIR := $(PROJ_mandir)/man1
PS_DIR := $(PROJ_docsdir)/ps
install-local:: $(HTML) $(MAN) $(PS)
$(Echo) Installing HTML CommandGuide Documentation
$(Verb) $(INSTALL) -d $(HTML_DIR)
$(Verb) $(INSTALL) -C $(HTML) $(HTML_DIR)
$(Verb) $(INSTALL) -C $(BUILD_SRC_DIR)/index.html $(HTML_DIR)
$(Verb) $(INSTALL) -C $(BUILD_SRC_DIR)/manpage.css $(HTML_DIR)
$(Verb) $(MKDIR) $(HTML_DIR)
$(Verb) $(DataInstall) $(HTML) $(HTML_DIR)
$(Verb) $(DataInstall) $(PROJ_SRC_DIR)/index.html $(HTML_DIR)
$(Verb) $(DataInstall) $(PROJ_SRC_DIR)/manpage.css $(HTML_DIR)
$(Echo) Installing MAN CommandGuide Documentation
$(Verb) $(INSTALL) -d $(MAN_DIR)
$(Verb) $(INSTALL) -C $(MAN) $(MAN_DIR)
$(Verb) $(MKDIR) $(MAN_DIR)
$(Verb) $(DataInstall) $(MAN) $(MAN_DIR)
$(Echo) Installing PS CommandGuide Documentation
$(Verb) $(INSTALL) -d $(PS_DIR)
$(Verb) $(INSTALL) -C $(PS) $(PS_DIR)
$(Verb) $(MKDIR) $(PS_DIR)
$(Verb) $(DataInstall) $(PS) $(PS_DIR)
uninstall-local::
$(Echo) Uninstalling Documentation
@@ -62,3 +97,5 @@ uninstall-local::
printvars::
$(Echo) "POD : " '$(POD)'
$(Echo) "HTML : " '$(HTML)'
endif

View File

@@ -15,140 +15,9 @@ B<bugpoint> narrows down the source of problems in LLVM tools and passes. It
can be used to debug three types of failures: optimizer crashes, miscompilations
by optimizers, or bad native code generation (including problems in the static
and JIT compilers). It aims to reduce large test cases to small, useful ones.
For example, if B<gccas> crashes while optimizing a file, it will identify the
optimization (or combination of optimizations) that causes the crash, and reduce
the file down to a small example which triggers the crash.
=head2 Design Philosophy
B<bugpoint> is designed to be a useful tool without requiring any hooks into the
LLVM infrastructure at all. It works with any and all LLVM passes and code
generators, and does not need to "know" how they work. Because of this, it may
appear to do stupid things or miss obvious simplifications. B<bugpoint> is also
designed to trade off programmer time for computer time in the
compiler-debugging process; consequently, it may take a long period of
(unattended) time to reduce a test case, but we feel it is still worth it. Note
that B<bugpoint> is generally very quick unless debugging a miscompilation where
each test of the program (which requires executing it) takes a long time.
=head2 Automatic Debugger Selection
B<bugpoint> reads each F<.bc> or F<.ll> file specified on the command line and
links them together into a single module, called the test program. If any LLVM
passes are specified on the command line, it runs these passes on the test
program. If any of the passes crash, or if they produce malformed output (which
causes the verifier to abort), B<bugpoint> starts the crash debugger.
Otherwise, if the B<-output> option was not specified, B<bugpoint> runs the test
program with the C backend (which is assumed to generate good code) to generate
a reference output. Once B<bugpoint> has a reference output for the test
program, it tries executing it with the selected code generator. If the
selected code generator crashes, B<bugpoint> starts the L</Crash debugger> on
the code generator. Otherwise, if the resulting output differs from the
reference output, it assumes the difference resulted from a code generator
failure, and starts the L</Code generator debugger>.
Finally, if the output of the selected code generator matches the reference
output, B<bugpoint> runs the test program after all of the LLVM passes have been
applied to it. If its output differs from the reference output, it assumes the
difference resulted from a failure in one of the LLVM passes, and enters the
miscompilation debugger. Otherwise, there is no problem B<bugpoint> can debug.
=head2 Crash debugger
If an optimizer or code generator crashes, B<bugpoint> will try as hard as it
can to reduce the list of passes (for optimizer crashes) and the size of the
test program. First, B<bugpoint> figures out which combination of optimizer
passes triggers the bug. This is useful when debugging a problem exposed by
B<gccas>, for example, because it runs over 38 passes.
Next, B<bugpoint> tries removing functions from the test program, to reduce its
size. Usually it is able to reduce a test program to a single function, when
debugging intraprocedural optimizations. Once the number of functions has been
reduced, it attempts to delete various edges in the control flow graph, to
reduce the size of the function as much as possible. Finally, B<bugpoint>
deletes any individual LLVM instructions whose absence does not eliminate the
failure. At the end, B<bugpoint> should tell you what passes crash, give you a
bytecode file, and give you instructions on how to reproduce the failure with
B<opt>, B<analyze>, or B<llc>.
=head2 Code generator debugger
The code generator debugger attempts to narrow down the amount of code that is
being miscompiled by the selected code generator. To do this, it takes the test
program and partitions it into two pieces: one piece which it compiles with the
C backend (into a shared object), and one piece which it runs with either the
JIT or the static compiler (B<llc>). It uses several techniques to reduce the
amount of code pushed through the LLVM code generator, to reduce the potential
scope of the problem. After it is finished, it emits two bytecode files (called
"test" [to be compiled with the code generator] and "safe" [to be compiled with
the C backend], respectively), and instructions for reproducing the problem.
The code generator debugger assumes that the C backend produces good code.
=head2 Miscompilation debugger
The miscompilation debugger works similarly to the code generator debugger. It
works by splitting the test program into two pieces, running the optimizations
specified on one piece, linking the two pieces back together, and then executing
the result. It attempts to narrow down the list of passes to the one (or few)
which are causing the miscompilation, then reduce the portion of the test
program which is being miscompiled. The miscompilation debugger assumes that
the selected code generator is working properly.
=head2 Advice for using bugpoint
B<bugpoint> can be a remarkably useful tool, but it sometimes works in
non-obvious ways. Here are some hints and tips:
=over
=item *
In the code generator and miscompilation debuggers, B<bugpoint> only
works with programs that have deterministic output. Thus, if the program
outputs C<argv[0]>, the date, time, or any other "random" data, B<bugpoint> may
misinterpret differences in these data, when output, as the result of a
miscompilation. Programs should be temporarily modified to disable outputs that
are likely to vary from run to run.
=item *
In the code generator and miscompilation debuggers, debugging will go faster if
you manually modify the program or its inputs to reduce the runtime, but still
exhibit the problem.
=item *
B<bugpoint> is extremely useful when working on a new optimization: it helps
track down regressions quickly. To avoid having to relink B<bugpoint> every
time you change your optimization, make B<bugpoint> dynamically load
your optimization by using the B<-load> option.
=item *
B<bugpoint> can generate a lot of output and run for a long period of time. It
is often useful to capture the output of the program to file. For example, in
the C shell, you can type:
bugpoint ... |& tee bugpoint.log
to get a copy of B<bugpoint>'s output in the file F<bugpoint.log>, as well as on
your terminal.
=item *
B<bugpoint> cannot debug problems with the LLVM linker. If B<bugpoint> crashes
before you see its C<All input ok> message, you might try running C<llvm-link
-v> on the same set of input files. If that also crashes, you may be
experiencing a linker bug.
=item *
If your program is supposed to crash, B<bugpoint> will be confused. One way to
deal with this is to cause B<bugpoint> to ignore the exit code from your
program, by giving it the B<-check-exit-code=false> option.
=back
For more information on the design and inner workings of B<bugpoint>, as well as
advice for using bugpoint, see F<llvm/docs/Bugpoint.html> in the LLVM
distribution.
=head1 OPTIONS

View File

@@ -112,7 +112,7 @@ Do not mark all symbols as internal.
Preserve the list of symbol names in the file filename.
=item B<-internalize-public-api-list &lt;list&gt;>
=item B<-internalize-public-api-list> I<list>
Preserve the symbol names in list.

View File

@@ -1 +1,2 @@
*html
.dir

View File

@@ -32,44 +32,44 @@ options) arguments to the tool you are interested in.</p>
<ul>
<li><a href="llvm-as.html"><b>llvm-as</b></a> -
<li><a href="html/llvm-as.html"><b>llvm-as</b></a> -
assemble a human-readable .ll file into bytecode</li>
<li><a href="llvm-dis.html"><b>llvm-dis</b></a> -
<li><a href="html/llvm-dis.html"><b>llvm-dis</b></a> -
disassemble a bytecode file into a human-readable .ll file</li>
<li><a href="opt.html"><b>opt</b></a> -
<li><a href="html/opt.html"><b>opt</b></a> -
run a series of LLVM-to-LLVM optimizations on a bytecode file</li>
<li><a href="llc.html"><b>llc</b></a> -
<li><a href="html/llc.html"><b>llc</b></a> -
generate native machine code for a bytecode file</li>
<li><a href="lli.html"><b>lli</b></a> -
<li><a href="html/lli.html"><b>lli</b></a> -
directly run a program compiled to bytecode using a JIT compiler or
interpreter</li>
<li><a href="llvm-link.html"><b>llvm-link</b></a> -
<li><a href="html/llvm-link.html"><b>llvm-link</b></a> -
link several bytecode files into one</li>
<li><a href="analyze.html"><b>analyze</b></a> -
<li><a href="html/analyze.html"><b>analyze</b></a> -
run LLVM analyses on a bytecode file and print the results</li>
<li><a href="llvm-ar.html"><b>llvm-ar</b></a> -
<li><a href="html/llvm-ar.html"><b>llvm-ar</b></a> -
archive bytecode files</li>
<li><a href="llvm-ranlib.html"><b>llvm-ranlib</b></a> -
<li><a href="html/llvm-ranlib.html"><b>llvm-ranlib</b></a> -
create an index for archives made with llvm-ar</li>
<li><a href="llvm-nm.html"><b>llvm-nm</b></a> -
<li><a href="html/llvm-nm.html"><b>llvm-nm</b></a> -
print out the names and types of symbols in a bytecode file</li>
<li><a href="llvm-prof.html"><b>llvm-prof</b></a> -
<li><a href="html/llvm-prof.html"><b>llvm-prof</b></a> -
format raw `<tt>llvmprof.out</tt>' data into a human-readable report</li>
<li><a href="llvmc.html"><b>llvmc</b></a> -
<li><a href="html/llvmc.html"><b>llvmc</b></a> -
generic and configurable compiler driver</li>
<li><a href="llvm-ld.html"><b>llvm-ld</b></a> -
<li><a href="html/llvm-ld.html"><b>llvm-ld</b></a> -
general purpose linker with loadable runtime optimization support</li>
</ul>
@@ -85,19 +85,19 @@ options) arguments to the tool you are interested in.</p>
<div class="doc_text">
<ul>
<li><a href="llvmgcc.html"><b>llvmgcc</b></a> -
<li><a href="html/llvmgcc.html"><b>llvmgcc</b></a> -
GCC-based C front-end for LLVM
<li><a href="llvmgxx.html"><b>llvmg++</b></a> -
<li><a href="html/llvmgxx.html"><b>llvmg++</b></a> -
GCC-based C++ front-end for LLVM</li>
<li><a href="gccas.html"><b>gccas</b></a> -
<li><a href="html/gccas.html"><b>gccas</b></a> -
compile-time optimizer used by llvm-g++ and llvm-gcc</li>
<li><a href="gccld.html"><b>gccld</b></a> -
<li><a href="html/gccld.html"><b>gccld</b></a> -
linker and link-time optimizer used by llvm-g++ and llvm-gcc</li>
<li><a href="stkrc.html"><b>stkrc</b></a> -
<li><a href="html/stkrc.html"><b>stkrc</b></a> -
front-end compiler for the <a href="../Stacker.html">Stacker</a>
language</li>
@@ -116,13 +116,13 @@ options) arguments to the tool you are interested in.</p>
<ul>
<li><a href="bugpoint.html"><b>bugpoint</b></a> -
<li><a href="html/bugpoint.html"><b>bugpoint</b></a> -
automatic test-case reducer</li>
<li><a href="extract.html"><b>extract</b></a> -
<li><a href="html/llvm-extract.html"><b>llvm-extract</b></a> -
extract a function from an LLVM bytecode file</li>
<li><a href="llvm-bcanalyzer.html"><b>llvm-bcanalyzer</b></a> -
<li><a href="html/llvm-bcanalyzer.html"><b>llvm-bcanalyzer</b></a> -
bytecode analyzer (analyzes the binary encoding itself, not the program it
represents)</li>

View File

@@ -12,36 +12,11 @@ B<llc> [I<options>] [I<filename>]
The B<llc> command compiles LLVM bytecode into assembly language for a
specified architecture. The assembly language output can then be passed through
a native assembler and linker to generate native code.
a native assembler and linker to generate a native executable.
The choice of architecture for the output assembly code is determined as
follows, by attempting to satisfy each of the following rules in turn (first
one wins):
=over
=item *
If the user has specified an architecture with the -m option, use that
architecture.
=item *
Examine the input LLVM bytecode file: if it is little endian and has a
pointer size of 32 bits, select the Intel IA-32 architecture. If it is big
endian and has a pointer size of 64 bits, select the SparcV9 architecture.
=item *
If B<llc> was compiled on an architecture for which it can generate code, select
the architecture upon which B<llc> was compiled.
=item *
Exit with an error message telling the user to specify the output
architecture explicitly.
=back
The choice of architecture for the output assembly code is automatically
determined from the input bytecode file, unless the B<-march> option is used to
override the default.
=head1 OPTIONS
@@ -58,8 +33,14 @@ removing any existing F<.bc> extension, and adding a F<.s> suffix.
Other B<llc> options are as follows:
=head2 End-user Options
=over
=item B<--help>
Print a summary of command line options.
=item B<-f>
Overwrite output files. By default, B<llc> will refuse to overwrite
@@ -67,64 +48,56 @@ an output file which already exists.
=item B<-march>=I<arch>
Specify the architecture for which to generate assembly. Valid
architectures are:
=over
=item I<x86>
Intel IA-32 (Pentium and above)
=item I<ppc32>
32-bit PowerPC (MacOS X, 32-bit ABI)
=item I<sparcv9>
64-bit SPARC V9
=item I<c>
Emit C code, not assembly
=back
=item B<-enable-correct-eh-support>
Instruct the B<-lowerinvoke> pass to insert code for correct exception handling
support. This is expensive and is by default omitted for efficiency.
=item B<-help>
Print a summary of command line options.
=item B<-stats>
Print statistics recorded by code-generation passes.
=item B<-time-passes>
Record the amount of time needed for each pass and print a report to standard
error.
=back
=head2 Intel IA-32-specific Options
=over
Specify the architecture for which to generate assembly, overriding the target
encoded in the bytecode file. See the output of B<llc --help> for a list of
valid architectures.
=item B<--disable-fp-elim>
Disable frame pointer elimination optimization.
=item B<--disable-pattern-isel>
=item B<--disable-excess-fp-precision>
Use the 'simple' X86 instruction selector (the default).
Disable optimizations that may produce excess precision for floating point.
Note that this option can dramatically slow down code on some systems
(e.g. X86).
=item B<--enable-unsafe-fp-math>
Enable optimizations that make unsafe assumptions about IEEE math (e.g. that
addition is associative) or may not work for all input ranges. These
optimizations allow the code generator to make use of some instructions which
would otherwise not be usable (such as fsin on X86).
=item B<--enable-correct-eh-support>
Instruct the B<lowerinvoke> pass to insert code for correct exception handling
support. This is expensive and is by default omitted for efficiency.
=item B<--stats>
Print statistics recorded by code-generation passes.
=item B<--time-passes>
Record the amount of time needed for each pass and print a report to standard
error.
=item B<--load>=F<dso_path>
Dynamically load F<dso_path> (a path to a dynamically shared object) that
implements an LLVM target. This will permit the target name to be used with the
B<-march> option so that code can be generated for that target.
=back
=head2 Tuning/Configuration Options
=over
=item B<--print-machineinstrs>
Print generated machine code.
Print generated machine code between compilation phases (useful for debugging).
=item B<--regalloc>=I<allocator>
@@ -171,6 +144,17 @@ Local spiller
=back
=head2 Intel IA-32-specific Options
=over
=item B<--x86-asm-syntax=att|intel>
Specify whether to emit assembly code in AT&T syntax (the default) or intel
syntax.
=back
=head2 SPARCV9-specific Options
=over
@@ -183,15 +167,6 @@ Disable peephole optimization pass.
Disable local scheduling pass.
=item B<--disable-strip>
The Sparc backend embeds the LLVM bytecode into the assembly output. This
option requests that symbol names be retained; by default, they are stripped out.
=item B<--enable-maps>
Emit LLVM-to-machine code mapping information into the assembly output.
=back
=head1 EXIT STATUS

View File

@@ -23,7 +23,7 @@ The B<llvm-ar> command can be used to I<read> both SVR4 and BSD style archive
files. However, it cannot be used to write them. While the B<llvm-ar> command
produces files that are I<almost> identical to the format used by other C<ar>
implementations, it has two significant departures in order to make the
archive appropriate for LLVM. There are first departure is that B<llvm-ar> only
archive appropriate for LLVM. The first departure is that B<llvm-ar> only
uses BSD4.4 style long path names (stored immediately after the header) and
never contains a string table for long names. The second departure is that the
symbol table is formated for efficient construction of an in-memory data
@@ -63,7 +63,7 @@ slash (/) character.
B<llvm-ar> can compress the members of an archive to save space. The
compression used depends on what's available on the platform and what choices
the LLVM Compressor utility makes. It generally favors bzip2 but will select
between "no compression", bzip2 or zlib depending on what makes sense for the
between "no compression" or bzip2 depending on what makes sense for the
file's content.
=item I<Directory Recursion>
@@ -229,9 +229,9 @@ a time stamp than the time stamp of the member in the archive.
=item [z]
When inserting or replacing any file in the archive, compress the file first.
The compression will attempt to use the zlib compression algorithm. This
This
modifier is safe to use when (previously) compressed bytecode files are added to
the archive; the compress bytecode files will not be doubly compressed.
the archive; the compressed bytecode files will not be doubly compressed.
=back
@@ -342,9 +342,8 @@ This field provides the size of the file, in bytes, encoded as a decimal ASCII
string. If the size field is negative (starts with a minus sign, 0x02D), then
the archive member is stored in compressed form. The first byte of the archive
member's data indicates the compression type used. A value of 0 (0x30) indicates
that no compression was used. A value of 1 (0x31) indicates that zlib
compression was used. A value of 2 (0x32) indicates that bzip2 compression was
used.
that no compression was used. A value of 2 (0x32) indicates that bzip2
compression was used.
=item fmag - char[2]

View File

@@ -59,15 +59,6 @@ Print a summary of command line options.
Specify the output file name. If F<filename> is C<->, then B<llvm-as>
sends its output to standard output.
=item B<--stats>
Print statistics.
=item B<--time-passes>
Record the amount of time needed for each pass and print it to standard
error.
=back
=head1 EXIT STATUS

View File

@@ -6,26 +6,24 @@ llvm-bcanalyzer - LLVM bytecode analyzer
=head1 SYNOPSIS
B<llvm-bcanalyzer> [I<options>] [I<filename>]
B<llvm-bcanalyzer> [I<options>] [F<filename>]
=head1 DESCRIPTION
The B<llvm-bcanalyzer> command is a small utility for analyzing bytecode files.
The tool reads a bytecode file (such as generated with the B<llvm-as> tool) and
produces a statistical report on the contents of the byteocde file. The tool
will also dump a low level but human readable version of the bytecode file.
can also dump a low level but human readable version of the bytecode file.
This tool is probably not of much interest or utility except for those working
directly with the bytecode file format. Most LLVM users can just ignore
this tool.
If F<filename> is omitted or is C<->, then B<llvm-bcanalyzer> reads its input
from standard input. This is useful for combining the tool into a pipeline.
Output is written to the standard output.
=head1 OPTIONS
=over
=item B<-nodetails>
@@ -41,7 +39,7 @@ the encoding of the bytecode file.
=item B<-verify>
Causes B<llvm-bcanalyzer> to verify the module produced by by reading the
Causes B<llvm-bcanalyzer> to verify the module produced by reading the
bytecode. This ensures that the statistics generated are based on a consistent
module.
@@ -112,7 +110,7 @@ The size, in bytes, of all the compaction tables in all the functions.
Percentage is relative to File Size. Note that this value is also included in
the Function Bytes.
=item B<Compaction Table Bytes>
=item B<Symbol Table Bytes>
The size, in bytes, of all the symbol tables in all the functions. Percentage is
relative to File Size. Note that this value is also included in the Function
@@ -280,20 +278,20 @@ computed by dividing Byte Size by Instructions. Note that this is not the same
as Average Instruction Size. It computes a number relative to the total function
size not just the size of the instruction list.
=item B<# of VBR 32-bit Integers>
=item B<Number of VBR 32-bit Integers>
The total number of 32-bit integers found in this function (for any use).
=item B<# of VBR 64-bit Integers>
=item B<Number of VBR 64-bit Integers>
The total number of 64-bit integers found in this function (for any use).
=item B<# of VBR Compressed Bytes>
=item B<Number of VBR Compressed Bytes>
The total number of bytes in this function consumed by the 32-bit and 64-bit
integers that use the Variable Bit Rate encoding scheme.
=item B<# of VBR Expanded Bytes>
=item B<Number of VBR Expanded Bytes>
The total number of bytes in this function that would have been consumed by
the 32-bit and 64-bit integers had they not been compressed with the Variable

View File

@@ -42,11 +42,6 @@ Print a summary of command line options.
Specify the output file name. If F<filename> is -, then the output is sent
to standard output.
=item B<-time-passes>
Record the amount of time needed for each pass and print it to standard
error.
=back
=head1 EXIT STATUS

View File

@@ -2,23 +2,23 @@
=head1 NAME
extract - extract a function from an LLVM module
llvm-extract - extract a function from an LLVM module
=head1 SYNOPSIS
B<extract> [I<options>] B<--func> I<function-name> [I<filename>]
B<llvm-extract> [I<options>] B<--func> I<function-name> [I<filename>]
=head1 DESCRIPTION
The B<extract> command takes the name of a function and extracts it from
The B<llvm-extract> command takes the name of a function and extracts it from
the specified LLVM bytecode file. It is primarily used as a debugging tool to
reduce test cases from larger programs that are triggering a bug.
In addition to extracting the bytecode of the specified function,
B<extract> will also remove unreachable global variables, prototypes, and
B<llvm-extract> will also remove unreachable global variables, prototypes, and
unused types.
The B<extract> command reads its input from standard input if filename is
The B<llvm-extract> command reads its input from standard input if filename is
omitted or if filename is -. The output is always written to standard output,
unless the B<-o> option is specified (see below).
@@ -28,8 +28,8 @@ unless the B<-o> option is specified (see below).
=item B<-f>
Force overwrite. Normally, B<extract> will refuse to overwrite an
output file that already exists. With this option, B<extract>
Force overwrite. Normally, B<llvm-extract> will refuse to overwrite an
output file that already exists. With this option, B<llvm-extract>
will overwrite the output file and replace it with new bytecode.
=item B<--func> I<function-name>
@@ -43,22 +43,13 @@ Print a summary of command line options.
=item B<-o> I<filename>
Specify the output filename. If filename is "-" (the default), then
B<extract> sends its output to standard output.
=item B<--stats>
Print statistics.
=item B<--time-passes>
Record the amount of time needed for each pass and print it to standard
error.
B<llvm-extract> sends its output to standard output.
=back
=head1 EXIT STATUS
If B<extract> succeeds, it will exit with 0. Otherwise, if an error
If B<llvm-extract> succeeds, it will exit with 0. Otherwise, if an error
occurs, it will exit with a non-zero value.
=head1 SEE ALSO

View File

@@ -43,7 +43,7 @@ exit code will be returned.
=head1 SEE ALSO
L<llvm-ar|llvm-ar>, L<ranlib(1)>
L<llvm-ar|llvm-ar>, ranlib(1)
=head1 AUTHORS

View File

@@ -109,13 +109,13 @@ of compilation, optimization, and linking should be attempted. Source files
specified on the command line will be compiled and linked with objects and
libraries also specified.
=item B<-S> or B<--assemble>
=item B<-S>
This option specifies that compilation should end in the creation of
an LLVM assembly file that can be later converted to an LLVM object
file.
=item B<-E> or B<--preprocess>
=item B<-E>
This option specifies that no compilation or linking should be
performed. Only pre-processing, if applicable to the language being
@@ -274,7 +274,7 @@ it to the standard error.
=over
=item B<-T,pp>=I<options>
=item B<-T,pre>=I<options>
Pass an arbitrary option to the pre-processor.
@@ -282,7 +282,7 @@ Pass an arbitrary option to the pre-processor.
Pass an arbitrary option to the optimizer.
=item B<-T,link>=I<options>
=item B<-T,lnk>=I<options>
Pass an arbitrary option to the linker.
@@ -292,7 +292,7 @@ Pass an arbitrary option to the code generator.
=back
=head3 C/C++ Specific Options
=head2 C/C++ Specific Options
=over
@@ -301,6 +301,11 @@ Pass an arbitrary option to the code generator.
This option is just passed through to a C or C++ front end compiler to tell it
where include files can be found.
=item B<-D>F<symbol>
This option is just passed through to a C or C++ front end compiler to tell it
to define a symbol.
=back
=head2 Miscellaneous Options
@@ -311,10 +316,9 @@ where include files can be found.
Print a summary of command line options.
=item B<-V> or B<--version>
=item B<--version>
This option will cause B<llvmc> to print out its version number
and terminate.
This option will cause B<llvmc> to print out its version number and terminate.
=back
@@ -325,6 +329,23 @@ of these options can produce drastically wrong results.
=over
=item B<--config-dir> F<dirname>
This option tells B<llvmc> to read configuration data from the I<directory>
named F<dirname>. Data from such directories will be read in the order
specified on the command line after all other standard configuration files have
been read. This allows users or groups of users to conveniently create
their own configuration directories in addition to the standard ones to which
they may not have write access.
=head2 Unimplemented Options
The options below are not currently implemented in B<llvmc> but will be
eventually. They are documented here as "future design".
=over
=item B<--show-config> I<[suffixes...]>
When this option is given, the only action taken by B<llvmc> is to show its
@@ -345,15 +366,6 @@ item I<name> in the section named I<section>. This is a quick way to override
a configuration item on the command line without resorting to changing the
configuration files.
=item B<--config-file> F<dirname>
This option tells B<llvmc> to read configuration data from the I<directory>
named F<dirname>. Data from such directories will be read in the order
specified on the command line after all other standard configuration files have
been read. This allows users or groups of users to conveniently create
their own configuration directories in addition to the standard ones to which
they may not have write access.
=item B<--config-only-from> F<dirname>
This option tells B<llvmc> to skip the normal processing of configuration
@@ -361,7 +373,6 @@ files and only configure from the contents of the F<dirname> directory. Multiple
B<--config-only-from> options may be given in which case the directories are
read in the order given on the command line.
=item B<--emit-raw-code>
No optimization is done whatsoever. The compilers invoked by B<llvmc> with

View File

@@ -2,26 +2,26 @@
=head1 NAME
llvmgcc - LLVM C front-end
llvm-gcc - LLVM C front-end
=head1 SYNOPSIS
B<llvmgcc> [I<options>] I<filename>
B<llvm-gcc> [I<options>] I<filename>
=head1 DESCRIPTION
The B<llvmgcc> command is the LLVM C front end. It is a modified
The B<llvm-gcc> command is the LLVM C front end. It is a modified
version of gcc that takes C programs and compiles them into LLVM
bytecode or assembly language, depending upon the options.
Unless the B<-S> option is specified, B<llvmgcc> will use the
Unless the B<-S> option is specified, B<llvm-gcc> will use the
L<gccas|gccas> program to perform some optimizations and create an
LLVM bytecode file. Unless the B<-c> option is specified, B<llvmgcc>
LLVM bytecode file. Unless the B<-c> option is specified, B<llvm-gcc>
will also use the L<gccld|gccld> program to perform further
optimizations and link the resulting bytecode file(s) with support
libraries to create an executable program.
Being derived from the GNU Compiler Collection, B<llvmgcc> has many
Being derived from the GNU Compiler Collection, B<llvm-gcc> has many
of gcc's features and accepts most of gcc's options. It handles a
number of gcc's extensions to the C programming language.
@@ -64,20 +64,28 @@ repeated.
Link in the library libI<name>.[bc | a | so]. This library should
be a bytecode library.
=item B<-Wa,>I<option>
Pass I<option> to gccas
=item B<-Wl,>I<option>
Pass I<option> to the linker (usually gccld).
Pass I<option> to gccld
=item B<-Wa,-disable-inlining -Wl,-disable-inlining>
Fully disable all inlining
=back
=head1 EXIT STATUS
If B<llvmgcc> succeeds, it will exit with 0. Otherwise, if an error
If B<llvm-gcc> succeeds, it will exit with 0. Otherwise, if an error
occurs, it will exit with a non-zero value.
=head1 SEE ALSO
L<llvmg++|llvmgxx>, L<gccas|gccas>, L<gccld|gccld>
L<llvm-g++|llvmgxx>, L<gccas|gccas>, L<gccld|gccld>
=head1 AUTHORS

View File

@@ -2,26 +2,26 @@
=head1 NAME
llvmg++ - LLVM C++ front-end
llvm-g++ - LLVM C++ front-end
=head1 SYNOPSIS
B<llvmg++> [I<options>] I<filename>
B<llvm-g++> [I<options>] I<filename>
=head1 DESCRIPTION
The B<llvmg++> command is the LLVM C++ front end. It is a modified
The B<llvm-g++> command is the LLVM C++ front end. It is a modified
version of g++ that takes C++ programs and compiles them into LLVM
bytecode or assembly language, depending upon the options.
Unless the B<-S> option is specified, B<llvmg++> will use the
Unless the B<-S> option is specified, B<llvm-g++> will use the
L<gccas|gccas> program to perform some optimizations and create an
LLVM bytecode file. Unless the B<-c> option is specified, B<llvmg++>
LLVM bytecode file. Unless the B<-c> option is specified, B<llvm-g++>
will also use the L<gccld|gccld> program to perform further
optimizations and link the resulting bytecode file(s) with support
libraries to create an executable program.
Being derived from the GNU Compiler Collection, B<llvmg++> has many
Being derived from the GNU Compiler Collection, B<llvm-g++> has many
of g++'s features and accepts most of g++'s options. It handles a
number of g++'s extensions to the C++ programming language.
@@ -64,20 +64,28 @@ repeated.
Link in the library libI<name>.[bc | a | so]. This library should
be a bytecode library.
=item B<-Wa,>I<option>
Pass I<option> to gccas
=item B<-Wl,>I<option>
Pass I<option> to the linker (usually gccld).
Pass I<option> to gccld
=item B<-Wa,-disable-inlining -Wl,-disable-inlining>
Fully disable all inlining
=back
=head1 EXIT STATUS
If B<llvmg++> succeeds, it will exit with 0. Otherwise, if an error
If B<llvm-g++> succeeds, it will exit with 0. Otherwise, if an error
occurs, it will exit with a non-zero value.
=head1 SEE ALSO
L<llvmgcc>, L<gccas>, L<gccld>
L<llvm-gcc|llvmgcc>, L<gccas>, L<gccld>
=head1 AUTHORS

View File

@@ -0,0 +1 @@
.dir

View File

@@ -1 +1,2 @@
*.1
.dir

View File

@@ -1 +1,2 @@
*ps
.dir

View File

@@ -192,19 +192,19 @@ can do.</p>
<p>To start out, you need to include the CommandLine header file into your
program:</p>
<pre>
<div class="doc_code"><pre>
#include "Support/CommandLine.h"
</pre>
</pre></div>
<p>Additionally, you need to add this as the first line of your main
program:</p>
<pre>
<div class="doc_code"><pre>
int main(int argc, char **argv) {
<a href="#cl::ParseCommandLineOptions">cl::ParseCommandLineOptions</a>(argc, argv);
...
}
</pre>
</pre></div>
<p>... which actually parses the arguments and fills in the variable
declarations.</p>
@@ -220,9 +220,9 @@ to specify where to put the output. With the CommandLine library, this is
represented like this:</p>
<a name="value_desc_example"></a>
<pre>
<div class="doc_code"><pre>
<a href="#cl::opt">cl::opt</a>&lt;string&gt; OutputFilename("<i>o</i>", <a href="#cl::desc">cl::desc</a>("<i>Specify output filename</i>"), <a href="#cl::value_desc">cl::value_desc</a>("<i>filename</i>"));
</pre>
</pre></div>
<p>This declares a global variable "<tt>OutputFilename</tt>" that is used to
capture the result of the "<tt>o</tt>" argument (first parameter). We specify
@@ -235,25 +235,25 @@ that the data type that we are parsing is a string.</p>
to output for the "<tt>--help</tt>" option. In this case, we get a line that
looks like this:</p>
<pre>
<div class="doc_code"><pre>
USAGE: compiler [options]
OPTIONS:
-help - display available options (--help-hidden for more)
<b>-o &lt;filename&gt; - Specify output filename</b>
</pre>
</pre></div>
<p>Because we specified that the command line option should parse using the
<tt>string</tt> data type, the variable declared is automatically usable as a
real string in all contexts that a normal C++ string object may be used. For
example:</p>
<pre>
<div class="doc_code"><pre>
...
ofstream Output(OutputFilename.c_str());
if (Out.good()) ...
...
</pre>
</pre></div>
<p>There are many different options that you can use to customize the command
line option handling library, but the above example shows the general interface
@@ -270,9 +270,9 @@ href="#positional">positional</a> arguments to be specified for the program.
These positional arguments are filled with command line parameters that are not
in option form. We use this feature like this:</p>
<pre>
<div class="doc_code"><pre>
<a href="#cl::opt">cl::opt</a>&lt;string&gt; InputFilename(<a href="#cl::Positional">cl::Positional</a>, <a href="#cl::desc">cl::desc</a>("<i>&lt;input file&gt;</i>"), <a href="#cl::init">cl::init</a>("<i>-</i>"));
</pre>
</pre></div>
<p>This declaration indicates that the first positional argument should be
treated as the input filename. Here we use the <tt><a
@@ -285,16 +285,16 @@ that the user always specify an input filename, we would add the <tt><a
href="#cl::Required">cl::Required</a></tt> flag, and we could eliminate the
<tt><a href="#cl::init">cl::init</a></tt> modifier, like this:</p>
<pre>
<div class="doc_code"><pre>
<a href="#cl::opt">cl::opt</a>&lt;string&gt; InputFilename(<a href="#cl::Positional">cl::Positional</a>, <a href="#cl::desc">cl::desc</a>("<i>&lt;input file&gt;</i>"), <b><a href="#cl::Required">cl::Required</a></b>);
</pre>
</pre></div>
<p>Again, the CommandLine library does not require the options to be specified
in any particular order, so the above declaration is equivalent to:</p>
<pre>
<div class="doc_code"><pre>
<a href="#cl::opt">cl::opt</a>&lt;string&gt; InputFilename(<a href="#cl::Positional">cl::Positional</a>, <a href="#cl::Required">cl::Required</a>, <a href="#cl::desc">cl::desc</a>("<i>&lt;input file&gt;</i>"));
</pre>
</pre></div>
<p>By simply adding the <tt><a href="#cl::Required">cl::Required</a></tt> flag,
the CommandLine library will automatically issue an error if the argument is not
@@ -304,13 +304,13 @@ can alter the default behaviour of the library, on a per-option basis. By
adding one of the declarations above, the <tt>--help</tt> option synopsis is now
extended to:</p>
<pre>
<div class="doc_code"><pre>
USAGE: compiler [options] <b>&lt;input file&gt;</b>
OPTIONS:
-help - display available options (--help-hidden for more)
-o &lt;filename&gt; - Specify output filename
</pre>
</pre></div>
<p>... indicating that an input filename is expected.</p>
@@ -329,11 +329,11 @@ file, "<tt>--quiet</tt>" to enable quiet mode, and "<tt>-q</tt>" for backwards
compatibility with some of our users. We can support these by declaring options
of boolean type like this:</p>
<pre>
<div class="doc_code"><pre>
<a href="#cl::opt">cl::opt</a>&lt;bool&gt; Force ("<i>f</i>", <a href="#cl::desc">cl::desc</a>("<i>Overwrite output files</i>"));
<a href="#cl::opt">cl::opt</a>&lt;bool&gt; Quiet ("<i>quiet</i>", <a href="#cl::desc">cl::desc</a>("<i>Don't print informational messages</i>"));
<a href="#cl::opt">cl::opt</a>&lt;bool&gt; Quiet2("<i>q</i>", <a href="#cl::desc">cl::desc</a>("<i>Don't print informational messages</i>"), <a href="#cl::Hidden">cl::Hidden</a>);
</pre>
</pre></div>
<p>This does what you would expect: it declares three boolean variables
("<tt>Force</tt>", "<tt>Quiet</tt>", and "<tt>Quiet2</tt>") to recognize these
@@ -351,12 +351,12 @@ it assigns the value of true to the variable), or it allows the values
"<tt>true</tt>" or "<tt>false</tt>" to be specified, allowing any of the
following inputs:</p>
<pre>
<div class="doc_code"><pre>
compiler -f # No value, 'Force' == true
compiler -f=true # Value specified, 'Force' == true
compiler -f=TRUE # Value specified, 'Force' == true
compiler -f=FALSE # Value specified, 'Force' == false
</pre>
</pre></div>
<p>... you get the idea. The <a href="#boolparser">bool parser</a> just turns
the string values into boolean values, and rejects things like '<tt>compiler
@@ -367,7 +367,7 @@ library calls to parse the string value into the specified data type.</p>
<p>With the declarations above, "<tt>compiler --help</tt>" emits this:</p>
<pre>
<div class="doc_code"><pre>
USAGE: compiler [options] &lt;input file&gt;
OPTIONS:
@@ -375,11 +375,11 @@ OPTIONS:
-o - Override output filename
<b>-quiet - Don't print informational messages</b>
-help - display available options (--help-hidden for more)
</pre>
</pre></div>
<p>and "<tt>opt --help-hidden</tt>" prints this:</p>
<pre>
<div class="doc_code"><pre>
USAGE: compiler [options] &lt;input file&gt;
OPTIONS:
@@ -388,7 +388,7 @@ OPTIONS:
<b>-q - Don't print informational messages</b>
-quiet - Don't print informational messages
-help - display available options (--help-hidden for more)
</pre>
</pre></div>
<p>This brief example has shown you how to use the '<tt><a
href="#cl::opt">cl::opt</a></tt>' class to parse simple scalar command line
@@ -408,22 +408,22 @@ and <a href="#list">lists</a> of options.</p>
<p>So far, the example works well, except for the fact that we need to check the
quiet condition like this now:</p>
<pre>
<div class="doc_code"><pre>
...
if (!Quiet &amp;&amp; !Quiet2) printInformationalMessage(...);
...
</pre>
</pre></div>
<p>... which is a real pain! Instead of defining two values for the same
condition, we can use the "<tt><a href="#cl::alias">cl::alias</a></tt>" class to make the "<tt>-q</tt>"
option an <b>alias</b> for the "<tt>-quiet</tt>" option, instead of providing
a value itself:</p>
<pre>
<div class="doc_code"><pre>
<a href="#cl::opt">cl::opt</a>&lt;bool&gt; Force ("<i>f</i>", <a href="#cl::desc">cl::desc</a>("<i>Overwrite output files</i>"));
<a href="#cl::opt">cl::opt</a>&lt;bool&gt; Quiet ("<i>quiet</i>", <a href="#cl::desc">cl::desc</a>("<i>Don't print informational messages</i>"));
<a href="#cl::alias">cl::alias</a> QuietA("<i>q</i>", <a href="#cl::desc">cl::desc</a>("<i>Alias for -quiet</i>"), <a href="#cl::aliasopt">cl::aliasopt</a>(Quiet));
</pre>
</pre></div>
<p>The third line (which is the only one we modified from above) defines a
"<tt>-q</tt> alias that updates the "<tt>Quiet</tt>" variable (as specified by
@@ -436,11 +436,11 @@ output</tt>).</p>
<p>Now the application code can simply use:</p>
<pre>
<div class="doc_code"><pre>
...
if (!Quiet) printInformationalMessage(...);
...
</pre>
</pre></div>
<p>... which is much nicer! The "<tt><a href="#cl::alias">cl::alias</a></tt>"
can be used to specify an alternative name for any variable type, and has many
@@ -486,7 +486,7 @@ see if some level &gt;= "<tt>-O1</tt>" is enabled.</li>
CommandLine library fill it in with the appropriate level directly, which is
used like this:</p>
<pre>
<div class="doc_code"><pre>
enum OptLevel {
g, O1, O2, O3
};
@@ -502,7 +502,7 @@ enum OptLevel {
...
if (OptimizationLevel &gt;= O2) doPartialRedundancyElimination(...);
...
</pre>
</pre></div>
<p>This declaration defines a variable "<tt>OptimizationLevel</tt>" of the
"<tt>OptLevel</tt>" enum type. This variable can be assigned any of the values
@@ -514,7 +514,7 @@ enum values can be specified. The "<tt>clEnumVal</tt>" macros ensure that the
command line arguments matched the enum values. With this option added, our
help output now is:</p>
<pre>
<div class="doc_code"><pre>
USAGE: compiler [options] &lt;input file&gt;
OPTIONS:
@@ -527,14 +527,14 @@ OPTIONS:
-help - display available options (--help-hidden for more)
-o &lt;filename&gt; - Specify output filename
-quiet - Don't print informational messages
</pre>
</pre></div>
<p>In this case, it is sort of awkward that flag names correspond directly to
enum names, because we probably don't want a enum definition named "<tt>g</tt>"
in our program. Because of this, we can alternatively write this example like
this:</p>
<pre>
<div class="doc_code"><pre>
enum OptLevel {
Debug, O1, O2, O3
};
@@ -550,7 +550,7 @@ enum OptLevel {
...
if (OptimizationLevel == Debug) outputDebugInfo(...);
...
</pre>
</pre></div>
<p>By using the "<tt>clEnumValN</tt>" macro instead of "<tt>clEnumVal</tt>", we
can directly specify the name that the flag should get. In general a direct
@@ -575,7 +575,7 @@ following options, of which only one can be specified at a time:
our optimization level flags, but we also specify an option name. For this
case, the code looks like this:</p>
<pre>
<div class="doc_code"><pre>
enum DebugLev {
nodebuginfo, quick, detailed
};
@@ -587,14 +587,14 @@ enum DebugLev {
clEnumVal(quick, "<i>enable quick debug information</i>"),
clEnumVal(detailed, "<i>enable detailed debug information</i>"),
clEnumValEnd));
</pre>
</pre></div>
<p>This definition defines an enumerated command line variable of type "<tt>enum
DebugLev</tt>", which works exactly the same way as before. The difference here
is just the interface exposed to the user of your program and the help output by
the "<tt>--help</tt>" option:</p>
<pre>
<div class="doc_code"><pre>
USAGE: compiler [options] &lt;input file&gt;
OPTIONS:
@@ -611,7 +611,7 @@ OPTIONS:
-help - display available options (--help-hidden for more)
-o &lt;filename&gt; - Specify output filename
-quiet - Don't print informational messages
</pre>
</pre></div>
<p>Again, the only structural difference between the debug level declaration and
the optimization level declaration is that the debug level declaration includes
@@ -637,16 +637,16 @@ important. This is what the "<tt><a href="#cl::list">cl::list</a></tt>"
template is for. First, start by defining an enum of the optimizations that you
would like to perform:</p>
<pre>
<div class="doc_code"><pre>
enum Opts {
// 'inline' is a C++ keyword, so name it 'inlining'
dce, constprop, inlining, strip
};
</pre>
</pre></div>
<p>Then define your "<tt><a href="#cl::list">cl::list</a></tt>" variable:</p>
<pre>
<div class="doc_code"><pre>
<a href="#cl::list">cl::list</a>&lt;Opts&gt; OptimizationList(<a href="#cl::desc">cl::desc</a>("<i>Available Optimizations:</i>"),
<a href="#cl::values">cl::values</a>(
clEnumVal(dce , "<i>Dead Code Elimination</i>"),
@@ -654,17 +654,17 @@ enum Opts {
clEnumValN(inlining, "<i>inline</i>", "<i>Procedure Integration</i>"),
clEnumVal(strip , "<i>Strip Symbols</i>"),
clEnumValEnd));
</pre>
</pre></div>
<p>This defines a variable that is conceptually of the type
"<tt>std::vector&lt;enum Opts&gt;</tt>". Thus, you can access it with standard
vector methods:</p>
<pre>
<div class="doc_code"><pre>
for (unsigned i = 0; i != OptimizationList.size(); ++i)
switch (OptimizationList[i])
...
</pre>
</pre></div>
<p>... to iterate through the list of options specified.</p>
@@ -676,11 +676,11 @@ arguments together if there may be more than one specified. In the case of a
linker, for example, the linker takes several '<tt>.o</tt>' files, and needs to
capture them into a list. This is naturally specified as:</p>
<pre>
<div class="doc_code"><pre>
...
<a href="#cl::list">cl::list</a>&lt;std::string&gt; InputFilenames(<a href="#cl::Positional">cl::Positional</a>, <a href="#cl::desc">cl::desc</a>("&lt;Input files&gt;"), <a href="#cl::OneOrMore">cl::OneOrMore</a>);
...
</pre>
</pre></div>
<p>This variable works just like a "<tt>vector&lt;string&gt;</tt>" object. As
such, accessing the list is simple, just like above. In this example, we used
@@ -709,17 +709,17 @@ call in main. This additional argument is then printed as the overview
information for your program, allowing you to include any additional information
that you want. For example:</p>
<pre>
<div class="doc_code"><pre>
int main(int argc, char **argv) {
<a href="#cl::ParseCommandLineOptions">cl::ParseCommandLineOptions</a>(argc, argv, " CommandLine compiler example\n\n"
" This program blah blah blah...\n");
...
}
</pre>
</pre></div>
<p>Would yield the help output:</p>
<p>would yield the help output:</p>
<pre>
<div class="doc_code"><pre>
<b>OVERVIEW: CommandLine compiler example
This program blah blah blah...</b>
@@ -730,7 +730,7 @@ OPTIONS:
...
-help - display available options (--help-hidden for more)
-o &lt;filename&gt; - Specify output filename
</pre>
</pre></div>
</div>
@@ -764,20 +764,20 @@ tool takes a regular expression argument, and an optional filename to search
through (which defaults to standard input if a filename is not specified).
Using the CommandLine library, this would be specified as:</p>
<pre>
<div class="doc_code"><pre>
<a href="#cl::opt">cl::opt</a>&lt;string&gt; Regex (<a href="#cl::Positional">cl::Positional</a>, <a href="#cl::desc">cl::desc</a>("<i>&lt;regular expression&gt;</i>"), <a href="#cl::Required">cl::Required</a>);
<a href="#cl::opt">cl::opt</a>&lt;string&gt; Filename(<a href="#cl::Positional">cl::Positional</a>, <a href="#cl::desc">cl::desc</a>("<i>&lt;input file&gt;</i>"), <a href="#cl::init">cl::init</a>("<i>-</i>"));
</pre>
</pre></div>
<p>Given these two option declarations, the <tt>--help</tt> output for our grep
replacement would look like this:</p>
<pre>
<div class="doc_code"><pre>
USAGE: spiffygrep [options] <b>&lt;regular expression&gt; &lt;input file&gt;</b>
OPTIONS:
-help - display available options (--help-hidden for more)
</pre>
</pre></div>
<p>... and the resultant program could be used just like the standard
<tt>grep</tt> tool.</p>
@@ -804,7 +804,7 @@ first, you will have trouble doing this, because it will try to find an argument
named '<tt>-foo</tt>', and will fail (and single quotes will not save you).
Note that the system <tt>grep</tt> has the same problem:</p>
<pre>
<div class="doc_code"><pre>
$ spiffygrep '-foo' test.txt
Unknown command line argument '-foo'. Try: spiffygrep --help'
@@ -813,7 +813,7 @@ Note that the system <tt>grep</tt> has the same problem:</p>
grep: illegal option -- o
grep: illegal option -- o
Usage: grep -hblcnsviw pattern file . . .
</pre>
</pre></div>
<p>The solution for this problem is the same for both your tool and the system
version: use the '<tt>--</tt>' marker. When the user specifies '<tt>--</tt>' on
@@ -821,10 +821,10 @@ the command line, it is telling the program that all options after the
'<tt>--</tt>' should be treated as positional arguments, not options. Thus, we
can use it like this:</p>
<pre>
<div class="doc_code"><pre>
$ spiffygrep -- -foo test.txt
...output...
</pre>
</pre></div>
</div>
@@ -847,7 +847,9 @@ can use it like this:</p>
<tt>cl::list::getPosition(optnum)</tt> method. This method returns the
absolute position (as found on the command line) of the <tt>optnum</tt>
item in the <tt>cl::list</tt>.</p>
<p>The idiom for usage is like this:<pre><tt>
<p>The idiom for usage is like this:</p>
<div class="doc_code"><pre>
static cl::list&lt;std::string&gt; Files(cl::Positional, cl::OneOrMore);
static cl::listlt;std::string&gt; Libraries("l", cl::ZeroOrMore);
@@ -877,8 +879,8 @@ can use it like this:</p>
else
break; // we're done with the list
}
}
</tt></pre></p>
}</pre></div>
<p>Note that, for compatibility reasons, the <tt>cl::opt</tt> also supports an
<tt>unsigned getPosition()</tt> option that will provide the absolute position
of that option. You can apply the same approach as above with a
@@ -906,23 +908,23 @@ arguments to the script. These arguments to the script are parsed by the bourne
shell command line option processor, but are not interpreted as options to the
shell itself. Using the CommandLine library, we would specify this as:</p>
<pre>
<div class="doc_code"><pre>
<a href="#cl::opt">cl::opt</a>&lt;string&gt; Script(<a href="#cl::Positional">cl::Positional</a>, <a href="#cl::desc">cl::desc</a>("<i>&lt;input script&gt;</i>"), <a href="#cl::init">cl::init</a>("-"));
<a href="#cl::list">cl::list</a>&lt;string&gt; Argv(<a href="#cl::ConsumeAfter">cl::ConsumeAfter</a>, <a href="#cl::desc">cl::desc</a>("<i>&lt;program arguments&gt;...</i>"));
<a href="#cl::opt">cl::opt</a>&lt;bool&gt; Trace("<i>x</i>", <a href="#cl::desc">cl::desc</a>("<i>Enable trace output</i>"));
</pre>
</pre></div>
<p>which automatically provides the help output:</p>
<pre>
<div class="doc_code"><pre>
USAGE: spiffysh [options] <b>&lt;input script&gt; &lt;program arguments&gt;...</b>
OPTIONS:
-help - display available options (--help-hidden for more)
<b>-x - Enable trace output</b>
</pre>
</pre></div>
<p>At runtime, if we run our new shell replacement as '<tt>spiffysh -x test.sh
<p>At runtime, if we run our new shell replacement as `<tt>spiffysh -x test.sh
-a -x -y bar</tt>', the <tt>Trace</tt> variable will be set to true, the
<tt>Script</tt> variable will be set to "<tt>test.sh</tt>", and the
<tt>Argv</tt> list will contain <tt>["-a", "-x", "-y", "bar"]</tt>, because they
@@ -961,6 +963,7 @@ all of these clients (requiring lots of .cpp files to #include
<p>To do this, set up your .h file with your option, like this for example:</p>
<div class="doc_code">
<pre>
<i>// DebugFlag.h - Get access to the '-debug' command line option
//
@@ -976,15 +979,15 @@ extern bool DebugFlag;
// debug build, then the code specified as the option to the macro will be
// executed. Otherwise it will not be. Example:
//
// DEBUG(cerr << "Bitset contains: " << Bitset << "\n");
// DEBUG(std::cerr &lt;&lt; "Bitset contains: " &lt;&lt; Bitset &lt;&lt; "\n");
//</i>
<span class="doc_red">#ifdef NDEBUG
<span class="doc_hilite">#ifdef NDEBUG
#define DEBUG(X)
#else
#define DEBUG(X)</span> \
do { if (DebugFlag) { X; } } while (0)
<span class="doc_red">#endif</span>
#define DEBUG(X)</span> do { if (DebugFlag) { X; } } while (0)
<span class="doc_hilite">#endif</span>
</pre>
</div>
<p>This allows clients to blissfully use the <tt>DEBUG()</tt> macro, or the
<tt>DebugFlag</tt> explicitly if they want to. Now we just need to be able to
@@ -993,18 +996,19 @@ an additial argument to our command line argument processor, and we specify
where to fill in with the <a href="#cl::location">cl::location</a>
attribute:</p>
<div class="doc_code">
<pre>
bool DebugFlag; <i>// the actual value</i>
static <a href="#cl::opt">cl::opt</a>&lt;bool, true&gt; <i>// The parser</i>
Debug("<i>debug</i>", <a href="#cl::desc">cl::desc</a>("<i>Enable debug output</i>"), <a href="#cl::Hidden">cl::Hidden</a>,
<a href="#cl::location">cl::location</a>(DebugFlag));
Debug("<i>debug</i>", <a href="#cl::desc">cl::desc</a>("<i>Enable debug output</i>"), <a href="#cl::Hidden">cl::Hidden</a>, <a href="#cl::location">cl::location</a>(DebugFlag));
</pre>
</div>
<p>In the above example, we specify "<tt>true</tt>" as the second argument to
the <a href="#cl::opt">cl::opt</a> template, indicating that the template should
not maintain a copy of the value itself. In addition to this, we specify the <a
href="#cl::location">cl::location</a> attribute, so that <tt>DebugFlag</tt> is
automatically set.</p>
the <tt><a href="#cl::opt">cl::opt</a></tt> template, indicating that the
template should not maintain a copy of the value itself. In addition to this,
we specify the <tt><a href="#cl::location">cl::location</a></tt> attribute, so
that <tt>DebugFlag</tt> is automatically set.</p>
</div>
@@ -1055,8 +1059,8 @@ the section on <a href="#storage">Internal vs External Storage</a> for more
information.</li>
<li><a name="cl::aliasopt">The <b><tt>cl::aliasopt</tt></b></a> attribute
specifies which option a <a href="#cl::alias">cl::alias</a> option is an alias
for.</li>
specifies which option a <tt><a href="#cl::alias">cl::alias</a></tt> option is
an alias for.</li>
<li><a name="cl::values">The <b><tt>cl::values</tt></b></a> attribute specifies
the string-to-value mapping to be used by the generic parser. It takes a
@@ -1282,31 +1286,33 @@ everything after the prefix, including any equal sign if present. This is useful
for processing odd arguments like <tt>-lmalloc</tt> and <tt>-L/usr/lib</tt> in a
linker tool or <tt>-DNAME=value</tt> in a compiler tool. Here, the
'<tt>l</tt>', '<tt>D</tt>' and '<tt>L</tt>' options are normal string (or list)
options, that have the <a href="#cl::Prefix">cl::Prefix</a> modifier added to
allow the CommandLine library to recognize them. Note that
<a href="#cl::Prefix">cl::Prefix</a> options must not have the <a
href="#cl::ValueDisallowed">cl::ValueDisallowed</a> modifier specified.</li>
options, that have the <b><tt><a href="#cl::Prefix">cl::Prefix</a></tt></b>
modifier added to allow the CommandLine library to recognize them. Note that
<b><tt><a href="#cl::Prefix">cl::Prefix</a></tt></b> options must not have the
<b><tt><a href="#cl::ValueDisallowed">cl::ValueDisallowed</a></tt></b> modifier
specified.</li>
<li><a name="cl::Grouping">The <b><tt>cl::Grouping</tt></b></a> modifier is used
to implement unix style tools (like <tt>ls</tt>) that have lots of single letter
arguments, but only require a single dash. For example, the '<tt>ls -labF</tt>'
command actually enables four different options, all of which are single
letters. Note that <a href="#cl::Grouping">cl::Grouping</a> options cannot have
values.</li>
letters. Note that <b><tt><a href="#cl::Grouping">cl::Grouping</a></tt></b>
options cannot have values.</li>
</ul>
<p>The CommandLine library does not restrict how you use the <a
href="#cl::Prefix">cl::Prefix</a> or <a href="#cl::Grouping">cl::Grouping</a>
modifiers, but it is possible to specify ambiguous argument settings. Thus, it
is possible to have multiple letter options that are prefix or grouping options,
and they will still work as designed.</p>
<p>The CommandLine library does not restrict how you use the <b><tt><a
href="#cl::Prefix">cl::Prefix</a></tt></b> or <b><tt><a
href="#cl::Grouping">cl::Grouping</a></tt></b> modifiers, but it is possible to
specify ambiguous argument settings. Thus, it is possible to have multiple
letter options that are prefix or grouping options, and they will still work as
designed.</p>
<p>To do this, the CommandLine library uses a greedy algorithm to parse the
input option into (potentially multiple) prefix and grouping options. The
strategy basically looks like this:</p>
<p><tt>parse(string OrigInput) {</tt>
<div class="doc_code"><tt>parse(string OrigInput) {</tt>
<ol>
<li><tt>string input = OrigInput;</tt>
@@ -1322,10 +1328,10 @@ strategy basically looks like this:</p>
&nbsp;&nbsp;while (!isOption(input) &amp;&amp; !input.empty()) input.pop_back();<br>
}</tt>
<li><tt>if (!OrigInput.empty()) error();</tt></li>
</ol>
<p><tt>}</tt></p>
</div>
</div>
@@ -1450,13 +1456,13 @@ options, and is the one used most of the time. It is a templated class which
can take up to three arguments (all except for the first have default values
though):</p>
<pre>
<div class="doc_code"><pre>
<b>namespace</b> cl {
<b>template</b> &lt;<b>class</b> DataType, <b>bool</b> ExternalStorage = <b>false</b>,
<b>class</b> ParserClass = parser&lt;DataType&gt; &gt;
<b>class</b> opt;
}
</pre>
</pre></div>
<p>The first template argument specifies what underlying data type the command
line argument is, and is used to select a default parser implementation. The
@@ -1484,13 +1490,13 @@ href="#customparser">custom parser</a>.</p>
line options. It too is a templated class which can take up to three
arguments:</p>
<pre>
<div class="doc_code"><pre>
<b>namespace</b> cl {
<b>template</b> &lt;<b>class</b> DataType, <b>class</b> Storage = <b>bool</b>,
<b>class</b> ParserClass = parser&lt;DataType&gt; &gt;
<b>class</b> list;
}
</pre>
</pre></div>
<p>This class works the exact same as the <a
href="#cl::opt"><tt>cl::opt</tt></a> class, except that the second argument is
@@ -1510,11 +1516,11 @@ be used.</p>
<p>The <tt>cl::alias</tt> class is a nontemplated class that is used to form
aliases for other arguments.</p>
<pre>
<div class="doc_code"><pre>
<b>namespace</b> cl {
<b>class</b> alias;
}
</pre>
</pre></div>
<p>The <a href="#cl::aliasopt"><tt>cl::aliasopt</tt></a> attribute should be
used to specify which option this is an alias for. Alias arguments default to
@@ -1533,22 +1539,22 @@ the conversion from string to data.</p>
<p>The <tt>cl::extrahelp</tt> class is a nontemplated class that allows extra
help text to be printed out for the <tt>--help</tt> option.</p>
<pre>
<div class="doc_code"><pre>
<b>namespace</b> cl {
<b>struct</b> extrahelp;
}
</pre>
</pre></div>
<p>To use the extrahelp, simply construct one with a <tt>const char*</tt>
parameter to the constructor. The text passed to the constructor will be printed
at the bottom of the help message, verbatim. Note that multiple
<tt>cl::extrahelp</tt> <b>can</b> be used but this practice is discouraged. If
<tt>cl::extrahelp</tt> <b>can</b> be used, but this practice is discouraged. If
your tool needs to print additional help information, put all that help into a
single <tt>cl::extrahelp</tt> instance.</p>
<p>For example:</p>
<pre>
<div class="doc_code"><pre>
cl::extrahelp("\nADDITIONAL HELP:\n\n This is the extra help\n");
</pre>
</pre></div>
</div>
<!-- ======================================================================= -->
@@ -1675,13 +1681,13 @@ this the default for all <tt>unsigned</tt> options.</p>
<p>To start out, we declare our new <tt>FileSizeParser</tt> class:</p>
<pre>
<div class="doc_code"><pre>
<b>struct</b> FileSizeParser : <b>public</b> cl::basic_parser&lt;<b>unsigned</b>&gt; {
<i>// parse - Return true on error.</i>
<b>bool</b> parse(cl::Option &amp;O, <b>const char</b> *ArgName, <b>const</b> std::string &amp;ArgValue,
<b>unsigned</b> &amp;Val);
};
</pre>
</pre></div>
<p>Our new class inherits from the <tt>cl::basic_parser</tt> template class to
fill in the default, boiler plate, code for us. We give it the data type that
@@ -1697,7 +1703,7 @@ is not well formed, the parser should output an error message and return true.
Otherwise it should return false and set '<tt>Val</tt>' to the parsed value. In
our example, we implement <tt>parse</tt> as:</p>
<pre>
<div class="doc_code"><pre>
<b>bool</b> FileSizeParser::parse(cl::Option &amp;O, <b>const char</b> *ArgName,
<b>const</b> std::string &amp;Arg, <b>unsigned</b> &amp;Val) {
<b>const char</b> *ArgStart = Arg.c_str();
@@ -1723,7 +1729,7 @@ our example, we implement <tt>parse</tt> as:</p>
}
}
}
</pre>
</pre></div>
<p>This function implements a very simple parser for the kinds of strings we are
interested in. Although it has some holes (it allows "<tt>123KKK</tt>" for
@@ -1732,25 +1738,25 @@ itself to print out the error message (the <tt>error</tt> method always returns
true) in order to get a nice error message (shown below). Now that we have our
parser class, we can use it like this:</p>
<pre>
<div class="doc_code"><pre>
<b>static</b> <a href="#cl::opt">cl::opt</a>&lt;<b>unsigned</b>, <b>false</b>, FileSizeParser&gt;
MFS(<i>"max-file-size"</i>, <a href="#cl::desc">cl::desc</a>(<i>"Maximum file size to accept"</i>),
<a href="#cl::value_desc">cl::value_desc</a>("<i>size</i>"));
</pre>
</pre></div>
<p>Which adds this to the output of our program:</p>
<pre>
<div class="doc_code"><pre>
OPTIONS:
-help - display available options (--help-hidden for more)
...
<b>-max-file-size=&lt;size&gt; - Maximum file size to accept</b>
</pre>
</pre></div>
<p>And we can test that our parse works correctly now (the test program just
prints out the max-file-size argument value):</p>
<pre>
<div class="doc_code"><pre>
$ ./test
MFS: 0
$ ./test -max-file-size=123MB
@@ -1759,7 +1765,7 @@ $ ./test -max-file-size=3G
MFS: 3221225472
$ ./test -max-file-size=dog
-max-file-size option: 'dog' value invalid for file size argument!
</pre>
</pre></div>
<p>It looks like it works. The error message that we get is nice and helpful,
and we seem to accept reasonable file sizes. This wraps up the "custom parser"

View File

@@ -19,7 +19,9 @@
<ol>
<li><a href="#hw">Hardware</a>
<ol>
<li><a href="#alpha">Alpha</a></li>
<li><a href="#arm">ARM</a></li>
<li><a href="#ia64">Itanium</a></li>
<li><a href="#mips">MIPS</a></li>
<li><a href="#ppc">PowerPC</a></li>
<li><a href="#sparc">SPARC</a></li>
@@ -31,10 +33,7 @@
<li><a href="#linux">Linux</a></li>
<li><a href="#osx">OS X</a></li>
</ol></li>
<li><a href="#fmt">Binary File Formats</a>
<ol>
<li>...</li>
</ol></li>
<li><a href="#misc">Miscellaneous resources</a></li>
</ol>
<div class="doc_author">
@@ -46,10 +45,18 @@
<!-- *********************************************************************** -->
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="arm">ARM</a></div>
<div class="doc_subsection"><a name="alpha">Alpha</a></div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">ARM - Official manuals and docs</div>
<div class="doc_text">
<ul>
<li><a
href="http://ftp.digital.com/pub/Digital/info/semiconductor/literature/dsc-library.html">Alpha manuals</a>
</li>
</ul>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="arm">ARM</a></div>
<div class="doc_text">
<ul>
@@ -60,19 +67,25 @@ Cores</a>)</li>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="mips">MIPS</a></div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">MIPS - Official manuals and docs</div>
<div class="doc_subsection"><a name="ia64">Itanium (ia64)</a></div>
<div class="doc_text">
<ul>
<li><a
href="http://developer.intel.com/design/itanium2/documentation.htm">Itanium documentation</a>
</li>
</ul>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="mips">MIPS</a></div>
<div class="doc_text">
<ul>
<li><a
href="http://mips.com/content/Documentation/MIPSDocumentation/ProcessorArchitecture/doclibrary">MIPS
Processor Architecture</a></li>
</ul>
</div>
<!-- ======================================================================= -->
@@ -130,9 +143,6 @@ branch stubs for powerpc64-linux (from binutils)</a></li>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="sparc">SPARC</a></div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">Official manuals and docs</div>
<div class="doc_text">
<ul>
@@ -152,6 +162,7 @@ branch stubs for powerpc64-linux (from binutils)</a></li>
<ul>
<li><a
href="http://www.amd.com/us-en/Processors/TechnicalResources/0,,30_182_739,00.html">AMD processor manuals</a></li>
<li><a href="http://www.x86-64.org/documentation">X86-64 ABI</a></li>
</ul>
</div>
@@ -219,13 +230,16 @@ ABI</a></li>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="fmt">Binary File Formats</a></div>
<div class="doc_section"><a name="misc">Miscellaneous resources</a></div>
<!-- *********************************************************************** -->
<ul>
<li><a
href="http://www.nondot.org/sabre/os/articles/ExecutableFileFormats/">Executable
File Format library</a></li>
<li><a href="http://gcc.gnu.org/projects/prefetch.html">GCC prefetch project</a>
page has a good survey of the prefetching capabilities of a variety of modern
processors.</li>
</ul>
<!-- *********************************************************************** -->

View File

@@ -24,8 +24,8 @@
</ol>
<div class="doc_author">
<p>Written by <a href="http://misha.brukman.net">Misha Brukman</a> and
Brad Jones</p>
<p>Written by <a href="http://misha.brukman.net">Misha Brukman</a>,
Brad Jones, and <a href="http://nondot.org/sabre">Chris Lattner</a></p>
</div>
<!-- *********************************************************************** -->
@@ -86,9 +86,6 @@ function and then be turned into an instruction if warranted.</p>
<li><tt>llvm/include/llvm/Intrinsics.h</tt>:
add an enum in the <tt>llvm::Intrinsic</tt> namespace</li>
<li><tt>llvm/lib/CodeGen/IntrinsicLowering.cpp</tt>:
implement the lowering for this intrinsic</li>
<li><tt>llvm/lib/VMCore/Verifier.cpp</tt>:
Add code to check the invariants of the intrinsic are respected.</li>
@@ -100,17 +97,63 @@ function and then be turned into an instruction if warranted.</p>
not access memory or does not write to memory, add it to the relevant list
of functions.</li>
<li><tt>llvm/lib/Transforms/Utils/Local.cpp</tt>: If it is possible to
constant-propagate your intrinsic, add support to it in the
<tt>canConstantFoldCallTo</tt> and <tt>ConstantFoldCall</tt> functions.</li>
<li><tt>llvm/lib/Transforms/Utils/Local.cpp</tt>: If it is possible to constant
fold your intrinsic, add support to it in the <tt>canConstantFoldCallTo</tt> and
<tt>ConstantFoldCall</tt> functions.</li>
<li>Test your intrinsic</li>
<li><tt>llvm/test/Regression/*</tt>: add your test cases to the test suite</li>
</ol>
<p>If this intrinsic requires code generator support (i.e., it cannot be
lowered), you should also add support to the code generator in question.</p>
<p>Once the intrinsic has been added to the system, you must add code generator
support for it. Generally you must do the following steps:</p>
<dl>
<dt>Add support to the C backend in <tt>lib/Target/CBackend/</tt></dt>
<dd>Depending on the intrinsic, there are a few ways to implement this. First,
if it makes sense to lower the intrinsic to an expanded sequence of C code in
all cases, just emit the expansion in <tt>visitCallInst</tt>. Second, if the
intrinsic has some way to express it with GCC (or any other compiler)
extensions, it can be conditionally supported based on the compiler compiling
the CBE output (see llvm.prefetch for an example). Third, if the intrinsic
really has no way to be lowered, just have the code generator emit code that
prints an error message and calls abort if executed.
</dd>
<dt>Add a enum value for the SelectionDAG node in
<tt>include/llvm/CodeGen/SelectionDAGNodes.h</tt></dt>
<dd>Also, add code to <tt>lib/CodeGen/SelectionDAG/SelectionDAG.cpp</tt> (and
<tt>SelectionDAGPrinter.cpp</tt>) to print the node.</dd>
<dt>Add code to <tt>SelectionDAG/SelectionDAGISel.cpp</tt> to recognize the
intrinsic.</dt>
<dd>Presumably the intrinsic should be recognized and turned into the node you
added above.</dd>
<dt>Add code to <tt>SelectionDAG/LegalizeDAG.cpp</tt> to <a
href="CodeGenerator.html#selectiondag_legalize">legalize, promote, and
expand</a> the node as necessary.</dt>
<dd>If the intrinsic can be expanded to primitive operations, legalize can break
the node down into other elementary operations that are be supported.</dd>
<dt>Add target-specific support to specific code generators.</dt>
<dd>Extend the code generators you are interested in to recognize and support
the node, emitting the code you want.</dd>
</dl>
<p>
Unfortunately, the process of extending the code generator to support a new node
is not extremely well documented. As such, it is often helpful to look at other
intrinsics (e.g. <tt>llvm.ctpop</tt>) to see how they are recognized and turned
into a node by <tt>SelectionDAGISel.cpp</tt>, legalized by
<tt>LegalizeDAG.cpp</tt>, then finally emitted by the various code generators.
</p>
</div>
@@ -194,11 +237,8 @@ installations.</span> Only add new types if it is absolutely necessary.</p>
<ol>
<li><tt>llvm/include/llvm/Type.def</tt>:
add enum for the type</li>
<li><tt>llvm/include/llvm/Type.h</tt>:
add ID number for the new type; add static <tt>Type*</tt> for this type</li>
add enum for the new type; add static <tt>Type*</tt> for this type</li>
<li><tt>llvm/lib/VMCore/Type.cpp</tt>:
add mapping from <tt>TypeID</tt> =&gt; <tt>Type*</tt>;
@@ -222,11 +262,8 @@ installations.</span> Only add new types if it is absolutely necessary.</p>
<div class="doc_text">
<ol>
<li><tt>llvm/include/llvm/Type.def</tt>:
add enum for the type</li>
<li><tt>llvm/include/llvm/Type.h</tt>:
add ID number for the new type; add a forward declaration of the type
add enum for the new type; add a forward declaration of the type
also</li>
<li><tt>llvm/include/llvm/DerivedType.h</tt>:
@@ -283,7 +320,6 @@ void calcTypeName(const Type *Ty,
<a href="http://validator.w3.org/check/referer"><img
src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!" /></a>
<a href="http://misha.brukman.net">Misha Brukman</a><br>
<a href="http://llvm.cs.uiuc.edu">The LLVM Compiler Infrastructure</a>
<br>
Last modified: $Date$

View File

@@ -67,17 +67,23 @@
When I compile code using the LLVM GCC front end, it complains that it
cannot find libcrtend.a.
</li>
<li>
How can I disable all optimizations when compiling code using the LLVM GCC front end?
</li>
</ol>
</li>
<li><a href="#cfe_code">Questions about code generated by the GCC front-end</a>
<ol>
<li>What is this <tt>__main()</tt> call that gets inserted into
<tt>main()</tt>?</li>
<li>Where did all of my code go??</li>
<li>What is this <tt>llvm.global_ctors</tt> and
<li><a href="#__main">What is this <tt>__main()</tt> call that gets inserted into
<tt>main()</tt>?</a></li>
<li><a href="#iosinit">What is this <tt>llvm.global_ctors</tt> and
<tt>_GLOBAL__I__tmp_webcompile...</tt> stuff that happens when I
#include &lt;iostream&gt;?</li>
#include &lt;iostream&gt;?</a></li>
<li><a href="#codedce">Where did all of my code go??</a></li>
<li><a href="#undef">What is this "<tt>undef</tt>" thing that shows up in my code?</a></li>
</ol>
</li>
</ol>
@@ -168,10 +174,6 @@ LLVM have been ported to a plethora of platforms.</p>
<li>The GCC front end code is not as portable as the LLVM suite, so it may not
compile as well on unsupported platforms.</li>
<li>The Python test classes are more UNIX-centric than they should be, so
porting to non-UNIX like platforms (i.e. Windows, MacOS 9) will require some
effort.</li>
<li>The LLVM build system relies heavily on UNIX shell tools, like the Bourne
Shell and sed. Porting to systems without these tools (MacOS 9, Plan 9) will
require more effort.</li>
@@ -350,31 +352,6 @@ build.</p>
affects projects other than LLVM. Try upgrading or downgrading your GCC.</p>
</div>
<div class="question">
<p>
When I use the test suite, all of the C Backend tests fail. What is
wrong?
</p>
</div>
<div class="answer">
<p>
If you build LLVM and the C Backend tests fail in <tt>llvm/test/Programs</tt>,
then chances are good that the directory pointed to by the LLVM_LIB_SEARCH_PATH
environment variable does not contain the libcrtend.a library.
</p>
<p>
To fix it, verify that LLVM_LIB_SEARCH_PATH points to the correct directory
and that libcrtend.a is inside. For pre-built LLVM GCC front ends, this
should be the absolute path to
<tt>cfrontend/&lt;<i>platform</i>&gt;/llvm-gcc/bytecode-libs</tt>. If you've
built your own LLVM GCC front end, then ensure that you've built and installed
the libraries in <tt>llvm/runtime</tt> and have LLVM_LIB_SEARCH_PATH pointing
to the <tt>LLVMGCCDIR/bytecode-libs</tt> subdirectory.
</p>
</div>
<div class="question">
<p>After CVS update, rebuilding gives the error "No rule to make target".</p>
</div>
@@ -462,13 +439,27 @@ find libcrtend.a.
<div class="answer">
<p>
In order to find libcrtend.a, you must have the directory in which it lives in
your LLVM_LIB_SEARCH_PATH environment variable. For the binary distribution of
the LLVM GCC front end, this will be the full path of the bytecode-libs
directory inside of the LLVM GCC distribution.
The only way this can happen is if you haven't installed the runtime library. To
correct this, do:</p>
<pre>
% cd llvm/runtime
% make clean ; make install-bytecode
</pre>
</div>
<div class="question">
<p>
How can I disable all optimizations when compiling code using the LLVM GCC front end?
</p>
</div>
<div class="answer">
<p>
Passing "-Wa,-disable-opt -Wl,-disable-opt" will disable *all* cleanup and
optimizations done at the llvm level, leaving you with the truly horrible
code that you desire.
</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
@@ -476,6 +467,7 @@ directory inside of the LLVM GCC distribution.
</div>
<div class="question"><p>
<a name="__main"></a>
What is this <tt>__main()</tt> call that gets inserted into <tt>main()</tt>?
</p></div>
@@ -497,29 +489,8 @@ linked in automatically when you link the program.
<!--=========================================================================-->
<div class="question"><p>
Where did all of my code go??
</p></div>
<div class="answer">
<p>
If you are using the LLVM demo page, you may often wonder what happened to all
of the code that you typed in. Remember that the demo script is running the
code through the LLVM optimizers, so if your code doesn't actually do anything
useful, it might all be deleted.
</p>
<p>
To prevent this, make sure that the code is actually needed. For example, if
you are computing some expression, return the value from the function instead of
leaving it in a local variable. If you really want to constrain the optimizer,
you can read from and assign to <tt>volatile</tt> global variables.
</p>
</div>
<!--=========================================================================-->
<div class="question">
<a name="iosinit"></a>
<p> What is this <tt>llvm.global_ctors</tt> and
<tt>_GLOBAL__I__tmp_webcompile...</tt> stuff that happens when I #include
&lt;iostream&gt;?</p>
@@ -548,6 +519,51 @@ instead of <tt>iostream</tt>s to print values.</p>
</div>
<!--=========================================================================-->
<div class="question"><p>
<a name="codedce"></a>
Where did all of my code go??
</p></div>
<div class="answer">
<p>
If you are using the LLVM demo page, you may often wonder what happened to all
of the code that you typed in. Remember that the demo script is running the
code through the LLVM optimizers, so if your code doesn't actually do anything
useful, it might all be deleted.
</p>
<p>
To prevent this, make sure that the code is actually needed. For example, if
you are computing some expression, return the value from the function instead of
leaving it in a local variable. If you really want to constrain the optimizer,
you can read from and assign to <tt>volatile</tt> global variables.
</p>
</div>
<!--=========================================================================-->
<div class="question"><p>
<a name="undef"></a>
<p>What is this "<tt>undef</tt>" thing that shows up in my code?
</p></div>
<div class="answer">
<p>
<a href="LangRef.html#undef"><tt>undef</tt></a> is the LLVM way of representing
a value that is not defined. You can get these if you do not initialize a
variable before you use it. For example, the C function:</p>
<div class="doc_code">
<tt>int X() { int i; return i; }</tt>
</div>
<p>Is compiled to "<tt>ret int undef</tt>" because "i" never has a value
specified for it.
</p>
</div>
<!-- *********************************************************************** -->
<hr>

View File

@@ -38,13 +38,16 @@
<li><a href="#layout">Program layout</a>
<ol>
<li><a href="#cvsdir"><tt>CVS</tt> directories</a>
<li><a href="#examples"><tt>llvm/examples</tt></a>
<li><a href="#include"><tt>llvm/include</tt></a>
<li><a href="#lib"><tt>llvm/lib</tt></a>
<li><a href="#projects"><tt>llvm/projects</tt></a>
<li><a href="#runtime"><tt>llvm/runtime</tt></a>
<li><a href="#test"><tt>llvm/test</tt></a>
<li><a href="#llvmtest"><tt>llvm-test</tt></a>
<li><a href="#tools"><tt>llvm/tools</tt></a>
<li><a href="#utils"><tt>llvm/utils</tt></a>
<li><a href="#win32"><tt>llvm/win32</tt></a>
</ol></li>
<li><a href="#tutorial">An Example Using the LLVM Tool Chain</a>
@@ -86,6 +89,12 @@ end is a modified version of GCC 3.4 (we track the GCC 3.4 development). Once
compiled into LLVM bytecode, a program can be manipulated with the LLVM tools
from the LLVM suite.</p>
<p>
There is a third, optional piece called llvm-test. It is a suite of programs
with a testing harness that can be used to further test LLVM's functionality
and performance.
</p>
</div>
<!-- *********************************************************************** -->
@@ -102,46 +111,53 @@ from the LLVM suite.</p>
<li>Read the documentation.</li>
<li>Read the documentation.</li>
<li>Remember that you were warned twice about reading the documentation.</li>
<li>Install the GCC front end:
<li>Install the GCC front end if you intend to compile C or C++:
<ol>
<li><tt>cd <i>where-you-want-the-C-front-end-to-live</i></tt>
<li><tt>cd <i>where-you-want-the-C-front-end-to-live</i></tt></li>
<li><tt>gunzip --stdout cfrontend.<i>platform</i>.tar.gz | tar -xvf -</tt>
<li><b>Sparc and MacOS X Only:</b><br>
<tt>cd cfrontend/<i>platform</i><br>
./fixheaders</tt>
</li>
<li><tt>cd cfrontend/<i>platform</i><br>
./fixheaders</tt></li>
<li>Add the cfrontend's "bin" directory to your PATH variable.</li>
</ol></li>
<li>Get the Source Code
<li>Get the LLVM Source Code
<ul>
<li>With the distributed files:
<li>With the distributed files (or use <a href="#checkout">CVS</a>):
<ol>
<li><tt>cd <i>where-you-want-llvm-to-live</i></tt>
<li><tt>gunzip --stdout llvm-<i>version</i>.tar.gz | tar -xvf -</tt>
<li><tt>cd llvm</tt>
</ol></li>
<li>With anonymous CVS access (or use a <a href="#mirror">mirror</a>):
<ol>
<li><tt>cd <i>where-you-want-llvm-to-live</i></tt></li>
<li><tt>cvs -d
:pserver:anon@llvm-cvs.cs.uiuc.edu:/var/cvs/llvm login</tt></li>
<li>Hit the return key when prompted for the password.
<li><tt>cvs -z3 -d :pserver:anon@llvm-cvs.cs.uiuc.edu:/var/cvs/llvm
co llvm</tt></li>
<li><tt>cd llvm</tt></li>
<li><tt>cvs up -P -d</tt></li>
</ol></li>
</ul></li>
<li><b>[Optional]</b> Get the Test Suite Source Code
<ul>
<li>With the distributed files (or use <a href="#checkout">CVS</a>):
<ol>
<li><tt>cd <i>where-you-want-llvm-to-live</i></tt>
<li><tt>cd llvm/projects</tt>
<li><tt>gunzip --stdout llvm-test-<i>version</i>.tar.gz | tar -xvf -</tt>
</ol></li>
</ul></li>
<li>Configure the LLVM Build Environment
<ol>
<li>Change directory to where you want to store the LLVM object
files and run <tt>configure</tt> to configure the Makefiles and
header files for the default platform. Useful options include:
<li><tt>cd <i>where-you-want-to-build-llvm</i></tt></li>
<li><tt><i>/path/to/llvm/</i>configure [options]</tt><br>
Some common options:
<ul>
<li><tt>--prefix=<i>directory</i></tt>
<p>Specify for <i>directory</i> the full pathname of where you
want the LLVM tools and libraries to be installed (default
<tt>/usr/local</tt>).</p></li>
<li><tt>--with-llvmgccdir=<i>directory</i></tt>
<p>Specify the full pathname of where the LLVM GCC frontend is
installed.</p></li>
<p>Optionally, specify for <i>directory</i> the full pathname of the
C/C++ front end installation to use with this LLVM configuration. If
not specified, the PATH will be searched.</p></li>
<li><tt>--enable-spec2000=<i>directory</i></tt>
<p>Enable the SPEC2000 benchmarks for testing. The SPEC2000
benchmarks should be available in
@@ -151,7 +167,6 @@ from the LLVM suite.</p>
<li>Build the LLVM Suite:
<ol>
<li>Set your LLVM_LIB_SEARCH_PATH environment variable.</li>
<li><tt>gmake -k |&amp; tee gnumake.out
&nbsp;&nbsp;&nbsp;# this is csh or tcsh syntax</tt></li>
<li>If you get an "internal compiler error (ICE)" see <a href="#brokengcc">below</a>.</li>
@@ -198,7 +213,7 @@ software you will need.</p>
</tr>
<tr>
<td>Linux</td>
<td>x86<sup>1</sup></td>
<td>x86<sup><a href="#pf_1">1</a></sup></td>
<td>GCC</td>
</tr>
<tr>
@@ -208,17 +223,27 @@ software you will need.</p>
</tr>
<tr>
<td>FreeBSD</td>
<td>x86<sup>1</sup></td>
<td>x86<sup><a href="#pf_1">1</a></sup></td>
<td>GCC</td>
</tr>
<tr>
<td>MacOS X<sup>2</sup></td>
<td>MacOS X<sup><a href="#pf_2">2</a></sup></td>
<td>PowerPC</td>
<td>GCC</td>
</tr>
<tr>
<td>Cygwin/Win32</td>
<td>x86<sup>1</sup></td>
<td>x86<sup><a href="#pf_1">1</a></sup></td>
<td>GCC 3.4.X, binutils 2.15</td>
</tr>
<tr>
<td>MinGW/Win32</td>
<td>x86<sup><a href="#pf_1">1</a>,<a href="#pf_6">6</a></sup></td>
<td>GCC 3.4.X, binutils 2.15</td>
</tr>
<tr>
<td>Linux</td>
<td>amd64<sup><a href="#pf_3">3</a></sup></td>
<td>GCC</td>
</tr>
</table>
@@ -233,33 +258,58 @@ software you will need.</p>
</tr>
<tr>
<td>Windows</td>
<td>x86<sup>1</sup></td>
<td>Visual Studio .NET<sup>4,5</sup>, MinGW</td>
<td>x86<sup><a href="#pf_1">1</a></sup></td>
<td>Visual Studio .NET<sup><a href="#pf_4">4</a>,<a href="#pf_5">5</a></sup></td>
<tr>
<td>AIX<sup>3,4</sup></td>
<td>AIX<sup><a href="#pf_3">3</a>,<a href="#pf_4">4</a></sup></td>
<td>PowerPC</td>
<td>GCC</td>
</tr>
<tr>
<td>Linux<sup>3,5</sup></td>
<td>Linux<sup><a href="#pf_3">3</a>,<a href="#pf_5">5</a></sup></td>
<td>PowerPC</td>
<td>GCC</td>
</tr>
<tr>
<td>Linux<sup><a href="#pf_7">7</a></sup></td>
<td>Alpha</td>
<td>GCC</td>
</tr>
<tr>
<td>Linux<sup><a href="#pf_7">7</a></sup></td>
<td>Itanium (IA-64)</td>
<td>GCC</td>
</tr>
<tr>
<td>HP-UX<sup><a href="#pf_7">7</a></sup></td>
<td>Itanium (IA-64)</td>
<td>HP aCC</td>
</tr>
</table>
<p>
Notes:<br>
<sup>1</sup> Code generation supported for Pentium processors and up<br>
<sup>2</sup> Code generation supported for 32-bit ABI only<br>
<sup>3</sup> No native code generation<br>
<sup>4</sup> Build is not complete: one or more tools don't link<br>
<sup>5</sup> The GCC-based C/C++ frontend does not build<br>
</p>
<p><b>Notes:</b></p>
<div class="doc_notes">
<ol>
<li><a name="pf_1">Code generation supported for Pentium processors and
up</a></li>
<li><a name="pf_2">Code generation supported for 32-bit ABI only</a></li>
<li><a name="pf_3">No native code generation</a></li>
<li><a name="pf_4">Build is not complete: one or more tools don't link</a></li>
<li><a name="pf_5">The GCC-based C/C++ frontend does not build</a></li>
<li><a name="pf_6">The port is done using the MSYS shell.
<a href="http://www.mingw.org/MinGWiki/">Download</a> and install
bison (excl. M4.exe) and flex in that order. Build binutils-2.15 from source,
if necessary.</li>
<li><a name="pf_7">Native code generation exists but is not complete.</a></li>
</ol>
</div>
<p>Note that you will need about 1-3 GB of space for a full LLVM build in Debug
mode, depending on the system (because of all the debug info), and the libraries
appear in more than one of the tools that get linked, so there is some
duplication. If you do not need many of the tools and you are space-conscious,
mode, depending on the system (it is so large because of all the debugging
information and the fact that the libraries are statically linked into multiple
tools). If you do not need many of the tools and you are space-conscious,
you can disable them individually in <tt>llvm/tools/Makefile</tt>. The Release
build requires considerably less space.</p>
@@ -295,7 +345,7 @@ href="CFEBuildInstrs.html">try to compile it</a> on your platform.</p>
<tr>
<td><a href="http://gcc.gnu.org">GCC</a></td>
<td>3.4.2</td>
<td>C/C++ compiler (<a href="#Note4">Note 4</a>)</td>
<td>C/C++ compiler<sup><a href="#sf1">1</a></sup></td>
</tr>
<tr>
@@ -310,102 +360,80 @@ href="CFEBuildInstrs.html">try to compile it</a> on your platform.</p>
<td>YACC compiler</td>
</tr>
<tr>
<td><a href="https://www.cvshome.org/downloads.html">CVS</a></td>
<td>&ge;1.11</td>
<td>CVS access to LLVM<sup><a href="#sf2">2</a></sup></td>
</tr>
<tr>
<td><a href="http://savannah.gnu.org/projects/dejagnu">DejaGnu</a></td>
<td>1.4.2</td>
<td>Automated test suite (<a href="#Note2">Note 2</a>)</td>
<td>Automated test suite<sup><a href="#sf3">3</a></sup></td>
</tr>
<tr>
<td><a href="http://www.tcl.tk/software/tcltk/">tcl</a></td>
<td>8.3, 8.4</td>
<td>Automated test suite (<a href="#Note2">Note 2</a>)</td>
<td>Automated test suite<sup><a href="#sf3">3</a></sup></td>
</tr>
<tr>
<td><a href="http://expect.nist.gov/">expect</a></td>
<td>5.38.0</td>
<td>Automated test suite (<a href="#Note2">Note 2</a>)</td>
<td>Automated test suite<sup><a href="#sf3">3</a></sup></td>
</tr>
<tr>
<td><a href="http://www.perl.com/download.csp">perl</a></td>
<td>&ge;5.6.0</td>
<td>Nightly tester, utilities</td>
</tr>
<tr>
<td><a href="http://savannah.gnu.org/projects/m4">GNU M4</a>
<td>1.4</td>
<td>Macro processor for configuration (<a href="#Note1">Note 1</a>)</td>
<td>Macro processor for configuration<sup><a href="#sf4">4</a></sup></td>
</tr>
<tr>
<td><a href="http://www.gnu.org/software/autoconf">GNU Autoconf</a></td>
<td>2.59</td>
<td>Configuration script builder (<a href="#Note1">Note 1</a>)</td>
<td>Configuration script builder<sup><a href="#sf4">4</a></sup></td>
</tr>
<tr>
<td><a href="http://www.gnu.org/software/automake">GNU Automake</a></td>
<td>2.59</td>
<td>aclocal macro generator (<a href="#Note1">Note 1</a>)</td>
</tr>
<tr>
<td><a href="http://www.perl.com/download.csp">perl</a></td>
<td>&gt;5.6.0</td>
<td>Nightly tester, utilities</td>
<td>1.9.2</td>
<td>aclocal macro generator<sup><a href="#sf4">4</a></sup></td>
</tr>
<tr>
<td><a href="http://savannah.gnu.org/projects/libtool">libtool</a></td>
<td>1.5.10</td>
<td>Shared library manager (<a href="#Note1">Note 1</a>)</td>
</tr>
<tr>
<td><a href="http://www.codesourcery.com/qmtest">QMTest</a></td>
<td>2.0.3</td>
<td>Automated test suite (<a href="#Note2">Note 2</a>,<a href="#Note3">
Note 3</a>)</td>
</tr>
<tr>
<td><a href="http://www.python.org">Python</a></td>
<td>2.3</td>
<td>Automated test suite (<a href="#Note2">Note 2</a>,<a href="#Note3">
Note 3</a>)</td>
</tr>
<tr>
<td><a href="https://www.cvshome.org/downloads.html">CVS</a></td>
<td>&gt;1.11</td>
<td>CVS access to LLVM (<a href="#Note5">Note 5</a>)</td>
<td>Shared library manager<sup><a href="#sf4">4</a></sup></td>
</tr>
</table>
<p>Notes:</p>
<p><b>Notes:</b></p>
<div class="doc_notes">
<ol>
<li><a name="Note1">If you want to make changes to the configure scripts,
you will need GNU autoconf (2.59), and consequently, GNU M4 (version 1.4
or higher). You will also need automake. We only use aclocal from that
package.</a></li>
<li><a name="Note2">Only needed if you want to run the automated test
suite in the <tt>test</tt> directory.</a></li>
<li><a name="Note3">These are needed to use the LLVM test suite.</a>
Please note that newer versions of QMTest may not work with the LLVM
test suite. QMTest 2.0.3 can be retrieved from the QMTest CVS
repository using the following commands:
<ul>
<li><tt>cvs -d :pserver:anoncvs@cvs.codesourcery.com:/home/qm/Repository login</tt></li>
<li>When prompted, use <tt>anoncvs</tt> as the password. </li>
<li><tt>cvs -d :pserver:anoncvs@cvs.codesourcery.com:/home/qm/Repository co -r release-2-0-3 qm</tt></li>
</ul>
</li>
<li><a name="Note4">Only the C and C++ languages are needed so there's no
<li><a name="sf3">Only the C and C++ languages are needed so there's no
need to build the other languages for LLVM's purposes.</a> See
<a href="#brokengcc">below</a> for specific version info.
</li>
<li><a name="Note5">You only need CVS if you intend to build from the
<a href="#brokengcc">below</a> for specific version info.</li>
<li><a name="sf2">You only need CVS if you intend to build from the
latest LLVM sources. If you're working from a release distribution, you
don't need CVS.</a></li>
<li><a name="sf3">Only needed if you want to run the automated test
suite in the <tt>llvm/test</tt> directory.</a></li>
<li><a name="sf4">If you want to make changes to the configure scripts,
you will need GNU autoconf (2.59), and consequently, GNU M4 (version 1.4
or higher). You will also need automake (1.9.2). We only use aclocal
from that package.</a></li>
</ol>
</div>
<p>Additionally, your compilation host is expected to have the usual
plethora of Unix utilities. Specifically:</p>
<ul>
@@ -413,7 +441,7 @@ href="CFEBuildInstrs.html">try to compile it</a> on your platform.</p>
<li><b>bzip2*</b> - bzip2 command for distribution generation</li>
<li><b>bunzip2*</b> - bunzip2 command for distribution checking</li>
<li><b>chmod</b> - change permissions on a file</li>
<li><b>cat</b> - output concatentation utility</li>
<li><b>cat</b> - output concatenation utility</li>
<li><b>cp</b> - copy files</li>
<li><b>date</b> - print the current date/time </li>
<li><b>echo</b> - print to standard output</li>
@@ -447,7 +475,8 @@ href="CFEBuildInstrs.html">try to compile it</a> on your platform.</p>
<p>LLVM is very demanding of the host C++ compiler, and as such tends to expose
bugs in the compiler. In particular, several versions of GCC crash when trying
to compile LLVM. We routinely use GCC 3.3.3 and GCC 3.4.0 and have had success
with them. Other versions of GCC will probably work as well. GCC versions listed
with them (however, see below). Other versions of GCC will probably
work as well. GCC versions listed
here are known to not work. If you are using one of these versions, please try
to upgrade your GCC to something more recent. If you run into a problem with a
version of GCC not listed here, please <a href="mailto:llvmdev@cs.uiuc.edu">let
@@ -464,6 +493,16 @@ problems in the STL that effectively prevent it from compiling LLVM.
<p><b>GCC 3.3.2</b>: This version of GCC suffered from a <a
href="http://gcc.gnu.org/PR13392">serious bug</a> which causes it to crash in
the "<tt>convert_from_eh_region_ranges_1</tt>" GCC function.</p>
<p><b>Cygwin GCC 3.3.3</b>: The version of GCC 3.3.3 commonly shipped with
Cygwin does not work. Please <a href="CFEBuildInstrs.html#cygwin">upgrade
to a newer version</a> if possible.</p>
<p><b>SuSE GCC 3.3.3</b>: The version of GCC 3.3.3 shipped with SuSE 9.1 (and
possibly others) does not compile LLVM correctly (it appears that exception
handling is broken in some cases). Please download the FSF 3.3.3 or upgrade
to a newer version of GCC.</p>
<p><b>IA-64 GCC 4.0.0</b>: The IA-64 version of GCC 4.0.0 is known to
miscompile LLVM.</p>
</div>
@@ -515,7 +554,7 @@ All these paths are absolute:</p>
<dt>LLVMGCCDIR
<dd>
This is the where the LLVM GCC Front End is installed.
This is where the LLVM GCC Front End is installed.
<p>
For the pre-built GCC front end binaries, the LLVMGCCDIR is
<tt>cfrontend/<i>platform</i>/llvm-gcc</tt>.
@@ -531,23 +570,17 @@ All these paths are absolute:</p>
<div class="doc_text">
<p>
In order to compile and use LLVM, you will need to set some environment
variables. There are also some shell aliases which you may find useful.
You can set these on the command line, or better yet, set them in your
<tt>.cshrc</tt> or <tt>.profile</tt>.
In order to compile and use LLVM, you may need to set some environment
variables.
<dl>
<dt><tt>LLVM_LIB_SEARCH_PATH</tt>=<tt><i>LLVMGCCDIR</i>/bytecode-libs</tt>
<dd>
This environment variable helps the LLVM GCC front end find bytecode
libraries that it will need for compilation.
<p>
<dt>alias llvmgcc <i>LLVMGCCDIR</i><tt>/bin/gcc</tt>
<dt>alias llvmg++ <i>LLVMGCCDIR</i><tt>/bin/g++</tt>
<dd>
This alias allows you to use the LLVM C and C++ front ends without putting
them in your <tt>PATH</tt> or typing in their complete pathnames.
<dt><tt>LLVM_LIB_SEARCH_PATH</tt>=<tt>/path/to/your/bytecode/libs</tt></dt>
<dd>[Optional] This environment variable helps LLVM linking tools find the
locations of your bytecode libraries. It is provided only as a
convenience since you can specify the paths using the -L options of the
tools and the C/C++ front-end will automatically use the bytecode files
installed in its
<tt>lib</tt> directory.</dd>
</dl>
</div>
@@ -562,34 +595,34 @@ You can set these on the command line, or better yet, set them in your
<p>
If you have the LLVM distribution, you will need to unpack it before you
can begin to compile it. LLVM is distributed as a set of two files: the LLVM
suite and the LLVM GCC front end compiled for your platform. Each
file is a TAR archive that is compressed with the gzip program.
suite and the LLVM GCC front end compiled for your platform. There is an
additional test suite that is optional. Each file is a TAR archive that is
compressed with the gzip program.
</p>
<p> The files are as follows:
<p>The files are as follows, with <em>x.y</em> marking the version number:
<dl>
<dt>llvm-1.3.tar.gz
<dd>This is the source code to the LLVM suite.
<p>
<dt><tt>llvm-x.y.tar.gz</tt></dt>
<dd>Source release for the LLVM libraries and tools.<br/></dd>
<dt>cfrontend-1.3.source.tar.gz
<dd>This is the source release of the GCC front end.
<p>
<dt><tt>llvm-test-x.y.tar.gz</tt></dt>
<dd>Source release for the LLVM test suite.</dd>
<dt>cfrontend-1.3.sparc-sun-solaris2.8.tar.gz
<dd>This is the binary release of the GCC front end for Solaris/Sparc.
<p>
<dt><tt>cfrontend-x.y.source.tar.gz</tt></dt>
<dd>Source release of the GCC front end.<br/></dd>
<dt>cfrontend-1.3.i686-redhat-linux-gnu.tar.gz
<dd>This is the binary release of the GCC front end for Linux/x86.
<p>
<dt><tt>cfrontend-x.y.sparc-sun-solaris2.8.tar.gz</tt></dt>
<dd>Binary release of the GCC front end for Solaris/Sparc.
<br/></dd>
<dt>cfrontend-1.3.i386-unknown-freebsd5.1.tar.gz
<dd>This is the binary release of the GCC front end for FreeBSD/x86.
<p>
<dt><tt>cfrontend-x.y.i686-redhat-linux-gnu.tar.gz</tt></dt>
<dd>Binary release of the GCC front end for Linux/x86.<br/></dd>
<dt>cfrontend-1.3.powerpc-apple-darwin7.0.0.tar.gz
<dd>This is the binary release of the GCC front end for MacOS X/PPC.
<dt><tt>cfrontend-x.y.i386-unknown-freebsd5.1.tar.gz</tt></dt>
<dd>Binary release of the GCC front end for FreeBSD/x86.<br/></dd>
<dt><tt>cfrontend-x.y.powerpc-apple-darwin7.8.0.tar.gz</tt></dt>
<dd>Binary release of the GCC front end for MacOS X/PPC.<br/></dd>
</dl>
</div>
@@ -619,15 +652,27 @@ test directories, and local copies of documentation files.</p>
<p>If you want to get a specific release (as opposed to the most recent
revision), you can specify a label. The following releases have the following
label:</p>
labels:</p>
<ul>
<li>Release 1.5: <b>RELEASE_15</b></li>
<li>Release 1.4: <b>RELEASE_14</b></li>
<li>Release 1.3: <b>RELEASE_13</b></li>
<li>Release 1.2: <b>RELEASE_12</b></li>
<li>Release 1.1: <b>RELEASE_11</b></li>
<li>Release 1.0: <b>RELEASE_1</b></li>
</ul>
<p>If you would like to get the LLVM test suite (a separate package as of 1.4),
you get it from the CVS repository:</p>
<pre>
cd llvm/projects
cvs -z3 -d :pserver:anon@llvm-cvs.cs.uiuc.edu:/var/cvs/llvm co llvm-test
</pre>
<p>By placing it in the <tt>llvm/projects</tt>, it will be automatically
configured by the LLVM configure script as well as automatically updated when
you run <tt>cvs update</tt>.</p>
<p>If you would like to get the GCC front end source code, you can also get it
from the CVS repository:</p>
@@ -636,7 +681,7 @@ from the CVS repository:</p>
</pre>
<p>Please note that you must follow <a href="CFEBuildInstrs.html">these
instructions</a> to successfully build the LLVM C front-end.</p>
instructions</a> to successfully build the LLVM GCC front-end.</p>
</div>
@@ -676,8 +721,7 @@ location must be specified when the LLVM suite is configured.</p>
-</tt></li>
</ol>
<p>If you are using Solaris/Sparc or MacOS X/PPC, you will need to fix the
header files:</p>
<p>Next, you will need to fix your system header files:</p>
<p><tt>cd cfrontend/<i>platform</i><br>
./fixheaders</tt></p>
@@ -701,10 +745,10 @@ not for the faint of heart, so be forewarned.</p>
<div class="doc_text">
<p>Once checked out from the CVS repository, the LLVM suite source code must be
configured via the <tt>configure</tt> script. This script sets variables in
<tt>llvm/Makefile.config</tt> and <tt>llvm/include/Config/config.h</tt>. It
also populates <i>OBJ_ROOT</i> with the Makefiles needed to begin building
LLVM.</p>
configured via the <tt>configure</tt> script. This script sets variables in the
various <tt>*.in</tt> files, most notably <tt>llvm/Makefile.config</tt> and
<tt>llvm/include/Config/config.h</tt>. It also populates <i>OBJ_ROOT</i> with
the Makefiles needed to begin building LLVM.</p>
<p>The following environment variables are used by the <tt>configure</tt>
script to configure the build system:</p>
@@ -730,47 +774,59 @@ script to configure the build system:</p>
<p>The following options can be used to set or enable LLVM specific options:</p>
<dl>
<dt><i>--with-llvmgccdir=LLVMGCCDIR</i>
<dd>
Path to the location where the LLVM GCC front end binaries and
associated libraries were installed. This must be specified as an
absolute pathname.
<p>
<dt><i>--enable-optimized</i>
<dt><i>--with-llvmgccdir</i></dt>
<dd>Path to the LLVM C/C++ FrontEnd to be used with this LLVM configuration.
The value of this option should specify the full pathname of the C/C++ Front
End to be used. If this option is not provided, the PATH will be searched for
a program named <i>llvm-gcc</i> and the C/C++ FrontEnd install directory will
be inferred from the path found. If the option is not given, and no llvm-gcc
can be found in the path then a warning will be produced by
<tt>configure</tt> indicating this situation. LLVM may still be built with
the <tt>tools-only</tt> target but attempting to build the runtime libraries
will fail as these libraries require llvm-gcc and llvm-g++. See
<a href="#installcf">Install the GCC Front End</a> for details on installing
the C/C++ Front End. See
<a href="CFEBuildInstrs.html">Bootstrapping the LLVM C/C++ Front-End</a>
for details on building the C/C++ Front End.</dd>
<dt><i>--with-tclinclude</i></dt>
<dd>Path to the tcl include directory under which <tt>tclsh</tt> can be
found. Use this if you have multiple tcl installations on your machine and you
want to use a specific one (8.x) for LLVM. LLVM only uses tcl for running the
dejagnu based test suite in <tt>llvm/test</tt>. If you don't specify this
option, the LLVM configure script will search for the tcl 8.4 and 8.3
releases.
<p></p>
</dd>
<dt><i>--enable-optimized</i></dt>
<dd>
Enables optimized compilation by default (debugging symbols are removed
and GCC optimization flags are enabled). The default is to use an
unoptimized build (also known as a debug build).
<p>
<dt><i>--enable-jit</i>
<p></p>
</dd>
<dt><i>--enable-jit</i></dt>
<dd>
Compile the Just In Time (JIT) compiler functionality. This is not
available
on all platforms. The default is dependent on platform, so it is best
to explicitly enable it if you want it.
<p>
<dt><i>--enable-spec2000</i>
<dt><i>--enable-spec2000=&lt;<tt>directory</tt>&gt;</i>
<dd>
Enable the use of SPEC2000 when testing LLVM. This is disabled by default
(unless <tt>configure</tt> finds SPEC2000 installed). By specifying
<tt>directory</tt>, you can tell configure where to find the SPEC2000
benchmarks. If <tt>directory</tt> is left unspecified, <tt>configure</tt>
uses the default value
<tt>/home/vadve/shared/benchmarks/speccpu2000/benchspec</tt>.
<p>
<dt><i>--enable-spec95</i>
<dt><i>--enable-spec95=&lt;<tt>directory</tt>&gt;</i>
<dd>
Enable the use of SPEC95 when testing LLVM. It is similar to the
<i>--enable-spec2000</i> option.
<p>
<dt><i>--enable-povray</i>
<dt><i>--enable-povray=&lt;<tt>directory</tt>&gt;</i>
<dd>
Enable the use of Povray as an external test. Versions of Povray written
in C should work. This option is similar to the <i>--enable-spec2000</i>
option.
<p></p>
</dd>
<dt><i>--enable-targets=</i><tt>target-option</tt></dt>
<dd>Controls which targets will be built and linked into llc. The default
value for <tt>target_options</tt> is "all" which builds and links all
available targets. The value "host-only" can be specified to build only a
native compiler (no cross-compiler targets available). The "native" target is
selected as the target of the build host. You can also specify a comma
separated list of target names that you want available in llc. The target
names use all lower case. The current set of targets is: <br/>
<tt>alpha, ia64, powerpc, skeleton, sparc, x86</tt>.
<p></p></dd>
<dt><i>--enable-doxygen</i></dt>
<dd>Look for the doxygen program and enable construction of doxygen based
documentation from the source code. This is disabled by default because
generating the documentation can take a long time and producess 100s of
megabytes of output.</dd>
</dl>
<p>To configure LLVM, follow these steps:</p>
@@ -783,20 +839,10 @@ script to configure the build system:</p>
<li>Run the <tt>configure</tt> script located in the LLVM source tree:
<br>
<tt><i>SRC_ROOT</i>/configure</tt>
<tt><i>SRC_ROOT</i>/configure --prefix=/install/path [other options]</tt>
<p>
</ol>
<p>In addition to running <tt>configure</tt>, you must set the
<tt>LLVM_LIB_SEARCH_PATH</tt> environment variable in your startup scripts.
This environment variable is used to locate "system" libraries like
"<tt>-lc</tt>" and "<tt>-lm</tt>" when linking. This variable should be set to
the absolute path of the <tt>bytecode-libs</tt> subdirectory of the GCC front
end, or <i>LLVMGCCDIR</i>/<tt>bytecode-libs</tt>. For example, one might set
<tt>LLVM_LIB_SEARCH_PATH</tt> to
<tt>/home/vadve/lattner/local/x86/llvm-gcc/bytecode-libs</tt> for the x86
version of the GCC front end on our research machines.</p>
</div>
<!-- ======================================================================= -->
@@ -841,7 +887,7 @@ builds:</p>
<p><tt>gmake</tt></p>
<p>If the build fails, please <a href="#brokengcc">check here</a> to see if you
are using a known broken version of GCC to compile LLVM with.</p>
are using a version of GCC that is known not to compile LLVM.</p>
<p>
If you have multiple processors in your machine, you may wish to use some of
@@ -860,7 +906,7 @@ source code:</p>
generated C/C++ files, libraries, and executables.
<p>
<dt><tt>gmake distclean</tt>
<dt><tt>gmake dist-clean</tt>
<dd>
Removes everything that <tt>gmake clean</tt> does, but also removes files
generated by <tt>configure</tt>. It attempts to return the source tree to the
@@ -869,11 +915,13 @@ source code:</p>
<dt><tt>gmake install</tt>
<dd>
Installs LLVM libraries and tools in a heirarchy under $PREFIX, specified with
<tt>./configure --prefix=[dir]</tt>, defaults to <tt>/usr/local</tt>.
Installs LLVM header files, libraries, tools, and documentation in a
hierarchy
under $PREFIX, specified with <tt>./configure --prefix=[dir]</tt>, which
defaults to <tt>/usr/local</tt>.
<p>
<dt><tt>gmake -C runtime install</tt>
<dt><tt>gmake -C runtime install-bytecode</tt>
<dd>
Assuming you built LLVM into $OBJDIR, when this command is run, it will
install bytecode libraries into the GCC front end's bytecode library
@@ -882,6 +930,10 @@ source code:</p>
<p>
</dl>
<p>Please see the <a href="MakefileGuide.html">Makefile Guide</a> for further
details on these <tt>make</tt> targets and descriptions of other targets
available.</p>
<p>It is also possible to override default values from <tt>configure</tt> by
declaring variables on the command line. The following are some examples:</p>
@@ -900,6 +952,11 @@ declaring variables on the command line. The following are some examples:</p>
<dd>
Print what <tt>gmake</tt> is doing on standard output.
<p>
<dt><tt>gmake TOOL_VERBOSE=1</tt></dt>
<dd>Ask each tool invoked by the makefiles to print out what it is doing on
the standard output. This also implies <tt>VERBOSE=1</tt>.
<p></dd>
</dl>
<p>Every directory in the LLVM object tree includes a <tt>Makefile</tt> to build
@@ -941,9 +998,9 @@ named after the build type:</p>
<dd>
<dl>
<dt>Tools
<dd><tt><i>OBJ_ROOT</i>/tools/Debug</tt>
<dd><tt><i>OBJ_ROOT</i>/Debug/bin</tt>
<dt>Libraries
<dd><tt><i>OBJ_ROOT</i>/lib/Debug</tt>
<dd><tt><i>OBJ_ROOT</i>/Debug/lib</tt>
</dl>
<p>
@@ -951,9 +1008,9 @@ named after the build type:</p>
<dd>
<dl>
<dt>Tools
<dd><tt><i>OBJ_ROOT</i>/tools/Release</tt>
<dd><tt><i>OBJ_ROOT</i>/Release/bin</tt>
<dt>Libraries
<dd><tt><i>OBJ_ROOT</i>/lib/Release</tt>
<dd><tt><i>OBJ_ROOT</i>/Release/lib</tt>
</dl>
<p>
@@ -961,9 +1018,9 @@ named after the build type:</p>
<dd>
<dl>
<dt>Tools
<dd><tt><i>OBJ_ROOT</i>/tools/Profile</tt>
<dd><tt><i>OBJ_ROOT</i>/Profile/bin</tt>
<dt>Libraries
<dd><tt><i>OBJ_ROOT</i>/lib/Profile</tt>
<dd><tt><i>OBJ_ROOT</i>/Profile/lib</tt>
</dl>
</dl>
@@ -977,18 +1034,21 @@ named after the build type:</p>
<div class="doc_text">
<p>
If you're running on a linux system that supports the "<a
href="http://www.tat.physik.uni-tuebingen.de/~rguenth/linux/binfmt_misc.html">binfmt_misc</a>"
If you're running on a Linux system that supports the "<a
href="http://www.tat.physik.uni-tuebingen.de/~rguenth/linux/binfmt_misc.html">
binfmt_misc</a>"
module, and you have root access on the system, you can set your system up to
execute LLVM bytecode files directly. To do this, use commands like this (the
first command may not be required if you are already using the module):</p>
<div class="doc_code">
<pre>
$ mount -t binfmt_misc none /proc/sys/fs/binfmt_misc
$ echo ':llvm:M::llvm::/path/to/lli:' > /proc/sys/fs/binfmt_misc/register
$ echo ':llvm:M::llvm::/path/to/lli:' &gt; /proc/sys/fs/binfmt_misc/register
$ chmod u+x hello.bc (if needed)
$ ./hello.bc
</pre>
</div>
<p>
This allows you to execute LLVM bytecode files directly. Thanks to Jack
@@ -1015,17 +1075,20 @@ The following is a brief introduction to code layout:</p>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="cvsdir"><tt>CVS</tt> directories</a></div>
<div class="doc_text">
<p>Every directory checked out of CVS will contain a <tt>CVS</tt> directory; for
the most part these can just be ignored.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="examples"><tt>llvm/examples</tt></a></div>
<div class="doc_text">
<p>This directory contains some simple examples of how to use the LLVM IR and
JIT.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="include"><tt>llvm/include</tt></a></div>
<div class="doc_text">
<p>This directory contains public header files exported from the LLVM
@@ -1054,7 +1117,6 @@ library. The three main subdirectories of this directory are:</p>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="lib"><tt>llvm/lib</tt></a></div>
<div class="doc_text">
<p>This directory contains most of the source files of the LLVM system. In LLVM,
@@ -1088,7 +1150,7 @@ different <a href="#tools">tools</a>.</p>
<dd> This directory contains files that describe various target architectures
for code generation. For example, the <tt>llvm/lib/Target/SparcV9</tt>
directory holds the Sparc machine description while
<tt>llvm/lib/Target/CBackend</tt> implements the LLVM-to-C converter</dd>
<tt>llvm/lib/Target/CBackend</tt> implements the LLVM-to-C converter.</dd>
<dt><tt><b>llvm/lib/CodeGen/</b></tt></dt>
<dd> This directory contains the major parts of the code generator: Instruction
@@ -1114,6 +1176,16 @@ different <a href="#tools">tools</a>.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="projects"><tt>llvm/projects</tt></a></div>
<div class="doc_text">
<p>This directory contains projects that are not strictly part of LLVM but are
shipped with LLVM. This is also the directory where you should create your own
LLVM-based projects. See <tt>llvm/projects/sample</tt> for an example of how
to set up your own project. See <tt>llvm/projects/Stacker</tt> for a fully
functional example of a compiler front end.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="runtime"><tt>llvm/runtime</tt></a></div>
<div class="doc_text">
@@ -1139,12 +1211,13 @@ end to compile.</p>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="llvmtest"><tt>llvm-test</tt></a></div>
<div class="doc_text">
<p>This is not a directory in the normal llvm module, it is a separate CVS
<p>This is not a directory in the normal llvm module; it is a separate CVS
module that must be checked out (usually to <tt>projects/llvm-test</tt>). This
module contains a comprehensive correctness, performance and benchmarking test
module contains a comprehensive correctness, performance, and benchmarking
test
suite for LLVM. It is a separate CVS module because not every LLVM user is
interested in downloading or building such a comprehensive test. For further
details on this test suite, please see the
interested in downloading or building such a comprehensive test suite. For
further details on this test suite, please see the
<a href="TestingGuide.html">Testing Guide</a> document.</p>
</div>
@@ -1179,7 +1252,9 @@ information is in the <a href="CommandGuide/index.html">Command Guide</a>.</p>
pre-processing, translation, optimization, assembly, and linking of programs
all from one command line. <tt>llvmc</tt> also takes care of processing the
dependent libraries found in bytecode. This reduces the need to get the
traditional <tt>-l&lt;name&gt;</tt> options right on the command line.</dd>
traditional <tt>-l&lt;name&gt;</tt> options right on the command line. Please
note that this tool, while functional, is still experimental and not feature
complete.</dd>
<dt><tt><b>llvm-ar</b></tt></dt>
<dd>The archiver produces an archive containing
@@ -1194,6 +1269,13 @@ information is in the <a href="CommandGuide/index.html">Command Guide</a>.</p>
<dd>The disassembler transforms the LLVM bytecode to human readable
LLVM assembly.</dd>
<dt><tt><b>llvm-ld</b></tt></dt>
<dd><tt>llvm-ld</tt> is very similar to gccld and provides a general purpose
and extensible linker for LLVM. This is the linker invoked by <tt>llvmc</tt>.
It allows optimization modules to be loaded so that language specific
optimizations can be applied at link time. This tool is considered
experimental.</dd>
<dt><tt><b>llvm-link</b></tt></dt>
<dd><tt>llvm-link</tt>, not surprisingly, links multiple LLVM modules into
a single program.</dd>
@@ -1203,31 +1285,30 @@ information is in the <a href="CommandGuide/index.html">Command Guide</a>.</p>
can directly execute LLVM bytecode (although very slowly...). In addition
to a simple interpreter, <tt>lli</tt> also has a tracing mode (entered by
specifying <tt>-trace</tt> on the command line). Finally, for
architectures that support it (currently only x86 and Sparc), by default,
architectures that support it (currently x86, Sparc, and PowerPC), by default,
<tt>lli</tt> will function as a Just-In-Time compiler (if the
functionality was compiled in), and will execute the code <i>much</i>
faster than the interpreter.</dd>
<dt><tt><b>llc</b></tt></dt>
<dd> <tt>llc</tt> is the LLVM backend compiler, which
translates LLVM bytecode to a SPARC or x86 assembly file, or to C code (with
translates LLVM bytecode to a native code assembly file or to C code (with
the -march=c option).</dd>
<dt><tt><b>llvmgcc</b></tt></dt>
<dd><tt>llvmgcc</tt> is a GCC-based C frontend
<dt><tt><b>llvm-gcc</b></tt></dt>
<dd><tt>llvm-gcc</tt> is a GCC-based C frontend
that has been retargeted to emit LLVM code as the machine code output. It
works just like any other GCC compiler, taking the typical <tt>-c, -S, -E,
-o</tt> options that are typically used. The source code for the
<tt>llvmgcc</tt> tool is currently not included in the LLVM CVS tree
because it is quite large and not very interesting.
<tt>llvm-gcc</tt> tool is available as a separate CVS module.
<blockquote>
<dl>
<dt><tt><b>gccas</b></tt></dt>
<dd>This tool is invoked by the <tt>llvmgcc</tt> frontend as the
<dd>This tool is invoked by the <tt>llvm-gcc</tt> frontend as the
"assembler" part of the compiler. This tool actually assembles LLVM
assembly to LLVM bytecode, performs a variety of optimizations, and
outputs LLVM bytecode. Thus when you invoke
<tt>llvmgcc -c x.c -o x.o</tt>, you are causing <tt>gccas</tt> to be
<tt>llvm-gcc -c x.c -o x.o</tt>, you are causing <tt>gccas</tt> to be
run, which writes the <tt>x.o</tt> file (which is an LLVM bytecode file
that can be disassembled or manipulated just like any other bytecode
file). The command line interface to <tt>gccas</tt> is designed to be
@@ -1331,6 +1412,15 @@ are code generators for parts of LLVM infrastructure.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="win32"><tt>llvm/win32</tt></a></div>
<div class="doc_text">
<p>This directory contains build scripts and project files for use with
Visual C++. This allows developers on Windows to build LLVM without the need
for Cygwin. The contents of this directory should be considered experimental
at this time.
</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="tutorial">An Example Using the LLVM Tool Chain</a>
@@ -1350,7 +1440,7 @@ are code generators for parts of LLVM infrastructure.</p>
</pre></li>
<li><p>Next, compile the C file into a LLVM bytecode file:</p>
<p><tt>% llvmgcc hello.c -o hello</tt></p>
<p><tt>% llvm-gcc hello.c -o hello</tt></p>
<p>Note that you should have already built the tools and they have to be
in your path, at least <tt>gccas</tt> and <tt>gccld</tt>.</p>

View File

@@ -0,0 +1,360 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Getting Started with LLVM System for Microsoft Visual Studio</title>
<link rel="stylesheet" href="llvm.css" type="text/css">
</head>
<body>
<div class="doc_title">
Getting Started with the LLVM System using Microsoft Visual Studio
</div>
<ul>
<li><a href="#overview">Overview</a>
<li><a href="#quickstart">Getting Started Quickly (A Summary)</a>
<li><a href="#requirements">Requirements</a>
<ol>
<li><a href="#hardware">Hardware</a>
<li><a href="#software">Software</a>
</ol></li>
<li><a href="#starting">Getting Started with LLVM</a>
<ol>
<li><a href="#terminology">Terminology and Notation</a>
<li><a href="#objfiles">The Location of LLVM Object Files</a>
</ol></li>
<li><a href="#tutorial">An Example Using the LLVM Tool Chain</a>
<li><a href="#problems">Common Problems</a>
<li><a href="#links">Links</a>
</ul>
<div class="doc_author">
<p>Written by:
<a href="mailto:jeffc@jolt-lang.org">Jeff Cohen</a>
</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="overview"><b>Overview</b></a>
</div>
<!-- *********************************************************************** -->
<div class="doc_text">
<p>The Visual Studio port at this time is experimental. It is suitable for
use only if you are writing your own compiler front end or otherwise have a
need to dynamically generate machine code. The JIT and interpreter are
functional, but it is currently not possible to generate assembly code which
is then assembled into an executable. You can indirectly create executables
by using the C back end.</p>
<p>To emphasize, there is no C/C++ front end currently available.
<tt>llvm-gcc</tt> is based on GCC, which cannot be bootstrapped using VC++.
Eventually there should be a <tt>llvm-gcc</tt> based on Cygwin or MinGW that
is usable. There is also the option of generating bytecode files on Unix and
copying them over to Windows. But be aware the odds of linking C++ code
compiled with <tt>llvm-gcc</tt> with code compiled with VC++ is essentially
zero.</p>
<p>The LLVM test suite cannot be run on the Visual Studio port at this
time.</p>
<p>Most of the tools build and work. <tt>llvm-db</tt> does not build at this
time. <tt>bugpoint</tt> does build, but does not work.
<p>Additional information about the LLVM directory structure and tool chain
can be found on the main <a href="GettingStarted.html">Getting Started</a>
page.</P>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="quickstart"><b>Getting Started Quickly (A Summary)</b></a>
</div>
<!-- *********************************************************************** -->
<div class="doc_text">
<p>Here's the short story for getting up and running quickly with LLVM:</p>
<ol>
<li>Read the documentation.</li>
<li>Read the documentation.</li>
<li>Remember that you were warned twice about reading the documentation.</li>
<li>Get the Source Code
<ul>
<li>With the distributed files:
<ol>
<li><tt>cd <i>where-you-want-llvm-to-live</i></tt>
<li><tt>gunzip --stdout llvm-<i>version</i>.tar.gz | tar -xvf -</tt>
<i>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;or use WinZip</i>
<li><tt>cd llvm</tt></li>
</ol></li>
<li>With anonymous CVS access (or use a <a href="#mirror">mirror</a>):
<ol>
<li><tt>cd <i>where-you-want-llvm-to-live</i></tt></li>
<li><tt>cvs -d
:pserver:anon@llvm-cvs.cs.uiuc.edu:/var/cvs/llvm login</tt></li>
<li>Hit the return key when prompted for the password.
<li><tt>cvs -z3 -d :pserver:anon@llvm-cvs.cs.uiuc.edu:/var/cvs/llvm
co llvm</tt></li>
<li><tt>cd llvm</tt></li>
<li><tt>cvs up -P -d</tt></li>
</ol></li>
</ul></li>
<li>Start Visual Studio
<ol>
<li>Simply double click on the solution file <tt>llvm/win32/llvm.sln</tt>.
</li>
</ol></li>
<li>Build the LLVM Suite:
<ol>
<li>Simply build the solution.</li>
<li>The Fibonacci project is a sample program that uses the JIT. Modify
the project's debugging properties to provide a numeric command line
argument. The program will print the corresponding fibonacci value.</li>
</ol></li>
</ol>
<p>It is strongly encouraged that you get the latest version from CVS. Much
progress has been made since the 1.4 release.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="requirements"><b>Requirements</b></a>
</div>
<!-- *********************************************************************** -->
<div class="doc_text">
<p>Before you begin to use the LLVM system, review the requirements given
below. This may save you some trouble by knowing ahead of time what hardware
and software you will need.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="hardware"><b>Hardware</b></a>
</div>
<div class="doc_text">
<p>Any system that can adequately run Visual Studio .NET 2003 is fine. The
LLVM source tree and object files, libraries and executables will consume
approximately 3GB.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="software"><b>Software</b></a></div>
<div class="doc_text">
<p>You will need Visual Studio .NET 2003. Earlier versions cannot open the
solution/project files. The VS 2005 beta can, but will migrate these files
to its own format in the process. While it should work with the VS 2005
beta, there are no guarantees and there is no support for it at this time.
It has been reported that VC++ Express also works.</p>
<p>You will also need several open source packages: bison, flex, and sed.
These must be installed in <tt>llvm/win32/tools</tt>. These can be found at
<a href="http://gnuwin32.sourceforge.net">http://gnuwin32.sourceforge.net</a>
or
<a href="http://unxutils.sourceforge.net">http://unxutils.sourceforge.net</a>.
Bison prefers that m4 be in the path. You must add it to the Visual Studio
configuration under the menu Options -&gt; Projects -&gt; VC++ Directories.
Alternatively, you can set the environment variable <tt>M4</tt> to point to
<tt>m4</tt> executable.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="starting"><b>Getting Started with LLVM</b></a>
</div>
<!-- *********************************************************************** -->
<div class="doc_text">
<p>The remainder of this guide is meant to get you up and running with
LLVM using Visual Studio and to give you some basic information about the LLVM
environment.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="terminology">Terminology and Notation</a>
</div>
<div class="doc_text">
<p>Throughout this manual, the following names are used to denote paths
specific to the local system and working environment. <i>These are not
environment variables you need to set but just strings used in the rest
of this document below</i>. In any of the examples below, simply replace
each of these names with the appropriate pathname on your local system.
All these paths are absolute:</p>
<dl>
<dt>SRC_ROOT
<dd>
This is the top level directory of the LLVM source tree.
<p>
<dt>OBJ_ROOT
<dd>
This is the top level directory of the LLVM object tree (i.e. the
tree where object files and compiled programs will be placed. It
is fixed at SRC_ROOT/win32).
<p>
</dl>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="objfiles">The Location of LLVM Object Files</a>
</div>
<div class="doc_text">
<p>The object files are placed under <tt>OBJ_ROOT/Debug</tt> for debug builds
and <tt>OBJ_ROOT/Release</tt> for release (optimized) builds. These include
both executables and libararies that your application can link against.
<p>The files that <tt>configure</tt> would create when building on Unix are
created by the <tt>Configure</tt> project and placed in
<tt>OBJ_ROOT/llvm</tt>. You application must have OBJ_ROOT in its include
search path just before <tt>SRC_ROOT/include</tt>.
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="tutorial">An Example Using the LLVM Tool Chain</a>
</div>
<!-- *********************************************************************** -->
<div class="doc_text">
<ol>
<li>First, create a simple C file, name it 'hello.c':
<pre>
#include &lt;stdio.h&gt;
int main() {
printf("hello world\n");
return 0;
}
</pre></li>
<li><p>Next, compile the C file into a LLVM bytecode file:</p>
<p><tt>% llvm-gcc hello.c -o hello</tt></p>
<p>Note that you should have already built the tools and they have to be
in your path, at least <tt>gccas</tt> and <tt>gccld</tt>.</p>
<p>This will create two result files: <tt>hello</tt> and
<tt>hello.bc</tt>. The <tt>hello.bc</tt> is the LLVM bytecode that
corresponds the the compiled program and the library facilities that it
required. <tt>hello</tt> is a simple shell script that runs the bytecode
file with <tt>lli</tt>, making the result directly executable. Note that
all LLVM optimizations are enabled by default, so there is no need for a
"-O3" switch.</p>
<p><b>Note: while you cannot do this step on Windows, you can do it on a
Unix system and transfer <tt>hello.bc</tt> to Windows.</b></p></li>
<li><p>Run the program. To make sure the program ran, execute the
following command:</p>
<p><tt>% lli hello.bc</tt></p></li>
<li><p>Use the <tt>llvm-dis</tt> utility to take a look at the LLVM assembly
code:</p>
<p><tt>% llvm-dis &lt; hello.bc | less</tt><p></li>
<li><p>Compile the program to native assembly using the LLC code
generator:</p>
<p><tt>% llc hello.bc -o hello.s</tt></p>
<li><p>Assemble the native assembly language file into a program:</p>
<p><b>Not currently possible, but eventually will use <tt>NASMW</tt>.</b></p>
<li><p>Execute the native code program:</p>
<p><tt>% ./hello.native</tt></p></li>
</ol>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="problems">Common Problems</a>
</div>
<!-- *********************************************************************** -->
<div class="doc_text">
<p>If you are having problems building or using LLVM, or if you have any other
general questions about LLVM, please consult the <a href="FAQ.html">Frequently
Asked Questions</a> page.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="links">Links</a>
</div>
<!-- *********************************************************************** -->
<div class="doc_text">
<p>This document is just an <b>introduction</b> to how to use LLVM to do
some simple things... there are many more interesting and complicated things
that you can do that aren't documented here (but we'll gladly accept a patch
if you want to write something up!). For more information about LLVM, check
out:</p>
<ul>
<li><a href="http://llvm.cs.uiuc.edu/">LLVM homepage</a></li>
<li><a href="http://llvm.cs.uiuc.edu/doxygen/">LLVM doxygen tree</a></li>
<li><a href="http://llvm.cs.uiuc.edu/docs/Projects.html">Starting a Project
that Uses LLVM</a></li>
</ul>
</div>
<!-- *********************************************************************** -->
<hr>
<address>
<a href="http://jigsaw.w3.org/css-validator/check/referer"><img
src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a>
<a href="http://validator.w3.org/check/referer"><img
src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!" /></a>
<a href="mailto:jeffc@jolt-lang.org">Jeff Cohen</a><br>
<a href="http://llvm.cs.uiuc.edu">The LLVM Compiler Infrastructure</a><br>
Last modified: $Date$
</address>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@@ -19,53 +19,42 @@
<tr><th colspan="8"><b>- <a href="#A">A</a> -</b></th></tr>
<tr>
<td><a href="#ADCE">ADCE</a></td>
<td></td>
<td></td>
</tr>
<tr><th colspan="8"><b>- <a href="#B">B</a> -</b></th></tr>
<tr>
<td><a href="#BURS">BURS</a></td>
<td></td>
<td></td>
</tr>
<tr><th colspan="8"><b>- <a href="#C">C</a> -</b></th></tr>
<tr>
<td><a href="#CSE">CSE</a></td>
<td></td>
<td></td>
</tr>
<tr><th colspan="8"><b>- <a href="#D">D</a> -</b></th></tr>
<tr>
<td><a href="#DSA">DSA</a></td>
<td><a href="#DSE">DSE</a></td>
<td></td>
<td></td>
</tr>
<tr><th colspan="8"><b>- <a href="#I">I</a> -</b></th></tr>
<tr>
<td><a href="#IPA">IPA</a></td>
<td><a href="#IPO">IPO</a></td>
<td></td>
<td></td>
</tr>
<tr><th colspan="8"><b>- <a href="#L">L</a> -</b></th></tr>
<tr>
<td><a href="#LICM">LICM</a></td>
<td><a href="#Load-VN">Load-VN</a></td>
<td></td>
<td></td>
</tr>
<tr><th colspan="8"><b>- <a href="#P">P</a> -</b></th></tr>
<tr>
<td><a href="#PRE">PRE</a></td>
<td></td>
<td></td>
</tr>
<tr><th colspan="8"><b>- <a href="#R">R</a> -</b></th></tr>
<tr>
<td><a href="#Reassociation">Reassociation</a></td>
</tr>
<tr><th colspan="8"><b>- <a href="#S">S</a> -</b></th></tr>
<tr>
<td><a href="#SCCP">SCCP</a></td>
<td><a href="#SSA">SSA</a></td>
<td></td>
</tr>
</table>
</div>
@@ -136,6 +125,7 @@ href="http://www.program-transformation.org/Transform/BURG">BURG</a> tool.</dd>
<dd>Load Value Numbering</dd>
</dl>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="P">- P -</a></div>
<div class="doc_text">
@@ -144,6 +134,18 @@ href="http://www.program-transformation.org/Transform/BURG">BURG</a> tool.</dd>
<dd>Partial Redundancy Elimination</dd>
</dl>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="R">- R -</a></div>
<div class="doc_text">
<dl>
<dt><a name="Reassociation"><b>Reassociation</b></a></dt> <dd>Rearranging
associative expressions to promote better redundancy elimination and other
optimization. For example, changing (A+B-A) into (B+A-A), permitting it to
be optimized into (B+0) then (B).
</dl>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="S">- S -</a></div>
<div class="doc_text">

View File

@@ -12,10 +12,11 @@ DIRS := CommandGuide
include $(LEVEL)/Makefile.common
HTML := $(wildcard $(BUILD_SRC_DIR)/*.html) \
$(wildcard $(BUILD_SRC_DIR)/*.css)
IMAGES := $(wildcard $(BUILD_SRC_DIR)/img/*.*)
DOXYFILES := $(wildcard $(BUILD_SRC_DIR)/doxygen.*)
HTML := $(wildcard $(PROJ_SRC_DIR)/*.html) \
$(wildcard $(PROJ_SRC_DIR)/*.css)
IMAGES := $(wildcard $(PROJ_SRC_DIR)/img/*.*)
DOXYFILES := doxygen.cfg.in doxygen.css doxygen.footer doxygen.header \
doxygen.intro
EXTRA_DIST := $(HTML) $(DOXYFILES) llvm.css CommandGuide img
.PHONY: install-html install-doxygen doxygen
@@ -26,37 +27,40 @@ else
install-local:: install-html
endif
install-html: $(BUILD_OBJ_DIR)/html.tar.gz
install-html: $(PROJ_OBJ_DIR)/html.tar.gz
$(Echo) Installing HTML documentation
$(Verb) $(INSTALL) -d $(LLVM_DOCSDIR)/html
$(Verb) $(INSTALL) -d $(LLVM_DOCSDIR)/html/img
$(Verb) $(INSTALL) -C $(HTML) $(LLVM_DOCSDIR)/html
$(Verb) $(INSTALL) -C $(IMAGES) $(LLVM_DOCSDIR)/html/img
$(Verb) $(INSTALL) -C $(BUILD_OBJ_DIR)/html.tar.gz $(LLVM_DOCSDIR)
$(Verb) $(MKDIR) $(PROJ_docsdir)/html
$(Verb) $(MKDIR) $(PROJ_docsdir)/html/img
$(Verb) $(DataInstall) $(HTML) $(PROJ_docsdir)/html
$(Verb) $(DataInstall) $(IMAGES) $(PROJ_docsdir)/html/img
$(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/html.tar.gz $(PROJ_docsdir)
$(BUILD_OBJ_DIR)/html.tar.gz: $(HTML)
$(PROJ_OBJ_DIR)/html.tar.gz: $(HTML)
$(Echo) Packaging HTML documentation
$(Verb) $(RM) -rf $@ $(BUILD_OBJ_DIR)/html.tar
$(Verb) cd $(BUILD_SRC_DIR) && \
$(TAR) cf $(BUILD_OBJ_DIR)/html.tar *.html
$(Verb) $(GZIP) $(BUILD_OBJ_DIR)/html.tar
$(Verb) $(RM) -rf $@ $(PROJ_OBJ_DIR)/html.tar
$(Verb) cd $(PROJ_SRC_DIR) && \
$(TAR) cf $(PROJ_OBJ_DIR)/html.tar *.html
$(Verb) $(GZIP) $(PROJ_OBJ_DIR)/html.tar
install-doxygen: doxygen
$(Echo) Installing doxygen documentation
$(Echo) Installing doxygen documentation
$(Verb) $(INSTALL) -d $(LLVM_DOCSDIR)/html/doxygen
$(Verb) $(INSTALL) $(BUILD_OBJ_DIR)/doxygen.tar.gz $(LLVM_DOCSDIR)
$(Verb) cd $(BUILD_OBJ_DIR)/doxygen && \
$(Verb) $(MKDIR) $(PROJ_docsdir)/html/doxygen
$(Verb) $(DataInstall) $(PROJ_OBJ_DIR)/doxygen.tar.gz $(PROJ_docsdir)
$(Verb) cd $(PROJ_OBJ_DIR)/doxygen && \
$(FIND) . -type f -exec \
$(INSTALL) -C {} $(LLVM_DOCSDIR)/html/doxygen \;
$(DataInstall) {} $(PROJ_docsdir)/html/doxygen \;
doxygen: $(BUILD_OBJ_DIR)/doxygen.tar.gz
doxygen: $(PROJ_OBJ_DIR)/doxygen.tar.gz
$(BUILD_OBJ_DIR)/doxygen.tar.gz: $(DOXYFILES) $(BUILD_OBJ_DIR)/doxygen.cfg
$(PROJ_OBJ_DIR)/doxygen.tar.gz: $(DOXYFILES) $(PROJ_OBJ_DIR)/doxygen.cfg
$(Echo) Building doxygen documentation
$(Verb) $(DOXYGEN) $(BUILD_OBJ_DIR)/doxygen.cfg
$(Verb) if test -e $(PROJ_OBJ_DIR)/doxygen ; then \
$(RM) -rf $(PROJ_OBJ_DIR)/doxygen ; \
fi
$(Verb) $(DOXYGEN) $(PROJ_OBJ_DIR)/doxygen.cfg
$(Echo) Packaging doxygen documentation
$(Verb) $(RM) -rf $@ $(BUILD_OBJ_DIR)/doxygen.tar
$(Verb) $(TAR) cf $(BUILD_OBJ_DIR)/doxygen.tar doxygen
$(Verb) $(GZIP) $(BUILD_OBJ_DIR)/doxygen.tar
$(Verb) $(RM) -rf $@ $(PROJ_OBJ_DIR)/doxygen.tar
$(Verb) $(TAR) cf $(PROJ_OBJ_DIR)/doxygen.tar doxygen
$(Verb) $(GZIP) $(PROJ_OBJ_DIR)/doxygen.tar

View File

@@ -28,12 +28,17 @@
</li>
<li><a href="#tutorial">Tutorial</a>
<ol>
<li><a href="#libraries">Libraries</a></li>
<li><a href="#libraries">Libraries</a>
<ol>
<li><a href="#Modules">Bytecode Modules</a></li>
</ol>
</li>
<li><a href="#tools">Tools</a>
<ol>
<li><a href="#JIT">JIT Tools</a></li>
</ol>
</li>
<li><a href="#projects">Projects</a></li>
</ol>
</li>
<li><a href="#targets">Targets Supported</a>
@@ -41,6 +46,7 @@
<li><a href="#all">all</a></li>
<li><a href="#all-local">all-local</a></li>
<li><a href="#check">check</a></li>
<li><a href="#check-local">check-local</a></li>
<li><a href="#clean">clean</a></li>
<li><a href="#clean-local">clean-local</a></li>
<li><a href="#dist">dist</a></li>
@@ -49,6 +55,8 @@
<li><a href="#install">install</a></li>
<li><a href="#preconditions">preconditions</a></li>
<li><a href="#printvars">printvars</a></li>
<li><a href="#reconfigure">reconfigure</a></li>
<li><a href="#spotless">spotless</a></li>
<li><a href="#tags">tags</a></li>
<li><a href="#uninstall">uninstall</a></li>
</ol>
@@ -108,10 +116,15 @@
software, but it can build yours too. Built into the system is knowledge of
the <tt>llvm/projects</tt> directory. Any directory under <tt>projects</tt>
that has both a <tt>configure</tt> script and a <tt>Makefile</tt> is assumed
to be a project that uses the LLVM Makefile system. This allows your project
to be a project that uses the LLVM Makefile system. Building software that
uses LLVM does not require the LLVM Makefile System nor even placement in the
<tt>llvm/projects</tt> directory. However, doing so will allow your project
to get up and running quickly by utilizing the built-in features that are used
to compile LLVM. LLVM compiles itself using the same features of the makefile
system as used for projects.</p>
<p>For complete details on setting up your projects configuration, simply
mimic the <tt>llvm/projects/sample</tt> project or for further details,
consult the <a href="Projects.html">Projects.html</a> page.</p>
</div>
<!-- ======================================================================= -->
@@ -195,7 +208,7 @@
<div class="doc_subsection"><a name="Comments">Comments</a></div>
<div class="doc_text">
<p>User Makefiles need not have comments in them unless the construction is
unusual or it doesn't strictly follow the rules and patterns of the LLVM
unusual or it does not strictly follow the rules and patterns of the LLVM
makefile system. Makefile comments are invoked with the pound (#) character.
The # character and any text following it, to the end of the line, are ignored
by <tt>make</tt>.</p>
@@ -233,6 +246,37 @@
Note that you normally do not need to specify the sources involved. The LLVM
Makefile system will infer the source files from the contents of the source
directory.</p>
<p>The <tt>LOADABLE_MODULE=1</tt> directive can be used in conjunction with
<tt>SHARED_LIBRARY=1</tt> to indicate that the resulting shared library should
be openable with the <tt>dlopen</tt> function and searchable with the
<tt>dlsym</tt> function (or your operating system's equivalents). While this
isn't strictly necessary on Linux and a few other platforms, it is required
on systems like HP-UX and Darwin. You should use <tt>LOADABLE_MODULE</tt> for
any shared library that you intend to be loaded into an tool via the
<tt>-load</tt> option. See the
<a href="WritingAnLLVMPass.html#makefile">WritingAnLLVMPass.html</a> document
for an example of why you might want to do this.
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection"><a name="Modules">Bytecode Modules</a></div>
<div class="doc_text">
<p>In some situations, it is desireable to build a single bytecode module from
a variety of sources, instead of an archive, shared library, or bytecode
library. Bytecode modules can be specified in addition to any of the other
types of libraries by defining the <a href="#MODULE_NAME">MODULE_NAME</a>
variable. For example:</p>
<pre><tt>
LIBRARYNAME = mylib
BYTECODE_LIBRARY = 1
MODULE_NAME = mymod
</tt></pre>
<p>will build a module named <tt>mymod.bc</tt> from the sources in the
directory. This module will be an aggregation of all the bytecode modules
derived from the sources. The example will also build a bytecode archive
containing a bytecode module for each compiled source file. The difference is
subtle, but important depending on how the module or library is to be linked.
</p>
</div>
<!-- ======================================================================= -->
@@ -312,11 +356,13 @@
<div class="doc_text">
<p>This section describes each of the targets that can be built using the LLVM
Makefile system. Any target can be invoked from any directory but not all are
applicable to a given directory (e.g. "check", "dist", and "install" will
applicable to a given directory (e.g. "check", "dist" and "install" will
always operate as if invoked from the top level directory).</p>
<table style="text-align:left">
<tr><th>Target Name</th><th>Implied Targets</th><th>Target Description</th></tr>
<tr>
<th>Target Name</th><th>Implied Targets</th><th>Target Description</th>
</tr>
<tr><td><a href="#all"><tt>all</tt></a></td><td></td>
<td>Compile the software recursively. Default target.
</td></tr>
@@ -324,7 +370,12 @@
<td>Compile the software in the local directory only.
</td></tr>
<tr><td><a href="#check"><tt>check</tt></a></td><td></td>
<td>Change to the llvm/test directory and run regression tests.
<td>Change to the <tt>test</tt> directory in a project and run the
test suite there.
</td></tr>
<tr><td><a href="#check-local"><tt>check-local</tt></a></td><td></td>
<td>Run a local test suite. Generally this is only defined in the
<tt>Makefile</tt> of the project's <tt>test</tt> directory.
</td></tr>
<tr><td><a href="#clean"><tt>clean</tt></a></td><td></td>
<td>Remove built objects recursively.
@@ -335,7 +386,7 @@
<tr><td><a href="#dist"><tt>dist</tt></a></td><td>all</td>
<td>Prepare a source distribution tarball.
</td></tr>
<tr><td><a href="#dist-check"><tt>dist-check</tt></a></td><td>all check</td>
<tr><td><a href="#dist-check"><tt>dist-check</tt></a></td><td>all</td>
<td>Prepare a source distribution tarball and check that it builds.
</td></tr>
<tr><td><a href="#dist-clean"><tt>dist-clean</tt></a></td><td>clean</td>
@@ -377,12 +428,41 @@
the current directory instead of recursively.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="check">check</a></div>
<div class="doc_text">
<p>This target can be invoked from anywhere within a project's directories
but always invokes the <a href="#check-local"><tt>check-local</tt></a> target
in the project's <tt>test</tt> directory, if it exists and has a
<tt>Makefile</tt>. A warning is produced otherwise. If
<a href="#TESTSUITE"><tt>TESTSUITE</tt></a> is defined on the <tt>make</tt>
command line, it will be passed down to the invocation of
<tt>make check-local</tt> in the <tt>test</tt> directory. The intended usage
for this is to assist in running specific suites of tests. If
<tt>TESTSUITE</tt> is not set, the implementation of <tt>check-local</tt>
should run all normal tests. It is up to the project to define what
different values for <tt>TESTSUTE</tt> will do. See the
<a href="TestingGuide.html">TestingGuide</a> for further details.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="check-local">check-local</a></div>
<div class="doc_text">
<p>This target should be implemented by the <tt>Makefile</tt> in the project's
<tt>test</tt> directory. It is invoked by the <tt>check</tt> target elsewhere.
Each project is free to define the actions of <tt>check-local</tt> as
appropriate for that project. The LLVM project itself uses dejagnu to run a
suite of feature and regresson tests. Other projects may choose to use
dejagnu or any other testing mechanism.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="clean">clean</a></div>
<div class="doc_text">
<p>This target cleans the build directory, recursively removing all things
that the Makefile builds. Despite once or twice attempting to remove /*, the
cleaning rules have been made guarded so they shouldn't go awry.</p>
that the Makefile builds. The cleaning rules have been made guarded so they
shouldn't go awry (via <tt>rm -f $(UNSET_VARIABLE)/*</tt> which will attempt
to erase the entire directory structure.</p>
</div>
<!-- ======================================================================= -->
@@ -453,8 +533,30 @@
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="printvars">printvars</a></div>
<div class="doc_text">
<p>This utility target just causes LLVM to print out some of its variables so
that you can double check how things are set. </p>
<p>This utility target just causes the LLVM makefiles to print out some of
the makefile variables so that you can double check how things are set. </p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="reconfigure">reconfigure</a></div>
<div class="doc_text">
<p>This utility target will force a reconfigure of LLVM or your project. It
simply runs <tt>$(PROJ_OBJ_ROOT)/config.status --recheck</tt> to rerun the
configuration tests and rebuild the configured files. This isn't generally
useful as the makefiles will reconfigure themselves whenever its necessary.
</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="spotless">spotless</a></div>
<div class="doc_text">
<p>This utility target, only available when <tt>$(PROJ_OBJ_ROOT)</tt> is not
the same as <tt>$(PROJ_SRC_ROOT)</tt>, will completely clean the
<tt>$(PROJ_OBJ_ROOT)</tt> directoy by removing its content entirely and
reconfiguring the directory. This returns the <tt>$(PROJ_OBJ_ROOT)</tt>
directory to a completely fresh state. All content in the directory except
configured files and top-level makefiles will be lost.</p>
<div class="doc_warning"><p>Use with caution.</p></div>
</div>
<!-- ======================================================================= -->
@@ -544,6 +646,14 @@
source files, all built sources, all Makefiles, and most documentation files
will be automatically distributed. Use this variable to distribute any
files that are not automatically distributed.</dd>
<dt><a name="FAKE_SOURCES"><tt>FAKE_SOURCES</tt><small>(optional)</small>
</a></dt>
<dd>This variable is like <a href="#SOURCES"><tt>SOURCES</tt></a> except that
the source files don't need to exist. The makefiles only use
<tt>FAKE_SOURCES</tt> to create the names of derived objects that should be
included in the directory's result. It is assumed that the project's
<tt>Makefile</tt> will define how to build the derived objects
necessary.</dd>
<dt><a name="KEEP_SYMBOLS"><tt>KEEP_SYMBOLS</tt></a></dt>
<dd>If set to any value, specifies that when linking executables the
makefiles should retain debug symbols in the executable. Normally, symbols
@@ -558,6 +668,12 @@
<dt><a name="LLVMLIBS"><tt>LLVMLIBS</tt></a></dt>
<dd>Specifies the set of libraries from the LLVM $(ObjDir) that will be
linked into the tool or library.</dd>
<dt><a name="LOADABLE_MODULE"><tt>LOADABLE_MODULE</tt></a></dt>
<dd>If set to any value, causes the shared library being built to also be
a loadable module. Loadable modules can be opened with the dlopen() function
and searched with dlsym (or the operating system's equivalent). Note that
setting this variable without also setting <tt>SHARED_LIBRARY</tt> will have
no effect.</dd>
<dt><a name="MODULE_NAME"><tt>MODULE_NAME</tt></a></dt>
<dd>Specifies the name of a bytecode module to be created. A bytecode
module can be specified in conjunction with other kinds of library builds
@@ -588,6 +704,8 @@
<dd>Specifies the name of the LLVM code generation target that the
current directory builds. Setting this variable enables additional rules to
build <tt>.inc</tt> files from <tt>.td</tt> files. </dd>
<dt><a name="TESTSUITE"><tt>TESTSUITE</tt></a></dt>
<dd>Specifies the directory of tests to run in <tt>llvm/test</tt>.</dd>
<dt><a name="TOOLNAME"><tt>TOOLNAME</tt></a></dt>
<dd>Specifies the name of the tool that the current directory should
build.</dd>
@@ -619,18 +737,18 @@
<li>In the Makefile (only <em>after</em> the inclusion of <a
href="#Makefile.common"><tt>$(LEVEL)/Makefile.common</tt></a>).</li>
</ul>
<p>The overridable variables are given below:</p>
<p>The override variables are given below:</p>
<dl>
<dt><a name="AR"><tt>AR</tt></a> <small>(defaulted)</small></dt>
<dd>Specifies the path to the <tt>ar</tt> tool.</dd>
<dt><a name="BISON"><tt>BISON</tt></a><small>(configured)</small></dt>
<dd>Specifies the path to the <tt>bison</tt> tool.</dd>
<dt><a name="BUILD_OBJ_DIR"><tt>BUILD_OBJ_DIR</tt></a></dt>
<dt><a name="PROJ_OBJ_DIR"><tt>PROJ_OBJ_DIR</tt></a></dt>
<dd>The directory into which the products of build rules will be placed.
This might be the same as
<a href="#BUILD_SRC_DIR"><tt>BUILD_SRC_DIR</tt></a> but typically is
<a href="#PROJ_SRC_DIR"><tt>PROJ_SRC_DIR</tt></a> but typically is
not.</dd>
<dt><a name="BUILD_SRC_DIR"><tt>BUILD_SRC_DIR</tt></a></dt>
<dt><a name="PROJ_SRC_DIR"><tt>PROJ_SRC_DIR</tt></a></dt>
<dd>The directory which contains the source files to be built.</dd>
<dt><a name="BURG"><tt>BURG</tt></a></dt>
<dd>Specifies the path to the <tt>burg</tt> tool.</dd>
@@ -772,7 +890,8 @@
<dd>The configuration specific directory into which executables are placed
before they are installed.</dd>
<dt><a name="TopDistDir"><tt>TopDistDir</tt></a></dt>
<dd>The top most directory into which the distribution files are copied.</dd>
<dd>The top most directory into which the distribution files are copied.
</dd>
<dt><a name="Verb"><tt>Verb</tt></a></dt>
<dd>Use this as the first thing on your build script lines to enable or
disable verbose mode. It expands to either an @ (quiet mode) or nothing
@@ -786,83 +905,88 @@
<p>Variables listed below are used by the LLVM Makefile System
and considered internal. You should not use these variables under any
circumstances.</p>
<dl>
<dt><a name="Archive"><tt>Archive</tt></a></dt><dd></dd>
<dt><a name="AR.Flags"><tt>AR.Flags</tt></a></dt><dd></dd>
<dt><a name="BaseNameSources"><tt>BaseNameSources</tt></a></dt><dd></dd>
<dt><a name="BCCompile.C"><tt>BCCompile.C</tt></a></dt><dd></dd>
<dt><a name="BCCompile.CXX"><tt>BCCompile.CXX</tt></a></dt><dd></dd>
<dt><a name="BCLinkLib"><tt>BCLinkLib</tt></a></dt><dd></dd>
<dt><a name="Burg"><tt>Burg</tt></a></dt><dd></dd>
<dt><a name="C.Flags"><tt>C.Flags</tt></a></dt><dd></dd>
<dt><a name="Compile.C"><tt>Compile.C</tt></a></dt><dd></dd>
<dt><a name="CompileCommonOpts"><tt>CompileCommonOpts</tt></a></dt><dd></dd>
<dt><a name="Compile.CXX"><tt>Compile.CXX</tt></a></dt><dd></dd>
<dt><a name="ConfigStatusScript"><tt>ConfigStatusScript</tt></a></dt><dd></dd>
<dt><a name="ConfigureScript"><tt>ConfigureScript</tt></a></dt><dd></dd>
<dt><a name="CPP.Flags"><tt>CPP.Flags</tt></a></dt><dd></dd>
<dt><a name="CPP.Flags "><tt>CPP.Flags </tt></a></dt><dd></dd>
<dt><a name="CXX.Flags"><tt>CXX.Flags</tt></a></dt><dd></dd>
<dt><a name="DependFiles"><tt>DependFiles</tt></a></dt><dd></dd>
<dt><a name="DestArchiveLib"><tt>DestArchiveLib</tt></a></dt><dd></dd>
<dt><a name="DestBytecodeLib"><tt>DestBytecodeLib</tt></a></dt><dd></dd>
<dt><a name="DestRelinkedLib"><tt>DestRelinkedLib</tt></a></dt><dd></dd>
<dt><a name="DestSharedLib"><tt>DestSharedLib</tt></a></dt><dd></dd>
<dt><a name="DestTool"><tt>DestTool</tt></a></dt><dd></dd>
<dt><a name="DistAlways"><tt>DistAlways</tt></a></dt><dd></dd>
<dt><a name="DistCheckDir"><tt>DistCheckDir</tt></a></dt><dd></dd>
<dt><a name="DistCheckTop"><tt>DistCheckTop</tt></a></dt><dd></dd>
<dt><a name="DistFiles"><tt>DistFiles</tt></a></dt><dd></dd>
<dt><a name="DistName"><tt>DistName</tt></a></dt><dd></dd>
<dt><a name="DistOther"><tt>DistOther</tt></a></dt><dd></dd>
<dt><a name="DistSources"><tt>DistSources</tt></a></dt><dd></dd>
<dt><a name="DistSubDirs"><tt>DistSubDirs</tt></a></dt><dd></dd>
<dt><a name="DistTarBZ2"><tt>DistTarBZ2</tt></a></dt><dd></dd>
<dt><a name="DistTarGZip"><tt>DistTarGZip</tt></a></dt><dd></dd>
<dt><a name="DistZip"><tt>DistZip</tt></a></dt><dd></dd>
<dt><a name="ExtraLibs"><tt>ExtraLibs</tt></a></dt><dd></dd>
<dt><a name="INCFiles"><tt>INCFiles</tt></a></dt><dd></dd>
<dt><a name="InternalTargets"><tt>InternalTargets</tt></a></dt><dd></dd>
<dt><a name="LD.Flags"><tt>LD.Flags</tt></a></dt><dd></dd>
<dt><a name="LexOutput"><tt>LexOutput</tt></a></dt><dd></dd>
<dt><a name="LibName.A"><tt>LibName.A</tt></a></dt><dd></dd>
<dt><a name="LibName.BC"><tt>LibName.BC</tt></a></dt><dd></dd>
<dt><a name="LibName.LA"><tt>LibName.LA</tt></a></dt><dd></dd>
<dt><a name="LibName.O"><tt>LibName.O</tt></a></dt><dd></dd>
<dt><a name="LibTool.Flags"><tt>LibTool.Flags</tt></a></dt><dd></dd>
<dt><a name="Link"><tt>Link</tt></a></dt><dd></dd>
<dt><a name="LLVMGCCLibDir"><tt>LLVMGCCLibDir</tt></a></dt><dd></dd>
<dt><a name="LLVMLibDir"><tt>LLVMLibDir</tt></a></dt><dd></dd>
<dt><a name="LLVMLibsOptions"><tt>LLVMLibsOptions</tt></a></dt><dd></dd>
<dt><a name="LLVMLibsPaths"><tt>LLVMLibsPaths</tt></a></dt><dd></dd>
<dt><a name="LLVMToolDir"><tt>LLVMToolDir</tt></a></dt><dd></dd>
<dt><a name="LLVMUsedLibs"><tt>LLVMUsedLibs</tt></a></dt><dd></dd>
<dt><a name="LocalTargets"><tt>LocalTargets</tt></a></dt><dd></dd>
<dt><a name="LTCompile.C"><tt>LTCompile.C</tt></a></dt><dd></dd>
<dt><a name="LTCompile.CXX"><tt>LTCompile.CXX</tt></a></dt><dd></dd>
<dt><a name="LTInstall"><tt>LTInstall</tt></a></dt><dd></dd>
<dt><a name="ObjectsBC"><tt>ObjectsBC</tt></a></dt><dd></dd>
<dt><a name="ObjectsLO"><tt>ObjectsLO</tt></a></dt><dd></dd>
<dt><a name="ObjectsO"><tt>ObjectsO</tt></a></dt><dd></dd>
<dt><a name="ObjMakefiles"><tt>ObjMakefiles</tt></a></dt><dd></dd>
<dt><a name="Parallel_Targets"><tt>Parallel_Targets</tt></a></dt><dd></dd>
<dt><a name="PreConditions"><tt>PreConditions</tt></a></dt><dd></dd>
<dt><a name="ProjLibsOptions"><tt>ProjLibsOptions</tt></a></dt><dd></dd>
<dt><a name="ProjLibsPaths"><tt>ProjLibsPaths</tt></a></dt><dd></dd>
<dt><a name="ProjUsedLibs"><tt>ProjUsedLibs</tt></a></dt><dd></dd>
<dt><a name="Ranlib"><tt>Ranlib</tt></a></dt><dd></dd>
<dt><a name="RecursiveTargets"><tt>RecursiveTargets</tt></a></dt><dd></dd>
<dt><a name="Relink"><tt>Relink</tt></a></dt><dd></dd>
<dt><a name="SrcMakefiles"><tt>SrcMakefiles</tt></a></dt><dd></dd>
<dt><a name="Strip"><tt>Strip</tt></a></dt><dd></dd>
<dt><a name="StripWarnMsg"><tt>StripWarnMsg</tt></a></dt><dd></dd>
<dt><a name="TableGen"><tt>TableGen</tt></a></dt><dd></dd>
<dt><a name="TDFiles"><tt>TDFiles</tt></a></dt><dd></dd>
<dt><a name="ToolBuildPath"><tt>ToolBuildPath</tt></a></dt><dd></dd>
<dt><a name="TopLevelTargets"><tt>TopLevelTargets</tt></a></dt><dd></dd>
<dt><a name="UserTargets"><tt>UserTargets</tt></a></dt><dd></dd>
<dt><a name="YaccOutput"><tt>YaccOutput</tt></a></dt><dd></dd>
</dl>
<p><tt>
Archive
AR.Flags
BaseNameSources
BCCompile.C
BCCompile.CXX
BCLinkLib
Burg
C.Flags
Compile.C
CompileCommonOpts
Compile.CXX
ConfigStatusScript
ConfigureScript
CPP.Flags
CPP.Flags
CXX.Flags
DependFiles
DestArchiveLib
DestBytecodeLib
DestModule
DestRelinkedLib
DestSharedLib
DestTool
DistAlways
DistCheckDir
DistCheckTop
DistFiles
DistName
DistOther
DistSources
DistSubDirs
DistTarBZ2
DistTarGZip
DistZip
ExtraLibs
FakeSources
INCFiles
InternalTargets
LD.Flags
LexFiles
LexOutput
LibName.A
LibName.BC
LibName.LA
LibName.O
LibTool.Flags
Link
LinkModule
LLVMLibDir
LLVMLibsOptions
LLVMLibsPaths
LLVMToolDir
LLVMUsedLibs
LocalTargets
LTCompile.C
LTCompile.CXX
LTInstall
Module
ObjectsBC
ObjectsLO
ObjectsO
ObjMakefiles
ParallelTargets
PreConditions
ProjLibsOptions
ProjLibsPaths
ProjUsedLibs
Ranlib
RecursiveTargets
Relink
SrcMakefiles
Strip
StripWarnMsg
TableGen
TDFiles
ToolBuildPath
TopLevelTargets
UserTargets
YaccFiles
YaccOutput
</tt></p>
</div>
<!-- *********************************************************************** -->
@@ -880,5 +1004,3 @@
</body>
</html>
<!-- vim: sw=2 noai
-->

View File

@@ -1,394 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Open LLVM Projects</title>
<link rel="stylesheet" href="llvm.css" type="text/css">
</head>
<body>
<div class="doc_title">
Open LLVM Projects
</div>
<ul>
<li><a href="#what">What is this?</a></li>
<li><a href="#improving">Improving the current system</a>
<ol>
<li><a href="#code-cleanups">Implementing Code Cleanup bugs</a></li>
<li><a href="#glibc">Port glibc to LLVM</a></li>
<li><a href="#programs">Compile programs with the LLVM Compiler</a></li>
<li><a href="#llvm_ir">Extend the LLVM intermediate representation</a></li>
<li><a href="#target">Target backend improvements</a></li>
<li><a href="#misc_imp">Miscellaneous Improvements</a></li>
</ol></li>
<li><a href="#new">Adding new capabilities to LLVM</a>
<ol>
<li><a href="#newfeaturebugs">Implementing new feature PRs</a></li>
<li><a href="#pointeranalysis">Pointer and Alias Analysis</a></li>
<li><a href="#profileguided">Profile-Guided Optimization</a></li>
<li><a href="#xforms">New Transformations and Analyses</a></li>
<li><a href="#x86be">X86 Back-end Improvements</a></li>
<li><a href="#misc_new">Miscellaneous Additions</a></li>
</ol></li>
</ul>
<div class="doc_author">
<p>Written by the <a href="http://llvm.cs.uiuc.edu/">LLVM Team</a></p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="what">What is this?</a>
</div>
<!-- *********************************************************************** -->
<div class="doc_text">
<p>This document is meant to be a sort of "big TODO list" for LLVM. Each
project in this document is something that would be useful for LLVM to have, and
would also be a great way to get familiar with the system. Some of these
projects are small and self-contained, which may be implemented in a couple of
days, others are larger. Several of these projects may lead to interesting
research projects in their own right. In any case, we welcome all
contributions.</p>
<p>If you are thinking about tackling one of these projects, please send a mail
to the <a href="http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev">LLVM
Developer's</a> mailing list, so that we know the project is being worked on.
Additionally this is a good way to get more information about a specific project
or to suggest other projects to add to this page.
</p>
<p>The projects in this page are open-ended. More specific projects are
filed as unassigned enhancements in the <a href="http://llvm.cs.uiuc.edu/bugs/">
LLVM bug tracker</a>. See the <a href="http://llvm.cs.uiuc.edu/bugs/buglist.cgi?keywords_type=allwords&amp;keywords=&amp;bug_status=NEW&amp;bug_status=ASSIGNED&amp;bug_status=REOPENED&amp;bug_severity=enhancement&amp;emailassigned_to1=1&amp;emailtype1=substring&amp;email1=unassigned">list of currently outstanding issues</a> if you wish to help improve LLVM.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="improving">Improving the current system</a>
</div>
<!-- *********************************************************************** -->
<div class="doc_text">
<p>Improvements to the current infrastructure are always very welcome and tend
to be fairly straight-forward to implement. Here are some of the key areas that
can use improvement...</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="code-cleanups">Implementing Code Cleanup bugs</a>
</div>
<div class="doc_text">
<p>
The <a href="http://llvm.cs.uiuc.edu/bugs/">LLVM bug tracker</a> occasionally
has <a
href="http://llvm.cs.uiuc.edu/bugs/buglist.cgi?short_desc_type=allwordssubstr&amp;short_desc=&amp;long_desc_type=allwordssubstr&amp;long_desc=&amp;bug_file_loc_type=allwordssubstr&amp;bug_file_loc=&amp;status_whiteboard_type=allwordssubstr&amp;status_whiteboard=&amp;keywords_type=allwords&amp;keywords=code-cleanup&amp;bug_status=NEW&amp;bug_status=ASSIGNED&amp;bug_status=REOPENED&amp;emailassigned_to1=1&amp;emailtype1=substring&amp;email1=&amp;emailassigned_to2=1&amp;emailreporter2=1&amp;emailcc2=1&amp;emailtype2=substring&amp;email2=&amp;bugidtype=include&amp;bug_id=&amp;votes=&amp;changedin=&amp;chfieldfrom=&amp;chfieldto=Now&amp;chfieldvalue=&amp;cmdtype=doit&amp;order=Bug+Number&amp;field0-0-0=noop&amp;type0-0-0=noop&amp;value0-0-0=">"code-cleanup" bugs</a> filed in it. Taking one of these and fixing it is a good
way to get your feet wet in the LLVM code and discover how some of its components
work.
</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="glibc">Port glibc to LLVM</a>
</div>
<div class="doc_text">
<p>It would be very useful to <a
href="http://www.gnu.org/software/libc/manual/html_node/Porting.html">port</a> <a
href="http://www.gnu.org/software/libc/">glibc</a> to LLVM. This would allow a
variety of interprocedural algorithms to be much more effective in the face of
library calls. The most important pieces to port are things like the string
library and the <tt>stdio</tt> related functions... low-level system calls like
'<tt>read</tt>' should stay unimplemented in LLVM.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="programs">Compile programs with the LLVM Compiler</a>
</div>
<div class="doc_text">
<p>We are always looking for new testcases and benchmarks for use with LLVM. In
particular, it is useful to try compiling your favorite C source code with LLVM.
If it doesn't compile, try to figure out why or report it to the <a
href="http://mail.cs.uiuc.edu/pipermail/llvmbugs/">llvm-bugs</a> list. If you
get the program to compile, it would be extremely useful to convert the build
system to be compatible with the LLVM Programs testsuite so that we can check it
into CVS and the automated tester can use it to track progress of the
compiler.</p>
<p>When testing a code, try running it with a variety of optimizations, and with
all the back-ends: CBE, llc, and lli.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="llvm_ir">Extend the LLVM intermediate representation</a>
</div>
<div class="doc_text">
<ol>
<li>Add support for platform-independent prefetch support. The GCC <a
href="http://gcc.gnu.org/projects/prefetch.html">prefetch project</a> page
has a good survey of the prefetching capabilities of a variety of modern
processors.</li>
</ol>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="target">Target backend improvements</a>
</div>
<div class="doc_text">
<ol>
<li>Find benchmarks either using our <a
href="http://llvm.cs.uiuc.edu/testresults/">test results</a> or on your own,
where LLVM code generators do not produce optimal code or simply where another
compiler produces better code. Try to minimize the test case that
demonstrates the issue. Then, either <a
href="http://llvm.cs.uiuc.edu/bugs/">submit a bug</a> with your testcase and
the code that LLVM produces vs. the code that it <em>should</em> produce, or
even better, see if you can improve the code generator and submit a
patch.</li>
</ol>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="misc_imp">Miscellaneous Improvements</a>
</div>
<div class="doc_text">
<ol>
<li>Rework the PassManager to be more flexible</li>
<li>Some transformations and analyses only work on reducible flow graphs. It
would be nice to have a transformation which could be "required" by these passes
which makes irreducible graphs reducible. This can easily be accomplished
through code duplication. See <a
href="http://citeseer.nj.nec.com/janssen97making.html">Making Graphs Reducible
with Controlled Node Splitting</a> and perhaps <a
href="http://doi.acm.org/10.1145/262004.262005">Nesting of Reducible and
Irreducible Loops</a>.</li>
</ol>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="new">Adding new capabilities to LLVM</a>
</div>
<!-- *********************************************************************** -->
<div class="doc_text">
<p>Sometimes creating new things is more fun than improving existing things.
These projects tend to be more involved and perhaps require more work, but can
also be very rewarding.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="newfeaturebugs">Implementing new feature PRs</a>
</div>
<div class="doc_text">
<p>Many ideas for feature requests are stored in LLVM bugzilla. Just <a
href="http://llvm.cs.uiuc.edu/bugs/buglist.cgi?short_desc_type=allwordssubstr&amp;short_desc=&amp;long_desc_type=allwordssubstr&amp;long_desc=&amp;bug_file_loc_type=allwordssubstr&amp;bug_file_loc=&amp;status_whiteboard_type=allwordssubstr&amp;status_whiteboard=&amp;keywords_type=allwords&amp;keywords=new-feature&amp;bug_status=UNCONFIRMED&amp;bug_status=NEW&amp;bug_status=ASSIGNED&amp;bug_status=REOPENED&amp;emailassigned_to1=1&amp;emailtype1=substring&amp;email1=&amp;emailassigned_to2=1&amp;emailreporter2=1&amp;emailcc2=1&amp;emailtype2=substring&amp;email2=&amp;bugidtype=include&amp;bug_id=&amp;votes=&amp;changedin=&amp;chfieldfrom=&amp;chfieldto=Now&amp;chfieldvalue=&amp;cmdtype=doit&amp;namedcmd=All+PRs&amp;newqueryname=&amp;order=Bug+Number&amp;field0-0-0=noop&amp;type0-0-0=noop&amp;value0-0-0=">search for bugs with a "new-feature" keyword</a>.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="pointeranalysis">Pointer and Alias Analysis</a>
</div>
<div class="doc_text">
<p>We have a <a href="AliasAnalysis.html">strong base for development</a> of
both pointer analysis based optimizations as well as pointer analyses
themselves. It seems natural to want to take advantage of this...</p>
<ol>
<li>Implement a flow-sensitive context-sensitive alias analysis algorithm<br>
- Pick one of the somewhat efficient algorithms, but strive for maximum
precision</li>
<li>Implement a flow-sensitive context-insensitive alias analysis algorithm<br>
- Just an efficient local algorithm perhaps?</li>
<li>Implement alias-analysis-based optimizations:
<ul>
<li>...</li>
</ul></li>
</ol>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="profileguided">Profile-Guided Optimization</a>
</div>
<div class="doc_text">
<p>We now have a unified infrastructure for writing profile-guided
transformations, which will work either at offline-compile-time or in the JIT,
but we don't have many transformations. We would welcome new profile-guided
transformations as well as improvements to the current profiling system.
</p>
<p>Ideas for profile-guided transformations:</p>
<ol>
<li>Superblock formation (with many optimizations)</li>
<li>Loop unrolling/peeling</li>
<li>Profile directed inlining</li>
<li>Code layout</li>
<li>...</li>
</ol>
<p>Improvements to the existing support:</p>
<ol>
<li>The current block and edge profiling code that gets inserted is very simple
and inefficient. Through the use of control-dependence information, many fewer
counters could be inserted into the code. Also, if the execution count of a
loop is known to be a compile-time or runtime constant, all of the counters in
the loop could be avoided.</li>
<li>You could implement one of the "static profiling" algorithms which analyze a
piece of code an make educated guesses about the relative execution frequencies
of various parts of the code.</li>
<li>You could add path profiling support, or adapt the existing LLVM path
profiling code to work with the generic profiling interfaces.</li>
</ol>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="xforms">New Transformations and Analyses</a>
</div>
<div class="doc_text">
<ol>
<li>Implement <a href="http://www.cs.purdue.edu/homes/vandrutj/">GVN-PRE</a>, a
powerful and simple Partial Redundancy Elimination algorithm for SSA form</li>
<li>Implement a Dependence Analysis Infrastructure<br>
- Design some way to represent and query dep analysis</li>
<li>Implement a strength reduction pass</li>
<li>Value range propagation pass</li>
</ol>
</div>
<!-- ======================================================================= -->
<div class="doc_section">
<a name="x86be">X86 Back-end Improvements</a>
</div>
<div class="doc_text">
<ol>
<li>Implement a better instruction selector</li>
<li>Implement support for the "switch" instruction without requiring the
lower-switches pass.</li>
<li>Implement interprocedural register allocation. The CallGraphSCCPass can be
used to implement a bottom-up analysis that will determine the *actual*
registers clobbered by a function. Use the pass to fine tune register usage
in callers based on *actual* registers used by the callee.</li>
</ol>
</div>
<!-- ======================================================================= -->
<div class="doc_section">
<a name="misc_new">Miscellaneous Additions</a>
</div>
<div class="doc_text">
<ol>
<li>Port the <a href="http://www-sop.inria.fr/mimosa/fp/Bigloo/">Bigloo</A>
Scheme compiler, from Manuel Serrano at INRIA Sophia-Antipolis, to
output LLVM bytecode. It seems that it can already output .NET
bytecode, JVM bytecode, and C, so LLVM would ostensibly be another good
candidate.</li>
<li>Write a new frontend for C/C++ <b>in</b> C++, giving us the ability to
directly use LLVM C++ classes from within a compiler rather than use
C-based wrapper functions a la llvm-gcc. One possible starting point is the <a
href="http://www.parashift.com/c++-faq-lite/compiler-dependencies.html#faq-37.11">C++
yacc grammar by Ed Willink</a>.</li>
<li>Write a new frontend for some other language (Java? OCaml? Forth?)</li>
<li>Write a new backend for a target (IA64? MIPS? MMIX?)</li>
<li>Write a disassembler for machine code that would use TableGen to output
<tt>MachineInstr</tt>s for transformations, optimizations, etc.</li>
<li>Random test vector generator: Use a C grammar to generate random C code;
run it through llvm-gcc, then run a random set of passes on it using opt.
Try to crash opt. When opt crashes, use bugpoint to reduce the test case and
mail the result to yourself. Repeat ad infinitum.</li>
<li>Design a simple, recognizable logo.</li>
<li>Improve the usefulness and utility of the Skeleton target backend:
<ul>
<li>Convert the non-functional Skeleton target to become an abstract machine
target (choose some simple instructions, a register set, etc). This will
become a much more useful example of a backend since it would be a simple
but <em>functional</em> backend. Examples of such architectures include MIX,
MMIX, <a
href="http://www.cs.cinvestav.mx/SC/prof_personal/adiaz/vhdl/DLX/">DLX</a>,
or come up with your own!</li>
<li>Use the new Skeleton backend in the Interpreter: compile LLVM to Skeleton
target, and then interpret that code instead of LLVM. Performance win would
be the primary goal, as the number of registers would be a small constant
instead of unbounded, for example.</li>
</ul></li>
</ol>
</div>
<!-- *********************************************************************** -->
<hr>
<address>
<a href="http://jigsaw.w3.org/css-validator/check/referer"><img
src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a>
<a href="http://validator.w3.org/check/referer"><img
src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a>
<a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
<a href="http://llvm.cs.uiuc.edu">LLVM Compiler Infrastructure</a><br>
Last modified: $Date$
</address>
</body>
</html>

View File

@@ -20,6 +20,7 @@
<li>The <tt>-time-passes</tt> option</li>
<li>How to use the LLVM Makefile system</li>
<li>How to write a regression test</li>
-->
</ul>
</li>
@@ -81,6 +82,20 @@ with another <tt>Value</tt></a> </li>
-->
</ul>
</li>
<li><a href="#advanced">Advanced Topics</a>
<ul>
<li><a href="#TypeResolve">LLVM Type Resolution</a>
<ul>
<li><a href="#BuildRecType">Basic Recursive Type Construction</a></li>
<li><a href="#refineAbstractTypeTo">The <tt>refineAbstractTypeTo</tt> method</a></li>
<li><a href="#PATypeHolder">The PATypeHolder Class</a></li>
<li><a href="#AbstractTypeUser">The AbstractTypeUser Class</a></li>
</ul></li>
<li><a href="#SymbolTable">The <tt>SymbolTable</tt> class </a></li>
</ul></li>
<li><a href="#coreclasses">The Core LLVM Class Hierarchy Reference</a>
<ul>
<li><a href="#Value">The <tt>Value</tt> class</a>
@@ -112,13 +127,6 @@ with another <tt>Value</tt></a> </li>
</li>
</ul>
</li>
<li><a href="#SymbolTable">The <tt>SymbolTable</tt> class </a></li>
<li>The <tt>ilist</tt> and <tt>iplist</tt> classes
<ul>
<li>Creating, inserting, moving and deleting from LLVM lists </li>
</ul>
</li>
<li>Important iterator invalidation semantics to be aware of.</li>
</ol>
<div class="doc_author">
@@ -212,7 +220,7 @@ STL</a>.</li>
<li><a href="http://www.research.att.com/%7Ebs/C++.html">Bjarne Stroustrup's C++
Page</a></li>
<li><a href="http://www.linux.com.cn/Bruce_Eckel/TICPPv2/Contents.htm">
<li><a href="http://64.78.49.204/">
Bruce Eckel's Thinking in C++, 2nd ed. Volume 2 Revision 4.0 (even better, get
the book).</a></li>
@@ -266,7 +274,7 @@ operator, but they don't have some drawbacks (primarily stemming from
the fact that <tt>dynamic_cast&lt;&gt;</tt> only works on classes that
have a v-table). Because they are used so often, you must know what they
do and how they work. All of these templates are defined in the <a
href="/doxygen/Casting_8h-source.html"><tt>Support/Casting.h</tt></a>
href="/doxygen/Casting_8h-source.html"><tt>llvm/Support/Casting.h</tt></a>
file (note that you very rarely have to include this file directly).</p>
<dl>
@@ -293,6 +301,7 @@ file (note that you very rarely have to include this file directly).</p>
<i>// Otherwise, it must be an instruction...</i>
return !L-&gt;contains(cast&lt;<a href="#Instruction">Instruction</a>&gt;(V)-&gt;getParent());
}
</pre>
<p>Note that you should <b>not</b> use an <tt>isa&lt;&gt;</tt> test followed
@@ -321,21 +330,12 @@ file (note that you very rarely have to include this file directly).</p>
call to <tt>isa&lt;&gt;</tt> and a call to <tt>cast&lt;&gt;</tt> into one
statement, which is very convenient.</p>
<p> Another common example is:</p>
<pre>
<i>// Loop over all of the phi nodes in a basic block</i>
BasicBlock::iterator BBI = BB-&gt;begin();
for (; <a href="#PhiNode">PHINode</a> *PN = dyn_cast&lt;<a href="#PHINode">PHINode</a>&gt;(BBI); ++BBI)
std::cerr &lt;&lt; *PN;
</pre>
<p>Note that the <tt>dyn_cast&lt;&gt;</tt> operator, like C++'s
<tt>dynamic_cast</tt> or Java's <tt>instanceof</tt> operator, can be abused.
In particular you should not use big chained <tt>if/then/else</tt> blocks to
check for lots of different variants of classes. If you find yourself
wanting to do this, it is much cleaner and more efficient to use the
InstVisitor class to dispatch over the instruction type directly.</p>
<tt>InstVisitor</tt> class to dispatch over the instruction type directly.</p>
</dd>
@@ -379,7 +379,7 @@ across).</p>
but you don't want them to always be noisy. A standard compromise is to comment
them out, allowing you to enable them if you need them in the future.</p>
<p>The "<tt><a href="/doxygen/Debug_8h-source.html">Support/Debug.h</a></tt>"
<p>The "<tt><a href="/doxygen/Debug_8h-source.html">llvm/Support/Debug.h</a></tt>"
file provides a macro named <tt>DEBUG()</tt> that is a much nicer solution to
this problem. Basically, you can put arbitrary code into the argument of the
<tt>DEBUG</tt> macro, and it is only executed if '<tt>opt</tt>' (or any other
@@ -407,7 +407,7 @@ program hasn't been started yet, you can always just run it with
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<a name="DEBUG_TYPE">Fine grained debug info with <tt>DEBUG_TYPE()</tt> and
<a name="DEBUG_TYPE">Fine grained debug info with <tt>DEBUG_TYPE</tt> and
the <tt>-debug-only</tt> option</a>
</div>
@@ -427,7 +427,7 @@ option as follows:</p>
<p>Of course, in practice, you should only set <tt>DEBUG_TYPE</tt> at the top of
a file, to specify the debug type for the entire module (if you do this before
you <tt>#include "Support/Debug.h"</tt>, you don't have to insert the ugly
you <tt>#include "llvm/Support/Debug.h"</tt>, you don't have to insert the ugly
<tt>#undef</tt>'s). Also, you should use names more meaningful than "foo" and
"bar", because there is no system in place to ensure that names do not
conflict. If two different modules use the same string, they will all be turned
@@ -446,7 +446,7 @@ even if the source lives in multiple files.</p>
<div class="doc_text">
<p>The "<tt><a
href="/doxygen/Statistic_8h-source.html">Support/Statistic.h</a></tt>" file
href="/doxygen/Statistic_8h-source.html">llvm/ADT/Statistic.h</a></tt>" file
provides a template named <tt>Statistic</tt> that is used as a unified way to
keep track of what the LLVM compiler is doing and how effective various
optimizations are. It is useful to see what optimizations are contributing to
@@ -573,18 +573,18 @@ easy to iterate over the individual instructions that make up
<tt>BasicBlock</tt>s. Here's a code snippet that prints out each instruction in
a <tt>BasicBlock</tt>:</p>
<pre> // blk is a pointer to a BasicBlock instance<br> for (BasicBlock::iterator i = blk-&gt;begin(), e = blk-&gt;end(); i != e; ++i)<br> // the next statement works since operator&lt;&lt;(ostream&amp;,...) <br> // is overloaded for Instruction&amp;<br> cerr &lt;&lt; *i &lt;&lt; "\n";<br></pre>
<pre>
// blk is a pointer to a BasicBlock instance
for (BasicBlock::iterator i = blk-&gt;begin(), e = blk-&gt;end(); i != e; ++i)
// the next statement works since operator&lt;&lt;(ostream&amp;,...)
// is overloaded for Instruction&amp;
std::cerr &lt;&lt; *i &lt;&lt; "\n";
</pre>
<p>However, this isn't really the best way to print out the contents of a
<tt>BasicBlock</tt>! Since the ostream operators are overloaded for virtually
anything you'll care about, you could have just invoked the print routine on the
basic block itself: <tt>cerr &lt;&lt; *blk &lt;&lt; "\n";</tt>.</p>
<p>Note that currently operator&lt;&lt; is implemented for <tt>Value*</tt>, so
it will print out the contents of the pointer, instead of the pointer value you
might expect. This is a deprecated interface that will be removed in the
future, so it's best not to depend on it. To print out the pointer value for
now, you must cast to <tt>void*</tt>.</p>
basic block itself: <tt>std::cerr &lt;&lt; *blk &lt;&lt; "\n";</tt>.</p>
</div>
@@ -903,7 +903,7 @@ and <tt>ReplaceInstWithInst</tt>.</p>
<p>This function replaces all uses (within a basic block) of a given
instruction with a value, and then removes the original instruction. The
following example illustrates the replacement of the result of a particular
<tt>AllocaInst</tt> that allocates memory for a single integer with an null
<tt>AllocaInst</tt> that allocates memory for a single integer with a null
pointer to an integer.</p>
<pre>AllocaInst* instToReplace = ...;<br>BasicBlock::iterator ii(instToReplace);<br>ReplaceInstWithValue(instToReplace-&gt;getParent()-&gt;getInstList(), ii,<br> Constant::getNullValue(PointerType::get(Type::IntTy)));<br></pre></li>
@@ -931,6 +931,408 @@ ReplaceInstWithValue, ReplaceInstWithInst -->
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="advanced">Advanced Topics</a>
</div>
<!-- *********************************************************************** -->
<div class="doc_text">
<p>
This section describes some of the advanced or obscure API's that most clients
do not need to be aware of. These API's tend manage the inner workings of the
LLVM system, and only need to be accessed in unusual circumstances.
</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="TypeResolve">LLVM Type Resolution</a>
</div>
<div class="doc_text">
<p>
The LLVM type system has a very simple goal: allow clients to compare types for
structural equality with a simple pointer comparison (aka a shallow compare).
This goal makes clients much simpler and faster, and is used throughout the LLVM
system.
</p>
<p>
Unfortunately achieving this goal is not a simple matter. In particular,
recursive types and late resolution of opaque types makes the situation very
difficult to handle. Fortunately, for the most part, our implementation makes
most clients able to be completely unaware of the nasty internal details. The
primary case where clients are exposed to the inner workings of it are when
building a recursive type. In addition to this case, the LLVM bytecode reader,
assembly parser, and linker also have to be aware of the inner workings of this
system.
</p>
<p>
For our purposes below, we need three concepts. First, an "Opaque Type" is
exactly as defined in the <a href="LangRef.html#t_opaque">language
reference</a>. Second an "Abstract Type" is any type which includes an
opaque type as part of its type graph (for example "<tt>{ opaque, int }</tt>").
Third, a concrete type is a type that is not an abstract type (e.g. "<tt>[ int,
float }</tt>").
</p>
</div>
<!-- ______________________________________________________________________ -->
<div class="doc_subsubsection">
<a name="BuildRecType">Basic Recursive Type Construction</a>
</div>
<div class="doc_text">
<p>
Because the most common question is "how do I build a recursive type with LLVM",
we answer it now and explain it as we go. Here we include enough to cause this
to be emitted to an output .ll file:
</p>
<pre>
%mylist = type { %mylist*, int }
</pre>
<p>
To build this, use the following LLVM APIs:
</p>
<pre>
//<i> Create the initial outer struct.</i>
<a href="#PATypeHolder">PATypeHolder</a> StructTy = OpaqueType::get();
std::vector&lt;const Type*&gt; Elts;
Elts.push_back(PointerType::get(StructTy));
Elts.push_back(Type::IntTy);
StructType *NewSTy = StructType::get(Elts);
//<i> At this point, NewSTy = "{ opaque*, int }". Tell VMCore that</i>
//<i> the struct and the opaque type are actually the same.</i>
cast&lt;OpaqueType&gt;(StructTy.get())-&gt;<a href="#refineAbstractTypeTo">refineAbstractTypeTo</a>(NewSTy);
// <i>NewSTy is potentially invalidated, but StructTy (a <a href="#PATypeHolder">PATypeHolder</a>) is</i>
// <i>kept up-to-date.</i>
NewSTy = cast&lt;StructType&gt;(StructTy.get());
// <i>Add a name for the type to the module symbol table (optional).</i>
MyModule-&gt;addTypeName("mylist", NewSTy);
</pre>
<p>
This code shows the basic approach used to build recursive types: build a
non-recursive type using 'opaque', then use type unification to close the cycle.
The type unification step is performed by the <tt><a
ref="#refineAbstractTypeTo">refineAbstractTypeTo</a></tt> method, which is
described next. After that, we describe the <a
href="#PATypeHolder">PATypeHolder class</a>.
</p>
</div>
<!-- ______________________________________________________________________ -->
<div class="doc_subsubsection">
<a name="refineAbstractTypeTo">The <tt>refineAbstractTypeTo</tt> method</a>
</div>
<div class="doc_text">
<p>
The <tt>refineAbstractTypeTo</tt> method starts the type unification process.
While this method is actually a member of the DerivedType class, it is most
often used on OpaqueType instances. Type unification is actually a recursive
process. After unification, types can become structurally isomorphic to
existing types, and all duplicates are deleted (to preserve pointer equality).
</p>
<p>
In the example above, the OpaqueType object is definitely deleted.
Additionally, if there is an "{ \2*, int}" type already created in the system,
the pointer and struct type created are <b>also</b> deleted. Obviously whenever
a type is deleted, any "Type*" pointers in the program are invalidated. As
such, it is safest to avoid having <i>any</i> "Type*" pointers to abstract types
live across a call to <tt>refineAbstractTypeTo</tt> (note that non-abstract
types can never move or be deleted). To deal with this, the <a
href="#PATypeHolder">PATypeHolder</a> class is used to maintain a stable
reference to a possibly refined type, and the <a
href="#AbstractTypeUser">AbstractTypeUser</a> class is used to update more
complex datastructures.
</p>
</div>
<!-- ______________________________________________________________________ -->
<div class="doc_subsubsection">
<a name="PATypeHolder">The PATypeHolder Class</a>
</div>
<div class="doc_text">
<p>
PATypeHolder is a form of a "smart pointer" for Type objects. When VMCore
happily goes about nuking types that become isomorphic to existing types, it
automatically updates all PATypeHolder objects to point to the new type. In the
example above, this allows the code to maintain a pointer to the resultant
resolved recursive type, even though the Type*'s are potentially invalidated.
</p>
<p>
PATypeHolder is an extremely light-weight object that uses a lazy union-find
implementation to update pointers. For example the pointer from a Value to its
Type is maintained by PATypeHolder objects.
</p>
</div>
<!-- ______________________________________________________________________ -->
<div class="doc_subsubsection">
<a name="AbstractTypeUser">The AbstractTypeUser Class</a>
</div>
<div class="doc_text">
<p>
Some data structures need more to perform more complex updates when types get
resolved. The <a href="#SymbolTable">SymbolTable</a> class, for example, needs
move and potentially merge type planes in its representation when a pointer
changes.</p>
<p>
To support this, a class can derive from the AbstractTypeUser class. This class
allows it to get callbacks when certain types are resolved. To register to get
callbacks for a particular type, the DerivedType::{add/remove}AbstractTypeUser
methods can be called on a type. Note that these methods only work for <i>
abstract</i> types. Concrete types (those that do not include an opaque objects
somewhere) can never be refined.
</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="SymbolTable">The <tt>SymbolTable</tt> class</a>
</div>
<div class="doc_text">
<p>This class provides a symbol table that the <a
href="#Function"><tt>Function</tt></a> and <a href="#Module">
<tt>Module</tt></a> classes use for naming definitions. The symbol table can
provide a name for any <a href="#Value"><tt>Value</tt></a> or <a
href="#Type"><tt>Type</tt></a>. <tt>SymbolTable</tt> is an abstract data
type. It hides the data it contains and provides access to it through a
controlled interface.</p>
<p>Note that the symbol table class is should not be directly accessed by most
clients. It should only be used when iteration over the symbol table names
themselves are required, which is very special purpose. Note that not all LLVM
<a href="#Value">Value</a>s have names, and those without names (i.e. they have
an empty name) do not exist in the symbol table.
</p>
<p>To use the <tt>SymbolTable</tt> well, you need to understand the
structure of the information it holds. The class contains two
<tt>std::map</tt> objects. The first, <tt>pmap</tt>, is a map of
<tt>Type*</tt> to maps of name (<tt>std::string</tt>) to <tt>Value*</tt>.
The second, <tt>tmap</tt>, is a map of names to <tt>Type*</tt>. Thus, Values
are stored in two-dimensions and accessed by <tt>Type</tt> and name. Types,
however, are stored in a single dimension and accessed only by name.</p>
<p>The interface of this class provides three basic types of operations:
<ol>
<li><em>Accessors</em>. Accessors provide read-only access to information
such as finding a value for a name with the
<a href="#SymbolTable_lookup">lookup</a> method.</li>
<li><em>Mutators</em>. Mutators allow the user to add information to the
<tt>SymbolTable</tt> with methods like
<a href="#SymbolTable_insert"><tt>insert</tt></a>.</li>
<li><em>Iterators</em>. Iterators allow the user to traverse the content
of the symbol table in well defined ways, such as the method
<a href="#SymbolTable_type_begin"><tt>type_begin</tt></a>.</li>
</ol>
<h3>Accessors</h3>
<dl>
<dt><tt>Value* lookup(const Type* Ty, const std::string&amp; name) const</tt>:
</dt>
<dd>The <tt>lookup</tt> method searches the type plane given by the
<tt>Ty</tt> parameter for a <tt>Value</tt> with the provided <tt>name</tt>.
If a suitable <tt>Value</tt> is not found, null is returned.</dd>
<dt><tt>Type* lookupType( const std::string&amp; name) const</tt>:</dt>
<dd>The <tt>lookupType</tt> method searches through the types for a
<tt>Type</tt> with the provided <tt>name</tt>. If a suitable <tt>Type</tt>
is not found, null is returned.</dd>
<dt><tt>bool hasTypes() const</tt>:</dt>
<dd>This function returns true if an entry has been made into the type
map.</dd>
<dt><tt>bool isEmpty() const</tt>:</dt>
<dd>This function returns true if both the value and types maps are
empty</dd>
</dl>
<h3>Mutators</h3>
<dl>
<dt><tt>void insert(Value *Val)</tt>:</dt>
<dd>This method adds the provided value to the symbol table. The Value must
have both a name and a type which are extracted and used to place the value
in the correct type plane under the value's name.</dd>
<dt><tt>void insert(const std::string&amp; Name, Value *Val)</tt>:</dt>
<dd> Inserts a constant or type into the symbol table with the specified
name. There can be a many to one mapping between names and constants
or types.</dd>
<dt><tt>void insert(const std::string&amp; Name, Type *Typ)</tt>:</dt>
<dd> Inserts a type into the symbol table with the specified name. There
can be a many-to-one mapping between names and types. This method
allows a type with an existing entry in the symbol table to get
a new name.</dd>
<dt><tt>void remove(Value* Val)</tt>:</dt>
<dd> This method removes a named value from the symbol table. The
type and name of the Value are extracted from \p N and used to
lookup the Value in the correct type plane. If the Value is
not in the symbol table, this method silently ignores the
request.</dd>
<dt><tt>void remove(Type* Typ)</tt>:</dt>
<dd> This method removes a named type from the symbol table. The
name of the type is extracted from \P T and used to look up
the Type in the type map. If the Type is not in the symbol
table, this method silently ignores the request.</dd>
<dt><tt>Value* remove(const std::string&amp; Name, Value *Val)</tt>:</dt>
<dd> Remove a constant or type with the specified name from the
symbol table.</dd>
<dt><tt>Type* remove(const std::string&amp; Name, Type* T)</tt>:</dt>
<dd> Remove a type with the specified name from the symbol table.
Returns the removed Type.</dd>
<dt><tt>Value *value_remove(const value_iterator&amp; It)</tt>:</dt>
<dd> Removes a specific value from the symbol table.
Returns the removed value.</dd>
<dt><tt>bool strip()</tt>:</dt>
<dd> This method will strip the symbol table of its names leaving
the type and values. </dd>
<dt><tt>void clear()</tt>:</dt>
<dd>Empty the symbol table completely.</dd>
</dl>
<h3>Iteration</h3>
<p>The following functions describe three types of iterators you can obtain
the beginning or end of the sequence for both const and non-const. It is
important to keep track of the different kinds of iterators. There are
three idioms worth pointing out:</p>
<table>
<tr><th>Units</th><th>Iterator</th><th>Idiom</th></tr>
<tr>
<td align="left">Planes Of name/Value maps</td><td>PI</td>
<td align="left"><pre><tt>
for (SymbolTable::plane_const_iterator PI = ST.plane_begin(),
PE = ST.plane_end(); PI != PE; ++PI ) {
PI-&gt;first // This is the Type* of the plane
PI-&gt;second // This is the SymbolTable::ValueMap of name/Value pairs
</tt></pre></td>
</tr>
<tr>
<td align="left">All name/Type Pairs</td><td>TI</td>
<td align="left"><pre><tt>
for (SymbolTable::type_const_iterator TI = ST.type_begin(),
TE = ST.type_end(); TI != TE; ++TI )
TI-&gt;first // This is the name of the type
TI-&gt;second // This is the Type* value associated with the name
</tt></pre></td>
</tr>
<tr>
<td align="left">name/Value pairs in a plane</td><td>VI</td>
<td align="left"><pre><tt>
for (SymbolTable::value_const_iterator VI = ST.value_begin(SomeType),
VE = ST.value_end(SomeType); VI != VE; ++VI )
VI-&gt;first // This is the name of the Value
VI-&gt;second // This is the Value* value associated with the name
</tt></pre></td>
</tr>
</table>
<p>Using the recommended iterator names and idioms will help you avoid
making mistakes. Of particular note, make sure that whenever you use
value_begin(SomeType) that you always compare the resulting iterator
with value_end(SomeType) not value_end(SomeOtherType) or else you
will loop infinitely.</p>
<dl>
<dt><tt>plane_iterator plane_begin()</tt>:</dt>
<dd>Get an iterator that starts at the beginning of the type planes.
The iterator will iterate over the Type/ValueMap pairs in the
type planes. </dd>
<dt><tt>plane_const_iterator plane_begin() const</tt>:</dt>
<dd>Get a const_iterator that starts at the beginning of the type
planes. The iterator will iterate over the Type/ValueMap pairs
in the type planes. </dd>
<dt><tt>plane_iterator plane_end()</tt>:</dt>
<dd>Get an iterator at the end of the type planes. This serves as
the marker for end of iteration over the type planes.</dd>
<dt><tt>plane_const_iterator plane_end() const</tt>:</dt>
<dd>Get a const_iterator at the end of the type planes. This serves as
the marker for end of iteration over the type planes.</dd>
<dt><tt>value_iterator value_begin(const Type *Typ)</tt>:</dt>
<dd>Get an iterator that starts at the beginning of a type plane.
The iterator will iterate over the name/value pairs in the type plane.
Note: The type plane must already exist before using this.</dd>
<dt><tt>value_const_iterator value_begin(const Type *Typ) const</tt>:</dt>
<dd>Get a const_iterator that starts at the beginning of a type plane.
The iterator will iterate over the name/value pairs in the type plane.
Note: The type plane must already exist before using this.</dd>
<dt><tt>value_iterator value_end(const Type *Typ)</tt>:</dt>
<dd>Get an iterator to the end of a type plane. This serves as the marker
for end of iteration of the type plane.
Note: The type plane must already exist before using this.</dd>
<dt><tt>value_const_iterator value_end(const Type *Typ) const</tt>:</dt>
<dd>Get a const_iterator to the end of a type plane. This serves as the
marker for end of iteration of the type plane.
Note: the type plane must already exist before using this.</dd>
<dt><tt>type_iterator type_begin()</tt>:</dt>
<dd>Get an iterator to the start of the name/Type map.</dd>
<dt><tt>type_const_iterator type_begin() cons</tt>:</dt>
<dd> Get a const_iterator to the start of the name/Type map.</dd>
<dt><tt>type_iterator type_end()</tt>:</dt>
<dd>Get an iterator to the end of the name/Type map. This serves as the
marker for end of iteration of the types.</dd>
<dt><tt>type_const_iterator type_end() const</tt>:</dt>
<dd>Get a const-iterator to the end of the name/Type map. This serves
as the marker for end of iteration of the types.</dd>
<dt><tt>plane_const_iterator find(const Type* Typ ) const</tt>:</dt>
<dd>This method returns a plane_const_iterator for iteration over
the type planes starting at a specific plane, given by \p Ty.</dd>
<dt><tt>plane_iterator find( const Type* Typ </tt>:</dt>
<dd>This method returns a plane_iterator for iteration over the
type planes starting at a specific plane, given by \p Ty.</dd>
</dl>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="coreclasses">The Core LLVM Class Hierarchy Reference </a>
@@ -1091,9 +1493,9 @@ convenient form for direct access.</p></li>
<li><tt>User::op_iterator</tt> - Typedef for iterator over the operand
list<br>
<tt>User::op_const_iterator</tt> <tt>use_iterator op_begin()</tt> -
Get an iterator to the start of the operand list.<br>
<tt>use_iterator op_end()</tt> - Get an iterator to the end of the
<tt>op_iterator op_begin()</tt> - Get an iterator to the start of
the operand list.<br>
<tt>op_iterator op_end()</tt> - Get an iterator to the end of the
operand list.
<p> Together, these methods make up the iterator based interface to
the operands of a <tt>User</tt>.</p></li>
@@ -1221,7 +1623,7 @@ manually inserted into the <a href="#Function"><tt>Function</tt></a>.</p></li>
<li><tt>BasicBlock::iterator</tt> - Typedef for instruction list iterator<br>
<tt>BasicBlock::const_iterator</tt> - Typedef for const_iterator.<br>
<tt>begin()</tt>, <tt>end()</tt>, <tt>front()</tt>, <tt>back()</tt>,
<tt>size()</tt>, <tt>empty()</tt>, <tt>rbegin()</tt>, <tt>rend()</tt> -
<tt>size()</tt>, <tt>empty()</tt>
STL-style functions for accessing the instruction list.
<p>These methods and typedefs are forwarding functions that have the same
@@ -1409,8 +1811,8 @@ is its address (after linking) which is guaranteed to be constant.</p>
<li><tt>Function::iterator</tt> - Typedef for basic block list iterator<br>
<tt>Function::const_iterator</tt> - Typedef for const_iterator.<br>
<tt>begin()</tt>, <tt>end()</tt>, <tt>front()</tt>, <tt>back()</tt>,
<tt>size()</tt>, <tt>empty()</tt>, <tt>rbegin()</tt>, <tt>rend()</tt>
<tt>begin()</tt>, <tt>end()</tt>
<tt>size()</tt>, <tt>empty()</tt>
<p>These are forwarding methods that make it easy to access the contents of
a <tt>Function</tt> object's <a href="#BasicBlock"><tt>BasicBlock</tt></a>
@@ -1422,12 +1824,12 @@ is its address (after linking) which is guaranteed to be constant.</p>
is necessary to use when you need to update the list or perform a complex
action that doesn't have a forwarding method.</p></li>
<li><tt>Function::aiterator</tt> - Typedef for the argument list
<li><tt>Function::arg_iterator</tt> - Typedef for the argument list
iterator<br>
<tt>Function::const_aiterator</tt> - Typedef for const_iterator.<br>
<tt>Function::const_arg_iterator</tt> - Typedef for const_iterator.<br>
<tt>abegin()</tt>, <tt>aend()</tt>, <tt>afront()</tt>, <tt>aback()</tt>,
<tt>asize()</tt>, <tt>aempty()</tt>, <tt>arbegin()</tt>, <tt>arend()</tt>
<tt>arg_begin()</tt>, <tt>arg_end()</tt>
<tt>arg_size()</tt>, <tt>arg_empty()</tt>
<p>These are forwarding methods that make it easy to access the contents of
a <tt>Function</tt> object's <a href="#Argument"><tt>Argument</tt></a>
@@ -1571,8 +1973,8 @@ provide a name for it (probably based on the name of the translation unit).</p>
<li><tt>Module::iterator</tt> - Typedef for function list iterator<br>
<tt>Module::const_iterator</tt> - Typedef for const_iterator.<br>
<tt>begin()</tt>, <tt>end()</tt>, <tt>front()</tt>, <tt>back()</tt>,
<tt>size()</tt>, <tt>empty()</tt>, <tt>rbegin()</tt>, <tt>rend()</tt>
<tt>begin()</tt>, <tt>end()</tt>
<tt>size()</tt>, <tt>empty()</tt>
<p>These are forwarding methods that make it easy to access the contents of
a <tt>Module</tt> object's <a href="#Function"><tt>Function</tt></a>
@@ -1590,12 +1992,12 @@ provide a name for it (probably based on the name of the translation unit).</p>
<hr>
<ul>
<li><tt>Module::giterator</tt> - Typedef for global variable list iterator<br>
<li><tt>Module::global_iterator</tt> - Typedef for global variable list iterator<br>
<tt>Module::const_giterator</tt> - Typedef for const_iterator.<br>
<tt>Module::const_global_iterator</tt> - Typedef for const_iterator.<br>
<tt>gbegin()</tt>, <tt>gend()</tt>, <tt>gfront()</tt>, <tt>gback()</tt>,
<tt>gsize()</tt>, <tt>gempty()</tt>, <tt>grbegin()</tt>, <tt>grend()</tt>
<tt>global_begin()</tt>, <tt>global_end()</tt>
<tt>global_size()</tt>, <tt>global_empty()</tt>
<p> These are forwarding methods that make it easy to access the contents of
a <tt>Module</tt> object's <a
@@ -1709,13 +2111,13 @@ ConstantArray etc for representing the various types of Constants.</p>
<li>ConstantArray : This represents a constant array.
<ul>
<li><tt>const std::vector&lt;Use&gt; &amp;getValues() const</tt>: Returns
a Vecotr of component constants that makeup this array. </li>
a vector of component constants that makeup this array. </li>
</ul>
</li>
<li>ConstantStruct : This represents a constant struct.
<ul>
<li><tt>const std::vector&lt;Use&gt; &amp;getValues() const</tt>: Returns
a Vector of component constants that makeup this array. </li>
a vector of component constants that makeup this array. </li>
</ul>
</li>
<li>GlobalValue : This represents either a global variable or a function. In
@@ -1818,236 +2220,11 @@ types.</p>
<div class="doc_text">
<p>This subclass of Value defines the interface for incoming formal
arguments to a function. A Function maitanis a list of its formal
arguments to a function. A Function maintains a list of its formal
arguments. An argument has a pointer to the parent Function.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="SymbolTable">The <tt>SymbolTable</tt> class</a>
</div>
<div class="doc_text">
<p>This class provides a symbol table that the
<a href="#Function"><tt>Function</tt></a> and <a href="#Module">
<tt>Module</tt></a> classes use for naming definitions. The symbol table can
provide a name for any <a href="#Value"><tt>Value</tt></a> or
<a href="#Type"><tt>Type</tt></a>. <tt>SymbolTable</tt> is an abstract data
type. It hides the data it contains and provides access to it through a
controlled interface.</p>
<p>To use the <tt>SymbolTable</tt> well, you need to understand the
structure of the information it holds. The class contains two
<tt>std::map</tt> objects. The first, <tt>pmap</tt>, is a map of
<tt>Type*</tt> to maps of name (<tt>std::string</tt>) to <tt>Value*</tt>.
The second, <tt>tmap</tt>, is a map of names to <tt>Type*</tt>. Thus, Values
are stored in two-dimensions and accessed by <tt>Type</tt> and name. Types,
however, are stored in a single dimension and accessed only by name.</p>
<p>The interface of this class provides three basic types of operations:
<ol>
<li><em>Accessors</em>. Accessors provide read-only access to information
such as finding a value for a name with the
<a href="#SymbolTable_lookup">lookup</a> method.</li>
<li><em>Mutators</em>. Mutators allow the user to add information to the
<tt>SymbolTable</tt> with methods like
<a href="#SymbolTable_insert"><tt>insert</tt></a>.</li>
<li><em>Iterators</em>. Iterators allow the user to traverse the content
of the symbol table in well defined ways, such as the method
<a href="#SymbolTable_type_begin"><tt>type_begin</tt></a>.</li>
</ol>
<h3>Accessors</h3>
<dl>
<dt><tt>Value* lookup(const Type* Ty, const std::string&amp; name) const</tt>:
</dt>
<dd>The <tt>lookup</tt> method searches the type plane given by the
<tt>Ty</tt> parameter for a <tt>Value</tt> with the provided <tt>name</tt>.
If a suitable <tt>Value</tt> is not found, null is returned.</dd>
<dt><tt>Type* lookupType( const std::string&amp; name) const</tt>:</dt>
<dd>The <tt>lookupType</tt> method searches through the types for a
<tt>Type</tt> with the provided <tt>name</tt>. If a suitable <tt>Type</tt>
is not found, null is returned.</dd>
<dt><tt>bool hasTypes() const</tt>:</dt>
<dd>This function returns true if an entry has been made into the type
map.</dd>
<dt><tt>bool isEmpty() const</tt>:</dt>
<dd>This function returns true if both the value and types maps are
empty</dd>
<dt><tt>std::string get_name(const Value*) const</tt>:</dt>
<dd>This function returns the name of the Value provided or the empty
string if the Value is not in the symbol table.</dd>
<dt><tt>std::string get_name(const Type*) const</tt>:</dt>
<dd>This function returns the name of the Type provided or the empty
string if the Type is not in the symbol table.</dd>
</dl>
<h3>Mutators</h3>
<dl>
<dt><tt>void insert(Value *Val)</tt>:</dt>
<dd>This method adds the provided value to the symbol table. The Value must
have both a name and a type which are extracted and used to place the value
in the correct type plane under the value's name.</dd>
<dt><tt>void insert(const std::string&amp; Name, Value *Val)</tt>:</dt>
<dd> Inserts a constant or type into the symbol table with the specified
name. There can be a many to one mapping between names and constants
or types.</dd>
<dt><tt>void insert(const std::string&amp; Name, Type *Typ)</tt>:</dt>
<dd> Inserts a type into the symbol table with the specified name. There
can be a many-to-one mapping between names and types. This method
allows a type with an existing entry in the symbol table to get
a new name.</dd>
<dt><tt>void remove(Value* Val)</tt>:</dt>
<dd> This method removes a named value from the symbol table. The
type and name of the Value are extracted from \p N and used to
lookup the Value in the correct type plane. If the Value is
not in the symbol table, this method silently ignores the
request.</dd>
<dt><tt>void remove(Type* Typ)</tt>:</dt>
<dd> This method removes a named type from the symbol table. The
name of the type is extracted from \P T and used to look up
the Type in the type map. If the Type is not in the symbol
table, this method silently ignores the request.</dd>
<dt><tt>Value* remove(const std::string&amp; Name, Value *Val)</tt>:</dt>
<dd> Remove a constant or type with the specified name from the
symbol table.</dd>
<dt><tt>Type* remove(const std::string&amp; Name, Type* T)</tt>:</dt>
<dd> Remove a type with the specified name from the symbol table.
Returns the removed Type.</dd>
<dt><tt>Value *value_remove(const value_iterator&amp; It)</tt>:</dt>
<dd> Removes a specific value from the symbol table.
Returns the removed value.</dd>
<dt><tt>bool strip()</tt>:</dt>
<dd> This method will strip the symbol table of its names leaving
the type and values. </dd>
<dt><tt>void clear()</tt>:</dt>
<dd>Empty the symbol table completely.</dd>
</dl>
<h3>Iteration</h3>
<p>The following functions describe three types of iterators you can obtain
the beginning or end of the sequence for both const and non-const. It is
important to keep track of the different kinds of iterators. There are
three idioms worth pointing out:</p>
<table>
<tr><th>Units</th><th>Iterator</th><th>Idiom</th></tr>
<tr>
<td align="left">Planes Of name/Value maps</td><td>PI</td>
<td align="left"><pre><tt>
for (SymbolTable::plane_const_iterator PI = ST.plane_begin(),
PE = ST.plane_end(); PI != PE; ++PI ) {
PI-&gt;first // This is the Type* of the plane
PI-&gt;second // This is the SymbolTable::ValueMap of name/Value pairs
</tt></pre></td>
</tr>
<tr>
<td align="left">All name/Type Pairs</td><td>TI</td>
<td align="left"><pre><tt>
for (SymbolTable::type_const_iterator TI = ST.type_begin(),
TE = ST.type_end(); TI != TE; ++TI )
TI-&gt;first // This is the name of the type
TI-&gt;second // This is the Type* value associated with the name
</tt></pre></td>
</tr>
<tr>
<td align="left">name/Value pairs in a plane</td><td>VI</td>
<td align="left"><pre><tt>
for (SymbolTable::value_const_iterator VI = ST.value_begin(SomeType),
VE = ST.value_end(SomeType); VI != VE; ++VI )
VI-&gt;first // This is the name of the Value
VI-&gt;second // This is the Value* value associated with the name
</tt></pre></td>
</tr>
</table>
<p>Using the recommended iterator names and idioms will help you avoid
making mistakes. Of particular note, make sure that whenever you use
value_begin(SomeType) that you always compare the resulting iterator
with value_end(SomeType) not value_end(SomeOtherType) or else you
will loop infinitely.</p>
<dl>
<dt><tt>plane_iterator plane_begin()</tt>:</dt>
<dd>Get an iterator that starts at the beginning of the type planes.
The iterator will iterate over the Type/ValueMap pairs in the
type planes. </dd>
<dt><tt>plane_const_iterator plane_begin() const</tt>:</dt>
<dd>Get a const_iterator that starts at the beginning of the type
planes. The iterator will iterate over the Type/ValueMap pairs
in the type planes. </dd>
<dt><tt>plane_iterator plane_end()</tt>:</dt>
<dd>Get an iterator at the end of the type planes. This serves as
the marker for end of iteration over the type planes.</dd>
<dt><tt>plane_const_iterator plane_end() const</tt>:</dt>
<dd>Get a const_iterator at the end of the type planes. This serves as
the marker for end of iteration over the type planes.</dd>
<dt><tt>value_iterator value_begin(const Type *Typ)</tt>:</dt>
<dd>Get an iterator that starts at the beginning of a type plane.
The iterator will iterate over the name/value pairs in the type plane.
Note: The type plane must already exist before using this.</dd>
<dt><tt>value_const_iterator value_begin(const Type *Typ) const</tt>:</dt>
<dd>Get a const_iterator that starts at the beginning of a type plane.
The iterator will iterate over the name/value pairs in the type plane.
Note: The type plane must already exist before using this.</dd>
<dt><tt>value_iterator value_end(const Type *Typ)</tt>:</dt>
<dd>Get an iterator to the end of a type plane. This serves as the marker
for end of iteration of the type plane.
Note: The type plane must already exist before using this.</dd>
<dt><tt>value_const_iterator value_end(const Type *Typ) const</tt>:</dt>
<dd>Get a const_iterator to the end of a type plane. This serves as the
marker for end of iteration of the type plane.
Note: the type plane must already exist before using this.</dd>
<dt><tt>type_iterator type_begin()</tt>:</dt>
<dd>Get an iterator to the start of the name/Type map.</dd>
<dt><tt>type_const_iterator type_begin() cons</tt>:</dt>
<dd> Get a const_iterator to the start of the name/Type map.</dd>
<dt><tt>type_iterator type_end()</tt>:</dt>
<dd>Get an iterator to the end of the name/Type map. This serves as the
marker for end of iteration of the types.</dd>
<dt><tt>type_const_iterator type_end() const</tt>:</dt>
<dd>Get a const-iterator to the end of the name/Type map. This serves
as the marker for end of iteration of the types.</dd>
<dt><tt>plane_const_iterator find(const Type* Typ ) const</tt>:</dt>
<dd>This method returns a plane_const_iterator for iteration over
the type planes starting at a specific plane, given by \p Ty.</dd>
<dt><tt>plane_iterator find( const Type* Typ </tt>:</dt>
<dd>This method returns a plane_iterator for iteration over the
type planes starting at a specific plane, given by \p Ty.</dd>
<dt><tt>const ValueMap* findPlane( const Type* Typ ) cons</tt>:</dt>
<dd>This method returns a ValueMap* for a specific type plane. This
interface is deprecated and may go away in the future.</dd>
</dl>
</div>
<!-- *********************************************************************** -->
<hr>
<address>
@@ -2064,5 +2241,3 @@ will loop infinitely.</p>
</body>
</html>
<!-- vim: sw=2 noai
-->

View File

@@ -40,37 +40,32 @@ projects that use LLVM header files, libraries, and tools. In order to use
these facilities, a Makefile from a project must do the following things:</p>
<ol>
<li>Set environment variables.There are several environment variables that a
Makefile needs to set to use the LLVM build system:
<li>Set <tt>make</tt> variables. There are several variables that a Makefile
needs to set to use the LLVM build system:
<ul>
<li><tt>PROJECT_NAME</tt> - The name by which your project is known.</li>
<li><tt>LLVM_SRC_ROOT</tt> - The root of the LLVM source tree.</li>
<li><tt>LLVM_OBJ_ROOT</tt> - The root of the LLVM object tree.</li>
<li><tt>BUILD_SRC_ROOT</tt> - The root of the project's source tree.</li>
<li><tt>BUILD_OBJ_ROOT</tt> - The root of the project's object tree.</li>
<li><tt>BUILD_SRC_DIR</tt> - The directory containing the current source to be
compiled.</li>
<li><tt>BUILD_OBJ_DIR</tt> - The directory where the current source will place
the new object files. This should always be the current directory.</li>
<li><tt>LEVEL</tt> - The relative path from the current directory to the root
of the object tree.</li>
<li><tt>PROJ_SRC_ROOT</tt> - The root of the project's source tree.</li>
<li><tt>PROJ_OBJ_ROOT</tt> - The root of the project's object tree.</li>
<li><tt>PROJ_INSTALL_ROOT</tt> - The root installation directory.</li>
<li><tt>LEVEL</tt> - The relative path from the current directory to the
project's root ($PROJ_OBJ_ROOT).</li>
</ul></li>
<li>Include <tt>Makefile.config</tt> from <tt>$(LLVM_OBJ_ROOT)</tt>.</li>
<li>Include <tt>Makefile.rules</tt> from <tt>$(LLVM_SRC_ROOT)</tt>.</li>
</ol>
<p>There are two ways that you can set all of these variables:</p>
<ol>
<li>You can write your own Makefiles which hard-code these values.</li>
<li> You can use the pre-made LLVM sample project. This sample project includes
Makefiles, a configure script that can be used to configure the location of
LLVM, and the ability to support multiple object directories from a single
source directory.</li>
<li>You can use the pre-made LLVM sample project. This sample project
includes Makefiles, a configure script that can be used to configure the
location of LLVM, and the ability to support multiple object directories
from a single source directory.</li>
</ol>
<p>This document assumes that you will base your project off of the LLVM sample
<p>This document assumes that you will base your project on the LLVM sample
project found in <tt>llvm/projects/sample</tt>. If you want to devise your own
build system, studying the sample project and LLVM Makefiles will probably
provide enough information on how to write your own Makefiles.</p>
@@ -94,39 +89,52 @@ the name of your project.</li>
<li>Add your source code and Makefiles to your source tree.</li>
<li>If you want your Makefiles to be configured by the <tt>configure</tt>
script, or if you want to support multiple object directories, add your
Makefiles to the <tt>configure</tt> script by adding them into the
<tt>autoconf/configure.ac</tt> file. The macro <tt>AC_CONFIG_MAKEFILE</tt> will
copy a file, unmodified, from the source directory to the object directory.</li>
<li>If you want your project to be configured with the <tt>configure</tt> script
then you need to edit <tt>autoconf/configure.ac</tt> as follows:
<ul>
<li><b>AC_INIT</b>. Place the name of your project, its version number and
a contact email address for your project as the arguments to this macro</li>
<li><b>AC_CONFIG_AUC_DIR</b>. If your project isn't in the
<tt>llvm/projects</tt> directory then you might need to adjust this so that
it specifies a relative path to the <tt>llvm/autoconf</tt> directory.</li>
<li><b>LLVM_CONFIG_PROJECT</b>. Just leave this alone.</li>
<li><b>AC_CONFIG_SRCDIR</b>. Specify a path to a file name that identifies
your project; or just leave it at <tt>Makefile.config.in</tt></li>
<li><b>AC_CONFIG_FILES</b>. Do not change.</li>
<li><b>AC_CONFIG_MAKEFILE</b>. Use one of these macros for each Makefile
that your project uses. This macro arranges for your makefiles to be copied
from the source directory, unmodified, to the build directory.</li>
</ul>
</li>
<li>After updating <tt>autoconf/configure.ac</tt>, regenerate the
configure script with these commands:
<div class="doc_code">
<p><tt>% cd autoconf<br>
% autoconf -o ../configure</tt></p>
% AutoRegen.sh</tt></p>
</div>
<p>You must be using Autoconf version 2.57 or higher.</p></li>
<p>You must be using Autoconf version 2.59 or later and your aclocal version
should 1.9 or later.</p></li>
<li>Run <tt>configure</tt> in the directory in which you want to place
object code. Use the following options to tell your project where it
can find LLVM:
<dl>
<dt><tt>--with-llvmsrc=&lt;directory&gt;</tt>
<dd>
Tell your project where the LLVM source tree is located.
<p>
<dt><tt>--with-llvmobj=&lt;directory&gt;</tt>
<dd>
Tell your project where the LLVM object tree is located.
<dt><tt>--with-llvmsrc=&lt;directory&gt;</tt></dt>
<dd>Tell your project where the LLVM source tree is located.</dd>
<dt><br/><tt>--with-llvmobj=&lt;directory&gt;</tt></dt>
<dd>Tell your project where the LLVM object tree is located.</dd>
<dt><br/><tt>--prefix=&lt;directory&gt;</tt></dt>
<dd>Tell your project where it should get installed.</dd>
</dl>
</ol>
<p>That's it! Now all you have to do is type <tt>gmake</tt> in the root of
your object directory, and your project should build.</p>
<p>That's it! Now all you have to do is type <tt>gmake</tt> (or <tt>make</tt>
if your on a GNU/Linux system) in the root of your object directory, and your
project should build.</p>
</div>
@@ -186,30 +194,25 @@ directories:</p>
This subdirectory should contain tests that verify that your code
works correctly. Automated tests are especially useful.
<p>
Currently, the LLVM build system provides little support for tests,
although some exists. Expanded support for tests will hopefully
occur in the future. In the meantime, the LLVM system does provide the
following:
Currently, the LLVM build system provides basic support for tests.
The LLVM system provides the following:
<ul>
<li>
LLVM provides several QMTest test classes that can be used to
create tests. They can be found in
<tt>llvm/test/QMTest/llvm.py</tt>. These test classes perform a
variety of functions, including code optimization tests, assembly
tests, and code analysis tests. The Makefile in
<tt>llvm/test</tt> provides the QMTest context needed by LLVM test
classes.
<p>
LLVM provides a tcl procedure that is used by Dejagnu to run
tests. It can be found in <tt>llvm/lib/llvm-dg.exp</tt>. This
test procedure uses RUN lines in the actual test case to determine
how to run the test. See the <a
href="TestingGuide.html">TestingGuide</a> for more details. You
can easily write Makefile support similar to the Makefiles in
<tt>llvm/test</tt> to use Dejagnu to run your project's tests.<br/></li>
<li>
The LLVM source tree provides benchmarks and programs which are
known to compile with the LLVM GCC front ends. You can use these
LLVM contains an optional package called <tt>llvm-test</tt>
which provides benchmarks and programs that are known to compile with the
LLVM GCC front ends. You can use these
programs to test your code, gather statistics information, and
compare it to the current LLVM performance statistics. These
programs are found in the <tt>llvm/test/Programs</tt> directory.
<p>
Currently, there is no way to hook your tests directly into the
<tt>llvm/test/Programs</tt> testing harness. You will simply
compare it to the current LLVM performance statistics.
<br/>Currently, there is no way to hook your tests directly into the
<tt>llvm/test</tt> testing harness. You will simply
need to find a way to use the source provided within that directory
on your own.
</ul>
@@ -404,13 +407,13 @@ whether you do a Debug, Release, or Profile build.</p>
<dt>Libraries
<dd>
All libraries (static and dynamic) will be stored in
<tt>BUILD_OBJ_ROOT/lib/&lt;type&gt;</tt>, where type is <tt>Debug</tt>,
<tt>PROJ_OBJ_ROOT/&lt;type&gt;/lib</tt>, where type is <tt>Debug</tt>,
<tt>Release</tt>, or <tt>Profile</tt> for a debug, optimized, or
profiled build, respectively.<p>
<dt>Executables
<dd>All executables will be stored in
<tt>BUILD_OBJ_ROOT/tools/&lt;type&gt;</tt>, where type is <tt>Debug</tt>,
<tt>PROJ_OBJ_ROOT/&lt;type&gt;/bin</tt>, where type is <tt>Debug</tt>,
<tt>Release</tt>, or <tt>Profile</tt> for a debug, optimized, or profiled
build, respectively.
</dl>

View File

@@ -4,11 +4,11 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="llvm.css" type="text/css">
<title>LLVM 1.4 Release Notes</title>
<title>LLVM 1.5 Release Notes</title>
</head>
<body>
<div class="doc_title">LLVM 1.4 Release Notes</div>
<div class="doc_title">LLVM 1.5 Release Notes</div>
<ol>
<li><a href="#intro">Introduction</a></li>
@@ -16,22 +16,11 @@
<li><a href="GettingStarted.html">Installation Instructions</a></li>
<li><a href="#portability">Portability and Supported Platforms</a></li>
<li><a href="#knownproblems">Known Problems</a>
<ul>
<li><a href="#experimental">Experimental features included in this
release</a>
<li><a href="#core">Known problems with the LLVM Core</a>
<li><a href="#c-fe">Known problems with the C Front-end</a>
<li><a href="#c++-fe">Known problems with the C++ Front-end</a>
<li><a href="#x86-be">Known problems with the X86 Back-end</a>
<li><a href="#sparcv9-be">Known problems with the SparcV9 Back-end</a>
<li><a href="#ppc-be">Known problems with the PowerPC Back-end</a>
<li><a href="#c-be">Known problems with the C back-end</a>
</ul></li>
<li><a href="#additionalinfo">Additional Information</a></li>
</ol>
<div class="doc_author">
<p>Written by the <a href="http://llvm.cs.uiuc.edu">LLVM team</a><p>
<p>Written by the <a href="http://llvm.cs.uiuc.edu">LLVM Team</a><p>
</div>
<!-- *********************************************************************** -->
@@ -43,22 +32,22 @@
<div class="doc_text">
<p>This document contains the release notes for the LLVM compiler
infrastructure, release 1.4. Here we describe the status of LLVM, including any
known problems and bug fixes from the previous release. The most up-to-date
version of this document can be found on the <a
href="http://llvm.cs.uiuc.edu/releases/1.4/">LLVM 1.4 web site</a>. If you are
infrastructure, release 1.5. Here we describe the status of LLVM, including any
known problems and major improvements from the previous release. The most
up-to-date version of this document can be found on the <a
href="http://llvm.cs.uiuc.edu/releases/1.5/">LLVM 1.5 web site</a>. If you are
not reading this on the LLVM web pages, you should probably go there because
this document may be updated after the release.</p>
<p>For more information about LLVM, including information about potentially more
current releases, please check out the <a href="http://llvm.cs.uiuc.edu">main
<p>For more information about LLVM, including information about the latest
release, please check out the <a href="http://llvm.cs.uiuc.edu">main LLVM
web site</a>. If you have questions or comments, the <a
href="http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev">LLVM developer's mailing
list</a> is a good place to send them.</p>
<p>Note that if you are reading this file from CVS, this document applies
to the <i>next</i> release, not the current one. To see the release notes for
the current or previous releases, see the <a
<p>Note that if you are reading this file from CVS or the main LLVM web page,
this document applies to the <i>next</i> release, not the current one. To see
the release notes for the current or previous releases, see the <a
href="http://llvm.cs.uiuc.edu/releases/">releases page</a>.</p>
</div>
@@ -71,221 +60,284 @@ href="http://llvm.cs.uiuc.edu/releases/">releases page</a>.</p>
<div class="doc_text">
<p>This is the fifth public release of the LLVM compiler infrastructure.</p>
<p>This is the sixth public release of the LLVM Compiler Infrastructure.</p>
<p> At this time, LLVM is known to correctly compile and run all C &amp; C++
SPEC CPU95 &amp; 2000 benchmarks, the Olden benchmarks, and the Ptrdist
benchmarks, and <b>many</b> other C and C++ programs.</p>
<p>LLVM 1.5 is known to correctly compile a wide range of C and C++ programs,
includes bug fixes for those problems found since the 1.4 release, and includes
a large number of new features and enhancements, described below.</p>
</div>
<!--=========================================================================-->
<div class="doc_subsubsection">
<a name="newfeatures">This release implements the following new features:</a>
<div class="doc_subsection">
<a name="newfeatures">New Features in LLVM 1.5</a>
</div>
<!--_________________________________________________________________________-->
<div class="doc_subsubsection"><a name="newcg">New Native Code
Generators</a></div>
<div class="doc_text">
<p>
This release includes new native code generators for <a
href="#alpha-be">Alpha</a>, <a href="#ia64-be">IA-64</a>, and <a
href="#sparcv8">SPARC-V8</a> (32-bit SPARC). These code generators are still
beta quality, but are progressing rapidly. The Alpha backend is implemented
with an eye towards being compatible with the widely used SimpleScalar
simulator.
</p>
</div>
<!--_________________________________________________________________________-->
<div class="doc_subsubsection"><a name="selectiondag">New Instruction
Selector Framework</a></div>
<div class="doc_text">
<p>This release includes a <a href="CodeGenerator.html#instselect">new framework
for building instruction selectors</a>, which has long been the hardest part of
building a new LLVM target. This framework handles a lot of the mundane (but
easy to get wrong) details of writing the instruction selector, such as
generating efficient code for <a
href="LangRef.html#i_getelementptr">getelementptr</a> instructions, promoting
small integer types to larger types (e.g. for RISC targets with one size of
integer registers), expanding 64-bit integer operations for 32-bit targets, etc.
Currently, the X86, PowerPC, Alpha, and IA-64 backends use this framework. The
SPARC backends will be migrated when time permits.
</p>
</div>
<!--_________________________________________________________________________-->
<div class="doc_subsubsection"><a name="customccs">New Support for Per-Function
Calling Conventions</a></div>
<div class="doc_text">
<p>LLVM 1.5 adds supports for <a href="LangRef.html#callingconv">per-function
calling conventions</a>. Traditionally, the LLVM code generators match the
native C calling conventions for a target. This is important for compatibility,
but is not very flexible. This release allows custom calling conventions to be
established for functions, and defines three target-independent conventions (<a
href="LangRef.html#callingconv">C call, fast call, and cold call</a>) which may
be supported by code generators. When possible, the LLVM optimizer promotes C
functions to use the "fastcc" convention, allowing the use of more efficient
calling sequences (e.g., parameters are passed in registers in the X86 target).
</p>
<p>Targets may now also define target-specific calling conventions, allowing
LLVM to fully support calling convention altering options (e.g. GCC's
<tt>-mregparm</tt> flag) and well-defined target conventions (e.g. stdcall and
fastcall on X86).</p>
</div>
<!--_________________________________________________________________________-->
<div class="doc_subsubsection"><a name="tailcalls">New Support for
Proper Tail Calls</a></div>
<div class="doc_text">
<p>The release now includes support for <a
href="http://doi.acm.org/10.1145/277650.277719">proper tail calls</a>, as
required to implement languages like Scheme. Tail calls make use of two
features: custom calling conventions (described above), which allow the code
generator to use a convention where the caller deallocates its stack before it
returns. The second feature is a flag on the <a href="LangRef.html#i_call">call
instruction</a>, which indicates that the callee does not access the caller's
stack frame (indicating that it is acceptable to deallocate the caller stack
before invoking the callee). LLVM proper tail calls run on the system stack (as
do normal calls), supports indirect tail calls, tail calls with arbitrary
numbers of arguments, tail calls where the callee requires more argument space
than the caller, etc. The only case not supported are varargs calls, but that
could be added if desired.
</p>
<p>To ensure a call is interpreted as a tail call, a front-end must mark
functions as "fastcc", mark calls with the 'tail' marker, and follow the call
with a return of the called value (or void). The optimizer and code generator
attempt to handle more general cases, but the simple case will always work if
the code generator supports tail calls. Here is an example:</p>
<pre>
fastcc int %bar(int %X, int(double, int)* %FP) { ;<i> fastcc</i>
%Y = tail call fastcc int %FP(double 0.0, int %X) ;<i> tail, fastcc</i>
ret int %Y
}
</pre>
<p>In LLVM 1.5, the X86 code generator is the only target that has been enhanced
to support proper tail calls (other targets will be enhanced in future).
Further, because this support was added very close to the release, it is
disabled by default. Pass <tt>-enable-x86-fastcc</tt> to llc to enable it (this
will be enabled by default in the next release). The example above compiles to:
</p>
<pre>
bar:
sub ESP, 8 # Callee uses more space than the caller
mov ECX, DWORD PTR [ESP + 8] # Get the old return address
mov DWORD PTR [ESP + 4], 0 # First half of 0.0
mov DWORD PTR [ESP + 8], 0 # Second half of 0.0
mov DWORD PTR [ESP], ECX # Put the return address where it belongs
jmp EDX # Tail call "FP"
</pre>
<p>
With fastcc on X86, the first two integer arguments are passed in EAX/EDX, the
callee pops its arguments off the stack, and the argument area is always a
multiple of 8 bytes in size.
</p>
</div>
<!--_________________________________________________________________________-->
<div class="doc_subsubsection">Other New Features</div>
<div class="doc_text">
<ol>
<li>LLVM now includes a JIT for the PowerPC target.</li>
<li>LLVM now optimizes global variables significantly more than it did
before.
</li>
<li>LLVM now includes the new '<tt>undef</tt>' value and
<a href="LangRef.html#i_unreachable"><tt>unreachable</tt></a> instruction,
which give the optimizer more information about the behavior of the
program.
</li>
<li>llvmgcc and llvmg++ now emit source line number information when '-g' is
passed in. This information can be used with llvm-db or other tools and
passes.
</li>
<li>The test/Programs hierarchy <a href="http://llvm.cs.uiuc.edu/PR257">has
been moved out of the main LLVM tree</a> into a separate CVS repository and
tarball. This shrinks the distribution size of LLVM itself significantly.
</li>
<li>Bytecode compression with bzip2 has been implemented. All bytecode files
generated by LLVM will now be compressed by default. Compression can be
disabled with the <tt>-disable-compression</tt> option to the tools that can
generate bytecode files.
</li>
<li>A generic <a href="http://llvm.cs.uiuc.edu/PR353">compiler driver</a> and
an associated <a href="CommandGuide/html/llvm-ld.html">generic linker</a> have
been implemented. The compiler driver is generic because it can be configured
to pre-process, translate, optimize, assemble, and link code from any source
language. This aids compiler writers because all that is needed is a
source-to-bytecode or source-to-assembly translator and a configuration file.
The linker is generic because it allows dynamically loadable optimization
modules to be executed for link-time optimization. Language specific
link-time optimization modules can be created and executed automatically.
</li>
<li>The <a href="http://llvm.cs.uiuc.edu/PR263">dependent libraries</a>
feature has been implemented. This allows front end compilers to indicate in
the bytecode which libraries the bytecode needs to be linked with. Both the
C/C++ front end and Stacker support generating the required libraries. The
Linker now supports using this information to ensure required libaries are
linked into the module. This minimizes the need to use the <tt>-l</tt> option
when using <a href="CommandGuide/html/llvmc.html"><tt>llvmc</tt></a>
</li>
<li>The LLVM makefiles have been improved to build LLVM faster (2x) and
includes new targets (like dist-check, uninstall). One important change is
associated with <a href="http://llvm.cs.uiuc.edu/PR456">PR456</a>. The
libraries and tools will now be built into <tt>$builddir/Debug/{bin,lib}</tt>
instead of <tt>$builddir/tools/Debug</tt> and <tt>$builddir/lib/Debug</tt>.
Similarly for <tt>Release</tt> and <tt>Profile</tt> builds.
</li>
<li>The LLVM source code is much more compatible with Microsoft Visual C++,
including the JIT and runtime-code generation, though the entire system
may not work with it.
</li>
<li>The target-to-JIT interfaces <a href="http://llvm.cs.uiuc.edu/PR283">are
now much simpler</a> and more powerful.
</li>
<li>zlib and libpng are <a href="http://llvm.cs.uiuc.edu/PR417">no longer
included in the main LLVM tarball</a>.</li>
<li>The LLVM code generator now generates asm writers for the target from
an abstract target description, instead of requiring them to be hand
written.</li>
<li>LLVM regression and feature tests can now be run with DejaGNU.</li>
<li>llvmgcc and llvmg++ now emit source-level line number information, making
it possible to map from LLVM code back to source. This is currently used
by llvm-db.</li>
<li>Floating point intensive programs on X86 systems run much faster
with the LLC code generator and JIT than in 1.3.</li>
</ol>
<li>LLVM now includes an <a href="http://llvm.cs.uiuc.edu/PR415">
Interprocedural Sparse Conditional Constant Propagation</a> pass, named
-ipsccp, which is run by default at link-time.</li>
<li>LLVM 1.5 is now about 15% faster than LLVM 1.4 and its core data
structures use about 30% less memory.</li>
<li>Support for Microsoft Visual Studio is improved, and <a
href="GettingStartedVS.html">now documented</a>. Most LLVM tools build
natively with Visual C++ now.</li>
<li><a href="GettingStarted.html#config">Configuring LLVM to build a subset
of the available targets</a> is now implemented, via the
<tt>--enable-targets=</tt> option.</li>
<li>LLVM can now create native shared libraries with '<tt>llvm-gcc ...
-shared -Wl,-native</tt>' (or with <tt>-Wl,-native-cbe</tt>).</li>
<li>LLVM now supports a new "<a href="LangRef.html#i_prefetch">llvm.prefetch
</a>" intrinsic, and llvm-gcc now supports __builtin_prefetch.
<li>LLVM now supports intrinsics for <a href="LangRef.html#int_count">bit
counting</a> and llvm-gcc now implements the GCC
<tt>__builtin_popcount</tt>, <tt>__builtin_ctz</tt>, and
<tt>__builtin_clz</tt> builtins.</li>
<li>LLVM now mostly builds on HP-UX with the HP aCC Compiler.</li>
<li>The LLVM X86 backend can now emit Cygwin-compatible .s files.</li>
<li>LLVM now includes workarounds in the code generator generator which
reduces the likelyhood of <a href="http://llvm.cs.uiuc.edu/PR448">GCC
hitting swap during optimized builds</a>.</li>
<li>The <a href="http://llvm.cs.uiuc.edu/ProjectsWithLLVM/#llvmtv">LLVM
Transformation Visualizer</a> (llvm-tv) project has been updated to
work with LLVM 1.5.</li>
<li>Nightly tester output is now archived on the <a
href="http://mail.cs.uiuc.edu/pipermail/llvm-testresults/">
llvm-testresults</a> mailing list.</li>
</div>
<!--=========================================================================-->
<div class="doc_subsubsection">
In this release, the following missing features were implemented:
</div>
<div class="doc_text">
<ol>
<li><a href="http://llvm.cs.uiuc.edu/PR419">JIT interface should support
arbitrary calls</a>
</li>
<li>The <tt>llvm-ar</tt> tool was previously incomplete and didn't properly
support other ar(1) implementations. This has been corrected. <tt>llvm-ar</tt>
now fully supports all archive editing functions, table of contents listing,
extraction, and printing. It can also read BSD4.4/MacOSX and SVR4 style
archives. See <a href="CommandGuide/html/llvm-ar.html">llvm-ar</a> for
details.
</li>
</ol>
</div>
<!--=========================================================================-->
<div class="doc_subsubsection">
<a name="qualityofimp">In this release, the following Quality of Implementation
issues were fixed:</a>
</div>
<div class="doc_text">
<ol>
<li><a href="http://llvm.cs.uiuc.edu/PR426">[llvmg++] Tons of warnings
are spewed when linking to libstdc++</a>
</li>
<li><a href="http://llvm.cs.uiuc.edu/PR352">include/{Support,Config} ->
include/llvm/{Support,Config}</a>
</li>
<li>The names of the libraries generated by compiling LLVM source have been
changed to ensure they do not conflict with other packages upon installation.
Each LLVM library is now prefixed with LLVM and uses mixed clase. For example,
the library <tt>libasmparser.a</tt> in 1.3 has become
<tt>libLLVMAsmParser.a</tt> in release 1.4.
</li>
<li><a href="http://llvm.cs.uiuc.edu/PR459">[llvmg++] C++ frontend is expanding
lots of unused inline functions</a></li>
</ol>
</div>
<!--=========================================================================-->
<div class="doc_subsubsection">
In this release, the following build problems were fixed:
</div>
<div class="doc_text">
<ol>
<li><a href="http://llvm.cs.uiuc.edu/PR256">[autoconf] further standardizing
autoconf usage</a>. Various improvements in the configure.ac script were
made as well as the makefile system.
</li>
</ol>
</div>
<!--=========================================================================-->
<div class="doc_subsubsection">
<a name="codequality">This release includes the following Code Quality
improvements:</a>
<div class="doc_subsection">
<a name="codequality">Code Quality Improvements in LLVM 1.5</a>
</div>
<div class="doc_text">
<ol>
<li><a href="http://llvm.cs.uiuc.edu/PR362">Ugly code generated for
std::min/std::max</a>
<li>The new -simplify-libcalls pass improves code generated for well-known
library calls. The pass optimizes calls to many of the string, memory, and
standard I/O functions (e.g. replace the calls with simpler/faster calls) when
possible, given information known statically about the arguments to the call.
</li>
<li>The -globalopt pass now promotes non-address-taken static globals that are
only accessed in main to SSA registers.</li>
<li>Loops with trip counts based on array pointer comparisons (e.g. "<tt>for (i
= 0; &amp;A[i] != &amp;A[n]; ++i) ...</tt>") are optimized better than before,
which primarily helps iterator-intensive C++ code.</li>
<li>The optimizer now eliminates simple cases where redundant conditions exist
between neighboring blocks.</li>
<li>The reassociation pass (which turns (1+X+3) into (X+1+3) among other
things), is more aggressive and intelligent.</li>
<li>The -prune-eh pass now detects no-return functions in addition to the
no-unwind functions it did before.</li>
<li>The -globalsmodref alias analysis generates more precise results in some
cases.</li>
</ol>
</div>
<!--=========================================================================-->
<div class="doc_subsubsection">
<a name="bugfix">In this release, the following bugs in the previous release
were fixed:</a>
<div class="doc_subsection">
<a name="codequality">Code Generator Improvements in LLVM 1.5</a>
</div>
<div class="doc_text">
<ol>
<li>The code generator now can provide and use information about commutative
two-address instructions when performing register allocation.</li>
<li>The code generator now tracks function live-in registers explicitly,
instead of requiring the target to generate 'implicit defs' at the
entry to a function.</li>
<li>The code generator can lower integer division by a constant to
multiplication by a magic constant and multiplication by a constant into
shift/add sequences.</li>
<li>The code generator compiles fabs/fneg/sin/cos/sqrt to assembly instructions
when possible.</li>
<li>The PowerPC backend generates better code in many cases, making use of
FMA instructions and the recording ("dot") forms of various PowerPC
instructions.</li>
</ol>
</div>
<!--=========================================================================-->
<div class="doc_subsection">
<a name="bugfix">Significant Bugs Fixed in LLVM 1.5</a>
</div>
<div class="doc_text">
<p>Bugs fixed in the LLVM Core:</p>
<ol>
<li><a href="http://llvm.cs.uiuc.edu/PR420">[licm] LICM invalidates alias
analysis info and uses broken information</a> (optimizer crash)</li>
<li><a href="http://llvm.cs.uiuc.edu/PR422">[asmwriter] Asmwriter is really
slow for functions with lots of values</a></li>
<li><a href="http://llvm.cs.uiuc.edu/PR423">[anders-aa] Andersen's AA is
completely broken in LLVM 1.3</a></li>
<li><a href="http://llvm.cs.uiuc.edu/PR430">[bcwriter] Empty compaction
tables defined</a></li>
<li><a href="http://llvm.cs.uiuc.edu/PR227">[X86] llc output for functions
w/certain names tickles GNU 'as' bugs</a></li>
<li><a href="http://llvm.cs.uiuc.edu/PR472">[cbackend] Static globals are
prototyped as 'extern'</a></li>
<li><a href="http://llvm.cs.uiuc.edu/PR491">[dse] DSE deletes stores that
are partially overwritten by smaller stores</a></li>
<li><a href="http://llvm.cs.uiuc.edu/PR548">[instcombine] miscompilation of
setcc or setcc in one case</a></li>
<li>Transition code for LLVM 1.0 style varargs was removed from the .ll file
parser. LLVM 1.0 bytecode files are still supported. </li>
</ol>
<p>Code Generator Bugs:</p>
<ol>
<li><a href="http://llvm.cs.uiuc.edu/PR490">[cbackend] Logical constant
expressions (and/or/xor) not implemented</a>.</li>
<li><a href="http://llvm.cs.uiuc.edu/PR511">[cbackend] C backend does not
respect 'volatile'</a>.</li>
<li>The JIT sometimes miscompiled globals and constant pool entries for
64-bit integer constants on 32-bit hosts.</li>
<li>The C backend should no longer produce code that crashes ICC 8.1.</li>
</ol>
<p>Bugs in the C/C++ front-end:</p>
<ol>
<li><a href="http://llvm.cs.uiuc.edu/PR445">[llvmg++] not enough templates are
instantiated</a></li>
<li><a href="http://llvm.cs.uiuc.edu/PR450">[llvmg++] Extern const globals
cannot be marked 'constant' if they have nontrivial ctors or dtors</a></li>
<li><a href="http://llvm.cs.uiuc.edu/PR461">[llvmgcc] Crash compiling unnamed
bitfield which does not increase struct size</a></li>
<li><a href="http://llvm.cs.uiuc.edu/PR424">[llvmgcc] llvmgcc emits invalid
constant exprs</a></li>
<li><a href="http://llvm.cs.uiuc.edu/PR421">[llvmg++] Crash in initializing
array with constructors in hard EH situations</a></li>
<li><a href="http://llvm.cs.uiuc.edu/PR397">[llvm-gcc] Inline function
redefinitions error due to 'asm' function rename</a></li>
<li><a href="http://llvm.cs.uiuc.edu/PR244">[llvm-gcc] Error when an
implicitly external function is re-declared as static</a></li>
<li><a href="http://llvm.cs.uiuc.edu/PR360">[llvmgcc] Structure field with
non-constant offset crashes llvmgcc</a></li>
<li><a href="http://llvm.cs.uiuc.edu/PR447">[llvmg++] Crash compiling
friend with default argument</a></li>
</ol>
<p>Bugs fixed in the Sparc V9 back-end:</p>
<ol>
<li><a href="http://llvm.cs.uiuc.edu/PR428">[sparcv9] regalloc assertion
failure with certain indirect calls</a></li>
<li><a href="http://llvm.cs.uiuc.edu/PR487">[llvmgcc] llvm-gcc incorrectly
rejects some constant initializers involving the addresses of array
elements</a></li>
<li><a href="http://llvm.cs.uiuc.edu/PR501">[llvm-g++] Crash compiling
anonymous union</a></li>
<li><a href="http://llvm.cs.uiuc.edu/PR509">[llvm-g++] Do not use dynamic
initialization where static init will do</a></li>
<li><a href="http://llvm.cs.uiuc.edu/PR510">[llvmgcc] Field offset
miscalculated for some structure fields following bit fields</a></li>
<li><a href="http://llvm.cs.uiuc.edu/PR513">[llvm-g++] Temporary lifetimes
incorrect for short circuit logical operations</a></li>
<li><a href="http://llvm.cs.uiuc.edu/PR517">[llvm-gcc] Crash compiling
bitfield &lt;-&gt; aggregate assignment</a></li>
<li><a href="http://llvm.cs.uiuc.edu/PR520">[llvm-g++] Error compiling
virtual function thunk with an unnamed argument</a></li>
<li><a href="http://llvm.cs.uiuc.edu/PR522">[llvm-gcc] Crash on certain
C99 complex number routines</a></li>
<li><a href="http://llvm.cs.uiuc.edu/PR529">[llvm-g++] Crash using placement
new on an array type</a></li>
</ol>
</div>
@@ -298,14 +350,17 @@ were fixed:</a>
<div class="doc_text">
<p>LLVM is known to work in the following platforms:</p>
<p>LLVM is known to work on the following platforms:</p>
<ul>
<li>Intel and AMD machines running Red Hat Linux and FreeBSD (and probably
other unix-like systems).</li>
<li>Intel and AMD machines running Red Hat Linux, Fedora Core and FreeBSD
(and probably other unix-like systems).</li>
<li>Sun UltraSPARC workstations running Solaris 8.</li>
<li>Intel and AMD machines running on Win32 with the Cygwin libraries.</li>
<li>PowerPC-based Mac OS X boxes, running 10.2 and above.</li>
<li>Intel and AMD machines running on Win32 with the Cygwin libraries (limited
support is available for native builds with Visual C++).</li>
<li>PowerPC-based Mac OS X systems, running 10.2 and above.</li>
<li>Alpha-based machines running Debian GNU/Linux.</li>
<li>Itanium-based machines running Linux and HP-UX.</li>
</ul>
<p>The core LLVM infrastructure uses
@@ -314,15 +369,6 @@ to the machine and operating system on which it is built. However, minor
porting may be required to get LLVM to work on new platforms. We welcome your
portability patches and reports of successful builds or error messages.</p>
<p>Note that the LLVM build system does not currently support directories with
spaces on them when running on Win32/cygwin. We strongly recommend running
LLVM and the C frontend out of a top-level directory without spaces (e.g.,
<tt>/cygdrive/c/llvm</tt>). Also, make sure to install <b>all</b> of the
cygwin packages. By default, many important tools are not installed that
are needed by the LLVM build process or test suite (e.g., /bin/time). Finally,
please make sure that there are no directories with spaces in them in your
PATH environment variable.</p>
</div>
<!-- *********************************************************************** -->
@@ -355,13 +401,13 @@ useful to some people. In particular, if you would like to work on one of these
components, please contact us on the llvmdev list.</p>
<ul>
<li>The following passes are incomplete or buggy: <tt>-pgmdep, -memdep,
-ipmodref, -cee, -branch-combine, -instloops, -paths</tt></li>
<li>The <tt>-pre</tt> pass is incomplete (there are cases it doesn't handle that
it should) and not thoroughly tested.</li>
<li>The <tt>llvm-db</tt> tool is in a very early stage of development.</li>
<li>The "iterative scan" register allocator (enabled with -regalloc=iterativescan)
is not stable.</li>
<li>The following passes are incomplete or buggy, and may be removed in future
releases: <tt>-cee, -branch-combine, -instloops, -paths, -pre</tt></li>
<li>The <tt>llvm-db</tt> tool is in a very early stage of development, but can
be used to step through programs and inspect the stack.</li>
<li>The "iterative scan" register allocator (enabled with
<tt>-regalloc=iterativescan</tt>) is not stable.</li>
<li>The SparcV8, Alpha, and IA64 code generators are experimental.</li>
</ul>
</div>
@@ -374,28 +420,16 @@ components, please contact us on the llvmdev list.</p>
<div class="doc_text">
<ul>
<li>In the JIT, <tt>dlsym</tt> on a symbol compiled by the JIT will not work.
</li>
<li>In the JIT, <tt>dlsym()</tt> on a symbol compiled by the JIT will not
work.</li>
<li>The JIT does not use mutexes to protect its internal data structures. As
such, execution of a threaded program could cause these data structures to be
corrupted.
</li>
<li>Linking in static archive files (.a files) is slow by default because
there is no symbol table in the archive. To remedy this, run
<a href="CommandGuide/html/llvm-ranlib.html"><tt>llvm-ranlib</tt></a> on the
archive to add an LLVM symbol table.
</li>
<li>The gccld program <a href="http://llvm.cs.uiuc.edu/PR139">does not link
objects/archives in the order specified on the command line.</a>
</li>
<li><a href="http://llvm.cs.uiuc.edu/PR240">The lower-invoke pass does not
mark values live across a setjmp as volatile</a>. This missing feature
only affects targets whose setjmp/longjmp libraries do not save and restore
the entire register file.</li>
<li><a href="http://llvm.cs.uiuc.edu/PR427">[bytecode] Assertion on V1
Bytecode Files</a>. This bug won't be fixed because V1 bytecode had its own
problems, no one is using V1 bytecode any more, and the fix is non-trivial.
</li>
</ul>
</div>
@@ -421,9 +455,6 @@ components, please contact us on the llvmdev list.</p>
<li>Initialization of global union variables can only be done <a
href="http://llvm.cs.uiuc.edu/PR162">with the largest union member</a>.</li>
<li><a href="http://llvm.cs.uiuc.edu/PR244">[llvm-gcc] Error when an implicitly
external function is re-declared as static</a></li>
</ul>
</div>
@@ -464,7 +495,7 @@ work:
<li><a href="http://gcc.gnu.org/onlinedocs/gcc/Explicit-Reg-Vars.html#Explicit%20Reg%20Vars">Explicit Reg Vars</a>: Defining variables residing in specified registers.</li>
<li><a href="http://gcc.gnu.org/onlinedocs/gcc/Vector-Extensions.html#Vector%20Extensions">Vector Extensions</a>: Using vector instructions through built-in functions.</li>
<li><a href="http://gcc.gnu.org/onlinedocs/gcc/Target-Builtins.html#Target%20Builtins">Target Builtins</a>: Built-in functions specific to particular targets.</li>
<li><a href="http://gcc.gnu.org/onlinedocs/gcc/Thread-Local.html#Thread-Local">Thread-Local</a>: Per-thread variables.</li>
<li><a href="http://gcc.gnu.org/onlinedocs/gcc/Thread_002dLocal.html">Thread-Local</a>: Per-thread variables.</li>
<li><a href="http://gcc.gnu.org/onlinedocs/gcc/Pragmas.html#Pragmas">Pragmas</a>: Pragmas accepted by GCC.</li>
</ol>
@@ -485,10 +516,11 @@ work:
return.<br>
<b>Supported:</b> <tt>format</tt>, <tt>format_arg</tt>, <tt>non_null</tt>,
<tt>constructor</tt>, <tt>destructor</tt>, <tt>unused</tt>,
<tt>noreturn</tt>, <tt>constructor</tt>, <tt>destructor</tt>,
<tt>unused</tt>,
<tt>deprecated</tt>, <tt>warn_unused_result</tt>, <tt>weak</tt><br>
<b>Ignored:</b> <tt>noreturn</tt>, <tt>noinline</tt>,
<b>Ignored:</b> <tt>noinline</tt>,
<tt>always_inline</tt>, <tt>pure</tt>, <tt>const</tt>, <tt>nothrow</tt>,
<tt>malloc</tt>, <tt>no_instrument_function</tt>, <tt>cdecl</tt><br>
@@ -521,7 +553,9 @@ work:
<tt>__builtin_types_compatible_p</tt>, <tt>__builtin_choose_expr</tt>,
<tt>__builtin_constant_p</tt>, and <tt>__builtin_expect</tt>
(currently ignored). We also support builtins for ISO C99 floating
point comparison macros (e.g., <tt>__builtin_islessequal</tt>).</li>
point comparison macros (e.g., <tt>__builtin_islessequal</tt>),
<tt>__builtin_prefetch</tt>, <tt>__builtin_popcount[ll]</tt>,
<tt>__builtin_clz[ll]</tt>, and <tt>__builtin_ctz[ll]</tt>.</li>
</ol>
<p>The following extensions <b>are</b> known to be supported:</p>
@@ -549,7 +583,7 @@ or arrays as values.</li>
<li><a href="http://gcc.gnu.org/onlinedocs/gcc/Case-Ranges.html#Case%20Ranges">Case Ranges</a>: `case 1 ... 9' and such.</li>
<li><a href="http://gcc.gnu.org/onlinedocs/gcc/Mixed-Declarations.html#Mixed%20Declarations">Mixed Declarations</a>: Mixing declarations and code.</li>
<li><a href="http://gcc.gnu.org/onlinedocs/gcc/Function-Prototypes.html#Function%20Prototypes">Function Prototypes</a>: Prototype declarations and old-style definitions.</li>
<li><a href="http://gcc.gnu.org/onlinedocs/gcc/C---Comments.html#C++%20Comments">C++ Comments</a>: C++ comments are recognized.</li>
<li><a href="http://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Comments.html#C_002b_002b-Comments">C++ Comments</a>: C++ comments are recognized.</li>
<li><a href="http://gcc.gnu.org/onlinedocs/gcc/Dollar-Signs.html#Dollar%20Signs">Dollar Signs</a>: Dollar sign is allowed in identifiers.</li>
<li><a href="http://gcc.gnu.org/onlinedocs/gcc/Character-Escapes.html#Character%20Escapes">Character Escapes</a>: <code>\e</code> stands for the character &lt;ESC&gt;.</li>
<li><a href="http://gcc.gnu.org/onlinedocs/gcc/Alignment.html#Alignment">Alignment</a>: Inquiring about the alignment of a type or variable.</li>
@@ -576,10 +610,9 @@ lists, please let us know (also including whether or not they work).</p>
<div class="doc_text">
<p>For this release, the C++ front-end is considered to be fully functional but
has not been tested as thoroughly as the C front-end. It has been tested and
works for a number of non-trivial programs, but there may be lurking bugs.
Please report any bugs or problems.</p>
<p>For this release, the C++ front-end is considered to be fully
tested and works for a number of non-trivial programs, including LLVM
itself.</p>
</div>
@@ -592,12 +625,6 @@ Please report any bugs or problems.</p>
<li>The C++ front-end inherits all problems afflicting the <a href="#c-fe">C
front-end</a>.</li>
<li><b>IA-64 specific</b>: The C++ front-end does not use <a
href="http://llvm.cs.uiuc.edu/PR406">IA64 ABI compliant layout of v-tables</a>.
In particular, it just stores function pointers instead of function
descriptors in the vtable. This bug prevents mixing C++ code compiled with
LLVM with C++ objects compiled by other C++ compilers.</li>
</ul>
</div>
@@ -637,6 +664,28 @@ href="http://gcc.gnu.org/gcc-3.4/changes.html">GCC 3.4 release notes</a>.</li>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="c-be">Known problems with the C back-end</a>
</div>
<div class="doc_text">
<ul>
<li>The C back-end produces code that violates the ANSI C Type-Based Alias
Analysis rules. As such, special options may be necessary to compile the code
(for example, GCC requires the <tt>-fno-strict-aliasing</tt> option). This
problem probably cannot be fixed.</li>
<li><a href="http://llvm.cs.uiuc.edu/PR56">Zero arg vararg functions are not
supported</a>. This should not affect LLVM produced by the C or C++
frontends.</li>
</ul>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="x86-be">Known problems with the X86 back-end</a>
@@ -645,7 +694,20 @@ href="http://gcc.gnu.org/gcc-3.4/changes.html">GCC 3.4 release notes</a>.</li>
<div class="doc_text">
<ul>
<li>none yet</li>
<li><a href="http://llvm.cs.uiuc.edu/PR566">Memory Mapped I/O Intrinsics do not fence memory</a></li>
</ul>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="ppc-be">Known problems with the PowerPC back-end</a>
</div>
<div class="doc_text">
<ul>
<li>None yet</li>
</ul>
</div>
@@ -666,39 +728,67 @@ several programs in the LLVM test suite</a></li>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="ppc-be">Known problems with the PowerPC back-end</a>
<a name="alpha-be">Known problems with the Alpha back-end</a>
</div>
<div class="doc_text">
<ul>
<li>none yet</li>
<li>On 21164s, some rare FP arithmetic sequences which may trap do not have the
appropriate nops inserted to ensure restartability.</li>
<li>Defining vararg functions is not supported (but calling them is ok).</li>
<li>Due to the vararg problems, C++ exceptions do not work. Small changes are required to the CFE (which break correctness in the exception handler) to compile the exception handling library (and thus the C++ standard library).</li>
</ul>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="c-be">Known problems with the C back-end</a>
<a name="ia64-be">Known problems with the IA64 back-end</a>
</div>
<div class="doc_text">
<ul>
<li>The C back-end produces code that violates the ANSI C Type-Based Alias
Analysis rules. As such, special options may be necessary to compile the code
(for example, GCC requires the <tt>-fno-strict-aliasing</tt> option). This
problem probably cannot be fixed.</li>
<li>C++ programs are likely to fail on IA64, as calls to <tt>setjmp</tt> are
made where the argument is not 16-byte aligned, as required on IA64. (Strictly
speaking this is not a bug in the IA64 back-end; it will also be encountered
when building C++ programs using the C back-end.)</li>
<li><a href="http://llvm.cs.uiuc.edu/PR33">Initializers for global variables</a>
cannot include special floating point numbers like Not-A-Number or
Infinity.</li>
<li>The C++ front-end does not use <a href="http://llvm.cs.uiuc.edu/PR406">IA64
ABI compliant layout of v-tables</a>. In particular, it just stores function
pointers instead of function descriptors in the vtable. This bug prevents
mixing C++ code compiled with LLVM with C++ objects compiled by other C++
compilers.</li>
<li><a href="http://llvm.cs.uiuc.edu/PR56">Zero arg vararg functions are not
supported</a>. This should not affect LLVM produced by the C or C++
frontends.</li>
<li>There are a few ABI violations which will lead to problems when mixing LLVM
output with code built with other compilers, particularly for floating-point
programs.</li>
<li>Defining vararg functions is not supported (but calling them is ok).</li>
</ul>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="sparcv8">Known problems with the SPARC-V8 back-end</a>
</div>
<div class="doc_text">
<ul>
<li>Many features are still missing (e.g. support for 64-bit integer
arithmetic).</li>
<li>This backend needs to be updated to use the SelectionDAG instruction
selection framework.</li>
</ul>
</div>
@@ -711,15 +801,17 @@ frontends.</li>
<div class="doc_text">
<p>A wide variety of additional information is available on the LLVM web page,
including mailing lists and publications describing algorithms and components
implemented in LLVM. The web page also contains versions of the API
documentation which is up-to-date with the CVS version of the source code. You
can access versions of these documents specific to this release by going into
the "<tt>llvm/doc/</tt>" directory in the LLVM tree.</p>
<p>A wide variety of additional information is available on the <a
href="http://llvm.cs.uiuc.edu">LLVM web page</a>, including <a
href="http://llvm.cs.uiuc.edu/docs/">documentation</a> and <a
href="http://llvm.cs.uiuc.edu/pubs/">publications describing algorithms and
components implemented in LLVM</a>. The web page also contains versions of the
API documentation which is up-to-date with the CVS version of the source code.
You can access versions of these documents specific to this release by going
into the "<tt>llvm/doc/</tt>" directory in the LLVM tree.</p>
<p>If you have any questions or comments about LLVM, please feel free to contact
us via the <a href="http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev">mailing
us via the <a href="http://llvm.cs.uiuc.edu/docs/#maillist"> mailing
lists</a>.</p>
</div>

View File

@@ -72,8 +72,8 @@ height="369">
<!-- *********************************************************************** -->
<div class="doc_section"><a name="introduction">Introduction</a></div> <!--
*********************************************************************** -->
<div class="doc_section"><a name="introduction">Introduction</a></div>
<!-- *********************************************************************** -->
<div class="doc_text">
@@ -1028,6 +1028,7 @@ change in the future.</p>
<div class="doc_section">
<a name="ccxx_frontend">C/C++ front-end specific debug information</a>
</div>
<!-- *********************************************************************** -->
<div class="doc_text">

View File

@@ -787,7 +787,7 @@ using the following construction:</p>
</tr>
<tr><td>RROT</td>
<td>RROT</td>
<td>w1 w2 w3 -- w2 w3 w1</td>
<td>w1 w2 w3 -- w3 w1 w2</td>
<td>Reverse rotation. Like ROT, but it rotates the other way around.
Essentially, the third element on the stack is moved to the top
of the stack.</td>
@@ -946,24 +946,28 @@ using the following construction:</p>
executed. In either case, after the (words....) have executed, execution continues
immediately following the ENDIF. </td>
</tr>
<tr><td>WHILE (words...) END</td>
<td>WHILE (words...) END</td>
<tr><td>WHILE word END</td>
<td>WHILE word END</td>
<td>b -- b </td>
<td>The boolean value on the top of the stack is examined. If it is non-zero then the
"words..." between WHILE and END are executed. Execution then begins again at the WHILE where another
boolean is popped off the stack. To prevent this operation from eating up the entire
stack, you should push on to the stack (just before the END) a boolean value that indicates
whether to terminate. Note that since booleans and integers can be coerced you can
use the following "for loop" idiom:<br/>
<code>(push count) WHILE (words...) -- END</code><br/>
<td>The boolean value on the top of the stack is examined (not popped). If
it is non-zero then the "word" between WHILE and END is executed.
Execution then begins again at the WHILE where the boolean on the top of
the stack is examined again. The stack is not modified by the WHILE...END
loop, only examined. It is imperative that the "word" in the body of the
loop ensure that the top of the stack contains the next boolean to examine
when it completes. Note that since booleans and integers can be coerced
you can use the following "for loop" idiom:<br/>
<code>(push count) WHILE word -- END</code><br/>
For example:<br/>
<code>10 WHILE DUP &gt;d -- END</code><br/>
This will print the numbers from 10 down to 1. 10 is pushed on the stack. Since that is
non-zero, the while loop is entered. The top of the stack (10) is duplicated and then
printed out with &gt;d. The top of the stack is decremented, yielding 9 and control is
transfered back to the WHILE keyword. The process starts all over again and repeats until
the top of stack is decremented to 0 at which the WHILE test fails and control is
transfered to the word after the END.</td>
<code>10 WHILE &gt;d -- END</code><br/>
This will print the numbers from 10 down to 1. 10 is pushed on the
stack. Since that is non-zero, the while loop is entered. The top of
the stack (10) is printed out with &gt;d. The top of the stack is
decremented, yielding 9 and control is transfered back to the WHILE
keyword. The process starts all over again and repeats until
the top of stack is decremented to 0 at which point the WHILE test
fails and control is transfered to the word after the END.
</td>
</tr>
<tr><th colspan="4"><b>INPUT &amp; OUTPUT OPERATORS</b></th></tr>
<tr>

View File

@@ -8,39 +8,26 @@
<body>
<div class="doc_title">System Library</div>
<div class="doc_warning">
<p>Warning: This document is a work in progress.</p>
</div>
<ul>
<li><a href="#abstract">Abstract</a></li>
<li><a href="#requirements">System Library Requirements</a>
<li><a href="#requirements">Keeping LLVM Portable</a>
<ol>
<li><a href="#headers">Hide System Header Files</a></li>
<li><a href="#headers">Don't Include System Headers</a></li>
<li><a href="#expose">Don't Expose System Headers</a></li>
<li><a href="#c_headers">Allow Standard C Header Files</a></li>
<li><a href="#cpp_headers">Allow Standard C++ Header Files</a></li>
<li><a href="#highlev">High-Level Interface</a></li>
<li><a href="#nofunc">No Exposed Functions</a></li>
<li><a href="#nodata">No Exposed Data</a></li>
<li><a href="#nodupl">No Duplicate Implementations</a></li>
<li><a href="#nounused">No Unused Functionality</a></li>
<li><a href="#virtuals">No Virtual Methods</a></li>
<li><a href="#softerrors">Minimize Soft Errors</a></li>
<li><a href="#throw">Throw Only std::string</a></li>
<li><a href="#throw_spec">No throw() Specifications</a></li>
<li><a href="#nodupl">No Duplicate Implementations</a></li>
</ol></li>
<li><a href="#design">System Library Design</a>
<ol>
<li><a href="#nounused">No Unused Functionality</a></li>
<li><a href="#highlev">High-Level Interface</a></li>
<li><a href="#opaque">Use Opaque Classes</a></li>
<li><a href="#common">Common Implementations</a></li>
<li><a href="#multi_imps">Multiple Implementations</a></li>
<li><a href="#lowlevel">Use Low Level Interfaces</a></li>
<li><a href="#memalloc">No Memory Allocation</a></li>
<li><a href="#virtuals">No Virtual Methods</a></li>
</ol></li>
<li><a href="#detail">System Library Details</a>
<ol>
<li><a href="#organization">Code Organization</a></li>
<li><a href="#semantics">Consistent Semantics</a></li>
<li><a href="#bug">Tracking Bugzilla Bug: 351</a></li>
<li><a href="#refimpl">Reference Implementation</a></li>
</ol></li>
</ul>
@@ -52,68 +39,140 @@
<!-- *********************************************************************** -->
<div class="doc_section"><a name="abstract">Abstract</a></div>
<div class="doc_text">
<p>This document describes the requirements, design, and implementation
details of LLVM's System Library. The library is composed of the header files
in <tt>llvm/include/llvm/System</tt> and the source files in
<tt>llvm/lib/System</tt>. The goal of this library is to completely shield
LLVM from the variations in operating system interfaces. By centralizing
LLVM's use of operating system interfaces, we make it possible for the LLVM
tool chain and runtime libraries to be more easily ported to new platforms
since (theoretically) only <tt>llvm/lib/System</tt> needs to be ported. This
library also unclutters the rest of LLVM from #ifdef use and special
cases for specific operating systems. Such uses are replaced with simple calls
to the interfaces provided in <tt>llvm/include/llvm/System</tt>.</p> Note that
lib/System is not intended to be a complete operating system wrapper (such as
the Adaptive Communications Environment (ACE) or Apache Portable Runtime
(APR)), but only to provide the functionality necessary to support LLVM.
<p>This document provides some details on LLVM's System Library, located in
the source at <tt>lib/System</tt> and <tt>include/llvm/System</tt>. The
library's purpose is to shield LLVM from the differences between operating
systems for the few services LLVM needs from the operating system. Much of
LLVM is written using portability features of standard C++. However, in a few
areas, system dependent facilities are needed and the System Library is the
wrapper around those system calls.</p>
<p>By centralizing LLVM's use of operating system interfaces, we make it
possible for the LLVM tool chain and runtime libraries to be more easily
ported to new platforms since (theoretically) only <tt>lib/System</tt> needs
to be ported. This library also unclutters the rest of LLVM from #ifdef use
and special cases for specific operating systems. Such uses are replaced
with simple calls to the interfaces provided in <tt>include/llvm/System</tt>.
</p>
<p>Note that the System Library is not intended to be a complete operating
system wrapper (such as the Adaptive Communications Environment (ACE) or
Apache Portable Runtime (APR)), but only provides the functionality necessary
to support LLVM.
<p>The System Library was written by Reid Spencer who formulated the
design based on similar original work as part of the eXtensible Programming
System (XPS).</p>
design based on similar work originating from the eXtensible Programming
System (XPS). Several people helped with the effort; especially,
Jeff Cohen and Henrik Bach on the Win32 port.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="requirements">System Library Requirements</a>
<a name="requirements">Keeping LLVM Portable</a>
</div>
<div class="doc_text">
<p>The System library's requirements are aimed at shielding LLVM from the
variations in operating system interfaces. The following sections define the
requirements needed to fulfill this objective. Of necessity, these requirements
must be strictly followed in order to ensure the library's goal is reached.</p>
<p>In order to keep LLVM portable, LLVM developers should adhere to a set of
portability rules associated with the System Library. Adherence to these rules
should help the System Library achieve its goal of shielding LLVM from the
variations in operating system interfaces and doing so efficiently. The
following sections define the rules needed to fulfill this objective.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="headers">Hide System Header Files</a></div>
<div class="doc_subsection"><a name="headers">Don't Inlcude System Headers</a>
</div>
<div class="doc_text">
<p>The library must shield LLVM from <em>all</em> system libraries. To obtain
system level functionality, LLVM must <tt>#include "llvm/System/Thing.h"</tt>
and nothing else. This means that <tt>Thing.h</tt> cannot expose any system
header files. This protects LLVM from accidentally using system specific
functionality except through the lib/System interface. Specifically this
means that header files like "unistd.h", "windows.h", "stdio.h", and
"string.h" are verbotten outside the implementation of lib/System.
<p>Except in <tt>lib/System</tt>, no LLVM source code should directly
<tt>#include</tt> a system header. Care has been taken to remove all such
<tt>#includes</tt> from LLVM while <tt>lib/System</tt> was being
developed. Specifically this means that header files like "unistd.h",
"windows.h", "stdio.h", and "string.h" are forbidden to be included by LLVM
source code outside the implementation of <tt>lib/System</tt>.</p>
<p>To obtain system-dependent functionality, existing interfaces to the system
found in <tt>include/llvm/System</tt> should be used. If an appropriate
interface is not available, it should be added to <tt>include/llvm/System</tt>
and implemented in <tt>lib/System</tt> for all supported platforms.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="expose">Don't Expose System Headers</a>
</div>
<div class="doc_text">
<p>The System Library must shield LLVM from <em>all</em> system headers. To
obtain system level functionality, LLVM source must
<tt>#include "llvm/System/Thing.h"</tt> and nothing else. This means that
<tt>Thing.h</tt> cannot expose any system header files. This protects LLVM
from accidentally using system specific functionality and only allows it
via the <tt>lib/System</tt> interface.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="c_headers">Use Standard C Headers</a></div>
<div class="doc_text">
<p>The <em>standard</em> C headers (the ones beginning with "c") are allowed
to be exposed through the <tt>lib/System</tt> interface. These headers and
the things they declare are considered to be platform agnostic. LLVM source
files may include them directly or obtain their inclusion through
<tt>lib/System</tt> interfaces.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="cpp_headers">Use Standard C++ Headers</a>
</div>
<div class="doc_text">
<p>The <em>standard</em> C++ headers from the standard C++ library and
standard template library may be exposed through the <tt>lib/System</tt>
interface. These headers and the things they declare are considered to be
platform agnostic. LLVM source files may include them or obtain their
inclusion through lib/System interfaces.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="highlev">High Level Interface</a></div>
<div class="doc_text">
<p>The entry points specified in the interface of lib/System must be aimed at
completing some reasonably high level task needed by LLVM. We do not want to
simply wrap each operating system call. It would be preferable to wrap several
operating system calls that are always used in conjunction with one another by
LLVM.</p>
<p>For example, consider what is needed to execute a program, wait for it to
complete, and return its result code. On Unix, this involves the following
operating system calls: <tt>getenv, fork, execve,</tt> and <tt>wait</tt>. The
correct thing for lib/System to provide is a function, say
<tt>ExecuteProgramAndWait</tt>, that implements the functionality completely.
what we don't want is wrappers for the operating system calls involved.</p>
<p>There must <em>not</em> be a one-to-one relationship between operating
system calls and the System library's interface. Any such interface function
will be suspicious.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="nounused">No Unused Functionality</a></div>
<div class="doc_text">
<p>There must be no functionality specified in the interface of lib/System
that isn't actually used by LLVM. We're not writing a general purpose
operating system wrapper here, just enough to satisfy LLVM's needs. And, LLVM
doesn't need much. This design goal aims to keep the lib/System interface
small and understandable which should foster its actual use and adoption.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="nodupl">No Duplicate Implementations</a>
</div>
<div class="doc_text">
<p>The implementation of a function for a given platform must be written
exactly once. This implies that it must be possible to apply a function's
implementation to multiple operating systems if those operating systems can
share the same implementation. This rule applies to the set of operating
systems supported for a given class of operating system (e.g. Unix, Win32).
</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="c_headers">Allow Standard C Headers</a>
</div>
<div class="doc_subsection"><a name="virtuals">No Virtual Methods</a></div>
<div class="doc_text">
<p>The <em>standard</em> C headers (the ones beginning with "c") are allowed
to be exposed through the lib/System interface. These headers and the things
they declare are considered to be platform agnostic. LLVM source files may
include them or obtain their inclusion through lib/System interfaces.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="cpp_headers">Allow Standard C++ Headers</a>
</div>
<div class="doc_text">
<p>The <em>standard</em> C++ headers from the standard C++ library and
standard template library are allowed to be exposed through the lib/System
interface. These headers and the things they declare are considered to be
platform agnostic. LLVM source files may include them or obtain their
inclusion through lib/System interfaces.</p>
<p>The System Library interfaces can be called quite frequently by LLVM. In
order to make those calls as efficient as possible, we discourage the use of
virtual methods. There is no need to use inheritance for implementation
differences, it just adds complexity. The <tt>#include</tt> mechanism works
just fine.</p>
</div>
<!-- ======================================================================= -->
@@ -124,11 +183,12 @@
for that function is not exposed. This prevents inadvertent use of system
specific functionality.</p>
<p>For example, the <tt>stat</tt> system call is notorious for having
variations in the data it provides. lib/System must not declare <tt>stat</tt>
nor allow it to be declared. Instead it should provide its own interface to
discovering information about files and directories. Those interfaces may be
implemented in terms of <tt>stat</tt> but that is strictly an implementation
detail.</p>
variations in the data it provides. <tt>lib/System</tt> must not declare
<tt>stat</tt> nor allow it to be declared. Instead it should provide its own
interface to discovering information about files and directories. Those
interfaces may be implemented in terms of <tt>stat</tt> but that is strictly
an implementation detail. The interface provided by the System Library must
be implemented on all platforms (even those without <tt>stat</tt>).</p>
</div>
<!-- ======================================================================= -->
@@ -140,6 +200,45 @@
of data that might not exist on all platforms.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="softerrors">Minimize Soft Errors</a></div>
<div class="doc_text">
<p>Operating system interfaces will generally provide error results for every
little thing that could go wrong. In almost all cases, you can divide these
error results into two groups: normal/good/soft and abnormal/bad/hard. That
is, some of the errors are simply information like "file not found",
"insufficient privileges", etc. while other errors are much harder like
"out of space", "bad disk sector", or "system call interrupted". We'll call
the first group "<i>soft</i>" errors and the second group "<i>hard</i>"
errors.<p>
<p>lib/System must always attempt to minimize soft errors and always just
throw a std::string on hard errors. This is a design requirement because the
minimization of soft errors can affect the granularity and the nature of the
interface. In general, if you find that you're wanting to throw soft errors,
you must review the granularity of the interface because it is likely you're
trying to implement something that is too low level. The rule of thumb is to
provide interface functions that <em>can't</em> fail, except when faced with
hard errors.</p>
<p>For a trivial example, suppose we wanted to add an "OpenFileForWriting"
function. For many operating systems, if the file doesn't exist, attempting
to open the file will produce an error. However, lib/System should not
simply throw that error if it occurs because its a soft error. The problem
is that the interface function, OpenFileForWriting is too low level. It should
be OpenOrCreateFileForWriting. In the case of the soft "doesn't exist" error,
this function would just create it and then open it for writing.</p>
<p>This design principle needs to be maintained in lib/System because it
avoids the propagation of soft error handling throughout the rest of LLVM.
Hard errors will generally just cause a termination for an LLVM tool so don't
be bashful about throwing them.</p>
<p>Rules of thumb:</p>
<ol>
<li>Don't throw soft errors, only hard errors.</li>
<li>If you're tempted to throw a soft error, re-think the interface.</li>
<li>Handle internally the most common normal/good/soft error conditions
so the rest of LLVM doesn't have to.</li>
</ol>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="throw">Throw Only std::string</a></div>
<div class="doc_text">
@@ -173,191 +272,52 @@
<tt>throw()</tt> specifications on them. This requirement makes sure that the
compiler does not insert additional exception handling code into the interface
functions. This is a performance consideration: lib/System functions are at
the bottom of the many call chains and as such can be frequently called. We
the bottom of many call chains and as such can be frequently called. We
need them to be as efficient as possible.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="nodupl">No Duplicate Implementations</a>
</div>
<div class="doc_subsection"><a name="organization">Code Organization</a></div>
<div class="doc_text">
<p>The implementation of a function for a given platform must be written
exactly once. This implies that it must be possible to apply a function's
implementation to multiple operating systems if those operating systems can
share the same implementation.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="design">System Library Design</a></div>
<div class="doc_text">
<p>In order to fulfill the requirements of the system library, strict design
objectives must be maintained in the library as it evolves. The goal here
is to provide interfaces to operating system concepts (files, memory maps,
sockets, signals, locking, etc) efficiently and in such a way that the
remainder of LLVM is completely operating system agnostic.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="nounused">No Unused Functionality</a></div>
<div class="doc_text">
<p>There must be no functionality specified in the interface of lib/System
that isn't actually used by LLVM. We're not writing a general purpose
operating system wrapper here, just enough to satisfy LLVM's needs. And, LLVM
doesn't need much. This design goal aims to keep the lib/System interface
small and understandable which should foster its actual use and adoption.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="highlev">High Level Interface</a></div>
<div class="doc_text">
<p>The entry points specified in the interface of lib/System must be aimed at
completing some reasonably high level task needed by LLVM. We do not want to
simply wrap each operating system call. It would be preferable to wrap several
operating system calls that are always used in conjunction with one another by
LLVM.</p>
<p>For example, consider what is needed to execute a program, wait for it to
complete, and return its result code. On Unix, this involves the following
operating system calls: <tt>getenv, fork, execve,</tt> and <tt>wait</tt>. The
correct thing for lib/System to provide is a function, say
<tt>ExecuteProgramAndWait</tt>, that implements the functionality completely.
what we don't want is wrappers for the operating system calls involved.</p>
<p>There must <em>not</em> be a one-to-one relationship between operating
system calls and the System library's interface. Any such interface function
will be suspicious.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="highlev">Minimize Soft Errors</a></div>
<div class="doc_text">
<p>Operating system interfaces will generally provide errors results for every
little thing that could go wrong. In almost all cases, you can divide these
error results into two groups: normal/good/soft and abnormal/bad/hard. That
is, some of the errors are simply information like "file not found",
"insufficient privileges", etc. while other errors are much harder like
"out of space", "bad disk sector", or "system call interrupted". Well call the
first group "soft" errors and the second group "hard" errors.<p>
<p>lib/System must always attempt to minimize soft errors and always just
throw a std::string on hard errors. This is a design requirement because the
minimization of soft errors can affect the granularity and the nature of the
interface. In general, if you find that you're wanting to throw soft errors,
you must review the granularity of the interface because it is likely you're
trying to implement something that is too low level. The rule of thumb is to
provide interface functions that "can't" fail, except when faced with hard
errors.</p>
<p>For a trivial example, suppose we wanted to add an "OpenFileForWriting"
function. For many operating systems, if the file doesn't exist, attempting
to open the file will produce an error. However, lib/System should not
simply throw that error if it occurs because its a soft error. The problem
is that the interface function, OpenFileForWriting is too low level. It should
be OpenOrCreateFileForWriting. In the case of the soft "doesn't exist" error,
this function would just create it and then open it for writing.</p>
<p>This design principle needs to be maintained in lib/System because it
avoids the propagation of soft error handling throughout the rest of LLVM.
Hard errors will generally just cause a termination for an LLVM tool so don't
be bashful about throwing them.</p>
<p>Rules of thumb:</p>
<ol>
<li>Don't throw soft errors, only hard errors.</li>
<li>If you're tempted to throw a soft error, re-think the interface.</li>
<li>Handle internally the most common normal/good/soft error conditions
so the rest of LLVM doesn't have to.</li>
</ol>
<p>Implementations of the System Library interface are separated by their
general class of operating system. Currently only Unix and Win32 classes are
defined but more could be added for other operating system classifications.
To distinguish which implementation to compile, the code in lib/System uses
the LLVM_ON_UNIX and LLVM_ON_WIN32 #defines provided via configure through the
llvm/Config/config.h file. Each source file in lib/System, after implementing
the generic (operating system independent) functionality needs to include the
correct implementation using a set of <tt>#if defined(LLVM_ON_XYZ)</tt>
directives. For example, if we had lib/System/File.cpp, we'd expect to see in
that file:</p>
<pre><tt>
Notes:
10. The implementation of a lib/System interface can vary drastically between
platforms. That's okay as long as the end result of the interface function is
the same. For example, a function to create a directory is pretty straight
#if defined(LLVM_ON_UNIX)
#include "Unix/File.cpp"
#endif
#if defined(LLVM_ON_WIN32)
#include "Win32/File.cpp"
#endif
</tt></pre>
<p>The implementation in lib/System/Unix/File.cpp should handle all Unix
variants. The implementation in lib/System/Win32/File.cpp should handle all
Win32 variants. What this does is quickly differentiate the basic class of
operating system that will provide the implementation. The specific details
for a given platform must still be determined through the use of
<tt>#ifdef</tt>.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="semantics">Consistent Semantics</a></div>
<div class="doc_text">
<p>The implementation of a lib/System interface can vary drastically between
platforms. That's okay as long as the end result of the interface function
is the same. For example, a function to create a directory is pretty straight
forward on all operating system. System V IPC on the other hand isn't even
supported on all platforms. Instead of "supporting" System V IPC, lib/System
should provide an interface to the basic concept of inter-process
communications. The implementations might use System V IPC if that was
available or named pipes, or whatever gets the job done effectively for a
given operating system.
11. Implementations are separated first by the general class of operating system
as provided by the configure script's $build variable. This variable is used
to create a link from $BUILD_OBJ_ROOT/lib/System/platform to a directory in
$BUILD_SRC_ROOT/lib/System directory with the same name as the $build
variable. This provides a retargetable include mechanism. By using the link's
name (platform) we can actually include the operating specific
implementation. For example, support $build is "Darwin" for MacOS X. If we
place:
#include "platform/File.cpp"
into a a file in lib/System, it will actually include
lib/System/Darwin/File.cpp. What this does is quickly differentiate the basic
class of operating system that will provide the implementation.
12. Implementation files in lib/System need may only do two things: (1) define
functions and data that is *TRULY* generic (completely platform agnostic) and
(2) #include the platform specific implementation with:
#include "platform/Impl.cpp"
where Impl is the name of the implementation files.
13. Platform specific implementation files (platform/Impl.cpp) may only #include
other Impl.cpp files found in directories under lib/System. The order of
inclusion is very important (from most generic to most specific) so that we
don't inadvertently place an implementation in the wrong place. For example,
consider a fictitious implementation file named DoIt.cpp. Here's how the
#includes should work for a Linux platform
lib/System/DoIt.cpp
#include "platform/DoIt.cpp" // platform specific impl. of Doit
DoIt
lib/System/Linux/DoIt.cpp // impl that works on all Linux
#include "../Unix/DoIt.cpp" // generic Unix impl. of DoIt
#include "../Unix/SUS/DoIt.cpp // SUS specific impl. of DoIt
#include "../Unix/SUS/v3/DoIt.cpp // SUSv3 specific impl. of DoIt
Note that the #includes in lib/System/Linux/DoIt.cpp are all optional but
should be used where the implementation of some functionality can be shared
across some set of Unix variants. We don't want to duplicate code across
variants if their implementation could be shared.
</tt></pre>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="opaque">Use Opaque Classes</a></div>
<div class="doc_text">
<p>no public data</p>
<p>onlyprimitive typed private/protected data</p>
<p>data size is "right" for platform, not max of all platforms</p>
<p>each class corresponds to O/S concept</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="common">Common Implementations</a></div>
<div class="doc_text">
<p>To be written.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="multi_imps">Multiple Implementations</a>
</div>
<div class="doc_text">
<p>To be written.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="memalloc">No Memory Allocation</a></div>
<div class="doc_text">
<p>To be written.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="virtuals">No Virtual Methods</a></div>
<div class="doc_text">
<p>To be written.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="detail">System Library Details</a></div>
<div class="doc_text">
<p>To be written.</p>
given operating system. In all cases, the interface and the implementation
must be semantically consistent. </p>
</div>
<!-- ======================================================================= -->
@@ -367,130 +327,6 @@ Notes:
for further details on the progress of this work</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="bug">Rationale For #include Hierarchy</a>
</div>
<div class="doc_text">
<p>In order to provide different implementations of the lib/System interface
for different platforms, it is necessary for the library to "sense" which
operating system is being compiled for and conditionally compile only the
applicable parts of the library. While several operating system wrapper
libraries (e.g. APR, ACE) choose to use #ifdef preprocessor statements in
combination with autoconf variable (HAVE_* family), lib/System chooses an
alternate strategy. <p>
<p>To put it succinctly, the lib/System strategy has traded "#ifdef hell" for
"#include hell". That is, a given implementation file defines one or more
functions for a particular operating system variant. The functions defined in
that file have no #ifdef's to disambiguate the platform since the file is only
compiled on one kind of platform. While this leads to the same function being
implemented differently in different files, it is our contention that this
leads to better maintenance and easier portability.</p>
<p>For example, consider a function having different implementations on a
variety of platforms. Many wrapper libraries choose to deal with the different
implementations by using #ifdef, like this:</p>
<pre><tt>
void SomeFunction(void) {
#if defined __LINUX
// .. Linux implementation
#elif defined __WIN32
// .. Win32 implementation
#elif defined __SunOS
// .. SunOS implementation
#else
#warning "Don't know how to implement SomeFunction on this platform"
#endif
}
</tt></pre>
<p>The problem with this is that its very messy to read, especially as the
number of operating systems and their variants grow. The above example is
actually tame compared to what can happen when the implementation depends on
specific flavors and versions of the operating system. In that case you end up
with multiple levels of nested #if statements. This is what we mean by "#ifdef
hell".</p>
<p>To avoid the situation above, we've chosen to locate all functions for a
given implementation file for a specific operating system into one place. This
has the following advantages:<p>
<ul>
<li>No "#ifdef hell"</li>
<li>When porting, the strategy is quite straight forward: copy the
implementation file from a similar operating system to a new directory and
re-implement them.<li>
<li>Correctness is helped during porting because the new operating system's
implementation is wholly contained in a separate directory. There's no
chance to make an error in the #if statements and affect some other
operating system's implementation.</li>
</ul>
<p>So, given that we have decided to use #include instead of #if to provide
platform specific implementations, there are actually three ways we can go
about doing this. None of them are perfect, but we believe we've chosen the
lesser of the three evils. Given that there is a variable named $OS which
names the platform for which we must build, here's a summary of the three
approaches we could use to determine the correct directory:</p>
<ol>
<li>Provide the compiler with a -I$(OS) on the command line. This could be
provided in only the lib/System makefile.</li>
<li>Use autoconf to transform #include statements in the implementation
files by using substitutions of @OS@. For example, if we had a file,
File.cpp.in, that contained "#include &lt;@OS@/File.cpp&gt;" this would get
transformed to "#include &lt;actual/File.cpp&gt;" where "actual" is the
actual name of the operating system</li>
<li>Create a link from $OBJ_DIR/platform to $SRC_DIR/$OS. This allows us to
use a generic directory name to get the correct platform, as in #include
&lt;platform/File.cpp&gt;</li>
</ol>
<p>Let's look at the pitfalls of each approach.</p>
<p>In approach #1, we end up with some confusion as to what gets included.
Suppose we have lib/System/File.cpp that includes just File.cpp to get the
platform specific part of the implementation. In this case, the include
directive with the &lt;&gt; syntax will include the right file but the include
directive with the "" syntax will recursively include the same file,
lib/System/File.cpp. In the case of #include &lt;File.cpp&gt;, the -I options
to the compiler are searched first so it works. But in the #include "File.cpp"
case, the current directory is searched first. Furthermore, in both cases,
neither include directive documents which File.cpp is getting included.</p>
<p>In approach #2, we have the problem of needing to reconfigure repeatedly.
Developer's generally hate that and we don't want lib/System to be a thorn in
everyone's side because it will constantly need updating as operating systems
change and as new operating systems are added. The problem occurs when a new
implementation file is added to the library. First of all, you have to add a
file with the .in suffix, then you have to add that file name to the list of
configurable files in the autoconf/configure.ac file, then you have to run
AutoRegen.sh to rebuild the configure script, then you have to run the
configure script. This is deemed to be a pretty large hassle.</p>
<p>In approach #3, we have the problem that not all platforms support links.
Fortunately the autoconf macro used to create the link can compensate for
this. If a link can't be made, the configure script will copy the correct
directory from $BUILD_SRC_DIR to $BUILD_OBJ_DIR under the new name. The only
problem with this is that if a copy is made, the copy doesn't get updated if
the programmer adds or modifies files in the $BUILD_SRC_DIR. A reconfigure or
manual copying is needed to get things to compile.<p>
<p>The approach we have taken in lib/System is #3. Here's why:<p>
<ul>
<li>Approach #1 is rejected because it doesn't document what's actually
getting included and the potential for mistakes with alternate include
directive forms is high.</li>
<li>Approach #2 are both viable and only really impact development when new
files are added to the library.</li>
<li>However, approach #2 impacts every new file on every platform all the
time. With approach #3, only those platforms not supporting links will be
affected. The number of platforms not supporting links is very small and
they are generally archaic.</li>
<li>Given the above, approach #3 seems to have the least impact.</li>
</ul>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="refimpl">Reference Implementation</a>
</div>
<div class="doc_text">
<p>The <tt>linux</tt> implementation of the system library will always be the
reference implementation. This means that (a) the concepts defined by the
linux must be identically replicated in the other implementations and (b) the
linux implementation must always be complete (provide implementations for all
concepts).</p>
</div>
<!-- *********************************************************************** -->
<hr>

View File

@@ -22,15 +22,15 @@
</ul>
</li>
<li><a href="#tree">LLVM Test Suite Tree</a></li>
<li><a href="#qmstructure">QMTest Structure</a></li>
<li><a href="#dgstructure">DejaGNU Structure</a></li>
<li><a href="#progstructure"><tt>llvm-test</tt> Structure</a></li>
<li><a href="#run">Running the LLVM Tests</a></li>
<li><a href="#nightly">Running the nightly tester</a></li>
</ol>
<div class="doc_author">
<p>Written by John T. Criswell and <a
href="http://llvm.x10sys.com/rspencer">Reid Spencer</a></p>
<p>Written by John T. Criswell, <a
href="http://llvm.x10sys.com/rspencer">Reid Spencer</a>, and Tanya Lattner</p>
</div>
<!--=========================================================================-->
@@ -55,15 +55,12 @@ and run tests.</p>
required to build LLVM, plus the following:</p>
<dl>
<dt><a href="http://www.qmtest.com">QMTest</a></dt>
<dd>The LLVM test suite uses QMTest to organize and run tests. <b>Note:
you will need <a href="http://llvm.cs.uiuc.edu/qm-2.0.3.tar.gz">QMTest
2.0.3 (source tar.gz file)</a> to be successful. The tests do not run with
any other version.</b></dd>
<dt><a href="http://www.python.org">Python</a></dt>
<dd>You will need a Python interpreter that works with QMTest. Python will
need zlib and SAX support enabled.</dd>
<dt><a href="http://www.gnu.org/software/dejagnu/">DejaGNU</a></dt>
<dd>The Feature and Regressions tests are organized and run by DejaGNU.</dd>
<dt><a href="http://expect.nist.gov/">Expect</a></dt>
<dd>Expect is required by DejaGNU.</dd>
<dt><a href="http://www.tcl.tk/software/tcltk/">tcl</a></dt>
<dd>Tcl is required by DejaGNU. </dd>
<dt><a href="http://www.netlib.org/f2c">F2C</a></dt>
<dd>For now, LLVM does not have a Fortran front-end, but using F2C, we can run
@@ -105,30 +102,27 @@ regression tests are in the main "llvm" module under the directory
programs in C and C++ is in the <tt>llvm-test</tt> module. This module should
be checked out to the <tt>llvm/projects</tt> directory. When you
<tt>configure</tt> the <tt>llvm</tt> module, the <tt>llvm-test</tt> module
will be automatically configured. Or you can do it manually.</p>
<p>To run all of the simple tests in LLVM, use the master Makefile in the
will be automatically configured. Alternatively, you can configure the <tt>llvm-test</tt> module manually.</p>
<p>To run all of the simple tests in LLVM using DejaGNU, use the master Makefile in the
<tt>llvm/test</tt> directory:</p>
<pre>
% gmake -C llvm/test
</pre>
<p>To run only the code fragment tests (i.e. those that do basic testing of
LLVM), run the tests organized by QMTest:</p>
or<br>
<pre>
% gmake -C llvm/test qmtest
% gmake check
</pre>
<p>To run only the basic feature tests, QMTest supports the following
target:</p>
<p>To run only a subdirectory of tests in llvm/test using DejaGNU (ie.
Regression/Transforms), just set the TESTSUITE variable to the path of the
subdirectory (relative to <tt>llvm/test</tt>):</p>
<pre>
% gmake -C llvm/test Feature.t
% gmake -C llvm/test TESTSUITE=Regression/Transforms
</pre>
<p>To run only the regression tests, QMTest supports the following
target:</p>
<pre>
% gmake -C llvm/test Regression.t
</pre>
<p><b>Note: If you are running the tests with <tt>objdir != subdir</tt>, you
must have run the complete testsuite before you can specify a
subdirectory.</b></p>
<p>To run the comprehensive test suite (tests that compile and execute whole
programs), run the <tt>llvm-test</tt> tests:</p>
@@ -151,8 +145,8 @@ programs), run the <tt>llvm-test</tt> tests:</p>
<p>The LLVM test suite contains two major categories of tests: code
fragments and whole programs. Code fragments are in the <tt>llvm</tt> module
under the directory under the <tt>llvm/test</tt> directory. The whole programs
test suite are n the <tt>llvm-test</tt> module under the main directory.</p>
under the <tt>llvm/test</tt> directory. The whole programs
test suite is in the <tt>llvm-test</tt> module under the main directory.</p>
</div>
@@ -169,7 +163,7 @@ language front end.</p>
<p>Code fragments are not complete programs, and they are never executed to
determine correct behavior.</p>
<p>Thes code fragment tests are located in the <tt>llvm/test/Features</tt> and
<p>These code fragment tests are located in the <tt>llvm/test/Features</tt> and
<tt>llvm/test/Regression</tt> directories.</p>
</div>
@@ -253,86 +247,85 @@ directory are the SPEC 95 and SPEC 2000 benchmark suites. The presence and
location of these external programs is configured by the llvm-test
<tt>configure</tt> script.</p></li>
<li><tt>llvm/test/QMTest</tt>
<p>This directory contains the QMTest information files. Inside this directory
are QMTest administration files and the Python code that implements the LLVM
test and database classes.</p></li>
</ul>
</div>
<!--=========================================================================-->
<div class="doc_section"><a name="qmstructure">QMTest Structure</a></div>
<div class="doc_section"><a name="dgstructure">DejaGNU Structure</a></div>
<!--=========================================================================-->
<div class="doc_text">
<p>The LLVM test suite is partially driven by DejaGNU and partially
driven by GNU Make. Specifically, the Features and Regression tests
are all driven by DejaGNU. The <tt>llvm-test</tt>
module is currently driven by a set of Makefiles.</p>
<p>The LLVM test suite is partially driven by QMTest and partially driven by GNU
Make. Specifically, the Features and Regression tests are all driven by QMTest.
The <tt>llvm-test</tt> module is currently driven by a set of Makefiles.</p>
<p>The DejaGNU structure is very simple, but does require some
information to be set. This information is gathered via <tt>configure</tt> and
is written to a file, <tt>site.exp</tt> in <tt>llvm/test</tt>. The
<tt>llvm/test</tt>
Makefile does this work for you.</p>
<p>The QMTest system needs to have several pieces of information available;
these pieces of configuration information are known collectively as the
"context" in QMTest parlance. Since the context for LLVM is relatively large,
the master Makefile in llvm/test sets it for you.</p>
<p>In order for DejaGNU to work, each directory of tests must have a
<tt>dg.exp</tt> file. This file is a program written in tcl that calls
the <tt>llvm-runtests</tt> procedure on each test file. The
llvm-runtests procedure is defined in
<tt>llvm/test/lib/llvm-dg.exp</tt>. Any directory that contains only
directories does not need the <tt>dg.exp</tt> file.</p>
<p>The LLVM database class makes the subdirectories of llvm/test a QMTest test
database. For each directory that contains tests driven by QMTest, it knows
what type of test the source file is and how to run it.</p>
<p>In order for a test to be run, it must contain information within
the test file on how to run the test. These are called <tt>RUN</tt>
lines. Run lines are specified in the comments of the test program
using the keyword <tt>RUN</tt> followed by a colon, and lastly the
commands to execute. These commands will be executed in a bash script,
so any bash syntax is acceptable. You can specify as many RUN lines as
necessary. Each RUN line translates to one line in the resulting bash
script. Below is an example of legal RUN lines in a <tt>.ll</tt>
file:</p>
<pre>
; RUN: llvm-as < %s | llvm-dis > %t1
; RUN: llvm-dis < %s.bc-13 > %t2
; RUN: diff %t1 %t2
</pre>
<p>There are a couple patterns within a <tt>RUN</tt> line that the
llvm-runtest procedure looks for and replaces with the appropriate
syntax:</p>
<p>Hence, the QMTest namespace is essentially what you see in the Feature and
Regression directories, but there is some magic that the database class performs
(as described below).</p>
<dl style="margin-left: 25px">
<dt>%p</dt>
<dd>The path to the source directory. This is for locating
any supporting files that are not generated by the test, but used by
the test.</dd>
<dt>%s</dt>
<dd>The test file.</dd>
<p>The QMTest namespace is currently composed of the following tests and test
suites:</p>
<dt>%t</dt>
<dd>Temporary filename: testscript.test_filename.tmp, where
test_filename is the name of the test file. All temporary files are
placed in the Output directory within the directory the test is
located.</dd>
<ul>
<li>Feature
<dt>%prcontext</dt>
<dd>Path to a script that performs grep -C. Use this since not all
platforms support grep -C.</dd>
<p>These are the feature tests found in the Feature directory.
They are broken up into the following categories:</p>
<dt>%llvmgcc</dt> <dd>Full path to the llvm-gcc executable.</dd>
<dt>%llvmgxx</dt> <dd>Full path to the llvm-g++ executable.</dd>
</dl>
<ul>
<li>ad
<p>Assembler/Disassembler tests. These tests verify that a piece of LLVM
assembly language can be assembled into bytecode and then disassembled
into the original assembly language code. It does this several times to
ensure that assembled output can be disassembled and disassembler output
can be assembled. It also verifies that the give assembly language file
can be assembled correctly.</p></li>
<p>There are also several scripts in the llvm/test/Scripts directory
that you might find useful when writing <tt>RUN</tt> lines.</p>
<li>opt
<p>Optimizer tests. These tests verify that two of the optimizer passes
completely optimize a program (i.e. after a single pass, they cannot
optimize a program any further).</p></li>
<li>mc
<p> Machine code tests. These tests verify that the LLVM assembly
language file can be translated into native assembly code.</p></li>
<li>cc
<p>C code tests. These tests verify that the specified LLVM assembly
code can be converted into C source code using the C backend.</p></li>
</ul>
<p>The LLVM database class looks at every file in the Feature directory and
creates a fake test hierarchy containing
<tt>Feature.&lt;testtype&gt;.&lt;testname&gt;</tt>. So, if you add an LLVM
assembly language file to the Feature directory, it actually creates 5 new
tests: assembler/disassembler, assembler, optimizer, machine code, and C code.
</p></li>
<li>Regression
<p>These are the regression tests. There is one suite for each
subdirectory of the Regression directory. If you add a new subdirectory
there, you will need to modify, at least, the <tt>RegressionMap</tt>
variable in <tt>QMTest/llvmdb.py</tt> so that QMTest knows how to run the
tests in the new subdirectory.</p>
</li>
</ul>
<p>Lastly, you can easily mark a test that is expected to fail on a
specific platform by using the <tt>XFAIL</tt> keyword. Xfail lines are
specified in the comments of the test program using <tt>XFAIL</tt>,
followed by a colon, and one or more regular expressions (separated by
a comma) that will match against the target triplet for the
machine. You can use * to match all targets. Here is an example of an
<tt>XFAIL</tt> line:</p>
<pre>
; XFAIL: darwin,sun
</pre>
</div>
@@ -365,6 +358,32 @@ research group. They may still be valuable, however, as a guide to writing your
own TEST Makefile for any optimization or analysis passes that you develop with
LLVM.</p>
<p>Note, when configuring the <tt>llvm-test</tt> module, you might want to
specify the following configuration options:</p>
<dl>
<dt><i>--enable-spec2000</i>
<dt><i>--enable-spec2000=&lt;<tt>directory</tt>&gt;</i>
<dd>
Enable the use of SPEC2000 when testing LLVM. This is disabled by default
(unless <tt>configure</tt> finds SPEC2000 installed). By specifying
<tt>directory</tt>, you can tell configure where to find the SPEC2000
benchmarks. If <tt>directory</tt> is left unspecified, <tt>configure</tt>
uses the default value
<tt>/home/vadve/shared/benchmarks/speccpu2000/benchspec</tt>.
<p>
<dt><i>--enable-spec95</i>
<dt><i>--enable-spec95=&lt;<tt>directory</tt>&gt;</i>
<dd>
Enable the use of SPEC95 when testing LLVM. It is similar to the
<i>--enable-spec2000</i> option.
<p>
<dt><i>--enable-povray</i>
<dt><i>--enable-povray=&lt;<tt>directory</tt>&gt;</i>
<dd>
Enable the use of Povray as an external test. Versions of Povray written
in C should work. This option is similar to the <i>--enable-spec2000</i>
option.
</dl>
</div>
<!--=========================================================================-->
@@ -377,18 +396,19 @@ LLVM.</p>
<i>are not</i> executed inside of the LLVM source tree. This is because the
test suite creates temporary files during execution.</p>
<p>The master Makefile in llvm/test is capable of running only the QMTest driven
<p>The master Makefile in llvm/test is capable of running only the DejaGNU driven
tests. By default, it will run all of these tests.</p>
<p>To run only the QMTest driven tests, run <tt>gmake qmtest</tt> at the
command line in llvm/tests. To run a specific qmtest, suffix the test name with
".t" when running gmake.</p>
<p>To run only the DejaGNU driven tests, run <tt>gmake</tt> at the
command line in <tt>llvm/test</tt>. To run a specific directory of tests, use
the TESTSUITE variable.
</p>
<p>For example, to run the Regression.LLC tests, type
<tt>gmake Regression.LLC.t</tt> in <tt>llvm/tests</tt>.</p>
<p>For example, to run the Regression tests, type
<tt>gmake TESTSUITE=Regression</tt> in <tt>llvm/tests</tt>.</p>
<p>Note that there are no Makefiles in <tt>llvm/test/Features</tt> and
<tt>llvm/test/Regression</tt>. You must use QMTest from the <tt>llvm/test</tt>
<tt>llvm/test/Regression</tt>. You must use DejaGNU from the <tt>llvm/test</tt>
directory to run them.</p>
<p>To run the <tt>llvm-test</tt> suite, you need to use the following steps:
@@ -406,7 +426,7 @@ directory to run them.</p>
properly configured.</li>
<li>Use the <tt>configure</tt> script found in the <tt>llvm-test</tt> source
directory:<br/>
<tt>$BUILD_SRC_DIR/configure --with-llvmsrc=$LLVM_SRC_ROOT --with-llvmobj=$LLVM_OBJ_ROOT</tt>
<tt>$LLVM_SRC_ROOT/projects/llvm-test/configure --with-llvmsrc=$LLVM_SRC_ROOT --with-llvmobj=$LLVM_OBJ_ROOT</tt>
</li>
</ol>
<li>gmake</li>
@@ -430,11 +450,11 @@ output and standard error. You can redirect these results to a file if you
choose.</p>
<p>Some tests are known to fail. Some are bugs that we have not fixed yet;
others are features that we haven't added yet (or may never add). In QMTest,
others are features that we haven't added yet (or may never add). In DejaGNU,
the result for such tests will be XFAIL (eXpected FAILure). In this way, you
can tell the difference between an expected and unexpected failure.</p>
<p>The tests in <tt>llvm-test</tt> have no such feature as of this time. If the
<p>The tests in <tt>llvm-test</tt> have no such feature at this time. If the
test passes, only warnings and other miscellaneous output will be generated. If
a test fails, a large &lt;program&gt; FAILED message will be displayed. This
will help you separate benign warnings from actual test failures.</p>
@@ -454,18 +474,21 @@ program test (described above), run all of the feature and regression tests,
and then delete the checked out tree. This tester is designed to ensure that
programs don't break as well as keep track of LLVM's progress over time.</p>
<p>
If you'd like to set up an instance of the nightly tester to run on your
machine, take a look at the comments at the top of the utils/NightlyTester.pl
file. We usually run it from a crontab entry that looks ilke this:
</p>
<p>If you'd like to set up an instance of the nightly tester to run on your
machine, take a look at the comments at the top of the
<tt>utils/NightlyTester.pl</tt> file. We usually run it from a crontab entry
that looks ilke this:</p>
<div class="doc_code">
<pre>
5 3 * * * LLVM_LIB_SEARCH_PATH=.../llvm-gcc/bytecode-libs $HOME/llvm/utils/NightlyTest.pl -parallel -enable-linscan ...CVSREPOSTRING... $HOME/buildtest-X86 $HOME/cvs/testresults-X86
5 3 * * * $HOME/llvm/utils/NightlyTest.pl -parallel $CVSROOT $HOME/buildtest-X86 $HOME/cvs/testresults-X86
</pre>
</div>
<p>Or, you can create a shell script to encapsulate the running of the script.
The optimized x86 Linux nightly test is run from just such a script:
The optimized x86 Linux nightly test is run from just such a script:</p>
<div class="doc_code">
<pre>
#!/bin/bash
BASE=/proj/work/llvm/nightlytest
@@ -475,17 +498,16 @@ export WEBDIR=$BASE/testresults
export LLVMGCCDIR=/proj/work/llvm/cfrontend/install
export PATH=/proj/install/bin:$LLVMGCCDIR/bin:$PATH
export LD_LIBRARY_PATH=/proj/install/lib
export LLVM_LIB_SEARCH_PATH=/proj/work/llvm/cfrontend/install/bytecode-libs
cd $BASE
cp /proj/work/llvm/llvm/utils/NightlyTest.pl .
nice ./NightlyTest.pl -nice -release -verbose -parallel -enable-linscan -noexternals
nice ./NightlyTest.pl -nice -release -verbose -parallel -enable-linscan -noexternals 2&gt;&amp;1 &gt; output.log
mail -s 'X86 nightly tester results' <a href="http://mail.cs.uiuc.edu/mailman/listinfo/llvm-testresults">llvm-testresults@cs.uiuc.edu</a> &lt; output.log
</pre>
</div>
<p>
Take a look at the NightlyTest.pl file to see what all of the flags and
strings do. If you start running the nightly tests, please let us know and
we'll link your page to the global tester page. Thanks!
</p>
<p>Take a look at the <tt>NightlyTest.pl</tt> file to see what all of the flags
and strings do. If you start running the nightly tests, please let us know and
we'll link your page to the global tester page. Thanks!</p>
</div>
@@ -498,7 +520,7 @@ we'll link your page to the global tester page. Thanks!
<a href="http://validator.w3.org/check/referer"><img
src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!" /></a>
John T. Criswell<br>
John T. Criswell, Reid Spencer, and Tanya Lattner<br>
<a href="http://llvm.cs.uiuc.edu">The LLVM Compiler Infrastructure</a><br/>
Last modified: $Date$
</address>

View File

@@ -10,6 +10,7 @@
<li><a href="#abstract">Abstract</a></li>
<li><a href="#introduction">Introduction</a></li>
<li><a href="#descriptions">Library Descriptions</a></li>
<li><a href="#dependencies">Library Dependencies</a></li>
<li><a href="#rot">Linkage Rules Of Thumb</a>
<ol>
<li><a href="#always">Always link LLVMCore, LLVMSupport, LLVMSystem</a>
@@ -71,20 +72,24 @@
<table style="text-align:left">
<tr><th>Library</th><th>Forms</th><th>Description</th></tr>
<tr><th colspan="3">Core Libraries</th></tr>
<tr><td>LLVMArchive</td><td><tt>.a</tt></td>
<td>LLVM archive reading and writing</td></tr>
<tr><td>LLVMAsmParser</td><td><tt>.o</tt></td>
<td>LLVM Assembly Parsing</td></tr>
<td>LLVM assembly parsing</td></tr>
<tr><td>LLVMBCReader</td><td><tt>.o</tt></td>
<td>LLVM Bytecode Reading</td></tr>
<td>LLVM bytecode reading</td></tr>
<tr><td>LLVMBCWriter</td><td><tt>.o</tt></td>
<td>LLVM Bytecode Writing</td></tr>
<td>LLVM bytecode writing</td></tr>
<tr><td>LLVMCore</td><td><tt>.o</tt></td>
<td>LLVM core intermediate representation</td></tr>
<tr><td>LLVMDebugger</td><td><tt>.o</tt></td>
<td>Source Level Debugging Support</td></tr>
<td>Source level debugging support</td></tr>
<tr><td>LLVMLinker</td><td><tt>.a</tt></td>
<td>Bytecode and archive linking interface</td></tr>
<tr><td>LLVMSupport</td><td><tt>.a .o</tt></td>
<td>General support utilities</td></tr>
<tr><td>LLVMSystem</td><td><tt>.a .o</tt></td>
<td>Operating system abstraction</td></tr>
<tr><td>LLVMCore</td><td><tt>.o</tt></td>
<td>LLVM Core IR</td></tr>
<td>Operating system abstraction layer</td></tr>
<tr><th colspan="3">Analysis Libraries</th></tr>
<tr><td>LLVMAnalysis</td><td><tt>.a .o</tt></td>
@@ -118,9 +123,11 @@
<tr><td>LLVMPowerPC</td><td><tt>.o</tt></td>
<td>PowerPC code generation backend</td></tr>
<tr><td>LLVMSelectionDAG</td><td><tt>.o</tt></td>
<td>Aggressive instruction selector for Directed Acyclic Graphs.</td></tr>
<td>Aggressive instruction selector for directed acyclic graphs.</td></tr>
<tr><td>LLVMSkeleton</td><td><tt>.a .o</tt></td>
<td>Skeleton for a code generation backend.</td></tr>
<tr><td>LLVMSparcV8</td><td><tt>.o</tt></td>
<td>Code generation for SparcV8.</td></tr>
<tr><td>LLVMSparcV9</td><td><tt>.o</tt></td>
<td>Code generation for SparcV9.</td></tr>
<tr><td>LLVMSparcV9RegAlloc</td><td><tt>.a .o</tt></td>
@@ -148,6 +155,312 @@
</table>
</div>
<!-- ======================================================================= -->
<div class="doc_section"><a name="dependencies"></a>Library Dependencies</div>
<div class="doc_text">
<p>Below are two dependency graphs and a list that show the relationships
between the various LLVM archive libraries and object files. This information
can be automatically generated with the <tt>GenLibDeps.pl</tt> utility found
in the <tt>llvm/utils</tt> directory.</p>
<!-- =======NOTE: =========================================================-->
<!-- === The following graphs and <dl> list are generated automatically ===-->
<!-- === by the util named GenLibDeps.pl in the llvm/utils directory. ===-->
<!-- === This should be updated whenever new libraries are added, ===-->
<!-- === removed, or changed ===-->
<!-- =======NOTE: =========================================================-->
<h2>Dependency Relationships Of Libraries</h2>
<p>This graph shows the dependency of archive libraries on other archive
libraries or objects. Where a library has both archive and object forms, only
the archive form is shown.</p>
<img src="img/libdeps.gif" alt="Library Dependencies"/>
<h2>Dependency Relationships Of Object Files</h2>
<p>This graph shows the dependency of object files on archive libraries or
other objects. Where a library has both object and archive forms, only the
dependency to the archive form is shown.</p>
<img src="img/objdeps.gif" alt="Object File Dependencies"/>
<p>The following list shows the dependency relationships between libraries in
textual form. The information is the same as shown on the graphs but arranged
alphabetically.</p>
<dl>
<dt><b>libLLVMAnalysis.a</b</dt><dd><ul>
<li>libLLVMScalarOpts.a</li>
<li>libLLVMSupport.a</li>
<li>libLLVMTarget.a</li>
<li>libLLVMTransformUtils.a</li>
<li>LLVMCore.o</li>
</ul></dd>
<dt><b>libLLVMArchive.a</b</dt><dd><ul>
<li>libLLVMSupport.a</li>
<li>libLLVMSystem.a</li>
<li>LLVMBCReader.o</li>
</ul></dd>
<dt><b>libLLVMDataStructure.a</b</dt><dd><ul>
<li>libLLVMAnalysis.a</li>
<li>libLLVMSupport.a</li>
<li>libLLVMTarget.a</li>
<li>libLLVMTransformUtils.a</li>
<li>LLVMCore.o</li>
</ul></dd>
<dt><b>libLLVMInstrumentation.a</b</dt><dd><ul>
<li>libLLVMSupport.a</li>
<li>libLLVMTransformUtils.a</li>
<li>LLVMCore.o</li>
</ul></dd>
<dt><b>libLLVMLinker.a</b</dt><dd><ul>
<li>libLLVMArchive.a</li>
<li>libLLVMSystem.a</li>
<li>LLVMBCReader.o</li>
<li>LLVMCore.o</li>
</ul></dd>
<dt><b>libLLVMScalarOpts.a</b</dt><dd><ul>
<li>libLLVMAnalysis.a</li>
<li>libLLVMSupport.a</li>
<li>libLLVMTarget.a</li>
<li>libLLVMTransformUtils.a</li>
<li>LLVMCore.o</li>
</ul></dd>
<dt><b>libLLVMSparcV9RegAlloc.a</b</dt><dd><ul>
<li>libLLVMAnalysis.a</li>
<li>libLLVMSupport.a</li>
<li>LLVMCodeGen.o</li>
<li>LLVMCore.o</li>
<li>LLVMSparcV9LiveVar.o</li>
<li>LLVMSparcV9.o</li>
</ul></dd>
<dt><b>libLLVMSupport.a</b</dt><dd><ul>
<li>libLLVMSystem.a</li>
<li>LLVMbzip2.o</li>
</ul></dd>
<dt><b>libLLVMSystem.a</b</dt><dd></dd>
<dt><b>libLLVMTarget.a</b</dt><dd><ul>
<li>libLLVMSupport.a</li>
<li>LLVMCore.o</li>
</ul></dd>
<dt><b>libLLVMTransformUtils.a</b</dt><dd><ul>
<li>libLLVMAnalysis.a</li>
<li>libLLVMScalarOpts.a</li>
<li>libLLVMSupport.a</li>
<li>LLVMCore.o</li>
</ul></dd>
<dt><b>libLLVMTransforms.a</b</dt><dd><ul>
<li>libLLVMAnalysis.a</li>
<li>libLLVMSupport.a</li>
<li>libLLVMTarget.a</li>
<li>libLLVMTransformUtils.a</li>
<li>LLVMCore.o</li>
</ul></dd>
<dt><b>libLLVMipa.a</b</dt><dd><ul>
<li>libLLVMAnalysis.a</li>
<li>libLLVMSupport.a</li>
<li>LLVMCore.o</li>
</ul></dd>
<dt><b>libLLVMipo.a</b</dt><dd><ul>
<li>libLLVMAnalysis.a</li>
<li>libLLVMipa.a</li>
<li>libLLVMScalarOpts.a</li>
<li>libLLVMSupport.a</li>
<li>libLLVMTarget.a</li>
<li>libLLVMTransformUtils.a</li>
<li>LLVMCore.o</li>
</ul></dd>
<dt><b>LLVMAnalysis.o</b</dt><dd><ul>
<li>libLLVMScalarOpts.a</li>
<li>libLLVMSupport.a</li>
<li>libLLVMTarget.a</li>
<li>libLLVMTransformUtils.a</li>
<li>LLVMCore.o</li>
</ul></dd>
<dt><b>LLVMAsmParser.o</b</dt><dd><ul>
<li>LLVMCore.o</li>
</ul></dd>
<dt><b>LLVMBCReader.o</b</dt><dd><ul>
<li>libLLVMSupport.a</li>
<li>libLLVMSystem.a</li>
<li>LLVMCore.o</li>
</ul></dd>
<dt><b>LLVMBCWriter.o</b</dt><dd><ul>
<li>libLLVMSupport.a</li>
<li>LLVMCore.o</li>
</ul></dd>
<dt><b>LLVMCBackend.o</b</dt><dd><ul>
<li>libLLVMAnalysis.a</li>
<li>libLLVMipa.a</li>
<li>libLLVMScalarOpts.a</li>
<li>libLLVMSupport.a</li>
<li>libLLVMTarget.a</li>
<li>LLVMCore.o</li>
</ul></dd>
<dt><b>LLVMCodeGen.o</b</dt><dd><ul>
<li>libLLVMAnalysis.a</li>
<li>libLLVMSupport.a</li>
<li>libLLVMTarget.a</li>
<li>LLVMCore.o</li>
</ul></dd>
<dt><b>LLVMCore.o</b</dt><dd><ul>
<li>libLLVMSupport.a</li>
</ul></dd>
<dt><b>LLVMDataStructure.o</b</dt><dd><ul>
<li>libLLVMAnalysis.a</li>
<li>libLLVMSupport.a</li>
<li>libLLVMTarget.a</li>
<li>libLLVMTransformUtils.a</li>
<li>LLVMCore.o</li>
</ul></dd>
<dt><b>LLVMDebugger.o</b</dt><dd><ul>
<li>libLLVMSupport.a</li>
<li>libLLVMSystem.a</li>
<li>LLVMBCReader.o</li>
<li>LLVMCodeGen.o</li>
<li>LLVMCore.o</li>
<li>LLVMExecutionEngine.o</li>
</ul></dd>
<dt><b>LLVMExecutionEngine.o</b</dt><dd><ul>
<li>libLLVMSupport.a</li>
<li>libLLVMSystem.a</li>
<li>libLLVMTarget.a</li>
<li>LLVMCore.o</li>
<li>LLVMInterpreter.o</li>
<li>LLVMJIT.o</li>
</ul></dd>
<dt><b>LLVMInstrumentation.o</b</dt><dd><ul>
<li>libLLVMSupport.a</li>
<li>libLLVMTransformUtils.a</li>
<li>LLVMCore.o</li>
</ul></dd>
<dt><b>LLVMInterpreter.o</b</dt><dd><ul>
<li>libLLVMSupport.a</li>
<li>libLLVMSystem.a</li>
<li>libLLVMTarget.a</li>
<li>LLVMCore.o</li>
<li>LLVMExecutionEngine.o</li>
</ul></dd>
<dt><b>LLVMJIT.o</b</dt><dd><ul>
<li>libLLVMSupport.a</li>
<li>libLLVMSystem.a</li>
<li>libLLVMTarget.a</li>
<li>LLVMCore.o</li>
<li>LLVMExecutionEngine.o</li>
</ul></dd>
<dt><b>LLVMPowerPC.o</b</dt><dd><ul>
<li>libLLVMScalarOpts.a</li>
<li>libLLVMSupport.a</li>
<li>libLLVMTarget.a</li>
<li>LLVMCodeGen.o</li>
<li>LLVMCore.o</li>
</ul></dd>
<dt><b>LLVMProfilePaths.o</b</dt><dd><ul>
<li>libLLVMInstrumentation.a</li>
<li>libLLVMSupport.a</li>
<li>LLVMCore.o</li>
</ul></dd>
<dt><b>LLVMScalarOpts.o</b</dt><dd><ul>
<li>libLLVMAnalysis.a</li>
<li>libLLVMSupport.a</li>
<li>libLLVMTarget.a</li>
<li>libLLVMTransformUtils.a</li>
<li>LLVMCore.o</li>
</ul></dd>
<dt><b>LLVMSelectionDAG.o</b</dt><dd><ul>
<li>LLVMCodeGen.o</li>
<li>LLVMCore.o</li>
</ul></dd>
<dt><b>LLVMSkeleton.o</b</dt><dd><ul>
<li>libLLVMTarget.a</li>
<li>LLVMCodeGen.o</li>
<li>LLVMCore.o</li>
</ul></dd>
<dt><b>LLVMSparcV8.o</b</dt><dd><ul>
<li>libLLVMScalarOpts.a</li>
<li>libLLVMSupport.a</li>
<li>libLLVMTarget.a</li>
<li>LLVMCodeGen.o</li>
<li>LLVMCore.o</li>
</ul></dd>
<dt><b>LLVMSparcV9.o</b</dt><dd><ul>
<li>libLLVMScalarOpts.a</li>
<li>libLLVMSparcV9RegAlloc.a</li>
<li>libLLVMSupport.a</li>
<li>libLLVMTarget.a</li>
<li>LLVMBCWriter.o</li>
<li>LLVMCodeGen.o</li>
<li>LLVMCore.o</li>
<li>LLVMSparcV9InstrSched.o</li>
<li>LLVMSparcV9ModuloSched.o</li>
</ul></dd>
<dt><b>LLVMSparcV9InstrSched.o</b</dt><dd><ul>
<li>libLLVMSupport.a</li>
<li>LLVMCodeGen.o</li>
<li>LLVMCore.o</li>
<li>LLVMSparcV9LiveVar.o</li>
<li>LLVMSparcV9.o</li>
</ul></dd>
<dt><b>LLVMSparcV9LiveVar.o</b</dt><dd><ul>
<li>libLLVMSupport.a</li>
<li>LLVMCodeGen.o</li>
<li>LLVMCore.o</li>
</ul></dd>
<dt><b>LLVMSparcV9ModuloSched.o</b</dt><dd><ul>
<li>libLLVMSupport.a</li>
<li>libLLVMTarget.a</li>
<li>LLVMCodeGen.o</li>
<li>LLVMCore.o</li>
<li>LLVMSparcV9.o</li>
</ul></dd>
<dt><b>LLVMSparcV9RegAlloc.o</b</dt><dd><ul>
<li>libLLVMAnalysis.a</li>
<li>libLLVMSupport.a</li>
<li>LLVMCodeGen.o</li>
<li>LLVMCore.o</li>
<li>LLVMSparcV9LiveVar.o</li>
<li>LLVMSparcV9.o</li>
</ul></dd>
<dt><b>LLVMSupport.o</b</dt><dd><ul>
<li>libLLVMSystem.a</li>
<li>LLVMbzip2.o</li>
</ul></dd>
<dt><b>LLVMSystem.o</b</dt><dd></dd>
<dt><b>LLVMTarget.o</b</dt><dd><ul>
<li>libLLVMSupport.a</li>
<li>LLVMCore.o</li>
</ul></dd>
<dt><b>LLVMTransformUtils.o</b</dt><dd><ul>
<li>libLLVMAnalysis.a</li>
<li>libLLVMScalarOpts.a</li>
<li>libLLVMSupport.a</li>
<li>LLVMCore.o</li>
</ul></dd>
<dt><b>LLVMTransforms.o</b</dt><dd><ul>
<li>libLLVMAnalysis.a</li>
<li>libLLVMSupport.a</li>
<li>libLLVMTarget.a</li>
<li>libLLVMTransformUtils.a</li>
<li>LLVMCore.o</li>
</ul></dd>
<dt><b>LLVMX86.o</b</dt><dd><ul>
<li>libLLVMScalarOpts.a</li>
<li>libLLVMSupport.a</li>
<li>libLLVMTarget.a</li>
<li>LLVMCodeGen.o</li>
<li>LLVMCore.o</li>
</ul></dd>
<dt><b>LLVMbzip2.o</b</dt><dd></dd>
<dt><b>LLVMipa.o</b</dt><dd><ul>
<li>libLLVMAnalysis.a</li>
<li>libLLVMSupport.a</li>
<li>LLVMCore.o</li>
</ul></dd>
<dt><b>LLVMipo.o</b</dt><dd><ul>
<li>libLLVMAnalysis.a</li>
<li>libLLVMipa.a</li>
<li>libLLVMScalarOpts.a</li>
<li>libLLVMSupport.a</li>
<li>libLLVMTarget.a</li>
<li>libLLVMTransformUtils.a</li>
<li>LLVMCore.o</li>
</ul></dd>
</dl>
</div>
<!-- ======================================================================= -->
<div class="doc_section"><a name="rot">Linkage Rules Of Thumb</a></div>
<div class="doc_text">

View File

@@ -91,21 +91,34 @@ implement the following:</p>
href="CodeGenerator.html#targetmachine">TargetMachine</a></tt>, which
configures <tt><a href="CodeGenerator.html#targetdata">TargetData</a></tt>
correctly</li>
<li>Register your new target using the <tt>RegisterTarget</tt>
template:<br><br>
<div class="doc_code"><pre>
RegisterTarget&lt;<em>MyTargetMachine</em>&gt; M("short_name", " Target name");
</pre></div>
<br>Here, <em>MyTargetMachine</em> is the name of your implemented
subclass of <tt><a
href="CodeGenerator.html#targetmachine">TargetMachine</a></tt>,
<em>short_name</em> is the option that will be active following
<tt>-march=</tt> to select a target in llc and lli, and the last string
is the description of your target to appear in <tt>-help</tt>
listing.</li>
</ul></li>
<li>Implement the assembly printer for the architecture. Usually, if you have
described the instruction set with the assembly printer generator in mind, that
step can be almost automated.</li>
</ul>
<p>Now, for static code generation you also need to write an instruction
selector for your platform: see <tt>lib/Target/*/*ISelSimple.cpp</tt> which
is no longer "simple" but it gives you the idea: you have to be able to create
MachineInstrs for any given LLVM instruction using the <tt>InstVisitor</tt>
pattern, and produce a <tt>MachineFunction</tt> with
<tt>MachineBasicBlock</tt>s full of <tt><a
href="CodeGenerator.html#machineinstr">MachineInstr</a></tt>s for a
corresponding LLVM Function. Creating an instruction selector is perhaps the
most time-consuming part of creating a back-end.</p>
<p>You also need to write an instruction selector for your platform. The
recommended method is the <a
href="CodeGenerator.html#instselect">pattern-matching instruction selector</a>,
examples of which you can see in other targets:
<tt>lib/Target/*/*ISelPattern.cpp</tt>. The former method for writing
instruction selectors (<b>not</b> recommended for new targets) is evident in
<tt>lib/Target/*/*ISelSimple.cpp</tt>, which are <tt>InstVisitor</tt>-based
translators, generating code for an LLVM instruction at a time. Creating an
instruction selector is perhaps the most time-consuming part of creating a
back-end.</p>
<p>To create a JIT for your platform:</p>
@@ -217,10 +230,13 @@ how the C backend is written.</p>
<ul>
<li><a href="CodeGenerator.html">Code generator</a> -
describes some of the classes in code generation at a high level, but
it is not (yet) complete.</li>
it is not (yet) complete</li>
<li><a href="TableGenFundamentals.html">TableGen fundamentals</a> -
describes how to use TableGen to describe your target information succinctly
</li>
describes how to use TableGen to describe your target information
succinctly</li>
<li><a href="HowToSubmitABug.html#codegen">Debugging code generation with
bugpoint</a> - shows bugpoint usage scenarios to simplify backend
development</li>
</ul>
</div>

View File

@@ -2,6 +2,7 @@
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Writing an LLVM Pass</title>
<link rel="stylesheet" href="llvm.css" type="text/css">
</head>
@@ -155,13 +156,12 @@ source tree in the <tt>lib/Transforms/Hello</tt> directory.</p>
<div class="doc_text">
<p>First thing you need to do is create a new directory somewhere in the LLVM
source base. For this example, we'll assume that you made
"<tt>lib/Transforms/Hello</tt>". The first thing you must do is set up a build
script (Makefile) that will compile the source code for the new pass. To do
this, copy this into "<tt>Makefile</tt>":</p>
<hr>
<p>First, you need to create a new directory somewhere in the LLVM source
base. For this example, we'll assume that you made
<tt>lib/Transforms/Hello</tt>. Next, you must set up a build script
(Makefile) that will compile the source code for the new pass. To do this,
copy the following into <tt>Makefile</tt>:</p>
<hr/>
<pre>
# Makefile for hello pass
@@ -170,21 +170,25 @@ this, copy this into "<tt>Makefile</tt>":</p>
LEVEL = ../../..
# Name of the library to build
LIBRARYNAME = hello
LIBRARYNAME = Hello
# Build a dynamically loadable shared object
# Build a dynamically linkable shared object
SHARED_LIBRARY = 1
# Make the shared library become a loadable module so the tools can
# dlopen/dlsym on the resulting library.
LOADABLE_MODULE
# Include the makefile implementation stuff
include $(LEVEL)/Makefile.common
</pre>
<p>This makefile specifies that all of the <tt>.cpp</tt> files in the current
directory are to be compiled and linked together into a
<tt>lib/Debug/libhello.so</tt> shared object that can be dynamically loaded by
the <tt>opt</tt> or <tt>analyze</tt> tools. If your operating system uses a
suffix other than .so (such as windows or Mac OS/X), the appropriate extension
will be used.</p>
<tt>Debug/lib/Hello.so</tt> shared object that can be dynamically loaded by
the <tt>opt</tt> or <tt>analyze</tt> tools via their <tt>-load</tt> options.
If your operating system uses a suffix other than .so (such as windows or
Mac OS/X), the appropriate extension will be used.</p>
<p>Now that we have the build scripts set up, we just need to write the code for
the pass itself.</p>
@@ -238,7 +242,7 @@ information.</p>
</pre><p>
<p>This declares a "<tt>Hello</tt>" class that is a subclass of <tt><a
href="http://llvm.cs.uiuc.edu/doxygen/structllvm_1_1FunctionPass.html">FunctionPass</a></tt>.
href="http://llvm.cs.uiuc.edu/doxygen/classllvm_1_1FunctionPass.html">FunctionPass</a></tt>.
The different builtin pass subclasses are described in detail <a
href="#passtype">later</a>, but for now, know that <a
href="#FunctionPass"><tt>FunctionPass</tt></a>'s operate a function at a
@@ -291,7 +295,7 @@ depending on what it is to be used for. For "optimizations" we use the
<p>Now that it's all together, compile the file with a simple "<tt>gmake</tt>"
command in the local directory and you should get a new
"<tt>lib/Debug/libhello.so</tt> file. Note that everything in this file is
"<tt>Debug/lib/Hello.so</tt> file. Note that everything in this file is
contained in an anonymous namespace: this reflects the fact that passes are self
contained units that do not need external interfaces (although they can have
them) to be useful.</p>
@@ -317,7 +321,7 @@ through our transformation like this (or course, any bytecode file will
work):</p>
<pre>
$ opt -load ../../../lib/Debug/libhello.so -hello &lt; hello.bc &gt; /dev/null
$ opt -load ../../../Debug/lib/Hello.so -hello &lt; hello.bc &gt; /dev/null
Hello: __main
Hello: puts
Hello: main
@@ -334,7 +338,7 @@ interesting way, we just throw away the result of <tt>opt</tt> (sending it to
<tt>opt</tt> with the <tt>--help</tt> option:</p>
<pre>
$ opt -load ../../../lib/Debug/libhello.so --help
$ opt -load ../../../Debug/lib/Hello.so --help
OVERVIEW: llvm .bc -&gt; .bc modular optimizer
USAGE: opt [options] &lt;input bytecode&gt;
@@ -362,7 +366,7 @@ the execution time of your pass along with the other passes you queue up. For
example:</p>
<pre>
$ opt -load ../../../lib/Debug/libhello.so -hello -time-passes &lt; hello.bc &gt; /dev/null
$ opt -load ../../../Debug/lib/Hello.so -hello -time-passes &lt; hello.bc &gt; /dev/null
Hello: __main
Hello: puts
Hello: main
@@ -420,7 +424,7 @@ slow.</p>
<div class="doc_text">
<p>The most plain and boring type of pass is the "<tt><a
href="http://llvm.cs.uiuc.edu/doxygen/structllvm_1_1ImmutablePass.html">ImmutablePass</a></tt>"
href="http://llvm.cs.uiuc.edu/doxygen/classllvm_1_1ImmutablePass.html">ImmutablePass</a></tt>"
class. This pass type is used for passes that do not have to be run, do not
change state, and never need to be updated. This is not a normal type of
transformation or analysis, but can provide information about the current
@@ -481,7 +485,7 @@ otherwise.</p>
<div class="doc_text">
<p>The "<tt><a
href="http://llvm.cs.uiuc.edu/doxygen/structllvm_1_1CallGraphSCCPass.html">CallGraphSCCPass</a></tt>"
href="http://llvm.cs.uiuc.edu/doxygen/classllvm_1_1CallGraphSCCPass.html">CallGraphSCCPass</a></tt>"
is used by passes that need to traverse the program bottom-up on the call graph
(callees before callers). Deriving from CallGraphSCCPass provides some
mechanics for building and traversing the CallGraph, but also allows the system
@@ -694,8 +698,8 @@ As such, they are <b>not</b> allowed to do any of the following:</p>
<li>Modify or inspect any basic blocks outside of the current one</li>
<li>Maintain state across invocations of
<a href="#runOnBasicBlock"><tt>runOnBasicBlock</tt></a></li>
<li>Modify the constrol flow graph (by altering terminator instructions)</li>
<li>Any of the things verboten for
<li>Modify the control flow graph (by altering terminator instructions)</li>
<li>Any of the things forbidden for
<a href="#FunctionPass"><tt>FunctionPass</tt></a>es.</li>
</ol>
@@ -722,7 +726,7 @@ href="#FunctionPass"><tt>FunctionPass</tt></a>'s have, but also have the followi
<p>The <tt>doIninitialize</tt> method is allowed to do most of the things that
<tt>BasicBlockPass</tt>'s are not allowed to do, but that
<tt>FunctionPass</tt>'s can. The <tt>doInitialization</tt> method is designed
to do simple initialization type of stuff that does not depend on the
to do simple initialization that does not depend on the
BasicBlocks being processed. The <tt>doInitialization</tt> method call is not
scheduled to overlap with any other pass executions (thus it should be very
fast).</p>
@@ -943,11 +947,11 @@ object:</p>
<div class="doc_text">
<p>
If you pass requires a previous pass to be executed (an analysis for example),
If your pass requires a previous pass to be executed (an analysis for example),
it can use one of these methods to arrange for it to be run before your pass.
LLVM has many different types of analyses and passes that can be required,
spaning the range from <tt>DominatorSet</tt> to <tt>BreakCriticalEdges</tt>.
requiring <tt>BreakCriticalEdges</tt>, for example, guarantees that there will
spanning the range from <tt>DominatorSet</tt> to <tt>BreakCriticalEdges</tt>.
Requiring <tt>BreakCriticalEdges</tt>, for example, guarantees that there will
be no critical edges in the CFG when your pass has been run.
</p>
@@ -973,7 +977,7 @@ One of the jobs of the PassManager is to optimize how and when analyses are run.
In particular, it attempts to avoid recomputing data unless it needs to. For
this reason, passes are allowed to declare that they preserve (i.e., they don't
invalidate) an existing analysis if it's available. For example, a simple
constant folding pass would not modify the CFG, so it can't possible effect the
constant folding pass would not modify the CFG, so it can't possibly affect the
results of dominator analysis. By default, all passes are assumed to invalidate
all others.
</p>
@@ -1007,9 +1011,9 @@ the fact that it hacks on the CFG.
<pre>
<i>// This is an example implementation from an analysis, which does not modify
// the program at all, yet has a prerequisite.</i>
<b>void</b> <a href="http://llvm.cs.uiuc.edu/doxygen/structllvm_1_1PostDominanceFrontier.html">PostDominanceFrontier</a>::getAnalysisUsage(AnalysisUsage &amp;AU) <b>const</b> {
<b>void</b> <a href="http://llvm.cs.uiuc.edu/doxygen/classllvm_1_1PostDominanceFrontier.html">PostDominanceFrontier</a>::getAnalysisUsage(AnalysisUsage &amp;AU) <b>const</b> {
AU.setPreservesAll();
AU.addRequired&lt;<a href="http://llvm.cs.uiuc.edu/doxygen/structllvm_1_1PostDominatorTree.html">PostDominatorTree</a>&gt;();
AU.addRequired&lt;<a href="http://llvm.cs.uiuc.edu/doxygen/classllvm_1_1PostDominatorTree.html">PostDominatorTree</a>&gt;();
}
</pre>
@@ -1212,7 +1216,7 @@ pass is the default implementation for the interface.</p>
<div class="doc_text">
<p>The <a
href="http:://llvm.cs.uiuc.edu/doxygen/Statistic_8h-source.html"><tt>Statistic</tt></a>
href="http://llvm.cs.uiuc.edu/doxygen/Statistic_8h-source.html"><tt>Statistic</tt></a>
class, is designed to be an easy way to expose various success
metrics from passes. These statistics are printed at the end of a
run, when the -stats command line option is enabled on the command
@@ -1263,7 +1267,7 @@ etc... until the entire program has been run through the passes.
the LLVM program representation for a single function at a time, instead of
traversing the entire program. It reduces the memory consumption of compiler,
because, for example, only one <a
href="http://llvm.cs.uiuc.edu/doxygen/structllvm_1_1DominatorSet.html"><tt>DominatorSet</tt></a>
href="http://llvm.cs.uiuc.edu/doxygen/classllvm_1_1DominatorSet.html"><tt>DominatorSet</tt></a>
needs to be calculated at a time. This also makes it possible some <a
href="#SMP">interesting enhancements</a> in the future.</p></li>
@@ -1287,7 +1291,7 @@ how our <a href="#basiccode">Hello World</a> pass interacts with other passes.
Lets try it out with the <tt>gcse</tt> and <tt>licm</tt> passes:</p>
<pre>
$ opt -load ../../../lib/Debug/libhello.so -gcse -licm --debug-pass=Structure &lt; hello.bc &gt; /dev/null
$ opt -load ../../../Debug/lib/Hello.so -gcse -licm --debug-pass=Structure &lt; hello.bc &gt; /dev/null
Module Pass Manager
Function Pass Manager
Dominator Set Construction
@@ -1324,7 +1328,7 @@ passes.</p>
World</a> pass in between the two passes:</p>
<pre>
$ opt -load ../../../lib/Debug/libhello.so -gcse -hello -licm --debug-pass=Structure &lt; hello.bc &gt; /dev/null
$ opt -load ../../../Debug/lib/Hello.so -gcse -hello -licm --debug-pass=Structure &lt; hello.bc &gt; /dev/null
Module Pass Manager
Function Pass Manager
Dominator Set Construction
@@ -1365,7 +1369,7 @@ href="#getAnalysisUsage"><tt>getAnalysisUsage</tt></a> method to our pass:</p>
<p>Now when we run our pass, we get this output:</p>
<pre>
$ opt -load ../../../lib/Debug/libhello.so -gcse -hello -licm --debug-pass=Structure &lt; hello.bc &gt; /dev/null
$ opt -load ../../../Debug/lib/Hello.so -gcse -hello -licm --debug-pass=Structure &lt; hello.bc &gt; /dev/null
Pass Arguments: -gcse -hello -licm
Module Pass Manager
Function Pass Manager
@@ -1473,8 +1477,8 @@ want:</p>
<pre>
(gdb) <b>break PassManager::run</b>
Breakpoint 1 at 0x2413bc: file Pass.cpp, line 70.
(gdb) <b>run test.bc -load $(LLVMTOP)/llvm/lib/Debug/[libname].so -[passoption]</b>
Starting program: opt test.bc -load $(LLVMTOP)/llvm/lib/Debug/[libname].so -[passoption]
(gdb) <b>run test.bc -load $(LLVMTOP)/llvm/Debug/lib/[libname].so -[passoption]</b>
Starting program: opt test.bc -load $(LLVMTOP)/llvm/Debug/lib/[libname].so -[passoption]
Breakpoint 1, PassManager::run (this=0xffbef174, M=@0x70b298) at Pass.cpp:70
70 bool PassManager::run(Module &amp;M) { return PM-&gt;run(M); }
(gdb)

View File

@@ -536,7 +536,7 @@ COMPACT_LATEX = NO
# by the printer. Possible values are: a4, a4wide, letter, legal and
# executive. If left blank a4wide will be used.
PAPER_TYPE = a4wide
PAPER_TYPE = letter
# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
# packages that should be included in the LaTeX output.

BIN
llvm/docs/img/libdeps.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 141 KiB

BIN
llvm/docs/img/objdeps.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 189 KiB

View File

@@ -10,6 +10,7 @@
<div class="doc_title">Documentation for the LLVM System</div>
<div class="doc_text">
<table class="layout" width="95%"><tr class="layout"><td class="left">
<ul>
<li><a href="#llvmdesign">LLVM Design</a></li>
<li><a href="#userguide">LLVM User Guides</a></li>
@@ -17,6 +18,13 @@
<li><a href="#subsystems">LLVM Subsystem Documentation</a></li>
<li><a href="#maillist">LLVM Mailing Lists</a></li>
</ul>
</td><td class="right">
<form action="http://www.google.com/search" method=get>
<input type="hidden" name="sitesearch" value="llvm.cs.uiuc.edu/docs">
<input type=text name=q size=25><br>
<input type=submit value="Search the LLVM Docs" name="submit">
</form>
</td></tr></table>
</div>
<div class="doc_author">
@@ -51,10 +59,15 @@ Discusses how to get up and running quickly with the LLVM infrastructure.
Everything from unpacking and compilation of the distribution to execution of
some tools.</li>
<li><a href="GettingStartedVS.html">Getting Started with the LLVM System using
Microsoft Visual Studio</a> - An addendum to the main Getting Started guide for
those using Visual Studio on Windows.</li>
<li><a href="CommandGuide/index.html">LLVM Command Guide</a> - A reference
manual for the LLVM command line utilities ("man" pages for LLVM tools).<br/>
Current tools:
<a href="CommandGuide/html/llvm-ar.html">llvm-ar</a>,
<a href="CommandGuide/html/llvm-ranlib.html">llvm-ranlib</a>,
<a href="CommandGuide/html/llvm-as.html">llvm-as</a>,
<a href="CommandGuide/html/llvm-dis.html">llvm-dis</a>,
<a href="CommandGuide/html/opt.html">opt</a>,
@@ -70,7 +83,7 @@ Current tools:
<a href="CommandGuide/html/gccld.html">gccld</a>,
<a href="CommandGuide/html/stkrc.html">stkrc</a>,
<a href="CommandGuide/html/bugpoint.html">bugpoint</a>,
<a href="CommandGuide/html/extract.html">extract</a>,
<a href="CommandGuide/html/llvm-extract.html">llvm-extract</a>,
<a href="CommandGuide/html/llvm-bcanalyzer.html">llvm-bcanalyzer</a>,
<a href="CommandGuide/html/llvmc.html">llvmc</a>
</li>
@@ -127,10 +140,6 @@ Provides information on using the command line parsing library.</li>
Details the LLVM coding standards and provides useful information on writing
efficient C++ code.</li>
<li><a href="OpenProjects.html">Open Projects</a> - Look here if you are
interested in doing something with LLVM but aren't sure what needs to be
done.</li>
<li><a href="ExtendingLLVM.html">Extending LLVM</a> - Look here to see how
to add instructions and intrinsics to LLVM.</li>
@@ -183,13 +192,17 @@ GC'd programs.</li>
LLVM</a> - This document describes the design and philosophy behind the LLVM
source-level debugger.</li>
<li><a href="CommandGuide/html/bugpoint.html">bugpoint</a> - automatic bug
finder and test-case reducer description and usage information.</li>
<li><a href="Bugpoint.html">Bugpoint</a> - automatic bug finder and test-case
reducer description and usage information.</li>
<li><a href="CompilerDriver.html">Compiler Driver (llvmc)</a> - This document
describes the design and configuration of the LLVM compiler driver tool,
<tt>llvmc</tt>.</li>
<li><a href="SystemLibrary.html">System Library</a> - This document describes
the LLVM System Library (<tt>lib/System</tt>) and how to keep LLVM source code
portable</li>
</ul>
<!--=======================================================================-->

View File

@@ -47,11 +47,11 @@ TABLE { text-align: center; border: 2px solid black;
border-bottom: 1px solid #999999; font-size: 12pt;
width: 75%; }
.doc_author { text-align: left; font-weight: bold; padding-left: 20pt }
.doc_text { text-align: left; padding-left: 20pt }
.doc_text { text-align: left; padding-left: 20pt; padding-right: 10pt }
.doc_footer { text-align: left; padding: 0 0 0 0 }
.doc_red { color: red }
.doc_hilite { color: blue; font-weight: bold; }
.doc_table { text-align: center; width: 90%;
padding: 1px 1px 1px 1px; border: 1px; }
@@ -66,6 +66,7 @@ TABLE { text-align: center; border: 2px solid black;
padding: 0 1em 0 1em;
display:table;
}
.doc_notes { background: #fafafa; border: 1px solid #cecece; padding: 1em }
TABLE.layout { text-align: left; border: none; border-collapse: collapse;
padding: 4px 4px 4px 4px; }

View File

@@ -47,7 +47,7 @@ static Function *CreateFibFunction(Module *M) {
Value *Two = ConstantSInt::get(Type::IntTy, 2);
// Get pointer to the integer argument of the add1 function...
Argument *ArgX = FibF->abegin(); // Get the arg.
Argument *ArgX = FibF->arg_begin(); // Get the arg.
ArgX->setName("AnArg"); // Give it a nice symbolic name for fun.
// Create the true_block.
@@ -64,11 +64,14 @@ static Function *CreateFibFunction(Module *M) {
// create fib(x-1)
Value *Sub = BinaryOperator::createSub(ArgX, One, "arg", RecurseBB);
Value *CallFibX1 = new CallInst(FibF, Sub, "fibx1", RecurseBB);
CallInst *CallFibX1 = new CallInst(FibF, Sub, "fibx1", RecurseBB);
CallFibX1->setTailCall();
// create fib(x-2)
Sub = BinaryOperator::createSub(ArgX, Two, "arg", RecurseBB);
Value *CallFibX2 = new CallInst(FibF, Sub, "fibx2", RecurseBB);
CallInst *CallFibX2 = new CallInst(FibF, Sub, "fibx2", RecurseBB);
CallFibX2->setTailCall();
// fib(x-1)+fib(x-2)
Value *Sum = BinaryOperator::createAdd(CallFibX1, CallFibX2,

View File

@@ -61,8 +61,8 @@ int main() {
Value *One = ConstantSInt::get(Type::IntTy, 1);
// Get pointers to the integer argument of the add1 function...
assert(Add1F->abegin() != Add1F->aend()); // Make sure there's an arg
Argument *ArgX = Add1F->abegin(); // Get the arg
assert(Add1F->arg_begin() != Add1F->arg_end()); // Make sure there's an arg
Argument *ArgX = Add1F->arg_begin(); // Get the arg
ArgX->setName("AnArg"); // Give it a nice symbolic name for fun.
// Create the add instruction, inserting it into the end of BB.
@@ -88,6 +88,7 @@ int main() {
std::vector<Value*> Params;
Params.push_back(Ten);
CallInst *Add1CallRes = new CallInst(Add1F, Params, "add1", BB);
Add1CallRes->setTailCall(true);
// Create the return instruction and add it to the basic block.
new ReturnInst(Add1CallRes, BB);

View File

@@ -1,5 +1,12 @@
//===- examples/ModuleMaker/ModuleMaker.cpp - Example project ---*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This programs is a simple example that creates an LLVM module "from scratch",
// emitting it as a bytecode file to standard out. This is just to show how
// LLVM projects work and to demonstrate some of the LLVM APIs.

View File

@@ -7,108 +7,269 @@
//
//===----------------------------------------------------------------------===//
//
// Generic implementation of equivalence classes and implementation of
// union-find algorithms A not-so-fancy implementation: 2 level tree i.e root
// and one more level Overhead of a union = size of the equivalence class being
// attached Overhead of a find = 1.
// Generic implementation of equivalence classes through the use Tarjan's
// efficient union-find algorithm.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_ADT_EQUIVALENCECLASSES_H
#define LLVM_ADT_EQUIVALENCECLASSES_H
#include <map>
#include "llvm/ADT/iterator"
#include "llvm/Support/DataTypes.h"
#include <set>
#include <vector>
namespace llvm {
/// EquivalenceClasses - This represents a collection of equivalence classes and
/// supports three efficient operations: insert an element into a class of its
/// own, union two classes, and find the class for a given element. In
/// addition to these modification methods, it is possible to iterate over all
/// of the equivalence classes and all of the elements in a class.
///
/// This implementation is an efficient implementation that only stores one copy
/// of the element being indexed per entry in the set, and allows any arbitrary
/// type to be indexed (as long as it can be ordered with operator<).
///
/// Here is a simple example using integers:
///
/// EquivalenceClasses<int> EC;
/// EC.unionSets(1, 2); // insert 1, 2 into the same set
/// EC.insert(4); EC.insert(5); // insert 4, 5 into own sets
/// EC.unionSets(5, 1); // merge the set for 1 with 5's set.
///
/// for (EquivalenceClasses<int>::iterator I = EC.begin(), E = EC.end();
/// I != E; ++I) { // Iterate over all of the equivalence sets.
/// if (!I->isLeader()) continue; // Ignore non-leader sets.
/// for (EquivalenceClasses<int>::member_iterator MI = EC.member_begin(I);
/// MI != EC.member_end(); ++MI) // Loop over members in this set.
/// std::cerr << *MI << " "; // Print member.
/// std::cerr << "\n"; // Finish set.
/// }
///
/// This example prints:
/// 4
/// 5 1 2
///
template <class ElemTy>
class EquivalenceClasses {
// Maps each element to the element that is the leader of its
// equivalence class.
std::map<ElemTy, ElemTy> Elem2LeaderMap;
/// ECValue - The EquivalenceClasses data structure is just a set of these.
/// Each of these represents a relation for a value. First it stores the
/// value itself, which provides the ordering that the set queries. Next, it
/// provides a "next pointer", which is used to enumerate all of the elements
/// in the unioned set. Finally, it defines either a "end of list pointer" or
/// "leader pointer" depending on whether the value itself is a leader. A
/// "leader pointer" points to the node that is the leader for this element,
/// if the node is not a leader. A "end of list pointer" points to the last
/// node in the list of members of this list. Whether or not a node is a
/// leader is determined by a bit stolen from one of the pointers.
class ECValue {
friend class EquivalenceClasses;
mutable const ECValue *Leader, *Next;
ElemTy Data;
// ECValue ctor - Start out with EndOfList pointing to this node, Next is
// Null, isLeader = true.
ECValue(const ElemTy &Elt)
: Leader(this), Next((ECValue*)(intptr_t)1), Data(Elt) {}
// Maintains the set of leaders
std::set<ElemTy> LeaderSet;
// Caches the equivalence class for each leader
std::map<ElemTy, std::set<ElemTy> > LeaderToEqClassMap;
// Make Element2 the leader of the union of classes Element1 and Element2
// Element1 and Element2 are presumed to be leaders of their respective
// equivalence classes.
void attach(ElemTy Element1, ElemTy Element2) {
for (typename std::map<ElemTy, ElemTy>::iterator ElemI =
Elem2LeaderMap.begin(), ElemE = Elem2LeaderMap.end();
ElemI != ElemE; ++ElemI) {
if (ElemI->second == Element1)
Elem2LeaderMap[ElemI->first] = Element2;
const ECValue *getLeader() const {
if (isLeader()) return this;
if (Leader->isLeader()) return Leader;
// Path compression.
return Leader = Leader->getLeader();
}
const ECValue *getEndOfList() const {
assert(isLeader() && "Cannot get the end of a list for a non-leader!");
return Leader;
}
void setNext(const ECValue *NewNext) const {
assert(getNext() == 0 && "Already has a next pointer!");
Next = (const ECValue*)((intptr_t)NewNext | (intptr_t)isLeader());
}
public:
ECValue(const ECValue &RHS) : Leader(this), Next((ECValue*)(intptr_t)1),
Data(RHS.Data) {
// Only support copying of singleton nodes.
assert(RHS.isLeader() && RHS.getNext() == 0 && "Not a singleton!");
}
bool operator<(const ECValue &UFN) const { return Data < UFN.Data; }
bool isLeader() const { return (intptr_t)Next & 1; }
const ElemTy &getData() const { return Data; }
const ECValue *getNext() const {
return (ECValue*)((intptr_t)Next & ~(intptr_t)1);
}
template<typename T>
bool operator<(const T &Val) const { return Data < Val; }
};
/// TheMapping - This implicitly provides a mapping from ElemTy values to the
/// ECValues, it just keeps the key as part of the value.
std::set<ECValue> TheMapping;
public:
// If an element has not yet in any class, make it a separate new class.
// Return the leader of the class containing the element.
ElemTy addElement (ElemTy NewElement) {
typename std::map<ElemTy, ElemTy>::iterator ElemI =
Elem2LeaderMap.find(NewElement);
if (ElemI == Elem2LeaderMap.end()) {
Elem2LeaderMap[NewElement] = NewElement;
LeaderSet.insert(NewElement);
return NewElement;
}
else
return ElemI->second;
EquivalenceClasses() {}
EquivalenceClasses(const EquivalenceClasses &RHS) {
operator=(RHS);
}
ElemTy findClass(ElemTy Element) const {
typename std::map<ElemTy, ElemTy>::const_iterator I =
Elem2LeaderMap.find(Element);
return (I == Elem2LeaderMap.end())? (ElemTy) 0 : I->second;
const EquivalenceClasses &operator=(const EquivalenceClasses &RHS) {
TheMapping.clear();
for (iterator I = RHS.begin(), E = RHS.end(); I != E; ++I)
if (I->isLeader()) {
member_iterator MI = RHS.member_begin(I);
member_iterator LeaderIt = member_begin(insert(*MI));
for (++MI; MI != member_end(); ++MI)
unionSets(LeaderIt, member_begin(insert(*MI)));
}
return *this;
}
/// Attach the set with Element1 to the set with Element2 adding Element1 and
/// Element2 to the set of equivalence classes if they are not there already.
/// Implication: Make Element1 the element in the smaller set.
/// Take Leader[Element1] out of the set of leaders.
void unionSetsWith(ElemTy Element1, ElemTy Element2) {
// If either Element1 or Element2 does not already exist, include it
const ElemTy& leader1 = addElement(Element1);
const ElemTy& leader2 = addElement(Element2);
assert(leader1 != (ElemTy) 0 && leader2 != (ElemTy) 0);
if (leader1 != leader2) {
attach(leader1, leader2);
LeaderSet.erase(leader1);
//===--------------------------------------------------------------------===//
// Inspection methods
//
/// iterator* - Provides a way to iterate over all values in the set.
typedef typename std::set<ECValue>::const_iterator iterator;
iterator begin() const { return TheMapping.begin(); }
iterator end() const { return TheMapping.end(); }
/// member_* Iterate over the members of an equivalence class.
///
class member_iterator;
member_iterator member_begin(iterator I) const {
// Only leaders provide anything to iterate over.
return member_iterator(I->isLeader() ? &*I : 0);
}
member_iterator member_end() const {
return member_iterator(0);
}
// Returns a vector containing all the elements in the equivalence class
// including Element1
const std::set<ElemTy> & getEqClass(ElemTy Element1) {
assert(Elem2LeaderMap.find(Element1) != Elem2LeaderMap.end());
const ElemTy classLeader = Elem2LeaderMap[Element1];
std::set<ElemTy> & EqClass = LeaderToEqClassMap[classLeader];
// If the EqClass vector is empty, it has not been computed yet: do it now
if (EqClass.empty()) {
for (typename std::map<ElemTy, ElemTy>::iterator
ElemI = Elem2LeaderMap.begin(), ElemE = Elem2LeaderMap.end();
ElemI != ElemE; ++ElemI)
if (ElemI->second == classLeader)
EqClass.insert(ElemI->first);
assert(! EqClass.empty()); // must at least include the leader
/// findValue - Return an iterator to the specified value. If it does not
/// exist, end() is returned.
iterator findValue(const ElemTy &V) const {
return TheMapping.find(V);
}
return EqClass;
/// getLeaderValue - Return the leader for the specified value that is in the
/// set. It is an error to call this method for a value that is not yet in
/// the set. For that, call getOrInsertLeaderValue(V).
const ElemTy &getLeaderValue(const ElemTy &V) const {
member_iterator MI = findLeader(V);
assert(MI != member_end() && "Value is not in the set!");
return *MI;
}
std::set<ElemTy>& getLeaderSet() { return LeaderSet; }
const std::set<ElemTy>& getLeaderSet() const { return LeaderSet; }
/// getOrInsertLeaderValue - Return the leader for the specified value that is
/// in the set. If the member is not in the set, it is inserted, then
/// returned.
const ElemTy &getOrInsertLeaderValue(const ElemTy &V) const {
member_iterator MI = findLeader(insert(V));
assert(MI != member_end() && "Value is not in the set!");
return *MI;
}
std::map<ElemTy, ElemTy>& getLeaderMap() { return Elem2LeaderMap;}
const std::map<ElemTy, ElemTy>& getLeaderMap() const { return Elem2LeaderMap;}
/// getNumClasses - Return the number of equivalence classes in this set.
/// Note that this is a linear time operation.
unsigned getNumClasses() const {
unsigned NC = 0;
for (iterator I = begin(), E = end(); I != E; ++I)
if (I->isLeader()) ++NC;
return NC;
}
//===--------------------------------------------------------------------===//
// Mutation methods
/// insert - Insert a new value into the union/find set, ignoring the request
/// if the value already exists.
iterator insert(const ElemTy &Data) {
return TheMapping.insert(Data).first;
}
/// findLeader - Given a value in the set, return a member iterator for the
/// equivalence class it is in. This does the path-compression part that
/// makes union-find "union findy". This returns an end iterator if the value
/// is not in the equivalence class.
///
member_iterator findLeader(iterator I) const {
if (I == TheMapping.end()) return member_end();
return member_iterator(I->getLeader());
}
member_iterator findLeader(const ElemTy &V) const {
return findLeader(TheMapping.find(V));
}
/// union - Merge the two equivalence sets for the specified values, inserting
/// them if they do not already exist in the equivalence set.
member_iterator unionSets(const ElemTy &V1, const ElemTy &V2) {
iterator V1I = insert(V1), V2I = insert(V2);
return unionSets(findLeader(V1I), findLeader(V2I));
}
member_iterator unionSets(member_iterator L1, member_iterator L2) {
assert(L1 != member_end() && L2 != member_end() && "Illegal inputs!");
if (L1 == L2) return L1; // Unifying the same two sets, noop.
// Otherwise, this is a real union operation. Set the end of the L1 list to
// point to the L2 leader node.
const ECValue &L1LV = *L1.Node, &L2LV = *L2.Node;
L1LV.getEndOfList()->setNext(&L2LV);
// Update L1LV's end of list pointer.
L1LV.Leader = L2LV.getEndOfList();
// Clear L2's leader flag:
L2LV.Next = L2LV.getNext();
// L2's leader is now L1.
L2LV.Leader = &L1LV;
return L1;
}
class member_iterator : public forward_iterator<ElemTy, ptrdiff_t> {
typedef forward_iterator<const ElemTy, ptrdiff_t> super;
const ECValue *Node;
friend class EquivalenceClasses;
public:
typedef size_t size_type;
typedef typename super::pointer pointer;
typedef typename super::reference reference;
explicit member_iterator() {}
explicit member_iterator(const ECValue *N) : Node(N) {}
member_iterator(const member_iterator &I) : Node(I.Node) {}
reference operator*() const {
assert(Node != 0 && "Dereferencing end()!");
return Node->getData();
}
reference operator->() const { return operator*(); }
member_iterator &operator++() {
assert(Node != 0 && "++'d off the end of the list!");
Node = Node->getNext();
return *this;
}
member_iterator operator++(int) { // postincrement operators.
member_iterator tmp = *this;
++*this;
return tmp;
}
bool operator==(const member_iterator &RHS) const {
return Node == RHS.Node;
}
bool operator!=(const member_iterator &RHS) const {
return Node != RHS.Node;
}
};
};
} // End llvm namespace

View File

@@ -23,12 +23,6 @@
// Cannot specialize hash template from outside of the std namespace.
namespace HASH_NAMESPACE {
template <> struct hash<std::string> {
size_t operator()(std::string const &str) const {
return hash<char const *>()(str.c_str());
}
};
// Provide a hash function for arbitrary pointers...
template <class T> struct hash<T *> {
inline size_t operator()(const T *Val) const {
@@ -36,6 +30,12 @@ template <class T> struct hash<T *> {
}
};
template <> struct hash<std::string> {
size_t operator()(std::string const &str) const {
return hash<char const *>()(str.c_str());
}
};
} // End namespace std
#endif

View File

@@ -27,39 +27,6 @@ namespace llvm {
// Extra additions to <functional>
//===----------------------------------------------------------------------===//
// bind_obj - Often times you want to apply the member function of an object
// as a unary functor. This macro is shorthand that makes it happen less
// verbosely.
//
// Example:
// struct Summer { void accumulate(int x); }
// vector<int> Numbers;
// Summer MyS;
// for_each(Numbers.begin(), Numbers.end(),
// bind_obj(&MyS, &Summer::accumulate));
//
// TODO: When I get lots of extra time, convert this from an evil macro
//
#define bind_obj(OBJ, METHOD) std::bind1st(std::mem_fun(METHOD), OBJ)
// bitwise_or - This is a simple functor that applys operator| on its two
// arguments to get a boolean result.
//
template<class Ty>
struct bitwise_or : public std::binary_function<Ty, Ty, bool> {
bool operator()(const Ty& left, const Ty& right) const {
return left | right;
}
};
template<class Ty>
struct less_ptr : public std::binary_function<Ty, Ty, bool> {
bool operator()(const Ty* left, const Ty* right) const {
return *left < *right;
}
};
template<class Ty>
struct greater_ptr : public std::binary_function<Ty, Ty, bool> {
bool operator()(const Ty* left, const Ty* right) const {
@@ -187,79 +154,6 @@ inline ItTy prior(ItTy it)
return it;
}
//===----------------------------------------------------------------------===//
// Extra additions to <algorithm>
//===----------------------------------------------------------------------===//
// apply_until - Apply a functor to a sequence continually, unless the
// functor returns true. Return true if the functor returned true, return false
// if the functor never returned true.
//
template <class InputIt, class Function>
bool apply_until(InputIt First, InputIt Last, Function Func) {
for ( ; First != Last; ++First)
if (Func(*First)) return true;
return false;
}
// reduce - Reduce a sequence values into a single value, given an initial
// value and an operator.
//
template <class InputIt, class Function, class ValueType>
ValueType reduce(InputIt First, InputIt Last, Function Func, ValueType Value) {
for ( ; First != Last; ++First)
Value = Func(*First, Value);
return Value;
}
#if 1 // This is likely to be more efficient
// reduce_apply - Reduce the result of applying a function to each value in a
// sequence, given an initial value, an operator, a function, and a sequence.
//
template <class InputIt, class Function, class ValueType, class TransFunc>
inline ValueType reduce_apply(InputIt First, InputIt Last, Function Func,
ValueType Value, TransFunc XForm) {
for ( ; First != Last; ++First)
Value = Func(XForm(*First), Value);
return Value;
}
#else // This is arguably more elegant
// reduce_apply - Reduce the result of applying a function to each value in a
// sequence, given an initial value, an operator, a function, and a sequence.
//
template <class InputIt, class Function, class ValueType, class TransFunc>
inline ValueType reduce_apply2(InputIt First, InputIt Last, Function Func,
ValueType Value, TransFunc XForm) {
return reduce(map_iterator(First, XForm), map_iterator(Last, XForm),
Func, Value);
}
#endif
// reduce_apply_bool - Reduce the result of applying a (bool returning) function
// to each value in a sequence. All of the bools returned by the mapped
// function are bitwise or'd together, and the result is returned.
//
template <class InputIt, class Function>
inline bool reduce_apply_bool(InputIt First, InputIt Last, Function Func) {
return reduce_apply(First, Last, bitwise_or<bool>(), false, Func);
}
// map - This function maps the specified input sequence into the specified
// output iterator, applying a unary function in between.
//
template <class InIt, class OutIt, class Functor>
inline OutIt mapto(InIt Begin, InIt End, OutIt Dest, Functor F) {
return copy(map_iterator(Begin, F), map_iterator(End, F), Dest);
}
//===----------------------------------------------------------------------===//
// Extra additions to <utility>
//===----------------------------------------------------------------------===//

View File

@@ -29,7 +29,7 @@ static inline std::string utohexstr(uint64_t X) {
if (X == 0) *--BufPtr = '0'; // Handle special case...
while (X) {
unsigned char Mod = (unsigned char)X & 15;
unsigned char Mod = static_cast<unsigned char>(X) & 15;
if (Mod < 10)
*--BufPtr = '0' + Mod;
else
@@ -100,14 +100,16 @@ static inline std::string itostr(int X) {
static inline std::string ftostr(double V) {
char Buffer[200];
sprintf(Buffer, "%20.6e", V);
return Buffer;
char *B = Buffer;
while (*B == ' ') ++B;
return B;
}
static inline std::string LowercaseString(const std::string &S) {
std::string result(S);
for (unsigned i = 0; i < S.length(); ++i)
if (isupper(result[i]))
result[i] = (char)tolower(result[i]);
result[i] = char(tolower(result[i]));
return result;
}

View File

@@ -23,11 +23,13 @@
// 2.95.x :: hash_map
// 3.0.4 std ext/hash_map
// 3.1 __gnu_cxx ext/hash_map
// HP aCC6 std stdex/rw/hashm*ap.h
//
#undef HAVE_GNU_EXT_HASH_MAP
#undef HAVE_STD_EXT_HASH_MAP
#undef HAVE_GLOBAL_HASH_MAP
#undef HAVE_RW_STDEX_HASH_MAP_H
#if HAVE_GNU_EXT_HASH_MAP
// This is for GCC-3.1+ which puts hash in ext/hash_map
@@ -51,12 +53,51 @@
# define HASH_NAMESPACE std
# endif
// HP aCC doesn't include an SGI-like hash_map. For this platform (or
// any others using Rogue Wave Software's Tools.h++ library), we wrap
// around them in std::
#elif HAVE_RW_STDEX_HASH_MAP_H
# include <rw/stdex/hashmap.h>
# include <rw/stdex/hashmmap.h>
# ifndef HASH_NAMESPACE
# define HASH_NAMESPACE std
# endif
// Give a warning if we couldn't find it, instead of (or in addition to)
// randomly doing something dumb.
#else
# warning "Autoconfiguration failed to find the hash_map header file."
#endif
// we wrap Rogue Wave Tools.h++ rw_hashmap into something SGI-looking, here:
#ifdef HAVE_RW_STDEX_HASH_MAP_H
namespace HASH_NAMESPACE {
template <class DataType> struct hash {
unsigned int operator()(const unsigned int& x) const {
return x;
}
};
template <typename KeyType,
typename ValueType,
class _HashFcn = hash<KeyType>,
class _EqualKey = equal_to<KeyType>,
class _A = allocator <ValueType> >
class hash_map : public rw_hashmap<KeyType, ValueType, class _HashFcn, class _EqualKey, class _A> {
};
template <typename KeyType,
typename ValueType,
class _HashFcn = hash<KeyType>,
class _EqualKey = equal_to<KeyType>,
class _A = allocator <ValueType> >
class hash_multimap : public rw_hashmultimap<KeyType, ValueType, class _HashFcn, class _EqualKey, class _A> {
};
} // end HASH_NAMESPACE;
#endif
using HASH_NAMESPACE::hash_map;
using HASH_NAMESPACE::hash_multimap;
using HASH_NAMESPACE::hash;
@@ -65,6 +106,35 @@ using HASH_NAMESPACE::hash;
// out specializations like stl_bvector.h, causing link conflicts.
#include <vector>
#ifdef _MSC_VER
// GCC and VC++ have differing ways of implementing hash_maps. As it's not
// standardized, that's to be expected. This adapter class allows VC++
// hash_map to use GCC's hash classes.
namespace stdext {
template<class Key> struct hash;
// Provide a hash function for unsigned ints...
template<> struct hash<unsigned int> {
inline size_t operator()(unsigned int Val) const {
return Val;
}
};
template<class Key> class hash_compare<Key, std::less<Key> > {
std::less<Key> comp;
public:
enum { bucket_size = 4 };
enum { min_buckets = 8 };
hash_compare() {}
hash_compare(std::less<Key> pred) : comp(pred) {}
size_t operator()(const Key& key) const { return hash<Key>()(key); }
bool operator()(const Key& k1, const Key& k2) const { return comp(k1, k2); }
};
}
#endif
#include "llvm/ADT/HashExtras.h"
#endif

View File

@@ -24,11 +24,13 @@
// 2.95.x :: hash_set
// 3.0.4 std ext/hash_set
// 3.1 __gnu_cxx ext/hash_set
// HP aCC6 std stdex/rw/hashset.h
//
#undef HAVE_GNU_EXT_HASH_SET
#undef HAVE_STD_EXT_HASH_SET
#undef HAVE_GLOBAL_HASH_SET
#undef HAVE_RW_STDEX_HASH_SET_H
// GCC versions 3.1 and later put hash_set in <ext/hash_set> and in
// the __gnu_cxx namespace.
@@ -53,12 +55,43 @@
# define HASH_NAMESPACE std
# endif
// HP aCC doesn't include an SGI-like hash_set. For this platform (or
// any others using Rogue Wave Software's Tools.h++ library), we wrap
// around them in std::
#elif HAVE_RW_STDEX_HASH_SET_H
# include <rw/stdex/hashset.h>
# ifndef HASH_NAMESPACE
# define HASH_NAMESPACE std
# endif
// Give a warning if we couldn't find it, instead of (or in addition to)
// randomly doing something dumb.
#else
# warning "Autoconfiguration failed to find the hash_set header file."
#endif
// we wrap Rogue Wave Tools.h++ rw_hashset into something SGI-looking, here:
#ifdef HAVE_RW_STDEX_HASH_SET_H
namespace HASH_NAMESPACE {
/*
template <class DataType> struct hash {
unsigned int operator()(const unsigned int& x) const {
return x;
}
};
*/
template <typename ValueType,
class _HashFcn = hash<ValueType>,
class _EqualKey = equal_to<ValueType>,
class _A = allocator <ValueType> >
class hash_set : public rw_hashset<ValueType, class _HashFcn, class _EqualKey, class _A> {
};
} // end HASH_NAMESPACE;
#endif
using HASH_NAMESPACE::hash_set;
using HASH_NAMESPACE::hash;

View File

@@ -58,9 +58,10 @@ struct ilist_traits {
static void setPrev(NodeTy *N, NodeTy *Prev) { N->setPrev(Prev); }
static void setNext(NodeTy *N, NodeTy *Next) { N->setNext(Next); }
static NodeTy *createNode() { return new NodeTy(); }
static NodeTy *createNode(const NodeTy &V) { return new NodeTy(V); }
static NodeTy *createSentinel() { return new NodeTy(); }
static void destroySentinel(NodeTy *N) { delete N; }
void addNodeToList(NodeTy *NTy) {}
void removeNodeFromList(NodeTy *NTy) {}
@@ -168,93 +169,6 @@ void operator+(int, ilist_iterator<T>);
template<typename T>
void operator+(ilist_iterator<T>,int);
//===----------------------------------------------------------------------===//
// ilist_compat_iterator<Node> - Compatibility iterator for intrusive list.
// This makes an ilist<X> act like an std::list<X*>, where you have to
// dereference stuff multiple times. This should only be used for temporary
// migration purposes. Because we don't support "changing the pointer", we only
// expose constant pointers.
//
template<typename NodeTy>
class ilist_compat_iterator
: public bidirectional_iterator<NodeTy* const, ptrdiff_t> {
typedef ilist_traits<NodeTy> Traits;
typedef bidirectional_iterator<NodeTy* const, ptrdiff_t> super;
public:
typedef size_t size_type;
typedef typename super::pointer pointer;
typedef typename super::reference reference;
private:
NodeTy *NodePtr;
public:
ilist_compat_iterator(NodeTy *NP) : NodePtr(NP) {}
ilist_compat_iterator() : NodePtr(0) {}
// This is templated so that we can allow constructing a const iterator from
// a nonconst iterator...
template<class node_ty>
ilist_compat_iterator(const ilist_compat_iterator<node_ty> &RHS)
: NodePtr(RHS.getNodePtrUnchecked()) {}
// This is templated so that we can allow assigning to a const iterator from
// a nonconst iterator...
template<class node_ty>
const ilist_compat_iterator &operator=(const
ilist_compat_iterator<node_ty> &RHS) {
NodePtr = RHS.getNodePtrUnchecked();
return *this;
}
// Accessors...
operator pointer() const {
assert(Traits::getNext(NodePtr) != 0 && "Dereferencing end()!");
return &NodePtr;
}
reference operator*() const {
assert(Traits::getNext(NodePtr) != 0 && "Dereferencing end()!");
return NodePtr;
}
pointer operator->() { return &operator*(); }
const pointer operator->() const { return &operator*(); }
// Comparison operators
bool operator==(const ilist_compat_iterator &RHS) const {
return NodePtr == RHS.NodePtr;
}
bool operator!=(const ilist_compat_iterator &RHS) const {
return NodePtr != RHS.NodePtr;
}
// Increment and decrement operators...
ilist_compat_iterator &operator--() { // predecrement - Back up
NodePtr = Traits::getPrev(NodePtr);
assert(NodePtr && "--'d off the beginning of an ilist!");
return *this;
}
ilist_compat_iterator &operator++() { // preincrement - Advance
NodePtr = Traits::getNext(NodePtr);
assert(NodePtr && "++'d off the end of an ilist!");
return *this;
}
ilist_compat_iterator operator--(int) { // postdecrement operators...
ilist_compat_iterator tmp = *this;
--*this;
return tmp;
}
ilist_compat_iterator operator++(int) { // postincrement operators...
ilist_compat_iterator tmp = *this;
++*this;
return tmp;
}
// Internal interface, do not use...
pointer getNodePtrUnchecked() const { return NodePtr; }
};
// Allow ilist_iterators to convert into pointers to a node automatically when
// used by the dyn_cast, cast, isa mechanisms...
@@ -301,11 +215,11 @@ public:
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
typedef std::reverse_iterator<iterator> reverse_iterator;
iplist() : Head(Traits::createNode()), Tail(Head) {
iplist() : Head(Traits::createSentinel()), Tail(Head) {
setNext(Head, 0);
setPrev(Head, 0);
}
~iplist() { clear(); delete Tail; }
~iplist() { clear(); Traits::destroySentinel(Tail); }
// Iterator creation methods.
iterator begin() { return iterator(Head); }
@@ -320,11 +234,6 @@ public:
const_reverse_iterator rend() const {return const_reverse_iterator(begin());}
// "compatibility" iterator creation methods.
typedef ilist_compat_iterator<NodeTy> compat_iterator;
compat_iterator compat_begin() const { return compat_iterator(Head); }
compat_iterator compat_end() const { return compat_iterator(Tail); }
// Miscellaneous inspection routines.
size_type max_size() const { return size_type(-1); }
bool empty() const { return Head == Tail; }

View File

@@ -100,6 +100,93 @@ public:
///
virtual bool pointsToConstantMemory(const Value *P);
//===--------------------------------------------------------------------===//
/// Simple mod/ref information...
///
/// ModRefResult - Represent the result of a mod/ref query. Mod and Ref are
/// bits which may be or'd together.
///
enum ModRefResult { NoModRef = 0, Ref = 1, Mod = 2, ModRef = 3 };
/// ModRefBehavior - Summary of how a function affects memory in the program.
/// Loads from constant globals are not considered memory accesses for this
/// interface. Also, functions may freely modify stack space local to their
/// invocation without having to report it through these interfaces.
enum ModRefBehavior {
// DoesNotAccessMemory - This function does not perform any non-local loads
// or stores to memory.
//
// This property corresponds to the GCC 'const' attribute.
DoesNotAccessMemory,
// AccessesArguments - This function accesses function arguments in
// non-volatile and well known ways, but does not access any other memory.
//
// Clients may call getArgumentAccesses to get specific information about
// how pointer arguments are used.
AccessesArguments,
// AccessesArgumentsAndGlobals - This function has accesses function
// arguments and global variables in non-volatile and well-known ways, but
// does not access any other memory.
//
// Clients may call getArgumentAccesses to get specific information about
// how pointer arguments and globals are used.
AccessesArgumentsAndGlobals,
// OnlyReadsMemory - This function does not perform any non-local stores or
// volatile loads, but may read from any memory location.
//
// This property corresponds to the GCC 'pure' attribute.
OnlyReadsMemory,
// UnknownModRefBehavior - This indicates that the function could not be
// classified into one of the behaviors above.
UnknownModRefBehavior
};
/// PointerAccessInfo - This struct is used to return results for pointers,
/// globals, and the return value of a function.
struct PointerAccessInfo {
/// V - The value this record corresponds to. This may be an Argument for
/// the function, a GlobalVariable, or null, corresponding to the return
/// value for the function.
Value *V;
/// ModRefInfo - Whether the pointer is loaded or stored to/from.
///
ModRefResult ModRefInfo;
/// AccessType - Specific fine-grained access information for the argument.
/// If none of these classifications is general enough, the
/// getModRefBehavior method should not return AccessesArguments*. If a
/// record is not returned for a particular argument, the argument is never
/// dead and never dereferenced.
enum AccessType {
/// ScalarAccess - The pointer is dereferenced.
///
ScalarAccess,
/// ArrayAccess - The pointer is indexed through as an array of elements.
///
ArrayAccess,
/// ElementAccess ?? P->F only?
/// CallsThrough - Indirect calls are made through the specified function
/// pointer.
CallsThrough,
};
};
/// getModRefBehavior - Return the behavior of the specified function if
/// called from the specified call site. The call site may be null in which
/// case the most generic behavior of this function should be returned.
virtual ModRefBehavior getModRefBehavior(Function *F, CallSite CS,
std::vector<PointerAccessInfo> *Info = 0);
/// doesNotAccessMemory - If the specified function is known to never read or
/// write memory, return true. If the function only reads from known-constant
/// memory, it is also legal to return true. Functions that unwind the stack
@@ -111,7 +198,9 @@ public:
///
/// This property corresponds to the GCC 'const' attribute.
///
virtual bool doesNotAccessMemory(Function *F);
bool doesNotAccessMemory(Function *F) {
return getModRefBehavior(F, CallSite()) == DoesNotAccessMemory;
}
/// onlyReadsMemory - If the specified function is known to only read from
/// non-volatile memory (or not access memory at all), return true. Functions
@@ -122,18 +211,14 @@ public:
///
/// This property corresponds to the GCC 'pure' attribute.
///
virtual bool onlyReadsMemory(Function *F);
bool onlyReadsMemory(Function *F) {
/// FIXME: If the analysis returns more precise info, we can reduce it to
/// this.
ModRefBehavior MRB = getModRefBehavior(F, CallSite());
return MRB == DoesNotAccessMemory || MRB == OnlyReadsMemory;
}
//===--------------------------------------------------------------------===//
/// Simple mod/ref information...
///
/// ModRefResult - Represent the result of a mod/ref query. Mod and Ref are
/// bits which may be or'd together.
///
enum ModRefResult { NoModRef = 0, Ref = 1, Mod = 2, ModRef = 3 };
/// getModRefInfo - Return information about whether or not an instruction may
/// read or write memory specified by the pointer operand. An instruction
/// that doesn't read or write memory may be trivially LICM'd for example.

View File

@@ -16,6 +16,9 @@
#define LLVM_ANALYSIS_DSGRAPH_H
#include "llvm/Analysis/DataStructure/DSNode.h"
#include "llvm/ADT/hash_map"
#include "llvm/ADT/EquivalenceClasses.h"
#include <list>
namespace llvm {
@@ -38,7 +41,12 @@ class DSScalarMap {
typedef hash_set<GlobalValue*> GlobalSetTy;
GlobalSetTy GlobalSet;
EquivalenceClasses<GlobalValue*> &GlobalECs;
public:
DSScalarMap(EquivalenceClasses<GlobalValue*> &ECs) : GlobalECs(ECs) {}
EquivalenceClasses<GlobalValue*> &getGlobalECs() const { return GlobalECs; }
// Compatibility methods: provide an interface compatible with a map of
// Value* to DSNodeHandle's.
@@ -48,11 +56,60 @@ public:
iterator end() { return ValueMap.end(); }
const_iterator begin() const { return ValueMap.begin(); }
const_iterator end() const { return ValueMap.end(); }
iterator find(Value *V) { return ValueMap.find(V); }
const_iterator find(Value *V) const { return ValueMap.find(V); }
unsigned count(Value *V) const { return ValueMap.count(V); }
void erase(Value *V) { erase(find(V)); }
GlobalValue *getLeaderForGlobal(GlobalValue *GV) const {
EquivalenceClasses<GlobalValue*>::iterator ECI = GlobalECs.findValue(GV);
if (ECI == GlobalECs.end()) return GV;
return *GlobalECs.findLeader(ECI);
}
iterator find(Value *V) {
iterator I = ValueMap.find(V);
if (I != ValueMap.end()) return I;
if (GlobalValue *GV = dyn_cast<GlobalValue>(V)) {
// If this is a global, check to see if it is equivalenced to something
// in the map.
GlobalValue *Leader = getLeaderForGlobal(GV);
if (Leader != GV)
I = ValueMap.find((Value*)Leader);
}
return I;
}
const_iterator find(Value *V) const {
const_iterator I = ValueMap.find(V);
if (I != ValueMap.end()) return I;
if (GlobalValue *GV = dyn_cast<GlobalValue>(V)) {
// If this is a global, check to see if it is equivalenced to something
// in the map.
GlobalValue *Leader = getLeaderForGlobal(GV);
if (Leader != GV)
I = ValueMap.find((Value*)Leader);
}
return I;
}
/// getRawEntryRef - This method can be used by clients that are aware of the
/// global value equivalence class in effect.
DSNodeHandle &getRawEntryRef(Value *V) {
std::pair<iterator,bool> IP =
ValueMap.insert(std::make_pair(V, DSNodeHandle()));
if (IP.second) // Inserted the new entry into the map.
if (GlobalValue *GV = dyn_cast<GlobalValue>(V))
GlobalSet.insert(GV);
return IP.first->second;
}
unsigned count(Value *V) const { return ValueMap.find(V) != ValueMap.end(); }
void erase(Value *V) { erase(ValueMap.find(V)); }
void eraseIfExists(Value *V) {
iterator I = find(V);
if (I != end()) erase(I);
}
/// replaceScalar - When an instruction needs to be modified, this method can
/// be used to update the scalar map to remove the old and insert the new.
@@ -64,14 +121,25 @@ public:
erase(I);
}
DSNodeHandle &operator[](Value *V) {
std::pair<iterator,bool> IP =
ValueMap.insert(std::make_pair(V, DSNodeHandle()));
if (IP.second) { // Inserted the new entry into the map.
if (GlobalValue *GV = dyn_cast<GlobalValue>(V))
GlobalSet.insert(GV);
/// copyScalarIfExists - If Old exists in the scalar map, make New point to
/// whatever Old did.
void copyScalarIfExists(Value *Old, Value *New) {
iterator I = find(Old);
if (I != end())
ValueMap.insert(std::make_pair(New, I->second));
}
return IP.first->second;
/// operator[] - Return the DSNodeHandle for the specified value, creating a
/// new null handle if there is no entry yet.
DSNodeHandle &operator[](Value *V) {
iterator I = ValueMap.find(V);
if (I != ValueMap.end())
return I->second; // Return value if already exists.
if (GlobalValue *GV = dyn_cast<GlobalValue>(V))
return AddGlobal(GV);
return ValueMap.insert(std::make_pair(V, DSNodeHandle())).first->second;
}
void erase(iterator I) {
@@ -86,28 +154,40 @@ public:
GlobalSet.clear();
}
/// spliceFrom - Copy all entries from RHS, then clear RHS.
///
void spliceFrom(DSScalarMap &RHS);
// Access to the global set: the set of all globals currently in the
// scalar map.
typedef GlobalSetTy::const_iterator global_iterator;
global_iterator global_begin() const { return GlobalSet.begin(); }
global_iterator global_end() const { return GlobalSet.end(); }
unsigned global_size() const { return GlobalSet.size(); }
unsigned global_count(GlobalValue *GV) const { return GlobalSet.count(GV); }
private:
DSNodeHandle &AddGlobal(GlobalValue *GV);
};
//===----------------------------------------------------------------------===//
/// DSGraph - The graph that represents a function.
///
struct DSGraph {
class DSGraph {
public:
// Public data-type declarations...
typedef DSScalarMap ScalarMapTy;
typedef hash_map<Function*, DSNodeHandle> ReturnNodesTy;
typedef hash_set<GlobalValue*> GlobalSetTy;
typedef ilist<DSNode> NodeListTy;
/// NodeMapTy - This data type is used when cloning one graph into another to
/// keep track of the correspondence between the nodes in the old and new
/// graphs.
typedef hash_map<const DSNode*, DSNodeHandle> NodeMapTy;
// InvNodeMapTy - This data type is used to represent the inverse of a node
// map.
typedef hash_multimap<DSNodeHandle, const DSNode*> InvNodeMapTy;
private:
DSGraph *GlobalsGraph; // Pointer to the common graph of global objects
bool PrintAuxCalls; // Should this graph print the Aux calls vector?
@@ -121,38 +201,34 @@ private:
//
ReturnNodesTy ReturnNodes;
// FunctionCalls - This vector maintains a single entry for each call
// FunctionCalls - This list maintains a single entry for each call
// instruction in the current graph. The first entry in the vector is the
// scalar that holds the return value for the call, the second is the function
// scalar being invoked, and the rest are pointer arguments to the function.
// This vector is built by the Local graph and is never modified after that.
//
std::vector<DSCallSite> FunctionCalls;
std::list<DSCallSite> FunctionCalls;
// AuxFunctionCalls - This vector contains call sites that have been processed
// by some mechanism. In pratice, the BU Analysis uses this vector to hold
// the _unresolved_ call sites, because it cannot modify FunctionCalls.
//
std::vector<DSCallSite> AuxFunctionCalls;
// InlinedGlobals - This set records which globals have been inlined from
// other graphs (callers or callees, depending on the pass) into this one.
//
GlobalSetTy InlinedGlobals;
std::list<DSCallSite> AuxFunctionCalls;
/// TD - This is the target data object for the machine this graph is
/// constructed for.
const TargetData &TD;
void operator=(const DSGraph &); // DO NOT IMPLEMENT
DSGraph(const DSGraph&); // DO NOT IMPLEMENT
public:
// Create a new, empty, DSGraph.
DSGraph(const TargetData &td)
: GlobalsGraph(0), PrintAuxCalls(false), TD(td) {}
DSGraph(EquivalenceClasses<GlobalValue*> &ECs, const TargetData &td)
: GlobalsGraph(0), PrintAuxCalls(false), ScalarMap(ECs), TD(td) {}
// Compute the local DSGraph
DSGraph(const TargetData &td, Function &F, DSGraph *GlobalsGraph);
DSGraph(EquivalenceClasses<GlobalValue*> &ECs, const TargetData &TD,
Function &F, DSGraph *GlobalsGraph);
// Copy ctor - If you want to capture the node mapping between the source and
// destination graph, you may optionally do this by specifying a map to record
@@ -162,13 +238,19 @@ public:
// source. You need to set a new GlobalsGraph with the setGlobalsGraph
// method.
//
DSGraph(const DSGraph &DSG);
DSGraph(const DSGraph &DSG, NodeMapTy &NodeMap);
DSGraph(const DSGraph &DSG, EquivalenceClasses<GlobalValue*> &ECs,
unsigned CloneFlags = 0);
~DSGraph();
DSGraph *getGlobalsGraph() const { return GlobalsGraph; }
void setGlobalsGraph(DSGraph *G) { GlobalsGraph = G; }
/// getGlobalECs - Return the set of equivalence classes that the global
/// variables in the program form.
EquivalenceClasses<GlobalValue*> &getGlobalECs() const {
return ScalarMap.getGlobalECs();
}
/// getTargetData - Return the TargetData object for the current target.
///
const TargetData &getTargetData() const { return TD; }
@@ -184,9 +266,13 @@ public:
/// cause the node to be removed from this list. This means that if you are
/// iterating over nodes and doing something that could cause _any_ node to
/// merge, your node_iterators into this graph can be invalidated.
typedef NodeListTy::compat_iterator node_iterator;
node_iterator node_begin() const { return Nodes.compat_begin(); }
node_iterator node_end() const { return Nodes.compat_end(); }
typedef NodeListTy::iterator node_iterator;
node_iterator node_begin() { return Nodes.begin(); }
node_iterator node_end() { return Nodes.end(); }
typedef NodeListTy::const_iterator node_const_iterator;
node_const_iterator node_begin() const { return Nodes.begin(); }
node_const_iterator node_end() const { return Nodes.end(); }
/// getFunctionNames - Return a space separated list of the name of the
/// functions in this graph (if any)
@@ -207,26 +293,27 @@ public:
/// getFunctionCalls - Return the list of call sites in the original local
/// graph...
///
const std::vector<DSCallSite> &getFunctionCalls() const {
return FunctionCalls;
}
const std::list<DSCallSite> &getFunctionCalls() const { return FunctionCalls;}
std::list<DSCallSite> &getFunctionCalls() { return FunctionCalls;}
/// getAuxFunctionCalls - Get the call sites as modified by whatever passes
/// have been run.
///
std::vector<DSCallSite> &getAuxFunctionCalls() {
return AuxFunctionCalls;
}
const std::vector<DSCallSite> &getAuxFunctionCalls() const {
std::list<DSCallSite> &getAuxFunctionCalls() { return AuxFunctionCalls; }
const std::list<DSCallSite> &getAuxFunctionCalls() const {
return AuxFunctionCalls;
}
/// getInlinedGlobals - Get the set of globals that are have been inlined
/// (from callees in BU or from callers in TD) into the current graph.
///
GlobalSetTy& getInlinedGlobals() {
return InlinedGlobals;
}
// Function Call iteration
typedef std::list<DSCallSite>::const_iterator fc_iterator;
fc_iterator fc_begin() const { return FunctionCalls.begin(); }
fc_iterator fc_end() const { return FunctionCalls.end(); }
// Aux Function Call iteration
typedef std::list<DSCallSite>::const_iterator afc_iterator;
afc_iterator afc_begin() const { return AuxFunctionCalls.begin(); }
afc_iterator afc_end() const { return AuxFunctionCalls.end(); }
/// getNodeForValue - Given a value that is used or defined in the body of the
/// current function, return the DSNode that it points to.
@@ -240,6 +327,13 @@ public:
return I->second;
}
/// retnodes_* iterator methods: expose iteration over return nodes in the
/// graph, which are also the set of functions incorporated in this graph.
typedef ReturnNodesTy::const_iterator retnodes_iterator;
retnodes_iterator retnodes_begin() const { return ReturnNodes.begin(); }
retnodes_iterator retnodes_end() const { return ReturnNodes.end(); }
/// getReturnNodes - Return the mapping of functions to their return nodes for
/// this graph.
///
@@ -260,12 +354,28 @@ public:
return I->second;
}
/// containsFunction - Return true if this DSGraph contains information for
/// the specified function.
bool containsFunction(Function *F) const {
return ReturnNodes.count(F);
}
/// getGraphSize - Return the number of nodes in this graph.
///
unsigned getGraphSize() const {
return Nodes.size();
}
/// addObjectToGraph - This method can be used to add global, stack, and heap
/// objects to the graph. This can be used when updating DSGraphs due to the
/// introduction of new temporary objects. The new object is not pointed to
/// and does not point to any other objects in the graph. Note that this
/// method initializes the type of the DSNode to the declared type of the
/// object if UseDeclaredType is true, otherwise it leaves the node type as
/// void.
DSNode *addObjectToGraph(Value *Ptr, bool UseDeclaredType = true);
/// print - Print a dot graph to the specified ostream...
///
void print(std::ostream &O) const;
@@ -286,7 +396,7 @@ public:
///
void maskNodeTypes(unsigned Mask) {
for (node_iterator I = node_begin(), E = node_end(); I != E; ++I)
(*I)->maskNodeTypes(Mask);
I->maskNodeTypes(Mask);
}
void maskIncompleteMarkers() { maskNodeTypes(~DSNode::Incomplete); }
@@ -323,7 +433,6 @@ public:
DontCloneAuxCallNodes = 1 << 2, CloneAuxCallNodes = 0,
StripModRefBits = 1 << 3, KeepModRefBits = 0,
StripIncompleteBit = 1 << 4, KeepIncompleteBit = 0,
UpdateInlinedGlobals = 1 << 5, DontUpdateInlinedGlobals = 0,
};
void updateFromGlobalGraph();
@@ -336,24 +445,51 @@ public:
const DSNodeHandle &NH2, NodeMapTy &NodeMap,
bool StrictChecking = true);
/// computeGToGGMapping - Compute the mapping of nodes in the graph to nodes
/// in the globals graph.
void computeGToGGMapping(NodeMapTy &NodeMap);
/// cloneInto - Clone the specified DSGraph into the current graph. The
/// translated ScalarMap for the old function is filled into the OldValMap
/// member, and the translated ReturnNodes map is returned into ReturnNodes.
/// OldNodeMap contains a mapping from the original nodes to the newly cloned
/// nodes.
/// computeGGToGMapping - Compute the mapping of nodes in the global
/// graph to nodes in this graph.
void computeGGToGMapping(InvNodeMapTy &InvNodeMap);
/// computeCalleeCallerMapping - Given a call from a function in the current
/// graph to the 'Callee' function (which lives in 'CalleeGraph'), compute the
/// mapping of nodes from the callee to nodes in the caller.
void computeCalleeCallerMapping(DSCallSite CS, const Function &Callee,
DSGraph &CalleeGraph, NodeMapTy &NodeMap);
/// spliceFrom - Logically perform the operation of cloning the RHS graph into
/// this graph, then clearing the RHS graph. Instead of performing this as
/// two seperate operations, do it as a single, much faster, one.
///
void spliceFrom(DSGraph &RHS);
/// cloneInto - Clone the specified DSGraph into the current graph.
///
/// The CloneFlags member controls various aspects of the cloning process.
///
void cloneInto(const DSGraph &G, ScalarMapTy &OldValMap,
ReturnNodesTy &OldReturnNodes, NodeMapTy &OldNodeMap,
unsigned CloneFlags = 0);
void cloneInto(const DSGraph &G, unsigned CloneFlags = 0);
/// mergeInGraph - The method is used for merging graphs together. If the
/// argument graph is not *this, it makes a clone of the specified graph, then
/// merges the nodes specified in the call site with the formal arguments in
/// the graph. If the StripAlloca's argument is 'StripAllocaBit' then Alloca
/// markers are removed from nodes.
/// getFunctionArgumentsForCall - Given a function that is currently in this
/// graph, return the DSNodeHandles that correspond to the pointer-compatible
/// function arguments. The vector is filled in with the return value (or
/// null if it is not pointer compatible), followed by all of the
/// pointer-compatible arguments.
void getFunctionArgumentsForCall(Function *F,
std::vector<DSNodeHandle> &Args) const;
/// mergeInGraph - This graph merges in the minimal number of
/// nodes from G2 into 'this' graph, merging the bindings specified by the
/// call site (in this graph) with the bindings specified by the vector in G2.
/// If the StripAlloca's argument is 'StripAllocaBit' then Alloca markers are
/// removed from nodes.
///
void mergeInGraph(const DSCallSite &CS, std::vector<DSNodeHandle> &Args,
const DSGraph &G2, unsigned CloneFlags);
/// mergeInGraph - This method is the same as the above method, but the
/// argument bindings are provided by using the formal arguments of F.
///
void mergeInGraph(const DSCallSite &CS, Function &F, const DSGraph &Graph,
unsigned CloneFlags);
@@ -372,10 +508,7 @@ public:
assert((!N || N->getParentGraph() == this) &&
"AssertNodeInGraph: Node is not in graph!");
}
void AssertNodeContainsGlobal(const DSNode *N, GlobalValue *GV) const {
assert(std::find(N->getGlobals().begin(), N->getGlobals().end(), GV) !=
N->getGlobals().end() && "Global value not in node!");
}
void AssertNodeContainsGlobal(const DSNode *N, GlobalValue *GV) const;
void AssertCallSiteInGraph(const DSCallSite &CS) const;
void AssertCallNodesInGraph() const;
@@ -430,7 +563,7 @@ public:
/// mergeCallSite - Merge the nodes reachable from the specified src call
/// site into the nodes reachable from DestCS.
///
void mergeCallSite(const DSCallSite &DestCS, const DSCallSite &SrcCS);
void mergeCallSite(DSCallSite &DestCS, const DSCallSite &SrcCS);
bool clonedAnyNodes() const { return !NodeMap.empty(); }

View File

@@ -135,15 +135,13 @@ template <> struct GraphTraits<const DSGraph*> {
typedef const DSNode NodeType;
typedef DSNode::const_iterator ChildIteratorType;
typedef std::pointer_to_unary_function<const DSNode *,const DSNode&> DerefFun;
// nodes_iterator/begin/end - Allow iteration over all nodes in the graph
typedef mapped_iterator<DSGraph::node_iterator, DerefFun> nodes_iterator;
typedef DSGraph::node_const_iterator nodes_iterator;
static nodes_iterator nodes_begin(const DSGraph *G) {
return map_iterator(G->node_begin(), DerefFun(dereferenceC));
return G->node_begin();
}
static nodes_iterator nodes_end(const DSGraph *G) {
return map_iterator(G->node_end(), DerefFun(dereferenceC));
return G->node_end();
}
static ChildIteratorType child_begin(const NodeType *N) { return N->begin(); }

View File

@@ -15,6 +15,7 @@
#define LLVM_ANALYSIS_DSNODE_H
#include "llvm/Analysis/DataStructure/DSSupport.h"
#include "llvm/ADT/hash_map"
namespace llvm {
@@ -212,6 +213,16 @@ public:
///
unsigned getNumLinks() const { return Links.size(); }
/// edge_* - Provide iterators for accessing outgoing edges. Some outgoing
/// edges may be null.
typedef std::vector<DSNodeHandle>::iterator edge_iterator;
typedef std::vector<DSNodeHandle>::const_iterator const_edge_iterator;
edge_iterator edge_begin() { return Links.begin(); }
edge_iterator edge_end() { return Links.end(); }
const_edge_iterator edge_begin() const { return Links.begin(); }
const_edge_iterator edge_end() const { return Links.end(); }
/// mergeTypeInfo - This method merges the specified type into the current
/// node at the specified offset. This may update the current node's type
/// record if this gives more information to the node, it may do nothing to
@@ -272,12 +283,35 @@ public:
/// also marks the node with the 'G' flag if it does not already have it.
///
void addGlobal(GlobalValue *GV);
void mergeGlobals(const std::vector<GlobalValue*> &RHS);
const std::vector<GlobalValue*> &getGlobals() const { return Globals; }
typedef std::vector<GlobalValue*>::const_iterator global_iterator;
global_iterator global_begin() const { return Globals.begin(); }
global_iterator global_end() const { return Globals.end(); }
/// removeGlobal - Remove the specified global that is explicitly in the
/// globals list.
void removeGlobal(GlobalValue *GV);
void mergeGlobals(const std::vector<GlobalValue*> &RHS);
void clearGlobals() { std::vector<GlobalValue*>().swap(Globals); }
/// getGlobalsList - Return the set of global leaders that are represented by
/// this node. Note that globals that are in this equivalence class but are
/// not leaders are not returned: for that, use addFullGlobalsList().
const std::vector<GlobalValue*> &getGlobalsList() const { return Globals; }
/// addFullGlobalsList - Compute the full set of global values that are
/// represented by this node. Unlike getGlobalsList(), this requires fair
/// amount of work to compute, so don't treat this method call as free.
void addFullGlobalsList(std::vector<GlobalValue*> &List) const;
/// addFullFunctionList - Identical to addFullGlobalsList, but only return the
/// functions in the full list.
void addFullFunctionList(std::vector<Function*> &List) const;
/// globals_iterator/begin/end - Provide iteration methods over the global
/// value leaders set that is merged into this node. Like the getGlobalsList
/// method, these iterators do not return globals that are part of the
/// equivalence classes for globals in this node, but aren't leaders.
typedef std::vector<GlobalValue*>::const_iterator globals_iterator;
globals_iterator globals_begin() const { return Globals.begin(); }
globals_iterator globals_end() const { return Globals.end(); }
/// maskNodeTypes - Apply a mask to the node types bitfield.
@@ -348,7 +382,7 @@ public:
/// DSNodes, marking any nodes which are reachable. All reachable nodes it
/// adds to the set, which allows it to only traverse visited nodes once.
///
void markReachableNodes(hash_set<DSNode*> &ReachableNodes);
void markReachableNodes(hash_set<const DSNode*> &ReachableNodes) const;
private:
friend class DSNodeHandle;
@@ -368,7 +402,8 @@ struct ilist_traits<DSNode> {
static void setPrev(DSNode *N, DSNode *Prev) { N->Prev = Prev; }
static void setNext(DSNode *N, DSNode *Next) { N->Next = Next; }
static DSNode *createNode() { return new DSNode(0,0); }
static DSNode *createSentinel() { return new DSNode(0,0); }
static void destroySentinel(DSNode *N) { delete N; }
//static DSNode *createNode(const DSNode &V) { return new DSNode(V); }

View File

@@ -15,6 +15,7 @@
#define LLVM_ANALYSIS_DSSUPPORT_H
#include <functional>
#include "llvm/ADT/hash_map"
#include "llvm/ADT/hash_set"
#include "llvm/Support/CallSite.h"
@@ -145,6 +146,15 @@ namespace std {
inline void swap<llvm::DSNodeHandle>(llvm::DSNodeHandle &NH1, llvm::DSNodeHandle &NH2) { NH1.swap(NH2); }
}
namespace HASH_NAMESPACE {
// Provide a hash function for arbitrary pointers...
template <> struct hash<llvm::DSNodeHandle> {
inline size_t operator()(const llvm::DSNodeHandle &Val) const {
return hash<void*>()(Val.getNode()) ^ Val.getOffset();
}
};
}
namespace llvm {
//===----------------------------------------------------------------------===//
@@ -262,6 +272,10 @@ public:
return CallArgs[i];
}
void addPtrArg(const DSNodeHandle &NH) {
CallArgs.push_back(NH);
}
void swap(DSCallSite &CS) {
if (this != &CS) {
std::swap(Site, CS.Site);
@@ -282,13 +296,16 @@ public:
for (unsigned a = 0; a != MinArgs; ++a)
getPtrArg(a).mergeWith(CS.getPtrArg(a));
for (unsigned a = MinArgs, e = CS.getNumPtrArgs(); a != e; ++a)
CallArgs.push_back(CS.getPtrArg(a));
}
/// markReachableNodes - This method recursively traverses the specified
/// DSNodes, marking any nodes which are reachable. All reachable nodes it
/// adds to the set, which allows it to only traverse visited nodes once.
///
void markReachableNodes(hash_set<DSNode*> &Nodes);
void markReachableNodes(hash_set<const DSNode*> &Nodes) const;
bool operator<(const DSCallSite &CS) const {
if (isDirectCall()) { // This must sort by callee first!

View File

@@ -16,14 +16,20 @@
#include "llvm/Pass.h"
#include "llvm/Target/TargetData.h"
#include "llvm/ADT/hash_map"
#include "llvm/ADT/hash_set"
#include "llvm/ADT/EquivalenceClasses.h"
namespace llvm {
class Type;
class Instruction;
class GlobalValue;
class CallSite;
class DSGraph;
class DSCallSite;
class DSNode;
class DSNodeHandle;
// FIXME: move this stuff to a private header
namespace DataStructureAnalysis {
@@ -44,6 +50,10 @@ class LocalDataStructures : public ModulePass {
// DSInfo, one graph for each function
hash_map<Function*, DSGraph*> DSInfo;
DSGraph *GlobalsGraph;
/// GlobalECs - The equivalence classes for each global value that is merged
/// with other global values in the DSGraphs.
EquivalenceClasses<GlobalValue*> GlobalECs;
public:
~LocalDataStructures() { releaseMemory(); }
@@ -64,6 +74,8 @@ public:
DSGraph &getGlobalsGraph() const { return *GlobalsGraph; }
EquivalenceClasses<GlobalValue*> &getGlobalECs() { return GlobalECs; }
/// print - Print out the analysis results...
///
void print(std::ostream &O, const Module *M) const;
@@ -91,9 +103,17 @@ protected:
// DSInfo, one graph for each function
hash_map<Function*, DSGraph*> DSInfo;
DSGraph *GlobalsGraph;
hash_multimap<Instruction*, Function*> ActualCallees;
std::set<std::pair<Instruction*, Function*> > ActualCallees;
// This map is only maintained during construction of BU Graphs
std::map<std::vector<Function*>,
std::pair<DSGraph*, std::vector<DSNodeHandle> > > *IndCallGraphMap;
/// GlobalECs - The equivalence classes for each global value that is merged
/// with other global values in the DSGraphs.
EquivalenceClasses<GlobalValue*> GlobalECs;
public:
~BUDataStructures() { releaseMemory(); }
~BUDataStructures() { releaseMyMemory(); }
virtual bool runOnModule(Module &M);
@@ -106,37 +126,54 @@ public:
DSGraph &getDSGraph(const Function &F) const {
hash_map<Function*, DSGraph*>::const_iterator I =
DSInfo.find(const_cast<Function*>(&F));
assert(I != DSInfo.end() && "Function not in module!");
if (I != DSInfo.end())
return *I->second;
return const_cast<BUDataStructures*>(this)->
CreateGraphForExternalFunction(F);
}
DSGraph &getGlobalsGraph() const { return *GlobalsGraph; }
EquivalenceClasses<GlobalValue*> &getGlobalECs() { return GlobalECs; }
DSGraph &CreateGraphForExternalFunction(const Function &F);
/// deleteValue/copyValue - Interfaces to update the DSGraphs in the program.
/// These correspond to the interfaces defined in the AliasAnalysis class.
void deleteValue(Value *V);
void copyValue(Value *From, Value *To);
/// print - Print out the analysis results...
///
void print(std::ostream &O, const Module *M) const;
/// releaseMemory - if the pass pipeline is done with this pass, we can
/// release our memory...
///
virtual void releaseMemory();
// FIXME: Once the pass manager is straightened out, rename this to
// releaseMemory.
void releaseMyMemory();
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll();
AU.addRequired<LocalDataStructures>();
}
typedef hash_multimap<Instruction*, Function*> ActualCalleesTy;
typedef std::set<std::pair<Instruction*, Function*> > ActualCalleesTy;
const ActualCalleesTy &getActualCallees() const {
return ActualCallees;
}
typedef ActualCalleesTy::const_iterator callee_iterator;
callee_iterator callee_begin(Instruction *I) const {
return ActualCallees.lower_bound(std::pair<Instruction*,Function*>(I, 0));
}
callee_iterator callee_end(Instruction *I) const {
I = (Instruction*)((char*)I + 1);
return ActualCallees.lower_bound(std::pair<Instruction*,Function*>(I, 0));
}
private:
void calculateGraph(DSGraph &G);
void calculateReachableGraphs(Function *F);
DSGraph &getOrCreateGraph(Function *F);
unsigned calculateGraphs(Function *F, std::vector<Function*> &Stack,
@@ -154,6 +191,38 @@ class TDDataStructures : public ModulePass {
hash_map<Function*, DSGraph*> DSInfo;
hash_set<Function*> ArgsRemainIncomplete;
DSGraph *GlobalsGraph;
BUDataStructures *BUInfo;
/// GlobalECs - The equivalence classes for each global value that is merged
/// with other global values in the DSGraphs.
EquivalenceClasses<GlobalValue*> GlobalECs;
/// CallerCallEdges - For a particular graph, we keep a list of these records
/// which indicates which graphs call this function and from where.
struct CallerCallEdge {
DSGraph *CallerGraph; // The graph of the caller function.
const DSCallSite *CS; // The actual call site.
Function *CalledFunction; // The actual function being called.
CallerCallEdge(DSGraph *G, const DSCallSite *cs, Function *CF)
: CallerGraph(G), CS(cs), CalledFunction(CF) {}
bool operator<(const CallerCallEdge &RHS) const {
return CallerGraph < RHS.CallerGraph ||
(CallerGraph == RHS.CallerGraph && CS < RHS.CS);
}
};
std::map<DSGraph*, std::vector<CallerCallEdge> > CallerEdges;
// IndCallMap - We memoize the results of indirect call inlining operations
// that have multiple targets here to avoid N*M inlining. The key to the map
// is a sorted set of callee functions, the value is the DSGraph that holds
// all of the caller graphs merged together, and the DSCallSite to merge with
// the arguments for each function.
std::map<std::vector<Function*>, DSGraph*> IndCallMap;
public:
~TDDataStructures() { releaseMyMemory(); }
@@ -168,11 +237,19 @@ public:
DSGraph &getDSGraph(const Function &F) const {
hash_map<Function*, DSGraph*>::const_iterator I =
DSInfo.find(const_cast<Function*>(&F));
assert(I != DSInfo.end() && "Function not in module!");
return *I->second;
if (I != DSInfo.end()) return *I->second;
return const_cast<TDDataStructures*>(this)->
getOrCreateDSGraph(const_cast<Function&>(F));
}
DSGraph &getGlobalsGraph() const { return *GlobalsGraph; }
EquivalenceClasses<GlobalValue*> &getGlobalECs() { return GlobalECs; }
/// deleteValue/copyValue - Interfaces to update the DSGraphs in the program.
/// These correspond to the interfaces defined in the AliasAnalysis class.
void deleteValue(Value *V);
void copyValue(Value *From, Value *To);
/// print - Print out the analysis results...
///
@@ -193,11 +270,10 @@ private:
void markReachableFunctionsExternallyAccessible(DSNode *N,
hash_set<DSNode*> &Visited);
void inlineGraphIntoCallees(DSGraph &G);
void InlineCallersIntoGraph(DSGraph &G);
DSGraph &getOrCreateDSGraph(Function &F);
void ComputePostOrder(Function &F, hash_set<DSGraph*> &Visited,
std::vector<DSGraph*> &PostOrder,
const BUDataStructures::ActualCalleesTy &ActualCallees);
std::vector<DSGraph*> &PostOrder);
};
@@ -243,6 +319,110 @@ private:
void processGraph(DSGraph &G);
};
/// EquivClassGraphs - This is the same as the complete bottom-up graphs, but
/// with functions partitioned into equivalence classes and a single merged
/// DS graph for all functions in an equivalence class. After this merging,
/// graphs are inlined bottom-up on the SCCs of the final (CBU) call graph.
///
struct EquivClassGraphs : public ModulePass {
CompleteBUDataStructures *CBU;
DSGraph *GlobalsGraph;
// DSInfo - one graph for each function.
hash_map<const Function*, DSGraph*> DSInfo;
/// ActualCallees - The actual functions callable from indirect call sites.
///
std::set<std::pair<Instruction*, Function*> > ActualCallees;
// Equivalence class where functions that can potentially be called via the
// same function pointer are in the same class.
EquivalenceClasses<Function*> FuncECs;
/// OneCalledFunction - For each indirect call, we keep track of one
/// target of the call. This is used to find equivalence class called by
/// a call site.
std::map<DSNode*, Function *> OneCalledFunction;
/// GlobalECs - The equivalence classes for each global value that is merged
/// with other global values in the DSGraphs.
EquivalenceClasses<GlobalValue*> GlobalECs;
public:
/// EquivClassGraphs - Computes the equivalence classes and then the
/// folded DS graphs for each class.
///
virtual bool runOnModule(Module &M);
/// print - Print out the analysis results...
///
void print(std::ostream &O, const Module *M) const;
EquivalenceClasses<GlobalValue*> &getGlobalECs() { return GlobalECs; }
/// getDSGraph - Return the data structure graph for the specified function.
/// This returns the folded graph. The folded graph is the same as the CBU
/// graph iff the function is in a singleton equivalence class AND all its
/// callees also have the same folded graph as the CBU graph.
///
DSGraph &getDSGraph(const Function &F) const {
hash_map<const Function*, DSGraph*>::const_iterator I = DSInfo.find(&F);
assert(I != DSInfo.end() && "No graph computed for that function!");
return *I->second;
}
bool hasGraph(const Function &F) const {
return DSInfo.find(&F) != DSInfo.end();
}
/// ContainsDSGraphFor - Return true if we have a graph for the specified
/// function.
bool ContainsDSGraphFor(const Function &F) const {
return DSInfo.find(&F) != DSInfo.end();
}
/// getSomeCalleeForCallSite - Return any one callee function at
/// a call site.
///
Function *getSomeCalleeForCallSite(const CallSite &CS) const;
DSGraph &getGlobalsGraph() const {
return *GlobalsGraph;
}
typedef std::set<std::pair<Instruction*, Function*> > ActualCalleesTy;
const ActualCalleesTy &getActualCallees() const {
return ActualCallees;
}
typedef ActualCalleesTy::const_iterator callee_iterator;
callee_iterator callee_begin(Instruction *I) const {
return ActualCallees.lower_bound(std::pair<Instruction*,Function*>(I, 0));
}
callee_iterator callee_end(Instruction *I) const {
I = (Instruction*)((char*)I + 1);
return ActualCallees.lower_bound(std::pair<Instruction*,Function*>(I, 0));
}
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll();
AU.addRequired<CompleteBUDataStructures>();
}
private:
void buildIndirectFunctionSets(Module &M);
unsigned processSCC(DSGraph &FG, std::vector<DSGraph*> &Stack,
unsigned &NextID,
std::map<DSGraph*, unsigned> &ValMap);
void processGraph(DSGraph &FG);
DSGraph &getOrCreateGraph(Function &F);
};
} // End llvm namespace
#endif

View File

@@ -114,7 +114,7 @@ public:
/// print - Convert to human readable form
///
virtual void print(std::ostream &OS) const;
virtual void print(std::ostream &OS, const Module* = 0) const;
};
//===-------------------------------------
@@ -218,7 +218,7 @@ public:
/// print - Convert to human readable form
///
virtual void print(std::ostream &OS) const;
virtual void print(std::ostream &OS, const Module* = 0) const;
/// dominates - Return true if A dominates B. This performs the special
/// checks necessary if A and B are in the same basic block.
@@ -375,7 +375,7 @@ public:
/// print - Convert to human readable form
///
virtual void print(std::ostream &OS) const;
virtual void print(std::ostream &OS, const Module* = 0) const;
};
@@ -475,7 +475,7 @@ public:
/// print - Convert to human readable form
///
virtual void print(std::ostream &OS) const;
virtual void print(std::ostream &OS, const Module* = 0) const;
};

View File

@@ -60,7 +60,7 @@ public:
// Make sure that any clients of this file link in PostDominators.cpp
static IncludeFile
FIND_USED_TYPES_INCLUDE_FILE((void*)&FindUsedTypes::stub);
FIND_USED_TYPES_INCLUDE_FILE((void*)(&FindUsedTypes::stub));
} // End llvm namespace

View File

@@ -30,14 +30,14 @@ class BasicBlock;
//===----------------------------------------------------------------------===//
//
// Interval Class - An Interval is a set of nodes defined such that every node
// in the interval has all of its predecessors in the interval (except for the
// header)
//
/// Interval Class - An Interval is a set of nodes defined such that every node
/// in the interval has all of its predecessors in the interval (except for the
/// header)
///
class Interval {
// HeaderNode - The header BasicBlock, which dominates all BasicBlocks in this
// interval. Also, any loops in this interval must go through the HeaderNode.
//
/// HeaderNode - The header BasicBlock, which dominates all BasicBlocks in this
/// interval. Also, any loops in this interval must go through the HeaderNode.
///
BasicBlock *HeaderNode;
public:
typedef std::vector<BasicBlock*>::iterator succ_iterator;
@@ -53,22 +53,22 @@ public:
inline BasicBlock *getHeaderNode() const { return HeaderNode; }
// Nodes - The basic blocks in this interval.
//
/// Nodes - The basic blocks in this interval.
///
std::vector<BasicBlock*> Nodes;
// Successors - List of BasicBlocks that are reachable directly from nodes in
// this interval, but are not in the interval themselves.
// These nodes necessarily must be header nodes for other intervals.
//
/// Successors - List of BasicBlocks that are reachable directly from nodes in
/// this interval, but are not in the interval themselves.
/// These nodes necessarily must be header nodes for other intervals.
///
std::vector<BasicBlock*> Successors;
// Predecessors - List of BasicBlocks that have this Interval's header block
// as one of their successors.
//
/// Predecessors - List of BasicBlocks that have this Interval's header block
/// as one of their successors.
///
std::vector<BasicBlock*> Predecessors;
// contains - Find out if a basic block is in this interval
/// contains - Find out if a basic block is in this interval
inline bool contains(BasicBlock *BB) const {
for (unsigned i = 0; i < Nodes.size(); ++i)
if (Nodes[i] == BB) return true;
@@ -77,7 +77,7 @@ public:
//return find(Nodes.begin(), Nodes.end(), BB) != Nodes.end();
}
// isSuccessor - find out if a basic block is a successor of this Interval
/// isSuccessor - find out if a basic block is a successor of this Interval
inline bool isSuccessor(BasicBlock *BB) const {
for (unsigned i = 0; i < Successors.size(); ++i)
if (Successors[i] == BB) return true;
@@ -86,24 +86,24 @@ public:
//return find(Successors.begin(), Successors.end(), BB) != Successors.end();
}
// Equality operator. It is only valid to compare two intervals from the same
// partition, because of this, all we have to check is the header node for
// equality.
//
/// Equality operator. It is only valid to compare two intervals from the
/// same partition, because of this, all we have to check is the header node
/// for equality.
///
inline bool operator==(const Interval &I) const {
return HeaderNode == I.HeaderNode;
}
// isLoop - Find out if there is a back edge in this interval...
/// isLoop - Find out if there is a back edge in this interval...
bool isLoop() const;
// print - Show contents in human readable format...
/// print - Show contents in human readable format...
void print(std::ostream &O) const;
};
// succ_begin/succ_end - define methods so that Intervals may be used
// just like BasicBlocks can with the succ_* functions, and *::succ_iterator.
//
/// succ_begin/succ_end - define methods so that Intervals may be used
/// just like BasicBlocks can with the succ_* functions, and *::succ_iterator.
///
inline Interval::succ_iterator succ_begin(Interval *I) {
return I->Successors.begin();
}
@@ -111,9 +111,9 @@ inline Interval::succ_iterator succ_end(Interval *I) {
return I->Successors.end();
}
// pred_begin/pred_end - define methods so that Intervals may be used
// just like BasicBlocks can with the pred_* functions, and *::pred_iterator.
//
/// pred_begin/pred_end - define methods so that Intervals may be used
/// just like BasicBlocks can with the pred_* functions, and *::pred_iterator.
///
inline Interval::pred_iterator pred_begin(Interval *I) {
return I->Predecessors.begin();
}
@@ -127,7 +127,7 @@ template <> struct GraphTraits<Interval*> {
static NodeType *getEntryNode(Interval *I) { return I; }
// nodes_iterator/begin/end - Allow iteration over all nodes in the graph
/// nodes_iterator/begin/end - Allow iteration over all nodes in the graph
static inline ChildIteratorType child_begin(NodeType *N) {
return succ_begin(N);
}

View File

@@ -60,7 +60,7 @@ public:
~IntervalPartition() { destroy(); }
// print - Show contents in human readable format...
virtual void print(std::ostream &O) const;
virtual void print(std::ostream &O, const Module* = 0) const;
// getRootInterval() - Return the root interval that contains the starting
// block of the function.

View File

@@ -74,6 +74,7 @@ public:
/// iterator/begin/end - Return the loops contained entirely within this loop.
///
const std::vector<Loop*> &getSubLoops() const { return SubLoops; }
typedef std::vector<Loop*>::const_iterator iterator;
iterator begin() const { return SubLoops.begin(); }
iterator end() const { return SubLoops.end(); }
@@ -175,6 +176,21 @@ public:
Blocks.push_back(BB);
}
/// moveToHeader - This method is used to move BB (which must be part of this
/// loop) to be the loop header of the loop (the block that dominates all
/// others).
void moveToHeader(BasicBlock *BB) {
if (Blocks[0] == BB) return;
for (unsigned i = 0; ; ++i) {
assert(i != Blocks.size() && "Loop does not contain BB!");
if (Blocks[i] == BB) {
Blocks[i] = Blocks[0];
Blocks[0] = BB;
return;
}
}
}
/// removeBlockFromLoop - This removes the specified basic block from the
/// current loop, updating the Blocks as appropriate. This does not update
/// the mapping in the LoopInfo class.
@@ -214,7 +230,8 @@ public:
/// block is in no loop (for example the entry node), null is returned.
///
Loop *getLoopFor(const BasicBlock *BB) const {
std::map<BasicBlock *, Loop*>::const_iterator I=BBMap.find((BasicBlock*)BB);
std::map<BasicBlock *, Loop*>::const_iterator I=
BBMap.find(const_cast<BasicBlock*>(BB));
return I != BBMap.end() ? I->second : 0;
}
@@ -241,7 +258,7 @@ public:
virtual bool runOnFunction(Function &F);
virtual void releaseMemory();
void print(std::ostream &O) const;
void print(std::ostream &O, const Module* = 0) const;
/// getAnalysisUsage - Requires dominator sets
///
@@ -284,7 +301,7 @@ private:
// Make sure that any clients of this file link in LoopInfo.cpp
static IncludeFile
LOOP_INFO_INCLUDE_FILE((void*)&LoopInfo::stub);
LOOP_INFO_INCLUDE_FILE((void*)(&LoopInfo::stub));
// Allow clients to walk the list of nested loops...
template <> struct GraphTraits<const Loop*> {

View File

@@ -16,14 +16,92 @@
#define LLVM_ANALYSIS_PASSES_H
namespace llvm {
class FunctionPass;
class ImmutablePass;
class ModulePass;
class Pass;
//===--------------------------------------------------------------------===//
//
// createGlobalsModRefPass - This function creates and returns an instance of
// the GlobalsModRef alias analysis pass.
// createGlobalsModRefPass - This pass provides alias and mod/ref info for
// global values that do not have their addresses taken.
//
Pass *createGlobalsModRefPass();
//===--------------------------------------------------------------------===//
//
// createAliasAnalysisCounterPass - This pass counts alias queries and how the
// alias analysis implementation responds.
//
ModulePass *createAliasAnalysisCounterPass();
//===--------------------------------------------------------------------===//
//
// createAAEvalPass - This pass implements a simple N^2 alias analysis
// accuracy evaluator.
//
FunctionPass *createAAEvalPass();
//===--------------------------------------------------------------------===//
//
// createNoAAPass - This pass implements a "I don't know" alias analysis.
//
ImmutablePass *createNoAAPass();
//===--------------------------------------------------------------------===//
//
// createBasicAliasAnalysisPass - This pass implements the default alias
// analysis.
//
ImmutablePass *createBasicAliasAnalysisPass();
//===--------------------------------------------------------------------===//
//
// createAndersensPass - This pass implements Andersen's interprocedural alias
// analysis.
//
ModulePass *createAndersensPass();
//===--------------------------------------------------------------------===//
//
// createBasicVNPass - This pass walks SSA def-use chains to trivially
// identify lexically identical expressions.
//
ImmutablePass *createBasicVNPass();
//===--------------------------------------------------------------------===//
//
// createProfileLoaderPass - This pass loads information from a profile dump
// file.
//
ModulePass *createProfileLoaderPass();
//===--------------------------------------------------------------------===//
//
// createNoProfileInfoPass - This pass implements the default "no profile".
//
ImmutablePass *createNoProfileInfoPass();
//===--------------------------------------------------------------------===//
//
// createDSAAPass - This pass implements simple context sensitive alias
// analysis.
//
ModulePass *createDSAAPass();
//===--------------------------------------------------------------------===//
//
// createDSOptPass - This pass uses DSA to do a series of simple
// optimizations.
//
ModulePass *createDSOptPass();
//===--------------------------------------------------------------------===//
//
// createSteensgaardPass - This pass uses the data structure graphs to do a
// simple context insensitive alias analysis.
//
ModulePass *createSteensgaardPass();
}
#endif

View File

@@ -38,11 +38,11 @@ namespace llvm {
///
class SCEV {
const unsigned SCEVType; // The SCEV baseclass this node corresponds to
unsigned RefCount;
mutable unsigned RefCount;
friend class SCEVHandle;
void addRef() { ++RefCount; }
void dropRef() {
void addRef() const { ++RefCount; }
void dropRef() const {
if (--RefCount == 0)
delete this;
}
@@ -54,6 +54,16 @@ namespace llvm {
public:
SCEV(unsigned SCEVTy) : SCEVType(SCEVTy), RefCount(0) {}
/// getNegativeSCEV - Return the SCEV object corresponding to -V.
///
static SCEVHandle getNegativeSCEV(const SCEVHandle &V);
/// getMinusSCEV - Return LHS-RHS.
///
static SCEVHandle getMinusSCEV(const SCEVHandle &LHS,
const SCEVHandle &RHS);
unsigned getSCEVType() const { return SCEVType; }
/// getValueRange - Return the tightest constant bounds that this value is
@@ -74,6 +84,15 @@ namespace llvm {
///
virtual const Type *getType() const = 0;
/// replaceSymbolicValuesWithConcrete - If this SCEV internally references
/// the symbolic value "Sym", construct and return a new SCEV that produces
/// the same value, but which uses the concrete value Conc instead of the
/// symbolic value. If this SCEV does not use the symbolic value, it
/// returns itself.
virtual SCEVHandle
replaceSymbolicValuesWithConcrete(const SCEVHandle &Sym,
const SCEVHandle &Conc) const = 0;
/// print - Print out the internal representation of this scalar to the
/// specified stream. This should really only be used for debugging
/// purposes.
@@ -102,7 +121,9 @@ namespace llvm {
virtual const Type *getType() const;
virtual bool hasComputableLoopEvolution(const Loop *L) const;
virtual void print(std::ostream &OS) const;
virtual SCEVHandle
replaceSymbolicValuesWithConcrete(const SCEVHandle &Sym,
const SCEVHandle &Conc) const;
/// Methods for support type inquiry through isa, cast, and dyn_cast:
static inline bool classof(const SCEVCouldNotCompute *S) { return true; }
@@ -115,7 +136,7 @@ namespace llvm {
SCEV *S;
SCEVHandle(); // DO NOT IMPLEMENT
public:
SCEVHandle(SCEV *s) : S(s) {
SCEVHandle(const SCEV *s) : S(const_cast<SCEV*>(s)) {
assert(S && "Cannot create a handle to a null SCEV!");
S->addRef();
}
@@ -202,7 +223,7 @@ namespace llvm {
virtual bool runOnFunction(Function &F);
virtual void releaseMemory();
virtual void getAnalysisUsage(AnalysisUsage &AU) const;
virtual void print(std::ostream &OS) const;
virtual void print(std::ostream &OS, const Module* = 0) const;
};
}

View File

@@ -56,6 +56,11 @@ namespace llvm {
virtual const Type *getType() const;
SCEVHandle replaceSymbolicValuesWithConcrete(const SCEVHandle &Sym,
const SCEVHandle &Conc) const {
return this;
}
virtual void print(std::ostream &OS) const;
/// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -90,6 +95,14 @@ namespace llvm {
return Op->hasComputableLoopEvolution(L);
}
SCEVHandle replaceSymbolicValuesWithConcrete(const SCEVHandle &Sym,
const SCEVHandle &Conc) const {
SCEVHandle H = Op->replaceSymbolicValuesWithConcrete(Sym, Conc);
if (H == Op)
return this;
return get(H, Ty);
}
/// getValueRange - Return the tightest constant bounds that this value is
/// known to have. This method is only valid on integer SCEV objects.
virtual ConstantRange getValueRange() const;
@@ -132,6 +145,14 @@ namespace llvm {
/// known to have. This method is only valid on integer SCEV objects.
virtual ConstantRange getValueRange() const;
SCEVHandle replaceSymbolicValuesWithConcrete(const SCEVHandle &Sym,
const SCEVHandle &Conc) const {
SCEVHandle H = Op->replaceSymbolicValuesWithConcrete(Sym, Conc);
if (H == Op)
return this;
return get(H, Ty);
}
virtual void print(std::ostream &OS) const;
/// Methods for support type inquiry through isa, cast, and dyn_cast:
@@ -176,12 +197,23 @@ namespace llvm {
return true;
}
// hasComputableLoopEvolution - Commutative expressions have computable loop
// evolutions iff they have at least one operand that varies with the loop,
// but that all varying operands are computable.
virtual bool hasComputableLoopEvolution(const Loop *L) const {
bool HasVarying = false;
for (unsigned i = 0, e = getNumOperands(); i != e; ++i)
if (getOperand(i)->hasComputableLoopEvolution(L)) return true;
if (!getOperand(i)->isLoopInvariant(L))
if (getOperand(i)->hasComputableLoopEvolution(L))
HasVarying = true;
else
return false;
return HasVarying;
}
SCEVHandle replaceSymbolicValuesWithConcrete(const SCEVHandle &Sym,
const SCEVHandle &Conc) const;
virtual const char *getOperationStr() const = 0;
virtual const Type *getType() const { return getOperand(0)->getType(); }
@@ -286,6 +318,17 @@ namespace llvm {
RHS->hasComputableLoopEvolution(L);
}
SCEVHandle replaceSymbolicValuesWithConcrete(const SCEVHandle &Sym,
const SCEVHandle &Conc) const {
SCEVHandle L = LHS->replaceSymbolicValuesWithConcrete(Sym, Conc);
SCEVHandle R = RHS->replaceSymbolicValuesWithConcrete(Sym, Conc);
if (L == LHS && R == RHS)
return this;
else
return get(L, R);
}
virtual const Type *getType() const;
void print(std::ostream &OS) const;
@@ -347,8 +390,6 @@ namespace llvm {
virtual bool hasComputableLoopEvolution(const Loop *QL) const {
if (L == QL) return true;
/// FIXME: What if the start or step value a recurrence for the specified
/// loop?
return false;
}
@@ -383,6 +424,8 @@ namespace llvm {
/// returned.
SCEVHandle getNumIterationsInRange(ConstantRange Range) const;
SCEVHandle replaceSymbolicValuesWithConcrete(const SCEVHandle &Sym,
const SCEVHandle &Conc) const;
virtual void print(std::ostream &OS) const;
@@ -420,6 +463,12 @@ namespace llvm {
return false; // not computable
}
SCEVHandle replaceSymbolicValuesWithConcrete(const SCEVHandle &Sym,
const SCEVHandle &Conc) const {
if (&*Sym == this) return Conc;
return this;
}
virtual const Type *getType() const;
virtual void print(std::ostream &OS) const;

View File

@@ -39,9 +39,6 @@ public:
///
Argument(const Type *Ty, const std::string &Name = "", Function *F = 0);
/// setName - Specialize setName to handle symbol table majik...
virtual void setName(const std::string &name, SymbolTable *ST = 0);
inline const Function *getParent() const { return Parent; }
inline Function *getParent() { return Parent; }

View File

@@ -27,6 +27,8 @@ class Instruction;
struct AssemblyAnnotationWriter {
virtual ~AssemblyAnnotationWriter();
// emitFunctionAnnot - This may be implemented to emit a string right before
// the start of a function.
virtual void emitFunctionAnnot(const Function *F, std::ostream &OS) {}

View File

@@ -36,7 +36,8 @@ Module *ParseAssemblyFile(const std::string &Filename);// throw (ParseException)
// ParseException - For when an exceptional event is generated by the parser.
// This class lets you print out the exception message
//
struct ParseException {
class ParseException {
public:
ParseException(const std::string &filename, const std::string &message,
int LineNo = -1, int ColNo = -1);

View File

@@ -40,8 +40,9 @@ template <class Ptr, class USE_iterator> class PredIterator;
template<> struct ilist_traits<Instruction>
: public SymbolTableListTraits<Instruction, BasicBlock, Function> {
// createNode is used to create a node that marks the end of the list...
static Instruction *createNode();
// createSentinel is used to create a node that marks the end of the list...
static Instruction *createSentinel();
static void destroySentinel(Instruction *I) { delete I; }
static iplist<Instruction> &getList(BasicBlock *BB);
};
@@ -64,8 +65,6 @@ public:
/// Instruction iterators...
typedef InstListType::iterator iterator;
typedef InstListType::const_iterator const_iterator;
typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
typedef std::reverse_iterator<iterator> reverse_iterator;
/// BasicBlock ctor - If the function parameter is specified, the basic block
/// is automatically inserted at either the end of the function (if
@@ -75,9 +74,6 @@ public:
BasicBlock *InsertBefore = 0);
~BasicBlock();
// Specialize setName to take care of symbol table majik
virtual void setName(const std::string &name, SymbolTable *ST = 0);
/// getParent - Return the enclosing method, or null if none
///
const Function *getParent() const { return InstList.getParent(); }
@@ -106,7 +102,12 @@ public:
///
void eraseFromParent();
/// getSinglePredecessor - If this basic block has a single predecessor block,
/// return the block, otherwise return a null pointer.
BasicBlock *getSinglePredecessor();
const BasicBlock *getSinglePredecessor() const {
return const_cast<BasicBlock*>(this)->getSinglePredecessor();
}
//===--------------------------------------------------------------------===//
/// Instruction iterator methods
@@ -116,11 +117,6 @@ public:
inline iterator end () { return InstList.end(); }
inline const_iterator end () const { return InstList.end(); }
inline reverse_iterator rbegin() { return InstList.rbegin(); }
inline const_reverse_iterator rbegin() const { return InstList.rbegin(); }
inline reverse_iterator rend () { return InstList.rend(); }
inline const_reverse_iterator rend () const { return InstList.rend(); }
inline size_t size() const { return InstList.size(); }
inline bool empty() const { return InstList.empty(); }
inline const Instruction &front() const { return InstList.front(); }
@@ -159,14 +155,14 @@ public:
/// update the PHI nodes that reside in the block. Note that this should be
/// called while the predecessor still refers to this block.
///
void removePredecessor(BasicBlock *Pred);
void removePredecessor(BasicBlock *Pred, bool DontDeleteUselessPHIs = false);
/// splitBasicBlock - This splits a basic block into two at the specified
/// instruction. Note that all instructions BEFORE the specified iterator
/// stay as part of the original basic block, an unconditional branch is added
/// to the new BB, and the rest of the instructions in the BB are moved to the
/// new BB, including the old terminator. The newly formed BasicBlock is
/// returned. This function invalidates the specified iterator.
/// to the original BB, and the rest of the instructions in the BB are moved
/// to the new BB, including the old terminator. The newly formed BasicBlock
/// is returned. This function invalidates the specified iterator.
///
/// Note that this only works on well formed basic blocks (must have a
/// terminator), and 'I' must not be the end of instruction list (which would

View File

@@ -22,6 +22,7 @@
#include "llvm/Bytecode/Format.h"
#include <string>
#include <map>
#include <iostream>
namespace llvm {

View File

@@ -306,7 +306,10 @@ class Archive {
/// you intend to modify the archive or traverse its contents (e.g. for
/// printing).
/// @brief Open and load an archive file
static Archive* OpenAndLoad(const sys::Path& filePath);
static Archive* OpenAndLoad(
const sys::Path& filePath, ///< The file path to open and load
std::string* ErrorMessage = 0 ///< An optional error string
);
/// This method opens an existing archive file from \p Filename and reads in
/// its symbol table without reading in any of the archive's members. This
@@ -325,7 +328,8 @@ class Archive {
/// @returns an Archive* that represents the archive file.
/// @brief Open an existing archive and load its symbols.
static Archive* OpenAndLoadSymbols(
const sys::Path& Filename ///< Name of the archive file to open
const sys::Path& Filename, ///< Name of the archive file to open
std::string* ErrorMessage=0 ///< An optional error string
);
/// This destructor cleans up the Archive object, releases all memory, and
@@ -411,6 +415,15 @@ class Archive {
std::set<ModuleProvider*>& modules ///< The modules matching \p symbols
);
/// This method determines whether the archive is a properly formed llvm
/// bytecode archive. It first makes sure the symbol table has been loaded
/// and has a non-zero size. If it does, then it is an archive. If not,
/// then it tries to load all the bytecode modules of the archive. Finally,
/// it returns whether it was successfull.
/// @returns true if the archive is a proper llvm bytecode archive
/// @brief Determine whether the archive is a proper llvm bytecode archive.
bool isBytecodeArchive();
/// @}
/// @name Mutators
/// @{

View File

@@ -321,5 +321,4 @@ public:
};
}
// vim: sw=2 ai
#endif

View File

@@ -0,0 +1,54 @@
//===-- llvm/CallingConv.h - LLVM Calling Conventions -----------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines a set of enums which specify the assigned numeric values
// for known llvm calling conventions.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_CALLINGCONV_H
#define LLVM_CALLINGCONV_H
namespace llvm {
/// CallingConv Namespace - This namespace contains an enum with a value for
/// the well-known calling conventions.
///
namespace CallingConv {
enum ID {
// C - The default llvm calling convention, compatible with C. This
// convention is the only calling convention that supports varargs calls.
// As with typical C calling conventions, the callee/caller have to tolerate
// certain amounts of prototype mismatch.
C = 0,
// Generic LLVM calling conventions. None of these calling conventions
// support varargs calls, and all assume that the caller and callee
// prototype exactly match.
// Fast - This calling convention attempts to make calls as fast as possible
// (e.g. by passing things in registers).
Fast = 8,
// Cold - This calling convention attempts to make code in the caller as
// efficient as possible under the assumption that the call is not commonly
// executed. As such, these calls often preserve all registers so that the
// call does not break any live ranges in the caller side.
Cold = 9,
// Target - This is the start of the target-specific calling conventions,
// e.g. fastcall and thiscall on X86.
FirstTargetCC = 64,
};
} // End CallingConv namespace
} // End llvm namespace
#endif

Some files were not shown because too many files have changed in this diff Show More