Commit Graph

5419 Commits

Author SHA1 Message Date
Chris Lattner 2705829925 add a GEP helper function
llvm-svn: 36515
2007-04-27 20:35:56 +00:00
Jeff Cohen 6a23901014 Fix prolific source of 'possible loss of data' warnings.
llvm-svn: 36507
2007-04-27 14:43:05 +00:00
Devang Patel 2c1bba0c0c Move ~Pass() from Pass.h into Pass.cpp
llvm-svn: 36498
2007-04-26 21:33:42 +00:00
Devang Patel e6354bd3ff Delete Analysis Resolver.
llvm-svn: 36493
2007-04-26 21:06:41 +00:00
Dan Gohman e131e3ac02 Fix a typo in a comment.
llvm-svn: 36485
2007-04-26 19:40:56 +00:00
Evan Cheng 910c80851e Rename findRegisterUseOperand to findRegisterUseOperandIdx to avoid confusion.
llvm-svn: 36483
2007-04-26 19:00:32 +00:00
Jeff Cohen 476db10261 Rename identifier that GCC uses as a macro, breaking llvm-gcc build.
llvm-svn: 36474
2007-04-26 15:07:47 +00:00
Chris Lattner 1ceecb5df4 start defining codes for instructions
llvm-svn: 36471
2007-04-26 05:53:04 +00:00
Chris Lattner ca3b44aa57 add a new code
llvm-svn: 36462
2007-04-26 03:26:26 +00:00
Chris Lattner 6337d7b7c7 add alias support to bitcode
llvm-svn: 36460
2007-04-26 02:46:23 +00:00
Evan Cheng 43a17fe826 Be careful when to add implicit kill / dead operands. Don't add them during / post reg-allocation.
llvm-svn: 36458
2007-04-26 01:40:09 +00:00
Evan Cheng d21968d11a Change UsedPhysRegs from array bool to BitVector to save some space. Setting / getting its states now go through MachineFunction.
llvm-svn: 36451
2007-04-25 22:10:09 +00:00
Evan Cheng 0fbe14ab87 Data structure change to improve compile time (especially in debug mode).
llvm-svn: 36447
2007-04-25 19:34:00 +00:00
Devang Patel 7f7b8985f8 Mem2Reg does not need TargetData.
llvm-svn: 36446
2007-04-25 18:41:11 +00:00
Devang Patel 073be55d8e Remove unused function argument.
llvm-svn: 36441
2007-04-25 17:15:20 +00:00
Anton Korobeynikov cb5b13a0b8 Add missed file
llvm-svn: 36439
2007-04-25 16:42:39 +00:00
Anton Korobeynikov a97b694c82 Implement aliases. This fixes PR1017 and it's dependent bugs. CFE part
will follow.

llvm-svn: 36435
2007-04-25 14:27:10 +00:00
Evan Cheng 7818c03c6b Fix for PR1306.
- A register def / use now implicitly affects sub-register liveness but does
not affect liveness information of super-registers.
- Def of a larger register (if followed by a use later) is treated as
read/mod/write of a smaller register.

llvm-svn: 36434
2007-04-25 07:30:23 +00:00
Evan Cheng 93e3a2e6f7 Test if a register is sub- or super-register of another.
llvm-svn: 36433
2007-04-25 07:24:50 +00:00
Evan Cheng 559fae748c Minor speed tweak.
llvm-svn: 36432
2007-04-25 07:24:13 +00:00
Chris Lattner 868d969081 support for >4G frames
llvm-svn: 36424
2007-04-25 04:29:06 +00:00
Chris Lattner 9bd98ea4c1 support > 4G stack objects
llvm-svn: 36422
2007-04-25 04:20:54 +00:00
Chris Lattner 7bf18ba0a2 allow 64-bit stack objects
llvm-svn: 36419
2007-04-25 04:07:31 +00:00
Bill Wendling 5c7f25632e Add the final MMX instructions. Correct a few wrong patterns.
llvm-svn: 36405
2007-04-24 21:18:37 +00:00
Chris Lattner a11d217c7a comentate
llvm-svn: 36395
2007-04-24 15:54:42 +00:00
Chris Lattner c6a993dc8c add records for constant exprs
llvm-svn: 36393
2007-04-24 07:03:08 +00:00
Chris Lattner 82202333be add codes for constants table
llvm-svn: 36382
2007-04-23 23:29:59 +00:00
Christopher Lamb 15ea59ddfc Fix bug in isFloatingPoint()
llvm-svn: 36381
2007-04-23 22:50:40 +00:00
Chris Lattner 3e8d122a25 add a missing operator
llvm-svn: 36375
2007-04-23 20:58:14 +00:00
Chris Lattner 7abd70a4a9 Fix a bug in bitstream writer handling abbrevs, add value symtab
llvm-svn: 36373
2007-04-23 20:34:46 +00:00
Chris Lattner 1c927957f0 implement reading of abbrevs
llvm-svn: 36366
2007-04-23 18:57:58 +00:00
Chris Lattner 49ca73d7bc minor cleanups
llvm-svn: 36365
2007-04-23 18:57:32 +00:00
Chris Lattner 9dd74dbe15 finish implementation of basic abbrev writing.
llvm-svn: 36364
2007-04-23 17:43:52 +00:00
Chris Lattner 4b00d92a09 first part of implementation of abbrevs. The writer isn't fully there yet and the
reader doesn't handle them at all yet.

llvm-svn: 36363
2007-04-23 16:04:05 +00:00
Chris Lattner b652b1346e promote this to being a public header.
llvm-svn: 36357
2007-04-23 01:01:15 +00:00
Christopher Lamb 8af6d5896f PR400 phase 2. Propagate attributed load/store information through DAGs.
llvm-svn: 36356
2007-04-22 23:15:30 +00:00
Christopher Lamb f9206e267d PR400 phase 1 implementation feedback.
llvm-svn: 36354
2007-04-22 22:22:02 +00:00
Jeff Cohen af9a8a51a8 Have compiler enforce this.
llvm-svn: 36353
2007-04-22 22:16:55 +00:00
Christopher Lamb 8448570beb PR400 work phase 1. Add attributed load/store instructions for volatile/align to LLVM.
llvm-svn: 36349
2007-04-22 19:24:39 +00:00
Jeff Cohen 33be4c78ef Fix build problem with Gentoo 4.1.1-r3.
llvm-svn: 36348
2007-04-22 18:49:32 +00:00
Reid Spencer c6a83847a2 For PR1136:
Add reference counting to ParamAttrsList and make use of it in Function,
CallInst and InvokeInst classes.

llvm-svn: 36346
2007-04-22 17:28:03 +00:00
Reid Spencer 380058025b Terminate with newline.
llvm-svn: 36345
2007-04-22 16:31:22 +00:00
Reid Spencer 386837680f Undo premature commit.
llvm-svn: 36344
2007-04-22 16:30:47 +00:00
Reid Spencer d1906a945d Terminate file with newline.
llvm-svn: 36343
2007-04-22 16:29:35 +00:00
Jeff Cohen 7368a611fb Implement review feedback.
llvm-svn: 36342
2007-04-22 15:11:24 +00:00
Jeff Cohen e7518d5dd7 Teach Visual Studio about Bitcode.
llvm-svn: 36341
2007-04-22 15:00:52 +00:00
Chris Lattner eb9b37fd39 Define the content-independent interfaces to read/write bitcode files and
the high-level interface to read/write LLVM IR bitcode files.

This is a work in progress.

llvm-svn: 36329
2007-04-22 06:22:05 +00:00
Reid Spencer 4388f0b4fa For PR1146:
Make ParamAttrsList objects unique. You can no longer directly create or
destroy them but instead must go through the ParamAttrsList::get()
interface.

llvm-svn: 36327
2007-04-22 05:46:44 +00:00
Lauro Ramos Venancio 4e91908f17 X86 TLS: Implement review feedback.
llvm-svn: 36318
2007-04-21 20:56:26 +00:00
Reid Spencer 0c1349e6bc Revert Christopher Lamb's load/store alignment changes.
llvm-svn: 36309
2007-04-21 18:36:27 +00:00
Jeff Cohen bef777f506 Make enum-valued bitfield large enough to avoid interpretation as negative values in VC++.
llvm-svn: 36304
2007-04-21 16:29:37 +00:00
Jeff Cohen fa12f9d64a Fix breakage of bytecode reader when built with VC++.
llvm-svn: 36303
2007-04-21 15:29:13 +00:00
Jeff Cohen a30107fb03 The expression "SubclassData = (SubclassData & ~1) | (V) ? 1 : 0;" does not do what
was intended!  | has higher precedence than ?.  Caught by Visual Studio.

llvm-svn: 36302
2007-04-21 14:32:59 +00:00
Christopher Lamb bff50208c8 add support for alignment attributes on load/store instructions
llvm-svn: 36301
2007-04-21 08:16:25 +00:00
Owen Anderson 94e1d9aa39 Fix some null checks to actually test the part that needs checking.
llvm-svn: 36298
2007-04-21 07:04:45 +00:00
Evan Cheng 951ed1bdd2 Add super-register set.
llvm-svn: 36295
2007-04-21 00:54:06 +00:00
Chris Lattner d9d3a4bbd6 Fix a problem where primitive types lose their name after llvm_shutdown is called.
This also reduces the amount of work done at static construction time.

llvm-svn: 36285
2007-04-20 22:33:47 +00:00
Lauro Ramos Venancio 2518889872 Implement "general dynamic", "initial exec" and "local exec" TLS models for
X86 32 bits.

llvm-svn: 36283
2007-04-20 21:38:10 +00:00
Evan Cheng 3bf93733b9 Add sub-registers set accessor.
llvm-svn: 36282
2007-04-20 21:28:05 +00:00
Evan Cheng da2bf2ce0a Add sub-register sets.
llvm-svn: 36277
2007-04-20 21:11:22 +00:00
Owen Anderson 2da606c757 Move more passes to using ETForest instead of DominatorTree.
llvm-svn: 36271
2007-04-20 06:27:13 +00:00
Owen Anderson 7a5136d8c5 Add null checks and const-ify these accessors.
llvm-svn: 36270
2007-04-20 05:44:16 +00:00
Chris Lattner bc43e8d0b3 Fix a very strange assertion message, patch by Christopher Lamb
CVS: ----------------------------------------------------------------------

llvm-svn: 36267
2007-04-20 03:27:36 +00:00
Jeff Cohen 8cd3f3d7b4 Fix some VC++ warnings.
llvm-svn: 36259
2007-04-19 02:04:09 +00:00
Owen Anderson 9749c4744e Add accessor to get the blocks immediately dominated by a given block to ETForest.
llvm-svn: 36251
2007-04-18 05:25:09 +00:00
Evan Cheng 4c53d321aa VarInfo::UsedBlocks is no longer used. Remove.
llvm-svn: 36250
2007-04-18 05:04:38 +00:00
Owen Anderson fae86bcbaa Add an accessor to make ETForest more useful.
llvm-svn: 36246
2007-04-18 04:38:39 +00:00
Evan Cheng b408e8f11d Don't populate TryAgainList when coalescing only physical registers with virtual registers.
llvm-svn: 36240
2007-04-18 02:30:19 +00:00
Chris Lattner 0d7265650d what's an & between friends?
llvm-svn: 36234
2007-04-18 00:43:05 +00:00
Evan Cheng b881bdabd9 Copy coalescing change to prevent a physical register from being pin to a
long live interval that has low usage density.
1. Change order of coalescing to join physical registers with virtual
   registers first before virtual register intervals become too long.
2. Check size and usage density to determine if it's worthwhile to join.
3. If joining is aborted, assign virtual register live interval allocation
   preference field to the physical register.
4. Register allocator should try to allocate to the preferred register
   first (if available) to create identify moves that can be eliminated.

llvm-svn: 36218
2007-04-17 20:32:26 +00:00
Evan Cheng 57b5214d59 Add a register allocation preference field; add a method to compute size of a live interval.
llvm-svn: 36216
2007-04-17 20:25:11 +00:00
Evan Cheng 2f45bf31c5 Change getAllocatableSet() so it returns allocatable registers for a specific register class.
llvm-svn: 36215
2007-04-17 20:23:34 +00:00
Evan Cheng 8387cf1100 Keep track of number of uses within the function per virtual register.
llvm-svn: 36214
2007-04-17 20:22:11 +00:00
Chris Lattner 51109b7830 Commit an patch from Gabor Greif in Mar 2005. This eliminates the tail
pointer from ilist, storing it in the prev pointer of the first node in the
list instead.

This shrinks ilist from 8 to 4 bytes, BasicBlock from 40->36 bytes, Function
from 76->68 bytes, Module from 52->44 bytes.

llvm-svn: 36210
2007-04-17 18:41:42 +00:00
Chris Lattner ceb4b20807 make getnext/getprev accessors private.
llvm-svn: 36209
2007-04-17 18:30:41 +00:00
Chris Lattner 4a1e0b8c3e make next/prev accessors private
llvm-svn: 36207
2007-04-17 18:16:39 +00:00
Chris Lattner d1721d2e50 bool on darwin/ppc is 4 bytes.
llvm-svn: 36206
2007-04-17 18:15:04 +00:00
Chris Lattner b0aebc208c Instruction:: Next/Prev accessors are now private
llvm-svn: 36204
2007-04-17 18:03:55 +00:00
Anton Korobeynikov 8b7aab009e Implemented correct stack probing on mingw/cygwin for dynamic alloca's.
Also, fixed static case in presence of eax livin. This fixes PR331

PS: Why don't we still have push/pop instructions? :)
llvm-svn: 36195
2007-04-17 09:20:00 +00:00
Jeff Cohen 38be56ddf5 Fix build breakage on 64-bit systems.
llvm-svn: 36193
2007-04-17 05:33:04 +00:00
Chris Lattner 3c2ff10b93 merge several fields in GlobalValue to use the same word, move CallingConv
field into SubclassData in Value.  This shrinks GlobalVAlue from 48->40
bytes, Function from 88->76, and GlobalVariable from 76->68.  This trims
4640 bytes off my testcase, reading a bc file without materializing any
functions.

llvm-svn: 36192
2007-04-17 04:31:29 +00:00
Chris Lattner 422cfcdcb3 The (negative) offset from a SymbolTableListTraits-using ilist to its container
object is always constant.  As such, evaluate it at compile time instead of storing
it as an ivar in SymbolTableListTraits.  This shrinks every SymbolTableListTraits
ilist by a word, shrinking BasicBlock from 44->40 bytes, Function from 96->88 bytes,
and Module from 60->52 bytes.

llvm-svn: 36189
2007-04-17 04:04:14 +00:00
Chris Lattner b47aa543bb Refactor SymbolTableListTraits to only have a single pointer in it, instead
of two.  This shrinkifies Function by 8 bytes (104->96) and Module by 8
bytes (68->60).  On a testcase of mine, this reduces the memory used to
read a module header from 565680b to 561024, a little over 4K.

llvm-svn: 36188
2007-04-17 03:26:42 +00:00
Chris Lattner 0ed36f4078 urr, yeah.
llvm-svn: 36187
2007-04-17 02:04:39 +00:00
Reid Spencer 654b96df8b Fix 80 col violations.
llvm-svn: 36168
2007-04-16 21:24:12 +00:00
Devang Patel 9294281ac1 Proivde getAnalysis<FPAnalysis>(Func) support.
llvm-svn: 36159
2007-04-16 20:56:24 +00:00
Devang Patel e64d30573f Give each pass manager chance to manage lower level analysis pass, which is
pass required by one of pass managed by the manager.

llvm-svn: 36153
2007-04-16 20:12:57 +00:00
Devang Patel 254c9eb7c8 Add getPotentialPassManagerType(). No functionality change, yet.
llvm-svn: 36149
2007-04-16 18:51:25 +00:00
Anton Korobeynikov fb80151c42 Removed tabs everywhere except autogenerated & external files. Add make
target for tabs checking.

llvm-svn: 36146
2007-04-16 18:10:23 +00:00
Reid Spencer 9c2eec377e For PR1328:
Don't assert everytime an intrinsic name isn't recognized. Instead, make
the assert optional when callin getIntrinsicID(). This allows the assembler
to handle invalid intrinsic names gracefully.

llvm-svn: 36120
2007-04-16 06:54:34 +00:00
Owen Anderson f064c92298 Tabs -> Spaces
llvm-svn: 36094
2007-04-15 23:14:18 +00:00
Owen Anderson f35a1dbc7a Remove ImmediateDominator analysis. The same information can be obtained from DomTree. A lot of code for
constructing ImmediateDominator is now folded into DomTree construction.

This is part of the ongoing work for PR217.

llvm-svn: 36063
2007-04-15 08:47:27 +00:00
Owen Anderson 78cecc817f Make ETForest depend on DomTree rather than IDom. This is the first step
in the long process that will be fixing PR 217.

llvm-svn: 36034
2007-04-14 23:49:24 +00:00
Jeff Cohen e7ce8f23f6 Fix PR1329.
llvm-svn: 36016
2007-04-14 21:50:21 +00:00
Chris Lattner 45f15572f7 add GetElementPtrInst::hasAllZeroIndices, a long-overdue helper method.
Writing it twice in the same day was too much for me.

llvm-svn: 35978
2007-04-14 00:12:57 +00:00
Reid Spencer 9329e7b626 Implement a getBitsNeeded method to determine how many bits are needed to
represent a string in binary form by an APInt.

llvm-svn: 35968
2007-04-13 19:19:07 +00:00
Dan Gohman a789d31517 Rename Value::getValueType to getValueID, to avoid confusion with
other things named getValueType.

llvm-svn: 35964
2007-04-13 18:12:09 +00:00
Chris Lattner e71f1447f7 CSE simple binary expressions when they are inserted. This makes LSR produce
less huge code that needs to be cleaned up by sdisel.

llvm-svn: 35959
2007-04-13 05:04:18 +00:00
Lauro Ramos Venancio 749e4668e7 Implement the "thread_local" keyword.
llvm-svn: 35950
2007-04-12 18:32:50 +00:00
Reid Spencer c6251a7dfd For PR1284:
Implement the "part_set" intrinsic.

llvm-svn: 35938
2007-04-12 02:48:46 +00:00
Chris Lattner af039c53c0 improve the patch for PR1318 to also support grouped options with custom
handlers (like the pass list).  My previous fix only supported *new* command
line options, not additions to old ones.

This fixes test/Feature/load_module.ll

llvm-svn: 35935
2007-04-12 00:36:29 +00:00
Reid Spencer a472f66dd0 For PR1146:
Put the parameter attributes in their own ParamAttr name space. Adjust the
rest of llvm as a result.

llvm-svn: 35877
2007-04-11 02:44:20 +00:00
Reid Spencer d3f622e0d5 Teach sys::Path how to recognize different kinds of object files for ELF
and Mach-O systems. Additionally, correct the Mach-O logic code to look at
byte 12 not byte 15. Hopefully this fixes the llvm-ld warning on Darwin.

llvm-svn: 35876
2007-04-11 02:02:09 +00:00
Bill Wendling f099841573 Add support for our first SSSE3 instruction "pmulhrsw".
llvm-svn: 35869
2007-04-10 22:10:25 +00:00
Chris Lattner b05e1727ef fix a comment bug Reid noticed
llvm-svn: 35864
2007-04-10 16:33:06 +00:00
Chris Lattner 2cc9c488e8 add missing methods, mark stuff const
llvm-svn: 35862
2007-04-10 07:06:21 +00:00
Chris Lattner 338bd30f19 getLimitedValue now just forward to APInt's getLimitedValue. Mark it const.
llvm-svn: 35861
2007-04-10 06:44:12 +00:00
Chris Lattner c43883c8a9 add a method
llvm-svn: 35860
2007-04-10 06:43:18 +00:00
Reid Spencer 782ae66e41 Drop the "bit" prefix for the part.select intrinsic.
llvm-svn: 35854
2007-04-10 02:52:46 +00:00
Chris Lattner 35f0417ec1 remove dead target hooks.
llvm-svn: 35847
2007-04-09 23:34:08 +00:00
Chris Lattner 39f65335d5 remove some dead target hooks, subsumed by isLegalAddressingMode
llvm-svn: 35840
2007-04-09 22:27:04 +00:00
Chris Lattner 288c994403 add a default ctor for AddrMode.
llvm-svn: 35832
2007-04-09 21:18:34 +00:00
Reid Spencer ce38beb6a4 For PR1146:
* Add ParamAttrs to InvokeInst class too.
* Make sure all initializes of ParamAttrs in CallInst and InvokeInst are 0
* Destruct the ParamAttrs in Call/Invoke destructors to avoid memory
  leaks. This will change when ParamAttrsList is uniquified but needs to
  be correct until then.

llvm-svn: 35824
2007-04-09 18:00:57 +00:00
Reid Spencer 019c8869ed For PR1146:
* Add ParamAttrList pointers to Function and CallInst.
* Move the implementation of ParamAttrList from Type.cpp to Function.cpp

llvm-svn: 35818
2007-04-09 15:01:12 +00:00
Anton Korobeynikov 506eaf7915 Next stage into switch lowering refactoring
1. Fix some bugs in the jump table lowering threshold
2. Implement much better metric for optimal pivot selection
3. Tune thresholds for different lowering methods
4. Implement shift-and trick for lowering small (<machine word
length) cases with few destinations. Good testcase will follow.

llvm-svn: 35816
2007-04-09 12:31:58 +00:00
Reid Spencer 1ba12951e4 For PR1146:
Remove the handling of ParameterAttributes from FunctionType as they are
their own object defined in ParameterAttributes.h now.

llvm-svn: 35805
2007-04-09 06:06:57 +00:00
Owen Anderson 6978893a8f Move isReachableFromEntry out of line to avoid an unnecessary #include
llvm-svn: 35797
2007-04-09 04:07:36 +00:00
Reid Spencer bdcf9d6f08 Chris convinced me that the default size of the SmallVector (2) was too
small.  Since it doesn't cost much to have 2 more (8 bytes), but not having
them would require a malloc as soon as the third one is needed. Setting
the default to 4 delays the malloc until the 5th parameter attribute.

llvm-svn: 35793
2007-04-09 01:53:54 +00:00
Reid Spencer 389decb3a4 Remove redundancy.
llvm-svn: 35790
2007-04-09 01:26:02 +00:00
Owen Anderson ae39ca037a Cleanup some from my DomSet-removal changes. Add a new
isReachableFromEntry
test to ETForest to factor a common test out of code.

llvm-svn: 35786
2007-04-09 00:52:49 +00:00
Reid Spencer db77ca7cc1 Fix a typo.
llvm-svn: 35781
2007-04-08 22:50:29 +00:00
Reid Spencer f71c15bda6 Implement more feedback:
* Allow attributes to be added and removed singly or jointly so that in
  the future something like -pruneh can manipulate them more easily.
* Move functions generally only useful for LLVM internals to the end of
  the accessors list instead of the beginning.

llvm-svn: 35780
2007-04-08 22:30:27 +00:00
Reid Spencer 0c19c91961 Implement review feedback.
llvm-svn: 35777
2007-04-08 22:05:44 +00:00
Owen Anderson fe507270ac Remove DomSet completely. This concludes work on PR1171.
llvm-svn: 35775
2007-04-08 21:30:05 +00:00
Reid Spencer 0d95160c6d Implement the output inserter for PathWithStatus
llvm-svn: 35770
2007-04-08 20:05:10 +00:00
Reid Spencer 3638a2375f For PR1146:
New header file to provide parameter attribute declarations.

llvm-svn: 35767
2007-04-08 14:46:50 +00:00
Reid Spencer 43340fee01 For PR1291:
Change to use PathWithStatus

llvm-svn: 35746
2007-04-07 19:50:21 +00:00
Reid Spencer ceeb918dd1 For PR1291:
Implement the PathWithStatus class and its use throughout lib/System.

llvm-svn: 35742
2007-04-07 18:52:17 +00:00
Owen Anderson f7ebea1b9f Add DomSet back, and revert the changes to LoopSimplify. Apparently the
ETForest updating mechanisms don't work as I thought they did.  These changes
will be reapplied once the issue is worked out.

llvm-svn: 35741
2007-04-07 18:23:27 +00:00
Nick Lewycky b89804f246 Add signExtend to ConstantRange, to complement zeroExtend and truncate.
llvm-svn: 35733
2007-04-07 15:41:33 +00:00
Owen Anderson 8763ba1b88 Completely purge DomSet. This is the (hopefully) final patch for PR1171.
llvm-svn: 35731
2007-04-07 07:17:27 +00:00
Owen Anderson f095bf3ac4 Expunge DomSet from CodeExtractor. This is part of the continuing work
on PR1171.

llvm-svn: 35726
2007-04-07 05:31:27 +00:00
Chris Lattner 45c0dce868 add loop rot
llvm-svn: 35722
2007-04-07 04:43:02 +00:00
Devang Patel f42389ffe5 Add loop rotation pass.
llvm-svn: 35714
2007-04-07 01:25:15 +00:00
Chris Lattner 5247f60d20 rearchitect the registration mechanism used by the command line option stuff.
This dramatically reduce the amount of memory allocated by the commandline stuff
at static init time, changing it to build local data structures when ParseCommandLineOptions
is called.  In a dummy empty program that links some llvm libraries, this reduces
the number of malloc'd bytes from 4864 to 3360 on entry to main.  Most of that
memory is now allocated by non-commandline related stuff.

llvm-svn: 35701
2007-04-06 21:06:55 +00:00
Chris Lattner d31e5155be Switch some vectors to smallvectors. This reduces amount of malloc'd
memory that occurs before main starts from 5104 to 4864 bytes with a dummy
example app.

llvm-svn: 35698
2007-04-06 18:36:18 +00:00
Chris Lattner 7bbcd122db Eliminate unneeded virtual methods
llvm-svn: 35697
2007-04-06 18:06:27 +00:00
Reid Spencer 8d529a18f4 For PR1209:
Implement Type class's ContainedTys without using a std::vector.

llvm-svn: 35693
2007-04-06 02:02:20 +00:00
Chris Lattner 91e66dc136 eliminate a virtual method
llvm-svn: 35691
2007-04-05 22:21:39 +00:00
Chris Lattner 2031b02faf remove the dead removeArgument method, rename Options to OptionsMap.
llvm-svn: 35690
2007-04-05 21:58:17 +00:00
Chris Lattner 9df6baa772 Add a helper class (APSInt) which can represent an APInt along with sign
information.  This is useful when a value does have a sign associated with
it.  This shouldn't be used generally in LLVM for mid-level optimizer stuff.

llvm-svn: 35681
2007-04-05 05:20:11 +00:00
Reid Spencer cce90f55ed Implement the llvm.bit.part_select.iN.iN.iN overloaded intrinsic.
llvm-svn: 35678
2007-04-04 23:48:25 +00:00
Lauro Ramos Venancio 6db5eb028c Fix release build.
llvm-svn: 35676
2007-04-04 22:13:39 +00:00
Anton Korobeynikov 915e61736b Properly emit range comparisons for switch cases, where neighbour cases
go to the same destination. Now we're producing really good code for
switch-lower-feature.ll testcase

llvm-svn: 35672
2007-04-04 21:14:49 +00:00
Evan Cheng 44a28f7d77 Add isFixedObjectIndex. It returns true if the stack slot index is for a fixed stack object.
llvm-svn: 35659
2007-04-04 07:38:25 +00:00
Reid Spencer 031fb8d4dc Make the LinkInFile and LinkInLibrary both return an indication of whether
the file was found to be a native library (and thus not linked by these
functions).

llvm-svn: 35652
2007-04-04 06:32:01 +00:00
Reid Spencer 6d211ab8ed For PR1302:
Make the FileType enumerators more readable and add COFF, ELF and Mach-O.

llvm-svn: 35649
2007-04-04 06:29:49 +00:00
Chris Lattner e7cc7c825b trivial optimization
llvm-svn: 35648
2007-04-04 06:18:21 +00:00
Chris Lattner adf83a3513 use calloc instead of new/memset, it is more efficient
llvm-svn: 35644
2007-04-04 00:44:31 +00:00
Chris Lattner c712a1322a Initialize the symbol table to zero explicitly. This ensures that the
symbol table does no allocations for prototypes or other lazily deserialized
functions, saving significant space and time.

llvm-svn: 35643
2007-04-04 00:30:49 +00:00
Chris Lattner 2376346a8e Extend StringMap to support being initialized as completely empty. When
initialized this way, they do not do a malloc to allocate their buckets.

llvm-svn: 35642
2007-04-04 00:29:37 +00:00
Bill Wendling ac5b650a54 Adding more MMX instructions.
llvm-svn: 35638
2007-04-03 23:48:32 +00:00
Bill Wendling e7b2a864f2 Add FEMMS and ADDQ. Renamed MMX recipes to prepend the MMX_ to them.
llvm-svn: 35616
2007-04-03 06:00:37 +00:00
Chris Lattner fae5c8fae9 add missing operator
llvm-svn: 35613
2007-04-03 04:25:46 +00:00
Chris Lattner 6b3ff17c70 add a helper function to constantint.
llvm-svn: 35610
2007-04-03 01:41:34 +00:00
Evan Cheng 476fb6a5c9 Ugh. Copy coalescer does not update register numbers.
llvm-svn: 35600
2007-04-02 18:49:18 +00:00
Chris Lattner d14447833a add a helper function.
llvm-svn: 35585
2007-04-02 05:41:00 +00:00
Chris Lattner 7c773e6850 add range version of insert()
llvm-svn: 35572
2007-04-02 01:21:19 +00:00
Zhou Sheng 63b6bc1c88 Remove unused methods.
llvm-svn: 35553
2007-04-01 12:45:33 +00:00
Reid Spencer eba021453b For PR1297:
Implement bswap, ctpop, ctlz, and cttz utilizing the new overloaded
intrinsic feature of tblgen. By defining llvm_int_ty to have an ValueType
of iAny, any intrinsic using that type becomes an overloaded intrinsic.
This signals that a) any integer type could be used for that argument and
b) the intrinsic needs a suffix to match each such argument for the
actual intrinsic.

llvm-svn: 35544
2007-04-01 07:30:57 +00:00
Reid Spencer c7c4880ab1 For PR1297:
Intrinsic functions might need to be generated (if they are overloaded) so
returning a const char* is no longer possible. Change getOperationName to
return a std::string instead.

llvm-svn: 35543
2007-04-01 07:28:37 +00:00
Reid Spencer be23fb0370 For PR1297:
Change the interface to the getName, getType, getDeclaration methods to
include the "actual" types of the result/arguments. This is necessary to
support overloaded intrinsics.

llvm-svn: 35542
2007-04-01 07:26:35 +00:00
Reid Spencer 51455e00dc For PR1297:
Add an "iAny" ValueType as a place holder for an integer type of any
bit width. This is used for intrinsics overloading on integer type.

llvm-svn: 35538
2007-04-01 07:17:45 +00:00
Chris Lattner f2836d17b6 Split the sdisel code munging stuff out into its own opt-pass, CodeGenPrepare.
llvm-svn: 35528
2007-03-31 04:06:36 +00:00
Chris Lattner f2d71d49e2 switch TL::getValueType to use MVT::getValueType.
llvm-svn: 35527
2007-03-31 04:05:24 +00:00
Chris Lattner 516f38b35f add a method to turn a type into a VT.
llvm-svn: 35526
2007-03-31 04:03:02 +00:00
Chris Lattner ac3f81508c add one addressing mode description hook to rule them all.
llvm-svn: 35520
2007-03-30 23:14:50 +00:00
Zhou Sheng 02d3ac6895 Make sure this method just return value equal or less than Limit.
llvm-svn: 35509
2007-03-30 16:50:28 +00:00
Duncan Sands 3dd14331ac Correct typo.
llvm-svn: 35504
2007-03-30 06:39:42 +00:00
Zhou Sheng 9737575772 Rename and correct the method "greaterOrEqual".
llvm-svn: 35502
2007-03-30 05:10:59 +00:00
Zhou Sheng 12b3549f5d Add two utility methods into ConstantInt.
llvm-svn: 35501
2007-03-30 03:22:55 +00:00
Reid Spencer 200c6f9c3d For PR789:
Make the sys::Path::getFileStatus function more efficient by having it
return a pointer to the FileStatus structure rather than copy it. Adjust
uses of the function accordingly. Also, fix some memory issues in sys::Path.

llvm-svn: 35476
2007-03-29 19:05:44 +00:00
Chris Lattner c3f4d87c90 add a hook to demat functions.
llvm-svn: 35471
2007-03-29 18:30:26 +00:00
Jeff Cohen 73926a5fb5 uniqueID is a uint64_t (caught by VC++)
llvm-svn: 35465
2007-03-29 17:28:31 +00:00
Reid Spencer d394617a55 Add a uniqueID field to the FileStatus structure for Paths. This will map
to the inode number on Unix and something far less unique on Windows. The
windows case needs to be improved.

llvm-svn: 35461
2007-03-29 17:00:31 +00:00
Reid Spencer 858045e396 Don't forget to delete the FileStatus structure on destruction of Path.
llvm-svn: 35459
2007-03-29 16:50:49 +00:00
Reid Spencer 0f92f0e519 For PR789:
* Add a method: bool isAbsolute() const, which determines if the path name
  is absolute or not.
* Implement caching of file status information in the Path object. Allow it
  to be updated forcefully or lazily re-fetched from the cached value.

llvm-svn: 35456
2007-03-29 16:43:20 +00:00
Evan Cheng c2cba18f2b Remove isLegalAddressImmediate.
llvm-svn: 35406
2007-03-28 01:53:55 +00:00
Bill Wendling 5852729ce8 Add support for integer comparison builtins.
llvm-svn: 35384
2007-03-27 20:21:31 +00:00
Evan Cheng ec3ac316e2 Change findRegisterUseOperand() to return operand index instead.
llvm-svn: 35363
2007-03-26 22:37:45 +00:00
Dale Johannesen fd18a0cdf4 Fix reversed logic in getRegsUsed. Rename RegStates to RegsAvailable to
hopefully forestall similar errors.

llvm-svn: 35362
2007-03-26 22:23:54 +00:00
Bill Wendling 98d2104c6f Add support for the v1i64 type. This makes better code for this:
#include <mmintrin.h>

extern __m64 C;

void baz(__v2si *A, __v2si *B)
{
  *A = C;
  _mm_empty();
}

We get this:

_baz:
        call "L1$pb"
"L1$pb":
        popl %eax
        movl L_C$non_lazy_ptr-"L1$pb"(%eax), %eax
        movq (%eax), %mm0
        movl 4(%esp), %eax
        movq %mm0, (%eax)
        emms
        ret

GCC gives us this:

_baz:
        pushl   %ebx
        call    L3
"L00000000001$pb":
L3:
        popl    %ebx
        subl    $8, %esp
        movl    L_C$non_lazy_ptr-"L00000000001$pb"(%ebx), %eax
        movl    (%eax), %edx
        movl    4(%eax), %ecx
        movl    16(%esp), %eax
        movl    %edx, (%eax)
        movl    %ecx, 4(%eax)
        emms
        addl    $8, %esp
        popl    %ebx
        ret

llvm-svn: 35351
2007-03-26 07:53:08 +00:00
Chris Lattner 7a86dc5c27 Start value symbol tables out small (space for 16 elts), not huge (space for 512).
This is particularly useful for the JIT, which lazily deserializes functions.

llvm-svn: 35346
2007-03-26 01:45:35 +00:00
Reid Spencer 8314b16fc3 Compute getLowBitsSet correctly. Using the complement of a 64-bit value
and shifting down without regard for the bitwidth of the APInt can lead
to incorrect initialization values. Instead, check for the word size case
(to avoid undef results from shift) and then do (1 << loBitsSet) - 1

llvm-svn: 35344
2007-03-25 21:58:42 +00:00
Anton Korobeynikov 7037826c86 First step of switch lowering refactoring: perform worklist-driven
strategy, emit JT's where possible.

llvm-svn: 35338
2007-03-25 15:07:15 +00:00
Chris Lattner d685514e2e switch TargetLowering::getConstraintType to take the entire constraint,
not just the first letter.  No functionality change.

llvm-svn: 35322
2007-03-25 02:14:49 +00:00
Reid Spencer 9bb967ec5c Fix a typo in a comment.
llvm-svn: 35316
2007-03-25 01:13:46 +00:00
Reid Spencer d4e07f200a Actually, for getHighBitsSet and getLowBitsSet, don't make a 0 bit size
illegal. Instead do the 0 valued construction for the user. This is because
the caller may not know (or care to check) that the number of bits set is
zero.

llvm-svn: 35315
2007-03-25 00:01:47 +00:00
Reid Spencer 42fbb4fbe3 Make it illegal to set 0 bits in getHighBitsSet and getLowBitsSet. For that
they should have used the uint64_t constructor. This avoids causing
undefined results via shifts by the word size when the bit width is an
exact multiple of the word size.

llvm-svn: 35313
2007-03-24 23:47:58 +00:00
Reid Spencer 790631ff2d In the getBitsSet function, don't optimize for a common case that is
already covered by getLowBitsSet (i.e. when loBits==0). Consequently, remove
the default value for loBits and reorder the arguments to the more natural
loBits, hiBits order. This makes it more clear that this function is for bit
groups in the middle of the bit width and not towards one end or the other.

llvm-svn: 35312
2007-03-24 23:42:47 +00:00
Reid Spencer cf3a678d40 Don't invoke undefined behavior in shifts in the functions getHighBitsSet
and getLowBitsSet.

llvm-svn: 35311
2007-03-24 23:35:54 +00:00
Reid Spencer b334e8ac57 Implement the getBitsSet function.
llvm-svn: 35310
2007-03-24 23:27:48 +00:00
Reid Spencer 30e83dfc4b Implement the getHighBitsSet and getLowBitsSet functions.
llvm-svn: 35308
2007-03-24 23:05:35 +00:00
Reid Spencer 41eadeb49d Get the signs in the right place!
llvm-svn: 35307
2007-03-24 22:50:43 +00:00
Reid Spencer 709a820a53 Undo the last change and make this really implement remainder and not
modulus. The previous change was a result of incorrect documentation in
the LangRef.html.

llvm-svn: 35305
2007-03-24 22:37:23 +00:00
Reid Spencer 3e51cacd4f Correct the implementation of srem to be remainder, not modulus. The sign of
the result must follow the sign of the divisor.

llvm-svn: 35302
2007-03-24 21:56:22 +00:00
Reid Spencer 77859c2d49 Clean up this interface:
1. Group similar methods into doxygen groups
2. Reorganize the groups into a consist flow.
3. Significantly improve the quality of the documentation on several methods
4. Rewrite srem and sdiv to eliminate a copy and improve readability.
5. Eliminate unneeded forward references.

llvm-svn: 35300
2007-03-24 18:09:18 +00:00
Chris Lattner 7750e344d3 add a valuetype for v1i64, which is needed by mmx.
llvm-svn: 35298
2007-03-24 17:36:26 +00:00
Bill Wendling 3ab6e72143 This is dead. DEAD I tells you!!
llvm-svn: 35291
2007-03-23 22:42:04 +00:00
Bill Wendling 871c77cda1 PR1260:
Add final support to get the QT example to compile.

llvm-svn: 35290
2007-03-23 22:35:46 +00:00
Dan Gohman ac8fe43024 Add the 'explicit' keyword to several constructors that accept one
argument that don't appear intended as implicit-conversion operators.

llvm-svn: 35280
2007-03-23 18:44:11 +00:00
Bill Wendling 7c17fbc5b7 We generate a shufflevector instruction, so we don't need the builtin
intrinsic.

llvm-svn: 35269
2007-03-22 20:29:26 +00:00
Jeff Cohen d530a17cef Be more explicit concerning argument sizes.
Use VC++ byteswap intrinsics.

llvm-svn: 35267
2007-03-22 19:11:57 +00:00
Bill Wendling d551a18783 Support added for shifts and unpacking MMX instructions.
llvm-svn: 35266
2007-03-22 18:42:45 +00:00
Reid Spencer be7e9bc494 For PR1145:
Add the NoUnwindAttribute to allow explicit marking of functions that do
not unwind the stack via the unwind instruction. This is akin to gcc's
NoThrow attribute and used for optimizing exception handling.

llvm-svn: 35250
2007-03-22 00:32:02 +00:00
Reid Spencer 925e8aa370 Fix a comment.
llvm-svn: 35246
2007-03-21 22:22:19 +00:00
Dale Johannesen 0c6bb5eab7 repair x86 performance, dejagnu problems from previous change
llvm-svn: 35245
2007-03-21 21:51:52 +00:00
Dale Johannesen bacf4acf65 do not share old induction variables when this would result in invalid
instructions (that would have to be split later)

llvm-svn: 35227
2007-03-20 21:54:54 +00:00
Dale Johannesen d05a1a2ade maintain LiveIn when splitting blocks (register scavenging needs it)
llvm-svn: 35226
2007-03-20 21:35:06 +00:00
Devang Patel b39885d23d LoopSimplify::FindPHIToPartitionLoops()
Use ETForest instead of DominatorSet.

llvm-svn: 35222
2007-03-20 20:19:48 +00:00
Evan Cheng 0e3278e505 First cut trivial re-materialization support.
llvm-svn: 35208
2007-03-20 08:13:50 +00:00
Evan Cheng 61f39d186c Added MRegisterInfo hook to re-materialize an instruction.
llvm-svn: 35205
2007-03-20 08:09:38 +00:00
Zhou Sheng 4852dc1cd5 Correct the name: isStrictPositive --> isStrictlyPositive.
llvm-svn: 35201
2007-03-20 02:18:16 +00:00
Chris Lattner cc411d66d0 Add a dtor to fix leaks from all clients of BitVector.
llvm-svn: 35200
2007-03-20 02:10:56 +00:00
Reid Spencer 362fb29d80 Allow ConstantInt::get(Ty, uint64_t) to interpret the 64-bit values as a
negative number. This is needed to fix test/Assembler/2007-03-19-NegValue.ll

llvm-svn: 35181
2007-03-19 20:39:08 +00:00
Reid Spencer 568b8b54dc Add an indication of signedness to the uint64_t constructor so sign bits
can be extended. This helps fix test/Assembler/2007-03-19-NegValue.ll

llvm-svn: 35179
2007-03-19 20:36:48 +00:00
Duncan Sands 5a040c510b Fix obvious typo in comment.
llvm-svn: 35164
2007-03-19 14:25:02 +00:00
Evan Cheng 0420161130 Add a TargetInstrDescriptor flag to mark an instruction as "re-materializable".
It means the instruction can be easily re-materialized at any point. e.g.
constant generation, load from constantpool.

llvm-svn: 35158
2007-03-19 06:19:16 +00:00
Zhou Sheng f89ea5068f Add isStrictPositive() to APInt to determine if this APInt Value > 0.
llvm-svn: 35156
2007-03-19 05:22:18 +00:00
Evan Cheng fd43be8532 Fix comment.
llvm-svn: 35139
2007-03-18 03:26:04 +00:00
Evan Cheng f6f043332f Track the BB's where each virtual register is used.
llvm-svn: 35135
2007-03-17 09:29:54 +00:00
Evan Cheng a2a2fd1e55 Added isLegalAddressExpression hook to test if the given expression can be
folded into target addressing mode for the given type.

llvm-svn: 35121
2007-03-16 08:42:32 +00:00
Evan Cheng 2ae53613ca These forward declarations are not needed.
llvm-svn: 35120
2007-03-16 08:41:06 +00:00
Bill Wendling e31034125c Multiplication support for MMX.
llvm-svn: 35118
2007-03-15 21:24:36 +00:00
Jeff Cohen 137a16ea95 Fix for VS 2005 problem supplied by Morten Ofstad.
llvm-svn: 35098
2007-03-14 15:25:21 +00:00
Zhou Sheng b9c3707e97 Add zextOrCopy() into APInt for convenience.
llvm-svn: 35079
2007-03-13 06:16:26 +00:00
Evan Cheng 6486974e8d More flexible TargetLowering LSR hooks for testing whether an immediate is
a legal target address immediate or scale.

llvm-svn: 35071
2007-03-12 23:26:27 +00:00
Zhou Sheng e8e618a6ff Add getSignBit() and operator<<= into APInt for convenience.
llvm-svn: 35059
2007-03-11 07:16:10 +00:00
Nick Lewycky e455937fae Add getter methods for the extremes of a ConstantRange.
llvm-svn: 35056
2007-03-10 15:54:12 +00:00
Bill Wendling e9b81f5366 Adding more arithmetic operators to MMX. This is an almost exact copy of
the addition. Please let me know if you have suggestions.

llvm-svn: 35055
2007-03-10 09:57:05 +00:00
Bill Wendling 6092ce25cf Added "padd*" support for MMX. Added MMX move stuff to X86InstrInfo so that
moves, loads, etc. are recognized.

llvm-svn: 35031
2007-03-08 22:09:11 +00:00
Evan Cheng 58aeb9c444 Add ReadOnlySection directive.
llvm-svn: 35015
2007-03-08 01:00:38 +00:00
Evan Cheng f9e003b653 Added ContainsRelocations() to check if a constant might only be resolvable at load time.
llvm-svn: 35014
2007-03-08 00:59:12 +00:00
Anton Korobeynikov ed4b303c10 Refactoring of formal parameter flags. Enable properly use of
zext/sext/aext stuff.

llvm-svn: 35008
2007-03-07 16:25:09 +00:00
Evan Cheng b127b0bc27 Add a utility function to test whether a load is unindexed.
llvm-svn: 35004
2007-03-07 08:04:41 +00:00
Devang Patel 2ac57e1f02 Now IndVarSimplify is a LoopPass.
llvm-svn: 35003
2007-03-07 06:39:01 +00:00
Devang Patel 69730c96db Now LICM is a LoopPass.
llvm-svn: 35001
2007-03-07 04:41:30 +00:00
Anton Korobeynikov 942fda027f Fix DWARF debugging information on x86/Linux and (hopefully)
Mingw32/Cygwin targets. This fixes PR978

llvm-svn: 35000
2007-03-07 02:47:57 +00:00
Evan Cheng 7e1cae3d2d Add skipTo to set internal iterator. Useful when pointed to instruction is deleted.
llvm-svn: 34997
2007-03-07 02:36:16 +00:00
Devang Patel 9779e56c04 Now LoopUnroll is a LoopPass.
llvm-svn: 34996
2007-03-07 01:38:05 +00:00
Devang Patel 901a27d892 Now LoopUnswitch is a LoopPass.
llvm-svn: 34992
2007-03-07 00:26:10 +00:00
Devang Patel b0743b5d6a Now LoopStrengthReduce is a LoopPass.
llvm-svn: 34984
2007-03-06 21:14:09 +00:00
Devang Patel 4a8725cf2f Use schedulePass() instead of assignPassManager() to add new LPPassManager.
This ensures that require analysis info is available.

llvm-svn: 34980
2007-03-06 19:11:25 +00:00
Devang Patel ef7ac13406 Add LPPassManager::insertLoop().
llvm-svn: 34979
2007-03-06 19:00:02 +00:00
Devang Patel fca3aa3645 LPPassManager::deleteLoopFromQueue() add meat. Cut-n-paste code from
LoopUnswitch pass.

llvm-svn: 34977
2007-03-06 18:38:33 +00:00
Devang Patel 1699384509 LPPassManager. Implement preparePassManager() hook.
llvm-svn: 34975
2007-03-06 17:59:37 +00:00
Devang Patel 9d9fc90952 Keep track of higher level analysis.
llvm-svn: 34974
2007-03-06 17:52:53 +00:00
Devang Patel 84ffc223f1 LPPassManager : Add initialization and finalizatino hooks.
llvm-svn: 34968
2007-03-06 16:59:03 +00:00
Evan Cheng 8b8cac289b Minor interface change.
llvm-svn: 34967
2007-03-06 10:05:14 +00:00
Evan Cheng 372c2c69f8 Register scavenger is now capable of scavenging. It spills a register whose use of furthest away to make it available.
llvm-svn: 34964
2007-03-06 10:01:25 +00:00