1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 12:02:58 +02:00
Commit Graph

3159 Commits

Author SHA1 Message Date
Dan Gohman
29dbc79996 Move FunctionPassManagerImpl's dumpArguments and dumpPasses calls
out of its run function and into its doInitialization method, so
that it does the dump once instead of once per function.

llvm-svn: 89660
2009-11-23 16:24:18 +00:00
Duncan Sands
efd23f129e I forgot to update the prototype for LLVMBuildIntCast when correcting
the body to not pass the name for the isSigned parameter.  However it
seems that changing prototypes is a big-no-no, so here I revert the
previous change and pass "true" for isSigned, meaning this always does
a signed cast, which was the previous behaviour assuming the name was
not NULL!  Some other C function needs to be introduced for the general
case of signed or unsigned casts.  This hopefully unbreaks the ocaml
binding.

llvm-svn: 89648
2009-11-23 10:49:03 +00:00
Nick Lewycky
deb3d7dfbc Start catching LLVMContext misuse in the verifier.
llvm-svn: 89646
2009-11-23 04:52:00 +00:00
Jeffrey Yasskin
135f2adcbb In GlobalVariable::setInitializer, assert that the initializer has the
right type.

llvm-svn: 89014
2009-11-17 00:43:13 +00:00
Duncan Sands
0503912f83 BuildIntCast takes an additional parameter, isSigned.
llvm-svn: 88910
2009-11-16 13:15:28 +00:00
Evan Cheng
9b306a1e32 Special case FixedStackPseudoSourceValueVal as well. Do we really need to differentiate PseudoSourceValueVal from FixedStackPseudoSourceValueVal at this level?
llvm-svn: 88902
2009-11-16 07:10:36 +00:00
Eric Christopher
9b6ef0d374 Remove extraneous commit.
llvm-svn: 88716
2009-11-13 23:08:47 +00:00
Eric Christopher
14bf8d4de6 Print out something, even if it's non-parseable later when we've
got ghost linkage. It's better than aborting.

llvm-svn: 88715
2009-11-13 23:00:14 +00:00
Devang Patel
c70b8eefb7 Do not use StringRef in DebugInfo interface.
This allows StringRef to skip controversial if(str) check in constructor.
Buildbots, wait for corresponding clang and llvm-gcc FE check-ins!

llvm-svn: 86914
2009-11-12 00:50:58 +00:00
Chris Lattner
a3457e6bae Reject duplicate case values in a switch, PR5450.
llvm-svn: 86846
2009-11-11 17:37:02 +00:00
Victor Hernandez
70963992b8 make this handle redefinition of malloc function with different prototype correctly
llvm-svn: 86712
2009-11-10 19:53:28 +00:00
Jeffrey Yasskin
23ac706aab Fix DenseMap iterator constness.
This patch forbids implicit conversion of DenseMap::const_iterator to
DenseMap::iterator which was possible because DenseMapIterator inherited
(publicly) from DenseMapConstIterator. Conversion the other way around is now
allowed as one may expect.

The template DenseMapConstIterator is removed and the template parameter
IsConst which specifies whether the iterator is constant is added to
DenseMapIterator.

Actually IsConst parameter is not necessary since the constness can be
determined from KeyT but this is not relevant to the fix and can be addressed
later.

Patch by Victor Zverovich!

llvm-svn: 86636
2009-11-10 01:02:17 +00:00
Daniel Dunbar
886e51b5c1 Fix MemoryBuffer::getSTDIN to *not* return null if stdin is empty, this is a lame API.
Also, Stringrefify some more MemoryBuffer functions, and add two performance FIXMEs.

llvm-svn: 86630
2009-11-10 00:43:58 +00:00
Chris Lattner
91fe2102eb make this handle redefinition of malloc with different prototype correctly.
llvm-svn: 86525
2009-11-09 07:12:01 +00:00
Chris Lattner
f8b7276e30 prune #include / layering violation
llvm-svn: 86365
2009-11-07 09:07:01 +00:00
Victor Hernandez
8275ebb927 Fit in 80 columns
llvm-svn: 86316
2009-11-07 00:36:50 +00:00
Victor Hernandez
8736a8fca4 Re-commit r86077 now that r86290 fixes the 179.art and 175.vpr ARM regressions.
Here is the original commit message:

This commit updates malloc optimizations to operate on malloc calls that have constant int size arguments.

Update CreateMalloc so that its callers specify the size to allocate:
MallocInst-autoupgrade users use non-TargetData-computed allocation sizes.
Optimization uses use TargetData to compute the allocation size.

Now that malloc calls can have constant sizes, update isArrayMallocHelper() to use TargetData to determine the size of the malloced type and the size of malloced arrays.
Extend getMallocType() to support malloc calls that have non-bitcast uses.

Update OptimizeGlobalAddressOfMalloc() to optimize malloc calls that have non-bitcast uses.  The bitcast use of a malloc call has to be treated specially here because the uses of the bitcast need to be replaced and the bitcast needs to be erased (just like the malloc call) for OptimizeGlobalAddressOfMalloc() to work correctly.

Update PerformHeapAllocSRoA() to optimize malloc calls that have non-bitcast uses.  The bitcast use of the malloc is not handled specially here because ReplaceUsesOfMallocWithGlobal replaces through the bitcast use.

Update OptimizeOnceStoredGlobal() to not care about the malloc calls' bitcast use.

Update all globalopt malloc tests to not rely on autoupgraded-MallocInsts, but instead use explicit malloc calls with correct allocation sizes.

llvm-svn: 86311
2009-11-07 00:16:28 +00:00
Victor Hernandez
fe6fe378ce CallInst::CreateMalloc() and CallInst::CreateFree() need to create calls with correct calling convention
llvm-svn: 86290
2009-11-06 21:43:21 +00:00
Daniel Dunbar
4daaf9d3f4 Pass StringRef by value.
llvm-svn: 86251
2009-11-06 10:58:06 +00:00
Chris Lattner
903ae55e1c remove a bunch of extraneous LLVMContext arguments
from various APIs, addressing PR5325.

llvm-svn: 86231
2009-11-06 04:27:31 +00:00
Victor Hernandez
a5a12cd62e Revert r86077 because it caused crashes in 179.art and 175.vpr on ARM
llvm-svn: 86213
2009-11-06 01:33:24 +00:00
Victor Hernandez
21ec158c23 Update CreateMalloc so that its callers specify the size to allocate:
MallocInst-autoupgrade users use non-TargetData-computed allocation sizes.
Optimization uses use TargetData to compute the allocation size.

Now that malloc calls can have constant sizes, update isArrayMallocHelper() to use TargetData to determine the size of the malloced type and the size of malloced arrays.
Extend getMallocType() to support malloc calls that have non-bitcast uses.

Update OptimizeGlobalAddressOfMalloc() to optimize malloc calls that have non-bitcast uses.  The bitcast use of a malloc call has to be treated specially here because the uses of the bitcast need to be replaced and the bitcast needs to be erased (just like the malloc call) for OptimizeGlobalAddressOfMalloc() to work correctly.

Update PerformHeapAllocSRoA() to optimize malloc calls that have non-bitcast uses.  The bitcast use of the malloc is not handled specially here because ReplaceUsesOfMallocWithGlobal replaces through the bitcast use.

Update OptimizeOnceStoredGlobal() to not care about the malloc calls' bitcast use.

Update all globalopt malloc tests to not rely on autoupgraded-MallocInsts, but instead use explicit malloc calls with correct allocation sizes.

llvm-svn: 86077
2009-11-05 00:03:03 +00:00
Victor Hernandez
628b65ea6e Changes requested (avoid getFunction(), avoid Type creation via isVoidTy(), and avoid redundant isFreeCall cases) in feedback to r85176
llvm-svn: 85936
2009-11-03 20:39:35 +00:00
Chris Lattner
ad2926bbb4 remove a bunch of locking from LLVMContextImpl. Since only one thread
can be banging on a context at a time, this isn't needed.  Owen, please
review.

llvm-svn: 85728
2009-11-01 18:42:03 +00:00
Chris Lattner
55a53e4e79 the verifier shouldn't modify the IR.
llvm-svn: 85722
2009-11-01 18:11:50 +00:00
Chris Lattner
baa216cd33 fix an issue where the verifier would reject a function whose entry
block had its address taken even if the blockaddress was dead.

llvm-svn: 85706
2009-11-01 04:08:01 +00:00
Chris Lattner
6e87bdadb9 Fix BlockAddress::replaceUsesOfWithOnConstant to correctly
maintain the block use count in SubclassData.

llvm-svn: 85701
2009-11-01 03:03:03 +00:00
Chris Lattner
2bbe57b2b8 Revert 85678/85680. The decision is to stay with the current form of
indirectbr, thus we don't need "blockaddr(@func, null)".  Eliminate it
for simplicity.

llvm-svn: 85699
2009-11-01 01:27:45 +00:00
Chris Lattner
cbab35746f Make blockaddress(@func, null) be valid, and make 'deleting a basic
block with a blockaddress still referring to it' replace the invalid 
blockaddress with a new blockaddress(@func, null) instead of a 
inttoptr(1).

This changes the bitcode encoding format, and still needs codegen 
support (this should produce a non-zero value, referring to the entry
block of the function would also be quite reasonable).

llvm-svn: 85678
2009-10-31 20:08:37 +00:00
Chris Lattner
3982885b51 if basic blocks are destroyed while there are *just* BlockAddress' hanging
around, then zap them.  This is analogous to dangling constantexprs hanging
off functions.

llvm-svn: 85627
2009-10-30 22:39:36 +00:00
Chris Lattner
74ed905748 make hasAddressTaken() constant time by storing a refcount in BB's subclass data.
llvm-svn: 85625
2009-10-30 22:33:29 +00:00
Chris Lattner
5b38f2ec49 it isn't valid to take the address of the entry block.
llvm-svn: 85621
2009-10-30 22:15:48 +00:00
Dan Gohman
42e985b07a Simplify this code and avoid an extra space character in the output.
llvm-svn: 85568
2009-10-30 02:01:10 +00:00
Chris Lattner
57a8d8d4e0 add sanity check for indbr.
llvm-svn: 85496
2009-10-29 05:53:32 +00:00
Dan Gohman
c80f1a4033 Add a hasAddressTaken for BasicBlock.
llvm-svn: 85449
2009-10-29 00:09:08 +00:00
Chris Lattner
f605b2e8f9 Previously, all operands to Constant were themselves constant.
In the new world order, BlockAddress can have a BasicBlock operand.
This doesn't permute much, because if you have a ConstantExpr (or
anything more specific than Constant) we still know the operand has
to be a Constant.

llvm-svn: 85375
2009-10-28 05:14:34 +00:00
Chris Lattner
c22b8deb03 'static const void *X = &&y' can only be put in the
readonly section if a reference to the containing function
is valid in the readonly section.

llvm-svn: 85370
2009-10-28 04:12:16 +00:00
Chris Lattner
a1aa8a092d asmprinter support for BlockAddress.
llvm-svn: 85367
2009-10-28 03:38:12 +00:00
Chris Lattner
24819a6e06 when we tear down a module, we need to be careful to
zap BlockAddress values.

llvm-svn: 85366
2009-10-28 03:37:35 +00:00
Chris Lattner
2bc8002f4c rename indbr -> indirectbr to appease the residents of #llvm.
llvm-svn: 85351
2009-10-28 00:19:10 +00:00
Chris Lattner
28895dac5b IR support for the new BlockAddress constant kind. This is
untested and there is no way to use it, next up: doing battle
with asmparser.

llvm-svn: 85349
2009-10-28 00:01:44 +00:00
Jeffrey Yasskin
173c58db88 Rename lib/VMCore/ConstantsContext.h:ValueMap<> to ConstantUniqueMap<> to avoid
colliding with llvm/ADT/ValueMap.h:ValueMap<>.

llvm-svn: 85344
2009-10-27 23:45:55 +00:00
Devang Patel
b7572e3783 Factor out redundancy from clone() implementations.
llvm-svn: 85327
2009-10-27 22:16:29 +00:00
Victor Hernandez
0f662a7acf Rename MallocFreeHelper as MemoryBuiltins
llvm-svn: 85286
2009-10-27 20:05:49 +00:00
Chris Lattner
fdda543cea add enough support for indirect branch for the feature test to pass
(assembler,asmprinter, bc reader+writer) and document it.  Codegen
currently aborts on it.

llvm-svn: 85274
2009-10-27 19:13:16 +00:00
Chris Lattner
fa5b1df64a Type.h doesn't need to #include LLVMContext.h
llvm-svn: 85254
2009-10-27 17:08:31 +00:00
Victor Hernandez
6c86b93663 Rename MallocHelper as MallocFreeHelper, since it now also identifies calls to free()
llvm-svn: 85181
2009-10-26 23:58:56 +00:00
Victor Hernandez
673c036bc7 Remove FreeInst.
Remove LowerAllocations pass.
Update some more passes to treate free calls just like they were treating FreeInst.

llvm-svn: 85176
2009-10-26 23:43:48 +00:00
Devang Patel
9027c8f10f Do not use expensive sort().
llvm-svn: 85130
2009-10-26 17:09:00 +00:00
Nick Lewycky
2b8400628d Remove includes of Support/Compiler.h that are no longer needed after the
VISIBILITY_HIDDEN removal.

llvm-svn: 85043
2009-10-25 06:57:41 +00:00