Commit Graph

9027 Commits

Author SHA1 Message Date
Dan Gohman
667d787c0a Incorporate the insertion point into the key of SCEVExpander's CSE map.
This helps it avoid reusing an instruction that doesn't dominate all
of the users, in cases where the original instruction was inserted
before all of the users were known.  This may result in redundant
expansions of sub-expressions that depend on loop-unpredictable values
in some cases, however this isn't very common, and it primarily impacts
IndVarSimplify, so GVN can be expected to clean these up.

This eliminates the need for IndVarSimplify's FixUsesBeforeDefs,
which fixes several bugs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74352 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 22:53:46 +00:00
Devang Patel
acec7b35aa Remove unused routines.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74351 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 22:53:22 +00:00
Bob Wilson
ff0d3392e0 Add missing argument for vtbx intrinsic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74340 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 22:27:22 +00:00
Bob Wilson
fd6d87d68a Add intrinsics for ARM NEON vtbl and vtbx operations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74333 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 21:45:05 +00:00
Chris Lattner
505e982040 fix a really subtle bug in the cross section of aliases and TLS:
the SelectionDAG::getGlobalAddress function properly looks through
aliases to determine thread-localness, but then passes the GV* down
to GlobalAddressSDNode::GlobalAddressSDNode which does not.  Instead
of passing down isTarget, just pass down the predetermined node
opcode.  This fixes some assertions with out of tree changes I'm 
working on.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74325 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 21:14:05 +00:00
Jeffrey Yasskin
d8ac1be686 Delete LoopPass::runOnFunctionBody. It was never used or implemented.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74320 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 20:42:50 +00:00
Owen Anderson
b41b5e0b2d Get rid of these cache variables, which are a holdover from the days when
we had multiple type planes and these lookups were expensive.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74319 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 20:33:47 +00:00
Bob Wilson
4dbbfe3571 Swap order of arguments to vst[34]* intrinsics. This matches the order
used by both the user-visible intrinsics defined by ARM and the
corresponding GCC builtins.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74300 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 18:23:29 +00:00
Douglas Gregor
c7077c7015 CMake: add configure checks for pthread_rwlock_init and pthread_getspecific
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74284 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 14:35:43 +00:00
Devang Patel
e2f9382c72 Remove unnecessary includes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74254 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 02:25:46 +00:00
Devang Patel
13e16b65dd Remove debug info anchors - llvm.dbg.compile_units, llvm.dbg.subprograms
and llvm.dbg.global_variables.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74251 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-26 01:49:18 +00:00
Owen Anderson
438d3946af Add support for const thread locals.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74226 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-25 23:31:18 +00:00
Owen Anderson
27fcfe1364 Add a configure test for pthread_getspecific, and use it when building ThreadLocal.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74222 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-25 23:10:26 +00:00
Owen Anderson
4a28522c1a Add a class for supporting platform independent thread-local storage.
Windows people, please double-check/patch this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74209 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-25 21:58:01 +00:00
Chris Lattner
f5a5546f43 add targetflags to jump tables and constant pool entries.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74204 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-25 21:35:31 +00:00
Chris Lattner
2a4ed82ce2 allow setting target operand flags on TargetGlobalAddress nodes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74203 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-25 21:21:14 +00:00
Chris Lattner
1af2231da6 start bringing targetoperand flags into isel, first up, ExternalSymbol.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74199 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-25 18:45:50 +00:00
Mikhail Glushenkov
7defa2d3d5 Make -save-temps behave like in GCC 4.5.
The -save-temps option now behaves like described in GCC 4.5 release notes
(you can specify output directory for temporary files with -save-temps=obj
-o $DIRNAME). I do not have GCC 4.5 installed, so if there are any
inconsistencies between llvmc and GCC in the implementation of this
feature, please let me know.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74190 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-25 18:20:10 +00:00
Chris Lattner
b1fb84dee9 just eliminate the code entirely!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74183 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-25 17:28:07 +00:00
Chris Lattner
d5899793a6 Clone target flags when copying mbb operands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74181 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-25 17:21:32 +00:00
Owen Anderson
a8dbf36f3f Privatize some more debug-related static data.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74179 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-25 16:55:32 +00:00
Sanjiv Gupta
8ebd4b6422 Identify unconditional gotos and generate a page sel instructions before them.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74172 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-25 11:03:14 +00:00
Jeffrey Yasskin
df5a7daff9 Add a JITEventListener interface that gets called back when a new function is
emitted or the machine code for a function is freed.  Chris mentioned that we
may also want a notification when a stub is emitted, but that'll be a future
change.  I intend to use this to tell oprofile where functions are emitted and
what lines correspond to what addresses.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74157 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-25 02:04:04 +00:00
Chris Lattner
9a96c425db ad MachineInstrBuilder support for target flags on operands.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74155 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-25 01:16:22 +00:00
Dan Gohman
a278f3f552 Add a getUniqueExitBlock utility function, similar to getExitBlock,
but for getUniqueExitBlocks.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74145 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-25 00:09:57 +00:00
Owen Anderson
6279cd85e9 Now with EVEN FEWER statics!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74143 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-25 00:04:15 +00:00
Owen Anderson
2b2000174b Didn't mean to commit this part.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74135 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-24 22:58:48 +00:00
Owen Anderson
04c05f7630 Down with statics!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74134 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-24 22:53:20 +00:00
Devang Patel
70535451e0 Add constructor to create MDString using std::string
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74133 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-24 22:42:39 +00:00
Owen Anderson
bd58edf591 Move local statics to per-instance variables.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74132 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-24 22:28:12 +00:00
David Greene
02a6218774 Increase limit for OpActions array
The OpActions array had a limit of 32 value types, so change it to use
MVT::MAX_ALLOWED_VALUETYPE in its declaration and change the accesses to
this array to work with a VT.getSimpleVT() that is larger than 32.

Also, add a comment to the place where MVT::MAX_ALLOWED_VALUETYPE is
defined indicating that it must be a multiple of 32.

This is part of the work allow MVT::LAST_VALUETYPE be greater than 32.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74130 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-24 22:22:02 +00:00
Owen Anderson
09fc0fa0b1 Get rid of a static boolean.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74125 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-24 22:08:59 +00:00
Andreas Bolka
cb21010fa0 Scaffolding for LDA pass.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74120 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-24 21:29:13 +00:00
Bob Wilson
e46161f10c Fix the Ocaml bindings for the ExecutionEngine: with the change to build
libraries instead of relinked objects, the interpreter, JIT, and native
target libraries were not being linked in to an ocaml program using the
ExecutionEngine.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74117 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-24 21:09:18 +00:00
Owen Anderson
1c47c7db1e Update for DOTGraphTraits changes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74113 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-24 20:41:17 +00:00
David Greene
f2e19d5dcf This increases the maximum for MVT::LAST_VALUETYPE
This change doubles the allowable value for MVT::LAST_VALUETYPE. It does
this by doing several things.

1. Introduces MVT::MAX_ALLOWED_LAST_VALUETYPE which in this change has a
value of 64.  This value contains the current maximum for the
MVT::LAST_VALUETYPE.

2. Instead of checking "MVT::LAST_VALUETYPE <= 32", all of those uses
now become "MVT::LAST_VALUETYPE <= MVT::MAX_ALLOWED_LAST_VALUETYPE"

3. Changes the dimension of the ValueTypeActions from 2 elements to four
elements and adds comments ahead of the declaration indicating the it is
"(MVT::MAX_ALLOWED_LAST_VALUETYPE/32) * 2".  This at least lets us find
what is affected if and when MVT::MAX_ALLOWED_LAST_VALUETYPE gets
changed.

4. Adds initializers for the new elements of ValueTypeActions.

This does NOT add any types in MVT. That would be done separately.

This doubles the size of ValueTypeActions from 64 bits to 128 bits and
gives us the freedom to add more types for AVX.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74110 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-24 19:41:55 +00:00
Daniel Dunbar
84a2926fb7 Sketch streamer support for .align, .org functionality.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74109 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-24 19:25:34 +00:00
Chris Lattner
0de1fc4f41 sink management of DwarfWriter & MachineModuleInfo into the AsmPrinter base class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74101 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-24 19:09:55 +00:00
Chris Lattner
0a7befa8bd eliminate the ExtWeakSymbols set from AsmPrinter. This eliminates
a bunch of code from all the targets, and eliminates nondeterministic
ordering of directives being emitted in the output.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74096 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-24 18:52:01 +00:00
Chris Lattner
31530617dd Rearrange some stuff in MachineOperand and add a new TargetFlags field.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74087 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-24 17:54:48 +00:00
Owen Anderson
8cbc94afb7 Get rid of the global CFGOnly flag by threading a ShortNames parameters through the GraphViz rendering code.
Update other uses in the codebase for this change.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74084 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-24 17:37:09 +00:00
Daniel Dunbar
71d259bc4b We decided to not worry about Atoms for now, it should be straightforward to
reintroduce them later.

Also, don't require MCSection* when creating a symbol.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74081 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-24 17:00:42 +00:00
Daniel Dunbar
d814b21509 MCStreamer: Add a few more "symbol attributes".
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74077 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-24 16:36:52 +00:00
Dan Gohman
650919e8b0 Remove an obsolete comment and fix some 80-column violations.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74059 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-24 04:47:54 +00:00
Chris Lattner
c69485e34d add trivial support for passing label definitions through the MCStreamer.
This is suboptimal in several aspects, see the commented out assertion.
I need to talk to Daniel about this.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74057 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-24 04:31:49 +00:00
Dan Gohman
40a5a1b39e Extend ScalarEvolution's multiple-exit support to compute exact
trip counts in more cases.

Generalize ScalarEvolution's isLoopGuardedByCond code to recognize
And and Or conditions, splitting the code out into an
isNecessaryCond helper function so that it can evaluate Ands and Ors
recursively, and make SCEVExpander be much more aggressive about
hoisting instructions out of loops.

test/CodeGen/X86/pr3495.ll has an additional instruction now, but
it appears to be due to an arbitrary register allocation difference.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74048 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-24 01:18:18 +00:00
Daniel Dunbar
a11af531ec Start MCAsmStreamer implementation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74044 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-24 01:03:06 +00:00
Dan Gohman
6bbcba18db Move the special cases for constants out of getUnknown and into
createSCEV. Also, recognize UndefValue in createSCEV.

Change getIntegerSCEV's comment to avoid mentioning FP types,
and re-implement it in terms of getConstant instead of getUnknown.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74041 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-24 00:54:57 +00:00
Chris Lattner
f4a9061b6b stub out a trivial constructor method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74038 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-24 00:51:35 +00:00
Dan Gohman
4d289bf4af Add an isAllOnesValue utility function, similar to isZero and isOne.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74032 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-24 00:30:26 +00:00
Bob Wilson
a96751fc8f Provide InitializeAllTargets and InitializeNativeTarget functions in the
C bindings.  Change all the backend "Initialize" functions to have C linkage.
Change the "llvm/Config/Targets.def" header to use C-style comments to avoid
compile warnings.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74026 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23 23:59:40 +00:00
Daniel Dunbar
ba1da8a7b1 Update for MCImm -> MCValue rename.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74024 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23 23:39:15 +00:00
Chris Lattner
a33ccc7956 rename MCImm ->MCValue.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74023 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23 23:31:52 +00:00
Daniel Dunbar
381e92c66a Add comments for the MCStreamer interface.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74019 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23 23:02:31 +00:00
Devang Patel
9af2fa879c It is not a good idea to have data member's name match argument's name. In fact, it is a simple receipe to waste an hour or so.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74018 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23 22:25:41 +00:00
Devang Patel
0de4fa621e Add DISubprogram::getReturnTypeName()
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74015 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23 22:07:48 +00:00
Daniel Dunbar
ecc63f8687 Start flushing out MCContext.
- Lives inside new library lib/MC (LLVMMC.a)


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74013 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23 22:01:43 +00:00
Owen Anderson
92915e31e9 Use atomic operations when accessing statistics, and make the lazy initialization of statistics actually threadsafe.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74005 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23 21:19:38 +00:00
Owen Anderson
e0fa0b42b2 Add atomic multiply and divide operations, built on top of CompareAndSwap.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74004 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23 21:19:04 +00:00
Owen Anderson
46d9a64944 Make timers threadsafe again. This isn't quite as nice as I'd hoped (it uses locking rather than atomic arithmetic),
but should work on all the platforms we care about.

I might revisit this if a totally awesome way to do it occurs to me.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74002 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23 20:52:29 +00:00
Mikhail Glushenkov
d80d8690af Make llvmc work again.
Chris recently broke llvmc with his Makefile changes (r75379). That patch made
the global change .o -> .a, which caused built-in llvmc plugins to stop working
since plugin initialization in llvmc is based on static variables not referenced
from the main executable. This patch implements auto-generated forced references
to the plugin libraries.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74000 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23 20:46:48 +00:00
Mikhail Glushenkov
06509db630 Typo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73999 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23 20:46:00 +00:00
Daniel Dunbar
25e0d8f755 Start sketching MCStreamer interface.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73994 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23 20:24:17 +00:00
Owen Anderson
6f2c64d70a Revert my last series of commits related to Timer and 64-bit atomics. Not all the targets
we care about are capable of supporting it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73993 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23 20:17:22 +00:00
Bill Wendling
dcee684755 Add include file to get the type for in64_t.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73991 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23 20:02:00 +00:00
Chris Lattner
35d0e87937 add a simple MCImm class.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73984 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23 18:58:00 +00:00
Owen Anderson
f43f9d0ef8 Atomic ops that do arithmetic use signed arithmetic.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73980 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23 18:30:27 +00:00
Owen Anderson
14112e5169 Actually, these need to be signed integers, not unsigned.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73978 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23 18:21:13 +00:00
Owen Anderson
cd92c1000e Use 64-bit integer counters for tracking time, rather than doubles. This will be more atomic op friendly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73974 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23 18:12:30 +00:00
Owen Anderson
0de9953e88 Label the existing atomic functions as 32-bit specific, and add a 64-bit one that will be useful in
the near future.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73971 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23 18:01:04 +00:00
Chris Lattner
f28d631189 add an accessor.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73966 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23 17:50:34 +00:00
Owen Anderson
5a9c0eeaf2 Add an atomic add operation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73964 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23 17:39:31 +00:00
Douglas Gregor
bcba7f95c2 Work around build problem with OpenJDK, which defines X86 as a
macro. Fixes PR 4427. Patch by Xerxes Rånby!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73961 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23 17:21:35 +00:00
Owen Anderson
200aa6d89b Revert r73923, which broke clang.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73957 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-23 16:36:10 +00:00
Owen Anderson
af2e2b54b6 Add guards around timer groups, which can be shared.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73923 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-22 23:37:06 +00:00
Bob Wilson
5bafff36c7 Add support for ARM's Advanced SIMD (NEON) instruction set.
This is still a work in progress but most of the NEON instruction set
is supported.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73919 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-22 23:27:02 +00:00
Owen Anderson
753ad615f9 Remove the parent pointer from SCEV, since it did not end up being needed.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73907 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-22 21:57:23 +00:00
Owen Anderson
372b46cad9 SCEVHandle is no more!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73906 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-22 21:39:50 +00:00
Bruno Cardoso Lopes
0d3193ef3c Add more methods to gather target specific elf stuff
Support for .text relocations, implementing TargetELFWriter overloaded methods for x86/x86_64.
Use a map to track global values to their symbol table indexes
Code cleanup and small fixes



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73894 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-22 19:16:16 +00:00
Owen Anderson
08367b6163 Banish global state from ScalarEvolution! SCEV uniquing is now done by tables attached to the ScalarEvolution pass.
This also throws out the SCEV reference counting scheme, as the the SCEVs now have a lifetime controlled by the
ScalarEvolution pass.

Note that SCEVHandle is now a no-op, and will be remove in a future commit.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73892 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-22 18:25:46 +00:00
Dan Gohman
c9759e80f4 Add a getUMinFromMismatchedTypes helper function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73883 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-22 15:03:27 +00:00
Dan Gohman
f9a9a9928c Factor out code for computing umin and smin for SCEV expressions into
helper functions. Based on a patch by Nick Lewycky.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73869 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-22 03:18:45 +00:00
Dan Gohman
a334aa7a10 Teach ScalarEvolution how to analyze loops with multiple exit
blocks, and also exit blocks with multiple conditions (combined
with (bitwise) ands and ors). It's often infeasible to compute an
exact trip count in such cases, but a useful upper bound can often
be found.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73866 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-22 00:31:57 +00:00
Dan Gohman
51f53b7f5a Fix ScalarEvolution's backedge-taken count computations to check for
overflow when computing a integer division to round up.

Thanks to Nick Lewycky for noticing this!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73862 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-21 23:46:38 +00:00
Chris Lattner
14ee48a5ba rename SourceMgr::PrintError to PrintMessage.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73861 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-21 21:22:11 +00:00
Chris Lattner
7ee5d5f97b move include searching logic from TGLexer to SourceMgr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73845 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-21 05:06:04 +00:00
Chris Lattner
8070ea3f06 Rename TGSourceMgr -> SourceMgr.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73844 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-21 03:41:50 +00:00
Chris Lattner
1e3a8a4924 rename TGLoc -> SMLoc.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73843 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-21 03:39:35 +00:00
Chris Lattner
099e198ae8 move TGSourceMgr class out of TableGen into libsupport.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73842 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-21 03:36:54 +00:00
Chris Lattner
5b038b793c fit in 80 cols
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73838 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-21 01:52:00 +00:00
Chris Lattner
c12430644a implement support for lowering subregs when preparing to print
LEA64_32r, eliminating a bunch of modifier logic stuff on addr modes.

Implement support for printing mbb labels as operands.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73817 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-20 07:03:18 +00:00
Chris Lattner
bb5d44d7c4 make immediates be int64_t like machineoperand. Add some apis
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73809 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-20 00:47:37 +00:00
Owen Anderson
cc40f077b0 Add debugging code to test for various locking faux-pas's, when running in single threaded mode. This should help improve testing coverage for
threading support, without having extensive actually concurrent clients yet.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73803 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-20 00:27:21 +00:00
Owen Anderson
04fb7c36a9 Revert r73790, and replace it with a significantly less ugly solution. Rather than trying to make the global reader-writer lock work,
create separate recursive mutexes for each value map.  The recursive-ness fixes the double-acquiring issue, which having one per ValueMap
lets us continue to maintain some concurrency.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73801 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-20 00:24:58 +00:00
Chris Lattner
d5fb790613 stub out some hacky code for wiring up the new asmprinter interfaces
on X86.  Not useful yet.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73799 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-19 23:59:57 +00:00
Dan Gohman
2c364ad4a6 Make GetMinTrailingZeros a member function of ScalarEvolution,
so that it can access the TargetData member (when available) and
use ValueTracking.h information to compute information for
SCEVUnknown Values.

Also add GetMinLeadingZeros and GetMinSignBits functions,
with minimal implementations.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73794 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-19 23:29:04 +00:00
Owen Anderson
430444b102 Fix a serious bug that would cause deadlock during abstract type refinement. The constant creation
gets involved, and we end up trying to recursively acquire a writer lock.  The fix for this is slightly horrible,
and involves passing a boolean "locked" parameter around in Constants.cpp, but it's better than having locked and
unlocked versions of most of the code.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73790 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-19 23:16:19 +00:00
Devang Patel
1e86a66b00 mv CodeGen/DebugLoc.h Support/DebugLoc.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73786 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-19 22:08:58 +00:00
Owen Anderson
94fefe27f5 Fences are expensive. Avoid doing them when we're not in multithreaded mode.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73777 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-19 17:50:11 +00:00
Owen Anderson
1b19a50cdb Fix a major typo.
Nicolas, this is probably the cause of the failures you were seeing.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73770 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-19 17:08:20 +00:00
Duncan Sands
852cd112ed Add support for AuroraUX. Patch by evocallaghan.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73766 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-19 14:40:01 +00:00
Lang Hames
10382fb71d More VNInfo tweaking, plus a little progress on intra-block splitting.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73750 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-19 02:17:53 +00:00
Zhongxing Xu
8ebf83b2cc Include DataTypes.h for 'uint64_t'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73748 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-19 01:56:53 +00:00
Owen Anderson
4f10c3b4dc Fix weird class-size-being-different problems. At some level this is being caused by config.h not being
included everywhere.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73745 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-19 00:48:22 +00:00
Chris Lattner
475370b036 Add some scaffolding for a new experimental asmprinter
implementation.  The idea is that we want asmprinting to
work by converting MachineInstrs into a new MCInst class,
then the per-instruction asmprinter works on MCInst.  MCInst
and the new asmprinters will not depend on most of the 
llvm code generators.  This allows building diassemblers
that don't link in the whole llvm code generator.  This is
step #1 of many.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73743 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-19 00:47:33 +00:00
Chris Lattner
4e0f25b603 merge the common darwin settings from the X86/PPC/ARM targets
into DarwinTargetAsmInfo.cpp.  The remaining differences should
be evaluated.  It seems strange that x86/arm has .zerofill but ppc
doesn't, etc.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73742 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-19 00:08:39 +00:00
Chris Lattner
a93ca92379 move mangler quote handling from asm printers to TargetAsmInfo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73738 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18 23:41:35 +00:00
Chris Lattner
b839c3f577 simplify macro debug info directive handling.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73736 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18 23:31:37 +00:00
Owen Anderson
4a7893b452 Add a parent pointer to SCEV, in preparation for getting rid of the global uniquing tables. No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73728 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18 22:25:12 +00:00
Owen Anderson
3c8031df6d Add a SmartScopedLock, and use it to simplify code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73722 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18 20:51:00 +00:00
Anton Korobeynikov
9547cdfa35 Revert IRBuilder CC propagation. Fix SimplifyLibCalls instead.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73715 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18 20:05:31 +00:00
Owen Anderson
f0eeb9b7f5 Simplify the SmartMutex implementation a bit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73711 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18 18:29:03 +00:00
Owen Anderson
b65e9ed106 Give RWMutex the SmartRWMutex treatment too.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73710 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18 18:26:15 +00:00
Owen Anderson
b849a4dd4b Insert a SmartMutex templated class into the class hierarchy, which takes a template parameter specifying whether this mutex
should become a no-op when not running in multithreaded mode.  Make sys::Mutex a typedef of SmartMutex<false>, to preserve source compatibility.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73709 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18 17:53:17 +00:00
Owen Anderson
e3cd5ca7e7 Move Threading.[h|cpp] from Support to System.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73707 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18 16:54:52 +00:00
Dan Gohman
4e8a98519e Remove the code from IVUsers that attempted to handle
casted induction variables in cases where the cast
isn't foldable. It ended up being a pessimization in
many cases. This could be fixed, but it would require
a bunch of complicated code in IVUsers' clients. The
advantages of this approach aren't visible enough to
justify it at this time.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73706 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18 16:54:06 +00:00
Anton Korobeynikov
fd0cfe4bb4 Forgot to commit this hunk
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73693 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18 08:30:57 +00:00
Anton Korobeynikov
df9d0f0ed2 Propagate calling conv for invokes too
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73692 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18 08:13:56 +00:00
Chris Lattner
b7b39987bb Don't use int8_t, that requires DataTypes.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73682 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18 04:56:53 +00:00
Zhongxing Xu
73d2f15fb5 include header for uint8_t.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73675 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18 04:11:43 +00:00
Evan Cheng
f9f1da17f8 - Update register allocation hint after coalescing. This is done by the target since the hint is target dependent. This is important for ARM register pair hints.
- Register allocator should resolve the second part of the hint (register number) before passing it to the target since it knows virtual register to physical register mapping.
- More fixes to get ARM load / store double word working.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73671 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-18 02:04:01 +00:00
Owen Anderson
bf5ec1b9db Reapply r73647 in a non-broken form.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73662 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 23:49:06 +00:00
Owen Anderson
b983d67465 Protect the GC table in Function.cpp
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73647 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 22:23:31 +00:00
Anton Korobeynikov
bf823e7590 Honour calling convention and attributes of Callee by default.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73646 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 22:20:46 +00:00
Lang Hames
857c4e01f8 VNInfo cleanup.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73634 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 21:01:20 +00:00
Owen Anderson
dd561e1539 Add an RAII ScopedWriter, which allows one to acquire a writer lock for the duration of a scope. Simplify a lot of uses of
writer locks in Constants.cpp by using it.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73630 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 20:34:43 +00:00
Douglas Gregor
e9d683b052 Define LLVM_NATIVE_ARCH in CMake, so that lli can actually JIT
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73616 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 17:01:56 +00:00
Chris Lattner
7b04c94152 remove two headers subsumed by TargetSelect.h
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73612 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 16:45:02 +00:00
Chris Lattner
5f1a5c7f57 Add a utility header that makes it easy to link in the right set
of targets for various purposes.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73610 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 16:42:01 +00:00
Chris Lattner
08826a50e1 make CreateFMul forward to CreateFMul, not CreateMul.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73603 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 06:31:02 +00:00
Mikhail Glushenkov
71c767b4e3 Fix comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73601 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 03:10:10 +00:00
Douglas Gregor
0711c30376 Update auto-generated configuration files
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73591 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 00:43:20 +00:00
Owen Anderson
efdbfc4cef Use atomic increment/decrement for reference counting of Type's.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73588 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 00:28:49 +00:00
Owen Anderson
9a3df671ab Add an atomic increment and decrement implementation, which will be used for
thread-safe reference counting.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73587 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-17 00:13:00 +00:00
Owen Anderson
1527f5442a Forgot this file in my last commit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73578 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-16 22:56:04 +00:00
Owen Anderson
82995a83e1 Fix #include guards.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73548 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-16 20:26:04 +00:00
Owen Anderson
ff30b7d173 Fix/cleanup trailing newlines.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73546 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-16 20:23:05 +00:00
Owen Anderson
2a8cf9aadd Add a portable wrapper for reader-writer locks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73545 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-16 20:19:28 +00:00
Douglas Gregor
1555a23335 Introduce new headers whose inclusion forces linking and
initialization of all targets (InitializeAllTargets.h) or assembler
printers (InitializeAllAsmPrinters.h). This is a step toward the
elimination of relinked object files, so that we can build normal
archives.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73543 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-16 20:12:29 +00:00
Anton Korobeynikov
385f5a99ec Address review comments: add 3 ARM calling conventions.
Dispatch C calling conv. to one of these conventions based on
target triple and subtarget features.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73530 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-16 18:50:49 +00:00
Owen Anderson
de8aed2808 Add a configure check for pthread_rwlock_init.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73523 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-16 18:20:20 +00:00
Owen Anderson
4c7ac18fc9 Split the thread-related APIs out into their own file, and add a few more
calls for convenience.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73512 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-16 17:33:51 +00:00
Chris Lattner
6cc8a93c48 Generalize instcombine's isSafeToLoadUnconditionally() function
to ignore readonly calls, and factor it out of instcombine so
that it can be used by other passes.  Patch by Frits van Bommel!



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73506 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-16 17:23:12 +00:00
Sanjiv Gupta
7d8d36a69f Fixed names of libcalls checked in r73480.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73483 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-16 10:22:58 +00:00
Sanjiv Gupta
8aa207ee30 Added required libcalls for PIC16 (mostly floating points to integer casting operations).
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73480 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-16 09:03:58 +00:00
Dan Gohman
079f858f03 Add comments to ConstantInt::get and ConstantFP::get to more fully
describe their behavior.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73454 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-16 01:02:32 +00:00
Owen Anderson
be24f1b7fb Owen Anderson 2009-06-15: Use a SmallPtrSet here, for speed and to match df_iterator.
Owen Anderson 2009-06-15: Remember to clear out our maps to prevent crashing.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73438 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15 22:54:48 +00:00
Dan Gohman
a7a8af0c58 Add a CreateFNeg function to IRBuilder.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73437 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15 22:50:40 +00:00
Dan Gohman
6de29f8d96 Support vector casts in more places, fixing a variety of assertion
failures.

To support this, add some utility functions to Type to help support
vector/scalar-independent code. Change ConstantInt::get and
ConstantFP::get to support vector types, and add an overload to
ConstantInt::get that uses a static IntegerType type, for
convenience.

Introduce a new getConstant method for ScalarEvolution, to simplify
common use cases.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73431 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15 22:12:54 +00:00
Anton Korobeynikov
0d492bdf4d Address more comments :)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73430 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15 22:08:48 +00:00
Anton Korobeynikov
52edfc7a6d Document ABIType enum. Patch by Sandeep Patel!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73427 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15 21:46:02 +00:00
Evan Cheng
358dec5180 Part 1.
- Change register allocation hint to a pair of unsigned integers. The hint type is zero (which means prefer the register specified as second part of the pair) or entirely target dependent.
- Allow targets to specify alternative register allocation orders based on allocation hint.

Part 2.
- Use the register allocation hint system to implement more aggressive load / store multiple formation.
- Aggressively form LDRD / STRD. These are formed *before* register allocation. It has to be done this way to shorten live interval of base and offset registers. e.g.
v1025 = LDR v1024, 0
v1026 = LDR v1024, 0
=>
v1025,v1026 = LDRD v1024, 0

If this transformation isn't done before allocation, v1024 will overlap v1025 which means it more difficult to allocate a register pair.

- Even with the register allocation hint, it may not be possible to get the desired allocation. In that case, the post-allocation load / store multiple pass must fix the ldrd / strd instructions. They can either become ldm / stm instructions or back to a pair of ldr / str instructions.

This is work in progress, not yet enabled.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73381 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15 08:28:29 +00:00
Chris Lattner
88d7e403d0 add a new static method to portably determine whether a patch is
absolute or not, based on a patch by Gregory Curfman!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73368 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-15 04:17:07 +00:00
Dan Gohman
a119de86a0 Fix old-style type names in comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73362 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-14 23:30:43 +00:00
Dan Gohman
444f49150d Specialize DenseMapInfo for SCEVHandle, so that SCEVHandles can be
used as keys in DenseMaps.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73360 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-14 22:55:07 +00:00
Dan Gohman
a82752c9eb Convert several parts of the ScalarEvolution framework to use
SmallVector instead of std::vector.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73357 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-14 22:47:23 +00:00
Evan Cheng
90f95f88c6 Move register allocation preference (or hint) from LiveInterval to MachineRegisterInfo. This allows more passes to set them.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73346 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-14 20:22:55 +00:00
Owen Anderson
ca399021d4 Add an early implementation of a partial inlining pass. The idea behind this
is that, for functions whose bodies are entirely guarded by an if-statement, it
can be profitable to pull the test out of the callee and into the caller.

This code has had some cursory testing, but still has a number of known issues
on the LLVM test suite.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73338 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-14 08:26:32 +00:00
Bruno Cardoso Lopes
ae9163f0e2 Introduce new BinaryObject (blob) class, ELF Writer modified to use it. BinaryObject.h by Aaron Gray
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73333 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-14 07:53:21 +00:00
Dan Gohman
2ce84c8d47 Add a ScalarEvolution::getAnyExtendExpr utility function for performing
extension with unspecified bits.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73293 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-13 15:56:47 +00:00
Bruno Cardoso Lopes
7e0b551e2a Type change cleanup on JCE and MCE. Patch by Aaron Gray
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73271 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-12 23:51:56 +00:00
Bruno Cardoso Lopes
d00d4159d4 Use forward declarations and move TargetELFWriterInfo impl to a new file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73209 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-11 22:13:00 +00:00
Bill Wendling
5e0644c73e Remove unused parameter warnings.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73202 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-11 20:10:02 +00:00
Bruno Cardoso Lopes
c997d45ae5 Support for ELF Visibility
Emission for globals, using the correct data sections
Function alignment can be computed for each target using TargetELFWriterInfo
Some small fixes



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73201 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-11 19:16:03 +00:00
Duncan Sands
d6de30ceea Cosmetic changes to parameter attribute verification.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73188 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-11 08:11:03 +00:00
Jay Foad
757068f3ba Implement and use new method Function::hasAddressTaken().
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73164 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-10 08:41:11 +00:00
Sanjiv Gupta
cb597c9cc4 Remove warnings: no newline at end of file.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73156 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-10 03:42:13 +00:00
Owen Anderson
6cbd8da86e Add the beginnings of an implementatation of lazy liveness analysis, based on "Fast Liveness Checking for SSA-form Programs" by Boissinot, et al.
This is still very early, hasn't been tested, and is not yet well documented.  More to come soon.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73141 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-09 19:30:45 +00:00
David Greene
f5aefbdb79 Change IndexedModeAction representation.
This changes the IndexedModeAction representation to remove the
limitation on the number of value types in MVT.  This limitation
prevents us from specifying AVX types.

Prior to this change IndexedModActions was represented as follows...

uint64_t IndexedModeActions[2][ISD::LAST_INDEXED_MODE];

the first dimension was used to represent loads, then stores.  This
imposed a limitation of 32 on the number of value types that could be
handled with this method.  The value type was used to shift the two bits
into and out of the approprate bits in the uint64_t.

With this change the array is now represented as ...

uint8_t IndexedModeActions[MVT::LAST_VALUETYPE][2][ISD::LAST_INDEXED_MODE];

Takes more space but removes the limitation on MVT::LAST_VALUETYPE.  The
first dimension is now the value_type for the reference.  The second
dimension is the load [0] vs. store[1].  The third dimension represents
the various modes for load store.  Accesses are now direct, no shifting
or masking.

There are other limitations that need to be removed, so that
MVT::LAST_VALUETYPE can be greater than 32.  This is merely the first
step towards that goal.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73104 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-09 00:19:10 +00:00
David Greene
63ec51d86b Oops, didn't mean to commit 73102 yet. Revert it.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73103 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-08 23:54:42 +00:00
David Greene
9df4eb8cfe Change IndexedModeAction representation.
This changes the IndexedModeAction representation to remove the
limitation on the number of value types in MVT.  This limitation
prevents us from specifying AVX types.

Prior to this change IndexedModActions was represented as follows...

uint64_t IndexedModeActions[2][ISD::LAST_INDEXED_MODE];

the first dimension was used to represent loads, then stores.  This
imposed a limitation of 32 on the number of value types that could be
handled with this method.  The value type was used to shift the two bits
into and out of the approprate bits in the uint64_t.

With this change the array is now represented as ...

uint8_t IndexedModeActions[MVT::LAST_VALUETYPE][2][ISD::LAST_INDEXED_MODE];

Takes more space but removes the limitation on MVT::LAST_VALUETYPE.  The
first dimension is now the value_type for the reference.  The second
dimension is the load [0] vs. store[1].  The third dimension represents
the various modes for load store.  Accesses are now direct, no shifting
or masking.

There are other limitations that need to be removed, so that
MVT::LAST_VALUETYPE can be greater than 32.  This is merely the first
step towards that goal.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73102 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-08 23:53:19 +00:00
Anton Korobeynikov
0eebf653a7 The attached patches implement most of the ARM AAPCS-VFP hard float
ABI. The missing piece is support for putting "homogeneous aggregates"
into registers.

Patch by Sandeep Patel!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73095 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-08 22:53:56 +00:00
David Greene
e1b469170b Make IntInits and ListInits typed. This helps deduce types of !if and
other operators.  For the rare cases where a list type cannot be
deduced, provide a []<type> syntax, where <type> is the list element
type.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73078 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-08 20:23:18 +00:00
Bruno Cardoso Lopes
a029a27fae Simple ELF32/64 binary files can now be emitted for x86 and x86_64 without
relocation sections.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73038 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-07 21:22:38 +00:00
Nick Lewycky
a5f54a06b0 Create FunctionType::isValidArgumentType to go along with isValidReturnType.
Also create isValidElementType for ArrayType, PointerType, StructType and
VectorType.

Make LLParser use them. This closes up some holes like an assertion failure on:

  %x = type {label}

but largely doesn't change any semantics. The only thing we accept now which
we didn't before is vectors of opaque type such as "<4 x opaque>". The opaque
can be resolved to an int or float when linking.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@73016 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-07 07:26:46 +00:00
Dan Gohman
86fbf2fe4c Rename UnknownValue to CouldNotCompute, since it holds an instance of
SCEVCouldNotCompute, and not SCEVUnknown.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72999 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-06 14:37:11 +00:00
Bruno Cardoso Lopes
f5b0c5a1c7 Remove elf specific info from ELFWriter.h to Elf.h. Code cleanup and more comments added
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72982 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-06 03:56:29 +00:00
Douglas Gregor
318de60701 More portability checks for CMake's config.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72975 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-05 23:46:34 +00:00
Devang Patel
578efa920a Add new function attribute - noimplicitfloat
Update code generator to use this attribute and remove NoImplicitFloat target option.
Update llc to set this attribute when -no-implicit-float command line option is used.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72959 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-05 21:57:13 +00:00
Nate Begeman
abc0199680 Adapt the x86 build_vector dagcombine to the current state of the legalizer.
build vectors with i64 elements will only appear on 32b x86 before legalize.
Since vector widening occurs during legalize, and produces i64 build_vector 
elements, the dag combiner is never run on these before legalize splits them
into 32b elements.

Teach the build_vector dag combine in x86 back end to recognize consecutive 
loads producing the low part of the vector.

Convert the two uses of TLI's consecutive load recognizer to pass LoadSDNodes
since that was required implicitly.

Add a testcase for the transform.

Old:
	subl	$28, %esp
	movl	32(%esp), %eax
	movl	4(%eax), %ecx
	movl	%ecx, 4(%esp)
	movl	(%eax), %eax
	movl	%eax, (%esp)
	movaps	(%esp), %xmm0
	pmovzxwd	%xmm0, %xmm0
	movl	36(%esp), %eax
	movaps	%xmm0, (%eax)
	addl	$28, %esp
	ret

New:
	movl	4(%esp), %eax
	pmovzxwd	(%eax), %xmm0
	movl	8(%esp), %eax
	movaps	%xmm0, (%eax)
	ret




git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72957 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-05 21:37:30 +00:00
Dan Gohman
1d09de3eca Move SCEVExpander::getOrInsertCanonicalInductionVariable out of line.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72949 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-05 16:35:53 +00:00
Dan Gohman
ae3a0be92e Split the Add, Sub, and Mul instruction opcodes into separate
integer and floating-point opcodes, introducing
FAdd, FSub, and FMul.

For now, the AsmParser, BitcodeReader, and IRBuilder all preserve
backwards compatability, and the Core LLVM APIs preserve backwards
compatibility for IR producers. Most front-ends won't need to change
immediately.

This implements the first step of the plan outlined here:
http://nondot.org/sabre/LLVMNotes/IntegerOverflow.txt


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72897 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-04 22:49:04 +00:00
Devang Patel
d18e31ae17 Add new function attribute - noredzone.
Update code generator to use this attribute and remove DisableRedZone target option.
Update llc to set this attribute when -disable-red-zone command line option is used.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72894 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-04 22:05:33 +00:00
Douglas Gregor
ef23d711bc Properly detect malloc_zone_statistics in CMake build system
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72873 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-04 17:22:52 +00:00
Torok Edwin
6c8db34165 Fix comments.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72858 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-04 08:18:25 +00:00
Torok Edwin
e8ebb0fe1b Add support for outputting ANSI colors to raw_fd_ostream.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72854 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-04 07:09:50 +00:00
Nick Kledzik
cbad586240 <rdar://problem/6940611> libLTO.dylib needs to let linker specify path to assembler
Add lto_codegen_set_assembler_path() API which allows the linker to specify the
path to the assembler tool to run.  When assembler is used (instead of compiler)
different command line options are used.
Add LTO_API_VERSION #define so clients (linkers) can conditionalize use of new APIs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72823 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-04 00:28:45 +00:00
Bruno Cardoso Lopes
186c670e15 Use uint8_t and int32_t in {JIT,Machine}CodeEmiters
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72821 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-04 00:15:51 +00:00
Daniel Dunbar
e0f0e0be1c Change LTO to run the global opt pass twice.
- This matches llvm-ld.

It took a bit of archeology to figure out what the right thing to do was
(whether this was intentionally added or intentionally removed). My final
conclusion is that Chris added this intentionally here:
  http://llvm.org/viewvc/llvm-project?view=rev&revision=16913
but the changes weren't propogated to llvm-ld until here:
  http://llvm.org/viewvc/llvm-project?view=rev&revision=34058
which was after lto.cpp had been cloned off (of llvm-ld), here:
  http://llvm.org/viewvc/llvm-project?view=rev&revision=29494

From the commit message, it looks like the motivation for running global opt
again is because we ran it prior to inlining. Based on that I updated the
comment and also only run the pass if we actually ran the inliner.

Chris, please review.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72811 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-03 21:51:32 +00:00
Eli Friedman
a8ba2c25e9 PR4317: Handle splits where the new block is unreachable correctly in
DominatorTreeBase::Split.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72810 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-03 21:42:06 +00:00
Daniel Dunbar
006a034828 Add createStandardLTOPasses to StandardPasses.h, and move lto and llvm-ld over.
- I know it sounds crazy, but I think all the pass lists are now coalesced into
   StandardPasses.h.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72805 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-03 21:06:14 +00:00
Daniel Dunbar
e98c4d0b10 Remove some silly code.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72788 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-03 18:13:05 +00:00
Daniel Dunbar
04d5f44882 Add StandardPasses.h which embeds the standard compilation passes shared by
clang/llvm-gcc.
 - Implemented as inline functions for linking simplicity.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72786 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-03 17:52:39 +00:00
Bruno Cardoso Lopes
bae049cd9e Revert 72650
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72783 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-03 16:55:02 +00:00
Dan Gohman
b3ae97cffe Change TargetFolder's TD member from a reference to a
pointer, now that ConstantFoldConstantExpression can
accept a null TargetData pointer.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72744 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-03 00:13:48 +00:00
Dan Gohman
7714285efd Change ConstantFoldConstantExpression to accept a null
TargetData pointer. The only thing it's used for are
calls to ConstantFoldCompareInstOperands and
ConstantFoldInstOperands, which both already accept a
null TargetData pointer. This makes
ConstantFoldConstantExpression easier to use in clients
where TargetData is optional.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72741 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-02 21:48:15 +00:00
Dan Gohman
014d53595c Delete an unnecessary forward declaration.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72740 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-02 21:37:43 +00:00
Torok Edwin
23e1e727bd fix build on VC++2k8.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72736 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-02 20:32:59 +00:00
Devang Patel
8900bcc1ff Simplify assertion message to avoid confusion.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72731 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-02 17:26:29 +00:00
Lang Hames
f41538d1b5 Update to in-place spilling framework. Includes live interval scaling and trivial rewriter.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72729 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-02 16:53:25 +00:00
Dale Johannesen
874ae251c3 Revert 72707 and 72709, for the moment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72712 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-02 03:12:52 +00:00
Dale Johannesen
4150d83abe Make the implicit inputs and outputs of target-independent
ADDC/ADDE use MVT::i1 (later, whatever it gets legalized to)
instead of MVT::Flag.  Remove CARRY_FALSE in favor of 0; adjust
all target-independent code to use this format.

Most targets will still produce a Flag-setting target-dependent
version when selection is done.  X86 is converted to use i32
instead, which means TableGen needs to produce different code
in xxxGenDAGISel.inc.  This keys off the new supportsHasI1 bit
in xxxInstrInfo, currently set only for X86; in principle this
is temporary and should go away when all other targets have
been converted.  All relevant X86 instruction patterns are
modified to represent setting and using EFLAGS explicitly.  The
same can be done on other targets.

The immediate behavior change is that an ADC/ADD pair are no
longer tightly coupled in the X86 scheduler; they can be
separated by instructions that don't clobber the flags (MOV).
I will soon add some peephole optimizations based on using
other instructions that set the flags to feed into ADC.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72707 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-01 23:27:20 +00:00
Mike Stump
6330084a66 Dcoument that the opauque value used to construct QNaNs is truncated
as necessary.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72702 91177308-0d34-0410-b5e6-96231b3b80d8
2009-06-01 21:02:35 +00:00
Dan Gohman
55b42513e1 Fix the name of the function in this comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72666 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-31 16:18:03 +00:00
Bruno Cardoso Lopes
af90a1cd26 Use uint8_t and int32_t in {JIT,Machine}CodeEmiters
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72650 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-30 23:50:33 +00:00
Bruno Cardoso Lopes
cc5fc60468 Add AMD64 elf machine type
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72635 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-30 21:05:47 +00:00
Bruno Cardoso Lopes
a3f99f9033 First patch in the direction of splitting MachineCodeEmitter in two subclasses:
JITCodeEmitter and ObjectCodeEmitter. No functional changes yet. Patch by Aaron Gray



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72631 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-30 20:51:52 +00:00
Mike Stump
7d36d39e63 Add some documentation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72622 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-30 15:19:29 +00:00
Nick Lewycky
7a0370f66a Give embedded metadata its own type instead of relying on EmptyStructTy.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72610 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-30 05:06:04 +00:00
Mike Stump
c5ca713b80 Add support for letting the client choose different flavors of NaNs. Testcase to be
added in clang.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72606 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-30 03:49:43 +00:00
Bill Wendling
4d4eab219a Untabify.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72603 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-30 00:58:37 +00:00
Evan Cheng
abdbc57abb Default isNarrowingProfitable to false.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72561 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-29 05:31:40 +00:00
Evan Cheng
8b944d39b3 Added optimization that narrow load / op / store and the 'op' is a bit twiddling instruction and its second operand is an immediate. If bits that are touched by 'op' can be done with a narrower instruction, reduce the width of the load and store as well. This happens a lot with bitfield manipulation code.
e.g.
orl     $65536, 8(%rax)
=>
orb     $1, 10(%rax)

Since narrowing is not always a win, e.g. i32 -> i16 is a loss on x86, dag combiner consults with the target before performing the optimization.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72507 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-28 00:35:15 +00:00
Jeffrey Yasskin
493a3d015c LiveVariables::VarInfo contains an AliveBlocks BitVector, which has as many
entries as there are basic blocks in the function.  LiveVariables::getVarInfo
creates a VarInfo struct for every register in the function, leading to
quadratic space use.  This patch changes the BitVector to a SparseBitVector,
which doesn't help the worst-case memory use but does reduce the actual use in
very long functions with short-lived variables.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72426 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-26 18:27:15 +00:00
Dan Gohman
d9480d0f68 Give SCEVNaryExpr a doxygen comment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72423 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-26 17:42:32 +00:00
Evan Cheng
aed4a430f4 Eliminate VarInfo::UsedBlocks.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72411 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-26 06:25:46 +00:00
Dan Gohman
6c0866ca83 Various comment fixes.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72376 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-24 23:45:28 +00:00
Dan Gohman
d594e6f034 Change ScalarEvolution::getSCEVAtScope to always return the original value
in the case where a loop exit value cannot be computed, instead of only in
some cases while using SCEVCouldNotCompute in others. This simplifies
getSCEVAtScope's callers.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72375 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-24 23:25:42 +00:00
Dan Gohman
453aa4fbf1 Generalize SCEVExpander::visitAddRecExpr's GEP persuit, and avoid
sending SCEVUnknowns to expandAddToGEP. This avoids the need for
expandAddToGEP to bend the rules and peek into SCEVUnknown
expressions.

Factor out the code for testing whether a SCEV can be factored by
a constant for use in a GEP index. This allows it to handle
SCEVAddRecExprs, by recursing.

As a result, SCEVExpander can now put more things in GEP indices,
so it emits fewer explicit mul instructions.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72366 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-24 18:06:31 +00:00
Torok Edwin
b679de2a21 The rewriter may hold references to instructions that are deleted because they are trivially dead.
Fix by clearing the rewriter cache before deleting the trivially dead
instructions.
Also make InsertedExpressions use an AssertingVH to catch these
bugs easier.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72364 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-24 14:23:16 +00:00
Anton Korobeynikov
41a024385f Propagate CPU string out of SubtargetFeatures
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72335 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-23 19:50:50 +00:00
Torok Edwin
f5ff1d335b available_externall linkage is not local, this was confusing the codegenerator,
and it wasn't generating calls through @PLT for these functions.
hasLocalLinkage() is now false for available_externally,
I attempted to fix the inliner and dce to handle available_externally properly.
It passed make check.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72328 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-23 14:06:57 +00:00
Eli Friedman
5c22c80744 Add a new step to legalization to legalize vector math operations. This
will allow simplifying LegalizeDAG to eliminate type legalization.  (I 
have a patch to do that, but it's not quite finished; I'll commit it 
once it's finished and I've fixed any review comments for this patch.)  
See the comment at the beginning of 
lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp for more details on the
motivation for this patch.



git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72325 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-23 12:35:30 +00:00
Duncan Sands
b0f1e1780c Add a new codegen pass that normalizes dwarf exception handling
code in preparation for code generation.  The main thing it does
is handle the case when eh.exception calls (and, in a future
patch, eh.selector calls) are far away from landing pads.  Right
now in practice you only find eh.exception calls close to landing
pads: either in a landing pad (the common case) or in a landing
pad successor, due to loop passes shifting them about.  However
future exception handling improvements will result in calls far
from landing pads:
(1) Inlining of rewinds.  Consider the following case:
In function @f:
...
  invoke @g to label %normal unwind label %unwinds
...
unwinds:
  %ex = call i8* @llvm.eh.exception()
...

In function @g:
...
  invoke @something to label %continue unwind label %handler
...
handler:
  %ex = call i8* @llvm.eh.exception()
... perform cleanups ...
  "rethrow exception"

Now inline @g into @f.  Currently this is turned into:
In function @f:
...
  invoke @something to label %continue unwind label %handler
...
handler:
  %ex = call i8* @llvm.eh.exception()
... perform cleanups ...
  invoke "rethrow exception" to label %normal unwind label %unwinds
unwinds:
  %ex = call i8* @llvm.eh.exception()
...

However we would like to simplify invoke of "rethrow exception" into
a branch to the %unwinds label.  Then %unwinds is no longer a landing
pad, and the eh.exception call there is then far away from any landing
pads.

(2) Using the unwind instruction for cleanups.
It would be nice to have codegen handle the following case:
  invoke @something to label %continue unwind label %run_cleanups
...
handler:
... perform cleanups ...
  unwind

This requires turning "unwind" into a library call, which
necessarily takes a pointer to the exception as an argument
(this patch also does this unwind lowering).  But that means
you are using eh.exception again far from a landing pad.

(3) Bugpoint simplifications.  When bugpoint is simplifying
exception handling code it often generates eh.exception calls
far from a landing pad, which then causes codegen to assert.
Bugpoint then latches on to this assertion and loses sight
of the original problem.

Note that it is currently rare for this pass to actually do
anything.  And in fact it normally shouldn't do anything at
all given the code coming out of llvm-gcc!  But it does fire
a few times in the testsuite.  As far as I can see this is
almost always due to the LoopStrengthReduce codegen pass
introducing pointless loop preheader blocks which are landing
pads and only contain a branch to another block.  This other
block contains an eh.exception call.  So probably by tweaking
LoopStrengthReduce a bit this can be avoided.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72276 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-22 20:36:31 +00:00
Daniel Dunbar
7eaf057e54 Add llvm::triple constructor from arch, vendor, os strings, and recognize
DragonFly OS type.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72242 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-22 02:24:11 +00:00
Eli Friedman
15002a2b52 Fix broken logic in DominatorTreeBase::Split. Part of PR4238.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72231 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-21 21:47:54 +00:00
Eli Friedman
e528fca673 Fix indentation.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72227 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-21 21:08:47 +00:00
Jay Foad
c5d73afa48 Tighten up the asserts in SmallVector::operator[]().
If this causes any new assertion failures that I didn't catch in
testing, the fix is usually to change "&v[0]" to "v.data()" for some
SmallVector v.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72221 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-21 19:48:58 +00:00
Duncan Sands
ef854af5bd Add a getAlignOf helper for getting the ABI alignment of a
type as a target independent constant expression.  I confess
that I didn't check that this method works as intended (though
I did test the equivalent hand-written IR a little).  But what
could possibly go wrong!


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72213 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-21 15:52:21 +00:00
Jay Foad
e3e51c0038 Use v.data() instead of &v[0] when SmallVector v might be empty.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72210 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-21 09:52:38 +00:00
Jay Foad
82fe2935bf Implement new SmallVector::data() methods.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72209 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-21 09:00:37 +00:00
Owen Anderson
c4551d3d21 Use DataTypes.h instead of stdint.h.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72201 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-21 00:48:13 +00:00
Bill Wendling
df7d5d3170 Temporarily revert r72191. It was causing an assert during llvm-gcc
bootstrapping.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72200 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-21 00:04:55 +00:00
Argyrios Kyrtzidis
a3437647dc Introduce DebugScope which gets embedded into the machine instructions' DebugLoc.
DebugScope refers to a debug region, function or block.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72191 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-20 22:57:17 +00:00
Dan Gohman
b60182f1b0 Add an accessor method to return the insertion point.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72184 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-20 21:45:41 +00:00
Owen Anderson
6afe2fa288 Have llvm_start_multithreaded return a bool indicating whether multithreaded
initialization succeeded or not, rather than just asserting.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72182 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-20 21:03:06 +00:00
Owen Anderson
3c1eaa0dc2 Move atomic operations' definitions out of line. While this seems kind of silly,
all kinds of problems caused by including windows.h and/or config.h in an LLVM header.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72174 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-20 18:26:15 +00:00
Duncan Sands
0a8fe7a245 When comparing DominanceFrontier's, advance iterators
before erasing nodes, not after.  Otherwise dom frontier
checking reads from freed memory.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72168 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-20 15:12:01 +00:00
Owen Anderson
9b2818d207 Compile fix for MSVC.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72167 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-20 09:34:13 +00:00
Owen Anderson
b4d97b78df Add llvm_start_multithreaded(), which starts up the LLVM internals in thread-safe mode. Provide double-check locking
initialization of ManagedStatic's when running in thread-safe mode.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72151 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-20 00:39:20 +00:00
Owen Anderson
81e4e9f7cb We need to include config.h here so that the #defines are set properly.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72148 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-20 00:31:29 +00:00
Owen Anderson
197ca8e939 Forgot this file in my last commit.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72141 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-19 22:25:55 +00:00
Owen Anderson
a86037084d Split the ENABLE_THREADS #define in two. Now ENABLE_THREADS indicates the ability to run multiple threads at once in the JIT, and requires only
mutex support.  LLVM_MULTITHREADED indicates (or will indicate) the ability to run LLVM itself across multiple threads, and requires atomics support.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72140 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-19 22:18:56 +00:00
Dan Gohman
1959b7562e Make SCEVCallbackVH a private nested class inside ScalarEvolution, as
it's an implementation detail.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72122 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-19 19:22:47 +00:00
Dan Gohman
5be18e8476 Teach SCEVExpander to expand arithmetic involving pointers into GEP
instructions. It attempts to create high-level multi-operand GEPs,
though in cases where this isn't possible it falls back to casting
the pointer to i8* and emitting a GEP with that. Using GEP instructions
instead of ptrtoint+arithmetic+inttoptr helps pointer analyses that
don't use ScalarEvolution, such as BasicAliasAnalysis.

Also, make the AddrModeMatcher more aggressive in handling GEPs.
Previously it assumed that operand 0 of a GEP would require a register
in almost all cases. It now does extra checking and can do more
matching if operand 0 of the GEP is foldable. This fixes a problem
that was exposed by SCEVExpander using GEPs.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72093 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-19 02:15:55 +00:00
Dan Gohman
6c3534c5aa Add some comments noting how IndVarSimplify facilitates
LoopInfo functionality.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72091 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-19 01:52:46 +00:00
Owen Anderson
84e5cac70a Make using an unsupported CAS size a hard error on Windows.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72088 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-19 01:08:36 +00:00
Owen Anderson
ecb1684d51 Fix up the Windows portion of Atomic.h. This is untested, but it is my best understanding of what should work.
I'd be much obliged if someone on MSVC++ could try this out and let me know if it works.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72087 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-19 01:07:40 +00:00
Owen Anderson
03462230c7 Template CompareAndSwap function.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72086 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-19 01:02:27 +00:00
Owen Anderson
71417827e8 Now that we have atomics support properly detected by configure,
use it to implement Atomic.h.

This expunges the code previously imported from libatomic_ops.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@72077 91177308-0d34-0410-b5e6-96231b3b80d8
2009-05-19 00:08:29 +00:00