Commit Graph

57341 Commits

Author SHA1 Message Date
Johnny Chen 52a6ab3ba7 Add SETEND and BXJ instructions for disassembly only.
llvm-svn: 96075
2010-02-13 02:51:09 +00:00
Sean Callanan 4d804d794f Added the rdtscp instruction to the x86 instruction
tables.

llvm-svn: 96073
2010-02-13 02:06:11 +00:00
Jakob Stoklund Olesen b659c76c77 Fix PR6283.
When coalescing with a physreg, remember to add imp-def and imp-kill when
dealing with sub-registers.

Also fix a related bug in VirtRegRewriter where substitutePhysReg may
reallocate the operand list on an instruction and invalidate the reg_iterator.
This can happen when a register is mentioned twice on the same instruction.

llvm-svn: 96072
2010-02-13 02:06:10 +00:00
Dan Gohman 5b18f039eb Fix a pruning heuristic which implicitly assumed that SmallPtrSet is
deterministically sorted.

llvm-svn: 96071
2010-02-13 02:06:02 +00:00
Evan Cheng 3b065cdb64 Teach MachineFrameInfo to track maximum alignment while stack objects are being
created. This ensures it's updated at all time. It means targets which perform
dynamic stack alignment would know whether it is required and whether frame
pointer register cannot be made available register allocation.
This is a fix for rdar://7625239. Sorry, I can't create a reasonably sized test
case.

llvm-svn: 96069
2010-02-13 01:56:41 +00:00
Jakob Stoklund Olesen 492b8b42cd Enable the inlinehint attribute in the Inliner.
Functions explicitly marked inline will get an inlining threshold slightly
more aggressive than the default for -O3. This means than -O3 builds are
mostly unaffected while -Os builds will be a bit bigger and faster.

The difference depends entirely on how many 'inline's are sprinkled on the
source.

In the CINT2006 suite, only these tests are significantly affected under -Os:

               Size   Time
471.omnetpp   +1.63% -1.85%
473.astar     +4.01% -6.02%
483.xalancbmk +4.60%  0.00%

Note that 483.xalancbmk runs too quickly to give useful timing results.

llvm-svn: 96066
2010-02-13 01:51:53 +00:00
Sean Callanan 44232af55a Fixed encodings for invlpg, invept, and invvpid.
llvm-svn: 96065
2010-02-13 01:48:34 +00:00
Daniel Dunbar d0c6d361fe MC/AsmParser: Attempt to constant fold expressions up-front. This ensures we avoid fixups for obvious cases like '-(16)'.
llvm-svn: 96064
2010-02-13 01:28:07 +00:00
Johnny Chen b0208d2a06 Added a bunch of saturating add/subtract instructions for disassembly only.
llvm-svn: 96063
2010-02-13 01:21:01 +00:00
Chris Lattner 509154e0f9 rip out the 'heinous' x86 MCCodeEmitter implementation.
We still have the templated X86 JIT emitter, *and* the
almost-copy in X86InstrInfo for getting instruction sizes.

llvm-svn: 96059
2010-02-13 00:49:29 +00:00
Chris Lattner 140caa7240 remove special cases for vmlaunch, vmresume, vmxoff, and swapgs
fix swapgs to be spelled right.

llvm-svn: 96058
2010-02-13 00:41:14 +00:00
Bob Wilson 01abf8fc2f Besides removing phi cycles that reduce to a single value, also remove dead
phi cycles.  Adjust a few tests to keep dead instructions from being optimized
away.  This (together with my previous change for phi cycles) fixes Apple
radar 7627077.

llvm-svn: 96057
2010-02-13 00:31:44 +00:00
Dan Gohman fe873e7c10 Override dominates and properlyDominates for SCEVAddRecExpr, as a
SCEVAddRecExpr doesn't necessarily dominate blocks merely dominated
by all of its operands. This fixes an abort compiling 403.gcc.

llvm-svn: 96056
2010-02-13 00:19:39 +00:00
Daniel Dunbar 224340cabe MC/X86: Push immediate operands as immediates not expressions when possible.
llvm-svn: 96055
2010-02-13 00:17:21 +00:00
Jeffrey Yasskin 01f88a96c5 Make PassRegistrar thread-safe since it can be modified by code running in
separate LLVMContexts.

llvm-svn: 96051
2010-02-13 00:03:17 +00:00
Chris Lattner 064e926362 Remove special cases for [LM]FENCE, MONITOR and MWAIT from
encoder and decoder by using new MRM_ forms.

llvm-svn: 96048
2010-02-12 23:54:57 +00:00
Chris Lattner 34749d879d add some disassemble testcases for weird instructions
llvm-svn: 96045
2010-02-12 23:46:48 +00:00
Sean Callanan dde9c12307 Reworked the Intel disassembler to support instructions
whose opcodes extend into the ModR/M field using the
Form field of the instruction rather than by special
casing each instruction.  Commented out the special
casing of VMCALL, which is the first instruction to use
this special form.  While I was in the neighborhood,
added a few comments for people modifying the Intel
disassembler. 

llvm-svn: 96043
2010-02-12 23:39:46 +00:00
Chris Lattner 1e827fd8ca implement the rest of correct x86-64 encoder support for
rip-relative addresses, and add a testcase.

llvm-svn: 96040
2010-02-12 23:24:09 +00:00
Dale Johannesen 626b79d6a6 Add the problem I just hacked around in 96015/96020.
The solution there produces correct code, but is seriously
deficient in several ways.

llvm-svn: 96039
2010-02-12 23:16:24 +00:00
Chris Lattner 741580a5bd give MCCodeEmitters access to the current MCContext.
llvm-svn: 96038
2010-02-12 23:12:47 +00:00
Jeffrey Yasskin 2d36eb6e18 Make JIT::runFunction clean up the generated stub function.
Patch by Shivram K!

llvm-svn: 96037
2010-02-12 23:05:31 +00:00
Chris Lattner 4ad96055fb implement infrastructure to support fixups for rip-rel
addressing.  This isn't complete because I need an MCContext
to generate new MCExprs.

llvm-svn: 96036
2010-02-12 23:00:36 +00:00
Johnny Chen 29a9103ee6 Add YIELD, WFE, WFI, and SEV instructions for disassembly only.
Plus add two formats: MiscFrm and ThumbMiscFrm.  Some of the for disassembly
only instructions are changed from Pseudo Format to MiscFrm Format.

llvm-svn: 96032
2010-02-12 22:53:19 +00:00
Chris Lattner d18320361f pull the rip-relative addressing mode case up early.
llvm-svn: 96031
2010-02-12 22:47:55 +00:00
Chris Lattner 6c1c0141be fixme resolved!
llvm-svn: 96029
2010-02-12 22:39:06 +00:00
Chris Lattner 0055e75249 start producing reloc_pcrel_4byte/reloc_pcrel_1byte for calls.
llvm-svn: 96028
2010-02-12 22:36:47 +00:00
Bob Wilson e464c658ce Fix a comment typo.
llvm-svn: 96027
2010-02-12 22:34:54 +00:00
Chris Lattner 12455ca03d enhance the immediate field encoding to know whether the immediate
is pc relative or not, mark call and branches as pcrel.

llvm-svn: 96026
2010-02-12 22:27:07 +00:00
Evan Cheng 439bda9d3f Load / store multiple instructions cannot load / store sp. Sorry, can't come up with a reasonable test case.
llvm-svn: 96023
2010-02-12 22:17:21 +00:00
Dale Johannesen cb39340b81 This should have gone in with 26015, see comments there.
llvm-svn: 96020
2010-02-12 22:00:40 +00:00
Johnny Chen dc2051c802 Add halfword multiply accumulate long SMLALBB/BT/TB/TT for disassembly only.
llvm-svn: 96019
2010-02-12 21:59:23 +00:00
Chris Lattner 486483ac95 doxygenize some comments, patch by Peter Collingbourne!
llvm-svn: 96018
2010-02-12 21:54:28 +00:00
Dale Johannesen 26062150fa When save/restoring CR at prolog/epilog, in a large
stack frame, the prolog/epilog code was using the same
register for the copy of CR and the address of the save slot.  Oops.
This is fixed here for Darwin, sort of, by reserving R2 for this case.
A better way would be to do the store before the decrement of SP,
which is safe on Darwin due to the red zone.

SVR4 probably has the same problem, but I don't know how to fix it;
there is no red zone and R2 is already used for something else.
I'm going to leave it to someone interested in that target.

Better still would be to rewrite the CR-saving code completely;
spilling each CR subregister individually is horrible code.

llvm-svn: 96015
2010-02-12 21:35:34 +00:00
Chris Lattner 392be58cad Add support for a union type in LLVM IR. Patch by Talin!
llvm-svn: 96011
2010-02-12 20:49:41 +00:00
Johnny Chen bdf1b9520c Add SWP (Swap) and SWPB (Swap Byte) for disassembly only.
llvm-svn: 96010
2010-02-12 20:48:24 +00:00
Evan Cheng 545d36019b Also recognize armv6t2-* and armv5te-* triplets.
llvm-svn: 96008
2010-02-12 20:39:35 +00:00
Dan Gohman 1a8674e60b Fix a case of mismatched types in an Add that turned up in 447.dealII.
llvm-svn: 96007
2010-02-12 20:39:25 +00:00
Evan Cheng 9aa30fbe02 Add ARM bitcode file magic.
llvm-svn: 96006
2010-02-12 20:13:44 +00:00
Dan Gohman 2b75de97c0 Reapply 95979, a compile-time speedup, now that the bug it exposed is fixed.
llvm-svn: 96005
2010-02-12 19:35:25 +00:00
Dan Gohman 363f847ec6 Fix this code to avoid dereferencing an end() iterator in
offset distributions it doesn't expect.

llvm-svn: 96002
2010-02-12 19:20:37 +00:00
Johnny Chen cf20cbec49 Add CPS, MRS, MRSsys, MSR, MSRsys for disassembly only.
llvm-svn: 95999
2010-02-12 18:55:33 +00:00
Dale Johannesen 30d99f4b9b Rewrite handling of DBG_VALUE; previous algorithm
didn't handle
X =
Y<dead> = use X
DBG_VALUE(X)
I was hoping to avoid this approach as it's slower,
but I don't think it can be done.

llvm-svn: 95996
2010-02-12 18:40:17 +00:00
Chris Lattner 75879be9d8 1. modernize the constantmerge pass, using densemap/smallvector.
2. don't bother trying to merge globals in non-default sections,
   doing so is quite dubious at best anyway.
3. fix a bug reported by Arnaud de Grandmaison where we'd try to
   merge two globals in different address spaces.

llvm-svn: 95995
2010-02-12 18:17:23 +00:00
Chris Lattner 554003f481 rename test
llvm-svn: 95993
2010-02-12 18:05:00 +00:00
Daniel Dunbar e0b2c69d3c Revert "Reverse the order for collecting the parts of an addrec. The order", it
is breaking llvm-gcc bootstrap.

llvm-svn: 95988
2010-02-12 17:27:08 +00:00
Anton Korobeynikov b9ce3cc458 Testcases for recent stdcall / fastcall mangling improvements
llvm-svn: 95982
2010-02-12 15:29:13 +00:00
Anton Korobeynikov c3c357006e Setup correct data layout to match gcc's expectations on mingw32.
llvm-svn: 95981
2010-02-12 15:28:56 +00:00
Anton Korobeynikov c9276dfe04 Cleanup stdcall / fastcall name mangling.
This should fix alot of problems we saw so far, e.g. PRs 5851 & 2936

llvm-svn: 95980
2010-02-12 15:28:40 +00:00
Dan Gohman 0194f58047 Reverse the order for collecting the parts of an addrec. The order
doesn't matter, except that ScalarEvolution tends to need less time
to fold the results this way.

llvm-svn: 95979
2010-02-12 11:08:26 +00:00
Dan Gohman 45774ce0ad Reapply the new LoopStrengthReduction code, with compile time and
bug fixes, and with improved heuristics for analyzing foreign-loop
addrecs.

This change also flattens IVUsers, eliminating the stride-oriented
groupings, which makes it easier to work with.

llvm-svn: 95975
2010-02-12 10:34:29 +00:00
Lang Hames c7ef4cc9fc * Updated the cost matrix normalization proceedure to better handle infinite costs.
* Enabled R1/R2 application for nodes with infinite spill costs in the Briggs heuristic (made
safe by the changes to the normalization proceedure).
* Removed a redundant header.

llvm-svn: 95973
2010-02-12 09:43:37 +00:00
Evan Cheng 0e4df63bd5 Update test to match 95961.
llvm-svn: 95971
2010-02-12 07:48:46 +00:00
Evan Cheng 993bd1b7da Test for 95961.
llvm-svn: 95962
2010-02-12 02:35:03 +00:00
Chris Lattner f7477e599f add a bunch of mod/rm encoding types for fixed mod/rm bytes.
This will work better for the disassembler for modeling things
like lfence/monitor/vmcall etc.

llvm-svn: 95960
2010-02-12 02:06:33 +00:00
Evan Cheng 67e45e1670 Test case for 95958.
llvm-svn: 95959
2010-02-12 02:02:23 +00:00
Chris Lattner 44ac89f517 revert r95949, it turns out that adding new prefixes is not a
great solution for the disassembler, we'll go with "plan b".

llvm-svn: 95957
2010-02-12 01:55:31 +00:00
Daniel Dunbar 692d06fb77 MC: Fix bug where trailing tied operands were forgotten; the X86 assembler
matcher is now free of implicit operands!
 - Still need to clean up the code now that we don't to worry about implicit
   operands, and to make it a hard error if an instruction fails to specify all
   of its operands for some reason.

llvm-svn: 95956
2010-02-12 01:46:54 +00:00
Johnny Chen 905a2d7727 Added coprocessor Instructions CDP, CDP2, MCR, MCR2, MRC, MRC2, MCRR, MCRR2,
MRRC, MRRc2.  For disassembly only.

llvm-svn: 95955
2010-02-12 01:44:23 +00:00
Bob Wilson 0827e040e0 Add a new pass on machine instructions to optimize away PHI cycles that
reduce down to a single value.  InstCombine already does this transformation
but DAG legalization may introduce new opportunities.  This has turned out to
be important for ARM where 64-bit values are split up during type legalization:
InstCombine is not able to remove the PHI cycles on the 64-bit values but
the separate 32-bit values can be optimized.  I measured the compile time 
impact of this (running llc on 176.gcc) and it was not significant.

llvm-svn: 95951
2010-02-12 01:30:21 +00:00
Daniel Dunbar d7e9212e2d X86: Fix definition for RCL/RCR.*m? operations -- they were getting represented
with "tied memory operands", which is wrong.

llvm-svn: 95950
2010-02-12 01:22:03 +00:00
Chris Lattner 336f9abb45 add another bit of space for new kinds of instruction prefixes.
llvm-svn: 95949
2010-02-12 01:15:16 +00:00
Nate Begeman c780af6471 Add a missing pattern for movhps so that we get:
movq	(%ecx,%edx,2), %xmm2
movhps	(%ecx,%eax,2), %xmm2

rather than:

movq     (%eax, %edx, 2), %xmm2		
movq     (%eax, %ebx, 2), %xmm3		
movlhps  %xmm3, %xmm2			

Testcase forthcoming.

llvm-svn: 95948
2010-02-12 01:10:45 +00:00
Chris Lattner 1572e760bc fix the encodings of monitor and mwait, which were completely
busted in both encoders.  I'm not bothering to fix it in the
old one at this point.

llvm-svn: 95947
2010-02-12 01:06:22 +00:00
Chris Lattner 62f50dad8d improve support for minix, PR6280, patch by
Kees van Reeuwijk!

llvm-svn: 95946
2010-02-12 00:37:46 +00:00
Charles Davis be5557e86b Add a new function attribute, 'alignstack'. It will indicate (when the backends
implement support for it) that the stack should be forcibly realigned in the
prologue (and the process reversed in the epilogue).

llvm-svn: 95945
2010-02-12 00:31:15 +00:00
Jakob Stoklund Olesen 93c92225af Reapply coalescer fix for better cross-class coalescing.
This time with fixed test cases.

llvm-svn: 95938
2010-02-11 23:55:29 +00:00
Chris Lattner b1913c4df9 enhance llvm-mc -show-inst to print the enum of an instruction, like so:
testb	%al, %al                ## <MCInst #2412 TEST8rr
                                        ##   <MCOperand Reg:2>
                                        ##   <MCOperand Reg:2>>
	jne	LBB1_7                  ## <MCInst #938 JNE_1
                                        ##   <MCOperand Expr:(LBB1_7)>>

llvm-svn: 95935
2010-02-11 22:57:32 +00:00
Chris Lattner 524138176d add a new MCInstPrinter::getOpcodeName interface, when it is
implemented, llvm-mc --show-inst now uses it to print the
instruction opcode as well as the number.

llvm-svn: 95929
2010-02-11 22:39:10 +00:00
Anton Korobeynikov 9e8baa5c17 Document binutils requirements for coff targets (cygwin / mingw32).
llvm-svn: 95928
2010-02-11 21:51:51 +00:00
Chris Lattner b8af65ed0b improve encoding information for branches. We now know they have
8 or 32-bit immediates, which allows the new encoder to handle
them.

llvm-svn: 95927
2010-02-11 21:45:31 +00:00
Daniel Dunbar 1d34759721 MC: Move assembler-backend's fixup list into the fragment.
llvm-svn: 95926
2010-02-11 21:29:46 +00:00
Daniel Dunbar ee82e763e6 MC: Move MCSectionData::Fixup out to MCAsmFixup.
llvm-svn: 95925
2010-02-11 21:29:29 +00:00
Chris Lattner ddeceae839 make getFixupKindInfo return a const reference, allowing
the tables to be const.  Teach MCCodeEmitter to handle
the target-indep kinds so that we don't crash on them.

llvm-svn: 95924
2010-02-11 21:27:18 +00:00
Jakob Stoklund Olesen 0d642824d6 Revert functional change. This broke a bunch of tests.
llvm-svn: 95921
2010-02-11 21:19:44 +00:00
Chris Lattner 2a34015abc switch to target-indep fixups for 1/2/4/8 byte data.
llvm-svn: 95920
2010-02-11 21:17:54 +00:00
Devang Patel c07f1f4f7b revert 95903.
llvm-svn: 95918
2010-02-11 20:58:56 +00:00
Jakob Stoklund Olesen 28139f0043 It is always good to do a cross-class join when the large register has a tiny interval.
Also avoid division by zero.

llvm-svn: 95917
2010-02-11 20:58:45 +00:00
Johnny Chen af88c0a84d Added LDRT/LDRBT/STRT/STRBT for disassembly only.
llvm-svn: 95916
2010-02-11 20:31:08 +00:00
Chris Lattner 1f298326b0 unbreak the build.
llvm-svn: 95915
2010-02-11 19:52:11 +00:00
Dan Gohman f34f55b873 llvm-db was removed.
llvm-svn: 95904
2010-02-11 19:35:26 +00:00
Devang Patel 11ddc679ca Destroy MDNodes while destructing llvm context.
llvm-svn: 95903
2010-02-11 19:35:10 +00:00
Chris Lattner e140686d9f refactor x86 conditional branches to use a multipattern
that generates the 1-byte and 4-byte immediate versions
from one definition.

llvm-svn: 95902
2010-02-11 19:31:22 +00:00
Chris Lattner 2b0a7a2592 refactor the conditional jump instructions in the .td file to
use a multipattern that generates both the 1-byte and 4-byte 
versions from the same defm

llvm-svn: 95901
2010-02-11 19:25:55 +00:00
Jeffrey Yasskin 8a30324e51 Make Kaleidoscope not link against the interpreter, since that didn't
work anyway (Interpreter::getPointerToFunction doesn't return a
callable pointer), and improve the error message when an
ExecutionEngine can't be created.

llvm-svn: 95896
2010-02-11 19:15:20 +00:00
Johnny Chen 3964059a16 Forgot to also check in this file for vcvt (floating-point <-> fixed-point, VFP).
Sorry!

llvm-svn: 95892
2010-02-11 18:47:03 +00:00
Dale Johannesen 177ced3953 Allow for more than one DBG_VALUE targeting the
same dead instruction.

llvm-svn: 95890
2010-02-11 18:23:23 +00:00
Dale Johannesen 12565de705 Don't allow DBG_VALUE to affect codegen.
llvm-svn: 95889
2010-02-11 18:22:31 +00:00
Johnny Chen 2588efd071 Added VCVT (between floating-point and fixed-point, VFP) for disassembly.
A8.6.297

llvm-svn: 95885
2010-02-11 18:17:16 +00:00
Johnny Chen f40b8e03fb Added BKPT/tBKPT (breakpoint) to the instruction table for disassembly purpose.
llvm-svn: 95884
2010-02-11 18:12:29 +00:00
Jakob Stoklund Olesen 45396438c3 Use array_pod_sort instead of std::sort for improved code size.
Use SmallVector instead of std::vector for better speed when indirectbr has
few successors.

llvm-svn: 95879
2010-02-11 18:06:56 +00:00
Eric Christopher cccdc13662 Make sure that ConstantExpr offsets also aren't off of extern
symbols.

Thanks to Duncan Sands for the testcase!

llvm-svn: 95877
2010-02-11 17:44:04 +00:00
Johnny Chen 9c13dfb5dd Add pseudo instruction TRAP for disassembly, which is encoded according to A5-21
as the "Permanently UNDEFINED" instruction.

llvm-svn: 95873
2010-02-11 17:14:31 +00:00
Bill Wendling 243e1f21db Use .empty() instead of .size().
llvm-svn: 95871
2010-02-11 10:37:57 +00:00
Chris Lattner fbf1f02fee dont' call getX86RegNum on X86::RIP, it doesn't like that. This
fixes the remaining x86-64 jit failures afaik.

llvm-svn: 95867
2010-02-11 08:45:56 +00:00
Chris Lattner 5a4ec879bf fix a really nasty bug I introduced in r95693: r12 (and r12d,
r12b, etc) also encodes to a R/M value of 4, which is just
as illegal as ESP/RSP for the non-sib version an address.

This fixes x86-64 jit miscompilations of a bunch of programs.

llvm-svn: 95866
2010-02-11 08:41:21 +00:00
Jeffrey Yasskin 00ea4a36d6 Fix (harmless) memory leak found by memcheck.
llvm-svn: 95862
2010-02-11 07:16:13 +00:00
Chris Lattner 6bb2463f85 Add and commonize encoder support for all immediates.
Stub out some dummy fixups to make things work.

We can now emit fixups like this:
	subl	$20, %esp               ## encoding: [0x83,0xec,A]
                                        ##   fixup A - offset: 2, value: 20, kind: fixup_1byte_imm

Emitting $20 as a single-byte fixup to be later resolved
by the assembler is ridiculous of course (vs just emitting
the byte) but this is a failure of the matcher, which 
should be producing an imm of 20, not an MCExpr of 20.

llvm-svn: 95860
2010-02-11 07:06:31 +00:00
Chris Lattner 167842f90b generalize EmitDisplacementField to work with any size
and rename it to EmitImmediate.

llvm-svn: 95859
2010-02-11 06:54:23 +00:00
Chris Lattner 3555993312 eliminate the dead IsPCRel argument.
llvm-svn: 95858
2010-02-11 06:51:36 +00:00
Chris Lattner 5a40e6c95c eliminate the dead "PCAdj" logic.
llvm-svn: 95857
2010-02-11 06:49:52 +00:00
Jeffrey Yasskin c660b23075 Fix some of the memcheck errors found in the JIT unittests.
llvm-svn: 95856
2010-02-11 06:41:30 +00:00
Chris Lattner 4e8137d678 Rename ValueRequiresCast to ShouldOptimizeCast, to better reflect
what it does.  Enhance it to return false to optimizing vector
sign extensions from vector comparisions, which is the idiom used
to get a splatted vector for a vector comparison.

Doing this breaks vector-casts.ll, add some compensating 
transformations to handle the important case they cover without
depending on this canonicalization.

This fixes rdar://7434900 a serious pessimization of vector compares.

llvm-svn: 95855
2010-02-11 06:26:33 +00:00
Chris Lattner 1d4eb8fac4 convert to filecheck.
llvm-svn: 95854
2010-02-11 06:24:37 +00:00
Chris Lattner c053cbbc4d Make DSE only scan blocks that are reachable from the entry
block.  Other blocks may have pointer cycles that will crash
basicaa and other alias analyses.  In any case, there is no
point wasting cycles optimizing dead blocks.  This fixes 
rdar://7635088

llvm-svn: 95852
2010-02-11 05:11:54 +00:00
Chris Lattner f492ece81e a testcase that doesn't crash GVN but could someday.
llvm-svn: 95851
2010-02-11 05:08:05 +00:00
Chris Lattner d924f63692 Make jump threading honor x|undef -> true and x&undef -> false,
instead of considering x|undef -> x, which may not be true.

llvm-svn: 95850
2010-02-11 04:40:44 +00:00
Eric Christopher 531ea566a6 Add ConstantExpr handling to Intrinsic::objectsize lowering.
Update testcase accordingly now that we can optimize another
section.

llvm-svn: 95846
2010-02-11 01:48:54 +00:00
Devang Patel d0d1fc0221 test case for r95842.
llvm-svn: 95844
2010-02-11 01:31:01 +00:00
Bill Wendling 7c2005aa6d Fix to get it to compile.
llvm-svn: 95840
2010-02-11 01:15:27 +00:00
Bill Wendling 6034260c43 Don't print out a default newline when emitting the section offset. There are
almost always comments afterwards that need printing.

llvm-svn: 95839
2010-02-11 01:13:02 +00:00
Jeffrey Yasskin e0913883b7 Make it possible to create multiple JIT instances at the same time, by removing
the global TheJIT and TheJITResolver variables.  Lazy compilation is supported
by a global map from a stub address to the JITResolver that knows how to
compile it.

Patch by Olivier Meurant!

llvm-svn: 95837
2010-02-11 01:07:39 +00:00
Jakob Stoklund Olesen 75521cab3e Reuse operand location when updating PHI instructions.
Calling RemoveOperand is very expensive on huge PHI instructions. This makes
early tail duplication run twice as fast on the Firefox JavaScript
interpreter.

llvm-svn: 95832
2010-02-11 00:34:33 +00:00
Jakob Stoklund Olesen 896428d630 Remove duplicate successors from indirectbr instructions before building the machine CFG.
This makes early tail duplication run 60 times faster when compiling the Firefox
JavaScript interpreter, see PR6186.

llvm-svn: 95831
2010-02-11 00:34:18 +00:00
Devang Patel 03936a1880 Ignore dbg info intrinsics.
llvm-svn: 95828
2010-02-11 00:20:49 +00:00
Kevin Enderby 37993197bf Remove the few # TAILCALL comments that snuck in. As they may fail on linux.
llvm-svn: 95827
2010-02-11 00:18:12 +00:00
Kevin Enderby cfd0e5a15e Update the X86 assembler matcher test case now that a few more things match
with some of the recent changes that have gone into llvm-mc.

llvm-svn: 95826
2010-02-11 00:13:43 +00:00
Dan Gohman f684e452ca Add support to llvm-extract for extracting multiple functions and/or
multiple global variables at a time.

llvm-svn: 95825
2010-02-10 23:58:53 +00:00
Mon P Wang 5b77f0dac1 The previous fix of widening divides that trap was too fragile as it depends on custom
lowering and requires that certain types exist in ValueTypes.h.  Modified widening to
check if an op can trap and if so, the widening algorithm will apply only the op on
the defined elements.  It is safer to do this in widening because the optimizer can't
guarantee removing unused ops in some cases.

llvm-svn: 95823
2010-02-10 23:37:45 +00:00
Dale Johannesen af3fe99821 Ignore debug info one more place during coalescing.
llvm-svn: 95819
2010-02-10 23:04:09 +00:00
Dale Johannesen 522f08be0b Allow isDebug inquiry on any MO.
llvm-svn: 95818
2010-02-10 23:03:20 +00:00
Bob Wilson 0f52d0c074 Delete dead PHI machine instructions. These can be created due to type
legalization even when the IR-level optimizer has removed dead phis, such
as when the high half of an i64 value is unused on a 32-bit target.
I had to adjust a few test cases that had dead phis.
This is a partial fix for Radar 7627077.

llvm-svn: 95816
2010-02-10 22:58:57 +00:00
Dale Johannesen 8bba1608bd Skip debug info in a couple of places.
llvm-svn: 95814
2010-02-10 21:47:48 +00:00
Bill Wendling 7742b6406b Use an index instead of pointers into the vector. If the vector resizes, then
the pointer values could be invalid.

llvm-svn: 95813
2010-02-10 21:41:57 +00:00
Dale Johannesen 1ccda7b7c4 When I rewrote this loop per Chris' preference I
changed its behavior.  Oops.

llvm-svn: 95811
2010-02-10 21:41:41 +00:00
Chris Lattner a34e96377e add a virtual dtor to MCTargetExpr, hopefully silencing some warnings.
llvm-svn: 95810
2010-02-10 21:37:31 +00:00
Eli Friedman 4d4c6944e9 A few missed optimizations; the last one could have a significant impact on
code with lots of bitfields.

llvm-svn: 95809
2010-02-10 21:26:04 +00:00
Chris Lattner 0d7b5e5d33 work around a gcc bug with -Wuninitialized.
llvm-svn: 95808
2010-02-10 21:22:51 +00:00
Devang Patel 211746a69a Strip new llvm.dbg.value intrinsic.
llvm-svn: 95807
2010-02-10 21:19:56 +00:00
Daniel Dunbar 3e0c9790f2 MC/X86 AsmMatcher: Fix a use after free spotted by d0k, and de-XFAIL
x86_32-encoding.s in on expectation of it passing.

llvm-svn: 95806
2010-02-10 21:19:28 +00:00
Daniel Dunbar df11958895 XFAIL this on linux until I figure out what is happening.
llvm-svn: 95804
2010-02-10 21:01:04 +00:00
Daniel Dunbar d3fda55857 lit: Ignore dot files when scanning for tests (e.g., editor temprary files,
etc.)

llvm-svn: 95803
2010-02-10 21:00:55 +00:00
Daniel Dunbar 5b785ac0a3 MC/AsmMatcher: Tweak conversion function name.
llvm-svn: 95802
2010-02-10 21:00:47 +00:00
Dan Gohman bd11c41b91 Minor whitespace cleanups.
llvm-svn: 95801
2010-02-10 20:42:57 +00:00
Dan Gohman c42c5243a1 Use an AssemblyAnnotatorWriter to clean up IVUsers' debug output.
The "uses=" comments are just clutter in this context.

llvm-svn: 95799
2010-02-10 20:42:37 +00:00
Dan Gohman e34890f921 Add a hook to AssemblyAnnotationWriter to allow custom info comments
to be printed, in place of the familiar "uses=" comments.

llvm-svn: 95798
2010-02-10 20:41:46 +00:00
Dan Gohman e78a922eef Use doxygen comment syntax.
llvm-svn: 95797
2010-02-10 20:23:33 +00:00
Dan Gohman 97c5902e78 Fix several comments which had previously been "the the" where a
different word was intended.

llvm-svn: 95795
2010-02-10 20:04:19 +00:00
Kevin Enderby cc152d6159 Replace this file containing 4 tests of x86 32-bit encodings with a file
containing the subset of the full auto generated test case that currently
encodes correctly.  Again it is useful as we bring up the the new encoder
to make sure currently working stuff stays working.

llvm-svn: 95791
2010-02-10 19:13:56 +00:00
Johnny Chen c7e14704d0 Added NOP, DBG, SVC to the instruction table for disassembly purpose.
llvm-svn: 95784
2010-02-10 18:02:25 +00:00
Dan Gohman 4a618827de Fix "the the" and similar typos.
llvm-svn: 95781
2010-02-10 16:03:48 +00:00
Dan Gohman 7bf08432d2 Minor code simplification.
llvm-svn: 95780
2010-02-10 15:54:22 +00:00
Benjamin Kramer 4b86e9b7a6 Silence GCC warnings.
llvm-svn: 95779
2010-02-10 13:34:02 +00:00
Daniel Dunbar f22553a1c7 MC/AsmMatcher: Add support for creating tied operands when constructing MCInsts.
- Pretty messy, but we need to rework how we handle tied operands in MCInst
   anyway.

llvm-svn: 95774
2010-02-10 08:15:48 +00:00
Chris Lattner de03bd0ab4 emit some simple (and probably incorrect) fixups for symbolic
displacement values.

llvm-svn: 95773
2010-02-10 06:52:12 +00:00
Chris Lattner f58d0074d7 keep track of what the current byte being emitted is
throughout the X86 encoder.

llvm-svn: 95771
2010-02-10 06:41:02 +00:00
Chris Lattner a725d785a9 simplify displacement handling, emit displacements by-operand
even for the immediate case.  No functionality change.

llvm-svn: 95770
2010-02-10 06:30:00 +00:00
Dan Gohman 183a423af9 Canonicalize sizeof and alignof on pointer types to a canonical
pointer type.

llvm-svn: 95769
2010-02-10 06:13:07 +00:00
Dan Gohman e69b99baaf Implement operators |=, &=, and ^= for SmallBitVector, and remove the
restriction in BitVector for |= and ^= that the operand must be the
same length.

llvm-svn: 95768
2010-02-10 05:54:04 +00:00
Daniel Dunbar 605474463f MC: Switch MCFixup to just hold an MCExpr pointer instead of index into the
MCInst it came from.

llvm-svn: 95767
2010-02-10 04:47:08 +00:00
Daniel Dunbar 8373cc8cec Fix a signed comparison warning.
llvm-svn: 95766
2010-02-10 04:46:51 +00:00
Daniel Dunbar 351f9edacb Remove stray DOS newline.
llvm-svn: 95765
2010-02-10 04:10:10 +00:00
Daniel Dunbar 1e96fca746 Add a ReleaseNotes FIXME.
llvm-svn: 95764
2010-02-10 04:09:52 +00:00
Garrison Venn b282f60d19 Prevented build on WINDOWS using default make system. Stopped WINDOWS build
at eh llvm/examples level using if check on LLVM_ON_UNIX.

llvm-svn: 95763
2010-02-10 03:38:29 +00:00
Sean Callanan 7b0c339510 Updated the enhanced disassembly library's TableGen
backend to not use exceptions at all except in cases
of actual error.

llvm-svn: 95762
2010-02-10 03:23:23 +00:00
Garrison Venn c824adb593 Prevented ExceptionDemo example being built on WINDOWS via if( NOT WIN32 )
check in examples cmake list file. This has NOT been tested.

llvm-svn: 95761
2010-02-10 02:50:08 +00:00
Sean Callanan e9959a5f1a Updated the TableGen emitter for the Enhanced
Disassembler to take advantage of the refactored
AsmWriterInst.h.  Note removed parser code.

llvm-svn: 95760
2010-02-10 02:47:08 +00:00
Sean Callanan 515937d2ea Changed AsmWriterOperand to also include the index of the
operand into the CodeGenInstruction's list of operands,
which is useful for EDEmitter.  (Still working on PR6219)

llvm-svn: 95759
2010-02-10 02:27:43 +00:00
Evan Cheng 29b8f554fc Now that ShrinkDemandedOps() is separated out from DAG combine. It sometimes leave some obvious nops which dag combine used to clean up afterwards e.g. (trunk (ext n)) -> n. Look for them and squash them.
llvm-svn: 95757
2010-02-10 02:17:34 +00:00
Chris Lattner 7ed514b23e "fixup" a comment.
llvm-svn: 95754
2010-02-10 01:46:47 +00:00
Chris Lattner a9dfb1bc07 Introduce a new CodeGenInstruction::ConstraintInfo class
for representing constraint info semantically instead of
as a c expression that will be blatted out to the .inc
file.  Fix X86RecognizableInstr to use this instead of
parsing C code :).

llvm-svn: 95753
2010-02-10 01:45:28 +00:00
Daniel Dunbar 75c9a4eeae llvm-mc: Remove --show-fixups and always show as part of --show-encoding.
Also, fix a silly memory leak.

llvm-svn: 95752
2010-02-10 01:41:14 +00:00
Dale Johannesen f8b0e44584 Rewrite loop to suit Chris' preference.
llvm-svn: 95749
2010-02-10 01:31:26 +00:00
Chris Lattner ea26fa9971 fix a layering violation: VirtRegRewriter.cpp shouldn't use AsmPrinter.h.
llvm-svn: 95748
2010-02-10 01:23:18 +00:00
Evan Cheng 0a75ceee38 Remove duplicated #include.
llvm-svn: 95747
2010-02-10 01:22:57 +00:00
Evan Cheng 3ebd551aac Emit an error for illegal inline asm constraint (which uses illegal type) rather than asserting.
llvm-svn: 95746
2010-02-10 01:21:02 +00:00
Chris Lattner c9505b68c8 fix missing #includes.
llvm-svn: 95745
2010-02-10 01:17:36 +00:00
Chris Lattner 69920c5c8a daniel *really* likes fixups!
llvm-svn: 95742
2010-02-10 01:05:28 +00:00
Chris Lattner f0b06d4ed4 Stop MachineInstr.h from #including AsmPrinter.h
llvm-svn: 95741
2010-02-10 01:04:16 +00:00
Bill Wendling a0cd0e11c9 Improve comments a even more.
llvm-svn: 95740
2010-02-10 00:59:47 +00:00
Dale Johannesen f8f9f55468 Skip DBG_VALUE many places in live intervals and
register coalescing.  This fixes many crashes and
places where debug info affects codegen (when
dbg.value is lowered to machine instructions, which
it isn't yet in TOT).

llvm-svn: 95739
2010-02-10 00:55:42 +00:00
Chris Lattner 74e6852510 Move verbose asm instruction comments to using MCStreamer.
The major win of this is that the code is simpler and they 
print on the same line as the instruction again:

        movl    %eax, 96(%esp)          ## 4-byte Spill
        movl    96(%esp), %eax          ## 4-byte Reload
        cmpl    92(%esp), %eax          ## 4-byte Folded Reload
        jl      LBB7_86

llvm-svn: 95738
2010-02-10 00:47:53 +00:00
Bill Wendling b188e92ca9 Improve comments a bit more.
llvm-svn: 95737
2010-02-10 00:45:28 +00:00
Dale Johannesen 222c75bea2 more comment updates
llvm-svn: 95736
2010-02-10 00:44:23 +00:00
Dale Johannesen d40d42c9e5 Add isDebug argument to ChangeToRegister; this prevents
the field from being used uninitialized later in some cases.

llvm-svn: 95735
2010-02-10 00:41:49 +00:00
Chris Lattner ff68a42121 print all the newlines at the end of instructions with
OutStreamer.AddBlankLine instead of textually.

llvm-svn: 95734
2010-02-10 00:36:00 +00:00
Kenneth Uildriks 08f618cd03 IntegerValType holds a uint32_t, so its constructor should take a uint32_t. This allows it to be properly initialized with bit widths > 65535
llvm-svn: 95731
2010-02-10 00:14:03 +00:00
Dale Johannesen 3d1f1cccbb Fix comments to reflect renaming elsewhere.
llvm-svn: 95730
2010-02-10 00:11:11 +00:00
Kevin Enderby a7c1d6cfd1 Fix the encoding of the movntdqa X86 instruction. It was missing the 0x66
prefix which is part of the opcode encoding.

llvm-svn: 95729
2010-02-10 00:10:31 +00:00
Chris Lattner 482bf69bfe Add ability for MCInstPrinters to add comments for instructions.
Enhance the x86 backend to show the hex values of immediates in
comments when they are large.  For example:

        movl    $1072693248, 4(%esp)    ## imm = 0x3FF00000

llvm-svn: 95728
2010-02-10 00:10:18 +00:00
David Greene 509be1fe5e TableGen fragment refactoring.
Move some utility TableGen defs, classes, etc. into a common file so
they may be used my multiple pattern files.  We will use this for
the AVX specification to help with the transition from the current
SSE specification.

llvm-svn: 95727
2010-02-09 23:52:19 +00:00
Garrison Venn f4d2f8464d Adds a JIT based exception handling example to the examples directory.
Both zero cost example domain specific, and C++ foreign exception handling are 
shown. The example's documentation fully explains how to run the example.

Notes:

1)   The code uses an extremely simple type info model.
2)   Only a single landing pad is used per unwind edge 
     (one call to llvm.eh.selector)
3)   llvm.eh.selector support for filter arguments is not given.
4)   llvm.eh.typeid.for is not used.
5)   Forced unwind behavior is not supported.
6)   Very little if any error handling is given.
7)   __attribute__((__aligned__)) is used.
8)   The code uses parts from the llvm compiler-rt project and
     the llvm Kaleidoscope example.
9)   The code has not been ported or tested on WINDOWS.
10)  The code was not tested with a cmake build.
11)  The code was tested for a debug build on 32bit X86 CentOS LINUX, 
     and both a debug and release build on OS X 10.6.2 (64bit).

llvm-svn: 95723
2010-02-09 23:22:43 +00:00
Sean Callanan d4b19e12ed Fixed some indentation in the AsmWriterInst
implementation.  Also changed the constructor
so that it does not require a Record, making it
usable by the EDEmitter.

llvm-svn: 95715
2010-02-09 23:06:35 +00:00
Johnny Chen 1215c774f2 Add VBIF/VBIT for disassembly only.
A8.6.279

llvm-svn: 95713
2010-02-09 23:05:23 +00:00
Jeffrey Yasskin 914050bc5a Make --disable-libffi work on systems with libffi installed. Also
make no-ffi the default even on systems with libffi.  This fixes
http://llvm.org/PR5018.

llvm-svn: 95712
2010-02-09 23:03:44 +00:00
David Greene 893047d43e Only dump output in debug mode.
llvm-svn: 95711
2010-02-09 23:03:05 +00:00
Daniel Dunbar 9a0a46163d llvm-mc: Add --show-fixups option, for displaying the instruction fixup information in the asm comments.
llvm-svn: 95710
2010-02-09 23:00:14 +00:00
Daniel Dunbar 0e42dc0dac MC/X86: Add a dummy implementation of MCFixup generation for hacky X86 MCCodeEmitter.
llvm-svn: 95709
2010-02-09 23:00:03 +00:00
Daniel Dunbar b311a6b3ae MC: First cut at MCFixup, for getting fixup/relocation information out of an MCCodeEmitter.
llvm-svn: 95708
2010-02-09 22:59:55 +00:00
Bill Wendling bf02536262 Improve comments in the LSDA somewhat. They can be improved much more.
llvm-svn: 95707
2010-02-09 22:49:16 +00:00
Johnny Chen b618f66c5f Added VMRS/VMSR for disassembly only.
A8.6.335 & A8.6.336

llvm-svn: 95703
2010-02-09 22:35:38 +00:00
Sean Callanan a36341366b Added AsmWriterInst.cpp to the CMakeList so that
it builds OK on Visual Studio.

llvm-svn: 95702
2010-02-09 22:29:16 +00:00
Dale Johannesen 7c7b9a2807 Disable unittests/ADT/BitVectorTest on PPC Darwin.
It fails with a release build only, for reasons
as yet unknown.  (If there's a better way to Xfail
things here let me know, doesn't seem to be any
prior art in unittests.)

llvm-svn: 95700
2010-02-09 22:15:27 +00:00
Chris Lattner 8aef06f8eb port encoder enhancements over to the new encoder.
llvm-svn: 95699
2010-02-09 21:57:34 +00:00
Sean Callanan b7e8f4a30e Per PR 6219, factored AsmWriterInst and AsmWriterOperand
out of the AsmWriterEmitter.  This patch does the physical
code movement, but leaves the implementation unchanged. I'll
make any changes necessary to generalize the code in a
separate patch.

llvm-svn: 95697
2010-02-09 21:50:41 +00:00
Chris Lattner 0c3b66cd87 fix X86 encoder to output [disp] only addresses with no SIB byte
in X86-32 mode.  This is still required in x86-64 mode to avoid
forming [disp+rip] encoding.  Rewrite the SIB byte decision logic
to be actually understandable.

llvm-svn: 95693
2010-02-09 21:47:19 +00:00
Eric Christopher 7b7028fd24 Move Intrinsic::objectsize lowering back to InstCombineCalls and
enable constant 0 offset lowering.

llvm-svn: 95691
2010-02-09 21:24:27 +00:00
Chris Lattner 45d89644ae revert r95689: getX86RegNum(BaseReg) != N86::ESP is
a confusing idiom to check for ESP or RSP.

llvm-svn: 95690
2010-02-09 21:21:26 +00:00
Chris Lattner e464a4d815 simplify.
llvm-svn: 95689
2010-02-09 21:00:12 +00:00
Dale Johannesen 8d3aa40bae Re-disable for Darwin; I was mistaken to think this was fixed.
llvm-svn: 95688
2010-02-09 19:54:29 +00:00