Commit Graph

22678 Commits

Author SHA1 Message Date
Duncan Sands 813384951e Use Intrinsic::getDeclaration in more places.
llvm-svn: 49338
2008-04-07 13:45:04 +00:00
Duncan Sands 1416ebf1fe The "stacksave is not nounwind problem" no longer
needs to be fixed here - a previous commit made sure
that intrinsics always get the right attributes.
So remove no-longer needed code, and while there use
Intrinsic::getDeclaration rather than getOrInsertFunction. 

llvm-svn: 49337
2008-04-07 13:43:58 +00:00
Duncan Sands fbc6adcc59 Use Intrinsic::getDeclaration to get hold of
intrinsics.  Fix up the argument type (should
be i8*, was an array*).

llvm-svn: 49336
2008-04-07 13:41:19 +00:00
Duncan Sands a8ff6ca2e3 Make sure that intrinsics automagically get the
right parameter attributes no matter how they
are obtained.

llvm-svn: 49335
2008-04-07 13:39:11 +00:00
Roman Levenstein 51f532f92d Re-commit of the r48822, where the infinite looping problem discovered
by Dan Gohman is fixed.

llvm-svn: 49330
2008-04-07 10:06:32 +00:00
Owen Anderson 0c1e634cbb Make GVN more memory efficient, particularly on code that contains a large number of
allocations, which GVN can't optimize anyways.

llvm-svn: 49329
2008-04-07 09:59:07 +00:00
Dale Johannesen 87e484f08b Mark calls to llvm.stacksave, llvm.stackrestore as
nounwind.  When such calls are inlined into something
else that is invoked, they were getting changed to invokes,
which is badness.

llvm-svn: 49299
2008-04-07 00:08:48 +00:00
Gabor Greif 92f493dc72 regenerate
llvm-svn: 49293
2008-04-06 23:07:54 +00:00
Chris Lattner 982e8502c9 fix warnings with assertions disabled.
llvm-svn: 49285
2008-04-06 21:50:58 +00:00
Chris Lattner 4db1f62d84 Silence warning when no assertions.
llvm-svn: 49284
2008-04-06 21:46:45 +00:00
Chris Lattner a39cfc5c5b silence a warning when assertions are disabled.
llvm-svn: 49283
2008-04-06 21:44:08 +00:00
Gabor Greif dd8b7a0a47 fix a warning
llvm-svn: 49282
2008-04-06 21:42:13 +00:00
Torok Edwin 613d7afe64 Prefer to expand mask for xor to -1, so we have a chance to turn it into a not.
If it cannot be expanded, it will keep the old behaviour and try to shrink the constant.
Part of enhancement for PR2191.

llvm-svn: 49280
2008-04-06 21:23:02 +00:00
Gabor Greif e9ecc68d8f API changes for class Use size reduction, wave 1.
Specifically, introduction of XXX::Create methods
for Users that have a potentially variable number of
Uses.

llvm-svn: 49277
2008-04-06 20:25:17 +00:00
Chris Lattner 8519c0ead8 disable this for now.
llvm-svn: 49248
2008-04-05 04:12:01 +00:00
Evan Cheng b5fdc923d3 1. IMPLICIT_DEF can *re-define* any register.
2. Coalescer can now create an interesting situation where a register def can
   reaches itself without being killed.

llvm-svn: 49246
2008-04-05 01:27:09 +00:00
Evan Cheng f77b5ef3d0 Favors pshufd over shufps when shuffling elements from one vector. pshufd is faster than shufps.
llvm-svn: 49244
2008-04-05 00:30:36 +00:00
Dale Johannesen 0ce4a7cc44 Make sure both PendingLoads and PendingExports are flushed
before an invoke.  Failure to do this causes references in
the landing pad to variables that were not set.  Fixes
g++.dg/eh/delayslot1.C
g++.dg/eh/fp-regs.C
g++.old-deja/g++.brendan/eh1.C

llvm-svn: 49243
2008-04-04 23:48:31 +00:00
Torok Edwin b20e659770 strdup needs <cstring>. This fixes a build error with g++-4.3.
llvm-svn: 49218
2008-04-04 16:08:00 +00:00
Chris Lattner 318d3ef88e Provide an initial cut at exposing JIT compiled symbols to performance
tools.  This is currently only enabled on the mac, but could easily be
supported by other hosts that are interested.

llvm-svn: 49207
2008-04-04 05:51:42 +00:00
Chris Lattner ee1817300a Make ExecutionEngine::updateGlobalMapping return the old mapping.
llvm-svn: 49206
2008-04-04 04:47:41 +00:00
Evan Cheng 14bee50e06 Undo PHI elimination copy placement patch. This causes coalescing (performace) issues.
llvm-svn: 49198
2008-04-04 01:20:05 +00:00
Evan Cheng 823017fdd1 This is done.
llvm-svn: 49197
2008-04-04 01:19:03 +00:00
Andrew Lenharth bfb7246fb6 if some functions don't have debug info, we were outputing the same label at the start of each of those functions. This makes assemblers unhappy
llvm-svn: 49176
2008-04-03 17:37:43 +00:00
Evan Cheng 58936a48ee - Turn copies of implicit_def into implicit_def instructions.
- Be smarter about coalescing copies from implicit_def.

llvm-svn: 49168
2008-04-03 16:41:54 +00:00
Evan Cheng 6d07b625aa Special handling of zero-sized live intervals.
llvm-svn: 49167
2008-04-03 16:40:27 +00:00
Evan Cheng 20aed56504 - Treat a live range defined by an implicit_def as a zero-sized one.
- Eliminate an implicit_def when it's being spilled.

llvm-svn: 49166
2008-04-03 16:39:43 +00:00
Evan Cheng aacf4f15b3 - PHI elimination also eliminates implicit_def that fits into a PHI node rather than copying it.
- Be (slightly) smarter about where to place the copies.

llvm-svn: 49165
2008-04-03 16:38:20 +00:00
Evan Cheng 916802a78e Start of a series of patches related to implicit_def.
There is no point in creating a long live range defined by an implicit_def. Scheduler now duplicates implicit_def instruction for each of its uses. Therefore, if an implicit_def node has multiple uses, it will become a number of very short live ranges, rather than a long one. This will make coalescer's job easier.

llvm-svn: 49164
2008-04-03 16:36:07 +00:00
Ted Kremenek 1d0436cdb0 Re-implemented Path::createDirectoryOnDisk (for Unix).
This method allows one to create a directory, and optionally create all parent
directories that do not exist.

The original implementation would require that *all* directories along a path
are writable by the user, including directories that already exist. For example,
suppose we wanted to create the directory "/tmp/foo/bar", and the directory
"/tmp" already exists, but not "/tmp/foo". Since "/tmp" is writable by all
users, the original implementation would work, and create "/tmp/foo", followed
by "/tmp/bar".

A problem occurred, however if one wanted to created the directory
"/Users/myuser/bar" (or equivalently "/home/myuser/bar"), and "/Users/myuser"
already existed and is writable by the current user. The directory
"/User/myuser" is writable by the user, but "/User" is not. The original
implementation of createDirectoryOnDisk would return with failure since "/User"
is not writable, even though "/User/mysuser" is writable.

The new implementation works by recursively creating parents as needed, and thus
doesn't need to check the permissions on every directory in a path.

llvm-svn: 49162
2008-04-03 16:11:31 +00:00
Evan Cheng 6c66bd368e Re-enable SSE4.
llvm-svn: 49158
2008-04-03 08:53:29 +00:00
Evan Cheng 6db4b4cc65 Fix x86-64 encoding bug. REX prefix must always follow 0x0F prefix. For example, extractps in 64bit mode: 66 REX 0F 3A 17, not 66 0F 3A REX 17.
llvm-svn: 49157
2008-04-03 08:53:17 +00:00
Evan Cheng d9129d1de3 Cosmetic
llvm-svn: 49156
2008-04-03 07:45:18 +00:00
Evan Cheng 3063c5546e Temporarily disabling SSE4 until we fix the encoding issues.
llvm-svn: 49129
2008-04-03 04:49:54 +00:00
Evan Cheng 025cea1126 Backing out 48222 temporarily.
llvm-svn: 49124
2008-04-03 03:13:16 +00:00
Dan Gohman bd72cea737 Suppress the 128-bit integer typedef on 32-bit targets, because
it causes compile errors.

llvm-svn: 49122
2008-04-02 23:52:49 +00:00
Dale Johannesen 491557712a Make EH work with unnamed functions. Reenable running
StripSymbols when EH is on.

llvm-svn: 49110
2008-04-02 20:10:52 +00:00
Dan Gohman 39d8b26322 Partial CBackend support for 128-bit integers. This is needed
now that llvm-gcc is lowering appropriately-sized struct returns
to i128 on x86-64.

llvm-svn: 49109
2008-04-02 19:40:14 +00:00
David Greene 586740f401 Iterators folloring a SmallVector erased element are invalidated so
don't access cached iterators from after the erased element.

Re-apply 49056 with SmallVector support.

llvm-svn: 49106
2008-04-02 18:24:46 +00:00
Evan Cheng d8616064d8 Now that I am told MachineRegisterInfo also tracks physical register uses / defs, I can do away with the horribleness I introduced a while back. It's impossible to detect if there is any use of a physical register below an instruction (and before any def of the register) with some cheap book keeping.
llvm-svn: 49105
2008-04-02 18:04:08 +00:00
Evan Cheng be3d44c3cb Remove #include<map> from LiveVariables.h. Not referenced.
llvm-svn: 49099
2008-04-02 17:23:50 +00:00
Dale Johannesen 8780ecbbac Cosmetic changes per EH patch review feedback.
llvm-svn: 49096
2008-04-02 17:04:45 +00:00
Anton Korobeynikov 20c9e4cbee Add new CC lowering rule: provide a list of registers, which can be 'shadowed',
when some another register is used for argument passing.
Currently is used on Win64.

llvm-svn: 49079
2008-04-02 05:23:57 +00:00
Owen Anderson 2412158111 In some situations, we need to check for local interferences between the PHI
node and its inputs.

llvm-svn: 49070
2008-04-02 03:00:13 +00:00
Owen Anderson edfc2eb558 Correctly mark a valno that was previous defined by a PHI node as having an
unknown defining inst after PHI elimination.

llvm-svn: 49069
2008-04-02 02:12:45 +00:00
Dale Johannesen fd967cf3fa Recommitting EH patch; this should answer most of the
review feedback.
-enable-eh is still accepted but doesn't do anything.
EH intrinsics use Dwarf EH if the target supports that,
and are handled by LowerInvoke otherwise.
The separation of the EH table and frame move data is,
I think, logically figured out, but either one still
causes full EH info to be generated (not sure how to
split the metadata correctly).
MachineModuleInfo::needsFrameInfo is no longer used and
is removed.

llvm-svn: 49064
2008-04-02 00:25:04 +00:00
Evan Cheng ac38d444e2 1. Drop default inline threshold back down to 200.
2. Do not use # of basic blocks as part of the cost computation since it doesn't really figure into function size.
3. More aggressively inline function with vector code.

llvm-svn: 49061
2008-04-01 23:59:29 +00:00
Tanya Lattner 052838c55d Reverting 49056 due to the build being broken.
llvm-svn: 49060
2008-04-01 23:41:44 +00:00
Evan Cheng b86595fb0a ReMat of load from stub in pic mode extends the life of pic base. Currently spiller doesn't do a good job of estimating the impact. Disable for now.
llvm-svn: 49059
2008-04-01 23:26:12 +00:00
David Greene 7f7edc3824 Iterators folloring a SmallVector erased element are invalidated so
don't access cached iterators from after the erased element.

llvm-svn: 49056
2008-04-01 22:14:23 +00:00
Bill Wendling fc9f25dab0 Fix compilation errors on MSVC. Patch by Argiris Kirtzidis!
llvm-svn: 49055
2008-04-01 22:09:20 +00:00
Evan Cheng 19a6dd9f2a Remove unnecessary and non-deterministic checking code. Re-enable remat of load from gv stub.
llvm-svn: 49054
2008-04-01 21:38:20 +00:00
Evan Cheng 985a0b51d7 Re-materialization is for uses only.
llvm-svn: 49053
2008-04-01 21:37:32 +00:00
Dan Gohman cb9f8f6e4e Don't use __bzero for memset if the second argument isn't zero.
llvm-svn: 49050
2008-04-01 20:56:18 +00:00
Dan Gohman 980d7200c1 Speculatively micro-optimize memory-zeroing calls on Darwin 10.
llvm-svn: 49048
2008-04-01 20:38:36 +00:00
Dale Johannesen 5e4e051c2a Revert 49006 for the moment.
llvm-svn: 49046
2008-04-01 20:00:57 +00:00
Owen Anderson 49dd9f16a9 Don't dereference MBB->end().
llvm-svn: 49043
2008-04-01 18:05:08 +00:00
Chris Lattner 6f2ffdb73f Change the MemoryBuffer::getFile* methods to take just a pointer to the
start of a filename, not a filename+length.  All clients can produce a
null terminated name, and the system api's require null terminated 
strings anyway.

llvm-svn: 49041
2008-04-01 18:04:03 +00:00
Evan Cheng 306e3dcff4 Disabling remat of load from gv stub (temporarily) again to fix llvmgcc bootstrap miscompare.
llvm-svn: 49037
2008-04-01 07:33:13 +00:00
Chris Lattner ba98fca5e5 add some #includes.
llvm-svn: 49036
2008-04-01 06:25:23 +00:00
Chris Lattner 18356d8857 MappedFile is dead, remove it.
llvm-svn: 49035
2008-04-01 06:20:44 +00:00
Chris Lattner 4c5e15f7da Implement Path::MapInFilePages/UnMapFilePages on unix, which
provides fast MappedFile::getFile for large files.

llvm-svn: 49034
2008-04-01 06:16:24 +00:00
Chris Lattner a542518315 Reimplement MemoryBuffer::getFile with three enhancements:
1) stop using MappedFile.
2) if profitable use the sys::path::MapInFilePages api to
   read the file.
3) otherwise fallback to read.

When sys::path::MapInFilePages is implemented, this provides
several benefits:

#1: this avoids fragmenting memory for small files.
#2: this avoids extraneous stat calls when the file size is known.
#3: this only keeps the file descriptor open while reading the 
    file, not for the duration of the lifetime of the memory 
    buffer.  This fixes a serious clang FD 'leak' problem.

I believe that this will work on a win32 machine, but I don't have
one to test on.  I'd appreciate it if someone could check.

llvm-svn: 49031
2008-04-01 06:05:21 +00:00
Chris Lattner 3089e1d82e Stub out some sys::Path::MapInFilePages/UnMapFilePages methods.
llvm-svn: 49030
2008-04-01 06:00:12 +00:00
Chris Lattner d4310a27aa change the archive stuff to use MemoryBuffer instead of mappedfile.
MemoryBuffer is higher level and more closely matches the model
needed.

llvm-svn: 49029
2008-04-01 04:26:46 +00:00
Chris Lattner 4ac7bb0294 rewrite SourceFile to be in terms of MemoryBuffer, not MappedFile.
llvm-svn: 49027
2008-04-01 03:59:34 +00:00
Chris Lattner 64959dcf03 Make MappedFile::map return a const correct pointer, don't leak address space on Unix platforms.
llvm-svn: 49026
2008-04-01 03:49:38 +00:00
Chris Lattner bcfa564759 Remove the MappedFile::charBase member, rename base -> getBase() and
make getBase() return a const-correct pointer.

llvm-svn: 49025
2008-04-01 03:40:53 +00:00
Chris Lattner 314a1414d0 Change DiffFilesWithTolerance to be written in terms of MemoryBuffer,
not an mmapped file.  This more closely matches its requirements and
provides an implicitly null terminated buffer, something this
routine had to emulate itself before.

llvm-svn: 49024
2008-04-01 03:39:49 +00:00
Chris Lattner 62385ba3a0 Remove MappedFile support for mapping files for write and exec
and shared.  This complicates the design, is not used, and probably
doesn't even work.

llvm-svn: 49022
2008-04-01 03:10:22 +00:00
Chris Lattner 3d7127b3e3 add missing #includes
llvm-svn: 49020
2008-04-01 02:58:05 +00:00
Evan Cheng 0bd72c5ccd More soft fp fixes.
llvm-svn: 49016
2008-04-01 02:18:22 +00:00
Evan Cheng 4cabe4b452 Pasto.
llvm-svn: 49014
2008-04-01 02:00:09 +00:00
Evan Cheng 611abc03ed Add comment.
llvm-svn: 49013
2008-04-01 01:51:26 +00:00
Evan Cheng 86e476b7cb Unbreak ARM / Thumb soft FP support.
llvm-svn: 49012
2008-04-01 01:50:16 +00:00
Dale Johannesen efa81a6979 Accept 'y' constraint (MMX) in inline asm.
llvm-svn: 49011
2008-04-01 00:57:48 +00:00
Chris Lattner efecfbc113 cleanup the MappedFile API and comments. This removes and updates
tons of out of date comments (really nothing throws here!) and fixes
some other fairly glaring issues: "size" used to return the size of 
the file *and* change it, depending on how you called it.

llvm-svn: 49009
2008-04-01 00:53:25 +00:00
Chris Lattner 1fa4dca692 remove DEFINING_FILE_FOR for MappedFile.h
llvm-svn: 49008
2008-04-01 00:35:55 +00:00
Dale Johannesen 7d02cf3c9c Emit exception handling info for functions which are
not marked nounwind, or for all functions when -enable-eh
is set, provided the target supports Dwarf EH.

llvm-gcc generates nounwind in the right places; other FEs
will need to do so also.  Given such a FE, -enable-eh should
no longer be needed.

llvm-svn: 49006
2008-03-31 23:40:23 +00:00
Evan Cheng e4f77c69ac It's not safe to fold a load from GV stub or constantpool into a two-address use.
llvm-svn: 49002
2008-03-31 23:19:51 +00:00
Nate Begeman f8be3836e3 Actually disable crash reporting on Mac OS X, returning bugpoint to speedy
crash miscompilations.

llvm-svn: 49000
2008-03-31 22:19:25 +00:00
Dan Gohman 3717cdaf22 Set blockBegin to point to the beginning of the block,
not the end.

llvm-svn: 48999
2008-03-31 22:08:00 +00:00
Evan Cheng ed6e34fe41 Move reMaterialize() from TargetRegisterInfo to TargetInstrInfo.
llvm-svn: 48995
2008-03-31 20:40:39 +00:00
Dan Gohman f549b26254 Fix a DAGCombiner optimization to respect volatile qualification.
llvm-svn: 48994
2008-03-31 20:32:52 +00:00
Erick Tryzelaar 4a0da98825 Expose Function::viewCFG and Function::viewCFGOnly to bindings.
llvm-svn: 48982
2008-03-31 16:22:09 +00:00
Evan Cheng 1973a46cd3 Re-apply 48911.
llvm-svn: 48977
2008-03-31 07:54:19 +00:00
Evan Cheng 73d7c3bfba The support for remat of instructions with a register operand is hackish, to say the least. Since the register operand guaranteed to be PIC base and that it is already live at all uses, we are making sure it will not be spilled after its uses are rematerialized for both performance and correctness reasons.
llvm-svn: 48976
2008-03-31 07:53:30 +00:00
Owen Anderson f28fc71c93 Fix a major bug in the DFS calculation. Thanks for Christopher Lamb for pointing this out.
llvm-svn: 48973
2008-03-31 01:39:20 +00:00
Nate Begeman f2b0b0eb17 Don't eliminate bitcast instructions that change the type of a pointer
llvm-svn: 48971
2008-03-31 00:22:16 +00:00
Duncan Sands 7d6c8ae488 Fix comment typo.
llvm-svn: 48967
2008-03-30 19:38:55 +00:00
Nick Lewycky 9fb8908457 Moved from PR1570.
llvm-svn: 48965
2008-03-30 19:07:11 +00:00
Chris Lattner 0f760dfe09 Fix "Control reaches the end of non-void function" warnings,
patch by David Chisnall.

llvm-svn: 48963
2008-03-30 18:22:13 +00:00
Chris Lattner 519a51a76f minor code cleanups, allow constant folding sinf/cosf.
llvm-svn: 48961
2008-03-30 18:02:00 +00:00
Evan Cheng 16d72072df Cosmetic changes.
llvm-svn: 48947
2008-03-29 18:34:22 +00:00
Chris Lattner 4311ad2dae change iterator invalidation avoidance to just move the iterator backward
when something changes, instead of moving forward.  This allows us to 
simplify memset lowering, inserting the memset at the end of the range of 
stuff we're touching instead of at the start.

This, in turn, allows us to make use of the addressing instructions already
used in the function instead of inserting our own.  For example, we now
codegen:

	%tmp41 = getelementptr [8 x i8]* %ref_idx, i32 0, i32 0		; <i8*> [#uses=2]
	call void @llvm.memset.i64( i8* %tmp41, i8 -1, i64 8, i32 1 )

instead of:

	%tmp20 = getelementptr [8 x i8]* %ref_idx, i32 0, i32 7		; <i8*> [#uses=1]
	%ptroffset = getelementptr i8* %tmp20, i64 -7		; <i8*> [#uses=1]
	call void @llvm.memset.i64( i8* %ptroffset, i8 -1, i64 8, i32 1 )

llvm-svn: 48940
2008-03-29 05:15:47 +00:00
Chris Lattner ac95515741 make the common case of a single store (which clearly shouldn't be turned
into a memset!) faster by avoiding an allocation of an std::list node.

llvm-svn: 48939
2008-03-29 04:52:12 +00:00
Chris Lattner d528b21a65 give form-memset a significantly more sane heuristic, enable it by default.
llvm-svn: 48937
2008-03-29 04:36:18 +00:00
Owen Anderson 8b22873bdd Remove some unneeded code for LiveInterval joining, and fix a bug in the Phi elimination algorithm where we were accidentally reasoning about
the source rather than the destination.

llvm-svn: 48936
2008-03-29 01:58:47 +00:00
Dan Gohman fd2eb00cc2 Fix a tokenfactor node to use the load chain rather than the
load value. This fixes PR2177.

llvm-svn: 48932
2008-03-28 23:45:16 +00:00
Evan Cheng b8654202dd Backing out 48911 for now. It's breaking stuff.
llvm-svn: 48922
2008-03-28 17:49:06 +00:00
Chris Lattner a148acdc82 ifdef out a dead function. Should this be removed?
llvm-svn: 48916
2008-03-28 15:36:27 +00:00
Duncan Sands 35c7cdac07 Rename getAnyLoad to getLoad is suggested by Evan.
llvm-svn: 48914
2008-03-28 09:45:24 +00:00
Evan Cheng 81e0c9a32c New entry.
llvm-svn: 48912
2008-03-28 07:07:06 +00:00
Evan Cheng 9ae4d7b719 Load from stub is already re-materializable.
llvm-svn: 48911
2008-03-28 06:49:25 +00:00
Nick Lewycky f88c84f690 Update example to new syntax.
llvm-svn: 48910
2008-03-28 06:46:51 +00:00
Chris Lattner d62964a7d8 make memset inference significantly more powerful: it can now handle
memsets that initialize "structs of arrays" and other store sequences
that are not sequential.  This is still only enabled if you pass 
-form-memset-from-stores.  The flag is not heavily tested and I haven't
analyzed the perf regressions when -form-memset-from-stores is passed
either, but this causes no make check regressions.

llvm-svn: 48909
2008-03-28 06:45:13 +00:00
Evan Cheng 87bac50d7b New entry.
llvm-svn: 48908
2008-03-28 06:34:23 +00:00
Duncan Sands f740509e58 Implement LegalizeTypes support for softfloat LOAD.
In order to handle indexed nodes I had to introduce
a new constructor, and since I was there I factorized
the code in the various load constructors.

llvm-svn: 48894
2008-03-27 20:23:40 +00:00
Dan Gohman cad51cb671 Avoid creating chain dependencies from CopyToReg nodes to load and store
nodes. This doesn't currently have much impact the generated code, but it
does produce simpler-looking SelectionDAGs, and consequently
simpler-looking ScheduleDAGs, because there are fewer spurious
dependencies.

In particular, CopyValueToVirtualRegister now uses the entry node as the
input chain dependency for new CopyToReg nodes instead of calling getRoot
and depending on the most recent memory reference.

Also, rename UnorderedChains to PendingExports and pull it up from being
a local variable in SelectionDAGISel::BuildSelectionDAG to being a
member variable of SelectionDAGISel, so that it doesn't have to be
passed around to all the places that need it.

llvm-svn: 48893
2008-03-27 19:56:19 +00:00
Devang Patel eb1e3fcbe0 PHI->removeIncomingValue may remove PHInode.
Increment iterator in advance.

llvm-svn: 48890
2008-03-27 17:32:46 +00:00
Roman Levenstein 30d09518b5 Fix spelling. Thanks, Duncan! :-)
llvm-svn: 48873
2008-03-27 09:44:37 +00:00
Roman Levenstein bc674501ba Speed-up the SumOfUnscheduledPredsOfSuccs by introducing a new function
called LimitedSumOfUnscheduledPredsOfSuccs. It terminates the computation
after a given treshold is reached. This new function is always faster, but
brings real wins only on bigger test-cases.

The old function SumOfUnscheduledPredsOfSuccs is left in-place for now and therefore a warning about an unused static function is produced.

llvm-svn: 48872
2008-03-27 09:14:57 +00:00
Evan Cheng 308e564693 Code clean up.
llvm-svn: 48856
2008-03-27 01:45:11 +00:00
Evan Cheng 29e62a59f3 Allow certain lea instructions to be rematerialized.
llvm-svn: 48855
2008-03-27 01:41:09 +00:00
Evan Cheng 4fb07c6500 Remove an unused command line option.
llvm-svn: 48854
2008-03-27 01:30:24 +00:00
Evan Cheng 5832410d77 Fix a memory bug: increment an iterator of a deleted machine instr.
llvm-svn: 48853
2008-03-27 01:27:25 +00:00
Erick Tryzelaar 8ac07c2834 Expose ExecutionEngine::getTargetData() to c and ocaml bindings.
llvm-svn: 48851
2008-03-27 00:27:14 +00:00
Dale Johannesen 87c6ada5de Fix a bug in Darwin EH: FDE->CIE pointer must
be relocatable.  Describe why .set is needed better.

llvm-svn: 48848
2008-03-26 23:31:39 +00:00
Evan Cheng db390694ff One more coalescer fix wrt deadness propagation.
llvm-svn: 48837
2008-03-26 20:15:49 +00:00
Evan Cheng 289ba4f335 Avoid commuting a def MI in order to coalesce a copy instruction away if any use of the same val# is a copy instruction that has already been coalesced.
llvm-svn: 48833
2008-03-26 19:03:01 +00:00
Roman Levenstein 358e04a185 Use a linked data structure for the uses lists of an SDNode, just like
LLVM Value/Use does and MachineRegisterInfo/MachineOperand does.
This allows constant time for all uses list maintenance operations.

The idea was suggested by Chris. Reviewed by Evan and Dan.
Patch is tested and approved by Dan.

On normal use-cases compilation speed is not affected. On very big basic
blocks there are compilation speedups in the range of 15-20% or even better. 

llvm-svn: 48822
2008-03-26 12:39:26 +00:00
Roman Levenstein 733a4d6e85 Fixed some spelling errors. Thanks, Duncan!
llvm-svn: 48819
2008-03-26 11:23:38 +00:00
Roman Levenstein 7e71b4baaf Some improvements related to the computation of isReachable.
This fixes Bugzilla #1835 (http://llvm.org/bugs/show_bug.cgi?id=1835).
This patched is reviewed by Tanya and Dan. Dan tested and approved it.

The reason for the bad performance of the old algorithm is that it is very naive and scans every
time all nodes of the DAG in the worst case.

This patch introduces  a new algorithm based on the paper "Online algorithms
for maintaining the topological order of a directed acyclic graph" by
David J.Pearce and Paul H.J.Kelly. This is the MNR algorithm. It has a
linear time worst-case and performs much better in most situations.

The paper can be found here:
http://fano.ics.uci.edu/cites/Document/Online-algorithms-for-maintaining-the-topological-order-of-a-directed-acyclic-graph.html

The main idea of the new algorithm is to compute the topological ordering of the SNodes in the
DAG and to maintain it even after DAG modifications. The topological ordering allows for very fast 
node reachability checks. 

Tests on very big  input files with tens of thousands of instructions in a BB indicate huge 
speed-ups (up to 10x compilation time improvement) compared to the old version.

llvm-svn: 48817
2008-03-26 09:18:09 +00:00
Evan Cheng 292063603e Fix some SSE4.1 instruction encoding bugs.
llvm-svn: 48815
2008-03-26 08:11:49 +00:00
Owen Anderson 5d2d1776e0 Dead PHI instructions need to be handled specially.
llvm-svn: 48811
2008-03-26 03:03:23 +00:00
Dale Johannesen ad6c23d5e9 Use ## for comment delimiter on darwin x86-32, so
llvm's output .s files will go through gcc -std=c99
without triggering preprocesser errors.  Approach
suggested by Daveed Vandevoorde.

llvm-svn: 48808
2008-03-25 23:29:30 +00:00
Evan Cheng ddc58ff92a Smaller function alignment when optimizing for size.
llvm-svn: 48805
2008-03-25 22:29:46 +00:00
Evan Cheng 88c44ef91f Rename option -optimizefor-size to -optimize-size.
llvm-svn: 48804
2008-03-25 22:28:39 +00:00
Owen Anderson 9f129318dc Remove some debugging code.
llvm-svn: 48803
2008-03-25 22:26:43 +00:00
Owen Anderson 1d46d45e35 StrongPHIElimination doesn't support swapping live intervals like the coalescer does.
llvm-svn: 48802
2008-03-25 22:25:27 +00:00
Dan Gohman c60c67fc37 Add explicit keywords.
llvm-svn: 48801
2008-03-25 22:06:05 +00:00
Dan Gohman bdc24adaaf A quick nm audit turned up several fixed tables and objects that were
marked read-write. Use const so that they can be allocated in a
read-only segment.

llvm-svn: 48800
2008-03-25 21:45:14 +00:00
Dan Gohman a7ba51f6ec Avoid outputing spaces at the ends of lines.
llvm-svn: 48797
2008-03-25 21:38:12 +00:00
Devang Patel 72cfe84f05 Do not align loops if optimizing for size.
llvm-svn: 48794
2008-03-25 21:03:02 +00:00
Devang Patel 246a52740b Add optimize-for-size knob.
llvm-svn: 48793
2008-03-25 21:02:35 +00:00
Evan Cheng df1690dc7c Handle a special case xor undef, undef -> 0. Technically this should be transformed to undef. But this is such a common idiom (misuse) we are going to handle it.
llvm-svn: 48792
2008-03-25 20:08:07 +00:00
Evan Cheng 2b72c05992 Handle a special case xor undef, undef -> 0. Technically this should be transformed to undef. But this is such a common idiom (misuse) we are going to handle it.
llvm-svn: 48791
2008-03-25 20:07:13 +00:00
Dan Gohman fd227e9c3a Fix typos.
llvm-svn: 48779
2008-03-25 17:10:29 +00:00
Dan Gohman 883cbfd0ba Add CMP32mr and friends to the load-unfolding table. Among
other things, this allows the scheduler to unfold a load operand
in the 2008-01-08-SchedulerCrash.ll testcase, so it now successfully
clones the comparison to avoid a pushf+popf.

llvm-svn: 48777
2008-03-25 16:53:19 +00:00
Bill Wendling 0ee1bd9588 Fix PR2062: Don't build Intrinsics.gen in the source directory. Do it in the
object directory.

llvm-svn: 48766
2008-03-25 09:12:48 +00:00
Evan Cheng 7d564c3b4a lastRegisterUse() should ignore identity copies. Those will be erased.
llvm-svn: 48759
2008-03-25 02:02:19 +00:00
Evan Cheng fe7610f37f Remove an unneeded test.
llvm-svn: 48755
2008-03-24 23:55:16 +00:00
Evan Cheng 50b536eef9 Add \t after .set. Fix by Jay Freeman.
llvm-svn: 48753
2008-03-24 23:36:49 +00:00
Evan Cheng 69a3f9c417 If the coalescer commuted a def MI to allow coalescing, it can changed a previously coalesced copy into an non-identity copy.
llvm-svn: 48752
2008-03-24 23:31:21 +00:00
Evan Cheng 6e225173c5 Add an assertion to catch register of illegal class.
llvm-svn: 48751
2008-03-24 23:28:21 +00:00
Bill Wendling 6306183df3 Use the bit size of the operand instead of the hard-coded 32 to generate the
mask.

llvm-svn: 48750
2008-03-24 23:16:37 +00:00
Evan Cheng 615488ab45 - SSE4.1 extractfps extracts a f32 into a gr32 register. Very useful! Not. Fix the instruction specification and teaches lowering code to use it only when the only use is a store instruction.
llvm-svn: 48746
2008-03-24 21:52:23 +00:00
Owen Anderson c905fe9407 Revert r48676. I had plans for using it, but now it's just dead code.
llvm-svn: 48743
2008-03-24 21:29:58 +00:00
Owen Anderson e2707768a4 Remove #include<iostream>, which I was using for debugging.
llvm-svn: 48739
2008-03-24 20:36:47 +00:00
Devang Patel a38f58aa5c Add incoming value from header only if phi node has any use inside the loop.
llvm-svn: 48738
2008-03-24 20:16:14 +00:00
Dan Gohman aa583d75b1 Shrink the size of AllocationInst by using its SubclassData
field to store the alignment value instead of haing a
separate field.

llvm-svn: 48727
2008-03-24 16:55:58 +00:00
Dan Gohman d8ea040c31 APIntify SelectionDAG's EXTRACT_ELEMENT code.
llvm-svn: 48726
2008-03-24 16:38:05 +00:00
Evan Cheng 3471ae8c5d Increasing the inline limit from (overly conservative) 200 to 300. Given each BB costs 20 and each instruction costs 5, 200 means a 4 BB function + 24 instructions (actually less because caller's size also contributes to it).
Furthermore, double the limit when more than 10% of the callee instructions are vector instructions. Multimedia kernels tend to love inlining.

llvm-svn: 48725
2008-03-24 06:37:48 +00:00
Evan Cheng 21a8e3d260 Temporarily disabling memset forming optimization. Add an option.
llvm-svn: 48720
2008-03-24 05:28:38 +00:00
Owen Anderson 200e57840e Be sure to remove intervals after we've joined them. Also, remove some duplicated code.
With this pass, StrongPHIElim can compile very simple testcases correctly.  There's still a ways
to go before it's ready for prime time, though.

llvm-svn: 48719
2008-03-24 04:11:27 +00:00
Evan Cheng c3cf9f872a Transform (zext (or (icmp), (icmp))) to (or (zext (cimp), (zext icmp))) if at least one of the (zext icmp) can be transformed to eliminate an icmp.
llvm-svn: 48715
2008-03-24 00:21:34 +00:00
Evan Cheng 58db865d6e Remove duplicated entries.
llvm-svn: 48714
2008-03-23 22:56:07 +00:00
Gordon Henriksen 07a45f4edb Objective Caml bindings for basic block, function, global, and arg iterators.
llvm-svn: 48711
2008-03-23 22:21:29 +00:00
Anton Korobeynikov 1fdd5e9133 Minor typo fixes. Also add another FIXME.
llvm-svn: 48710
2008-03-23 20:32:06 +00:00
Anton Korobeynikov d38b3fb127 Preserve calling convention during function cloning
llvm-svn: 48708
2008-03-23 16:03:00 +00:00
Anton Korobeynikov 17fb491469 Add license header
llvm-svn: 48707
2008-03-23 14:53:18 +00:00
Anton Korobeynikov 9f0e820fa3 Add Win64 compilation callback. This allows easy examples to be JITed on Win64!
llvm-svn: 48706
2008-03-23 14:44:32 +00:00
Anton Korobeynikov a347663762 Provide a JIT selector on win64
llvm-svn: 48704
2008-03-23 13:43:47 +00:00
Anton Korobeynikov 7574ead985 Hack out the PIC mode on Win64 targets. This needs to be investigated later.
llvm-svn: 48703
2008-03-23 13:41:18 +00:00
Anton Korobeynikov 4733e72a25 Code cleanup. Provide generic way of selecting JIT pointer bitwidth regardless
of compiler used.

llvm-svn: 48702
2008-03-23 13:40:45 +00:00
Anton Korobeynikov bd47269f13 Remove old-standing obsolete code.
llvm-svn: 48701
2008-03-23 12:32:54 +00:00
Anton Korobeynikov cec773d8e7 Honour built-in defines on win64 targets for automatically subtarget recognize.
Force stack alignment to 16 bytes on win targets.

llvm-svn: 48695
2008-03-22 21:18:22 +00:00
Anton Korobeynikov 07a789d2b5 Recognize "windows" in target triple, not only "win32"
llvm-svn: 48694
2008-03-22 21:12:53 +00:00
Anton Korobeynikov b86e0936f1 Add information about callee-saved registers on Win64
llvm-svn: 48692
2008-03-22 21:04:01 +00:00
Anton Korobeynikov 7f125b2ba5 Add convenient helper for win64 check. Simplify things slightly.
llvm-svn: 48691
2008-03-22 20:57:27 +00:00
Anton Korobeynikov 7b4f4e1a86 Initial support for Win64 calling conventions. Still in early state.
llvm-svn: 48690
2008-03-22 20:37:30 +00:00
Anton Korobeynikov 7ebdd255b5 Register EH frames emitted in JIT when using gcc unwinding runtime
llvm-svn: 48688
2008-03-22 08:53:09 +00:00
Anton Korobeynikov dd8c695746 Fix merge error
llvm-svn: 48687
2008-03-22 08:50:08 +00:00
Anton Korobeynikov 3f7fab913d Add testcase for prev. commit. Minor fixes
llvm-svn: 48686
2008-03-22 08:37:05 +00:00
Anton Korobeynikov 25b2e8203a Aliasing chains cleanups: update langref, add check into verifier
llvm-svn: 48685
2008-03-22 08:36:14 +00:00
Anton Korobeynikov 72d5d42dbc Support chained aliases for LLVM IR printing. This fixes PR2145
llvm-svn: 48684
2008-03-22 08:17:17 +00:00
Anton Korobeynikov 2fa75184f3 Another comments fixing
llvm-svn: 48683
2008-03-22 07:53:40 +00:00
Anton Korobeynikov 2fb3897f1b Slightly increase default set size. It's cheap and won't hurt.
llvm-svn: 48682
2008-03-22 07:48:40 +00:00
Chris Lattner 53ccb62712 implement an initial hack at a straight-line store -> memset optimization.
This fires dozens of times across spec and multisource, but I don't know
if it actually speeds stuff up.  Hopefully the testers will show something
nice :)

llvm-svn: 48680
2008-03-22 05:37:16 +00:00
Chris Lattner 168be766a8 implement the logic for memset insertion and store deletion.
llvm-svn: 48679
2008-03-22 04:13:49 +00:00
Owen Anderson 5b993fd70d Add a comment, and fix a bug where AllocateRW recurred to AllocateRWX instead of itself.
llvm-svn: 48677
2008-03-22 02:59:54 +00:00
Owen Anderson c1e4e3e9a1 Add an AllocateRW to match AllocateRWX.
llvm-svn: 48676
2008-03-22 02:33:53 +00:00
Evan Cheng 31604a62f6 Teach DAG combiner to commute commutable binary nodes in order to achieve sdisel CSE.
llvm-svn: 48673
2008-03-22 01:55:50 +00:00
Chris Lattner f5d41c67af This is a partially implemented and currently disabled start of a store
merging optimization.  Nothing to see here, hopefully more later :)

llvm-svn: 48670
2008-03-22 00:31:52 +00:00
Dan Gohman 9988569af8 Don't include <map> in Pass.h, which doesn't need it. This requires
adding <map> to many files that actually do need it.

llvm-svn: 48667
2008-03-21 23:51:57 +00:00
Dan Gohman 026eed69e7 Avoid calling array_endof in a static initializer, as it incurs
dynamic initialization.

llvm-svn: 48666
2008-03-21 23:44:21 +00:00
Dan Gohman 5a6ac79738 Specialize FORCE_DEFINING_FILE_TO_BE_LINKED using a GCC trick
to avoid using constructor calls for static objects. This reduces
the number of objects requiring static constructors in a typical
LLVM build by around 20%.

llvm-svn: 48665
2008-03-21 23:38:23 +00:00
Dan Gohman 30e44a4b40 Fix -view-sunit-dags to support cross-rc-copy nodes.
llvm-svn: 48664
2008-03-21 22:51:06 +00:00
Chris Lattner 804209d17c the size of a smallvector shouldn't be part of the interface to these methods.
llvm-svn: 48662
2008-03-21 22:01:16 +00:00
Chris Lattner beb216da0a make gvn marginally faster by reallocating the lastSeenLoad map for
each basic block.

llvm-svn: 48660
2008-03-21 21:33:23 +00:00
Chris Lattner 2876a645c3 Minor cleanups and shrinkification.
llvm-svn: 48658
2008-03-21 21:14:38 +00:00
Dan Gohman a25dde6fee Handle getresult instructions in different basic blocks
from their aggregate operands by moving the getresult
instructions.

llvm-svn: 48657
2008-03-21 21:01:32 +00:00
Chris Lattner c55b444a8f Restore this assert now that the livevar bug is fixed.
This verifies kill info for "ret" fp operands is right.

llvm-svn: 48656
2008-03-21 20:41:27 +00:00
Evan Cheng 8c19af1b7e A couple of kill marker maintainence bug.
llvm-svn: 48653
2008-03-21 19:09:30 +00:00
Andrew Lenharth 74d154ce57 FunctionExtractorPass has been superceded by GVExtractorPass
llvm-svn: 48648
2008-03-21 16:46:53 +00:00
Duncan Sands dec270a6db Make it possible to get an empty struct using
the new StructType::get method.  The second NULL
is to pacify the gcc warning mechanism.  This
patch compiles but is otherwise untested.

llvm-svn: 48645
2008-03-21 15:53:17 +00:00
Duncan Sands d97eea372a Introduce a new node for holding call argument
flags.  This is needed by the new legalize types
infrastructure which wants to expand the 64 bit
constants previously used to hold the flags on
32 bit machines.  There are two functional changes:
(1) in LowerArguments, if a parameter has the zext
attribute set then that is marked in the flags;
before it was being ignored; (2) PPC had some bogus
code for handling two word arguments when using the
ELF 32 ABI, which was hard to convert because of
the bogusness.  As suggested by the original author
(Nicolas Geoffray), I've disabled it for the moment.
Tested with "make check" and the Ada ACATS testsuite.

llvm-svn: 48640
2008-03-21 09:14:45 +00:00
Duncan Sands c9e09a0588 Fix the build for gcc-4.2.
llvm-svn: 48639
2008-03-21 08:32:17 +00:00
Chris Lattner 68b11e14bc remove Evan's "ugly hack" that sorta attempted to get
x86-64 return conventions correct, but was never enabled.
We can now do the "right thing" with multiple return values.

llvm-svn: 48635
2008-03-21 06:50:21 +00:00
Chris Lattner 5abbe6cef5 Add support for calls that return two FP values in
ST(0)/ST(1).

llvm-svn: 48634
2008-03-21 06:38:26 +00:00