Commit Graph

460 Commits

Author SHA1 Message Date
Anton Korobeynikov 8f35fabbc1 Add support for thiscall calling convention.
Patch by Charles Davis and Steven Watanabe!

llvm-svn: 103902
2010-05-16 09:08:45 +00:00
Chris Lattner 42dbe4943f simplify more.
llvm-svn: 103431
2010-05-10 20:59:18 +00:00
Chris Lattner 609de0068a Simplify by using startswith instead of substr.
llvm-svn: 103430
2010-05-10 20:58:42 +00:00
Duncan Sands 76d6217906 Verify metadata harder. In particular, check that module
level metadata does not have any function local operands.
This would have caught the problem found in PR6112.

llvm-svn: 102620
2010-04-29 16:10:30 +00:00
Eric Christopher 7258dcd77f Revert 101465, it broke internal OpenGL testing.
Probably the best way to know that all getOperand() calls have been handled
is to replace that API instead of updating.

llvm-svn: 101579
2010-04-16 23:37:20 +00:00
Gabor Greif f375520f7b reapply r101434
with a fix for self-hosting

rotate CallInst operands, i.e. move callee to the back
of the operand array

the motivation for this patch are laid out in my mail to llvm-commits:
more efficient access to operands and callee, faster callgraph-construction,
smaller compiler binary

llvm-svn: 101465
2010-04-16 15:33:14 +00:00
Gabor Greif 403e9694f9 back out r101423 and r101397, they break llvm-gcc self-host on darwin10
llvm-svn: 101434
2010-04-16 01:16:20 +00:00
Gabor Greif 33ae80bff7 reapply r101364, which has been backed out in r101368
with a fix

rotate CallInst operands, i.e. move callee to the back
of the operand array

the motivation for this patch are laid out in my mail to llvm-commits:
more efficient access to operands and callee, faster callgraph-construction,
smaller compiler binary

llvm-svn: 101397
2010-04-15 20:51:13 +00:00
Gabor Greif 9fd00c7d25 back out r101364, as it trips the linux nightlybot on some clang C++ tests
llvm-svn: 101368
2010-04-15 12:46:56 +00:00
Gabor Greif aafd209632 rotate CallInst operands, i.e. move callee to the back
of the operand array

the motivation for this patch are laid out in my mail to llvm-commits:
more efficient access to operands and callee, faster callgraph-construction,
smaller compiler binary

llvm-svn: 101364
2010-04-15 10:49:53 +00:00
Dan Gohman bc048307f3 Fix a comment.
llvm-svn: 100774
2010-04-08 15:57:10 +00:00
Chris Lattner 2104b8d36e rename llvm::llvm_report_error -> llvm::report_fatal_error
llvm-svn: 100709
2010-04-07 22:58:41 +00:00
Gabor Greif a2fbc0ae1b Finally land the InvokeInst operand reordering.
I have audited all getOperandNo calls now, fixing
hidden assumptions. CallSite related uglyness will
be eliminated successively.

Note this patch has a long and griveous history,
for all the back-and-forths have a look at
CallSite.h's log.

llvm-svn: 99399
2010-03-24 13:21:49 +00:00
Chris Lattner 2109cb461c Change intrinsic result type for void to store it as an empty list
instead of as a single element list with VoidTy.  Now with a fix
for the verifier.

llvm-svn: 99206
2010-03-22 20:56:36 +00:00
Gabor Greif e1517a084f backing out r99170 because it still fails on clang-x86_64-darwin10-fnt
llvm-svn: 99171
2010-03-22 09:11:00 +00:00
Gabor Greif 7a743e15e3 Now that hopefully all direct accesses to InvokeInst operands are fixed
we can reapply the InvokeInst operand reordering patch. (see r98957).

llvm-svn: 99170
2010-03-22 08:28:00 +00:00
Devang Patel 5002454d2a call void @llvm.dbg.declare(metadata !{i32* null}, metadata !1)
is valid, but not useful, when variable  identified by !1 is optimized away by the optimizer.

llvm-svn: 98986
2010-03-19 21:06:24 +00:00
Gabor Greif 6c56ed847e back out r98957, it broke http://smooshlab.apple.com:8010/builders/clang-x86_64-darwin10-fnt/builds/703 in the nightly test suite
llvm-svn: 98958
2010-03-19 13:50:02 +00:00
Gabor Greif 8335f9c0bf Recommit r80858 again (which has been backed out in r80871).
This time I did a self-hosted bootstrap on Linux x86-64,
with no problems. Let's see how darwin 64-bit self-hosting
goes. At the first sign of failure I'll back this out.

Maybe the valgrind bots give me a hint of what may be wrong
(it at all).

llvm-svn: 98957
2010-03-19 11:55:53 +00:00
Nick Lewycky 4b5e95426d Add verification of union types.
llvm-svn: 97889
2010-03-06 20:26:48 +00:00
Duncan Sands 19d0b47b1f There are two ways of checking for a given type, for example isa<PointerType>(T)
and T->isPointerTy().  Convert most instances of the first form to the second form.
Requested by Chris.

llvm-svn: 96344
2010-02-16 11:11:14 +00:00
Nick Lewycky 1d9a8159df Teach the verifier to check the condition on a branch and ensure that it has
'i1' type.

llvm-svn: 96282
2010-02-15 22:09:09 +00:00
Nick Lewycky 62f864dea3 Fix crash in VerifyType when checking Contexts. Because there may not be a
Module (we were called with verifyFunction and an unowned Function) we can't
rely on Mod->getContext().

llvm-svn: 96275
2010-02-15 21:52:04 +00:00
Duncan Sands 9dff9bec31 Uniformize the names of type predicates: rather than having isFloatTy and
isInteger, we now have isFloatTy and isIntegerTy.  Requested by Chris!

llvm-svn: 96223
2010-02-15 16:12:20 +00:00
Jeffrey Yasskin 091217be6f Kill ModuleProvider and ghost linkage by inverting the relationship between
Modules and ModuleProviders. Because the "ModuleProvider" simply materializes
GlobalValues now, and doesn't provide modules, it's renamed to
"GVMaterializer". Code that used to need a ModuleProvider to materialize
Functions can now materialize the Functions directly. Functions no longer use a
magic linkage to record that they're materializable; they simply ask the
GVMaterializer.

Because the C ABI must never change, we can't remove LLVMModuleProviderRef or
the functions that refer to it. Instead, because Module now exposes the same
functionality ModuleProvider used to, we store a Module* in any
LLVMModuleProviderRef and translate in the wrapper methods.  The bindings to
other languages still use the ModuleProvider concept.  It would probably be
worth some time to update them to follow the C++ more closely, but I don't
intend to do it.

Fixes http://llvm.org/PR5737 and http://llvm.org/PR5735.

llvm-svn: 94686
2010-01-27 20:34:15 +00:00
Victor Hernandez 016b286758 Fix/strengthen verification of llvm.dbg.declare
llvm-svn: 94195
2010-01-22 19:06:12 +00:00
Victor Hernandez ab62196c9d Backout r93990
llvm-svn: 93995
2010-01-20 07:37:49 +00:00
Victor Hernandez 6c50c06e70 Fix/strengthen verification of llvm.dbg.declare
llvm-svn: 93990
2010-01-20 06:57:02 +00:00
Chris Lattner ffcec8f0d8 reject some invalid IR. We already assert and reject this from the
.ll parser, but PR6070 wants it in the verifier too.

llvm-svn: 93756
2010-01-18 19:50:32 +00:00
Victor Hernandez b324e66f4c Improve llvm.dbg.declare intrinsic by referring directly to the storage in its first argument, via function-local metadata (instead of via a bitcast).
This patch also cleans up code that expects there to be a bitcast in the first argument and testcases that call llvm.dbg.declare.
It also strips old llvm.dbg.declare intrinsics that did not pass metadata as the first argument.

llvm-svn: 93531
2010-01-15 19:04:09 +00:00
Victor Hernandez 8d4904b639 Revert r93504 because older uses of llvm.dbg.declare intrinsics need to be auto-upgraded
llvm-svn: 93515
2010-01-15 17:36:47 +00:00
Victor Hernandez 5d6551816b Improve llvm.dbg.declare intrinsic by referring directly to the storage in its first argument, via function-local metadata (instead of via a bitcast).
This patch also cleans up code that expects there to be a bitcast in the first argument and testcases that call llvm.dbg.declare.

llvm-svn: 93504
2010-01-15 03:37:48 +00:00
David Greene 7749903658 Change errs() to dbgs().
llvm-svn: 92649
2010-01-05 01:29:14 +00:00
Chris Lattner 9b493028df rename "elements" of metadata to "operands". "Elements" are
things that occur in types.  "operands" are things that occur
in values.

llvm-svn: 92322
2009-12-31 01:22:29 +00:00
Chris Lattner 588096e51d Rewrite the function-local validation logic for MDNodes (most of r91708).
Among other benefits, this doesn't leak the SmallPtrSet, has the verifier
code in the verifier pass, actually does the verification at the end,
and is considerably simpler.

llvm-svn: 92217
2009-12-28 09:07:21 +00:00
Victor Hernandez 0471abd58b Formalize MDNode's function-localness:
- an MDNode is designated as function-local when created, and continues to be even if its operands are modified not to refer to function-local IR
- function-localness is designated via lowest bit in SubclassData
- getLocalFunction() descends MDNode tree to see if it is consistently function-local

Add verification of MDNodes to checks that MDNodes are consistently function-local.
Update AsmWriter to use isFunctionLocal().

llvm-svn: 91708
2009-12-18 20:09:14 +00:00
Nick Lewycky 890a1d120f Start catching LLVMContext misuse in the verifier.
llvm-svn: 89646
2009-11-23 04:52:00 +00:00
Chris Lattner 7eb84155a5 Reject duplicate case values in a switch, PR5450.
llvm-svn: 86846
2009-11-11 17:37:02 +00:00
Chris Lattner 253bc77513 the verifier shouldn't modify the IR.
llvm-svn: 85722
2009-11-01 18:11:50 +00:00
Chris Lattner 274717419c 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 112caed500 it isn't valid to take the address of the entry block.
llvm-svn: 85621
2009-10-30 22:15:48 +00:00
Nick Lewycky 974e12b2d3 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
Nick Lewycky 02d5f77d26 Remove VISIBILITY_HIDDEN from class/struct found inside anonymous namespaces.
Chris claims we should never have visibility_hidden inside any .cpp file but
that's still not true even after this commit.

llvm-svn: 85042
2009-10-25 06:33:48 +00:00
Victor Hernandez 8acf2956b8 Remove AllocationInst. Since MallocInst went away, AllocaInst is the only subclass of AllocationInst, so it no longer is necessary.
llvm-svn: 84969
2009-10-23 21:09:37 +00:00
Nick Lewycky e63c2cb3b7 Emit newlines at the end of instructions too.
llvm-svn: 84348
2009-10-17 19:43:45 +00:00
Nick Lewycky 9bc890425a Force memory use markers to have a ConstantInt for the size argument.
llvm-svn: 83960
2009-10-13 07:57:33 +00:00
Chris Lattner fdd8790718 strength reduce a ton of type equality tests to check the typeid (Through
the new predicates I added) instead of going through a context and doing a
pointer comparison.  Besides being cheaper, this allows a smart compiler
to turn the if sequence into a switch.

llvm-svn: 83297
2009-10-05 05:54:46 +00:00
Nick Lewycky 93e06a57c9 Remove the "metadata*" type and simplify the code it complicated. This was only
used to support GlobalVariables storing MDNodes, back when they were derived
from Constant before the introduction of NamedMDNode, but never removed.

llvm-svn: 82943
2009-09-27 23:27:42 +00:00
Victor Hernandez ddc2ce4fe2 No need to verify that malloc's return type is i8*.
llvm-svn: 82561
2009-09-22 18:50:03 +00:00
Victor Hernandez 788eaabd18 Update malloc call creation code (AllocType is now the element type of the malloc, not the resulting type).
In getMallocArraySize(), fix bug in the case that array size is the product of 2 constants.

Extend isArrayMalloc() and getMallocArraySize() to handle case where malloc is used as char array.

Ensure that ArraySize in LowerAllocations::runOnBasicBlock() is correct type.

Extend Instruction::isSafeToSpeculativelyExecute() to handle malloc calls.

Add verification for malloc calls.

Reviewed by Dan Gohman.

llvm-svn: 82257
2009-09-18 19:20:02 +00:00