Compare commits

...

7413 Commits

Author SHA1 Message Date
Tanya Lattner
ef55b5d87a Fix bugs section.
llvm-svn: 46992
2008-02-12 06:28:54 +00:00
Tanya Lattner
1c4be00c9e Merge release notes from mainline.
llvm-svn: 46986
2008-02-12 05:16:42 +00:00
Tanya Lattner
06834b2734 release tag.
llvm-svn: 46982
2008-02-12 02:43:50 +00:00
Tanya Lattner
3e45ec8ee2 Merge from mainline.
Don't dump the function!

llvm-svn: 46699
2008-02-04 06:29:04 +00:00
Tanya Lattner
4149ab2eb3 Merge from mainline.
Provide correct DWARF register numbering for debug information emission on x86-32/Darwin.
This should fix bunch of issues.

llvm-svn: 46698
2008-02-04 06:17:46 +00:00
Tanya Lattner
23177b1ff0 Merge from mainline.
Trivial patch to fix two warnings

llvm-svn: 46272
2008-01-23 03:56:34 +00:00
Tanya Lattner
7ae6b34d1d Merge from mainline.
One too many )'s breaks 'make clean' with certain versions of make.
This fixes PR1927

llvm-svn: 46248
2008-01-22 07:16:09 +00:00
Tanya Lattner
d18515a257 Merge from mainline.
Fix the failures in the PPC JIT by marking relocation entries for
external symbols (e.g. 'fmod') as needing a stub.  This regression
was introduced by Evan's jit patch here:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20071231/056749.html

With this fixed, the two ExecutionEngine failures are passing on ppc,
and the ppc jit works on freebench and olden.

llvm-svn: 46225
2008-01-21 22:45:15 +00:00
Tanya Lattner
99d99dcaa2 Merge from mainline.
Need to handle any 'nest' parameter before integer
parameters, since otherwise it won't be passed in
the right register.  With this change trampolines
work on x86-64 (thanks to Luke Guest for providing
access to an x86-64 box).

llvm-svn: 46215
2008-01-21 20:47:24 +00:00
Tanya Lattner
e41e59505e Merge from mainline.
Honour ByVal parameter attribute for name decoration.

llvm-svn: 46214
2008-01-21 20:45:28 +00:00
Tanya Lattner
c1dde534b1 Merge from mainline.
Make sure the caller doesn't use freed memory.
Fixes PR1935.

llvm-svn: 46213
2008-01-21 20:43:02 +00:00
Tanya Lattner
a489619ead UnXFAIL this test.
llvm-svn: 46169
2008-01-18 19:18:51 +00:00
Tanya Lattner
2e1232ef6f Merge from mainline.
Revert the part of 45849 that treated weak globals
as weak globals rather than commons.  While not wrong,
this change tickled a latent bug in Darwin's strip,
so revert it for now as a workaround.

llvm-svn: 46168
2008-01-18 19:15:06 +00:00
Tanya Lattner
f2190a5c18 Merge from mainline.
Revert the part of 45848 that treated weak globals
as weak globals rather than commons.  While not wrong,
this change tickled a latent bug in Darwin's strip,
so revert it for now as a workaround.

llvm-svn: 46167
2008-01-18 19:13:34 +00:00
Tanya Lattner
93f7a28af9 Update for current year.
llvm-svn: 46121
2008-01-17 06:01:52 +00:00
Tanya Lattner
e1a9bf1233 Set version to 2.2
Regenerated configure with autoconf 2.60. Do not use 2.61 until AutoGen.sh is updated!

llvm-svn: 46118
2008-01-17 05:54:18 +00:00
Tanya Lattner
cf9988be1f Creating 2.2 release branch
llvm-svn: 46114
2008-01-17 05:09:49 +00:00
Evan Cheng
04af661b1f DAE bug fix. Don't lose parameter attributes on vararg arguments.
llvm-svn: 46113
2008-01-17 04:18:54 +00:00
Devang Patel
16808a32f4 Enable CBE
llvm-svn: 46112
2008-01-17 02:10:08 +00:00
Evan Cheng
54c20b559e When a live virtual register is being clobbered by an implicit def, it is spilled
and the spill is its kill. However, if the local allocator has determined the
register has not been modified (possible when its value was reloaded), it would
not issue a restore. In that case, mark the last use of the virtual register as
kill.

llvm-svn: 46111
2008-01-17 02:08:17 +00:00
Fariborz Jahanian
386699515b Computed length of a __func__ identifier used in an objective-c method correctly,
when creating its type.

llvm-svn: 46109
2008-01-17 01:36:09 +00:00
Chris Lattner
5630c4f217 Fix arg promotion to propagate the correct attrs on the calls to
promoted functions.  This is important for varargs calls in 
particular.  Thanks to duncan for providing a great testcase.

llvm-svn: 46108
2008-01-17 01:17:03 +00:00
Seo Sanghyeon
15051b4caf Ignore --param
llvm-svn: 46107
2008-01-17 01:08:43 +00:00
Ted Kremenek
e780f408b1 Added some experimental optimizations to remove dead values from the
state.

llvm-svn: 46106
2008-01-17 00:52:48 +00:00
Steve Naroff
1aa1941889 Declarator::clear(): Null out variable after it's been deleted.
This avoids a double free (which is good:-)

Bug submitted by Eli.

llvm-svn: 46105
2008-01-17 00:36:28 +00:00
Evan Cheng
dc5b4c57d7 Replace std::vector<bool> with BitVector.
llvm-svn: 46104
2008-01-17 00:35:26 +00:00
Steve Naroff
d8583eb993 Simplify comment.
llvm-svn: 46103
2008-01-16 23:56:32 +00:00
Steve Naroff
8a0abea999 Type::isArithmeticType(): disallow incomplete enum decls.
Bug submitted by Eli.

llvm-svn: 46102
2008-01-16 23:54:22 +00:00
Ted Kremenek
506e507508 Changed sorting criteria for DSPtr to put sub-expressions first in the value
map. This will allow us to quickly prune them from maps without searching the
entire map.

llvm-svn: 46101
2008-01-16 23:35:31 +00:00
Ted Kremenek
692b01b0be Changed sorting criteria for DSPtr to sort Decl* before Expr*, and
to sort sub-expressions before Block-level expressions.

llvm-svn: 46100
2008-01-16 23:33:44 +00:00
Evan Cheng
7be1528004 Fixes a nasty dag combiner bug that causes a bunch of tests to fail at -O0.
It's not safe to use the two value CombineTo variant to combine away a dead load.
e.g. 
v1, chain2 = load chain1, loc
v2, chain3 = load chain2, loc
v3         = add v2, c 
Now we replace use of v1 with undef, use of chain2 with chain1.
ReplaceAllUsesWith() will iterate through uses of the first load and update operands:
v1, chain2 = load chain1, loc
v2, chain3 = load chain1, loc
v3         = add v2, c 
Now the second load is the same as the first load, SelectionDAG cse will ensure
the use of second load is replaced with the first load.
v1, chain2 = load chain1, loc
v3         = add v1, c
Then v1 is replaced with undef and bad things happen.

llvm-svn: 46099
2008-01-16 23:11:54 +00:00
Duncan Sands
32b0ff6814 Trampoline support for x86-64. This looks like
it should work, but I have no machine to test
it on.  Committed because it will at least
cause no harm, and maybe someone can test it
for me!

llvm-svn: 46098
2008-01-16 22:55:25 +00:00
Ted Kremenek
a14396d51d IntegerLiterals are no longer evaluated to create separate nodes; their
values are determined when evaluating the parent expression.

llvm-svn: 46096
2008-01-16 22:28:08 +00:00
Ted Kremenek
493444fc19 Fixed bug where we performed addition instead of subtraction during
constant propagation.

llvm-svn: 46095
2008-01-16 22:20:36 +00:00
Ted Kremenek
e914bb8183 Fixed iterator bug in ExplodedNodeImpl::NodeGroup::end(); we would improperly
handle the case where the number of nodes was 0.

Fixed bug in GREngineImpl where we did not proceed to the next statement
when processing a PostStmt location.

llvm-svn: 46093
2008-01-16 22:13:19 +00:00
Ted Kremenek
ac886cb835 Added initial graph visualization support for the GRConstants analysis.
llvm-svn: 46092
2008-01-16 21:46:15 +00:00
Ted Kremenek
873bbd53a4 Fixed invalid typedefs in the root and eop iterators for ExplodedGraph.
llvm-svn: 46091
2008-01-16 21:45:54 +00:00
Chris Lattner
39f156183d Handle attribute(used) global variables that are i8.
llvm-svn: 46090
2008-01-16 21:35:43 +00:00
Dale Johannesen
ed20366706 Do not mark EH tables no-dead-strip unless the
associated function is so marked.

llvm-svn: 46088
2008-01-16 19:59:28 +00:00
Ted Kremenek
88d5909bed Added support from retrieving stored values to variables.
llvm-svn: 46087
2008-01-16 19:47:19 +00:00
Ted Kremenek
47b62c1a5f Added support for assignments in GRConstants.
llvm-svn: 46086
2008-01-16 19:42:59 +00:00
Ted Kremenek
7e7070b594 Fixed bug where GRConstants::AddBindings() did not check for values
that were "not a constant."

llvm-svn: 46085
2008-01-16 19:28:16 +00:00
Ted Kremenek
deac51943a Fixed bug in cleanup of nodes in ExplodedNodeImpl where we should directly
call the dstor instead of using delete.

llvm-svn: 46084
2008-01-16 19:27:42 +00:00
Chris Lattner
a65e1f3b31 Move promoteExprToType from being a static method in SemaExpr.cpp to being
a method named ImpCastExprToType in Sema.

Use this method to insert implicit casts for case statements from their 
operand type to the condition type of the switch.  This fixes a crash on
test/CodeGen/statements.c, reported by Eli Friedman.

llvm-svn: 46083
2008-01-16 19:17:22 +00:00
Chris Lattner
45b985c664 add accessors to switchstmt.
llvm-svn: 46082
2008-01-16 19:16:00 +00:00
Ted Kremenek
334139f58e Fixed broken bitmasking in the ctor of ProgramPoint.
llvm-svn: 46081
2008-01-16 19:11:06 +00:00
Ted Kremenek
29a9d00a56 Added missing call to the checker's Initialize() method in the alternate
ctor for GREngine.

llvm-svn: 46080
2008-01-16 18:59:52 +00:00
Ted Kremenek
34eb8bb3bd Added missing ctor to ExplodedGraph.
llvm-svn: 46079
2008-01-16 18:59:09 +00:00
Ted Kremenek
f81d2c9a06 Fixed incorrect pointer mask.
llvm-svn: 46078
2008-01-16 18:58:48 +00:00
Ted Kremenek
db0b651de9 Shortened driver option for running the GR-constants analysis to --grconstants.
llvm-svn: 46076
2008-01-16 18:21:49 +00:00
Ted Kremenek
7773c4fafd Add missing header file for GRConstants analysis.
llvm-svn: 46075
2008-01-16 18:19:20 +00:00
Ted Kremenek
2e12c2e790 Hooked up the GRConstants analysis to the driver.
Fixed some compilation errors with GREngine that showed up during
template instantiation.

llvm-svn: 46074
2008-01-16 18:18:48 +00:00
Chris Lattner
aebbe4700a add testcase for regression
llvm-svn: 46073
2008-01-16 18:03:52 +00:00
Chris Lattner
52188501f6 Fix a ppc long double regression I introduced yesterday due to a
simplification.  This fixes automotive-basicmath on PPC.

llvm-svn: 46072
2008-01-16 17:59:31 +00:00
Ted Kremenek
2d700ed2ba More cleanups in DoStmt. The NodeSets are now vectors instead of sets, since
node caching in GREngine will guarantee that we do not insert a node twice into
a nodeset.

llvm-svn: 46071
2008-01-16 17:56:25 +00:00
Steve Naroff
17832a48f8 Sema::MergeFunctionDecl()...make sure diagnostic is accurate (wrt function declarations/definitions). Patch by Carl Lewis!
llvm-svn: 46070
2008-01-16 15:01:34 +00:00
Chris Lattner
7ca4d5b1f3 merge a few pieces of code that do the store/load to stack
pattern to use EmitStackConvert now.

llvm-svn: 46066
2008-01-16 07:51:34 +00:00
Chris Lattner
87bc3e7ece rename ExpandBIT_CONVERT to EmitStackConvert, generalizing
it to allow it to emit different load and store kinds.

llvm-svn: 46065
2008-01-16 07:45:30 +00:00
Chris Lattner
a2c7ff3386 simplify a bunch of code by using SelectionDAG::CreateStackTemporary
instead of inlining its body.

llvm-svn: 46062
2008-01-16 07:03:22 +00:00
Chris Lattner
91d86242f9 Change legalizeop of FP_ROUND and FP_EXTEND to not fall through
into the ANY_EXTEND/ZERO_EXTEND/SIGN_EXTEND code to simplify it.

Unmerge the code for FP_ROUND and FP_EXTEND from each other to 
make each one simpler.

llvm-svn: 46061
2008-01-16 06:57:07 +00:00
Chris Lattner
6e3379c07b make sure to use a cpu that has sse.
llvm-svn: 46060
2008-01-16 06:32:02 +00:00
Chris Lattner
e8bb9f2190 make it more clear that this predicate only applies to scalar FP types.
llvm-svn: 46058
2008-01-16 06:24:21 +00:00
Chris Lattner
14e616ef0b introduce a isTypeInSSEReg predicate, which allows us to simplify
some code.  No functionality change.

llvm-svn: 46055
2008-01-16 06:19:45 +00:00
Chris Lattner
8f7cec859e My previous commit had an incomplete message, it should have been:
make the 'fp return in ST(0)' optimization smart enough to
look through token factor nodes.  THis allows us to compile 
testcases like CodeGen/X86/fp-stack-retcopy.ll into:

_carg:
	subl	$12, %esp
	call	L_foo$stub
	fstpl	(%esp)
	fldl	(%esp)
	addl	$12, %esp
	ret

instead of:

_carg:
	subl	$28, %esp
	call	L_foo$stub
	fstpl	16(%esp)
	movsd	16(%esp), %xmm0
	movsd	%xmm0, 8(%esp)
	fldl	8(%esp)
	addl	$28, %esp
	ret

Still not optimal, but much better and this is a trivial patch.  Fixing 
the rest requires invasive surgery that is is not llvm 2.2 material.

llvm-svn: 46054
2008-01-16 05:56:59 +00:00
Chris Lattner
ea001f1db7 make the 'fp return in ST(0)' optimization smart enough to
look through token factor

llvm-svn: 46053
2008-01-16 05:53:06 +00:00
Chris Lattner
de5c74f18e various whitespace cleanups, no functionality change.
llvm-svn: 46052
2008-01-16 05:52:18 +00:00
Ted Kremenek
73e5f2bb17 Adjusted DSPtr::Profile method again, since my last patch broke the build.
llvm-svn: 46051
2008-01-16 05:51:13 +00:00
Chris Lattner
2e50a6f90f Factor the ReachesChainWithoutSideEffects out of dag combiner into
a public SDOperand::reachesChainWithoutSideEffects method.  No 
functionality change.

llvm-svn: 46050
2008-01-16 05:49:24 +00:00
Ted Kremenek
29185f17e9 Changed 'Profile' method for DSPtr to incorporate the flags from the
variant type, and not just the pointer value.

llvm-svn: 46049
2008-01-16 05:49:09 +00:00
Devang Patel
b3696e4f14 Do not strip llvm.used values.
llvm-svn: 46045
2008-01-16 03:33:05 +00:00
Ted Kremenek
fb55354fc9 Renamed some internal classes for the GR-Constant Propagation analysis.
Cleaned up GRConstants::AddBinding to not directly reference the
predecessor node.  Now we just manipulate the current state, and a driver
function creates nodes as needed.

llvm-svn: 46040
2008-01-16 00:53:15 +00:00
Fariborz Jahanian
19d42bf0a5 Typo.
llvm-svn: 46038
2008-01-16 00:09:11 +00:00
Fariborz Jahanian
b860cbf052 Added support for rewriting of continue/break statements inside ObjC2's foreach-stmt.
llvm-svn: 46037
2008-01-15 23:58:23 +00:00
Ted Kremenek
de8d62b132 Added skeleton implementation of new constant-prop. analysis using
the graph reachability engine.

llvm-svn: 46036
2008-01-15 23:55:06 +00:00
Ted Kremenek
03bc2afa65 Added ctor to GRNodeBuilder.
llvm-svn: 46035
2008-01-15 23:54:22 +00:00
Ted Kremenek
7ea05687be Changed ImmutableMap::find to return an iterator instead of a pointer
to the tree node.

llvm-svn: 46034
2008-01-15 23:53:53 +00:00
Devang Patel
41f375a45c - Introduces versioning macro LLVM_LTO_VERSION
- Communicate symbol visibility
- Communicate code generation model

llvm-svn: 46033
2008-01-15 23:52:34 +00:00
Chris Lattner
5047536879 Commit a piece that I missed before, patch by Alain Frisch
llvm-svn: 46032
2008-01-15 23:27:40 +00:00
Dale Johannesen
00dfb551cc Missed file from previous checkin.
llvm-svn: 46030
2008-01-15 23:25:27 +00:00
Dale Johannesen
59a2250b0d Fix and enable EH for x86-64 Darwin. Adds
ShortenEHDataFor64Bits as a not-very-accurate
abstraction to cover all the changes in DwarfWriter.
Some cosmetic changes to Darwin assembly code for
gcc testsuite compatibility.

llvm-svn: 46029
2008-01-15 23:24:56 +00:00
Owen Anderson
897aed9109 Move some calls to getVRegDef higher in the callgraph, so they don't get executed as frequently in performance sensitive code.
llvm-svn: 46027
2008-01-15 22:58:11 +00:00
Chris Lattner
cc7ff8c1dd improve compatibility with mingw, patch by Alain Frisch
llvm-svn: 46026
2008-01-15 22:50:50 +00:00
Chris Lattner
f3e1155c41 add a test to ensure that argpromote of one argument doesn't
break the byval attr on some other argument.

llvm-svn: 46025
2008-01-15 22:38:12 +00:00
Anton Korobeynikov
06cbb65cb0 Add description of 'llvm.trap' intrinsic. Also, minor fixes in formatting.
llvm-svn: 46024
2008-01-15 22:31:34 +00:00
Chris Lattner
915ec14073 verify x86 generates ud2 for llvm.trap
llvm-svn: 46023
2008-01-15 22:22:02 +00:00
Steve Naroff
abefc391dd Finish up handling all permutations of "complex int" (in Sema::UsualArithmeticConversions()).
A FIXME remains to verify the conversion rules are consistent with GCC.

Thanks to Eli for the new/improved test case...

llvm-svn: 46022
2008-01-15 22:21:49 +00:00
Evan Cheng
51a09143c2 Unbreak the build.
llvm-svn: 46021
2008-01-15 22:19:35 +00:00
Chris Lattner
50baecd31e new testcase for llvm.trap.
llvm-svn: 46020
2008-01-15 22:17:26 +00:00
Chris Lattner
8e07533f20 If someone wants to implement ppc TRAP, they can go for it :)
llvm-svn: 46019
2008-01-15 22:15:02 +00:00
Chris Lattner
ec224888a6 The type of the 'abort' node should be pointer type (because
it's a function pointer) not MVT::Other.  This fixes builtin_trap
lowering on ppc, alpha, ia64

llvm-svn: 46018
2008-01-15 22:09:33 +00:00
Chris Lattner
9a249b0ce5 rename SDTRet -> SDTNone.
Move definition of 'trap' sdnode up from x86 instrinfo to targetselectiondag.td.

llvm-svn: 46017
2008-01-15 22:02:54 +00:00
Owen Anderson
1ba66e0cec Remove DefInst from LiveVariables::VarInfo. Use the facilities on MachineRegisterInfo instead.
llvm-svn: 46016
2008-01-15 22:02:46 +00:00
Chris Lattner
3c3fefde06 no need to expand ISD::TRAP to X86ISD::TRAP, just match ISD::TRAP.
llvm-svn: 46015
2008-01-15 21:58:22 +00:00
Chris Lattner
ee8df1f4d3 Add support for targets that have a legal ISD::TRAP.
llvm-svn: 46014
2008-01-15 21:58:08 +00:00
Chuck Rose III
fe2714fab3 Add files to windows project files. Also include <algorithm> explicitly so that vstudio build works
llvm-svn: 46013
2008-01-15 21:43:17 +00:00
Anton Korobeynikov
59e6d533bd Fix JIT encoding of trap/ud2 instruction
llvm-svn: 46012
2008-01-15 21:40:02 +00:00
Bill Wendling
d21d90cf98 Reformatted. It was confusing the other way. No functionality change.
llvm-svn: 46009
2008-01-15 21:16:32 +00:00
Gordon Henriksen
1390ef4163 Fix a memory correctness error noticed by valgrind (harmless in practice).
Thanks to Duncan Sands for noticing it.

llvm-svn: 46007
2008-01-15 20:02:11 +00:00
Duncan Sands
60bd71603b Testcase for gimplify_expr crash caused by an
unexpected placeholder_expr.

llvm-svn: 46006
2008-01-15 19:55:41 +00:00
Steve Naroff
6fcfd0581d - Change Type::isComplexType() to exlude GCC's complex integer extension. In general, we will keep the lowest level Type predicates "pure" (i.e. true to the C99 spec).
- Modify Sema::UsualArithmeticConversions() to work with the new definition of Type::isComplexType().

This is a nice cleanup and also fixes a bug submitted by Eli (which I've added to the test suite).

llvm-svn: 46005
2008-01-15 19:36:10 +00:00
Evan Cheng
4f7437f8af Oops. Forgot to commit this.
llvm-svn: 46003
2008-01-15 07:49:54 +00:00
Evan Cheng
eb30bb7d29 Oops. Forgot to commit this.
llvm-svn: 46002
2008-01-15 07:49:36 +00:00
Anton Korobeynikov
6bbbc4cbfa For PR1839: add initial support for __builtin_trap. llvm-gcc part is missed
as well as PPC codegen

llvm-svn: 46001
2008-01-15 07:02:33 +00:00
Chris Lattner
15346fae70 avoid pasting L + "foo" into L"foo".
llvm-svn: 46000
2008-01-15 05:22:14 +00:00
Chris Lattner
877ca77420 avoid token pasting between identifiers and wide strings:
abc+L"foo" -> abc L"foo", not abcL"foo"

llvm-svn: 45999
2008-01-15 05:14:19 +00:00
Chris Lattner
352ab9b4a2 clarify that byval is valid for any pointer argument.
llvm-svn: 45998
2008-01-15 04:34:22 +00:00
Evan Cheng
4d70ba3134 Rename CCIfStruct to CCIfByVal and CCStructAssign to CCPassByVal. Remove unused parameters of CCStructAssign and add size and alignment requirement info.
llvm-svn: 45997
2008-01-15 03:34:58 +00:00
Evan Cheng
48bdfe63e2 Both x86-32 and x86-64 handle byval parameter attributes.
llvm-svn: 45996
2008-01-15 03:15:41 +00:00
Evan Cheng
5b212ea818 ByVal stack slot alignment should be at least as large as pointer ABI alignment.
llvm-svn: 45995
2008-01-15 03:14:05 +00:00
Evan Cheng
a9ecdf6927 Revert my last commit. Not needed.
llvm-svn: 45994
2008-01-15 03:10:35 +00:00
Steve Naroff
8115902d6c Add a comment...
llvm-svn: 45993
2008-01-15 02:05:07 +00:00
Steve Naroff
7f988889ef Rework commit r45976, which was incorrect.
- Add Type::isComplexIntegerType(), Type::getAsComplexIntegerType().
- Don't inlude complex types with Type::isIntegerType(), which is too general.
- Use the new predicates in Sema::UsualArithmeticConversions() to recognize/convert the types.

llvm-svn: 45992
2008-01-15 01:41:59 +00:00
Ted Kremenek
e584359716 Removed implicit transitions to a "BlockExit" location; we now handle
the end of the block by processing empty blocks (at BlockEntrance) or
when we have just processed the last statement in a block (at PostStmt).

llvm-svn: 45991
2008-01-15 00:24:08 +00:00
Ted Kremenek
619bd1a8a0 Removed mutation of CFGBlock through operator[]. For now the underlying ASTs,
however, can still be manipulated through the returned Stmt*.

llvm-svn: 45990
2008-01-15 00:18:01 +00:00
Steve Naroff
d8c7d484af Make sure Sema::GetTypeForDeclarator() deals with abstract declarators when diagnosing incorrect code.
Bug submitted by Eli.

llvm-svn: 45989
2008-01-14 23:33:18 +00:00
Ted Kremenek
3e743661c5 Added prototype implementation of path-sens. analysis core engine.
llvm-svn: 45986
2008-01-14 23:24:37 +00:00
Ted Kremenek
50fd838140 Added operator[] for CFGBlock. This provides random access to the statements
of a block.

llvm-svn: 45984
2008-01-14 23:18:55 +00:00
Chris Lattner
49f980c334 Fix build issue on cygwin, patch by Sam Bishop
llvm-svn: 45977
2008-01-14 21:47:29 +00:00
Steve Naroff
c28f46c6b4 Teach Type::isIntegerType() about GCC's __complex__ integer extensions...
Bug submitted by Eli.

llvm-svn: 45976
2008-01-14 21:38:57 +00:00
Steve Naroff
012484d6c8 Fix crasher when redefining functions. Not 100% pleased with this solution, but it is clearly an improvement. Will discuss with Chris later.
llvm-svn: 45975
2008-01-14 20:51:29 +00:00
Duncan Sands
38987c1dcc Simplify CallInst::hasByValArgument using a new method.
llvm-svn: 45974
2008-01-14 19:57:00 +00:00
Duncan Sands
b5ca2e9fcb I noticed that the trampoline straightening transformation could
drop attributes on varargs call arguments.  Also, it could generate
invalid IR if the transformed call already had the 'nest' attribute
somewhere (this can never happen for code coming from llvm-gcc,
but it's a theoretical possibility).  Fix both problems.

llvm-svn: 45973
2008-01-14 19:52:09 +00:00
Chris Lattner
994718417a don't create the post-ra scheduler unless it is enabled.
llvm-svn: 45972
2008-01-14 19:00:06 +00:00
Chris Lattner
4272c12571 remove dead #include
llvm-svn: 45971
2008-01-14 18:45:28 +00:00
Ted Kremenek
cb994b6a72 Cleaned up comment.
llvm-svn: 45970
2008-01-14 18:42:38 +00:00
Ted Kremenek
94acc6ac9a Cleaned up comment.
llvm-svn: 45969
2008-01-14 18:41:42 +00:00
Ted Kremenek
a018a2c0f4 When serializing CompoundLiteralExpr, serialize out the file scope flag before
serializing the subexpression (Init), as this results in a more efficient
encoding in the bitstream.

llvm-svn: 45967
2008-01-14 18:29:39 +00:00
Steve Naroff
d32419de0d Record if a compound literal expression is @ file scope. This allows us to implement C99 6.5.2.5p6. This could have been done without modifying the AST (by checking the decl type and passing the info down to isContextExpr), however we concluded this is more desirable.
Bug/patch by Eli Friedman!

llvm-svn: 45966
2008-01-14 18:19:28 +00:00
Ted Kremenek
d065a790d9 Removed 'inline' keywords from methods now defined in ExplodedGraph.cpp.
llvm-svn: 45965
2008-01-14 18:11:35 +00:00
Evan Cheng
c8dc2f781f Need a space to separate Make options.
llvm-svn: 45964
2008-01-14 17:58:03 +00:00
Ted Kremenek
a0a3e9bb07 Change uses of std::cerr/std::cout to llvm::Lcerr/llvm::cout, and remove
#include<iostream>.

Patch provided by Sam Bishop.

llvm-svn: 45962
2008-01-14 16:44:48 +00:00
Steve Naroff
4871fe0b8f Revert r45951, Chris says it violates the C99 spec.
llvm-svn: 45961
2008-01-14 16:10:57 +00:00
Duncan Sands
ae8c041b85 This test is now the same as byval-1.ll, so remove it.
llvm-svn: 45960
2008-01-14 14:57:30 +00:00
Duncan Sands
4e079479bb Test that byval cannot be used with pointers to
types with no size.

llvm-svn: 45959
2008-01-14 14:55:05 +00:00
Anders Carlsson
a1afcab6f9 _asm is another valid alias for asm.
llvm-svn: 45957
2008-01-14 07:46:40 +00:00
Duncan Sands
1f5340c023 We now allow byval on fairly general pointer types.
llvm-svn: 45956
2008-01-14 06:53:45 +00:00
Chris Lattner
3c43efc9d1 Improve the FP stackifier to decide all on its own whether
an instruction kills a register or not.  This is cheap and 
easy to do now that instructions record this on their flags,
and this eliminates the second pass of LiveVariables from the
x86 backend.  This speeds up a release llc by ~2.5%.

llvm-svn: 45955
2008-01-14 06:41:29 +00:00
Anders Carlsson
1ba25ca171 Add codegen upport for implicit casts to aggregate exprs.
llvm-svn: 45954
2008-01-14 06:28:57 +00:00
Chris Lattner
f14ba63620 add a note
llvm-svn: 45953
2008-01-14 06:27:57 +00:00
Chris Lattner
fd65291aa3 Fix ASTContext::typesAreCompatible when analyzing a function type with
proto and function type without proto.  It would never call 
'functionTypesAreCompatible' because they have different type classes.

llvm-svn: 45952
2008-01-14 05:45:46 +00:00
Steve Naroff
090353191c Rewrite Expr::isNullPointerConstant() to deal with multiple levels of explicit casts.
Now, isNullPointerConstant() will return true for the following: "(void*)(double*)0"

llvm-svn: 45951
2008-01-14 02:53:34 +00:00
Evan Cheng
b9293c51bd Simplify code.
llvm-svn: 45950
2008-01-14 02:38:45 +00:00
Chris Lattner
26fe7ebc03 Fix the miscompilation of MiBench/consumer-lame that was exposed by Evan's
byval work.  This miscompilation is due to the program indexing an array out
of range and us doing a transformation that broke this.

llvm-svn: 45949
2008-01-14 02:09:12 +00:00
Chris Lattner
9a6db18b04 The isNotSuitableForSRA property is now dead, don't compute it.
llvm-svn: 45948
2008-01-14 01:32:52 +00:00
Chris Lattner
ab0537258f Change SRAGlobal to not depend on isNotSuitableForSRA, which makes it very
difficult to understand the invariants.

llvm-svn: 45947
2008-01-14 01:31:05 +00:00
Chris Lattner
20bbac3435 Make the 'shrink global to bool' optimization more self contained, and thus
easier to show that its safe.  No functionality change.

llvm-svn: 45946
2008-01-14 01:17:44 +00:00
Chris Lattner
92bd785323 Turn a memcpy from a double* into a load/store of double instead of
a load/store of i64.  The later prevents promotion/scalarrepl of the
source and dest in many cases.

This fixes the 300% performance regression of the byval stuff on 
stepanov_v1p2.

llvm-svn: 45945
2008-01-14 00:28:35 +00:00
Chris Lattner
57974c8d51 factor memcpy/memmove simplification out to its own SimplifyMemTransfer
method, no functionality change.

llvm-svn: 45944
2008-01-13 23:50:23 +00:00
Chris Lattner
8c5cdddfb9 simplify some code. If we can infer alignment for source and dest that are
greater than memcpy alignment, and if we lower to load/store, use the best 
alignment info we have.

llvm-svn: 45943
2008-01-13 22:30:28 +00:00
Chris Lattner
5a86612d3f simplify some code by adding a InsertBitCastBefore method,
make memmove->memcpy conversion a bit simpler.

llvm-svn: 45942
2008-01-13 22:23:22 +00:00
Duncan Sands
51fe7bbcf5 Whitespace tweak.
llvm-svn: 45940
2008-01-13 21:20:29 +00:00
Duncan Sands
08c728b519 Remove the assumption that byval has been applied to
a pointer to a struct.

llvm-svn: 45939
2008-01-13 21:19:59 +00:00
Duncan Sands
2796740ad6 Allow the byval attribute for pointers to any type with
a size, not just structs.

llvm-svn: 45938
2008-01-13 21:19:12 +00:00
Chris Lattner
5bc253c8f2 Fix PR1907, a nasty miscompilation because instcombine didn't
realize that ne & sgt  was a signed comparison (it was only 
looking at whether the left compare was signed).

llvm-svn: 45937
2008-01-13 20:59:02 +00:00
Duncan Sands
93ebe1df27 Check that nested functions don't get pointless
static chains.

llvm-svn: 45936
2008-01-13 18:44:12 +00:00
Steve Naroff
826e91ae04 Change Sema::CheckAddressOfOperation() to respect C99-only addressof rules.
Remove diagnostics from Sema::CheckIndirectionOperand(). C89/C99 allow dereferencing an incomplete type. clang appears to be emulating some incorrect gcc behavior (see below).

void
foo (void)
{
 struct b;
 struct b* x = 0;
 struct b* y = &*x; // gcc produces an error ("dereferencing pointer to incomplete type")
}

With this patch, the above is now allowed.

Bug/Patch by Eli Friedman!

llvm-svn: 45933
2008-01-13 17:10:08 +00:00
Duncan Sands
ff70c5de69 Small simplification.
llvm-svn: 45932
2008-01-13 08:12:17 +00:00
Duncan Sands
781f6549db When turning a call to a bitcast function into a direct call,
if this becomes a varargs call then deal correctly with any
parameter attributes on the newly vararg call arguments.

llvm-svn: 45931
2008-01-13 08:02:44 +00:00
Ted Kremenek
d122bbdb06 Moved destructor logic of templated class ExplodedGraph to non-templated
parent class ExplodedGraphImpl.

llvm-svn: 45930
2008-01-13 05:33:04 +00:00
Ted Kremenek
6d7aee6edd Added node cleanup to dstor of ExplodedGraph.
llvm-svn: 45929
2008-01-13 05:03:01 +00:00
Ted Kremenek
eb370bc386 Created ExplodedGraph.cpp and moved most method implementations of
ExplodedNodeImpl::NodeGroup from being defined inline to being defined
"out-of-line" in ExplodedGraph.cpp. This removes a dependence on including
<vector> in ExplodedGraph.h, and will hopefully result in smaller generated code
with negligible performance impact.

llvm-svn: 45928
2008-01-13 04:56:13 +00:00
Ted Kremenek
49bbee0b1d Moved 'ExplodedNodeGroup' into class 'ExplodedNode' as the nested class
'NodeGroup.'

llvm-svn: 45927
2008-01-13 04:20:10 +00:00
Ted Kremenek
39dfeadd93 Fixed lines preventing compilation.
llvm-svn: 45926
2008-01-13 04:18:40 +00:00
Ted Kremenek
2ae51a5d27 Now include "CFG.h" because the inline methods of "BlockEntrance" accessor
the methods of CFGBlock.

llvm-svn: 45925
2008-01-13 04:08:45 +00:00
Ted Kremenek
990d7d5205 Fixed some comments.
llvm-svn: 45924
2008-01-13 04:03:38 +00:00
Ted Kremenek
76245f3ed0 Removed ExplodedNode.h, since its contents are now in ExplodedGraph.h
llvm-svn: 45923
2008-01-13 04:00:44 +00:00
Ted Kremenek
8f13ec74c4 Merged ExplodedNode.h into ExplodedGraph.h, since the ExplodedNode class will
only be used in the context of the ExplodedGraph class.

llvm-svn: 45922
2008-01-13 04:00:16 +00:00
Ted Kremenek
cfe8235fa1 Changed implementation of successor and predecessor sets for ExplodedNode
to optimize for the common case of having a single predecessor and a single
successor.

llvm-svn: 45921
2008-01-13 03:55:50 +00:00
Chris Lattner
0d815f8f21 new testcase for rdar://5685492
llvm-svn: 45918
2008-01-13 00:19:57 +00:00
Chris Lattner
ca7faf6faa improve cygwin compatibility, patch by Sam Bishop
llvm-svn: 45917
2008-01-12 22:54:07 +00:00
Chris Lattner
0a8c2325fc allow __func__ in objc methods.
llvm-svn: 45915
2008-01-12 19:32:28 +00:00
Chris Lattner
afb514a7b4 clarify a note
llvm-svn: 45914
2008-01-12 18:58:46 +00:00
Evan Cheng
09dde6001d Add hasByValArgument() to test if a call instruction has byval argument(s).
llvm-svn: 45913
2008-01-12 18:57:32 +00:00
Chris Lattner
4f6c81ac68 we don't have to make an explicit copy of a byval argument when
inlining a function if we know that the function does not write
to *any* memory.  This implements test/Transforms/Inline/byval2.ll

llvm-svn: 45912
2008-01-12 18:54:29 +00:00
Evan Cheng
f755ff7be3 Indirect call with byval parameter requires a cast first.
llvm-svn: 45911
2008-01-12 18:53:07 +00:00
Chris Lattner
317e6ba07f Tighten up handling of __func__ and friends: it should be an array
of const char, and it should error if it occurs outside a function.

Is it valid in an objc method?  If so we should handle that too.

llvm-svn: 45910
2008-01-12 18:39:25 +00:00
Duncan Sands
0009c44464 Be more liberal in what parameter attributes are
allowed on the vararg arguments of a call.

llvm-svn: 45909
2008-01-12 16:42:01 +00:00
Chris Lattner
a81a0279cc Fix the type of predefined identifiers like __func__. Patch by
Eli Friedman!

llvm-svn: 45906
2008-01-12 08:14:25 +00:00
Chris Lattner
65531e8fb7 Fix a fixme, by only parsing extern "C" in C++ mode.
llvm-svn: 45905
2008-01-12 07:08:43 +00:00
Chris Lattner
38376f1595 Add first pieces of support for parsing and representing
extern "C" in C++ mode.  Patch by Mike Stump!

llvm-svn: 45904
2008-01-12 07:05:38 +00:00
Chris Lattner
22ad7abdfe Allow clients to specify the inline threshold when creating
the inliner pass.  Patch by Robert Zeh.

llvm-svn: 45903
2008-01-12 06:49:13 +00:00
Chris Lattner
459dc52df4 Add support for NetBSD, patch by Krister Walfridsson!
llvm-svn: 45902
2008-01-12 06:46:09 +00:00
Chris Lattner
177977ac19 When forming the squigly underline for a diagnostic, make sure to
verify that the source range corresponds to the current file, not
just the current line.  This allows us to emit:

a.c:1:44: error: invalid operands to binary expression ('double' and 'int *')
double a; int *b; void f(void) { int c = a +
                                         ~ ^

instead of:

a.c:1:44: error: invalid operands to binary expression ('double' and 'int *')
double a; int *b; void f(void) { int c = a +
~                                        ~ ^

for PR1906 (note the leading ~).

Thanks to Neil for noticing this.

llvm-svn: 45901
2008-01-12 06:43:35 +00:00
Evan Cheng
0395fd76cf Add -disable-lto optimization.
llvm-svn: 45900
2008-01-12 04:27:18 +00:00
Chris Lattner
ca2af72c7b this actually does pass with 4.0
llvm-svn: 45899
2008-01-12 01:45:22 +00:00
Evan Cheng
7411b510b2 Code clean up.
llvm-svn: 45898
2008-01-12 01:08:07 +00:00
Evan Cheng
02e78103ab ByVal arguments are passed on stack. Make sure to allocate a slot using size and alignment information on the parameter attribute.
llvm-svn: 45897
2008-01-12 01:07:41 +00:00
Chris Lattner
18df33d0c8 fix a wordo that gordon noticed :)
llvm-svn: 45896
2008-01-12 00:53:16 +00:00
Chris Lattner
6da61c2515 Any x86 instruction that reads from an invariant location is invariant.
This allows us to sink things like:
	cvtsi2sd	32(%esp), %xmm1
when reading from the argument area, for example.

llvm-svn: 45895
2008-01-12 00:35:08 +00:00
Chris Lattner
08af5a9dad implement support for sinking a load out the bottom of a block that
has no stores between the load and the end of block.  This works 
great and sinks hundreds of stores, but we can't turn it on because
machineinstrs don't have volatility information and we don't want to
sink volatile stores :(

llvm-svn: 45894
2008-01-12 00:17:41 +00:00
Chris Lattner
1f503ddab5 remove some incorrect classof's.
llvm-svn: 45893
2008-01-11 23:25:16 +00:00
Duncan Sands
5b721fc21d When DAE drops the varargs part of a function, ensure any
attributes on the vararg call arguments are also dropped.

llvm-svn: 45892
2008-01-11 23:13:45 +00:00
Evan Cheng
b51d228e79 More cbe byval fixes.
llvm-svn: 45891
2008-01-11 23:10:11 +00:00
Chris Lattner
5a3deb99b3 llvm-g++ 4.0 has completely different code for this warning,
just xfail it.

llvm-svn: 45890
2008-01-11 23:06:56 +00:00
Chris Lattner
031f5e1b8c new testcase
llvm-svn: 45888
2008-01-11 23:04:14 +00:00
Duncan Sands
b99f44aa5e Do not allow attributes beyond a function's last
parameter, even if it is a varargs function.  Do
allow attributes on the varargs part of a call,
but not beyond the last argument.  Only allow
selected attributes to be on the varargs part of
a call (currently only 'byval' is allowed).  The
reasoning here is that most attributes, eg inreg,
simply make no sense here.

llvm-svn: 45887
2008-01-11 22:36:48 +00:00
Chris Lattner
b5bd924e83 Teach argpromote to ruthlessly hack small byval structs when it can
get away with it, which exposes opportunities to eliminate the memory
objects entirely.  For example, we now compile byval.ll to:

define internal void @f1(i32 %b.0, i64 %b.1) {
entry:
	%tmp2 = add i32 %b.0, 1		; <i32> [#uses=0]
	ret void
}

define i32 @main() nounwind  {
entry:
	call void @f1( i32 1, i64 2 )
	ret i32 0
}

This seems like it would trigger a lot for code that passes around small
structs (e.g. SDOperand's or _Complex)...

llvm-svn: 45886
2008-01-11 22:31:41 +00:00
Duncan Sands
0ebaf91f48 Two occurrences on one line count as one...
llvm-svn: 45885
2008-01-11 21:46:24 +00:00
Duncan Sands
7e46c50c6a If there are attributes on the varargs part of a
call, don't discard them.

llvm-svn: 45884
2008-01-11 21:23:39 +00:00
Scott Michel
a8f67e04bd More CellSPU refinements:
- struct_2.ll: Completely unaligned load/store testing

- call_indirect.ll, struct_1.ll: Add test lines to exercise
   X-form [$reg($reg)] addressing

At this point, loads and stores should be under control (he says
in an optimistic tone of voice.)

llvm-svn: 45882
2008-01-11 21:01:19 +00:00
Dale Johannesen
04b99780cf Disable for now.
llvm-svn: 45881
2008-01-11 20:47:33 +00:00
Ted Kremenek
8d71e25590 Fix misspelling of "existent".
Do not use std::cerr; use llvm::cerr instead.

Patch provided by Sam Bishop!

llvm-svn: 45880
2008-01-11 20:42:05 +00:00
Chris Lattner
b66fbdde42 Use smallptrset instead of std::set for efficiency.
llvm-svn: 45878
2008-01-11 19:36:30 +00:00
Chris Lattner
4a70261f00 a byval argument is guaranteed to be valid to load.
llvm-svn: 45877
2008-01-11 19:34:32 +00:00
Chris Lattner
4062a625e5 Update this code to use eraseFromParent where possible. Compute
whether an argument is byval and pass into isSafeToPromoteArgument.

llvm-svn: 45876
2008-01-11 19:20:39 +00:00
Chris Lattner
e736e55d3c replace a loop with a constant time check.
llvm-svn: 45875
2008-01-11 18:55:10 +00:00
Chris Lattner
669e7054ca another minor datastructure tweak.
llvm-svn: 45874
2008-01-11 18:47:45 +00:00
Chris Lattner
a8ba28f6e4 start using smallvector to avoid vector heap thrashing.
llvm-svn: 45873
2008-01-11 18:43:58 +00:00
Chris Lattner
c70ed4ba5b add operator==/!= to smallvector.
llvm-svn: 45872
2008-01-11 18:42:02 +00:00
Chris Lattner
596875118c rename MachineInstr::setInstrDescriptor -> setDesc
llvm-svn: 45871
2008-01-11 18:10:50 +00:00
Chris Lattner
806dd0e2ac remove xchg and shift-reg-by-1 instructions, which are dead.
llvm-svn: 45870
2008-01-11 18:00:50 +00:00
Chris Lattner
ff5998e66b add a note, remove a done deed.
llvm-svn: 45869
2008-01-11 18:00:13 +00:00
Arnold Schwaighofer
06da9e2d43 hrm - correct spelling.
Actually were not riding any arguments. Sadly there is no semantic spell checker that is going to safe you from such a mistake.

llvm-svn: 45868
2008-01-11 17:10:15 +00:00
Arnold Schwaighofer
6cf72fbbaf Improve tail call optimized call's argument lowering. Before this
commit all arguments where moved to the stack slot where they would
reside on a normal function call before the lowering to the tail call
stack slot. This was done to prevent arguments overwriting each other.
Now only arguments sourcing from a FORMAL_ARGUMENTS node or a
CopyFromReg node with virtual register (could also be a caller's
argument) are lowered indirectly.

 --This line, and those below, will be ignored--

M    X86/X86ISelLowering.cpp
M    X86/README.txt

llvm-svn: 45867
2008-01-11 16:49:42 +00:00
Ted Kremenek
5906b9e79a Added ProgramPoint.cpp, which implements several methods of the subclasses
of ProgramPoint.

llvm-svn: 45866
2008-01-11 16:36:20 +00:00
Arnold Schwaighofer
bf1816ea7b Correct a copy and paste error.
llvm-svn: 45865
2008-01-11 14:34:56 +00:00
Evan Cheng
ef5285ef88 Some C backend ByVal parameter attribute support. Not yet complete.
llvm-svn: 45864
2008-01-11 09:12:49 +00:00
Evan Cheng
8c51394e01 Rename Int_CVTSI642SSr* to Int_CVTSI2SS64r* for naming consistency and remove unused instructions.
llvm-svn: 45861
2008-01-11 07:37:44 +00:00
Chris Lattner
9283173061 more flags set right
llvm-svn: 45860
2008-01-11 07:18:17 +00:00
Chris Lattner
f4b0c99d63 add some missing flags.
llvm-svn: 45859
2008-01-11 06:59:07 +00:00
Chris Lattner
6d7cf509d1 don't include loopinfo.h from this file.
llvm-svn: 45858
2008-01-11 06:30:04 +00:00
Chris Lattner
b3220147d2 Move typedef of loop to top of the file where it is more obvious.
llvm-svn: 45857
2008-01-11 06:29:42 +00:00
Chris Lattner
b97b83fbf7 Fix 80 col violations
llvm-svn: 45856
2008-01-11 06:27:42 +00:00
Chris Lattner
5cee13f1df document the byval parameter attribute.
llvm-svn: 45855
2008-01-11 06:20:47 +00:00
Chris Lattner
87b0c13104 add some notes.
llvm-svn: 45854
2008-01-11 06:17:47 +00:00
Chris Lattner
908117bf69 When inlining a functino with a byval argument, make an explicit
copy of it in case the callee modifies the struct.

llvm-svn: 45853
2008-01-11 06:09:30 +00:00
Evan Cheng
aaef8ce856 A couple of obvious off-by-one bugs.
llvm-svn: 45852
2008-01-11 03:07:46 +00:00
Scott Michel
8d5841ae3c More CellSPU refinement and progress:
- Cleaned up custom load/store logic, common code is now shared [see note
  below], cleaned up address modes

- More test cases: various intrinsics, structure element access (load/store
  test), updated target data strings, indirect function calls.

Note: This patch contains a refactoring of the LoadSDNode and StoreSDNode
structures: they now share a common base class, LSBaseSDNode, that
provides an interface to their common functionality. There is some hackery
to access the proper operand depending on the derived class; otherwise,
to do a proper job would require finding and rearranging the SDOperands
sent to StoreSDNode's constructor. The current refactor errs on the
side of being conservatively and backwardly compatible while providing
functionality that reduces redundant code for targets where loads and
stores are custom-lowered.

llvm-svn: 45851
2008-01-11 02:53:15 +00:00
Evan Cheng
4cc275c3fb Allow parameter attributes on varargs function parameters.
llvm-svn: 45850
2008-01-11 02:13:09 +00:00
Dale Johannesen
193daf0698 Weak zeroes don't go in bss on Darwin.
llvm-svn: 45849
2008-01-11 01:59:45 +00:00
Dale Johannesen
2ff66f08f2 Weak things initialized to 0 don't go in bss on Darwin.
Cosmetic changes to spacing to match gcc (some dejagnu
tests actually care).

llvm-svn: 45848
2008-01-11 00:54:37 +00:00
Ted Kremenek
b1dec454bb Renamed ProgramEdge.h to ProgramPoint.h
llvm-svn: 45847
2008-01-11 00:43:12 +00:00
Ted Kremenek
e5ccf9a96c Renamed ProgramEdge to ProgramPoint and changed subclasses of ProgramEdge
to have a much simpler, cleaner interpretation of what is a "location"
in a function (as encoded by a CFG).

llvm-svn: 45846
2008-01-11 00:40:29 +00:00
Ted Kremenek
d7a7abed62 Fixed 80-col violation.
llvm-svn: 45845
2008-01-11 00:18:40 +00:00
Chris Lattner
c8226f32e9 Simplify the side effect stuff a bit more and make licm/sinking
both work right according to the new flags.

This removes the TII::isReallySideEffectFree predicate, and adds
TII::isInvariantLoad. 

It removes NeverHasSideEffects+MayHaveSideEffects and adds
UnmodeledSideEffects as machine instr flags.  Now the clients
can decide everything they need.

I think isRematerializable can be implemented in terms of the
flags we have now, though I will let others tackle that.

llvm-svn: 45843
2008-01-10 23:08:24 +00:00
Fariborz Jahanian
af5d80cba5 Avoid redefinition of __objcFastEnumerationState
llvm-svn: 45842
2008-01-10 23:04:06 +00:00
Chris Lattner
f3bd2cd37c Clamp down on sinking of lots of instructions.
llvm-svn: 45841
2008-01-10 22:35:15 +00:00
Steve Naroff
98f7203680 - Teach Expr::isConstantExpr() about InitListExpr's (and offsetof, since I noticed it was missing).
- Rename CheckInitializer() to CheckInitializerTypes().
- Removed the isStatic argument to CheckInitializerTypes() and all of it's subroutines. Checking for constant expressions is now done separately.
- Added CheckForConstantInitializer().

llvm-svn: 45840
2008-01-10 22:15:12 +00:00
Fariborz Jahanian
939776756f Recover from user typo not having proper @interface decl and a bad foreach decl.
llvm-svn: 45839
2008-01-10 20:33:58 +00:00
Chris Lattner
8e60f2c996 IMPLICIT_USE and IMPLICIT_DEF are dead, remove them.
llvm-svn: 45838
2008-01-10 19:27:54 +00:00
Chris Lattner
1d07b65add add a note
llvm-svn: 45837
2008-01-10 18:25:41 +00:00
Fariborz Jahanian
2de9a0be09 Remove non-ascii chaaracter from diagnostic
llvm-svn: 45836
2008-01-10 18:10:31 +00:00
Ted Kremenek
e67952fcd9 Fixed non-ASCII quote.
llvm-svn: 45835
2008-01-10 18:08:55 +00:00
Fariborz Jahanian
c644ee4992 Warn (as gcc does) when @end does not close anything.
llvm-svn: 45834
2008-01-10 17:58:07 +00:00
Duncan Sands
53c954fa86 Output sinl for a long double FSIN node, not sin.
Likewise fix up a bunch of other libcalls.  While
there I remove NEG_F32 and NEG_F64 since they are
not used anywhere.  This fixes 9 Ada ACATS failures.

llvm-svn: 45833
2008-01-10 10:28:30 +00:00
Evan Cheng
f2553ab84f Only remat loads from immutable stack slots.
llvm-svn: 45831
2008-01-10 08:24:38 +00:00
Evan Cheng
8b03bafd37 Simplify some code.
llvm-svn: 45830
2008-01-10 08:22:10 +00:00
Chris Lattner
317332fc2a Start inferring side effect information more aggressively, and fix many bugs in the
x86 backend where instructions were not marked maystore/mayload, and perf issues where
instructions were not marked neverHasSideEffects.  It would be really nice if we could
write patterns for copy instructions.

I have audited all the x86 instructions down to MOVDQAmr.  The flags on others and on
other targets are probably not right in all cases, but no clients currently use this
info that are enabled by default.

llvm-svn: 45829
2008-01-10 07:59:24 +00:00
Evan Cheng
4c1f731905 Clearify the meaning of immutable StackObject.
llvm-svn: 45828
2008-01-10 07:19:43 +00:00
Chris Lattner
70ddafaf45 Fix a crash on code like: let x = 1 {x
llvm-svn: 45827
2008-01-10 07:01:53 +00:00
Chris Lattner
2e38f2458c rename X86InstrX86-64.td -> X86Instr64bit.td
llvm-svn: 45826
2008-01-10 05:50:42 +00:00
Chris Lattner
520d4adad3 add SDNPSideEffect node property declaration
llvm-svn: 45825
2008-01-10 05:48:23 +00:00
Chris Lattner
aca7ca3730 remove explicit sets of 'neverHasSideEffects' that can now be
inferred from the instr patterns.

llvm-svn: 45824
2008-01-10 05:45:39 +00:00
Chris Lattner
86c458a178 if an instr lacks a pattern, assume it has side effects (unless never has s-e is true).
llvm-svn: 45823
2008-01-10 05:40:54 +00:00
Chris Lattner
42c63ef96e start inferring 'no side effects'.
llvm-svn: 45822
2008-01-10 05:39:30 +00:00
Chris Lattner
94de7bc3aa get def use info more correct.
llvm-svn: 45821
2008-01-10 05:12:37 +00:00
Ted Kremenek
aa8c904dfc Added some text about the ccc script provided by Sanghyeon Seo.
llvm-svn: 45820
2008-01-10 04:59:05 +00:00
Chris Lattner
9e69654461 Infer mayload
llvm-svn: 45819
2008-01-10 04:44:48 +00:00
Chris Lattner
c72335878d add SDNPMayLoad to the 'load' sdnode definition. This is enough to get all the x86
instructions (with patterns) that load memory marked, for example.

llvm-svn: 45818
2008-01-10 04:44:32 +00:00
Chris Lattner
1ca2068227 realize that instructions who match intrinsics that read memory read memory.
Also, instructions with any nodes that are SDNPMayLoad also read memory.

llvm-svn: 45817
2008-01-10 04:38:57 +00:00
Chris Lattner
f171482a66 verify that the frame index is immutable before remat'ing (still disabled)
or being side-effect free.

llvm-svn: 45816
2008-01-10 04:16:31 +00:00
Owen Anderson
d445b8813f Don't use LiveVariables::VarInfo::DefInst.
llvm-svn: 45815
2008-01-10 03:12:54 +00:00
Evan Cheng
0f8c7c4a73 Codegen improvement has reduced one spill.
llvm-svn: 45814
2008-01-10 02:54:40 +00:00
Evan Cheng
a26552493b Mark byval parameter stack objects mutable for now.
llvm-svn: 45813
2008-01-10 02:24:25 +00:00
Evan Cheng
301b0cade5 Add a isImmutable bit to StackObject. Fixed stack objects are immutable (in the function) unless specified otherwise.
llvm-svn: 45812
2008-01-10 02:18:37 +00:00
Dale Johannesen
7ecb3b79c7 Emit unused EH frames for weak definitions on Darwin,
because assembler/linker can't cope with weak absolutes.
PR 1880.

llvm-svn: 45811
2008-01-10 02:03:30 +00:00
Chris Lattner
2cbf2f39ee add support for the GCC -include option.
llvm-svn: 45810
2008-01-10 01:53:41 +00:00
Seo Sanghyeon
77133e6d30 Compiler driver
llvm-svn: 45809
2008-01-10 01:43:47 +00:00
Chris Lattner
bceeefdc9c Fix some 80 col violations
llvm-svn: 45808
2008-01-10 01:43:14 +00:00
Chris Lattner
d2cdb97747 Ted apparently likes crazy whitespace at the end of line. Crush his spirit by
removing them, fitting the file into 80 columns. :)

llvm-svn: 45807
2008-01-10 01:41:55 +00:00
Fariborz Jahanian
7262fca0a6 Put return type of synthesize method on same line as method declaration, space after method declaration header.
llvm-svn: 45806
2008-01-10 01:39:52 +00:00
Owen Anderson
4f45cef2f9 Get rid of all uses of LiveVariables::VarInfo::DefInst in favor of the equivalent API from
MachineRegisterInfo.  Once all clients are switched over, the former will be going away.

llvm-svn: 45805
2008-01-10 01:36:43 +00:00
Chris Lattner
cb0e1bcf0c provide def_* and use_* iterators in addition to reg_* iterators.
The first only returns definitions of a register, the second only
returns uses, the third returns both.

llvm-svn: 45803
2008-01-10 01:01:27 +00:00
Ted Kremenek
3d55c84c99 Added "InfeasibleEdge" to represent an infeasible state transition.
llvm-svn: 45802
2008-01-10 00:58:25 +00:00
Owen Anderson
51b8e20ccf Add more comments explaining the basics of how the decision of when to rename and when to insert
copies is made.

llvm-svn: 45799
2008-01-10 00:47:01 +00:00
Evan Cheng
fead113fe0 Do not use the stack pointer directly, issue a copyfromreg instead. Otherwise we can end up with something like ADD32ri %esp, x which two-address pass won't like.
llvm-svn: 45798
2008-01-10 00:37:26 +00:00
Owen Anderson
8958a78576 Get rid of the isKillInst predicate. LiveVariables already provides this information.
llvm-svn: 45797
2008-01-10 00:33:11 +00:00
Chris Lattner
ec79bba97f Fix PR1845 and rdar://5676945. Generic vectors smaller
than hardware supported type will be scalarized, so we
can infer their alignment from that info.

We now codegen pr1845 into:

_boolVectorSelect:
	lbz r2, 0(r3)
	stb r2, -16(r1)
	blr 

llvm-svn: 45796
2008-01-10 00:30:57 +00:00
Chris Lattner
e34d7d0e24 new testcase for PR1845
llvm-svn: 45795
2008-01-10 00:30:38 +00:00
Fariborz Jahanian
db701b47d2 Pass rewritten output to 'clang' for verification.
llvm-svn: 45794
2008-01-10 00:30:24 +00:00
Fariborz Jahanian
82ae0152a7 Allow messaging expression as foreach's collection expression.
llvm-svn: 45793
2008-01-10 00:24:29 +00:00
Evan Cheng
73d1017871 Remove comments that do not correspond to anything after recent refactoring.
llvm-svn: 45792
2008-01-10 00:09:10 +00:00
Owen Anderson
1c8152ba03 Copies need to be inserted before the first terminator, not at the end of the block.
llvm-svn: 45791
2008-01-10 00:01:41 +00:00
Steve Naroff
a385fb8c2e Add a FIXME to commit r45784. Thanks mrs!
llvm-svn: 45790
2008-01-09 23:44:05 +00:00
Steve Naroff
e6b0ec8b5e Fix Sema::ActOnDeclarator() to call MergeFunctionDecl for function decls that aren't in scope. Since C functions are in a flat namespace, we need to give them special treatment (when compared with variables and typedefs).
llvm-svn: 45789
2008-01-09 23:34:55 +00:00
Ted Kremenek
24ea11d4e0 Renamed various traits and classes. Added "Infeasible" bit to ExplodedNodeImpl
so that nodes can be marked as representing an infeasible program point. This
flag lets the path-sensitive solver know that no successors should be generated
for such nodes.

llvm-svn: 45788
2008-01-09 23:11:36 +00:00
Evan Cheng
0e400d4cb7 Special copy SUnit's do not have SDNode's.
llvm-svn: 45787
2008-01-09 23:01:55 +00:00
Ted Kremenek
84ab850e46 Renamed Stmt***Edge and ***StmtEdge (where *** = "Stmt" or "Blk") classes to
BExpr*** and ***BExpr respectively. These edges represent program locations
between the entrance/exit of a block and Block-level Expressions.

Also added ***SExpr and SExpr*** ProgramEdges to represent the locations in the
program between the evaluation of subexpressions and block-level expressions.

llvm-svn: 45786
2008-01-09 22:52:38 +00:00
Ted Kremenek
fed4cce0cc Removed some files related to the path-sensitive solver as part of some
code restructuring.  (new files will be introduced shortly)

llvm-svn: 45785
2008-01-09 22:49:37 +00:00
Steve Naroff
c6edcbdb5d Fix ASTContext::typesAreCompatible to allow for int/enum compatibility (C99 6.7.2.2p4).
Fix Sema::MergeFunctionDecl to allow for function type compatibility (by using the predicate on ASTContext). Function types don't have to be identical to be compatible...

llvm-svn: 45784
2008-01-09 22:43:08 +00:00
Owen Anderson
436db42a3c Clean up StrongPHIElimination a bit, and add some more comments to the internal structures. There's
still more work to do on this front.

llvm-svn: 45783
2008-01-09 22:40:54 +00:00
Steve Naroff
08ddb8c55c Teach Sema::ActOnCompoundLiteral about constraint C99 6.5.2.5p3.
llvm-svn: 45782
2008-01-09 20:58:06 +00:00
Duncan Sands
48f22f0b80 Fix compile failures with g++-4.3.
llvm-svn: 45781
2008-01-09 19:42:09 +00:00
Chris Lattner
204e4a27b6 many cleanups and fixed, contributed by Sam Bishop
llvm-svn: 45780
2008-01-09 19:28:50 +00:00
Chris Lattner
119d81a4f4 Fix isIntegerConstantExpr to compare against zero for casts to bool instead of
truncating.  This allows us to compile:
 void foo() {
  static _Bool foo = 4;
}

into:
@foo1 = internal global i8 1
instead of:
@foo1 = internal global i8 4

llvm-svn: 45779
2008-01-09 18:59:34 +00:00
Chris Lattner
41a1ef0dfe implement proper support for _Bool in memory, which is usually i8, not i1.
This fixes a crash reported by Seo Sanghyeon

llvm-svn: 45778
2008-01-09 18:47:25 +00:00
Fariborz Jahanian
6fa7516bc9 Type-cast RHS of assignment to prevent warning compiling rewritten foreach code.
llvm-svn: 45777
2008-01-09 18:15:42 +00:00
Fariborz Jahanian
22f2347791 Fixed a bug whereby a parethesized collection expression was not being rewritten correctly.
llvm-svn: 45776
2008-01-09 17:50:00 +00:00
Owen Anderson
4de0c3978d StrongPHIElim: Now with even fewer trivial bugs!
llvm-svn: 45775
2008-01-09 10:41:39 +00:00
Owen Anderson
77c3fe441b Fix an infinite recursion bug in InsertCopies.
llvm-svn: 45774
2008-01-09 10:32:30 +00:00
Owen Anderson
e0fd9bd35a Fix some simple bugs. StrongPHIElimination now does not crash on 164.gzip.
llvm-svn: 45773
2008-01-09 06:19:05 +00:00
Evan Cheng
a31824a08e Fix sse2.psrl.w and sse2.psrl.q definitions.
llvm-svn: 45772
2008-01-09 02:16:44 +00:00
Fariborz Jahanian
b7e7ee9ff3 Typo fixed.
llvm-svn: 45771
2008-01-09 01:25:54 +00:00
Chris Lattner
7ff4a8bf3f Fix llvm-ld -Xlinker, patch by Daniel Teske!
llvm-svn: 45770
2008-01-09 01:01:17 +00:00
Fariborz Jahanian
05d2876ec3 Another test case for testing rewriteing of nested foreach-statement.
llvm-svn: 45769
2008-01-09 00:47:02 +00:00
Chris Lattner
9129f51f9b add a testcase
llvm-svn: 45768
2008-01-09 00:37:18 +00:00
Fariborz Jahanian
a305a5609e Remove dependency on objc.h
llvm-svn: 45767
2008-01-09 00:33:05 +00:00
Chris Lattner
45e5032b1d add a note
llvm-svn: 45766
2008-01-09 00:17:57 +00:00
Steve Naroff
66a26044f8 Teach Expr::isConstantExpr() about CompoundLiterals.
llvm-svn: 45764
2008-01-09 00:05:37 +00:00
Chris Lattner
82bebb2432 Fix a typo, patch by Mike Stump!
llvm-svn: 45763
2008-01-09 00:00:15 +00:00
Chris Lattner
51b01bf8a5 Make load->store deletion a bit smarter. This allows us to compile this:
void test(long long *P) { *P ^= 1; }

into just:

_test:
	movl	4(%esp), %eax
	xorl	$1, (%eax)
	ret

instead of code like this:

_test:
	movl	4(%esp), %ecx
        xorl    $1, (%ecx)
	movl	4(%ecx), %edx
	movl	%edx, 4(%ecx)
	ret

llvm-svn: 45762
2008-01-08 23:08:06 +00:00
Fariborz Jahanian
965a8961c7 Patch to rewrite ObjC2's foreach-stmt.
llvm-svn: 45760
2008-01-08 22:06:28 +00:00
Owen Anderson
1b0d5c747e Rename registers that do not need copies.
llvm-svn: 45759
2008-01-08 21:54:52 +00:00
Duncan Sands
7b1460cca4 Crashes llc when using Chris's new legalization logic.
llvm-svn: 45758
2008-01-08 21:51:53 +00:00
Ted Kremenek
a0a2881b1e Added "getRoot()" to ImmutableMap.
Made the ctor for ImmutableMap to construct a map from an AVL tree public.

llvm-svn: 45756
2008-01-08 21:05:59 +00:00
Ted Kremenek
9b0f70bb85 Fixed 80 col. violation.
llvm-svn: 45752
2008-01-08 19:38:55 +00:00
Ted Kremenek
96b1ce4f0a Added VISIBILITY_HIDDEN to classes/structs in anonymous namespaces.
llvm-svn: 45750
2008-01-08 18:19:08 +00:00
Ted Kremenek
83ebcef8ae Added VISIBILITY_HIDDEN to classes/structs in anonymous namespace.
llvm-svn: 45749
2008-01-08 18:15:10 +00:00
Chris Lattner
07fde9bde1 add a mayLoad property for machine instructions, a correlary to mayStore.
This is currently not set by anything.

llvm-svn: 45748
2008-01-08 18:05:21 +00:00
Ted Kremenek
7e41c29a86 Added most of the boilerplate to the driver needed to run the graph-reachability
constant propagation analysis.

llvm-svn: 45747
2008-01-08 18:04:06 +00:00
Duncan Sands
bb956ca730 Use size_t to store Pos, avoid truncating value
on 64-bit builds.  Analysis and original patch
by Török Edwin.  Code audit found another place
with the same problem, also fixed here.

llvm-svn: 45746
2008-01-08 10:06:15 +00:00
Chris Lattner
2940c5c56d Implement PR1795, an instcombine hack for forming GEPs with integer pointer arithmetic.
llvm-svn: 45745
2008-01-08 07:23:51 +00:00
Chris Lattner
ff71ec4dfb add match support for casts.
llvm-svn: 45744
2008-01-08 07:02:44 +00:00
Chris Lattner
b17db3afa8 remove darwin/i386 t-t
llvm-svn: 45743
2008-01-08 06:52:51 +00:00
Chris Lattner
89f36e6b21 Finally implement correct ordered comparisons for PPC, even though
the code generated is not wonderful.  This turns a miscompilation into
a code quality bug (noted in the ppc readme).  This fixes PR642, which
is over 2 years old (!).  Nate, please review this.

llvm-svn: 45742
2008-01-08 06:46:30 +00:00
Chris Lattner
184f79a5e1 Testcase for PR1721
llvm-svn: 45739
2008-01-08 05:16:29 +00:00
Owen Anderson
812e1ea7cf Actually insert copies now!
llvm-svn: 45738
2008-01-08 05:16:15 +00:00
Chris Lattner
97879424fe Fix PR1797
llvm-svn: 45736
2008-01-08 04:26:20 +00:00
Chris Lattner
e3e358c317 readability improvement suggested by Sam Bishop, thanks!
llvm-svn: 45735
2008-01-08 04:13:21 +00:00
Evan Cheng
00300ddff1 Minor fix to enable x86-64 pic jit (still fails for other reasons).
llvm-svn: 45734
2008-01-08 02:07:10 +00:00
Evan Cheng
4951da49aa Fix a x86-64 static codegen bug. This fixes a lot of x86-64 jit failures.
llvm-svn: 45733
2008-01-08 02:06:11 +00:00
Steve Naroff
039ad3cf90 Fix Sema::CheckConditionalOperands(). The null pointer constant checks need to precede the check for two pointer operands.
llvm-svn: 45732
2008-01-08 01:11:38 +00:00
Bill Wendling
3b6fe5fa8d Silence warning about loss of precision.
llvm-svn: 45731
2008-01-08 00:52:29 +00:00
Ted Kremenek
9384343c11 Added nodes_iterator to the GraphTrait for ExplodedNode<>.
llvm-svn: 45730
2008-01-08 00:46:00 +00:00
Ted Kremenek
a3da232ce7 Added GraphTraits<> partial specializations for ExplodedNode<> classes.
llvm-svn: 45729
2008-01-08 00:26:05 +00:00
Ted Kremenek
551e4ce74e Relocated comment in header.
llvm-svn: 45728
2008-01-08 00:07:06 +00:00
Evan Cheng
7250120177 Only mark instructions that load a single value without extension as isSimpleLoad = 1.
llvm-svn: 45727
2008-01-07 23:56:57 +00:00
Chris Lattner
ba734518c1 add a new bit.
llvm-svn: 45726
2008-01-07 23:16:55 +00:00
Evan Cheng
8242168ef4 Unbreak x86-64.
llvm-svn: 45725
2008-01-07 23:08:23 +00:00
Ted Kremenek
35ff5b0ee6 Added more boilerplate for processing end-of-paths.
llvm-svn: 45724
2008-01-07 22:22:13 +00:00
Chris Lattner
ef81aa75f6 add a note that is important for some fp apps.
llvm-svn: 45723
2008-01-07 21:59:58 +00:00
Ted Kremenek
8569309bca Added ownership of "checker state" within the ExplodedGraph. Moved code that
creates the initial root node from the constructor of ReachabilityEngine to
ReachabilityEngine::ExecuteWorklist.

llvm-svn: 45722
2008-01-07 21:56:52 +00:00
Fariborz Jahanian
dc917b9e07 Patch to start rewriting of ObjC2's foreach statement (work in progress).
llvm-svn: 45721
2008-01-07 21:40:22 +00:00
Chris Lattner
730d088be1 possible switch lowering improvement.
llvm-svn: 45720
2008-01-07 21:38:14 +00:00
Owen Anderson
47299489ec Oops, missed one.
llvm-svn: 45719
2008-01-07 21:32:09 +00:00
Owen Anderson
bbc6352d1f Make some predicates static.
llvm-svn: 45718
2008-01-07 21:30:40 +00:00
Fariborz Jahanian
6917870be5 Verify/add code to make sure types passed to interfaceTypesAreCompatible
are canonical. Asst in interfaceTypesAreCompatible if they are not.

llvm-svn: 45717
2008-01-07 20:12:21 +00:00
Chris Lattner
a30be59fa2 Fix a nasty corner case that Neil noticed in PR1900, where we would
incorrectly apply the multiple include optimization to files with 
guards like:

#if !defined(x) MACRO

where MACRO could expand to different things in different contexts.
Thanks Neil!

llvm-svn: 45716
2008-01-07 19:50:27 +00:00
Ted Kremenek
1b0ea82459 Substituted all instances of the string "Objc" for "ObjC". This fixes
some naming inconsistencies in the names of classes pertaining to Objective-C
support in clang.

llvm-svn: 45715
2008-01-07 19:49:32 +00:00
Duncan Sands
c50c210d76 I doubt the address of the Error string was intended
to be used for the force_interpreter parameter...
Spotted by gcc-4.2.

llvm-svn: 45714
2008-01-07 19:14:42 +00:00
Fariborz Jahanian
699e638e4f Make interfaceTypesAreCompatible a private method.
llvm-svn: 45713
2008-01-07 19:13:39 +00:00
Duncan Sands
d19a6f4836 Add missing newline at EOF.
llvm-svn: 45712
2008-01-07 19:13:36 +00:00
Ted Kremenek
9dbf8a93a7 Renamed SimulVertex, SimulGraph, and SimulEngine to:
ExplodedNode, ExplodedGraph  (to match the vocabulary in the RHS paper)
  ReachabilityEngine
  
The implementation of the core of the path-sensitive dataflow solver has
been de-templatized and places in ReachabilityEngine.cpp.

The solver is still incomplete.

llvm-svn: 45711
2008-01-07 19:08:42 +00:00
Ted Kremenek
dabea046f6 Minor tweak to serialization of ObjcForCollectionStmt: the three owned pointers
are now emitted in a batch, which reduces the metadata overhead in the
serialized bitcode.

llvm-svn: 45710
2008-01-07 18:35:04 +00:00
Fariborz Jahanian
d5450b7f07 Limit type of foreach's element and collection to be a pointer to
objc object type.

llvm-svn: 45709
2008-01-07 18:14:04 +00:00
Fariborz Jahanian
fef287cb67 Issue diagnostics if more than one declaration in objectove-c's foreach-stmt header.
llvm-svn: 45708
2008-01-07 17:52:35 +00:00
Nate Begeman
281653b25e Update the comment on scalar to vector to be a bit more clear.
llvm-svn: 45707
2008-01-07 17:52:24 +00:00
Chris Lattner
f5c973d061 minor cleanup.
llvm-svn: 45706
2008-01-07 17:51:46 +00:00
Nate Begeman
d3d49df3f1 Update test to catch recent x86 insert regression and improvements
llvm-svn: 45705
2008-01-07 17:49:23 +00:00
Duncan Sands
b18c30acec Small cleanup for handling of type/parameter attribute
incompatibility.

llvm-svn: 45704
2008-01-07 17:16:06 +00:00
Duncan Sands
d8d4170f84 Unbreak x86-32 darwin long double!
llvm-svn: 45703
2008-01-07 16:36:38 +00:00
Duncan Sands
28bf7ac219 Fix long double support on x86-32 linux.
llvm-svn: 45701
2008-01-07 13:44:22 +00:00
Gordon Henriksen
24db8d383d Pruning includes.
llvm-svn: 45700
2008-01-07 13:30:38 +00:00
Bill Wendling
a3bdad153f Operand 1 should be a register. We don't care if it's a preg, vreg, or 0.
llvm-svn: 45699
2008-01-07 08:05:29 +00:00
Chris Lattner
d7857eafd0 add a note
llvm-svn: 45698
2008-01-07 07:46:23 +00:00
Chris Lattner
f3efadcb5b remove #includage
llvm-svn: 45697
2008-01-07 07:42:25 +00:00
Chris Lattner
69fc766f63 split TargetInstrDesc out into its own header file.
llvm-svn: 45696
2008-01-07 07:33:08 +00:00
Chris Lattner
03ad885039 rename TargetInstrDescriptor -> TargetInstrDesc.
Make MachineInstr::getDesc return a reference instead
of a pointer, since it can never be null.

llvm-svn: 45695
2008-01-07 07:27:27 +00:00
Chris Lattner
3ef160b15a remove a dead method.
llvm-svn: 45694
2008-01-07 06:47:10 +00:00
Chris Lattner
fd2e338b85 simplify some code.
llvm-svn: 45693
2008-01-07 06:47:00 +00:00
Chris Lattner
e99a6caee4 Rename all the M_* flags to be namespace qualified enums, and switch
all clients over to using predicates instead of these flags directly.
These are now private values which are only to be used to statically
initialize the tables.

llvm-svn: 45692
2008-01-07 06:42:05 +00:00
Chris Lattner
d004f54155 use predicate.
llvm-svn: 45691
2008-01-07 06:37:29 +00:00
Chris Lattner
08a69ac2f5 add more and significantly better comments to the rest of the machineinstr
flags that can be set.  Add predicates for the ones lacking it, and switch
some clients over to using the predicates instead of Flags directly.

llvm-svn: 45690
2008-01-07 06:21:53 +00:00
Chris Lattner
769c86bf63 simplify some code using new predicates
llvm-svn: 45689
2008-01-07 05:40:58 +00:00
Chris Lattner
c5c63ff9d7 add some mroe comments, add a isImplicitDef() method, add
isConditionalBranch() and isUnconditionalBranch() methods.

llvm-svn: 45688
2008-01-07 05:38:38 +00:00
Chris Lattner
f376c99ea0 rename hasVariableOperands() -> isVariadic(). Add some comments.
Evan, please review the comments I added to getNumDefs to make sure
that they are accurate, thx.

llvm-svn: 45687
2008-01-07 05:19:29 +00:00
Chris Lattner
fd548c96cc Move M_* flags down in the file. Move SchedClass up in the
TargetInstrDescriptor class and shrink to 16-bits, saving a 
word in TargetInstrDescriptor.  Add some comments.

llvm-svn: 45686
2008-01-07 05:06:49 +00:00
Chris Lattner
8c69898157 remove a dead field.
llvm-svn: 45685
2008-01-07 04:57:42 +00:00
Chris Lattner
6f8713decb the name field of instructions is never set to a non-empty string,
just unconditionally use the def name of the instruction.

llvm-svn: 45684
2008-01-07 04:57:31 +00:00
Chris Lattner
6077962101 no need to explicitly clear these fields.
llvm-svn: 45683
2008-01-07 04:55:09 +00:00
Nate Begeman
f7c3ff6f80 Fix typo
llvm-svn: 45682
2008-01-07 04:01:26 +00:00
Gordon Henriksen
c75405bdb3 Removing a leaked file.
llvm-svn: 45681
2008-01-07 03:23:52 +00:00
Chris Lattner
b0d06b4381 Move a bunch more accessors from TargetInstrInfo to TargetInstrDescriptor
llvm-svn: 45680
2008-01-07 03:13:06 +00:00
Chris Lattner
f0f438a517 remove MachineOpCode typedef.
llvm-svn: 45679
2008-01-07 02:48:55 +00:00
Chris Lattner
d34c47653e remove some uses of MachineOpCode, move getSchedClass
into TargetInstrDescriptor from TargetInstrInfo.

llvm-svn: 45678
2008-01-07 02:46:03 +00:00
Chris Lattner
e55e115616 Add predicates methods to TargetOperandInfo, and switch all clients
over to using them, instead of diddling Flags directly.  Change the
various flags from const variables to enums.

llvm-svn: 45677
2008-01-07 02:39:19 +00:00
Gordon Henriksen
c7e991b7c3 Setting GlobalDirective in TargetAsmInfo by default rather than
providing a misleading facility. It's used once in the MIPS backend
and hardcoded as "\t.globl\t" everywhere else.

llvm-svn: 45676
2008-01-07 02:31:11 +00:00
Gordon Henriksen
efb08802ec Deleting an empty file. Thanks, /usr/bin/patch!
llvm-svn: 45675
2008-01-07 02:29:04 +00:00
Chris Lattner
a98c679de0 Rename MachineInstr::getInstrDescriptor -> getDesc(), which reflects
that it is cheap and efficient to get.

Move a variety of predicates from TargetInstrInfo into 
TargetInstrDescriptor, which makes it much easier to query a predicate
when you don't have TII around.  Now you can use MI->getDesc()->isBranch()
instead of going through TII, and this is much more efficient anyway. Not
all of the predicates have been moved over yet.

Update old code that used MI->getInstrDescriptor()->Flags to use the
new predicates in many places.

llvm-svn: 45674
2008-01-07 01:56:04 +00:00
Owen Anderson
0ec92e9d64 Update CodeGen for MRegisterInfo --> TargetInstrInfo changes.
llvm-svn: 45673
2008-01-07 01:35:56 +00:00
Owen Anderson
2a3be7bb6c Move even more functionality from MRegisterInfo into TargetInstrInfo.
Some day I'll get it all moved over...

llvm-svn: 45672
2008-01-07 01:35:02 +00:00
Gordon Henriksen
2d684b1fbf Ammending r45669 with a missing file.
llvm-svn: 45671
2008-01-07 01:33:09 +00:00
Gordon Henriksen
6047b6e140 With this patch, the LowerGC transformation becomes the
ShadowStackCollector, which additionally has reduced overhead with
no sacrifice in portability.

Considering a function @fun with 8 loop-local roots,
ShadowStackCollector introduces the following overhead
(x86):

; shadowstack prologue
        movl    L_llvm_gc_root_chain$non_lazy_ptr, %eax
        movl    (%eax), %ecx
        movl    $___gc_fun, 20(%esp)
        movl    $0, 24(%esp)
        movl    $0, 28(%esp)
        movl    $0, 32(%esp)
        movl    $0, 36(%esp)
        movl    $0, 40(%esp)
        movl    $0, 44(%esp)
        movl    $0, 48(%esp)
        movl    $0, 52(%esp)
        movl    %ecx, 16(%esp)
        leal    16(%esp), %ecx
        movl    %ecx, (%eax)

; shadowstack loop overhead
        (none)

; shadowstack epilogue
        movl    48(%esp), %edx
        movl    %edx, (%ecx)

; shadowstack metadata
        .align  3
___gc_fun:                              # __gc_fun
        .long   8
        .space  4

In comparison to LowerGC:

; lowergc prologue
        movl    L_llvm_gc_root_chain$non_lazy_ptr, %eax
        movl    (%eax), %ecx
        movl    %ecx, 48(%esp)
        movl    $8, 52(%esp)
        movl    $0, 60(%esp)
        movl    $0, 56(%esp)
        movl    $0, 68(%esp)
        movl    $0, 64(%esp)
        movl    $0, 76(%esp)
        movl    $0, 72(%esp)
        movl    $0, 84(%esp)
        movl    $0, 80(%esp)
        movl    $0, 92(%esp)
        movl    $0, 88(%esp)
        movl    $0, 100(%esp)
        movl    $0, 96(%esp)
        movl    $0, 108(%esp)
        movl    $0, 104(%esp)
        movl    $0, 116(%esp)
        movl    $0, 112(%esp)

; lowergc loop overhead
        leal    44(%esp), %eax
        movl    %eax, 56(%esp)
        leal    40(%esp), %eax
        movl    %eax, 64(%esp)
        leal    36(%esp), %eax
        movl    %eax, 72(%esp)
        leal    32(%esp), %eax
        movl    %eax, 80(%esp)
        leal    28(%esp), %eax
        movl    %eax, 88(%esp)
        leal    24(%esp), %eax
        movl    %eax, 96(%esp)
        leal    20(%esp), %eax
        movl    %eax, 104(%esp)
        leal    16(%esp), %eax
        movl    %eax, 112(%esp)

; lowergc epilogue
        movl    48(%esp), %edx
        movl    %edx, (%ecx)

; lowergc metadata
        (none)

llvm-svn: 45670
2008-01-07 01:30:53 +00:00
Gordon Henriksen
5180e85675 Enabling the target-independent garbage collection infrastructure by hooking it
up to the various compiler pipelines.

This doesn't actually add support for any GC algorithms, which means it 
temporarily breaks a few tests. To be fixed shortly.

llvm-svn: 45669
2008-01-07 01:30:38 +00:00
Chris Lattner
b296b0f1c1 The pic base can't be duplicated.
llvm-svn: 45668
2008-01-06 23:49:32 +00:00
Chris Lattner
a4ce4f6987 rename isLoad -> isSimpleLoad due to evan's desire to have such a predicate.
llvm-svn: 45667
2008-01-06 23:38:27 +00:00
Chris Lattner
4d3b0f579c rearrange some code.
llvm-svn: 45666
2008-01-06 22:50:31 +00:00
Chris Lattner
e2949f42d3 some simplifications/cleanups to ?: sema.
llvm-svn: 45665
2008-01-06 22:42:25 +00:00
Chris Lattner
cfb6f430b6 Emit warnings like "dereferencing void pointer" instead of trying to
pretty print the type name for void.

llvm-svn: 45664
2008-01-06 22:21:46 +00:00
Gordon Henriksen
db911e9037 Modify Makefile.rules to allow makefiles to prepend to C.Flags and
fiends. Change Makefile.ocaml to not touch CFLAGS.

llvm-svn: 45663
2008-01-06 21:54:35 +00:00
Chris Lattner
2a1993fb2c improve description of alignment, patch by Alain Frisch.
llvm-svn: 45662
2008-01-06 21:04:43 +00:00
Chris Lattner
ec56402557 Fix typo noticed by 'Danny' in PR1901
llvm-svn: 45661
2008-01-06 19:51:52 +00:00
Chris Lattner
466e8ebcc7 back out accidental commit.
llvm-svn: 45660
2008-01-06 19:19:32 +00:00
Chris Lattner
460d863ba5 fix an accidental commit that broke all the testers :(
llvm-svn: 45659
2008-01-06 19:18:52 +00:00
Duncan Sands
404eb05247 The transform that tries to turn calls to bitcast functions into
direct calls bails out unless caller and callee have essentially
equivalent parameter attributes.  This is illogical - the callee's
attributes should be of no relevance here.  Rework the logic, which
incidentally fixes a crash when removed arguments have attributes.

llvm-svn: 45658
2008-01-06 18:27:01 +00:00
Duncan Sands
55e5090fe8 When transforming a call to a bitcast function into
a direct call with cast parameters and cast return
value (if any), instcombine was prepared to cast any
non-void return value into any other, whether castable
or not.  Add a new predicate for testing whether casting
is valid, and check it both for the return value and
(as a cleanup) for the parameters.

llvm-svn: 45657
2008-01-06 10:12:28 +00:00
Chris Lattner
10324d0175 rename isStore -> mayStore to more accurately reflect what it captures.
llvm-svn: 45656
2008-01-06 08:36:04 +00:00
Duncan Sands
1694a53c5d Remove an unused variable.
llvm-svn: 45655
2008-01-06 07:43:13 +00:00
Chris Lattner
a348f55ec6 Change the 'isStore' inferrer to look for 'SDNPMayStore'
instead of "ISD::STORE".  This allows us to mark target-specific dag
nodes as storing (such as ppc byteswap stores).  This allows us to remove
more explicit isStore flags from the .td files.

Finally, add a warning for when a .td file contains an explicit 
isStore and tblgen is able to infer it.

llvm-svn: 45654
2008-01-06 06:44:58 +00:00
Chris Lattner
f4d55ec4e8 remove explicit isStore flags that are now inferrable.
llvm-svn: 45653
2008-01-06 05:55:01 +00:00
Chris Lattner
e20f380fbf remove some isStore flags that are now inferred automatically.
llvm-svn: 45652
2008-01-06 05:53:26 +00:00
Chris Lattner
e9dba0920b describe isStore and simplify the implementation of hasUnmodelledSideEffects.
No functionality change. 

llvm-svn: 45651
2008-01-06 05:43:21 +00:00
Chris Lattner
89c6566577 set the 'isstore' flag for instructions whose pattern is an
intrinsic that writes to memory.

llvm-svn: 45650
2008-01-06 05:36:50 +00:00
Nick Lewycky
0e519bb555 Accept both %y, %x and %x, %y as valid answers.
llvm-svn: 45649
2008-01-06 03:12:44 +00:00
Chris Lattner
e457fd1e9b remove some old hacky code that tried to infer whether a store
occured in a pattern, but failed miserably.  The new code works for
any instruction that has a store in its pattern, including all the 
x86 mem op mem instructions.

The only target-independent code that uses this is branch folding,
so this won't change anything in practice.

llvm-svn: 45648
2008-01-06 02:16:26 +00:00
Chris Lattner
27a4c1515a rearrange some code to allow inferring instr info from the pattern of the instr, but don't do so yet.
llvm-svn: 45647
2008-01-06 01:53:37 +00:00
Chris Lattner
d5326def4a improve const correctness.
llvm-svn: 45646
2008-01-06 01:52:22 +00:00
Chris Lattner
ea2d52d867 Split the impl of CodeGenInstruction out to its own .cpp file, add a getName() accessor.
llvm-svn: 45645
2008-01-06 01:35:39 +00:00
Chris Lattner
85467a17ae final cleanups.
llvm-svn: 45644
2008-01-06 01:21:51 +00:00
Chris Lattner
626b89daa4 further simplifications and cleanup
llvm-svn: 45643
2008-01-06 01:20:13 +00:00
Chris Lattner
827efa451f simplify some code
llvm-svn: 45642
2008-01-06 01:12:44 +00:00
Chris Lattner
ab3242fd46 rename CodegenDAGPatterns -> CodeGenDAGPatterns
llvm-svn: 45641
2008-01-06 01:10:31 +00:00
Chris Lattner
e59a3c79e5 split enum emission out from InstrInfoEmitter into it's own tblgen backend.
llvm-svn: 45640
2008-01-06 00:49:05 +00:00
Chris Lattner
78ac0747e7 fix build on case sensitive file systems.
llvm-svn: 45639
2008-01-05 23:37:52 +00:00
Bill Wendling
5fa2c64b78 Fix comment.
llvm-svn: 45638
2008-01-05 23:30:51 +00:00
Chris Lattner
7eac714b41 make this build with newer gcc's
llvm-svn: 45637
2008-01-05 23:29:51 +00:00
Chris Lattner
7980bba549 now that computing CodegenDAGPatterns doesn't implicitly print stuff
out, DAGISelEmitter can compute it in its ctor, which simplifies some code.

Now we can use CodegenDAGPatterns in other parts of tblgen that want access
to dag pattern info, woo!

llvm-svn: 45636
2008-01-05 22:58:54 +00:00
Chris Lattner
cc43e79bcd move Node Transformation printing from CodeGenDAGPatterns -> DAGISelEmitter.
The only difference in output is that we now print them in alphabetical 
order instead of reverse alphabetical order.

llvm-svn: 45635
2008-01-05 22:54:53 +00:00
Chris Lattner
e7170df043 move predicate printing code from CodeGenDAGPatterns -> DAGISelEmitter.
llvm-svn: 45634
2008-01-05 22:43:57 +00:00
Chris Lattner
9abe77b2d0 fix a fixme by improving const correctness.
llvm-svn: 45633
2008-01-05 22:30:17 +00:00
Chris Lattner
8cab021ca2 change getQualifiedName to be a global function.
Split the pattern parsing code out from the dag isel emitter into it's own file.

No functionality change.

llvm-svn: 45632
2008-01-05 22:25:12 +00:00
Nate Begeman
22950d26f5 Remove an incorrect optimization that is performed correctly by
the target independent legalizer.

llvm-svn: 45631
2008-01-05 20:51:30 +00:00
Nate Begeman
5743da502e If custom lowering of insert element fails, the result Val will be 0.
Don't overwrite a variable used by the fallthrough code path in this
case.

llvm-svn: 45630
2008-01-05 20:47:37 +00:00
Chris Lattner
647e61a42b Fix build issue on certain compilers.
llvm-svn: 45629
2008-01-05 20:15:42 +00:00
Gordon Henriksen
9231958391 Refactoring the x86 and x86-64 calling convention implementations,
unifying the copied algorithms and saving over 500 LOC. There should
be no functionality change, but please test on your favorite x86
target.

llvm-svn: 45627
2008-01-05 16:56:59 +00:00
Bill Wendling
be984cf10b Chris and Evan noticed that this check was compleatly fubared. I was
checking that there was a from a global instead of a load from the stub
for a global, which is the one that's safe to hoist.

Consider this program:

volatile char G[100];
int B(char *F, int N) {
  for (; N > 0; --N)
    F[N] = G[N];
}

In static mode, we shouldn't be hoisting the load from G:

$ llc -relocation-model=static -o - a.bc -march=x86 -machine-licm

LBB1_1: # bb.preheader
        leal    -1(%eax), %edx
        testl   %edx, %edx
        movl    $1, %edx
        cmovns  %eax, %edx
        xorl    %esi, %esi
LBB1_2: # bb
        movb    _G(%eax), %bl
        movb    %bl, (%ecx,%eax)

llvm-svn: 45626
2008-01-05 09:18:04 +00:00
Chris Lattner
ee61d14bf6 The current impl is really trivial, add some comments about how it can be made better.
llvm-svn: 45625
2008-01-05 06:47:58 +00:00
Chris Lattner
276178e49f allow sinking to be enabled for the jit
llvm-svn: 45624
2008-01-05 06:14:16 +00:00
Chris Lattner
e0f0c4aa02 enable sinking and licm of loads from the argument area. I'd like to enable this
for remat, but can't due to an RA bug.

llvm-svn: 45623
2008-01-05 06:10:42 +00:00
Chris Lattner
d4738ee8e1 simplify some code by using shorter accessors.
llvm-svn: 45622
2008-01-05 05:28:30 +00:00
Chris Lattner
86f4a2e4f2 revert my previous patch.
llvm-svn: 45621
2008-01-05 05:26:26 +00:00
Chris Lattner
69d7902cf1 factor some code better to avoid redundancy between
isReallySideEffectFree and isReallyTriviallyReMaterializable.  Why is a load from
a global considered side-effect-free but not rematable?

llvm-svn: 45620
2008-01-05 05:19:56 +00:00
Chris Lattner
9fa8ae6c6b getting the pic base has no side effects.
llvm-svn: 45618
2008-01-05 03:54:32 +00:00
Chris Lattner
d11ca169e7 don't sink anything with side effects, this makes lots of stuff work, but sinks almost nothing.
llvm-svn: 45617
2008-01-05 02:33:22 +00:00
Evan Cheng
880b080887 X86 JIT PIC jumptable support.
llvm-svn: 45616
2008-01-05 02:26:58 +00:00
Fariborz Jahanian
7b1b947ca1 twiks based on Chris's comment. No need to iterate thru a list of declarations
in a foreach-statement which is illegal (but not yet caught) .

llvm-svn: 45615
2008-01-05 01:40:08 +00:00
Chris Lattner
6ec78274df fix a common crash.
llvm-svn: 45614
2008-01-05 01:39:17 +00:00
Chris Lattner
e666bc272d remove a couple more unsafe xforms in the face of overflow.
llvm-svn: 45613
2008-01-05 01:22:42 +00:00
Chris Lattner
db026d703b remove the (x-y) < 0 comparison xform, it miscompiles
things that are not equality comparisons, for example:
   (2147479553+4096)-2147479553 < 0    !=   (2147479553+4096) < 2147479553

llvm-svn: 45612
2008-01-05 01:18:20 +00:00
Ted Kremenek
e84b32e506 Moved serialization code for ObjcForCollectionStmt to be in alphabetical order
with the rest of the Objective-C serialization code.

llvm-svn: 45609
2008-01-05 00:57:49 +00:00
Owen Anderson
3592b2352d I should not be allowed to commit when sleepy.
llvm-svn: 45608
2008-01-05 00:48:55 +00:00
Owen Anderson
1984732f22 Didn't mean to commit this.
llvm-svn: 45607
2008-01-05 00:43:37 +00:00
Owen Anderson
cc35708bac Didn't mean to commit this.
llvm-svn: 45606
2008-01-05 00:42:45 +00:00
Evan Cheng
f55b7381af Combine MovePCtoStack + POP32r into one instruction MOVPC32r so it can be moved if needed.
llvm-svn: 45605
2008-01-05 00:41:47 +00:00
Fariborz Jahanian
bad3218954 Minor refactoring of foreach's semantics code per Chris's suggetion.
llvm-svn: 45604
2008-01-04 23:59:09 +00:00
Owen Anderson
6bb0c52628 Move some more functionality from MRegisterInfo to TargetInstrInfo.
llvm-svn: 45603
2008-01-04 23:57:37 +00:00
Chris Lattner
881a212a70 unnest vector handling again.
llvm-svn: 45602
2008-01-04 23:32:24 +00:00
Fariborz Jahanian
e908cab389 Added a comment, minor refactoring of foreach parsing code per Chris's suggestion.
llvm-svn: 45601
2008-01-04 23:23:46 +00:00
Chris Lattner
f735409e11 we already test for exact type matches early, so we don't have to do
it explicitly for vectors.  This allows us to unnest some code.

llvm-svn: 45600
2008-01-04 23:20:56 +00:00
Chris Lattner
a52c2f2e3e simplify some of this code by removing the else/if chain and by
stripping down to canonical types early.

llvm-svn: 45599
2008-01-04 23:18:45 +00:00
Fariborz Jahanian
3622e5954b Minor changes as suggested by Chris L.
llvm-svn: 45598
2008-01-04 23:04:08 +00:00
Chris Lattner
a3fc41d616 move objc expr sema to its own file.
llvm-svn: 45597
2008-01-04 22:32:30 +00:00
Bill Wendling
0c209430b4 Don't recalculate the loop info and loop dominators analyses if they're
preserved.

llvm-svn: 45596
2008-01-04 20:54:55 +00:00
Wojciech Matyjewicz
2bd541c5ff fix typo
llvm-svn: 45595
2008-01-04 20:04:08 +00:00
Wojciech Matyjewicz
30e434569e fix typo
llvm-svn: 45594
2008-01-04 20:02:18 +00:00
Chris Lattner
4899a6aa6a Fix PR1897, patch by Wilhansen Li
llvm-svn: 45593
2008-01-04 19:12:28 +00:00
Chris Lattner
940cfebf90 add comments for the various AssignConvertType's, and split int->pointer from pointer->int.
llvm-svn: 45591
2008-01-04 18:22:42 +00:00
Chris Lattner
9bad62c72a Merge all the 'assignment' diagnostic code into one routine, decloning
it from several places.  This merges the diagnostics, making them more
uniform and fewer in number. This also simplifies and cleans up the code.

Some highlights:
1. This removes a bunch of very-similar diagnostics.
2. This renames AssignmentCheckResult -> AssignConvertType
3. This merges PointerFromInt + IntFromPointer which were always treated the same.
4. This updates a bunch of test cases that have minor changes to the produced diagnostics.

llvm-svn: 45589
2008-01-04 18:04:52 +00:00
Duncan Sands
d98c63ebb9 Testcase with non-integer "bitfields" (in quotes,
since they didn't actually need to be bitfields,
though they are marked as such).

llvm-svn: 45588
2008-01-04 17:31:56 +00:00
Chris Lattner
94cf8061e7 fix a build problem where NULL isn't implicitly defined by the headers this file includes.
llvm-svn: 45587
2008-01-04 16:27:03 +00:00
Gordon Henriksen
d829d2efeb Fix a typo in llvm.mli noticed by Alain Frisch.
llvm-svn: 45585
2008-01-04 13:21:02 +00:00
Duncan Sands
99fc7197f2 Testcase for PR1386.
llvm-svn: 45583
2008-01-04 13:15:39 +00:00
Bill Wendling
46813c58bb doc_code-ify some code in this doc.
llvm-svn: 45581
2008-01-04 12:04:32 +00:00
Gordon Henriksen
73d8967f02 Quote a path in the Ocaml makefile which is likely to include spaces on Windows.
llvm-svn: 45580
2008-01-04 11:55:57 +00:00
Evan Cheng
c1d1e54fc4 Unbreak tailcall opt in JIT.
llvm-svn: 45576
2008-01-04 10:50:28 +00:00
Evan Cheng
49ff8ecd03 X86 PIC JIT support fixes: encoding bugs, add lazy pointer stubs support.
llvm-svn: 45575
2008-01-04 10:46:51 +00:00
Bill Wendling
118ae4cd61 80-column violations.
llvm-svn: 45574
2008-01-04 08:59:18 +00:00
Bill Wendling
3bf5603ce4 Add that this preserves some analyses.
llvm-svn: 45573
2008-01-04 08:48:49 +00:00
Bill Wendling
66470d02c3 Move option to enable machine LICM into LLVMTargetMachine.cpp.
llvm-svn: 45572
2008-01-04 08:11:03 +00:00
Bill Wendling
d865697016 Call the parent's getAnalysisUsage.
llvm-svn: 45571
2008-01-04 07:50:05 +00:00
Chris Lattner
f3edc09f9b Add a really quick hack at a machine code sinking pass, enabled with --enable-sinking.
It is missing validity checks, so it is known broken.  However, it is powerful enough
to compile this contrived code:

void test1(int C, double A, double B, double *P) {
  double Tmp = A*A+B*B;
  *P = C ? Tmp : A;
}

into:

_test1:
	movsd	8(%esp), %xmm0
	cmpl	$0, 4(%esp)
	je	LBB1_2	# entry
LBB1_1:	# entry
	movsd	16(%esp), %xmm1
	mulsd	%xmm1, %xmm1
	mulsd	%xmm0, %xmm0
	addsd	%xmm1, %xmm0
LBB1_2:	# entry
	movl	24(%esp), %eax
	movsd	%xmm0, (%eax)
	ret

instead of:

_test1:
	movsd	16(%esp), %xmm0
	mulsd	%xmm0, %xmm0
	movsd	8(%esp), %xmm1
	movapd	%xmm1, %xmm2
	mulsd	%xmm2, %xmm2
	addsd	%xmm0, %xmm2
	cmpl	$0, 4(%esp)
	je	LBB1_2	# entry
LBB1_1:	# entry
	movapd	%xmm2, %xmm1
LBB1_2:	# entry
	movl	24(%esp), %eax
	movsd	%xmm1, (%eax)
	ret

woo.

llvm-svn: 45570
2008-01-04 07:36:53 +00:00
Chris Lattner
b5c1d9b7da remove dead #includes and reorder the rest.
llvm-svn: 45569
2008-01-04 06:41:45 +00:00
Chris Lattner
bdd6acfb59 Fix PR1896
llvm-svn: 45568
2008-01-04 05:04:53 +00:00
Chris Lattner
69ea01446e Change the builtin matcher to emit a decision tree, which should help out
the VC++ 'nesting depth' issue.

llvm-svn: 45567
2008-01-04 04:38:35 +00:00
Chris Lattner
43542b3a93 fix nesting issues.
llvm-svn: 45566
2008-01-04 04:34:14 +00:00
Chris Lattner
b8f816e90d fix validation issues.
llvm-svn: 45565
2008-01-04 04:33:49 +00:00
Chris Lattner
7824d182da improve the description of types, patch by Alain Frisch
llvm-svn: 45564
2008-01-04 04:32:38 +00:00
Chris Lattner
a47634ecb1 Don't let IntrinsicID be uninitialized if it doesn't match.
llvm-svn: 45563
2008-01-04 03:32:52 +00:00
Evan Cheng
2e1ba07f16 Correct order of parameters.
llvm-svn: 45562
2008-01-04 02:22:21 +00:00
Fariborz Jahanian
775d5d02af Patch to add semantics check for ObjC2's foreacn statement.
llvm-svn: 45561
2008-01-04 00:27:46 +00:00
Chris Lattner
816dea2fc5 generalize some of the conversion warnings.
llvm-svn: 45560
2008-01-03 23:38:43 +00:00
Chris Lattner
166ae81be1 update for changes in diagnostic strings.
llvm-svn: 45559
2008-01-03 23:36:08 +00:00
Chris Lattner
874e024f10 regroup assignment-related diagnostics, fix a mistake in one.
llvm-svn: 45558
2008-01-03 23:13:36 +00:00
Bill Wendling
ddc77f8e4c Remove the default else. This was ending in code that looked like this:
if (!strcmp(Target, "x86")) {
  // ...
}
else
  IntrinsicID = Intrinsic::not_intrinsic;

llvm-svn: 45557
2008-01-03 23:02:16 +00:00
Chris Lattner
0a788433eb give better diagnostics for converting between function pointer and void*.
llvm-svn: 45556
2008-01-03 22:56:36 +00:00
Ted Kremenek
739d350369 renamed class "GRCP" (Graph Reachabilty Constant Propagation) to
"GREngine" (Graph Reachability Engine).  The idea is to provide a separation
of concerns between the constant prop. details and the core analysis engine.

llvm-svn: 45555
2008-01-03 22:46:25 +00:00
Ted Kremenek
7c54e520e7 Implemented End-Of-Path processing.
llvm-svn: 45554
2008-01-03 22:29:38 +00:00
Chris Lattner
84cea329d5 Remove symbols that don't exist, remove tabs, fix comment typo
llvm-svn: 45553
2008-01-03 22:15:32 +00:00
Ted Kremenek
0044908de0 Initial checking of GRConstantPropagation.cpp, which implements a constant
propagation analysis via graph reachability. This analysis (which is incomplete)
will be the basis for later developments on the core engine for path-sensitive
analysis analysis.

llvm-svn: 45552
2008-01-03 22:12:28 +00:00
Ted Kremenek
fde239df06 Fixed misuse of pointer within SimulVertex::addPredecessor()
llvm-svn: 45551
2008-01-03 22:09:27 +00:00
Ted Kremenek
9d375282cf SimulGraph::getVertex() now also returns a bool indicating if the returned
vertex was freshly created.

llvm-svn: 45550
2008-01-03 22:08:52 +00:00
Ted Kremenek
6abe02ada6 Constified methods front() and back() in CFGBlock.
llvm-svn: 45549
2008-01-03 22:07:58 +00:00
Ted Kremenek
d6c30e58e2 De-constified the pointers returned by the Dst() and Src() methods of
the various ProgramEdge classes.

llvm-svn: 45548
2008-01-03 22:07:01 +00:00
Fariborz Jahanian
c89ea091a2 Couple more uninitialized before use warning elimination.
llvm-svn: 45547
2008-01-03 20:04:58 +00:00
Fariborz Jahanian
243c611a05 Remove cause of misc. "variable might be used uninitialized in this function" warnings.
llvm-svn: 45546
2008-01-03 20:01:35 +00:00
Chuck Rose III
7f2e31a36a Adding new files to win32 build
llvm-svn: 45545
2008-01-03 19:53:03 +00:00
Fariborz Jahanian
5cc21a7e02 Fixed a bug reported by Chris, involving assiging 0 to a qualified object type.
llvm-svn: 45542
2008-01-03 18:46:52 +00:00
Chris Lattner
2b15cf705b simplify the lexer a bit, pulling stuff out of the default case.
llvm-svn: 45540
2008-01-03 17:58:54 +00:00
Fariborz Jahanian
732b8c2dc5 Patch to parse/build AST ObjC2's foreach statement.
llvm-svn: 45539
2008-01-03 17:55:25 +00:00
Gordon Henriksen
9b92e93d36 Ignoring output files.
llvm-svn: 45538
2008-01-03 17:42:08 +00:00
Chris Lattner
67793d8d60 add info on walking preds/succs of a block.
llvm-svn: 45537
2008-01-03 16:56:04 +00:00
Gordon Henriksen
f066fc477c First steps in in X86 calling convention cleanup.
llvm-svn: 45536
2008-01-03 16:47:34 +00:00
Duncan Sands
338b462b6f Test for handling of large bit offset from a
variable field offset.

llvm-svn: 45534
2008-01-03 11:53:52 +00:00
Chris Lattner
f391883670 don't hoist FP additions into unconditional adds + selects. This
could theoretically introduce a trap, but is also a performance issue.
This speeds up ptrdist/ks by 8%.

llvm-svn: 45533
2008-01-03 07:25:26 +00:00
Chris Lattner
705dc51f2c Fix PR1873, a problem finding stat-related symbols on linux, due to
"libc_nonshared.a". Patch by Edwin Török!

llvm-svn: 45532
2008-01-03 07:10:51 +00:00
Chris Lattner
1800c18ebd fix long lines.
llvm-svn: 45531
2008-01-03 07:05:49 +00:00
Chris Lattner
20455f204f Fix a crash reported by Seo Sanghyeon.
llvm-svn: 45530
2008-01-03 06:36:51 +00:00
Gordon Henriksen
7c87884ec3 Trying that again.
llvm-svn: 45529
2008-01-03 03:32:33 +00:00
Gordon Henriksen
8624d7b72e Fix a compile error on Windows.
llvm-svn: 45528
2008-01-03 03:21:18 +00:00
Evan Cheng
563fcc3428 Change MachineRelocation::DoesntNeedFnStub to NeedStub. This fields will be used
for non-function GV relocations that require function address stubs (e.g. Mac OS X in non-static mode).

llvm-svn: 45527
2008-01-03 02:56:28 +00:00
Chris Lattner
e35604ddb2 don't access element zero of an array of size zero.
llvm-svn: 45526
2008-01-03 01:25:31 +00:00
Chris Lattner
76719ba5f1 Remove the function attr cache for intrinsics. This does not maintain the
refcount on these correctly, and can end up referring to deleted 
attributes.  This fixes PR1881.

llvm-svn: 45525
2008-01-03 01:20:12 +00:00
Chris Lattner
b18b0b99c6 Don't create a new ParamAttrsList (which copies the vector) just to
get a profile.

llvm-svn: 45524
2008-01-03 00:29:27 +00:00
Duncan Sands
a7f7ac7072 An example for which the TYPE_SIZE was being set from
the initial value, while the type fields were not (this
is a qualified union type, so not all fields are always
present).  This resulted in the size of the corresponding
LLVM type being larger than the gcc TYPE_SIZE.

llvm-svn: 45522
2008-01-03 00:26:42 +00:00
Duncan Sands
1d03fb4e7e Test handling of records for which the fields are
not ordered by offset.

llvm-svn: 45520
2008-01-03 00:17:02 +00:00
Chris Lattner
d0e1f10078 move some code out of line, rearrange a bit.
llvm-svn: 45519
2008-01-03 00:10:22 +00:00
Chris Lattner
d135068e53 Disallow copying explicitly.
llvm-svn: 45518
2008-01-03 00:09:47 +00:00
Chris Lattner
3e13b8c173 Split param attr implementation out from Function.cpp into its
own file.  Don't #include ParameterAttributes.h into any major
public header files: just move methods out of line as appropriate.

llvm-svn: 45517
2008-01-02 23:42:30 +00:00
Chris Lattner
d2b0e15535 add missing #include
llvm-svn: 45516
2008-01-02 23:41:05 +00:00
Evan Cheng
96334b4e3b X86 PIC JIT bug fix: relocations for constantpool and jumptable.
llvm-svn: 45515
2008-01-02 23:38:59 +00:00
Chris Lattner
04cd35f88b remove blob of #if'd out code.
llvm-svn: 45512
2008-01-02 23:10:45 +00:00
Fariborz Jahanian
8361552af9 New declarations/defs for Objc2's foreach-statement. This is work in progress.
llvm-svn: 45511
2008-01-02 22:54:34 +00:00
Chris Lattner
4f20351142 When promoting array to pointer for argument, don't lose type qualifiers.
llvm-svn: 45510
2008-01-02 22:50:48 +00:00
Chris Lattner
41e423a6f5 fix this to use a valid triple.
llvm-svn: 45509
2008-01-02 22:21:45 +00:00
Ted Kremenek
161807f8d1 SimulVertex: Inverted argument order when calling the Profile method of StateTy.
SimulGraph: Inverted argument order when calling the Profile method of VertexTy
  (plus minor cleanups)
llvm-svn: 45508
2008-01-02 22:20:20 +00:00
Ted Kremenek
a26f5d188f Inverted argument order for ImmutableMap::Profile.
llvm-svn: 45507
2008-01-02 22:18:33 +00:00
Chris Lattner
0acc15c470 Fix a build issue on cygwin
llvm-svn: 45506
2008-01-02 22:03:27 +00:00
Chris Lattner
7977cca8e8 Fix PR1895: a crash on an ugly gcc extension.
llvm-svn: 45505
2008-01-02 21:54:09 +00:00
Chris Lattner
266a2ff3ac Compute the proper sourcerange for an CompoundLiteralExpr.
llvm-svn: 45504
2008-01-02 21:46:24 +00:00
Ted Kremenek
d7c6b0e664 Added iterator and profiling (i.e. FoldingSetNodeID) support to ImmutableMap.
llvm-svn: 45503
2008-01-02 21:31:48 +00:00
Ted Kremenek
c7523bcaaa Converted state reference within SimulVertex from StateTy* to StateTy.
This is more flexible.

llvm-svn: 45502
2008-01-02 21:31:13 +00:00
Chris Lattner
9a6774064b Fix PR1888, patch by Wilhansen Li.
llvm-svn: 45501
2008-01-02 21:30:58 +00:00
Chris Lattner
91678fc457 Fix a build problem with VC++ by not doing the target prefix
comparison for every builtin.  This reduces the depth of
the if/elseif chain dramatically.

llvm-svn: 45500
2008-01-02 21:24:22 +00:00
Bill Wendling
0ba4184404 Use the correct MachineRegisterInfo object.
llvm-svn: 45499
2008-01-02 21:10:54 +00:00
Bill Wendling
e1f28e7871 Machine LICM will check that operands are defined outside of the loop. Also
check that register isn't 0 before going further.

llvm-svn: 45498
2008-01-02 21:10:40 +00:00
Chris Lattner
54bb810997 Refactor the decl printer, patch by Mike Stump!
llvm-svn: 45497
2008-01-02 21:04:16 +00:00
Bill Wendling
f0b37780ca Remove dead code.
llvm-svn: 45496
2008-01-02 20:47:37 +00:00
Chris Lattner
5d998c5712 verify that aligned common support doesn't break.
llvm-svn: 45495
2008-01-02 19:48:24 +00:00
Chris Lattner
cce79c67ca darwin9 and above support aligned common symbols.
llvm-svn: 45494
2008-01-02 19:44:55 +00:00
Chris Lattner
dcbc0f3029 leopard and above support alignment for common symbols.
llvm-svn: 45493
2008-01-02 19:35:16 +00:00
Bill Wendling
5da1945cdd Use the new architecture to get the containing machine basic block for a machine
instruction. Also, use "splice" to move the new instruction instead of
remove/insert (where it was leaking memory anyway).

llvm-svn: 45492
2008-01-02 19:32:43 +00:00
Fariborz Jahanian
056e3a4e90 Issue diagnostic when objective-c's @interface is preceeded by a type specifier.
llvm-svn: 45491
2008-01-02 19:17:38 +00:00
Ted Kremenek
796b64337b Added/fixed some comments.
llvm-svn: 45490
2008-01-02 18:31:49 +00:00
Fariborz Jahanian
5e57e1890d Prevent crash on incorrect objc messaging expression.
llvm-svn: 45489
2008-01-02 18:09:46 +00:00
Ted Kremenek
dc8ebe5022 Sprinkled 'typename' and fixed a few typos and type declaration errors to
make these headers compile.

llvm-svn: 45488
2008-01-02 17:45:00 +00:00
Ted Kremenek
2290828271 Added fixme.
llvm-svn: 45487
2008-01-02 17:05:47 +00:00
Ted Kremenek
032cb4433e Allocate vertices using a BumpPtrAllocator.
llvm-svn: 45486
2008-01-02 17:00:32 +00:00
Nick Lewycky
d1200b00dc Don't be rude, emit debugging info where asked to.
llvm-svn: 45485
2008-01-02 02:49:20 +00:00
Owen Anderson
eee14601b1 Move some more instruction creation methods from RegisterInfo into InstrInfo.
llvm-svn: 45484
2008-01-01 21:11:32 +00:00
Chris Lattner
caaf8aae4d Make MachineRegisterInfo::getVRegDef more efficient by aiming the keep the def of the vreg at the start of the list, so the list doesn't need to be traversed.
llvm-svn: 45483
2008-01-01 21:08:22 +00:00
Chris Lattner
0cb9dd7aa2 switch the register iterator to act more like hte LLVM value iterator: dereferencing
it now returns the machineinstr of the use.  To get the operand, use I.getOperand().

Add a new MachineRegisterInfo::replaceRegWith, which is basically like
Value::replaceAllUsesWith.

llvm-svn: 45482
2008-01-01 20:36:19 +00:00
Gordon Henriksen
097102c32a Adding C bindings for SwitchInst::addCase.
Patch by Bryan O'Sullivan!

llvm-svn: 45481
2008-01-01 05:50:53 +00:00
Chris Lattner
39204d76c5 Add a trivial but handy function to efficiently return the machine
instruction that defines the specified vreg.  Crazy.

llvm-svn: 45480
2008-01-01 03:07:29 +00:00
Chris Lattner
8a497053a7 add efficient iteration support for register use/def's
within a machine function.

llvm-svn: 45479
2008-01-01 02:55:32 +00:00
Bill Wendling
6f8c9a8372 Update this testcase. The output needs to be disabled to pass.
llvm-svn: 45478
2008-01-01 01:34:36 +00:00
Chris Lattner
961e7427ea Implement automatically updated def/use lists for all MachineInstr register
operands.  The lists are currently kept in MachineRegisterInfo, but it does
not yet provide an iterator interface to them.

llvm-svn: 45477
2008-01-01 01:12:31 +00:00
Chris Lattner
b0fb17fd34 Fix a bug in my previous patch: refer to the impl not the pure virtual version. It's unclear why gcc would ever compile this...
llvm-svn: 45476
2008-01-01 01:05:34 +00:00
Chris Lattner
25568e4cef Fix a problem where lib/Target/TargetInstrInfo.h would include and use
a header file from libcodegen.  This violates a layering order: codegen
depends on target, not the other way around.  The fix to this is to 
split TII into two classes, TII and TargetInstrInfoImpl, which defines
stuff that depends on libcodegen.  It is defined in libcodegen, where 
the base is not.

llvm-svn: 45475
2008-01-01 01:03:04 +00:00
Chris Lattner
c23e6351de Factor out makefile dependency generation better.
Don't include system headers in the .d files.
Don't use $@ in the makefile rules, as there are two possible targets it could resolve to: use the one that we need explicitly.

llvm-svn: 45473
2007-12-31 23:58:31 +00:00
Duncan Sands
57a60f0466 Fix PR1833 - eh.exception and eh.selector return two
values, which means doing extra legalization work.
It would be easier to get this kind of thing right if
there was some documentation...

llvm-svn: 45472
2007-12-31 18:35:50 +00:00
Owen Anderson
7a73ae9a86 Move copyRegToReg from MRegisterInfo to TargetInstrInfo. This is part of the
Machine-level API cleanup instigated by Chris.

llvm-svn: 45470
2007-12-31 06:32:00 +00:00
Chris Lattner
574e7166e0 properly encapsulate the parent field of MBB and MI with get/set accessors.
llvm-svn: 45469
2007-12-31 04:56:33 +00:00
Chris Lattner
21ec2b4769 update a couple of references to SSARegMap.
llvm-svn: 45468
2007-12-31 04:16:08 +00:00
Chris Lattner
a10fff51d9 Rename SSARegMap -> MachineRegisterInfo in keeping with the idea
that "machine" classes are used to represent the current state of
the code being compiled.  Given this expanded name, we can start 
moving other stuff into it.  For now, move the UsedPhysRegs and
LiveIn/LoveOuts vectors from MachineFunction into it.

Update all the clients to match.

This also reduces some needless #includes, such as MachineModuleInfo
from MachineFunction.

llvm-svn: 45467
2007-12-31 04:13:23 +00:00
Gordon Henriksen
1f35454e99 Removing obsolete files from the Xcode project.
llvm-svn: 45466
2007-12-31 01:45:55 +00:00
Chris Lattner
5a1d88e91b slightly simplify and document SSARegMap.
llvm-svn: 45465
2007-12-30 23:40:31 +00:00
Chris Lattner
a5bb370aa4 Add new shorter predicates for testing machine operands for various types:
e.g. MO.isMBB() instead of MO.isMachineBasicBlock().  I don't plan on 
switching everything over, so new clients should just start using the 
shorter names.

Remove old long accessors, switching everything over to use the short
accessor: getMachineBasicBlock() -> getMBB(), 
getConstantPoolIndex() -> getIndex(), setMachineBasicBlock -> setMBB(), etc.

llvm-svn: 45464
2007-12-30 23:10:15 +00:00
Gordon Henriksen
1862b6daa0 Another backwards compatibility fix.
llvm-svn: 45463
2007-12-30 22:48:58 +00:00
Chris Lattner
db64f04ac6 - rename opType -> OpKind and contents -> Contents.
- eliminate the auxInfo union, merging it into the contents union.  This shaves 
  4 bytes off MachineOperand on a 32-bit machine.

- Use accessors in ctor methods.

- Add comments.

llvm-svn: 45462
2007-12-30 22:24:06 +00:00
Chris Lattner
6005589faf More cleanups for MachineOperand:
- Eliminate the static "print" method for operands, moving it
    into MachineOperand::print.
  - Change various set* methods for register flags to take a bool
    for the value to set it to.  Remove unset* methods.
  - Group methods more logically by operand flavor in MachineOperand.h

llvm-svn: 45461
2007-12-30 21:56:09 +00:00
Chris Lattner
c98c0e57eb MachineOperand:
- Add getParent() accessors.
  - Move SubReg out of the AuxInfo union, to make way for future changes.
  - Remove the getImmedValue/setImmedValue methods.
  - in some MachineOperand::Create* methods, stop initializing fields that are dead.

MachineInstr:
  - Delete one copy of the MachineInstr printing code, now there is only one dump
    format and one copy of the code.
  - Make MachineOperand use the parent field to get info about preg register names if
    no target info is otherwise available.
  - Move def/use/kill/dead flag printing to the machineoperand printer, so they are
    always printed for an operand.

llvm-svn: 45460
2007-12-30 21:31:53 +00:00
Chris Lattner
96317d2412 fix typo duncan noticed!
llvm-svn: 45459
2007-12-30 21:21:10 +00:00
Chris Lattner
35fececec9 simpilfy some register printing code.
llvm-svn: 45458
2007-12-30 21:08:36 +00:00
Chris Lattner
383a873a9a eliminate a copy of the machineoperand printing stuff. Keep the copy that
knows how to print offsets.

llvm-svn: 45457
2007-12-30 21:03:30 +00:00
Chris Lattner
49bd29daa0 Simplify and clean up some machine operand/instr printing/dumping stuff.
llvm-svn: 45456
2007-12-30 21:01:27 +00:00
Chris Lattner
0dad74d252 two register machineoperands are not identical unless their subregs match.
llvm-svn: 45455
2007-12-30 20:55:08 +00:00
Chris Lattner
81798417dc MachineOperand::getImmedValue -> MachineOperand::getImm
llvm-svn: 45454
2007-12-30 20:50:28 +00:00
Chris Lattner
5c4637816e Use MachineOperand::getImm instead of MachineOperand::getImmedValue. Likewise setImmedValue -> setImm
llvm-svn: 45453
2007-12-30 20:49:49 +00:00
Gordon Henriksen
86427bb2a9 Trying r45451 again, but this time warning-free on 3.10.x.
llvm-svn: 45452
2007-12-30 18:12:41 +00:00
Gordon Henriksen
8100a225c0 Remove some lines that are nonportable to Ocaml 3.06.
llvm-svn: 45451
2007-12-30 17:48:11 +00:00
Gordon Henriksen
4a4d73519e Add some doxygen comments to llvm-c/Core.h.
llvm-svn: 45450
2007-12-30 17:46:33 +00:00
Chris Lattner
3c6ce5b43c make machine operands fatter: give each one an up-pointer to the
machineinstr that owns it.

llvm-svn: 45449
2007-12-30 06:11:04 +00:00
Gordon Henriksen
12c53c8c84 Strengthening this test so it fails in release mode.
llvm-svn: 45446
2007-12-30 05:45:49 +00:00
Chris Lattner
ad0c83d65e split machineoperand out into its own header file.
llvm-svn: 45445
2007-12-30 04:40:25 +00:00
Bill Wendling
7749a9014b If we have a load of a global address that's not modified during the
function, then go ahead and hoist it out of the loop. This is the result:

$ cat a.c
volatile int G;

int A(int N) {
  for (; N > 0; --N)
    G++;
}
$ llc -o - -relocation-model=pic
_A:
...
LBB1_2: # bb
        movl    L_G$non_lazy_ptr-"L1$pb"(%eax), %esi
        incl    (%esi)
        incl    %edx
        cmpl    %ecx, %edx
        jne     LBB1_2  # bb
...
$ llc -o - -relocation-model=pic -machine-licm
_A:
...
        movl    L_G$non_lazy_ptr-"L1$pb"(%eax), %eax
LBB1_2: # bb
        incl    (%eax)
        incl    %edx
        cmpl    %ecx, %edx
        jne     LBB1_2  # bb
...

I'm limiting this to the MOV32rm x86 instruction for now.

llvm-svn: 45444
2007-12-30 03:18:58 +00:00
Nate Begeman
330aaa79e0 Allow implicit casts during arithmetic for OCUVector operations
Add codegen support and test for said casts.

llvm-svn: 45443
2007-12-30 02:59:45 +00:00
Nate Begeman
627daba0fd Allow splat casts for OCU vector assignments & add some comments.
llvm-svn: 45442
2007-12-30 01:45:55 +00:00
Nate Begeman
16a3a9d5f9 Rename stats to print-stats to avoid conflicting with llvm's
stats statistic when clang is built as a dylib.

llvm-svn: 45441
2007-12-30 01:38:50 +00:00
Nate Begeman
628028bd27 Allow codegen of vector fdiv
llvm-svn: 45440
2007-12-30 01:28:16 +00:00
Chris Lattner
add4b3f9ab remove unneeded #includes.
llvm-svn: 45439
2007-12-30 01:11:43 +00:00
Chris Lattner
79f6f6c87a remove a bunch of now-dead methods.
llvm-svn: 45438
2007-12-30 01:04:05 +00:00
Chris Lattner
b3fd2d7b63 use simplified operand addition methods.
llvm-svn: 45437
2007-12-30 01:01:54 +00:00
Chris Lattner
20421fe936 use simplified operand addition methods.
llvm-svn: 45436
2007-12-30 00:57:42 +00:00
Chris Lattner
bbbae8e1ce use simplified operand addition methods.
llvm-svn: 45435
2007-12-30 00:51:11 +00:00
Chris Lattner
b65293a075 make offset operand optional.
llvm-svn: 45434
2007-12-30 00:50:55 +00:00
Chris Lattner
4b762496a9 Shrinkify the machine operand creation method names.
llvm-svn: 45433
2007-12-30 00:45:46 +00:00
Chris Lattner
e35dfb827f Start using the simplified methods for adding operands.
llvm-svn: 45432
2007-12-30 00:41:17 +00:00
Chris Lattner
c002be7fdd switch MIBuilder over to use the simplified operand addition methods.
llvm-svn: 45431
2007-12-30 00:35:18 +00:00
Chris Lattner
d948c2d244 1. Make a static MachineOperand::create* method for every
operand type.
2. Move these create methods below the accessors.
3. Simplify all the MachineInstr::add* methods to use these.

llvm-svn: 45430
2007-12-30 00:29:19 +00:00
Chris Lattner
dc3c9050f8 tblgen shouldn't include headers from llvm codegen.
llvm-svn: 45429
2007-12-30 00:25:23 +00:00
Chris Lattner
c288ff1d78 simplify some code by factoring operand construction better.
llvm-svn: 45428
2007-12-30 00:12:25 +00:00
Chris Lattner
a77acbdcae implement codegen support for most unary operators when
initializing a global.  This handles important cases like:
float foo3 = -0.01f;

llvm-svn: 45427
2007-12-29 23:43:37 +00:00
Chris Lattner
6787a45a65 remove attribution from a variety of miscellaneous files.
llvm-svn: 45425
2007-12-29 22:59:10 +00:00
Chris Lattner
f87b59d683 regenerate
llvm-svn: 45424
2007-12-29 20:47:37 +00:00
Chris Lattner
cb1e357a1c remove attributions
llvm-svn: 45423
2007-12-29 20:46:15 +00:00
Gordon Henriksen
1158c533f7 Bindings for instruction calling conventions.
llvm-svn: 45422
2007-12-29 20:45:00 +00:00
Chris Lattner
345353d6b4 remove attributions from tools.
llvm-svn: 45421
2007-12-29 20:44:31 +00:00
Chris Lattner
bcf65db6f3 remove attributions from examples.
llvm-svn: 45420
2007-12-29 20:37:57 +00:00
Chris Lattner
8adcd9f32e remove attributions from utils.
llvm-svn: 45419
2007-12-29 20:37:13 +00:00
Chris Lattner
f3ebc3f3d2 Remove attribution from file headers, per discussion on llvmdev.
llvm-svn: 45418
2007-12-29 20:36:04 +00:00
Chris Lattner
11cc8b3c14 remove attributions from the rest of the llvm makefiles.
llvm-svn: 45416
2007-12-29 20:11:13 +00:00
Chris Lattner
a087a8d2ce remove attribution from lib Makefiles.
llvm-svn: 45415
2007-12-29 20:09:26 +00:00
Chris Lattner
8fa21acd25 remove attributions from tools/utils makefiles.
llvm-svn: 45414
2007-12-29 20:07:17 +00:00
Chris Lattner
7429581c33 remove attributions from .def files.
llvm-svn: 45413
2007-12-29 20:03:32 +00:00
Chris Lattner
5926c0ebfb remove attribution from makefiles.
llvm-svn: 45412
2007-12-29 20:02:25 +00:00
Chris Lattner
e9cc742a17 Don't attribute in file headers anymore. See llvmdev for the
discussion of this change.  Boy are my fingers tired. ;-)

llvm-svn: 45411
2007-12-29 19:59:42 +00:00
Chris Lattner
5b12ab8c93 Don't attribute in file headers anymore. See llvmdev for the
discussion of this change.

llvm-svn: 45410
2007-12-29 19:59:25 +00:00
Chris Lattner
ebf5666abf Don't attribute in file headers anymore. See llvmdev for the
discussion of this change.

llvm-svn: 45409
2007-12-29 19:56:08 +00:00
Chris Lattner
4e6cbb2fe2 this is done.
llvm-svn: 45408
2007-12-29 19:38:02 +00:00
Chris Lattner
d2b8a36f0e One readme entry is done, one is really easy (Evan, want to investigate
eliminating the llvm.x86.sse2.loadl.pd intrinsic?), one shuffle optzn
may be done (if shufps is better than pinsw, Evan, please review), and
we already know about LICM of simple instructions.

llvm-svn: 45407
2007-12-29 19:31:47 +00:00
Chris Lattner
0d90c8f016 upgrade this test
llvm-svn: 45406
2007-12-29 19:24:06 +00:00
Chris Lattner
3b6a82118b Fold comparisons against a constant nan, and optimize ORD/UNORD
comparisons with a constant.  This allows us to compile isnan to:

_foo:
	fcmpu cr7, f1, f1
	mfcr r2
	rlwinm r3, r2, 0, 31, 31
	blr 

instead of:

LCPI1_0:					;  float
	.space	4
_foo:
	lis r2, ha16(LCPI1_0)
	lfs f0, lo16(LCPI1_0)(r2)
	fcmpu cr7, f1, f0
	mfcr r2
	rlwinm r3, r2, 0, 31, 31
	blr 

llvm-svn: 45405
2007-12-29 08:37:08 +00:00
Chris Lattner
33de0c6e92 this xform is implemented.
llvm-svn: 45404
2007-12-29 08:19:39 +00:00
Christopher Lamb
b053b80b79 Disable null pointer folding transforms for non-generic address spaces. This should probably be a target-specific predicate based on address space. That way for targets where this isn't applicable the predicate can be optimized away.
llvm-svn: 45403
2007-12-29 07:56:53 +00:00
Chris Lattner
2de9b85297 make sure not to zap volatile stores, thanks a lot to Dale for noticing this!
llvm-svn: 45402
2007-12-29 07:15:45 +00:00
Chris Lattner
07ccbfa64a Codegen:
as:

_bar:
	pushl	%esi
	subl	$8, %esp
	movl	16(%esp), %esi
	call	L_foo$stub
	fstps	(%esi)
	addl	$8, %esp
	popl	%esi
	#FP_REG_KILL
	ret

instead of:

_bar:
	pushl	%esi
	subl	$8, %esp
	movl	16(%esp), %esi
	call	L_foo$stub
	fstpl	(%esi)
	cvtsd2ss	(%esi), %xmm0
	movss	%xmm0, (%esi)
	addl	$8, %esp
	popl	%esi
	#FP_REG_KILL
	ret

llvm-svn: 45401
2007-12-29 06:57:38 +00:00
Chris Lattner
5919b48fe9 don't fold fp_round(fp_extend(load)) -> fp_round(extload)
llvm-svn: 45400
2007-12-29 06:55:23 +00:00
Chris Lattner
8013bd339b avoid going through a stack slot to convert from fpstack to xmm reg
if we are just going to store it back anyway.  This improves things 
like:
double foo();
void bar(double *P) { *P = foo(); }

llvm-svn: 45399
2007-12-29 06:41:28 +00:00
Chris Lattner
3f9c6a7260 Delete a store whose input is a load from the same pointer:
x = load p
  store x -> p

llvm-svn: 45398
2007-12-29 06:26:16 +00:00
Chris Lattner
62ba67c0f7 add a note
llvm-svn: 45397
2007-12-29 05:51:58 +00:00
Christopher Lamb
c5fafa211a Fix OCUVector case in struct layout code.
llvm-svn: 45396
2007-12-29 05:10:55 +00:00
Christopher Lamb
d91c3d4926 Enable CodeGen for member expressions based on call expressions returning aggregate types. This enables expressions like 'foo().member.submember'.
llvm-svn: 45395
2007-12-29 05:02:41 +00:00
Christopher Lamb
fd9af54ad1 Make MemberExpr code safe w.r.t. address spaces.
llvm-svn: 45394
2007-12-29 04:06:57 +00:00
Chris Lattner
7cafd92aa9 expand note.
llvm-svn: 45393
2007-12-29 01:05:01 +00:00
Chris Lattner
e96658392d dead calls to llvm.stacksave can be deleted, even though they
have potential side-effects.

llvm-svn: 45392
2007-12-29 00:59:12 +00:00
Chris Lattner
bc03f70a07 upgrade this test
llvm-svn: 45391
2007-12-29 00:57:06 +00:00
Christopher Lamb
ad66035921 Fix an error in the base/idx accessors for ArraySubscriptExpr's that crops up with vector element access.
llvm-svn: 45390
2007-12-28 23:43:03 +00:00
Devang Patel
b57ff068cd Test -simplifycfg only.
llvm-svn: 45389
2007-12-28 22:59:48 +00:00
Chris Lattner
9d53b611d1 add a note.
llvm-svn: 45388
2007-12-28 22:30:05 +00:00
Chris Lattner
d798002401 add a note.
llvm-svn: 45387
2007-12-28 21:50:40 +00:00
Owen Anderson
3de3f9981e Add a testcase for my recent InstCombine fix, written by Nicholas.
llvm-svn: 45386
2007-12-28 21:08:43 +00:00
Owen Anderson
7363914ef7 Repair a transform that Chris noticed a bug in. Thanks to Nicholas for pointing out my stupid mistakes when writing this patch. :-)
llvm-svn: 45384
2007-12-28 07:42:12 +00:00
Chris Lattner
5179819beb disable this instcombine xform, it miscompiles:
define i32 @main() {
entry:
	%z = alloca i32		; <i32*> [#uses=2]
	store i32 0, i32* %z
	%tmp = load i32* %z		; <i32> [#uses=1]
	%sub = sub i32 %tmp, 1		; <i32> [#uses=1]
	%cmp = icmp ult i32 %sub, 0		; <i1> [#uses=1]
	%retval = select i1 %cmp, i32 1, i32 0		; <i32> [#uses=1]
	ret i32 %retval
}

into ret 1, instead of ret 0.

Christopher, please investigate.

llvm-svn: 45383
2007-12-28 06:24:31 +00:00
Chris Lattner
7ef31d3c53 various cleanups. Use IgnoreParenCasts instead of inlined versions.
llvm-svn: 45382
2007-12-28 05:38:24 +00:00
Chris Lattner
934edb210a unindent cases in a switch stmt, no functionality change.
llvm-svn: 45381
2007-12-28 05:31:15 +00:00
Chris Lattner
0846494750 Change Sema::ActOnCallExpr to construct the CallExpr early and put it into
and OwningPtr instead of constructing only after all of sema is done.  This
has a couple of effects:
1. it fixes memory leaks from all the error cases in sema
2. it simplifies the code significantly.

The cost of this is that the error case now new's and delete's an expr where
it did not before, but we don't care about the perf of the error case.

llvm-svn: 45380
2007-12-28 05:29:59 +00:00
Chris Lattner
6420345a34 move file to proper place in project.
llvm-svn: 45379
2007-12-28 05:27:01 +00:00
Chris Lattner
e4407ede20 Add accessors + iterator interface.
llvm-svn: 45378
2007-12-28 05:25:02 +00:00
Chris Lattner
180f0e9044 add a note
llvm-svn: 45377
2007-12-28 04:42:05 +00:00
Chris Lattner
02ac5e87e0 From Lucas Newman:
"Here's a tiny patch that lets the clang Xcode project build in any 
location, so llvm doesn't have to be checked out in your home folder."

llvm-svn: 45376
2007-12-28 00:38:23 +00:00
Anton Korobeynikov
4f00f531ad Ignore functions with internal linkages during linking. This snipped mimics the
behaviour of LinkGlobals() function.

llvm-svn: 45375
2007-12-27 23:21:57 +00:00
Chris Lattner
20bc6e06cd add a file I forgot to svn add.
llvm-svn: 45374
2007-12-27 21:46:27 +00:00
Chris Lattner
cc10d93dcf alphabetize in project.
llvm-svn: 45373
2007-12-27 20:59:50 +00:00
Chris Lattner
807979824e use -emit-llvm-bc
llvm-svn: 45372
2007-12-27 20:35:58 +00:00
Chris Lattner
40ad6cd854 no need to verify this, no errors/warnings are expected.
llvm-svn: 45371
2007-12-27 20:31:56 +00:00
Chris Lattner
11221033be Fix a crash on a top-level objc string, patch by Nico Weber
llvm-svn: 45370
2007-12-27 20:29:42 +00:00
Gordon Henriksen
05568bbd98 Adding bindings for target triple and data layout.
llvm-svn: 45369
2007-12-27 20:13:47 +00:00
Chris Lattner
5e530bcee3 - Use Tok.isObjCAtKeyword instead of Tok.getIdentifierInfo()->getObjCKeywordID().
The later fails if the token is not an identifier.
 - Replace tabs with spaces.
 - Various other cleanups.

Patch by Nico Weber!

llvm-svn: 45368
2007-12-27 19:57:00 +00:00
Gordon Henriksen
823f9730d7 Switch the bindings to use LLVMFoldingBuilder.
llvm-svn: 45367
2007-12-27 18:25:59 +00:00
Gordon Henriksen
d4749de856 Adding an uninitialized builder constructor to the Ocaml bindings.
llvm-svn: 45362
2007-12-26 21:21:51 +00:00
Anders Carlsson
c9d41e7d27 No need to do work that the folding builder does for us.
llvm-svn: 45361
2007-12-26 18:20:19 +00:00
Chris Lattner
bc13df19a8 one fewer uncond branch with my codegenprepare hack for single-mbb backedges.
llvm-svn: 45360
2007-12-26 17:23:47 +00:00
Seo Sanghyeon
acb00f4a73 Remove broken assert from CodeGen. Better check is done in Sema.
llvm-svn: 45358
2007-12-26 05:21:37 +00:00
Gordon Henriksen
d89e645c38 Tests for changes made in r45356, where IPO optimizations would drop
collector algorithms.

llvm-svn: 45357
2007-12-26 02:47:37 +00:00
Gordon Henriksen
520e64c0c2 Fixing several transforms which would drop the collector attribute
when copying functions.

llvm-svn: 45356
2007-12-25 22:16:06 +00:00
Chris Lattner
bea11173f5 update to llvm 2.0 syntax.
llvm-svn: 45355
2007-12-25 20:34:52 +00:00
Chris Lattner
ef1bbfc762 Don't break critical edges for single-bb loops, this helps with PR1877, though
it is only a partial fix.  This change is noise for most programs, but
speeds up Shootout-C++/matrix by 20%, Ptrdist/ks by 24%, smg2000 by 8%,
hexxagon by 9%, bzip2 by 9% (not sure I trust this), ackerman by 13%, etc.

OTOH, it slows down Shootout/fib2 by 40% (I'll update PR1877 with this info).

llvm-svn: 45354
2007-12-25 19:06:45 +00:00
Seo Sanghyeon
d42a60baa0 Actually parse q operation in llvm-ar
llvm-svn: 45353
2007-12-25 13:53:47 +00:00
Gordon Henriksen
f23d2a59c5 Disabling -g for ocaml builds; it's not downwards compatible.
llvm-svn: 45352
2007-12-25 08:37:43 +00:00
Gordon Henriksen
b969c5981b GC poses hazards to the inliner. Consider:
define void @f() {
            ...
            call i32 @g()
            ...
    }

    define void @g() {
            ...
    }

The hazards are:

  - @f and @g have GC, but they differ GC. Inlining is invalid. This
    may never occur.
  - @f has no GC, but @g does. g's GC must be propagated to @f.

The other scenarios are safe:

  - @f and @g have the same GC.
  - @f and @g have no GC.
  - @g has no GC.

This patch adds inliner checks for the former two scenarios.

llvm-svn: 45351
2007-12-25 03:10:07 +00:00
Gordon Henriksen
fb56bde933 Noting and enforcing that GC intrinsics are valid only within a
function with GC.

This will catch the error when the inliner inlines a function with
GC into a caller with no GC.

llvm-svn: 45350
2007-12-25 02:31:26 +00:00
Gordon Henriksen
9157c499fc Adjusting verification of "llvm.gc*" intrinsic prototypes to match
LangRef.

llvm-svn: 45349
2007-12-25 02:02:10 +00:00
Christopher Lamb
2b84813441 Make output files binary mode for -emit-llvm-bc
llvm-svn: 45348
2007-12-24 23:49:33 +00:00
Owen Anderson
bccb8c432d Flesh out the Briggs implementation a little bit more, fix a few FIXMEs.
llvm-svn: 45347
2007-12-24 22:12:23 +00:00
Christopher Lamb
d01dea749e Almost the best possible handling of stdin/stdout for llvm-emit-bc!
llvm-svn: 45346
2007-12-24 20:59:36 +00:00
Christopher Lamb
1c0f5d2436 Better handing of stdin/stdout for -emit-llvm-bc
llvm-svn: 45345
2007-12-24 20:56:07 +00:00
Chris Lattner
62a806d565 add a -backedge-hack llc-beta option to codegenprepare.
When specified, don't split backedges of single-bb loops.
This helps address PR1877

llvm-svn: 45344
2007-12-24 19:32:55 +00:00
Chris Lattner
6c234bf58f add a simple hack
llvm-svn: 45343
2007-12-24 19:27:46 +00:00
Anton Korobeynikov
ee6af40c95 Cygwin defines uint32_t as unsigned long. Unbreak call to std::min in this case
llvm-svn: 45342
2007-12-24 11:16:47 +00:00
Ted Kremenek
563b21b013 Added special support for stripping CRLF characters that may appear in the
output of nm.

llvm-svn: 45341
2007-12-24 08:04:39 +00:00
Christopher Lamb
5a3416409f Allow bitcode output to be redirected to stdout.
llvm-svn: 45340
2007-12-24 03:23:55 +00:00
Seo Sanghyeon
76270e6be6 Implement -emit-llvm-bc option
llvm-svn: 45339
2007-12-24 01:52:34 +00:00
Gordon Henriksen
84c7325ca1 Setting GlobalDirective in TargetAsmInfo by default rather than
providing a misleading facility. It's used once in the MIPS backend
and hardcoded as "\t.globl\t" everywhere else.

llvm-svn: 45338
2007-12-23 20:58:16 +00:00
Owen Anderson
6d070f39b8 Get rid of an unneeded #include.
llvm-svn: 45337
2007-12-23 20:34:06 +00:00
Gordon Henriksen
83097d8818 Fix some Ocaml GC errors noticed upon review.
llvm-svn: 45336
2007-12-23 17:10:23 +00:00
Gordon Henriksen
2a8cd89d03 C and Ocaml bindings for ExecutionEngine (i.e., the JIT compiler).
llvm-svn: 45335
2007-12-23 16:59:28 +00:00
Owen Anderson
e110199916 Sketch out an implementation of Briggs' copy placement algorithm.
llvm-svn: 45334
2007-12-23 15:37:26 +00:00
Owen Anderson
ef41b910e5 Add GraphTraits specializations for machine dominators.
llvm-svn: 45333
2007-12-23 15:16:46 +00:00
Seo Sanghyeon
6f1b274976 String literal in aggregate expression
llvm-svn: 45330
2007-12-23 03:11:58 +00:00
Chris Lattner
b907c3fca1 remove use of alloca.
llvm-svn: 45329
2007-12-23 01:40:15 +00:00
Anton Korobeynikov
03f8a3630d Unbreak mingw build
llvm-svn: 45328
2007-12-23 01:19:32 +00:00
Gordon Henriksen
e09a4f8515 Undo a wrong bit in that last patch.
llvm-svn: 45327
2007-12-22 23:34:26 +00:00
Gordon Henriksen
8790a22a30 Document a more robust implementation of performCustomLowering.
llvm-svn: 45326
2007-12-22 23:32:32 +00:00
Chris Lattner
00602f6105 fix some warnings. This code needs to be de-tabified :(
llvm-svn: 45325
2007-12-22 22:47:03 +00:00
Chris Lattner
91f3379660 fix strict-aliasing violation
llvm-svn: 45324
2007-12-22 22:45:38 +00:00
Chris Lattner
de272b1b63 initial code for forming an FGETSIGN node. This is disabled until
legalizer support goes in.

llvm-svn: 45323
2007-12-22 21:35:38 +00:00
Chris Lattner
afc8f13bf5 improve support for fgetsign
llvm-svn: 45322
2007-12-22 21:26:52 +00:00
Chris Lattner
efd1cddb5a Tell TargetLoweringOpt whether it is running before
or after legalize.

llvm-svn: 45321
2007-12-22 20:56:36 +00:00
Chris Lattner
843cad4df2 Add a new FGETSIGN operation, which defaults to expand on all
targets.

llvm-svn: 45320
2007-12-22 20:47:56 +00:00
Anton Korobeynikov
1b1250770c Erm, really disable :)
llvm-svn: 45319
2007-12-22 20:46:24 +00:00
Anton Korobeynikov
d34112a4ee Disable, until we'll really need it
llvm-svn: 45318
2007-12-22 20:41:12 +00:00
Gordon Henriksen
0c43064daf Fix a partial application typo.
llvm-svn: 45317
2007-12-22 19:41:30 +00:00
Gordon Henriksen
41689b52ab Use getIntrinsicID instead of looking up intrinsic prototypes. Also
fixes a bug with indirect calls. (Test case will be included with
ocaml collector patch.)

llvm-svn: 45316
2007-12-22 17:27:01 +00:00
Anton Korobeynikov
eed7c0b9f7 Unbreak build on gcc 3.x
llvm-svn: 45315
2007-12-22 14:27:49 +00:00
Anton Korobeynikov
2ffb2c9e59 Unbreak mingw build
llvm-svn: 45314
2007-12-22 14:26:49 +00:00
Evan Cheng
345a00ba05 Preliminary PIC JIT support for X86 (32-bit) / Darwin.
llvm-svn: 45313
2007-12-22 09:40:20 +00:00
Evan Cheng
db33a0211b Oops.
llvm-svn: 45312
2007-12-22 09:14:34 +00:00
Chris Lattner
74b2ab59fd implement InstCombine/shift-trunc-shift.ll. This allows
us to compile:
#include <math.h>
int t1(double d) { return signbit(d); }

into:

_t1:
	movd	%xmm0, %rax
	shrq	$63, %rax
	ret

instead of:

_t1:
	movd	%xmm0, %rax
	shrq	$32, %rax
	shrl	$31, %eax
	ret

on x86-64.

llvm-svn: 45311
2007-12-22 09:07:47 +00:00
Owen Anderson
5a4c05d047 Note what still needs doing.
llvm-svn: 45310
2007-12-22 04:59:10 +00:00
Owen Anderson
4534100765 Remove critical edge breaking. It won't be necessary as long as we are very careful when inserting copies.
llvm-svn: 45309
2007-12-22 04:50:11 +00:00
Gordon Henriksen
1621129e6b Ignoring generated files.
llvm-svn: 45308
2007-12-22 04:44:11 +00:00
Evan Cheng
f4f52dbc8c Fix JIT code emission of X86::MovePCtoStack.
llvm-svn: 45307
2007-12-22 02:26:46 +00:00
Ted Kremenek
dbc5385608 Added (incomplete) implementation of SimulEngine, a worklist-based dataflow
solver for path-sensitive, intra-procedural analysis.

llvm-svn: 45306
2007-12-22 01:43:37 +00:00
Devang Patel
7a2c66b11e If succ has succ itself as one of the predecessors then do
not merge current bb and succ even if bb's terminator is
unconditional branch to succ.

llvm-svn: 45305
2007-12-22 01:32:53 +00:00
Evan Cheng
ac134551c6 Allow JIT with non-static relocation model.
llvm-svn: 45304
2007-12-22 01:12:14 +00:00
Fariborz Jahanian
4f41b272c9 Another test case, testing a variety of objective-c type comparisons.
llvm-svn: 45302
2007-12-22 00:17:49 +00:00
Fariborz Jahanian
24e1a0bd35 Another test for objective-c's type comparison.
llvm-svn: 45301
2007-12-21 23:48:59 +00:00
Anton Korobeynikov
1e8c1308bb Fix silly typo in the FP CEP handling.
llvm-svn: 45300
2007-12-21 23:33:44 +00:00
Ted Kremenek
e7e26cd01e Converted Loc back to being of type ProgramEdge. Ultimately I believe we want
the ability to refer to the vertex set for all the vertices associated with an
edge. This will allow some nice queries over the graph, and (hopefully) will
reduce the memory footprint of SimulVertex.

llvm-svn: 45299
2007-12-21 23:23:12 +00:00
Ted Kremenek
e1d1a9479f Added preliminary implementation of SimulGraph, which represents the
intra-procedural supergraph of a path-sensitive dataflow analysis.

llvm-svn: 45298
2007-12-21 23:21:58 +00:00
Ted Kremenek
908cff9fa4 Changed "Location" from "ProgramEdge" to "ProgramEdge&" (slightly more svelt
memory representation).

llvm-svn: 45297
2007-12-21 22:57:10 +00:00
Ted Kremenek
95416706ed SimulVertex now subclasses FoldingSetNode.
llvm-svn: 45296
2007-12-21 22:41:58 +00:00
Ted Kremenek
1616945a7d Added Profile method to SimulVertex.
llvm-svn: 45295
2007-12-21 22:40:41 +00:00
Fariborz Jahanian
a7c705ddca This patch implements some of the more obscure type-checking involving
'id' quallified with protocols and static types which have categories and
inheritance which implement these protocols.

llvm-svn: 45294
2007-12-21 22:22:33 +00:00
Ted Kremenek
fda0aaf01b Updated Xcode project to be in sync with recent changes in file locations
introduced in r45292 (http://llvm.org/viewvc/llvm-project?rev=45292&view=rev)

llvm-svn: 45293
2007-12-21 21:48:31 +00:00
Ted Kremenek
bf593f81fa Directory restructing of Analysis files.
Created include/clang/Analysis/Analyses directory.
  - Moved LiveVariables.h and UninitializedValues.h into this dir.
  
Moved ExprDeclBitVector.h into Analysis/Support.

Updated all clients who use these headers to reflect the new paths.

llvm-svn: 45292
2007-12-21 21:42:19 +00:00
Ted Kremenek
f55ed782b4 Renamed file AnalysisVertex.h to SimulVertex.h
llvm-svn: 45291
2007-12-21 21:17:22 +00:00
Ted Kremenek
3d8b0d6948 Renamed class AnalysisVertex to SimulVertex
llvm-svn: 45290
2007-12-21 21:16:58 +00:00
Duncan Sands
85f26f28b9 Fix a brain fart by our beloved leader (the content
of this patch is the last line).

llvm-svn: 45289
2007-12-21 20:18:41 +00:00
Ted Kremenek
93e2031187 Fixed successor order for CFG basic blocks when handling: x && y. The bug
is best explained by illustration:

[ B2 ]
     1: x
     T: [B2.1] && ...
   Predecessors (1): B4
   Successors (2): B3 B1

Block "B3" should be the block where we evaluate "y" when "x" evaluates to
true. Previously we had the successor list reversed. Now this behavior matches
with how we handle other conditional branches.

Thanks to Nuno Lopes for reporting this problem.

llvm-svn: 45288
2007-12-21 19:49:00 +00:00
Devang Patel
505b4f1fd4 Convert opaque type when struct definition is seen.
llvm-svn: 45287
2007-12-21 19:35:28 +00:00
Duncan Sands
8c5822802e Get the verifier to check attributes on calls as well
as on functions.  Make it verify invokes and not just
ordinary calls.  As a (desired) side-effect, it is no
longer legal to have call attributes on arguments that
are being passed to the varargs part of a varargs
function (llvm-as drops them on the floor anyway).

llvm-svn: 45286
2007-12-21 19:19:01 +00:00
Duncan Sands
6a7703ed63 Make DAE not wipe out attributes on calls, and not drop
return attributes on the floor.  In the case of a call
to a varargs function where the varargs arguments are
being removed, any call attributes on those arguments
need to be dropped.  I didn't do this because I plan to
make it illegal to have such attributes (see next patch).
With this change, compiling the gcc filter2 eh test at -O0
and then running opt -std-compile-opts on it results in
a correctly working program (compiling at -O1 or higher
results in the test failing due to a problem with how we
output eh info into the IR).

llvm-svn: 45285
2007-12-21 19:16:16 +00:00
Devang Patel
016e41e8a6 Keep track of llvm struct size while adding fields.
Update addPaddingFields() interface.

llvm-svn: 45284
2007-12-21 18:43:53 +00:00
Fariborz Jahanian
56b5c96ef7 Patch to compare to objective-c static types where one or the other
(but not both) may be a protocol qualified static type.

llvm-svn: 45283
2007-12-21 17:34:43 +00:00
Nicolas Geoffray
31a2c3948e Fix unintented change from last commit
llvm-svn: 45282
2007-12-21 12:22:29 +00:00
Nicolas Geoffray
80c741e160 Enable EH for linux/ppc32 targets
llvm-svn: 45281
2007-12-21 12:19:44 +00:00
Evan Cheng
78c460c8c4 New entry.
llvm-svn: 45280
2007-12-21 01:31:58 +00:00
Evan Cheng
b54038fc29 Add a few more missing gcc builtin's.
llvm-svn: 45278
2007-12-21 01:30:39 +00:00
Fariborz Jahanian
fd6f3a2460 Test case for my last patch.
llvm-svn: 45277
2007-12-21 00:35:35 +00:00
Fariborz Jahanian
ff7d2bf255 More objective-c type analysis. This time involving objective types
of conforming protocols (or not).

llvm-svn: 45276
2007-12-21 00:33:59 +00:00
Ted Kremenek
1cf6c7aa5b Removed scoped_ptr, as its functionality is subsumed by OwningPtr.
llvm-svn: 45274
2007-12-21 00:15:29 +00:00
Ted Kremenek
b149889df6 Added class "StateVariant", a template class which serves to wrap states that
are generated by transfer functions used by the path-sensitive dataflow solver.

llvm-svn: 45273
2007-12-21 00:04:19 +00:00
Ted Kremenek
f40d2740b6 Added initial implementation of "AnalysisVertex", a class to represent a
location*state vertex in an intra-procedural, path-sensitive dataflow
supergraph.

llvm-svn: 45272
2007-12-20 23:24:55 +00:00
Fariborz Jahanian
76fcf32632 Another test for objective-c type comparison.
llvm-svn: 45271
2007-12-20 22:53:29 +00:00
Fariborz Jahanian
4368af07a7 More objective-c type checking. This time comparing objective-c known objects.
llvm-svn: 45269
2007-12-20 22:37:58 +00:00
Evan Cheng
01c7c198ee Fix JIT encoding for CMPSD as well.
llvm-svn: 45268
2007-12-20 19:57:09 +00:00
Ted Kremenek
5e2413384e Added OwningArrayPtr smart pointer class to provide an analogous class to
OwningPtr except that it works for pointers to arrays.

llvm-svn: 45266
2007-12-20 19:53:47 +00:00
Ted Kremenek
71d643f8b1 Converted uses of scoped_ptr to OwningPtr.
llvm-svn: 45265
2007-12-20 19:47:16 +00:00
Fariborz Jahanian
63b19f1b6e Patch to do type-checking for objctive-c's object types.
More is yet to come.

llvm-svn: 45263
2007-12-20 19:24:10 +00:00
Chris Lattner
1991794112 add accessor.
llvm-svn: 45262
2007-12-20 19:14:21 +00:00
Chris Lattner
63fbcdf6ca add new smart pointer for clang.
llvm-svn: 45261
2007-12-20 19:14:02 +00:00
Evan Cheng
c226ed0273 Type specification didn't match gcc's.
llvm-svn: 45260
2007-12-20 09:35:28 +00:00
Evan Cheng
f989141d30 More accurate checks for two-address constraints.
llvm-svn: 45259
2007-12-20 09:25:31 +00:00
Seo Sanghyeon
58bdfda87c Add newline
llvm-svn: 45257
2007-12-20 07:22:20 +00:00
Christopher Lamb
7d82bc46b8 Implement review feedback, including additional transforms
(icmp slt (sub A B) 1) -> (icmp sle A B)
icmp sgt (sub A B) -1) -> (icmp sge A B)

and add testcase.

llvm-svn: 45256
2007-12-20 07:21:11 +00:00
Chris Lattner
e2cf5b8c5c Add m_Zero().
llvm-svn: 45255
2007-12-20 04:47:44 +00:00
Evan Cheng
ddc9af11f0 Remove xfail. This is fixed.
llvm-svn: 45254
2007-12-20 02:25:21 +00:00
Evan Cheng
a509537e25 The physical register + virtual register joining requirement was much too strict.
llvm-svn: 45253
2007-12-20 02:23:25 +00:00
Evan Cheng
61bc51ee97 Bring back a burr scheduling heuristic that's still needed.
llvm-svn: 45252
2007-12-20 02:22:36 +00:00
Evan Cheng
26ee54eb05 Clean up previous patch: PHI uses should not prevent iv reuse if all other uses are addresses. This trades a constant multiply for one fewer iv.
llvm-svn: 45251
2007-12-20 02:20:53 +00:00
Chris Lattner
16a51da0e2 simplify this code with the new m_Zero() pattern. Make sure the select only
has a single use, and generalize it to not require N to be a constant.

llvm-svn: 45250
2007-12-20 01:56:58 +00:00
Devang Patel
c006744c38 Revert my previous check-in.
llvm-svn: 45249
2007-12-20 01:46:01 +00:00
Chris Lattner
8304df9024 Fix trivial self-infinite-recursion
llvm-svn: 45248
2007-12-20 01:38:17 +00:00
Anton Korobeynikov
dce44d87f8 More eye-candy stuff :)
llvm-svn: 45247
2007-12-20 01:30:27 +00:00
Anton Korobeynikov
5ab614824d Add iterators for child traversal.
llvm-svn: 45246
2007-12-20 01:21:50 +00:00
Bill Wendling
65c001e6bc Updated comments to reflect what "side effects" means in this situation.
llvm-svn: 45245
2007-12-20 01:08:10 +00:00
Fariborz Jahanian
134cbefba2 More objective-c typechecking stuff. This is work in progress and more patches
are due to arrive.

llvm-svn: 45244
2007-12-20 01:06:58 +00:00
Chris Lattner
6c9ffe9529 Implement codegen for ordered comparison builtins.
llvm-svn: 45243
2007-12-20 00:44:32 +00:00
Scott Michel
5f1470f03a More working CellSPU tests:
- vec_const.ll: Vector constant loads
- immed64.ll: i64, f64 constant loads

llvm-svn: 45242
2007-12-20 00:44:13 +00:00
Ted Kremenek
371efafb94 Created initial implementation of "BuildSerializer", and ASTConsumer
which serializes ASTs to a common output directory.  This ASTConsumer
is invoked using a combination of "-o" and "-serialize" from the driver.

llvm-svn: 45241
2007-12-20 00:34:58 +00:00
Ted Kremenek
62c462f9c5 Renamed "FileEntry::getDev()" to "FileEntry::getDevice()"
llvm-svn: 45240
2007-12-20 00:29:44 +00:00
Chris Lattner
2da14fb84f implement semantic analysis for __builtin_islessequal and friends.
llvm-svn: 45239
2007-12-20 00:26:33 +00:00
Devang Patel
6d279d484a Add lto version check mechanism.
llvm-svn: 45238
2007-12-20 00:24:01 +00:00
Ted Kremenek
8babe3d9c4 Added method getFileEntryForID() to SourceManager.
llvm-svn: 45237
2007-12-20 00:15:17 +00:00
Gordon Henriksen
59db63d5fc Use a module to group calling convention values, too.
llvm-svn: 45236
2007-12-20 00:13:26 +00:00
Chris Lattner
e202e6af48 simplify some code.
llvm-svn: 45235
2007-12-20 00:05:45 +00:00
Chris Lattner
43be2e6004 refactor some code that handles sema of direct function calls.
llvm-svn: 45234
2007-12-19 23:59:04 +00:00
Chris Lattner
9b65d3506e Add iterator interface to function/method parameters.
llvm-svn: 45233
2007-12-19 23:58:25 +00:00
Ted Kremenek
ca07147851 Split serialization ASTConsumers into two consumers: SingleFileSerializer and
BuildSerializer. The former serializes a single translation unit to a
corresponding .ast file. The second serializes ASTs to a common emission
direction.  The latter is not fully implemented yet.

llvm-svn: 45232
2007-12-19 23:49:37 +00:00
Ted Kremenek
96e05d4f31 Added methods createMainFileID() and createMainFileIDForMemBuffer() to
SourceManager to allow SourceManager to directly intern the MainFileID
when it is created.  Removed setMainFileID().

llvm-svn: 45231
2007-12-19 23:48:45 +00:00
Evan Cheng
e2a8ba7fec Allow iv reuse if the user is a PHI node which is in turn used as addresses.
llvm-svn: 45230
2007-12-19 23:33:23 +00:00
Gordon Henriksen
eb4ce98f98 Using modules to group enumerations in Ocaml bindings.
llvm-svn: 45229
2007-12-19 22:54:12 +00:00
Ted Kremenek
230bd918b2 Interned MainFileID within SourceManager. Since SourceManager is referenced by
both Preprocessor and ASTContext, we no longer need to explicitly pass
MainFileID around in function calls that also pass either Preprocessor or
ASTContext. This resulted in some nice cleanups in the ASTConsumers and the
driver.

llvm-svn: 45228
2007-12-19 22:51:13 +00:00
Ted Kremenek
f7bfae6b45 Typo fix.
llvm-svn: 45227
2007-12-19 22:32:34 +00:00
Gordon Henriksen
34eb6d877e Adding bindings for memory buffers and module providers. Switching
to exceptions rather than variants for error handling in Ocaml.

llvm-svn: 45226
2007-12-19 22:30:40 +00:00
Ted Kremenek
9a53275918 Added storage of the FileID of the the main source file of a translation unit
in SourceManager.

llvm-svn: 45225
2007-12-19 22:29:55 +00:00
Steve Naroff
fa5751f842 Various tweaks to the get/lookup instance/class method API's.
llvm-svn: 45224
2007-12-19 22:27:04 +00:00
Ted Kremenek
6c7807716b Removed "SourceFile" from TranslationUnit. This same information will (soon)
be available by querying the SourceManager within the ASTContext referenced by
the TranslationUnit.

llvm-svn: 45223
2007-12-19 22:24:34 +00:00
Chris Lattner
7bd082e188 Describe Nico's script for gcc interception. Patch by Nico Weber.
llvm-svn: 45222
2007-12-19 22:17:19 +00:00
Dale Johannesen
eadbf4b91c Enable EH on PPC Darwin. This basically works; there
are a couple of issues that show up with the optimizer,
but I don't think they're really EH problems.
(llvm-gcc testsuite users note:  By default the testsuite
uses the unwinding code that's built as part of your local
llvm-gcc, which does not work.  You need to trick it into
using the installed system unwinding code to get useful
results.)

llvm-svn: 45221
2007-12-19 21:54:36 +00:00
Scott Michel
5ecac82f71 CellSPU testcase, extract_elt.ll: extract vector element.
llvm-svn: 45219
2007-12-19 21:17:42 +00:00
Duncan Sands
aa31b92508 When inlining through an 'nounwind' call, mark inlined
calls 'nounwind'.  It is important for correct C++
exception handling that nounwind markings do not get
lost, so this transformation is actually needed for
correctness.

llvm-svn: 45218
2007-12-19 21:13:37 +00:00
Scott Michel
a246e09aa0 More working CellSPU test cases:
- call.ll: Function call
- ctpop.ll: Count population
- dp_farith.ll: DP arithmetic
- eqv.ll: Equivalence primitives
- fcmp.ll: SP comparisons
- fdiv.ll: SP division
- fneg-fabs.ll: SP negation, aboslute value
- int2fp.ll: Integer -> SP conversion
- rotate_ops.ll: Rotation primitives
- select_bits.ll: (a & c) | (b & ~c) bit selection
- shift_ops.ll: Shift primitives
- sp_farith.ll: SP arithmentic

llvm-svn: 45217
2007-12-19 20:50:49 +00:00
Scott Michel
098c113bc8 Two more test cases: or_ops.ll (arithmetic or operations) and vecinsert.ll
(vector insertions)

llvm-svn: 45216
2007-12-19 20:15:47 +00:00
Ted Kremenek
aff2343af3 Cleaned up "-o" option to print "-o=<path>" instead of "-o=<string>" when
doing clang --help.

llvm-svn: 45215
2007-12-19 19:50:41 +00:00
Chris Lattner
f1be288617 fix formatting
llvm-svn: 45214
2007-12-19 19:48:49 +00:00
Ted Kremenek
6c0b224011 Added "-o" option to driver. ASTConsumers will need to be gradually
rewired to utilize this option.

Renamed option --serialize-ast --serialize.

llvm-svn: 45213
2007-12-19 19:47:59 +00:00
Chris Lattner
c238331377 Add support for #pragma mark, which shouldn't warn about bogus tokens.
llvm-svn: 45212
2007-12-19 19:38:36 +00:00
Ted Kremenek
0061aeb316 Removed storing inode and device number in TranslationUnit.
Added "SourceFile" string to TranslationUnit to record corresponding
source file.

Updated serialization of TranslationUnits and logic in the driver to
correctly pass the source file information to the serializer.

llvm-svn: 45211
2007-12-19 19:27:38 +00:00
Chris Lattner
6a4f74593c fix some crazy indentation
llvm-svn: 45210
2007-12-19 19:23:28 +00:00
Steve Naroff
7e718bb3fd Soften the macro rewrite error to a warning (and change the text).
llvm-svn: 45209
2007-12-19 19:16:49 +00:00
Fariborz Jahanian
6a128ae962 Minor test twik.
llvm-svn: 45208
2007-12-19 19:07:24 +00:00
Ted Kremenek
0ec9a20bf0 Updated locations of TranslationUnit.[cpp,h] in XCode project.
Added AST/ASTConsumer.cpp to XCode project.

llvm-svn: 45206
2007-12-19 18:07:54 +00:00
Chris Lattner
2a70c95387 reenable this code, fix the testcase.
llvm-svn: 45205
2007-12-19 18:01:43 +00:00
Chris Lattner
99488aec20 disable my commit from yesterday, fixing a regression test failure.
llvm-svn: 45204
2007-12-19 17:49:45 +00:00
Fariborz Jahanian
a1e3420c49 This patch concludes implementation of dynamic objective-c type qualified by
protocol list.

llvm-svn: 45203
2007-12-19 17:45:58 +00:00
Anders Carlsson
2c26cc232f Fix the embarassing typo for real this time (- vs _), sorry about breaking the tests Steve.
llvm-svn: 45202
2007-12-19 17:43:24 +00:00
Ted Kremenek
6c3777c319 Moved generation of the name of the serialized AST file into
CreateASTSerializer.

llvm-svn: 45201
2007-12-19 17:25:59 +00:00
Steve Naroff
55cb4be8ae Emit errors when attempting to rewrite ObjC expressions that originate from a macro expansion.
We plan on fixing this and removing this restriction after the break...

llvm-svn: 45200
2007-12-19 14:32:56 +00:00
Steve Naroff
735a2716de Revert Anders r45191 commit...it broke several of the tests.
llvm-svn: 45199
2007-12-19 14:11:27 +00:00
Duncan Sands
e9d8861cdf Simplify LowerCallTo by using a callsite.
llvm-svn: 45198
2007-12-19 09:48:52 +00:00
Duncan Sands
030bce7b83 The C++ exception handling personality function wants
to know about calls that cannot throw ('nounwind'):
if such a call does throw for some reason then the
personality will terminate the program.  The distinction
between an ordinary call and a nounwind call is that
an ordinary call gets an entry in the exception table
but a nounwind call does not.  This patch sets up the
exception table appropriately.  One oddity is that
I've chosen to bracket nounwind calls with labels (like
invokes) - the other choice would have been to bracket
ordinary calls with labels.  While bracketing
ordinary calls is more natural (because bracketing
by labels would then correspond exactly to getting an
entry in the exception table), I didn't do it because
introducing labels impedes some optimizations and I'm
guessing that ordinary calls occur more often than
nounwind calls.  This fixes the gcc filter2 eh test,
at least at -O0 (the inliner needs some tweaking at
higher optimization levels).

llvm-svn: 45197
2007-12-19 07:36:31 +00:00
Scott Michel
9b834469e0 Add new immed16.ll test case, fix CellSPU errata to make test case work.
llvm-svn: 45196
2007-12-19 07:35:06 +00:00
Anders Carlsson
721f601507 Fix an embarassing typo and add some very limited support for the aligned attribute.
llvm-svn: 45195
2007-12-19 07:19:40 +00:00
Christopher Lamb
e592175f80 svn:ignore configure.out at the root level
llvm-svn: 45194
2007-12-19 06:43:23 +00:00
Christopher Lamb
6af61fab70 Change svn attributes to ignore build directories.
llvm-svn: 45193
2007-12-19 06:41:17 +00:00
Bill Wendling
b528a10e0a Modified to support comments better.
llvm-svn: 45192
2007-12-19 06:20:05 +00:00
Anders Carlsson
081f1b411d Normalize attribute names if possible so we won't have to do two strcmps for every attribute.
llvm-svn: 45191
2007-12-19 06:16:30 +00:00
Bill Wendling
ca77ecb40a Mark the "isRemat" instruction as never having side effects.
llvm-svn: 45190
2007-12-19 06:07:48 +00:00
Chris Lattner
0f8a39c793 fix broken assert.
llvm-svn: 45189
2007-12-19 05:38:06 +00:00
Chris Lattner
ea72f449fe Implement C99 6.7.5.3p1
llvm-svn: 45188
2007-12-19 05:31:29 +00:00
Chris Lattner
747359f973 fix more table abuses.
llvm-svn: 45187
2007-12-19 05:04:11 +00:00
Evan Cheng
9f06e5e2df Don't leave newly created nodes around if it turns out they are not needed.
llvm-svn: 45186
2007-12-19 01:34:38 +00:00
Ted Kremenek
f4c38c9289 Refactored inode and device number into FileEntry, and changed the
ADT storing FileEntry's in FileManager from a map to a set.

llvm-svn: 45184
2007-12-18 22:29:39 +00:00
Ted Kremenek
8c8947fb92 When serializing SourceManager, we now serialize out absolute paths
to serialized source files.

llvm-svn: 45183
2007-12-18 22:12:19 +00:00
Ted Kremenek
14020706d8 Added "GetCurrentDirectory()" to sys::Path.
llvm-svn: 45182
2007-12-18 22:07:33 +00:00
Ted Kremenek
f70d24d2ae Moved ReadBitcodeFile and EmitBitcodeFile out of TranslationUnit and made them
the standalone functions ReadASTBitcodeFile and EmitASTBitcodeFile
respectively.

llvm-svn: 45180
2007-12-18 21:44:50 +00:00
Steve Naroff
824a9d8d4b Fix serious regression with ObjcInterfaceDecl. Now that we are storing -1 to mean undefined, we need to change the respective getters from unsigned->int.
llvm-svn: 45179
2007-12-18 21:41:31 +00:00
Bill Wendling
166f746246 Add debugging info. Use the newly created "hasUnmodelledSideEffects" method.
llvm-svn: 45178
2007-12-18 21:38:04 +00:00
Ted Kremenek
25dbd71a4c Fixed broken includes introduced by recent (incomplete) patch to
TranslationUnit.

llvm-svn: 45177
2007-12-18 21:36:21 +00:00
Ted Kremenek
afb98f9c09 Moved TranslationUnit.h to include path.
llvm-svn: 45176
2007-12-18 21:34:50 +00:00
Ted Kremenek
879b75018f Moved TranslationUnit from Driver to AST library.
llvm-svn: 45175
2007-12-18 21:34:28 +00:00
Fariborz Jahanian
9f0e310861 Refactoring work. ObjcQualifiedIdType is now derived from 'Type'.
llvm-svn: 45174
2007-12-18 21:33:44 +00:00
Christopher Lamb
f00ac6dd93 Fold subtracts into integer compares vs. zero. This improves generate code for this case on X86
from
_foo:
        movl    $99, %ecx
        movl    4(%esp), %eax
        subl    %eax, %ecx
        xorl    %edx, %edx
        testl   %ecx, %ecx
        cmovs   %edx, %eax
        ret

to
_foo:
        xorl    %ecx, %ecx
        movl    4(%esp), %eax
        cmpl    $99, %eax
        cmovg   %ecx, %eax
        ret

llvm-svn: 45173
2007-12-18 21:32:20 +00:00
Anton Korobeynikov
95cc3e0e66 Support more insane CEP's in AsmPrinter (Yes, PyPy folks do really use them).
llvm-svn: 45172
2007-12-18 20:53:41 +00:00
Ted Kremenek
a51c88ccd8 Added to FileEntry a pointer to the <dev_t,ino_t> pair for the file, and
accessors to FileEntry to query these values.

llvm-svn: 45171
2007-12-18 20:45:25 +00:00
Christopher Lamb
b7016c53d1 Fix comments
llvm-svn: 45170
2007-12-18 20:33:11 +00:00
Christopher Lamb
74dbad9216 Remove an orthogonal transformation of the selection condition from my most recent submission.
llvm-svn: 45169
2007-12-18 20:30:28 +00:00
Ted Kremenek
74db04261b Added "isDirectory" method to llvm::sys::Path.
llvm-svn: 45168
2007-12-18 19:46:22 +00:00
Evan Cheng
483a969ece Fix PR1872: SrcValue and SrcValueOffset should not be used to compute load / store node id.
llvm-svn: 45167
2007-12-18 19:38:14 +00:00
Bill Wendling
7c0bea1ce9 Ignore shell scripts when doing "dsymutil" call.
llvm-svn: 45166
2007-12-18 19:21:52 +00:00
Chris Lattner
5f47cae3ce remove obviously dead uses of IncludeFile.
llvm-svn: 45165
2007-12-18 19:15:48 +00:00
Evan Cheng
78ced47a2f Also print alignment and volatileness.
llvm-svn: 45164
2007-12-18 19:06:30 +00:00
Chris Lattner
d92e71cf9a remove a dead annotation
llvm-svn: 45163
2007-12-18 19:04:24 +00:00
Ted Kremenek
3d71ad1976 Added some sectioning comments to Serialize.h.
Added additional serialization functors for use with std::foreach.

llvm-svn: 45162
2007-12-18 18:25:55 +00:00
Chris Lattner
2583a66295 add an obvious load folding missed optzn.
llvm-svn: 45161
2007-12-18 16:48:14 +00:00
Duncan Sands
3353ed09ac Rename isNoReturn to doesNotReturn, and isNoUnwind to
doesNotThrow.

llvm-svn: 45160
2007-12-18 09:59:50 +00:00
Christopher Lamb
30291f4a30 Fix typos.
llvm-svn: 45159
2007-12-18 09:45:40 +00:00
Christopher Lamb
8b09a464b4 Fold certain additions through selects (and their compares) so as to eliminate subtractions. This code is often produced by the SMAX expansion in SCEV.
This implements test/Transforms/InstCombine/2007-12-18-AddSelCmpSub.ll

llvm-svn: 45158
2007-12-18 09:34:41 +00:00
Evan Cheng
91e0fc9cb4 FIX for PR1799: When a load is unfolded from an instruction, check if it is a new node. If not, do not create a new SUnit.
llvm-svn: 45157
2007-12-18 08:42:10 +00:00
Chris Lattner
37bd2ecb11 local static vars are globals also. This fixes a testcase
reported by Seo.

llvm-svn: 45156
2007-12-18 08:16:44 +00:00
Chris Lattner
d4fc27e937 remove the loc argument to Type::isConstantSizeType, which isn't useful.
llvm-svn: 45155
2007-12-18 07:18:16 +00:00
Chris Lattner
20aad334c7 Fix the location we emit the "not a constant" error for this:
int foo() {
  typedef int x[foo()];
  static int y = sizeof(x);
}

previously we'd emit it on the typedef, which made not sense at all.

llvm-svn: 45154
2007-12-18 07:15:40 +00:00
Chris Lattner
6d2d1b67ca Fix PR1863: an assertion due to not setting a location on return from
this method.

llvm-svn: 45153
2007-12-18 07:03:30 +00:00
Chris Lattner
78e34a00f4 Fix const propagation bug.
llvm-svn: 45152
2007-12-18 07:02:56 +00:00
Evan Cheng
e2dbba5828 SelectionDAG::dump() should print SrcValue of LoadSDNode and StoreSDNode.
llvm-svn: 45151
2007-12-18 07:02:08 +00:00
Chris Lattner
9a2e3cb48d avoid confusing terminology (what is a "word"?), fix scary markup, add section to TOC.
llvm-svn: 45150
2007-12-18 06:18:21 +00:00
Chris Lattner
dcb7cc59ae Fix an nice and subtle parser bug reported by Nico Weber.
llvm-svn: 45149
2007-12-18 06:06:23 +00:00
Steve Naroff
b723564c79 Add DefaultFunctionArrayConversion() to the indirection operator in Sema::ActOnUnaryOp().
This fixes a bug Chris forwarded from Oliver Hunt...

typedef struct { char name[100]; } entry;
char f1(entry *e) { return *e->name; }

llvm-svn: 45148
2007-12-18 04:06:57 +00:00
Christopher Lamb
ac7d631ed2 Don't forget to print address space qualifiers when printing out the type table! Thanks to Gordon Henriksen for pointing this out.
llvm-svn: 45147
2007-12-18 03:49:35 +00:00
Steve Naroff
b74406ba98 Fixe bogus error for variable argument methods. Sema::ObjcGetTypeForMethodDefinition() wasn't preserving the isVariadic boolean. Another fix is to avoid synthsizing the function decl entirely, however this is a separate issue that I don't want to deal with now. Also added a FIXME to Sema::CheckFunctionCall(), which is currently emitting a bogus warning.
llvm-svn: 45146
2007-12-18 03:41:15 +00:00
Anders Carlsson
aa5c91980e Turns out the LLVMFoldingBuilder can fold InsertElement. Knowing this, we can get rid of our special casing of constants when creating vectors.
llvm-svn: 45145
2007-12-18 02:45:33 +00:00
Dale Johannesen
a56aab57e9 Testcase for preceding FE fix
llvm-svn: 45144
2007-12-18 01:58:38 +00:00
Steve Naroff
1d2538cb4d Improve how we find private method decls. This involved:
- Changed Sema::ObjcActOnStartOfMethodDef() to register the methods with the global pools.
- Changed Sema::ActOnInstanceMessage() to look in global pools (should be much less error prone).
- Added a test case to message.m (for lookup that was broken).

Misc changes while I was investigating this...

- Changed Sema::ActOnAtEnd() to call AddFactoryMethodToGlobalPool (this looked like a cut/paste error).
- Added a comment and tweaked another where I was using the first person.

llvm-svn: 45142
2007-12-18 01:30:32 +00:00
Chris Lattner
52a9e40789 add a missed case.
llvm-svn: 45141
2007-12-18 01:19:18 +00:00
Evan Cheng
a8288f4294 Remove int_x86_sse2_movl_dq. It's replaced with a string compare.
llvm-svn: 45140
2007-12-18 01:04:25 +00:00
Evan Cheng
61eacb9048 These have matching builtin's in 4.2.
llvm-svn: 45139
2007-12-18 00:52:20 +00:00
Chris Lattner
b8be97e239 introduce a new CodeGenModule::getIntrinsic method, which wraps
Intrinsic::getDeclaration, allowing much more terse code.

llvm-svn: 45136
2007-12-18 00:25:38 +00:00
Steve Naroff
2050b0d05a Add __private_extern__ keyword and recognize it. Added a FIXME to indicate there is still work to do.
llvm-svn: 45135
2007-12-18 00:16:02 +00:00
Scott Michel
8172f85e2f i32 immediate constant test case for CellSPU
llvm-svn: 45134
2007-12-17 23:45:52 +00:00
Bill Wendling
34cc217741 s/hasSideEffects/hasUnmodelledSideEffects/g
llvm-svn: 45133
2007-12-17 23:19:54 +00:00
Bill Wendling
b3d85a5d4b Add "mayHaveSideEffects" and "neverHasSideEffects" flags to some instructions. I
based what flag to set on whether it was already marked as
"isRematerializable". If there was a further check to determine if it's "really"
rematerializable, then I marked it as "mayHaveSideEffects" and created a check
in the X86 back-end similar to the remat one.

llvm-svn: 45132
2007-12-17 23:07:56 +00:00
Evan Cheng
0e179d015f Bring back int_x86_sse2_movl_dq intrinsic for backward compatibility. Make sure
it's auto-upgraded to a shufflevector instruction.

llvm-svn: 45131
2007-12-17 22:33:23 +00:00
Scott Michel
c5cccb9e60 - Restore some i8 functionality in CellSPU
- New test case: nand.ll

llvm-svn: 45130
2007-12-17 22:32:34 +00:00
Ted Kremenek
bd5362511d Modified Deserializer::ReadCStr to allow C-strings to be read into a
std::vector<char> starting from any index in the vector.

llvm-svn: 45129
2007-12-17 22:25:12 +00:00
Bill Wendling
a2401be121 LD_Fp64m should have "isRematerializable" set.
llvm-svn: 45128
2007-12-17 22:17:14 +00:00
Bill Wendling
d5477afc1b Add "hasSideEffects" method to MachineInstrInfo class.
llvm-svn: 45126
2007-12-17 21:53:30 +00:00
Fariborz Jahanian
9b482ba9ec Fixed a comment describing a function
llvm-svn: 45125
2007-12-17 21:48:49 +00:00
Chris Lattner
619e18cce2 implement HeaderMap::LookupFile. I think headermaps are done now. All that is
left is this crazy thing called "testing".

llvm-svn: 45124
2007-12-17 21:38:04 +00:00
Bill Wendling
842ddea5e4 Add MachineLICM.cpp
llvm-svn: 45123
2007-12-17 21:14:45 +00:00
Chris Lattner
9f9a619a9f implement enough helper functions to successfully dump out the
contents of the header map.  Look ma, no assumptions about input data
here (aka, corrupt header maps can't crash the compiler - crazy thought).

llvm-svn: 45122
2007-12-17 21:06:11 +00:00
Fariborz Jahanian
24cb52c9b0 Patch to implemented objective-c's dynamic object pointer qualified with
the protocol list (id<P,...> types).

llvm-svn: 45121
2007-12-17 21:03:50 +00:00
Bill Wendling
939526a930 As per feedback, revised comments to (hopefully) make the different side effect
flags clearer.

llvm-svn: 45120
2007-12-17 21:02:07 +00:00
Chris Lattner
a0943c36ed Targets.cpp is gone.
llvm-svn: 45119
2007-12-17 20:56:50 +00:00
Chris Lattner
e6a76da763 Make the insertion point with an explicit new instead of the builder.
llvm-svn: 45118
2007-12-17 20:50:59 +00:00
Ted Kremenek
a59e0064d3 Removed CFG.cpp's dependence on #including iostream.
llvm-svn: 45116
2007-12-17 19:35:20 +00:00
Devang Patel
725b73ff42 Add cast operators in LLVMFoldingBuilder.
Patch by Richard Pennington.

llvm-svn: 45115
2007-12-17 19:06:26 +00:00
Ted Kremenek
3fbeaea7ee Modified format-string checking to not emit a warning when all of the
following hold:

(1) A vprintf-like function is called that takes the argument list via a
    via_list argument.

(2) The format string is a non-literal that is the parameter value of
    the enclosing function, e.g:
    
    void logmessage(const char *fmt,...) { 
      va_list ap;
      va_start(ap,fmt);
      fprintf(fmt,ap);  // Do not emit a warning.
    }
    
In the future this special case will be enhanced to consult the "format"
attribute attached to a function declaration instead of just allowing a blank
check for all function parameters to be used as format strings to vprintf-like
functions. This will happen when more support for attributes becomes
available.

llvm-svn: 45114
2007-12-17 19:03:13 +00:00
Chris Lattner
d39b8c0269 simplify some code, using new scoped_ptr support. Fix a bug in the
cross-endianness case, where we checked the version in the wrong endianness.
Amusingly, the GCC logic that detects mixed endianness hmaps and rejects 
them is dead for this very reason.

llvm-svn: 45113
2007-12-17 18:59:44 +00:00
Chris Lattner
4d5bcd938e cleanup this code, making it more "llvm-like".
Add comments to reset indicating that it deletes its pointer.
Add a new take() method, which can be used to get the pointer
without it being deleted.

llvm-svn: 45112
2007-12-17 18:58:23 +00:00
Chris Lattner
79764a6bee Finish hooking up the scaffolding for headermaps. They can now do everything
except resolve lookups.

llvm-svn: 45111
2007-12-17 18:44:09 +00:00
Ted Kremenek
ea63b1575c Format string checker: asprintf does not pass argumnents via va_list.
llvm-svn: 45110
2007-12-17 18:38:31 +00:00
Chris Lattner
4ffe46cbdf Start reading the headermap header, drop the 'errorstr' argument to
the create method.

llvm-svn: 45109
2007-12-17 18:34:53 +00:00
Duncan Sands
b5a79d0eaa Make invokes of inline asm legal. Teach codegen
how to lower them (with no attempt made to be
efficient, since they should only occur for
unoptimized code).

llvm-svn: 45108
2007-12-17 18:08:19 +00:00
Fariborz Jahanian
77b713b5d3 Also fixed similar regression for class methods, as well as more indentations.
llvm-svn: 45107
2007-12-17 18:07:01 +00:00
Chris Lattner
8d720d083a Sink getName into DirectoryLookup to simplify the client in clang.
llvm-svn: 45106
2007-12-17 17:57:27 +00:00
Fariborz Jahanian
5f6409532b Fixed a regression caused by refactoring of some meta-data generation routines using iteratgors.
Also fixed indentation problems.

llvm-svn: 45105
2007-12-17 17:56:10 +00:00
Ted Kremenek
73e921fdf2 Fixed 80 col violation.
llvm-svn: 45104
2007-12-17 17:50:39 +00:00
Ted Kremenek
5aa66bdfd6 Added driver option -Wno-format-nonliteral to silence format string related
warnings. This flag is the inverse of to GCC's -Wformat-nonliteral option (in
the clang driver, these warnings are on by default).

Patch provided by Shantonu Sen.

llvm-svn: 45103
2007-12-17 17:50:07 +00:00
Chris Lattner
faebb62651 Unbreak -v with framework paths. Patch by Shantonu Sen.
llvm-svn: 45102
2007-12-17 17:42:26 +00:00
David Greene
71eae8a5ee GLIBCXX_DEBUG fix. std::vector<>::end() is invalidated by erase.
llvm-svn: 45101
2007-12-17 17:42:03 +00:00
David Greene
c4a80fb574 Get rid of annoying spaces.
llvm-svn: 45100
2007-12-17 17:40:29 +00:00
David Greene
2a5967b36a Fix GLIBCXX_DEBUG errors. Erase invalidates std::vector iterators
passed the erased element.

llvm-svn: 45099
2007-12-17 17:39:51 +00:00
Ted Kremenek
05821322b4 Fixed another case where sizeof() returns the size in bytes, not bits.
This parallels a previous patch (duplicate logic caused the bug to appear
in multiple locations):
 
  r44316 (http://llvm.org/viewvc/llvm-project?rev=44316&view=rev).

Patch provided by Nuno Lopes.

llvm-svn: 45098
2007-12-17 17:38:43 +00:00
Gordon Henriksen
557fb1451e Disabling a RUN line that's broken until addrspace roundtrips
through llvm-as|llvm-dis.

llvm-svn: 45097
2007-12-17 16:09:28 +00:00
Gordon Henriksen
5a3fe03784 C and Ocaml bindings for address spaces, for that burgeoning market
for Ocaml-based compilers targeting embedded devices. :)

llvm-svn: 45096
2007-12-17 16:08:32 +00:00
Chris Lattner
1587e6db01 add headermap.cpp
llvm-svn: 45095
2007-12-17 08:22:46 +00:00
Chris Lattner
44bd21b7c1 finish stubbing out support for HeaderMap. Now we just need an implementation!
llvm-svn: 45094
2007-12-17 08:17:39 +00:00
Chris Lattner
712e3873a0 refactor an better comment framework lookup code. This moves it from
HeaderSearch into DirectoryLookup, as a particular framework lookup is 
specific to the directory we are currently querying.

llvm-svn: 45093
2007-12-17 08:13:48 +00:00
Chris Lattner
f62f75895f as it turns out, frameworks and headermaps are orthogonal. Make this so in
the internal representation.  This also fixes a bug where -I foo  -F foo would
not search foo as both a normal and framework include dir.

llvm-svn: 45092
2007-12-17 07:52:39 +00:00
Chris Lattner
dd00e625d2 add a portability fixme.
llvm-svn: 45091
2007-12-17 06:51:34 +00:00
Chris Lattner
3e206b3a0e teach RemoveDuplicates about header maps.
llvm-svn: 45090
2007-12-17 06:44:29 +00:00
Chris Lattner
c4ba38ed1e Step #1 in adding headermap support to clang.
llvm-svn: 45089
2007-12-17 06:36:45 +00:00
Chris Lattner
899ff4a26d rearrange some code and make it more efficient.
llvm-svn: 45087
2007-12-17 05:59:27 +00:00
Chris Lattner
28c91c5f35 add a hack so that codegen doesn't abort on missing sema of initializers, now
we emit stuff like this:

abort on missing sema of initializers, now
we emit stuff like this:

t3.c:1:24: warning: cannot codegen this initializer yet
const char x[2][4] = { { 'a', 'b', '\0', '\0' }, { 'c', 'd', 'e', '\0' } };
                       ^~~~~~~~~~~~~~~~~~~~~~~~

This should be removed when sema is finished.

llvm-svn: 45086
2007-12-17 05:17:42 +00:00
Christopher Lamb
083bb46370 regenerate.
llvm-svn: 45085
2007-12-17 01:17:35 +00:00
Christopher Lamb
edf0788758 Change the PointerType api for creating pointer types. The old functionality of PointerType::get() has become PointerType::getUnqual(), which returns a pointer in the generic address space. The new prototype of PointerType::get() requires both a type and an address space.
llvm-svn: 45082
2007-12-17 01:12:55 +00:00
Christopher Lamb
77560fbde7 Update to use new PointerType::getUnqual() api.
llvm-svn: 45081
2007-12-17 01:11:20 +00:00
Christopher Lamb
55c6d4f22f Make it clear in the LangRef that allocation instructions only operated on the generic address space. Implement support in the verifier for ensuring this is true.
llvm-svn: 45080
2007-12-17 01:00:21 +00:00
Anders Carlsson
ca6bcae0be Start generating SSE intrinsics.
llvm-svn: 45079
2007-12-16 22:33:50 +00:00
Steve Naroff
eaaae467c7 Sema::ActOnMemberReferenceExpr() needs to perform the default conversions.
Bug and test case provided by Carl Lewis.

llvm-svn: 45078
2007-12-16 21:42:28 +00:00
Duncan Sands
56ed48036b Revert this part of r45073 until the verifier is
changed not to reject invoke of inline asm.

llvm-svn: 45077
2007-12-16 21:01:21 +00:00
Chris Lattner
2af27c202c don't violate C TBAA rules, use FloatToBits instead.
llvm-svn: 45076
2007-12-16 20:41:33 +00:00
Chris Lattner
e3b05fe31b fix a questionable cast, thanks to Mike Stump for pointing this out.
llvm-svn: 45075
2007-12-16 20:26:54 +00:00
Chris Lattner
dab6bd902e Fix the JIT encoding of cmp*ss, which aborts with this assertion currently:
X86CodeEmitter.cpp:378: failed assertion `0 && "Immediate size not set!"'

I *think* this is right, but Evan, please verify.  It also looks like
CMPSDrr and maybe others are missing this info.  Evan, plz investigate.

llvm-svn: 45074
2007-12-16 20:12:41 +00:00
Duncan Sands
8e4847ee95 Make instcombine promote inline asm calls to 'nounwind'
calls.  Remove special casing of inline asm from the
inliner.  There is a potential problem: the verifier
rejects invokes of inline asm (not sure why).  If an
asm call is not marked "nounwind" in some .ll, and
instcombine is not run, but the inliner is run, then
an illegal module will be created.  This is bad but
I'm not sure what the best approach is.  I'm tempted
to remove the check in the verifier...

llvm-svn: 45073
2007-12-16 15:51:49 +00:00
Bill Wendling
fcf2085731 Remove spurious warnings from GCC:
warning: suggest a space before ';' or explicit braces around empty  
body in 'for' statement

Patch by Mike Stump (modified slightly by yours truly).

llvm-svn: 45071
2007-12-16 09:16:12 +00:00
Owen Anderson
7b8a741189 Break local interferences in StrongPHIElimination. One step closer...
llvm-svn: 45070
2007-12-16 05:44:27 +00:00
Owen Anderson
ccb3981256 A few more comments.
llvm-svn: 45069
2007-12-16 04:07:23 +00:00
Anton Korobeynikov
ce1489e575 Define addString() and lookup() out-of-line to dissuade the C++ compiler from inlining it.
llvm-svn: 45068
2007-12-16 01:36:16 +00:00
Anton Korobeynikov
fbb9e418b5 Provide GraphTraits and DOTGraphTraits interface for Trie.
Retoss private/public stuff.
Make copy ctor and operator= private.

llvm-svn: 45067
2007-12-16 01:27:04 +00:00
Anton Korobeynikov
06e60b714b Constify graph arguments
llvm-svn: 45066
2007-12-16 00:42:19 +00:00
Chris Lattner
39911a2258 swtich to smallptrset, which is more efficient than std::set.
llvm-svn: 45065
2007-12-15 23:20:07 +00:00
Chris Lattner
d6658d932b make clang -v output more similar to gcc's -v output.
llvm-svn: 45064
2007-12-15 23:11:06 +00:00
Anton Korobeynikov
659c3f8dd1 Use references in DF iterators. This eliminates copy-ctor calls on huge objects (graphs)
llvm-svn: 45063
2007-12-15 22:23:24 +00:00
Anders Carlsson
f5f6544edc We now support all MMX intrinsics. SSE intrinsics are next.
llvm-svn: 45062
2007-12-15 21:23:30 +00:00
Chris Lattner
60a288ab19 simplify the interfaces to ProcessInputFile and InitializePreprocessor
llvm-svn: 45060
2007-12-15 20:48:40 +00:00
Duncan Sands
26d6539e70 These are more correctly called signaling NaNs.
llvm-svn: 45059
2007-12-15 17:37:40 +00:00
Evan Cheng
23d2d4dc6c Make better use of instructions that clear high bits; fix various 2-wide shuffle bugs.
llvm-svn: 45058
2007-12-15 03:00:47 +00:00
Evan Cheng
cbeec14a6f __builtin_ia32_movqv4si is now expanded to a shuffle.
llvm-svn: 45057
2007-12-15 02:54:12 +00:00
Ted Kremenek
56ba5b3931 Removed "isSizeOfExpr" mode from StmtIterator. It turned out not to be
so useful and introduced a few bugs.

llvm-svn: 45051
2007-12-15 00:39:18 +00:00
Scott Michel
0aa7133f82 Start committing working test cases for CellSPU.
llvm-svn: 45050
2007-12-15 00:38:50 +00:00
Ted Kremenek
3291844bf0 Added "mode" to StmtIterator to record if the expression being iterated
over is the subexpression of a sizeof(expression).  Different clients
will wish to handle iteration over such subexpressions differently, and can
now easily query if they are iterating over such statements using the
StmtIterator's inSizeOfExpr().

llvm-svn: 45047
2007-12-14 23:40:56 +00:00
Steve Naroff
3ce37a6b8e - Remove getInstanceMethods/getClassMethods API on ObjcInterfaceDecl, ObjcProtocolDecl, and ObjcCategoryDecl. These methods are replaced by the respective iterators on each class.
- Add getInstanceMethodForSelector to ObjcInterfaceDecl, ObjcProtocolDecl, and ObjcCatgoryDecl. This hook will do a "shallow" lookup. This is a convenience method that reducing some of the iterator usage.
- Various changes to convert all clients to the above API's...
 

llvm-svn: 45046
2007-12-14 23:37:57 +00:00
Ted Kremenek
85e45f278c Added support to StmtIterator to traverse the size expression of a VLA type
declared in a sizeof.  For example:

 sizeof(int[foo()]);

the expression "foo()" is an expression that is executed during the evaluation
of sizeof.

llvm-svn: 45043
2007-12-14 22:52:23 +00:00
Evan Cheng
9556729128 Actually, MOVPQIto64mr is a dup of MOVPQI2QImr, MOV64toPQIrm is a dup of MOVQI2PQIrm.
llvm-svn: 45041
2007-12-14 20:08:14 +00:00
Evan Cheng
e28372c0d6 Fix (mem) <-> low 64-bits of xmm bugs pointed out by David Greene. Mac OS X Leopard assembler recognizes movq.
llvm-svn: 45040
2007-12-14 19:54:07 +00:00
Duncan Sands
1202d1b1c4 Teach the interpreter to read and write memory in the
endianness of the target not of the host.  Done by the
simple expedient of reversing bytes for primitive types
if the host and target endianness don't match.  This is
correct for integer and pointer types.  I don't know if
it is correct for floating point types.

llvm-svn: 45039
2007-12-14 19:38:31 +00:00
Dale Johannesen
f7cefdd5f0 x86-32 long doubles are 4-byte aligned on the stack
for parameter passing (only for that, on Darwin).

llvm-svn: 45038
2007-12-14 19:25:34 +00:00
Evan Cheng
a56e6ff9a7 Fix bsf / bsr jit encoding.
llvm-svn: 45037
2007-12-14 18:49:43 +00:00
Evan Cheng
f28c810036 Oops. Forgot these.
llvm-svn: 45036
2007-12-14 18:25:34 +00:00
Anders Carlsson
4d3094a9bb Simplify the vector code. Add more shift intrinsics.
llvm-svn: 45035
2007-12-14 17:48:24 +00:00
Dan Gohman
8a332b235d Add explicit keywords, and fix a minor typo that they uncovered.
llvm-svn: 45034
2007-12-14 15:41:34 +00:00
Dan Gohman
11352df8e4 Don't redirect stderr when it isn't needed.
llvm-svn: 45033
2007-12-14 15:15:11 +00:00
Dan Gohman
6869bfc351 Fix a typo in a comment.
llvm-svn: 45032
2007-12-14 15:13:08 +00:00
Dan Gohman
4069a593cc Fix a typo in a comment.
llvm-svn: 45031
2007-12-14 15:11:58 +00:00
Dan Gohman
9d2e9e376f Fix Intel asm syntax for the bsr and bsf instructions.
llvm-svn: 45030
2007-12-14 15:10:00 +00:00
Evan Cheng
0e6408124e Fix ctlz and cttz. llvm definition requires them to return number of bits in of the src type when value is zero.
llvm-svn: 45029
2007-12-14 08:30:15 +00:00
Evan Cheng
0fcf56f8f5 Bug fix. Must also match ResNo when matching an operand with a user.
llvm-svn: 45028
2007-12-14 08:25:15 +00:00
Anders Carlsson
f924f34b6b All MMX shift instructions took a <2 x i32> vector as the shift amount parameter. Change this to be <1 x i64> instead, which matches the assembler instruction.
llvm-svn: 45027
2007-12-14 06:38:54 +00:00
Kevin
c3286e9cef IE Menu Problem...
Originally, I included CSS hacks for IE.
However, my comments before the doctype was the reason IE was running in non-strict mode.  I did not know this.
When Chris removed the comments, IE correctly went into strict mode and my IE hacks were no longer needed (the hacks were getting in the way now).
solution:
*) Make sure doctype is first on all files
*) removed all IE hacks from menu.css (since the doctype issue fixes IE)

llvm-svn: 45025
2007-12-14 05:47:49 +00:00
Evan Cheng
e9fbc3f014 Implement ctlz and cttz with bsr and bsf.
llvm-svn: 45024
2007-12-14 02:13:44 +00:00
Seo Sanghyeon
d4d8c3c717 Array subscription in aggregate expression
llvm-svn: 45023
2007-12-14 02:04:12 +00:00
Bill Wendling
cb77f04e1f Add flags to indicate that there are "never" side effects or that there "may be"
side effects for machine instructions.

llvm-svn: 45022
2007-12-14 01:48:59 +00:00
Seo Sanghyeon
3abb6d8435 Implement dereference operator in aggregate expression
llvm-svn: 45020
2007-12-14 01:09:11 +00:00
Ted Kremenek
7d9a2e119d CFG bug fix: for sizeof(expressions), don't expand the control-flow
of "expressions", since they are not really evaluated.

llvm-svn: 45015
2007-12-13 22:44:18 +00:00
Fariborz Jahanian
c47dc4f5af Patch to make ObjcQualifiedInterfaceType inherit ObjcInterfaceType
llvm-svn: 45014
2007-12-13 20:47:42 +00:00
Dan Gohman
d4551fd0a4 Make it more clear that some things that can't be done in .td files can
still be done in the LLVM code generator. And update the summary for the
X86 target.

llvm-svn: 45013
2007-12-13 20:43:47 +00:00
Steve Naroff
d78c81b6de Sema::ActOnFinishFunctionBody(): Since we no longer synthesize a FunctionDecl for each method, remove the unconditional initialization to 0 and corresponding comment.
llvm-svn: 45008
2007-12-13 18:18:56 +00:00
Ted Kremenek
2f4ab7148c Add hack to SourceManager to support missing source files during
deserialization.  Eventually this should be replaced with a lazy-reading
mechanism that only reads source files when they are needed by clients.

llvm-svn: 45007
2007-12-13 18:12:10 +00:00
Ted Kremenek
31dcdb312b Add check in the driver to see if a serialized AST file has been successfully
deserialized.

llvm-svn: 45006
2007-12-13 18:11:11 +00:00
Ted Kremenek
685dc9b56e Changed set of top-level decls from a list to a vector.
llvm-svn: 45005
2007-12-13 17:54:02 +00:00
Ted Kremenek
15ddcef648 Changed -serialize-ast to not create a temporary directory, but instead
create a .ast file in the current working directory.  This mirrors the behavior
of the -c option for gcc.  Later we should add the ability to write the
serialized file anywhere.

llvm-svn: 45004
2007-12-13 17:50:11 +00:00
Chris Lattner
60af5f3b82 Set target data layout info in module.
llvm-svn: 45003
2007-12-13 17:34:31 +00:00
Chris Lattner
69b9ea5afa typo
llvm-svn: 45002
2007-12-13 17:27:09 +00:00
Chris Lattner
2048b067a6 debug info too.
llvm-svn: 45001
2007-12-13 17:25:36 +00:00
Ted Kremenek
9f5ad6c795 Minor spelling; punctuation correction.
llvm-svn: 45000
2007-12-13 16:41:01 +00:00
Wojciech Matyjewicz
86d51b896e Make these loops follow GetGEPOperands() behavior.
Let: %q = GEP %p, X, ...
If %p is a GEP, we can chase baseptr further, only if X==0.

llvm-svn: 44999
2007-12-13 16:22:58 +00:00
Bill Wendling
a5be19d3df Grammar fix: correct ' usage.
llvm-svn: 44998
2007-12-13 09:57:40 +00:00
Evan Cheng
2011df4e39 Fix typo.
llvm-svn: 44997
2007-12-13 07:50:36 +00:00
Chris Lattner
eb13c73c36 minor cleanups
llvm-svn: 44996
2007-12-13 07:47:54 +00:00
Chris Lattner
54424ad69c add some builtins.
llvm-svn: 44995
2007-12-13 07:41:58 +00:00
Chris Lattner
13653d7668 simplify some code.
llvm-svn: 44994
2007-12-13 07:34:23 +00:00
Chris Lattner
3c1334013d Don't do integer promotions of LHS for compound shift assignment. The LHS has to be a modifiable lvalue.
llvm-svn: 44993
2007-12-13 07:28:16 +00:00
Chris Lattner
d7b5a9aa1a remove some dead styles.
llvm-svn: 44992
2007-12-13 06:55:59 +00:00
Chris Lattner
d9c10096d7 nuke hte status page.
llvm-svn: 44991
2007-12-13 06:55:02 +00:00
Chris Lattner
196a226567 add a bunch of open projects
llvm-svn: 44990
2007-12-13 06:41:15 +00:00
Ted Kremenek
136a37f1eb Updated serialization of ParmVarDecl to serialize out objcDeclQualifier.
Previously this field was serialized out in VarDecl (a parent class), but
now the field belongs to ParmVarDecl.

llvm-svn: 44989
2007-12-13 06:28:13 +00:00
Chris Lattner
a5b4965c0e split get_involved into two pages: get_started and get_involved.
llvm-svn: 44988
2007-12-13 06:20:15 +00:00
Owen Anderson
53b677e4e8 Add register pairs to the list to check for local interferences.
llvm-svn: 44987
2007-12-13 05:53:03 +00:00
Owen Anderson
1f93edd08a Remove ugly and horrible code. It's not necessary for correctness, and can be added back later if it causes code quality issues.
llvm-svn: 44986
2007-12-13 05:43:37 +00:00
Chris Lattner
8610d2de02 wrap to 80 cols, many fixes to markup.
llvm-svn: 44985
2007-12-13 05:42:27 +00:00
Ted Kremenek
3a742d280c For uninitialized values analysis, added special treatment for declarations
of array types.  For things like:

  char x[10];
  
we should treat "x" as being initialized, because the variable "x" really
refers to the memory block of the array. Clearly x[1] is uninitialized, but
expressions like "(char*) x" really do refer to an initialized value. This
simple dataflow analysis does not reason about the contents of arrays.

This fixes: PR 1859 (http://llvm.org/bugs/show_bug.cgi?id=1859)

llvm-svn: 44984
2007-12-13 05:14:22 +00:00
Chris Lattner
2fe0dd09b3 Fix file header.
llvm-svn: 44983
2007-12-13 05:02:35 +00:00
Ted Kremenek
78dcda6059 Fixed bug in live-variable analysis and uninitialized-values analysis where
we incorrectly examine the expression within a sizeof() for use in computing
dataflow values.

This fixes: PR 1858 (http://llvm.org/bugs/show_bug.cgi?id=1858)

llvm-svn: 44982
2007-12-13 04:47:15 +00:00
Evan Cheng
37c36ed79a Be extra careful with extension use optimation. Now turned on by default.
llvm-svn: 44981
2007-12-13 03:32:53 +00:00
Nate Begeman
23ffde507f Apply CBE/MSIL patch to autoconf
llvm-svn: 44980
2007-12-13 02:24:45 +00:00
Nate Begeman
938d8cb8d9 Add install-libs target which only installs libraries, not tools
llvm-svn: 44979
2007-12-13 02:17:17 +00:00
Chris Lattner
52a6f82d0f use new interface.
llvm-svn: 44978
2007-12-13 02:05:09 +00:00
Zhou Sheng
461d8419a7 Remove this testcase as it will always fail on
platform like Darwin.

llvm-svn: 44977
2007-12-13 02:03:57 +00:00
Chris Lattner
67671ed4b7 add a helper method.
llvm-svn: 44976
2007-12-13 01:59:49 +00:00
Devang Patel
527048247b Add assert to detect incomplete implementation work.
llvm-svn: 44974
2007-12-13 01:24:16 +00:00
Nate Begeman
272ee458cf Do not build CBackend and MSIL regardless of configured targets
llvm-svn: 44973
2007-12-13 01:18:52 +00:00
Fariborz Jahanian
885890a47a Moved ObjcDeclQualifier to ParmVarDecl from VarDecl.
Ted, this change necessitates (de)/serialization of ParmVarDecl.

llvm-svn: 44972
2007-12-13 00:54:18 +00:00
Evan Cheng
827d30db19 Fold some and + shift in x86 addressing mode.
llvm-svn: 44970
2007-12-13 00:43:27 +00:00
Evan Cheng
687567bca5 Oops. Forgot these.
llvm-svn: 44969
2007-12-13 00:42:35 +00:00
Chris Lattner
70efff25be builtin id 0 is invalid, don't use a slot for it.
llvm-svn: 44968
2007-12-13 00:38:03 +00:00
Ted Kremenek
ce8d55b087 Implemented -serialize-ast option for the driver. This is not really tested
and is a work in progress.

llvm-svn: 44967
2007-12-13 00:37:31 +00:00
Fariborz Jahanian
56637d127f Fixed test to match the new diagnostic text.
llvm-svn: 44966
2007-12-13 00:16:34 +00:00
Chris Lattner
f0fbf077d2 Fix for edge profiling, patch by 'Marc' for PR1857
llvm-svn: 44965
2007-12-13 00:04:46 +00:00
Fariborz Jahanian
4d1288a67e Concatenation of objc strings.
llvm-svn: 44964
2007-12-12 23:55:49 +00:00
Chris Lattner
b8bd2db8b3 fix off-by-one error.
llvm-svn: 44963
2007-12-12 23:46:36 +00:00
Ted Kremenek
8fdd3d95eb Implemented prototype mode where the driver can operate on serialized ASTs
instead of source files.

llvm-svn: 44962
2007-12-12 23:41:08 +00:00
Evan Cheng
7df585d9c4 Cosmetic change.
llvm-svn: 44961
2007-12-12 23:15:59 +00:00
Evan Cheng
6e68381e02 Implicit def instructions, e.g. X86::IMPLICIT_DEF_GR32, are always re-materializable and they should not be spilled.
llvm-svn: 44960
2007-12-12 23:12:09 +00:00
Duncan Sands
fde556745b Remove host endianness info from TargetData and
put it in a new header System/Host.h instead.
Instead of getting the endianness from configure,
calculate it directly.

llvm-svn: 44959
2007-12-12 23:03:45 +00:00
Ted Kremenek
1daa3cfbae TargetInfo no longer includes a reference to SourceManager.
Moved all clients of Diagnostics to use FullSourceLoc instead of SourceLocation.
Added many utility methods to FullSourceLoc to provide shorthand for:

    FullLoc.getManager().someMethod(FullLoc.getLocation());
    
instead we have:

    FullLoc.someMethod();
    
Modified TextDiagnostics (and related classes) to use this short-hand.

llvm-svn: 44957
2007-12-12 22:39:36 +00:00
Steve Naroff
f44cb63859 Encode enumeral types.
llvm-svn: 44956
2007-12-12 22:30:11 +00:00
Dan Gohman
015982aa32 Remove a forward-declaration for a non-existant class.
llvm-svn: 44955
2007-12-12 22:25:09 +00:00
Dan Gohman
7a7742c2fe Allow vector integer constants to be created with
SelectionDAG::getConstant, in the same way as vector floating-point
constants. This allows the legalize expansion code for @llvm.ctpop and
friends to be usable with vector types.

llvm-svn: 44954
2007-12-12 22:21:26 +00:00
Ted Kremenek
9b7632eef8 Removed "NULL" from default construction of FullSourceLoc (compilation errors on
some systems).

llvm-svn: 44953
2007-12-12 19:39:40 +00:00
Anton Korobeynikov
7ab71379b6 Use vector for child storage instead of map. This will also make
our life during future GraphTraits'ing slightly easier.

llvm-svn: 44952
2007-12-12 19:08:44 +00:00
Ted Kremenek
f82942d04c constified getFullLoc().
llvm-svn: 44951
2007-12-12 18:55:29 +00:00
Ted Kremenek
febe89a6da Changes to FullSourceLoc:
- Added cstor that takes no arguments to create an "invalid" location.
  - Removed non-const version of getSourceManager().
  - Renamed getSourceManager() to getManager.
  - Remover operator SourceLocatio().

llvm-svn: 44950
2007-12-12 18:54:21 +00:00
Ted Kremenek
50d23f007f Renamed getFullSourceLoc() -> getFullLoc().
llvm-svn: 44949
2007-12-12 18:46:37 +00:00
Ted Kremenek
d8bcfe27cc Added method: Preprocessor::getFullSourceLoc. Used by clients of Preprocessor
to get a FullSourceLoc from a SourceLocation.

llvm-svn: 44948
2007-12-12 18:41:40 +00:00
Ted Kremenek
23e2085701 Renamed FullContextSourceLocation to FullSourceLoc.
llvm-svn: 44947
2007-12-12 18:32:04 +00:00
Ted Kremenek
8d03cf953b Added utility static method to FullContextSourceLocation
for creating "invalid" location objects.

llvm-svn: 44946
2007-12-12 18:20:34 +00:00
Chris Lattner
83021e92ba make it a bit more clear in what way the ivar is consistent.
llvm-svn: 44945
2007-12-12 18:19:52 +00:00
Chris Lattner
85332c7534 add an ivar_size() method that never returns -1.
llvm-svn: 44944
2007-12-12 18:19:33 +00:00
Ted Kremenek
ea6999a1a5 Constified a predicate method.
llvm-svn: 44943
2007-12-12 18:18:05 +00:00
Ted Kremenek
fd5e5c4704 Added class FullContextSourceLocation: a tuple class that
contains both a SourceLocation and its associated
SourceManager. This class is useful for argument passing to
functions that expect both objects.

llvm-svn: 44942
2007-12-12 18:16:46 +00:00
Chris Lattner
0f29d98419 simplify some code, bump j. This fixes the remaining test failures.
llvm-svn: 44941
2007-12-12 18:11:49 +00:00
Ted Kremenek
6f6ff37b04 Moved construction of TargetInfo objects out of the Driver
and into the "Basic" library. TargetInfo objects are now
constructed from triples by calling the static method
TargetInfo::CreateTargetInfo.

llvm-svn: 44940
2007-12-12 18:05:32 +00:00
Chris Lattner
dd2bffdd0b handle the -1'ness of undefined lists
llvm-svn: 44939
2007-12-12 18:02:31 +00:00
Chris Lattner
061227aa59 unbreak the build. I'm still working on test failures.
llvm-svn: 44938
2007-12-12 17:58:05 +00:00
Duncan Sands
9ab0943b86 Revert r44626, which turned off the use of readonly
and readnone for functions with bodies because it
broke llvm-gcc-4.2 bootstrap.  It turns out that,
because of LLVM's array_ref hack, gcc was computing
pure/const attributes wrong (now fixed by turning
off the gcc ipa-pure-const pass).

llvm-svn: 44937
2007-12-12 16:01:40 +00:00
Wojciech Matyjewicz
309e5a723b 1. "Upgrage" comments.
2. Using zero-extended value of Scale and unsigned division is safe provided
   that Scale doesn't have the sign bit set.
   Previously these 2 instructions:
        %p = bitcast [100 x {i8,i8,i8}]* %x to i8*
        %q = getelementptr i8* %p, i32 -4
   were combined into:
        %q = getelementptr [100 x { i8, i8, i8 }]* %x, i32 0,
               i32 1431655764, i32 0
   what was incorrect.

llvm-svn: 44936
2007-12-12 15:21:32 +00:00
Christopher Lamb
17c405d29e Regenerate.
llvm-svn: 44934
2007-12-12 08:45:45 +00:00
Christopher Lamb
25f5076612 Implement part of review feedback for address spaces.
llvm-svn: 44933
2007-12-12 08:44:39 +00:00
Chris Lattner
7354e6a50e fix typo
llvm-svn: 44932
2007-12-12 08:17:45 +00:00
Chris Lattner
30d23e8289 more cleanups changing things like getInstanceVariables to iterators.
llvm-svn: 44930
2007-12-12 07:56:42 +00:00
Evan Cheng
0f42730722 Use shuffles to implement insert_vector_elt for i32, i64, f32, and f64.
llvm-svn: 44929
2007-12-12 07:55:34 +00:00
Evan Cheng
0a1254f634 Add a test case for -optimize-ext-uses.
llvm-svn: 44928
2007-12-12 07:54:08 +00:00
Chris Lattner
31bc07e6cf resolve some fixmes and clean up some code by eliminating the get*Vars apis to some classes and use iterators instead.
llvm-svn: 44927
2007-12-12 07:46:12 +00:00
Chris Lattner
854f3167c0 start cleaning up interfaces for objc bits and pieces by switching to an
iterator interface.

llvm-svn: 44926
2007-12-12 07:30:05 +00:00
Chris Lattner
da463fe7c1 split objc pieces of SemaDecl.cpp out into SemaDeclObjC.cpp
llvm-svn: 44925
2007-12-12 07:09:47 +00:00
Ted Kremenek
433a492f53 Added back VisitDeclStmt() to the StmtDumper, essentially reverting r44920:
http://llvm.org/viewvc/llvm-project?rev=44920&view=rev

Putting VisitDeclStmt() was motivated because it called DumpDeclarator(),
which printed out a little bit more information than just using the
child_iterator interface to visit the subexpressions of DeclStmt. To avoid
printing the initializers twice, DumpSubTree() now specially checks for
DeclStmts; in such cases it calls VisitDeclStmt() without using the
child_iterators to visit the subexpressions.

llvm-svn: 44924
2007-12-12 06:59:42 +00:00
Chris Lattner
61511e12e0 move function to a more logical location, add its grammar productions.
llvm-svn: 44923
2007-12-12 06:56:32 +00:00
Chris Lattner
074f325746 remove todo
llvm-svn: 44922
2007-12-12 06:54:22 +00:00
Evan Cheng
2a98956796 Lower a build_vector with all constants into a constpool load unless it can be done with a move to low part.
llvm-svn: 44921
2007-12-12 06:45:40 +00:00
Ted Kremenek
ee1a988bf6 Removed VisitDeclStmt(). The initializers of a DeclStmt are now automatically
printed out by DumpSubTree() via the child_iterator interface. This fixes a
bug where the initializers were being dumped twice.

llvm-svn: 44920
2007-12-12 06:44:12 +00:00
Chris Lattner
6d513f37c9 Unbreak -stats on cocoa.h
llvm-svn: 44919
2007-12-12 06:43:05 +00:00
Chris Lattner
b011825453 add run lines.
llvm-svn: 44918
2007-12-12 06:22:14 +00:00
Chris Lattner
58c8be81bb add run line
llvm-svn: 44917
2007-12-12 06:20:40 +00:00
Chris Lattner
2fbe8e98c4 add runline, make this test real.
llvm-svn: 44916
2007-12-12 06:20:18 +00:00
Chris Lattner
e01fc281c3 verify that tests contain RUN lines.
llvm-svn: 44915
2007-12-12 06:19:22 +00:00
Zhou Sheng
3115ba39e8 Add a guard to cxxabi header as other platform may
not support it.

llvm-svn: 44914
2007-12-12 06:16:47 +00:00
Chris Lattner
840e05ba11 simplify some code.
llvm-svn: 44913
2007-12-12 06:13:27 +00:00
Chris Lattner
5c11c41203 implement correct semantic analysis for shifts. For:
int test(int x, long long y) {
  return x << y;
}

we now realize the type of the shift is int, not long long.

This fixes a fixme from june.

llvm-svn: 44912
2007-12-12 05:47:28 +00:00
Chris Lattner
2d39e07112 Simplify some code, don't force the triple to a darwin triple if non-darwin.
llvm-svn: 44911
2007-12-12 05:01:48 +00:00
Zhou Sheng
ed5d693d67 Fixed PR1629.
Make lli interpreter correctly call external functions sin()/cos(),
__cxa_guard_acquire() and __cxa_guard_release().

llvm-svn: 44910
2007-12-12 04:55:43 +00:00
Chris Lattner
b8877d9c6d typo reported by Gabor Greif
llvm-svn: 44909
2007-12-12 04:22:37 +00:00
Chris Lattner
c6208a72f7 Fix a codegen crash on test/CodeGen/cast.c, reported by Keith.
llvm-svn: 44908
2007-12-12 04:13:20 +00:00
Chris Lattner
b3ba3d9827 Fix a bug in my previous patch, thanks to Jay Foad for
pointing this out and correcting the patch!

llvm-svn: 44907
2007-12-12 03:56:54 +00:00
Chris Lattner
4ebd7c2c19 fix typo pointed out by gordon
llvm-svn: 44906
2007-12-12 03:33:41 +00:00
Evan Cheng
63d33cfd2b Don't muck with phi nodes; bug fixes.
llvm-svn: 44905
2007-12-12 02:53:41 +00:00
Scott Michel
4a8bc7e105 Correct typo for Linux: s/esp/%rsp/
llvm-svn: 44904
2007-12-12 02:38:28 +00:00
Bill Wendling
bf85dd4f61 Bit masks conflicted. Needed to bump them by one.
llvm-svn: 44903
2007-12-12 01:51:58 +00:00
Owen Anderson
499e5bffcf Forgot to remove a register from the PHI-union after I'd determined that it
interfered with other registers.  Seems like that might be a good thing to do. :-)

llvm-svn: 44902
2007-12-12 01:25:08 +00:00
Chris Lattner
47fbe949c4 fix expected errors.
llvm-svn: 44901
2007-12-12 01:15:04 +00:00
Fariborz Jahanian
27c15cca19 Add -pedantic so test passes.
llvm-svn: 44900
2007-12-12 01:06:09 +00:00
Gordon Henriksen
0a68fe2ffc Add (very basic) bindings for ModuleProvider.
llvm-svn: 44899
2007-12-12 01:04:30 +00:00
Chris Lattner
e002fbea56 Add ObjC parser support for concatenated ObjC strings. Note that
this is passed to sema and ignored there, so the second part of the
string will not make it into the AST.  Passing to Fariborz to finish
Sema + AST construction.

llvm-svn: 44898
2007-12-12 01:04:12 +00:00
Fariborz Jahanian
c98d956778 Implemented type checking for pointer of objects of protocol-qualified types.
Note that incompatible-protocol-qualified-types.m is currently failing. This is
unrelated to this patch and Steve is looking at the general problem of not reporting
incompitible pointer types in return stetement..

llvm-svn: 44897
2007-12-12 01:00:23 +00:00
Evan Cheng
7bc8942532 Bug fix. Only safe to perform extension uses optimization if the source of extension is also defined in the same BB as the extension.
llvm-svn: 44896
2007-12-12 00:51:06 +00:00
Daniel Berlin
0af43a1895 Changes from Curtis Dunham implementing lazy cycle detection algorithm.
Changes from me implementing different way of representing points-to anything.
Changes from me that improve slightly on LCD.

llvm-svn: 44895
2007-12-12 00:37:04 +00:00
Evan Cheng
6766d2fa4f If deleting a reload instruction due to reuse (value is available in register R and reload is targeting R), make sure to invalidate the kill information of the last kill.
llvm-svn: 44894
2007-12-11 23:36:57 +00:00
Ted Kremenek
fc095b1669 Moved creation of SourceManager, HeaderSearch, TargetInfo, and LangOptions
into the loop that processes input files. These will soon become translation
unit specific (with the exception of LangOptions).

llvm-svn: 44893
2007-12-11 23:28:38 +00:00
Bill Wendling
38236ef6cb Need to grow the indexed map. Added debug statements.
llvm-svn: 44892
2007-12-11 23:27:51 +00:00
Chris Lattner
f641255a86 simplify code now that isConstantExpr really does always
return a loc.

llvm-svn: 44890
2007-12-11 23:15:04 +00:00
Chris Lattner
255e1323f3 Fix a case where we'd return "is not a constant expr" without
return a location.

llvm-svn: 44889
2007-12-11 23:11:17 +00:00
Fariborz Jahanian
16e703ade5 80-column please.
llvm-svn: 44888
2007-12-11 23:04:08 +00:00
Ted Kremenek
89fbadd3be Modified the internals of Diagnostic and DiagnosticClient to use
SourceManager*'s instead of SourceManager&'s. This allows the client specify a
NULL SourceManager when using a default constructed SourceLocation. Thus the
SourceManager can be NULL when the SourceLocation's isValid() == false.

The interface to most clients of Diagnostic remains the same.
Diagnostic::Report() is overload to either accept a SourceLocation and a
SourceManager&, or neither. Thus clients that do not have a SourceManager
cannot specify a SourceLocation.

Modified TextDiagnostics* to use this new interface.
Modified the driver to not passed in SourceManager when warning about "-I-".

llvm-svn: 44887
2007-12-11 22:57:35 +00:00
Fariborz Jahanian
4e56ed5fab Implemented rewriting of protocol-qualified global variable types.
Re-implemented some of rewriting of protocol-qualified function 
argument types to support it in its generality.

llvm-svn: 44886
2007-12-11 22:50:14 +00:00
Chris Lattner
3487a3009b gcc supports more targets.
llvm-svn: 44885
2007-12-11 22:32:45 +00:00
Chris Lattner
95f80da9fb update pch discussion
llvm-svn: 44884
2007-12-11 22:29:38 +00:00
Chris Lattner
a6b103a3c3 improve title
llvm-svn: 44883
2007-12-11 22:26:03 +00:00
Chris Lattner
6931189378 add a con of clang vs gcc
llvm-svn: 44882
2007-12-11 22:22:59 +00:00
Bill Wendling
642e15a7cb Simplify slightly.
llvm-svn: 44881
2007-12-11 22:22:22 +00:00
Anton Korobeynikov
7f01ebefc6 Remove Trie::Edge class. Now edge labels are stored into nodes itself.
llvm-svn: 44880
2007-12-11 21:55:38 +00:00
Devang Patel
b37b12d102 Match union field type when member expression is u->x
llvm-svn: 44879
2007-12-11 21:33:16 +00:00
Ted Kremenek
d4e5fbacab Mega-patch: ripped SourceManager out of Diagnostic/DiagnosticClient. Now
SourceManager is passed by reference, allowing the SourceManager to be
associated with a specific translation unit, and not the entire execution
of the driver.

Modified all users of Diagnostics to comply with this new interface.

Integrated SourceManager as a member variable of TargetInfo. TargetInfo will
eventually be associated with a single translation unit (just like
SourceManager).

Made the SourceManager reference in ASTContext private. Provided accessor
getSourceManager() for clients to use instead. Modified clients to comply with
new interface.

llvm-svn: 44878
2007-12-11 21:27:55 +00:00
Owen Anderson
f24dd1c1eb More progress on StrongPHIElimination. Now we actually USE the DomForest!
llvm-svn: 44877
2007-12-11 20:12:11 +00:00
Fariborz Jahanian
c86ee9ce90 Refactor Rewritetest::RewriteObjcQualifiedInterfaceTypes in preparation for more
general use.

llvm-svn: 44876
2007-12-11 19:56:36 +00:00
Devang Patel
e3f9fa6322 Refactor bit-field handling code into a separate method.
No functionality change.

llvm-svn: 44875
2007-12-11 19:51:39 +00:00
Bill Wendling
b678ae7c38 Blark! How in the world did this work without this?!
llvm-svn: 44874
2007-12-11 19:40:06 +00:00
Bill Wendling
7717a8a37d - Update the virtual reg to machine instruction map when hoisting.
- Fix subtle bug when creating initially creating this map.

llvm-svn: 44873
2007-12-11 19:17:04 +00:00
Fariborz Jahanian
3b5dca2533 For @optional unimplemented methods do not issue the warning.
llvm-svn: 44872
2007-12-11 19:10:26 +00:00
Bill Wendling
5143d898c8 Checking for "zero operands" during the "CanHoistInst()" method isn't necessary
because those with side effects will be caught by other checks in here.

Also, simplify the check for a BB in a sub loop.

llvm-svn: 44871
2007-12-11 18:45:11 +00:00
Fariborz Jahanian
251a943ce9 Fixed a parsing bug whereby @optional/@required keyword is not followed by
a method declaration.

llvm-svn: 44870
2007-12-11 18:34:51 +00:00
Nate Begeman
6dc8b4ed13 Allow the JIT to encode MMX instructions
llvm-svn: 44869
2007-12-11 18:06:14 +00:00
Wojciech Matyjewicz
5bf9f01349 Use correct member access operator.
(my test commit as well)

llvm-svn: 44868
2007-12-11 17:46:25 +00:00
Dan Gohman
5e1f8472d2 Rename these tests to use the appropriate suffixes.
llvm-svn: 44867
2007-12-11 15:55:52 +00:00
Dan Gohman
b582867567 Use not instead of ignore when an exit status is expected to always
be non-zero.

llvm-svn: 44866
2007-12-11 15:50:23 +00:00
Dan Gohman
cfed707c12 Don't redirect stderr when it isn't needed.
llvm-svn: 44865
2007-12-11 15:41:11 +00:00
Duncan Sands
f41217d4fa Fix compilation.
llvm-svn: 44864
2007-12-11 12:20:47 +00:00
Christopher Lamb
595798f041 Update credits.
llvm-svn: 44861
2007-12-11 09:32:07 +00:00
Christopher Lamb
308121c757 Add information on address space qualifiers for pointer types and global
declarations to the LangRef.

llvm-svn: 44860
2007-12-11 09:31:00 +00:00
Christopher Lamb
e92cba4535 Regenerate.
llvm-svn: 44859
2007-12-11 09:02:08 +00:00
Christopher Lamb
54dd24c2a7 Implement address space attribute for LLVM pointer types. Address spaces are
regions of memory that have a target specific relationship, as described in the 
Embedded C Technical Report. 

This also implements the 2007-12-11-AddressSpaces test, 
which demonstrates how address space attributes can be used in LLVM IR.

In addition, this patch changes the bitcode signature for stores (in a backwards 
compatible manner), such that the pointer type, rather than the pointee type, is 
encoded. This permits type information in the pointer (e.g. address space) to be 
preserved for stores.

LangRef updates are forthcoming.

llvm-svn: 44858
2007-12-11 08:59:05 +00:00
Chris Lattner
8975f49065 mention pork
llvm-svn: 44857
2007-12-11 07:59:50 +00:00
Chris Lattner
8e6a8f984c Teach VMCore to constant fold shufflevectors with constant operands.
This allows us to compile:

#include <emmintrin.h>
typedef __m128i VSInt16;
typedef short vSInt16 __attribute__ ((__vector_size__ (16)));
VSInt16 t3() {
  return (VSInt16)((vSInt16)_mm_set1_epi16(6518));
}

into:

_t3:
	movaps	LCPI1_0, %xmm0
	ret

instead of:
_t3:
	movl	$6518, %eax
	movd	%eax, %xmm0
	pextrw	$0, %xmm0, %eax
	xorps	%xmm0, %xmm0
	pinsrw	$0, %eax, %xmm0
	punpcklwd	%xmm0, %xmm0
	pshufd	$0, %xmm0, %xmm0
	ret

llvm-svn: 44856
2007-12-11 07:49:37 +00:00
Chris Lattner
6a6b3fb62b Implement constant folding if vector<->vector bitcasts where the number
of source/dest elements changes.  This implements
test/Transforms/InstCombine/bitcast-vector-fold.ll

llvm-svn: 44855
2007-12-11 07:29:44 +00:00
Reid Spencer
0b1df1d3da Don't have APInt.cpp depend upon DerivedTypes.h. This helps with splitting the
Support libraries separately into their own module.

llvm-svn: 44852
2007-12-11 06:53:58 +00:00
Anton Korobeynikov
3d23737c5f Add first and really dirty version of generic Trie structure
llvm-svn: 44851
2007-12-11 06:53:44 +00:00
Chris Lattner
5c6399eee6 significantly simplify some code, no functionality change.
llvm-svn: 44850
2007-12-11 06:07:39 +00:00
Chris Lattner
e8ea0374ac refactor some code, no functionality change.
llvm-svn: 44849
2007-12-11 05:55:02 +00:00
Chris Lattner
29a16af8de properly namespacify.
llvm-svn: 44845
2007-12-11 04:36:28 +00:00
Chris Lattner
63ba2c06c4 fix a build issue with non-apple-gcc-4.0 compilers.
llvm-svn: 44844
2007-12-11 04:33:00 +00:00
Steve Naroff
5cace62e66 Avoid the first person in a recently added comment.
llvm-svn: 44843
2007-12-11 03:38:03 +00:00
Steve Naroff
3f1223cb06 - Tweak several tests to be compatible with my last commit.
- Add a test to message.m for an unusual case for GCC compat (as suggested by Chris).

llvm-svn: 44842
2007-12-11 03:34:41 +00:00
Anders Carlsson
f1c18350e3 Generate more builtins.
llvm-svn: 44841
2007-12-11 03:09:22 +00:00
Steve Naroff
c30dcf1251 Change err_undef_protocolref to warn_undef_protocolref (this is consistent with GCC).
llvm-svn: 44840
2007-12-11 02:44:30 +00:00
Anders Carlsson
eee7566205 Generate code for some more intrinsics.
llvm-svn: 44839
2007-12-11 02:25:54 +00:00
Evan Cheng
303417d242 Switch over to MachineLoopInfo.
llvm-svn: 44838
2007-12-11 02:09:15 +00:00
Evan Cheng
f54030231e Pretty print shuffle mask operand.
llvm-svn: 44837
2007-12-11 02:08:35 +00:00
Evan Cheng
4fbf459549 - Improved v8i16 shuffle lowering. It now uses pshuflw and pshufhw as much as
possible before resorting to pextrw and pinsrw.
- Better codegen for v4i32 shuffles masquerading as v8i16 or v16i8 shuffles.
- Improves (i16 extract_vector_element 0) codegen by recognizing
  (i32 extract_vector_element 0) does not require a pextrw.

llvm-svn: 44836
2007-12-11 01:46:18 +00:00
Nate Begeman
a55a67ae91 x86 doesn't actually want to custom lower v3i32
llvm-svn: 44835
2007-12-11 01:41:33 +00:00
Chris Lattner
11fbda2b5a Reimplement support for strings that initialize global inits now that
the types are right in sema.  Thanks Steve.

llvm-svn: 44834
2007-12-11 01:38:45 +00:00
Devang Patel
7ae82e7305 Separate access field number is not required.
llvm-svn: 44833
2007-12-11 01:23:33 +00:00
Devang Patel
113bd8be70 Beautify comment.
llvm-svn: 44831
2007-12-11 00:54:19 +00:00
Devang Patel
ab6aadb34a Add support to share llvm fields for bit-fields.
For example, struct { char a; short b:2; };

llvm-svn: 44830
2007-12-11 00:49:18 +00:00
Gordon Henriksen
7843c16f31 CollectorMetadata and Collector are rejiggered to get along with
per-function collector model. Collector is now the factory for
CollectorMetadata, so the latter may be subclassed.

llvm-svn: 44827
2007-12-11 00:30:17 +00:00
Gordon Henriksen
a87d72b102 Project file maintenance.
llvm-svn: 44826
2007-12-11 00:29:16 +00:00
Chris Lattner
2945c46e93 Move TargetData::hostIsLittleEndian out of line, which means we
don't have to #include config.h in it.  #including config.h breaks
other projects that have their own autoconf stuff and try to #include
the llvm headers.  One obscure example is llvm-gcc.

llvm-svn: 44825
2007-12-11 00:28:59 +00:00
Gordon Henriksen
2b0eed278b Adding Ocaml bindings for the bitreader as requested by Sarah
Thompson. Usage should be something like this:

open Llvm
open Llvm_bitreader

match read_bitcode_file fn with
  | Bitreader_failure msg ->
      prerr_endline msg
  | Bitreader_success m -> 
      ...;
      dispose_module m

Compile with: ocamlc llvm.cma llvm_bitreader.cma
              ocamlopt llvm.cmxa llvm_bitreader.cmxa

llvm-svn: 44824
2007-12-11 00:20:48 +00:00
Steve Naroff
f727faf2ed Explicitly set the string literal type from "char *" to "constant array of char".
At this point, I am fairly certain the front-end is correct. Unfortunately, the back-end is still unhappy.

That said, I've commented out the two lines in globalinit.c that are causing problems.

Chris, please have a look...thanks!

llvm-svn: 44823
2007-12-11 00:00:01 +00:00
Ted Kremenek
c0870605be Fixed bug in CFG::PopulateBlkExprMap where the ordering
between fetching the size of the expression map (for use as
the next integer id for an Expr*) and the creation of the
entry in the map could be non-deterministic.  This could
cause the size of the map to be incremented prior to the
index being determine.

On Linux the map entry would be created first, causing the
map to the "size" to be incremented prior to it being
queried. On Mac OS X we had the reverse behavior. Now the
size is always queried prior to the new id being inserted
into the map.

This was the real cause of the bit-overrun triggered in
PR 1847:

  http://llvm.org/bugs/show_bug.cgi?id=1847
  
Also reverted the change in patch 44813, which was a bogus
fix to this problem:

  http://llvm.org/viewvc/llvm-project?rev=44813&view=rev

llvm-svn: 44822
2007-12-10 23:58:39 +00:00
Ted Kremenek
f182e81d85 Added missing inclusion of stdarg.h. Now CGExprScalar.cpp
compiles again on Linux.

llvm-svn: 44821
2007-12-10 23:44:32 +00:00
Anton Korobeynikov
21ade5880b Hey, English is not my native language :)
llvm-svn: 44820
2007-12-10 23:10:20 +00:00
Anton Korobeynikov
77eb5e649d Clarify the need of CFI() stuff
llvm-svn: 44819
2007-12-10 23:08:35 +00:00
Anton Korobeynikov
a6b0f7e244 Provide convenient way to disable CFI stuff for old/broken assemblers.
Use it for Darwin.

llvm-svn: 44818
2007-12-10 23:04:38 +00:00
Chris Lattner
d2265b45ae Fix PR1850 by removing an unsafe transformation from VMCore/ConstantFold.cpp.
Reimplement the xform in Analysis/ConstantFolding.cpp where we can use
targetdata to validate that it is safe.  While I'm in there, fix some const
correctness issues and generalize the interface to the "operand folder".

llvm-svn: 44817
2007-12-10 22:53:04 +00:00
Steve Naroff
91f78080e3 Add support for initializing char arrays from string literals.
Adapted from a patch by Anders Carlsson.

llvm-svn: 44816
2007-12-10 22:44:33 +00:00
Ted Kremenek
9a698a1da7 Added two bounds checks to the BitVector class to detect
out-of-bounds bit accesses.  The checks are only performed
in a Debug build.

llvm-svn: 44815
2007-12-10 22:28:35 +00:00
Chris Lattner
ea9ac34d18 split isBinaryOp into a static and member version.
llvm-svn: 44814
2007-12-10 22:18:53 +00:00
Ted Kremenek
b4785e3054 Fixed off-by-one-error when resizing Bitvectors used for
dataflow analysis over expressions and decls.

This should fix bug 1847:

http://llvm.org/bugs/show_bug.cgi?id=1847

Thanks to Török Edwin for providing a test case that
identified the problem.

llvm-svn: 44813
2007-12-10 22:01:22 +00:00
John Criswell
fa06f0203b Fix some wording.
llvm-svn: 44810
2007-12-10 20:26:29 +00:00
Chris Lattner
433fb26707 add support for implicit cast from array to pointer that is not the element
type.

llvm-svn: 44809
2007-12-10 19:50:32 +00:00
Anders Carlsson
d0113e4be3 Revert change that broke the build.
llvm-svn: 44808
2007-12-10 19:46:20 +00:00
Chris Lattner
e665077f9a disable case that makes this fail.
llvm-svn: 44807
2007-12-10 19:44:50 +00:00
Anders Carlsson
b9eb82c3ee Add EmitShuffleVector helper method.
llvm-svn: 44806
2007-12-10 19:35:18 +00:00
Chuck Rose III
900a13e82c Add StringPool + new CodeGen files to win32 build
llvm-svn: 44805
2007-12-10 19:31:09 +00:00
Anders Carlsson
dc16e8f299 Address comments from Chris.
llvm-svn: 44804
2007-12-10 19:30:18 +00:00
Chris Lattner
8a72a7d586 Disable cfi directives for now, darwin does't support them.
These should probably be something like:

  CFI(".cfi_def_cfa_offset 16\n")

where CFI is defined to a noop on darwin and other platforms
that don't support those directives.

llvm-svn: 44803
2007-12-10 19:10:18 +00:00
Duncan Sands
9f76be61d1 Make PruneEH update the nounwind/noreturn attributes
on functions as it calculates them.

llvm-svn: 44802
2007-12-10 19:09:40 +00:00
Chris Lattner
456078d50d minor edits.
llvm-svn: 44801
2007-12-10 18:56:37 +00:00
Devang Patel
b3ae8d7dc2 Add assert to flag incomplete bit-field support.
llvm-svn: 44800
2007-12-10 18:52:06 +00:00
Devang Patel
3c31b54b47 Use getABITypeSizeInBits() instead of getTypeSizeInBits() during struct layout.
llvm-svn: 44799
2007-12-10 18:37:40 +00:00
Devang Patel
bb5c0d8960 Use getABITypeSizeInBits() instead of getTypeSizeInBits() during struct layout.
llvm-svn: 44798
2007-12-10 18:25:34 +00:00
Ted Kremenek
256a15d532 Added newline to end of file.
llvm-svn: 44797
2007-12-10 18:01:25 +00:00
Duncan Sands
5c65cb4633 Fix PR1836: in the interpreter, read and write apints
using the minimum possible number of bytes.  For little
endian targets run on little endian machines, apints are
stored in memory from LSB to MSB as before.  For big endian
targets on big endian machines they are stored from MSB to
LSB which wasn't always the case before (if the target and
host endianness doesn't match values are stored according
to the host's endianness).  Doing this requires knowing the
endianness of the host, which is determined when configuring -
thanks go to Anton for this.  Only having access to little
endian machines I was unable to properly test the big endian
part, which is also the most complicated...

llvm-svn: 44796
2007-12-10 17:43:13 +00:00
Chris Lattner
80c54698e8 be more clear about what we are comparing.
llvm-svn: 44795
2007-12-10 17:38:50 +00:00
Anton Korobeynikov
657be86229 And finally annotate X86-64 version of callback.
All bad stuff from SSE version is implicitely inherited :)

llvm-svn: 44794
2007-12-10 15:27:07 +00:00
Anton Korobeynikov
88e9d082d8 Provide annotation for SSE version of callback. It's even more
broken, because doesn't mark xmm regs properly

llvm-svn: 44793
2007-12-10 15:13:55 +00:00
Anton Korobeynikov
81e9dc4af7 Annotate JIT callback function with call frame infromation.
This will allow us (theoretically) to unwind through JITer.
The code wasn't verified, so I'm pretty sure offsets are wrong :)

llvm-svn: 44792
2007-12-10 14:54:42 +00:00
Duncan Sands
81b25817f9 It looks like this has been broken for some time -
get it to compile.

llvm-svn: 44791
2007-12-10 14:43:10 +00:00
Anders Carlsson
1b9853a9f8 Forgot this file.
llvm-svn: 44790
2007-12-10 08:48:18 +00:00
Chris Lattner
c3307e2418 fixes, thanks to Nico Weber
llvm-svn: 44789
2007-12-10 08:21:12 +00:00
Chris Lattner
428760a6e6 clean up the TOC.
llvm-svn: 44788
2007-12-10 08:19:29 +00:00
Chris Lattner
e396aaae28 finish the features description.
llvm-svn: 44787
2007-12-10 08:12:49 +00:00
Owen Anderson
ba61806ef1 A little more progress on StrongPHIElimination, now that I have a better sense of
how the CodeGen machinery works.

llvm-svn: 44786
2007-12-10 08:07:09 +00:00
Christopher Lamb
d202e03fe5 Improve branch folding by recgonizing that explict successor relationships impact the value of fall-through choices.
llvm-svn: 44785
2007-12-10 07:24:06 +00:00
Chris Lattner
b6a8cfea24 now with hackability.
llvm-svn: 44784
2007-12-10 07:23:52 +00:00
Chris Lattner
aa085d36e2 reorganize features, expound on a couple more.
llvm-svn: 44783
2007-12-10 07:14:08 +00:00
Chris Lattner
e404df76c0 incorporate suggestions from Joel Nelson.
llvm-svn: 44782
2007-12-10 06:01:32 +00:00
Chris Lattner
f572f3364d start making features be a more detailed description of the features/goals section on the main page.
llvm-svn: 44781
2007-12-10 05:52:05 +00:00
Chris Lattner
27a2709cfb add toc
llvm-svn: 44780
2007-12-10 05:23:01 +00:00
Chris Lattner
b072569682 don't duplicate goals on the features page.
llvm-svn: 44779
2007-12-10 05:20:47 +00:00
Chris Lattner
ab44e15ce7 update status
llvm-svn: 44778
2007-12-10 05:11:40 +00:00
Chris Lattner
fdfd014270 edits, switch the goals/why section.
llvm-svn: 44777
2007-12-10 05:10:14 +00:00
Chris Lattner
5a7359c8c2 minor edits
llvm-svn: 44776
2007-12-10 05:06:15 +00:00
Gordon Henriksen
4b904b9627 Delete the CollectorNamePool if it should become empty.
llvm-svn: 44775
2007-12-10 03:35:18 +00:00
Gordon Henriksen
dc5cafb74e Fix a typo spotted by Nick Lewycky.
llvm-svn: 44774
2007-12-10 03:30:21 +00:00
Gordon Henriksen
71183b6739 Adding a collector name attribute to Function in the IR. These
methods are new to Function:

  bool hasCollector() const;
  const std::string &getCollector() const;
  void setCollector(const std::string &);
  void clearCollector();

The assembly representation is as such:

  define void @f() gc "shadow-stack" { ...

The implementation uses an on-the-side table to map Functions to 
collector names, such that there is no overhead. A StringPool is 
further used to unique collector names, which are extremely
likely to be unique per process.

llvm-svn: 44769
2007-12-10 03:18:06 +00:00
Chris Lattner
e31cd5b564 add link to comparison page.
llvm-svn: 44763
2007-12-10 02:25:51 +00:00
Chris Lattner
609f9ccb2c Be more positive! Add to sidebar.
llvm-svn: 44762
2007-12-10 02:24:44 +00:00
Chris Lattner
10ebf4dcb1 updates.
llvm-svn: 44761
2007-12-10 02:18:15 +00:00
Gordon Henriksen
14a5569f4e Reverting dtor devirtualization patch.
_sabre_: it has a major problem: by the time ~Value is run, all of the "parts" of the derived classes have been destroyed
_sabre_: the vtable lives to fight another day

llvm-svn: 44760
2007-12-10 02:14:30 +00:00
Chris Lattner
3fbe73bef2 minor edits
llvm-svn: 44759
2007-12-10 02:05:32 +00:00
Chris Lattner
cf7cb4bbdd make more positive.
llvm-svn: 44758
2007-12-10 01:52:24 +00:00
Chris Lattner
12f9855a42 remove some dead code.
llvm-svn: 44757
2007-12-10 01:51:38 +00:00
Chris Lattner
13daba07d9 fix some warnings.
llvm-svn: 44756
2007-12-10 01:51:22 +00:00
Chris Lattner
d05f4ba524 Fix a big problem in the recent dtor refactoring work, now it passes 2007-11-19-InlineAsm.ll
llvm-svn: 44755
2007-12-10 01:48:29 +00:00
Chris Lattner
78eeea2ce9 Add a "comparing clang to other compilers" page, to help resolve some FAQ's.
llvm-svn: 44754
2007-12-10 01:44:24 +00:00
Chris Lattner
7f0ad21480 lots of this is done.
llvm-svn: 44753
2007-12-10 00:14:49 +00:00
Chris Lattner
cb04ac9599 abort when we lower an initializer to the wrong type, as we currently do for:
char text[] = "string";

llvm-svn: 44752
2007-12-10 00:05:55 +00:00
Chris Lattner
686628e052 extend or truncate the initializer for a string initializer to match its type.
llvm-svn: 44751
2007-12-10 00:00:56 +00:00
Chris Lattner
c25c42f3ca Implement codegen support for:
char text[8] = "string";

Big fixme remains.

llvm-svn: 44750
2007-12-09 23:49:42 +00:00
Anders Carlsson
92c4e44da1 Address Chris's comments.
llvm-svn: 44749
2007-12-09 23:39:18 +00:00
Anders Carlsson
895af08562 Move target specific builtin IDs to TargetBuiltins.h so that they can be used by CGBuiltin.cpp
llvm-svn: 44748
2007-12-09 23:17:02 +00:00
Gordon Henriksen
3e5be66ccb Devirtualizing Value destructor (PR889). Patch by Pawel Kunio!
llvm-svn: 44747
2007-12-09 22:46:10 +00:00
Chris Lattner
4d62f42eba Implement correct semantic analysis of subtractions, implementing
C99 6.5.6.

llvm-svn: 44746
2007-12-09 21:53:25 +00:00
Anders Carlsson
8e1d8cf241 Implement __builtin_ia32_mulps.
llvm-svn: 44745
2007-12-09 21:51:19 +00:00
Anders Carlsson
a020c43034 Generate code for target specific intrinsics.
llvm-svn: 44744
2007-12-09 21:20:04 +00:00
Chris Lattner
3ed83c1c0f The flags on tokens indicate whether they are the start of a *physical* line,
not the start of a logical line.  Be careful about this distinction, which 
affects when newlines are printed and when paste-avoidance happens, etc.  
This fixes PR1848, thanks to Neil for noticing this!

llvm-svn: 44743
2007-12-09 21:11:08 +00:00
Chris Lattner
84f450789a Fix a pretty big but subtle bug counting the number of newlines to emit.
This would cause us to emit different code (in -E mode) for these two files:

---
#define t(x) x

t(a
3)
---
#define t(x) x
t(a
3)
---

In one case, -E would print "a\n3", in the other it printed "a3".  Now
it prints "a3" for both.

This is part of PR1848.

llvm-svn: 44742
2007-12-09 20:45:43 +00:00
Chris Lattner
615315f307 Add dumping support for locations, make -dumptokens print out the location
info of each token.

llvm-svn: 44741
2007-12-09 20:31:55 +00:00
Chris Lattner
64443973c0 Duncan points out that the subtraction is unneeded since hte code
knows the vector is not pow2

llvm-svn: 44740
2007-12-09 17:56:34 +00:00
Chris Lattner
93cd101e5c Fix typo noticed by Nico Weber
llvm-svn: 44739
2007-12-09 17:50:14 +00:00
Gordon Henriksen
ad80af9677 Upgrading this test to 2.0 .ll syntax.
llvm-svn: 44738
2007-12-09 15:03:01 +00:00
Chris Lattner
7566350b74 many edits to the main page, add a prominant 'status' section.
llvm-svn: 44737
2007-12-09 09:05:23 +00:00
Chris Lattner
d93d0fc79a unindent, don't zap whitespace before/after paragraphs.
llvm-svn: 44736
2007-12-09 08:40:26 +00:00
Chris Lattner
dffc79530a simplify the menu css, make it a bit more attractive.
llvm-svn: 44735
2007-12-09 08:38:01 +00:00
Chris Lattner
fc3b9bfea8 cleanup some markup, e.g. & -> &amp;
llvm-svn: 44734
2007-12-09 08:17:09 +00:00
Chris Lattner
3f42d12072 Fix PR1782, patch by Wojtek Matyjewicz!
llvm-svn: 44733
2007-12-09 07:35:13 +00:00
Gordon Henriksen
76c5dfd7df Fix a very silly typo.
llvm-svn: 44732
2007-12-09 01:12:08 +00:00
Chris Lattner
9c4aad2dba avoid ///usr/include/foo.h, patch by Sean Middleditch
llvm-svn: 44731
2007-12-09 00:39:55 +00:00
Chris Lattner
283d094b75 implement support for functions that initialize globals.
llvm-svn: 44730
2007-12-09 00:36:01 +00:00
Chris Lattner
ad6094ddd3 Fix accidental commit by Bill.
llvm-svn: 44729
2007-12-09 00:27:38 +00:00
Chris Lattner
69d3298777 Add support for splitting the operand of a return instruction.
llvm-svn: 44728
2007-12-09 00:06:19 +00:00
Bill Wendling
3f19dfe794 Reverting 44702. It wasn't correct to rename them.
llvm-svn: 44727
2007-12-08 23:58:46 +00:00
Chris Lattner
e48fc80446 add many new cases to SplitResult. SplitResult now handles all the cases that LegalizeDAG does.
llvm-svn: 44726
2007-12-08 23:58:27 +00:00
Chris Lattner
de9046af54 Implement splitting support for store, allowing us to compile:
%f8 = type <8 x float>

define void @test_f8(%f8* %P, %f8* %Q, %f8* %S) {
	%p = load %f8* %P		; <%f8> [#uses=1]
	%q = load %f8* %Q		; <%f8> [#uses=1]
	%R = add %f8 %p, %q		; <%f8> [#uses=1]
	store %f8 %R, %f8* %S
	ret void
}

into:

_test_f8:
	movaps	16(%rdi), %xmm0
	addps	16(%rsi), %xmm0
	movaps	(%rdi), %xmm1
	addps	(%rsi), %xmm1
	movaps	%xmm0, 16(%rdx)
	movaps	%xmm1, (%rdx)
	ret

llvm-svn: 44725
2007-12-08 23:24:26 +00:00
Chris Lattner
de87224cd9 implement vector splitting of load, undef, and binops.
llvm-svn: 44724
2007-12-08 23:08:49 +00:00
Chris Lattner
1ef437d4e1 implement some methods.
llvm-svn: 44723
2007-12-08 22:40:18 +00:00
Chris Lattner
a5e7db115e add scaffolding for splitting of vectors.
llvm-svn: 44722
2007-12-08 22:37:41 +00:00
Nate Begeman
b52ad35bc4 Project cleanups
llvm-svn: 44721
2007-12-08 22:29:19 +00:00
Chris Lattner
5c62ba5fb8 Remove dead file and directory.
llvm-svn: 44720
2007-12-08 22:17:33 +00:00
Chris Lattner
8c8eaf6b92 reorganize header to separate into functional blocks.
llvm-svn: 44719
2007-12-08 21:59:32 +00:00
Chris Lattner
4063bd6eae split scalarization out to its own file.
llvm-svn: 44718
2007-12-08 20:30:28 +00:00
Chris Lattner
5c7c46baaf Split expansion out into its own file.
llvm-svn: 44717
2007-12-08 20:27:32 +00:00
Chris Lattner
029c816460 Split promotion support out to its own file.
llvm-svn: 44716
2007-12-08 20:24:38 +00:00
Chris Lattner
757d4beba9 Rename LegalizeDAGTypes.cpp -> LegalizeTypes.cpp
llvm-svn: 44715
2007-12-08 20:17:13 +00:00
Chris Lattner
92288147b6 Split the class definition of DAGTypeLegalizer out into a header.
Leave it visibility hidden, but not in an anon namespace.

llvm-svn: 44714
2007-12-08 20:16:06 +00:00
Gordon Henriksen
e33aec0dd6 Incorporating review feedback from Reid.
llvm-svn: 44713
2007-12-08 20:10:40 +00:00
Anders Carlsson
050f494f66 Add getTargetPrefix to TargetInfo, to be used with target specific intrinsics.
llvm-svn: 44712
2007-12-08 19:32:57 +00:00
Chris Lattner
abef872bc0 remove dead #include.
llvm-svn: 44711
2007-12-08 19:06:21 +00:00
Chris Lattner
d58954b040 add #include
llvm-svn: 44710
2007-12-08 19:03:30 +00:00
Chris Lattner
31e0f1af67 eliminate dependency on Bitcode headers.
llvm-svn: 44709
2007-12-08 19:01:44 +00:00
Chris Lattner
c779e00f17 remove dead #include, APInt.h already has the needed forward decls.
llvm-svn: 44708
2007-12-08 19:00:38 +00:00
Chris Lattner
e5256754e7 proper #include order.
llvm-svn: 44707
2007-12-08 19:00:03 +00:00
Gordon Henriksen
0c428fe3ec Ignoring generated files.
llvm-svn: 44706
2007-12-08 17:53:01 +00:00
Gordon Henriksen
4b41a6f529 Adding a StringPool data structure, which GC will use.
llvm-svn: 44705
2007-12-08 17:07:47 +00:00
Gordon Henriksen
05481d91be Fix bug in constructing Ocaml option types in the bindings.
llvm-svn: 44704
2007-12-08 16:55:43 +00:00
Chris Lattner
ff87f05e43 aesthetic changes, no functionality change. Evan, it's not clear
what 'Available' is, please add a comment near it and rename it
if appropriate.

llvm-svn: 44703
2007-12-08 07:22:58 +00:00
Bill Wendling
2b07d8c5a0 Renaming:
isTriviallyReMaterializable -> hasNoSideEffects
  isReallyTriviallyReMaterializable -> isTriviallyReMaterializable

llvm-svn: 44702
2007-12-08 07:17:56 +00:00
Chris Lattner
f47015bc74 Fix a significant code quality regression I introduced on PPC64 quite
a while ago.  We now produce:

_foo:
	mflr r0
	std r0, 16(r1)
	ld r2, 16(r1)
	std r2, 0(r3)
	ld r0, 16(r1)
	mtlr r0
	blr 

instead of:

_foo:
	mflr r0
	std r0, 16(r1)
	lis r0, 0
	ori r0, r0, 16
	ldx r2, r1, r0
	std r2, 0(r3)
	ld r0, 16(r1)
	mtlr r0
	blr 

for:

void foo(void **X) {
  *X = __builtin_return_address(0);
}

on ppc64.

llvm-svn: 44701
2007-12-08 07:04:58 +00:00
Chris Lattner
f6a8156e4f implement __builtin_return_addr(0) on ppc.
llvm-svn: 44700
2007-12-08 06:59:59 +00:00
Chris Lattner
a6c8297e84 refactor some code to avoid overloading the name 'usesLR' in
different places to mean different things.  Document what the
one in PPCFunctionInfo means and when it is valid.

llvm-svn: 44699
2007-12-08 06:39:11 +00:00
Chris Lattner
1ebfecc8d0 Implement correct isa<UnaryInstruction>, problem reported by "ST".
llvm-svn: 44697
2007-12-08 04:37:52 +00:00
Bill Wendling
4375173ba0 Incorporated comments from Evan and Chris:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20071203/056043.html
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20071203/056048.html

llvm-svn: 44696
2007-12-08 01:47:01 +00:00
Owen Anderson
086b2c4537 Fix several cache coherence bugs in MemDep/GVN that were found. Also add some (disabled) debugging code
to make such problems easier to diagnose in the future, written by Duncan Sands.

llvm-svn: 44695
2007-12-08 01:37:09 +00:00
Evan Cheng
92105ac0cd Doh
llvm-svn: 44694
2007-12-08 01:01:07 +00:00
Fariborz Jahanian
8ea0779624 Test case for my last patch for implementation of static protocoled type
used as reciver type of a message expression.

llvm-svn: 44693
2007-12-08 01:00:55 +00:00
Evan Cheng
cd6913627e Fix a compilation warning.
llvm-svn: 44692
2007-12-08 01:00:31 +00:00
Evan Cheng
ab87e735cd Fix a compilation warning.
llvm-svn: 44691
2007-12-08 01:00:21 +00:00
Chuck Rose III
c214d1605f Adding MachineLoopInfo.h,.cpp and MachineLICP.cpp to VStudio build
llvm-svn: 44690
2007-12-08 00:53:13 +00:00
Steve Naroff
1f6ed92dbb Omit the field name when including the super class structure template.
This allows us to access a superclasses ivars without deriving the absolute path.

The comments below say a bit more...

llvm-svn: 44688
2007-12-07 22:15:58 +00:00
Bill Wendling
fb706bc52b Initial commit of the machine code LICM pass. It successfully hoists this:
_foo:
        li r2, 0
LBB1_1: ; bb
        li r5, 0
        stw r5, 0(r3)
        addi r2, r2, 1
        addi r3, r3, 4
        cmplw cr0, r2, r4
        bne cr0, LBB1_1 ; bb
LBB1_2: ; return
        blr 

to:

_foo:
        li r2, 0
        li r5, 0
LBB1_1: ; bb
        stw r5, 0(r3)
        addi r2, r2, 1
        addi r3, r3, 4
        cmplw cr0, r2, r4
        bne cr0, LBB1_1 ; bb
LBB1_2: ; return
        blr

ZOMG!! :-)

Moar to come...

llvm-svn: 44687
2007-12-07 21:42:31 +00:00
Evan Cheng
b41d838d28 Add comment.
llvm-svn: 44686
2007-12-07 21:30:01 +00:00
Fariborz Jahanian
ff6a455c12 Implemented when static typing is combined with protocols and use as receiver
type.

llvm-svn: 44685
2007-12-07 21:21:21 +00:00
Steve Naroff
2c20c38ced Have Sema::CheckConstantInitList skip semantic analysis when the element type is a record (until we implement the FIXME). This removes a bogus error for the following code...
snarofflocal% cat bug.m

#import <Foundation/NSGeometry.h>

#define NUMHELICOPTERRECTS 5

static NSRect helicopterRects[NUMHELICOPTERRECTS] = {
    {{27, 0}, {18, 11}},	// Bottom
    {{0, 8}, {4, 11}},		// Tail
    {{0, 16}, {50, 1}},
    {{22, 5}, {18, 12}},	// Body
    {{0, 10}, {42, 3}}
};

llvm-svn: 44684
2007-12-07 21:12:53 +00:00
Steve Naroff
888f33cc44 Lookup methods in the global pool even when a statically typed object's class interface isn't in scope!
As the comment in the code indicates, I'm not fond of this. Nevertheless, gcc compat is a goal.

Here is the case I'm talking about...

#import <Foundation/Foundation.h>

@interface AnyClass : NSObject
- (NSRect)rect;
@end

@class Helicopter;

static void func(Helicopter *obj) {
  NSRect r = [obj rect];
}

...before this patch, we would warn/error. With this patch, everything "just works".

llvm-svn: 44682
2007-12-07 20:41:14 +00:00
Fariborz Jahanian
33c0e815f3 Patch for rewriting of @protocol.
llvm-svn: 44681
2007-12-07 18:47:10 +00:00
Evan Cheng
bfd373a53e Much improved v8i16 shuffles. (Step 1).
llvm-svn: 44676
2007-12-07 08:07:39 +00:00
Owen Anderson
b1d4fda856 Fix a stupid error that Chris pointed out.
llvm-svn: 44674
2007-12-07 04:04:55 +00:00
Steve Naroff
b2f8ff153d Rewrite 'super' within a class method. This required some minor tweaks to the front-end.
llvm-svn: 44673
2007-12-07 03:50:46 +00:00
Evan Cheng
26593a04db New test case.
llvm-svn: 44672
2007-12-07 01:48:46 +00:00
Evan Cheng
85cdba29b0 Add an option to control this heuristic tweak so I can test it.
llvm-svn: 44671
2007-12-07 00:28:32 +00:00
Fariborz Jahanian
2bbd03a755 Patch to implement "Protocol" as a built-in type declared as
"@class Protocol;"

llvm-svn: 44670
2007-12-07 00:18:54 +00:00
Evan Cheng
c829e5cdf0 Remove a bogus optimization. It's not possible to do a move to low element to a <8 x i16> or <16 x i8> vector.
llvm-svn: 44669
2007-12-06 22:14:22 +00:00
Evan Cheng
5cb41390ab Fix a bogus test case.
llvm-svn: 44668
2007-12-06 22:12:45 +00:00
Anders Carlsson
10c6110fca Add workaround to get test/Parser/compound_literal.c working again.
llvm-svn: 44666
2007-12-06 20:10:20 +00:00
Fariborz Jahanian
227c0d13bc On Steve's suggestion, moved handling of use of undeclared method in a message
to rewriter (my previous patch).

llvm-svn: 44665
2007-12-06 19:49:56 +00:00
Devang Patel
65a2288eef More struct bitfields layout work. Now handle,
struct STestB1 {char a; char b:2; } stb1;
struct STestB2 {char a; char b:5; char c:4} stb2;

llvm-svn: 44664
2007-12-06 19:16:05 +00:00
Dale Johannesen
5eff4de9c8 Redo previous patch so optimization only done for i1.
Simpler and safer.

llvm-svn: 44663
2007-12-06 17:53:31 +00:00
Fariborz Jahanian
6b644a6e05 test case for my very last patch.
llvm-svn: 44662
2007-12-06 17:43:04 +00:00
Chris Lattner
b36a98e9a3 Fix a bug handling typedefs of functions, patch by Nuno Lopes!
llvm-svn: 44661
2007-12-06 17:20:20 +00:00
Evan Cheng
8393dc7378 Turning simple splitting on. Start testing new coalescer heuristics as new llcbeta.
llvm-svn: 44660
2007-12-06 08:54:31 +00:00
Chris Lattner
eedaf92fcf third time around: instead of disabling this completely,
only disable it if we don't know it will be obviously profitable.
Still fixme, but less so. :)

llvm-svn: 44658
2007-12-06 07:47:55 +00:00
Chris Lattner
b5fdfb9612 Actually, disable this code for now. More analysis and improvements to
the X86 backend are needed before this should be enabled by default.

llvm-svn: 44657
2007-12-06 07:44:31 +00:00
Chris Lattner
7c709a5d08 implement a readme entry, compiling the code into:
_foo:
	movl	$12, %eax
	andl	4(%esp), %eax
	movl	_array(%eax), %eax
	ret

instead of:

_foo:
	movl	4(%esp), %eax
	shrl	$2, %eax
	andl	$3, %eax
	movl	_array(,%eax,4), %eax
	ret

As it turns out, this triggers all the time, in a wide variety of
situations, for example, I see diffs like this in various programs:

-       movl    8(%eax), %eax
-       shll    $2, %eax
-       andl    $1020, %eax
-       movl    (%esi,%eax), %eax
+       movzbl  8(%eax), %eax
+       movl    (%esi,%eax,4), %eax


-       shll    $2, %edx
-       andl    $1020, %edx
-       movl    (%edi,%edx), %edx
+       andl    $255, %edx
+       movl    (%edi,%edx,4), %edx

Unfortunately, I also see stuff like this, which can be fixed in the
X86 backend:

-       andl    $85, %ebx
-       addl    _bit_count(,%ebx,4), %ebp
+       shll    $2, %ebx
+       andl    $340, %ebx
+       addl    _bit_count(%ebx), %ebp

llvm-svn: 44656
2007-12-06 07:33:36 +00:00
Chris Lattner
d2bbbabbfb simplify some code.
llvm-svn: 44655
2007-12-06 06:25:04 +00:00
Chris Lattner
42558bf664 implement the rest of the functionality from SelectionDAGLegalize::ScalarizeVectorOp
llvm-svn: 44654
2007-12-06 05:53:43 +00:00
Chris Lattner
9bc22b4838 make it more clear what 'foo' is
llvm-svn: 44653
2007-12-06 04:20:07 +00:00
Chuck Rose III
cc2a661322 Adjust VStudio files to add JITMemoryManager files + include <cassert> from same.
llvm-svn: 44651
2007-12-06 02:03:01 +00:00
Chris Lattner
0ccb663cca move some ashr-specific code out of commonShiftTransforms into visitAShr.
llvm-svn: 44650
2007-12-06 01:59:46 +00:00
Dale Johannesen
05bbbda78a Fix PR1842.
llvm-svn: 44649
2007-12-06 01:43:46 +00:00
Fariborz Jahanian
c277f6f351 A missing method in a messaging expression issues a warning, clients must not
crash because of this.

llvm-svn: 44648
2007-12-06 01:37:55 +00:00
Chris Lattner
7f3587e344 add a new ExecutionEngine::createJIT which can be used if you only want
to create a JIT.  This lets you specify JIT-specific configuration items
like the JITMemoryManager to use.

llvm-svn: 44647
2007-12-06 01:34:04 +00:00
Chris Lattner
dc351b94f9 simplify creation of the interpreter, make ExecutionEngine ctor protected,
delete one ExecutionEngine ctor, minor cleanup.

llvm-svn: 44646
2007-12-06 01:08:09 +00:00
Chris Lattner
dfa39289a5 fix this when run on non x86 hosts.
llvm-svn: 44645
2007-12-06 01:05:52 +00:00
Evan Cheng
7fc1d98353 Fix for PR1831: if all defs of an interval are re-materializable, then it's a preferred spill candiate.
llvm-svn: 44644
2007-12-06 00:01:56 +00:00
Evan Cheng
d3d8017bcb If both result of the {s|z}xt and its source are live out, rewrite all uses of the source with result of extension.
llvm-svn: 44643
2007-12-05 23:58:20 +00:00
Ted Kremenek
260d01d6e6 Subdivided the function InitializeBaseLanguage into InitializeBaseLanguage,
GetLanguage, and InitializeLangOptions.  The goal is to break up this logic
into atomic units of functionality that can later be refactored into better
driver logic that is capable of handling a mixture of source files of
different languages.

llvm-svn: 44642
2007-12-05 23:49:08 +00:00
Chris Lattner
6a04fcb2f4 improve header guard
llvm-svn: 44641
2007-12-05 23:45:41 +00:00
Chris Lattner
55d8c3f71b split the JIT memory management code out from the main JIT logic into its
own JITMemoryManager interface.  There is no functionality change with 
this patch.

llvm-svn: 44640
2007-12-05 23:39:57 +00:00
Chris Lattner
2ed8f31f2f Avoid passing Diags into InitializeIncludePaths.
llvm-svn: 44639
2007-12-05 23:24:17 +00:00
Chris Lattner
5e224c32f4 add a note
llvm-svn: 44638
2007-12-05 23:05:06 +00:00
Chris Lattner
ad05e17491 add a note
llvm-svn: 44637
2007-12-05 22:58:19 +00:00
Steve Naroff
152dd812b2 Make sure Parser::ParseObjCSelectorExpression() handles unary selectors (with no arguments) properly.
llvm-svn: 44636
2007-12-05 22:21:29 +00:00
Ted Kremenek
cdcf6dcbcb Removed dependence on including iostream (use llvm/Support/Streams.h instead).
llvm-svn: 44635
2007-12-05 22:21:13 +00:00
Ted Kremenek
e095881856 Converted SerializationTest (--test-pickling) to use the new TranslationUnit
class to serialize and deserialize translation units.

llvm-svn: 44634
2007-12-05 22:08:43 +00:00
Steve Naroff
ff9f8efe4d Make sure the class methods get attached to the metaclass object.
Need to query the implementation, not the interface...

llvm-svn: 44633
2007-12-05 21:49:40 +00:00
Ted Kremenek
68d232b477 Added Driver/TranslationUnit.h and Driver/TranslationUnit.cpp to the
XCode project.

llvm-svn: 44632
2007-12-05 21:36:57 +00:00
Ted Kremenek
62f4302ec7 Added "TranslationUnit" class that will be used to provide an interface
for serializing/deserializing ASTs that is decoupled from the logic
in SerializationTest (which will soon be rewritten to use this interface).

llvm-svn: 44631
2007-12-05 21:36:08 +00:00
Ted Kremenek
dd1a7aade5 Modified: CreateTargetInfo(). Now takes Diagnostic* instead of Diagnostic&.
Modified: ctor of SerializationTest: Now takes LangOptions argument.  We
          will eventually serialize this as well.

llvm-svn: 44630
2007-12-05 21:34:36 +00:00
Bill Wendling
dc71f08586 Alphabetizing; I want to be the last in the file!!!! ;-)
llvm-svn: 44629
2007-12-05 21:26:54 +00:00
Scott Michel
7c56a522af Regenerated configure after autoconf/configure.ac change.
llvm-svn: 44628
2007-12-05 21:24:02 +00:00
Scott Michel
83d54c9ee0 Minor updates:
- Fix typo in SPUCallingConv.td
- Credit myself for CellSPU work
- Add CellSPU to 'all' host target list

llvm-svn: 44627
2007-12-05 21:23:16 +00:00
Duncan Sands
abba5e218c Commit 44487 broke bootstrap of llvm-gcc-4.2. It is
not yet clear why, but in the meantime work around the
problem by making less use of readnone/readonly info.

llvm-svn: 44626
2007-12-05 21:03:28 +00:00
Ted Kremenek
2968476c2d Added Basic/LangOptions.cpp to XCode project.
llvm-svn: 44625
2007-12-05 19:07:32 +00:00
Ted Kremenek
ae492c4f0c Implemented serialization of LangOptions.
llvm-svn: 44624
2007-12-05 19:06:15 +00:00
Evan Cheng
3b8a674469 Added canFoldMemoryOperand for PPC.
llvm-svn: 44623
2007-12-05 18:41:29 +00:00
Chris Lattner
36021a9cc1 I'm apparently the only sad lonely ppc user left :)
llvm-svn: 44622
2007-12-05 18:41:05 +00:00
Evan Cheng
8492bdeaa4 Update foldMemoryOperand.
llvm-svn: 44621
2007-12-05 18:36:37 +00:00
Chris Lattner
de9bfcf67a fix warnings
llvm-svn: 44620
2007-12-05 18:32:18 +00:00
Chris Lattner
8292519705 allow this to build
llvm-svn: 44619
2007-12-05 18:30:11 +00:00
Ted Kremenek
a4c13bd94b Moved creation of ASTConsumers that can operate on both freshly-parsed and
deserialized ASTs into the function CreateASTConsumer().  This function
is called by ProcessInputFile, and soon the logic that processes deserialized
ASTs.

llvm-svn: 44618
2007-12-05 18:27:04 +00:00
Fariborz Jahanian
b31a2f2a47 Patch to prevent crash on use of objc2 syntax.
llvm-svn: 44617
2007-12-05 18:16:33 +00:00
Fariborz Jahanian
d5db92ba97 Changed type-cast of "struct objc_super"'s 2nd initializer to match definition of
"struct objc_super".

llvm-svn: 44616
2007-12-05 17:29:46 +00:00
Chris Lattner
6eed001371 fix some bogus code noticed by Kevin Andre
llvm-svn: 44615
2007-12-05 17:21:34 +00:00
Neil Booth
06f20ea4ba Prior commit updated wrong if, apologies.
llvm-svn: 44614
2007-12-05 13:06:04 +00:00
Neil Booth
3ab004bca6 Handle zero correctly.
llvm-svn: 44613
2007-12-05 13:01:24 +00:00
Evan Cheng
678b86d6ce MachineInstr can change. Store indexes instead.
llvm-svn: 44612
2007-12-05 10:24:35 +00:00
Evan Cheng
06353b48b5 If a split live interval is spilled again, remove the kill marker on its last use.
llvm-svn: 44611
2007-12-05 09:51:10 +00:00
Evan Cheng
64b3baaaea Clobber more bugs.
llvm-svn: 44610
2007-12-05 09:05:34 +00:00
Evan Cheng
d7de56ac93 Fix kill info for split intervals.
llvm-svn: 44609
2007-12-05 08:16:32 +00:00
Chris Lattner
c9693c60a5 more scalarization
llvm-svn: 44608
2007-12-05 07:45:02 +00:00
Chris Lattner
1a0d49a63c scalarize vector binops
llvm-svn: 44607
2007-12-05 07:36:58 +00:00
Anders Carlsson
a297e7a888 Implement CodeGen for vectors. Don't create unnecessary conversion instructions if the value to be converted is a constant.
llvm-svn: 44606
2007-12-05 07:36:10 +00:00
Anders Carlsson
2c1ec6d5f7 Add sema checking for compound literal expressions.
llvm-svn: 44605
2007-12-05 07:24:19 +00:00
Anders Carlsson
e8ee04c0bc Implement codegen for builtin infinity functions.
llvm-svn: 44604
2007-12-05 07:22:48 +00:00
Anders Carlsson
cbdb6f5b5d Revert DidWarn change - It won't catch all cases anyway and GCC warns for every excess element. Maybe later we can add back the limit and make it smarter.
llvm-svn: 44603
2007-12-05 04:57:06 +00:00
Steve Naroff
2644aaf537 Recognize CompoundLiteralExpr's as valid lvalue's.
Also updated a FIXME in Sema::CheckInitializer()...

llvm-svn: 44602
2007-12-05 04:00:10 +00:00
Evan Cheng
269dbd31d0 - Mark last use of a split interval as kill instead of letting spiller track it.
This allows an important optimization to be re-enabled.
- If all uses / defs of a split interval can be folded, give the interval a
  low spill weight so it would not be picked in case spilling is needed (avoid
  pushing other intervals in the same BB to be spilled).

llvm-svn: 44601
2007-12-05 03:22:34 +00:00
Evan Cheng
bb26301864 Add a argument to storeRegToStackSlot and storeRegToAddr to specify whether
the stored register is killed.

llvm-svn: 44600
2007-12-05 03:14:33 +00:00
Scott Michel
d766e5d7c2 fixed header attribution
llvm-svn: 44599
2007-12-05 02:08:01 +00:00
Scott Michel
4834955fdf More stuff for CellSPU -- this should be enough to get an error-free
compilation (no files missing). Test cases remain to be checked in.

llvm-svn: 44598
2007-12-05 02:01:41 +00:00
Scott Michel
d1b5b9f68c Updated source file headers to llvm coding standard.
llvm-svn: 44597
2007-12-05 01:40:25 +00:00
Scott Michel
8d35728607 Two missing files.
llvm-svn: 44596
2007-12-05 01:31:18 +00:00
Scott Michel
eff980208a Main CellSPU backend files checked in. Intrinsics and autoconf files
remain.

llvm-svn: 44595
2007-12-05 01:24:05 +00:00
Dale Johannesen
9d43e3d841 Handle 0 correctly in string->APFloat conversion.
llvm-svn: 44594
2007-12-05 01:10:19 +00:00
Ted Kremenek
90a7c12bb4 Implemented serialization of: ObjCEncodeExpr, ObjCSelectorExpr.
llvm-svn: 44593
2007-12-05 00:43:08 +00:00
Ted Kremenek
166e505d27 Added serialization support of SourceManager to the clang driver.
llvm-svn: 44592
2007-12-05 00:26:13 +00:00
Ted Kremenek
e634142388 Renamed SourceManager::Read to SourceManager::CreateAndRegister.
Now sourcemanager deserializer automatically self-registers itself with
the deserializer.

llvm-svn: 44591
2007-12-05 00:19:51 +00:00
Ted Kremenek
57f4c00241 Implemented initial serialization support for SourceManager.
llvm-svn: 44590
2007-12-05 00:14:18 +00:00
Ted Kremenek
ca0cb926f4 Added "Emitter" functor to allow easy emitting of elements of a container
using std::for_each.

llvm-svn: 44589
2007-12-05 00:13:07 +00:00
Steve Naroff
0317aeb4b6 Add the definition of objc_super...
llvm-svn: 44588
2007-12-04 23:59:30 +00:00
Evan Cheng
e412a4427b Remove a unsafe optimization. This fixes 401.bzip2.
llvm-svn: 44587
2007-12-04 23:57:55 +00:00
Devang Patel
e9d786e54d Add --with-llvmgcc= and --with-llvmgxx= configure options.
llvm-svn: 44586
2007-12-04 22:54:47 +00:00
Ted Kremenek
6ca076cb7a Removed serialization of FileEntry and DirectoryEntry. This objects will
now be lazily recreated upon deserialization.

llvm-svn: 44585
2007-12-04 22:42:20 +00:00
Scott Michel
dfe09ed085 More files in the CellSPU drop...
llvm-svn: 44584
2007-12-04 22:35:58 +00:00
Fariborz Jahanian
1e34ce1045 Type-cast initializers for "struct objc_super" parameter to avoid warning.
llvm-svn: 44583
2007-12-04 22:32:58 +00:00
Scott Michel
6e22c651d1 More of the Cell SPU code drop from "Team Aerospace".
llvm-svn: 44582
2007-12-04 22:23:35 +00:00
Fariborz Jahanian
22c278a216 Test case for my last patch.
llvm-svn: 44581
2007-12-04 21:48:54 +00:00
Fariborz Jahanian
31e1850694 Don't assert if objc.h not declared when rewriting.
llvm-svn: 44580
2007-12-04 21:47:40 +00:00
Ted Kremenek
c638952f59 Implemented serialization of SrcMgr::ContentCache.
llvm-svn: 44578
2007-12-04 19:39:02 +00:00
Fariborz Jahanian
f256b48bc7 Removed a "TODO" comment as objc1 runtime does not need to do the "TODO".
llvm-svn: 44577
2007-12-04 19:31:56 +00:00
Fariborz Jahanian
1f606a999e Simplified setting up Method's scope before generating AST for its nody.
llvm-svn: 44576
2007-12-04 19:20:11 +00:00
Evan Cheng
cd8a89b3cd Spiller unfold optimization bug: do not clobber a reusable stack slot value unless it can be modified.
llvm-svn: 44575
2007-12-04 19:19:45 +00:00
Ted Kremenek
c6593c2c2e Fixed a few more comments to change "FileInfo" to "ContentCache."
llvm-svn: 44574
2007-12-04 18:59:28 +00:00
Ted Kremenek
f7260b191c Implemented serialization of FileEntry and DirectoryEntry.
llvm-svn: 44573
2007-12-04 18:21:35 +00:00
Ted Kremenek
0c2bea2909 Removed searching for "darwin" keyword in target triple. We don't really support
any alternative targets at this point other than "darwin," so we now default to
Darwin targets (for now).

llvm-svn: 44572
2007-12-04 17:07:35 +00:00
Ted Kremenek
bce8b49973 Removed IntrusiveSPtr. There are no clients of this class anymore, so it is
not needed, and it was never extensively tested.  If we need an intrusive
reference-counting smart pointer, we can always import intrusive_ptr from
boost.

llvm-svn: 44571
2007-12-04 16:54:09 +00:00
Chris Lattner
b892225fb9 Implement framework for scalarizing node results. This is sufficient
to codegen this:

define float @test_extract_elt(<1 x float> * %P) {
	%p = load <1 x float>* %P
	%R = extractelement <1 x float> %p, i32 0
	ret float %R
}

llvm-svn: 44570
2007-12-04 07:48:46 +00:00
Chris Lattner
681c9d6697 start providing framework for scalarizing vectors.
llvm-svn: 44569
2007-12-04 07:29:51 +00:00
Ted Kremenek
c8f444ff80 Implemented serialization of ObjCStringLiteral.
llvm-svn: 44568
2007-12-04 00:51:11 +00:00
Ted Kremenek
b8714c8ef1 Implemented serialization for ObjcAtThrowStmt.
llvm-svn: 44567
2007-12-04 00:40:49 +00:00
Ted Kremenek
98b3a71537 Implemented serialization of ObjcAtTryStmt.
llvm-svn: 44566
2007-12-04 00:38:30 +00:00
Evan Cheng
d1badb960e Discard split intervals made empty due to folding.
llvm-svn: 44565
2007-12-04 00:32:23 +00:00
Ted Kremenek
ee695a3456 Implemented serialization for ObjcAtFinallyStmt.
llvm-svn: 44564
2007-12-04 00:32:22 +00:00
Ted Kremenek
0bf3e33dcc Implemented serialization for ObjcAtCatchStmt.
llvm-svn: 44563
2007-12-04 00:28:54 +00:00
Ted Kremenek
9c26202c76 Fixed order of operands to strstr call.
llvm-svn: 44561
2007-12-03 23:25:59 +00:00
Ted Kremenek
eead4052e9 For target processing, on non-Darwin systems instead of using the host triple,
we default to "i386-apple-darwin".  This is an interim solution.

Removed processing of "linux" triples from Targets.cpp, since we don't have
any sensical Linux target support (yet).

Cleaned up error processing of targets; added better diagnostics.

llvm-svn: 44560
2007-12-03 23:23:21 +00:00
Scott Michel
d821fe741e More CellSPU files... more to follow.
llvm-svn: 44559
2007-12-03 23:14:43 +00:00
Scott Michel
c7bd8d9cb0 Makefile fragment for CellSPU.
llvm-svn: 44558
2007-12-03 23:12:49 +00:00
Scott Michel
256e9abbb9 First commit to CellSPU. More to follow
llvm-svn: 44557
2007-12-03 23:09:49 +00:00
Fariborz Jahanian
68c06b2d2c Change <Objc/objc.h> to <objc/objc.h>
llvm-svn: 44556
2007-12-03 23:04:29 +00:00
Ted Kremenek
8e3a2a93aa Implemented serialization of TargetInfo.
SerializationTest (subclass of ASTConsumer) now takes Diagnostics& in its ctor.

llvm-svn: 44555
2007-12-03 22:48:14 +00:00
Ted Kremenek
8cdc08ea49 Added some notes on the -triple and -arch options.
llvm-svn: 44554
2007-12-03 22:26:16 +00:00
Fariborz Jahanian
d0d2bd5089 Fixed a bug exposed by referencing an ivar field using component reference syntax.
llvm-svn: 44553
2007-12-03 22:25:42 +00:00
Ted Kremenek
68fcff9bfa Few cleanups to patch 44551:
http://llvm.org/viewvc/llvm-project?view=rev&revision=44551

Removed debugging fprintfs for printing targets.
Implemented error messages when processing invalid targets.

llvm-svn: 44552
2007-12-03 22:11:31 +00:00
Ted Kremenek
b061554caa Implemented initial support for "-triple" option to the clang driver. This
replaces the functionality previously provided by just "-arch" (which is still
supported but has different semantics).

The new behavior is as follows:

(1) If the user does not specify -triple:

   (a) If no -arch options are specified, the target triple used is the host
   triple (in llvm/Config/config.h).
   
   (b) If one or more -arch's are specified (and no -triple), then there is
       one triple for each -arch, where the specified arch is substituted
       for the arch in the host triple.  Example:
          host triple = i686-apple-darwin9
          command: clang  -arch ppc -arch ppc64 ...
          triples used: ppc-apple-darwin9  ppc64-apple-darwin9
          
(2) The user does specify a -triple (only one allowed):

  (a) If no -arch options are specified, the triple specified by -triple
      is used.  E.g clang -triple i686-apple-darwin9
      
  (b) If one or more -arch options are specified, then the triple specified
      by -triple is used as the primary target, and the arch's specified
      by -arch are used to create secondary targets.  For example:
      
      clang -triple i686-apple-darwin9 -arch ppc -arch ppc64
      
      has the following targets:
         i686-apple-darwin9  (primary target)
         ppc-apple-darwin9
         ppc64-apple-darwin9


Other changes related to the changes to the driver:

- TargetInfoImpl now includes the triple string.

- TargetInfo::getTargetTriple returns the triple for its primary target.

- test case test/Parser/portability.c has been updated because "-arch linux" is
  no longer valid ("linux" is an OS, not an arch); instead we use a bogus
  architecture "bogusW16W16" where WCharWidth=16 and WCharAlign=16.

llvm-svn: 44551
2007-12-03 22:06:55 +00:00
Chris Lattner
e5a91b4924 Fix an ast-print/ast-dump bug.
llvm-svn: 44550
2007-12-03 21:43:25 +00:00
Evan Cheng
40965448ff Bug fixes.
llvm-svn: 44549
2007-12-03 21:31:55 +00:00
Fariborz Jahanian
4f76f22975 Support for rewriteing of messaging of methods which return float.
llvm-svn: 44548
2007-12-03 21:26:48 +00:00
Gordon Henriksen
363b02003b Track dependencies when creating symlinks to LLVM libraries next
to the ocaml bindings. This is required on Windows where 'ln -sf'
actually creates a copy. Thanks to Alain Frisch for noticing this.

llvm-svn: 44547
2007-12-03 21:15:53 +00:00
Anton Korobeynikov
3ddfbf36e9 Regenerate
llvm-svn: 44546
2007-12-03 21:01:29 +00:00
Anton Korobeynikov
a638f11cd2 Fix fallout from my last patch: don't reject varargs functions :)
llvm-svn: 44545
2007-12-03 21:00:45 +00:00
Duncan Sands
38ef3a8ec7 Rather than having special rules like "intrinsics cannot
throw exceptions", just mark intrinsics with the nounwind
attribute.  Likewise, mark intrinsics as readnone/readonly
and get rid of special aliasing logic (which didn't use
anything more than this anyway).

llvm-svn: 44544
2007-12-03 20:06:50 +00:00
Chris Lattner
19970e62e7 update file comment.
llvm-svn: 44543
2007-12-03 19:43:18 +00:00
John Criswell
9c9405f4ef Fixed typo.
llvm-svn: 44542
2007-12-03 19:34:25 +00:00
Anton Korobeynikov
c09b265410 Regenerate
llvm-svn: 44541
2007-12-03 19:17:47 +00:00
Fariborz Jahanian
9e7b848ac8 Added support for messagings which return a structure-value.
(Also fixed a regression caused by recent changes to synthesis of structs).

llvm-svn: 44540
2007-12-03 19:17:29 +00:00
Devang Patel
bd75910fa7 If ExitValue operand is also defined in Loop header then
insert new ExitValue after this operand definition.

This fixes PR1828.

llvm-svn: 44539
2007-12-03 19:17:21 +00:00
Anton Korobeynikov
d62b10dc93 More sanity checks for function types.
Thanks goes to PyPy folks for generating broken stuff :)

llvm-svn: 44538
2007-12-03 19:16:54 +00:00
Chris Lattner
b39e02bcc2 Describe the notion of 'owners' of the code.
llvm-svn: 44537
2007-12-03 19:00:47 +00:00
Ted Kremenek
d85026d925 Added getTrueExpr() and getFalseExpr() to ConditionalOperator. These methods
provide handy accessors to the subexpressions of ConditionalOperator that
automatically take into account the GCC extension where the "LHS" expression is
omitted: e.g x ?: y;. When the LHS expression is available, getTrueExpr() is the
same as getLHS(); when LHS is NULL, getTrueExpr() returns the condition expression.

llvm-svn: 44536
2007-12-03 17:09:21 +00:00
Gordon Henriksen
4814cd2271 Applying Anton's binmode fix to the other ofstream too.
llvm-svn: 44535
2007-12-03 14:50:37 +00:00
Anton Korobeynikov
bf96d99383 Sorry, typo :)
llvm-svn: 44534
2007-12-03 14:35:57 +00:00
Anton Korobeynikov
7c5442b0e3 Open output file correctly. This is extremely important for
windows-based hosts, where files are opened in text mode by default.

llvm-svn: 44533
2007-12-03 14:28:26 +00:00
Evan Cheng
196faa9dc5 Typo
llvm-svn: 44532
2007-12-03 10:00:00 +00:00
Evan Cheng
85ef9834a6 Update kill info for uses of split intervals.
llvm-svn: 44531
2007-12-03 09:58:48 +00:00
Bill Wendling
db4e34984b Fix for testcase that assigns a dereferenced reference to a pointer. The
standard says that we should adjust the "reference to T" type to "T"
before analysis.

llvm-svn: 44530
2007-12-03 07:33:35 +00:00
Seo Sanghyeon
3d072bea09 Ignore typedefs in pointer arithmetic codegen.
llvm-svn: 44529
2007-12-03 06:23:43 +00:00
Anton Korobeynikov
9050bd1f68 Provide hook for _alloca to make JITing on Cygwin slightly happier :)
llvm-svn: 44528
2007-12-03 05:30:41 +00:00
Nick Lewycky
9746782cea lli -trace was removed back in 2003.
llvm-svn: 44527
2007-12-03 01:58:01 +00:00
Nick Lewycky
d93847a96a Type::IntTy hasn't existed for a while. Just sub in Type::Int32Ty.
llvm-svn: 44526
2007-12-03 01:52:52 +00:00
Anders Carlsson
5dd106b212 Handle initializing vector elements correctly. Emit just one warning if there are excess initializers, instead of one per initializer.
llvm-svn: 44525
2007-12-03 01:01:28 +00:00
Chris Lattner
4b6d965611 explain what I need to grant commit access.
llvm-svn: 44524
2007-12-03 00:36:20 +00:00
Chris Lattner
6e4f047422 add a fixme
llvm-svn: 44523
2007-12-02 23:05:46 +00:00
Chris Lattner
b4ef023bf6 fix typo noticed by Joshua Pennington
llvm-svn: 44522
2007-12-02 22:46:01 +00:00
Anders Carlsson
ef93b9d011 Implement __builtin_bswap32 and __builtin_bswap64.
llvm-svn: 44521
2007-12-02 21:58:10 +00:00
Chris Lattner
4e4186b2de fix logic for member expr codegen.
llvm-svn: 44520
2007-12-02 18:52:07 +00:00
Seo Sanghyeon
828429fea9 Fix isStructureType and isUnionType to ignore typedefs, as stated
in the header. Patch by Cédric Venet.

llvm-svn: 44519
2007-12-02 16:57:27 +00:00
Christopher Lamb
0cbd8723f3 Treat discarding array initializer elements as an extwarn (so -pedantic-errors flags it). Allow CodeGen to truncate the initializer if needed.
llvm-svn: 44518
2007-12-02 08:49:54 +00:00
Evan Cheng
f45a1d623c Remove redundant foldMemoryOperand variants and other code clean up.
llvm-svn: 44517
2007-12-02 08:30:39 +00:00
Chris Lattner
310369fb84 restore these lines, which fixes some regtest failures.
llvm-svn: 44516
2007-12-02 07:50:03 +00:00
Chris Lattner
6311b58000 all filevar's have static storage. Previously a global with
extern storage class was returning false from hasStaticStorage.
Ted, please review this.

llvm-svn: 44515
2007-12-02 07:47:49 +00:00
Christopher Lamb
39aeb4069b Commit test for CL 44440.
llvm-svn: 44514
2007-12-02 07:47:19 +00:00
Chris Lattner
e4f0feb534 Fix buggy test
llvm-svn: 44513
2007-12-02 07:46:00 +00:00
Chris Lattner
0475c8178f globals can't be vla's
llvm-svn: 44512
2007-12-02 07:32:25 +00:00
Chris Lattner
d8d18d561e add codegen support for global inits that require array decay.
llvm-svn: 44511
2007-12-02 07:30:13 +00:00
Chris Lattner
d45aa2a03b warn about unhandled initializers instead of crashing on them.
llvm-svn: 44510
2007-12-02 07:19:18 +00:00
Chris Lattner
5bcdf24a50 Handle global variable definitions which change the type of a definition, such as:
extern int x[];
void foo() { x[0] = 1; }
int x[10];
void bar() { x[0] = 1; }

llvm-svn: 44509
2007-12-02 07:09:19 +00:00
Chris Lattner
c48023bd5b remove the alloca insertion point inst, which is an internal helper.
llvm-svn: 44508
2007-12-02 06:32:24 +00:00
Chris Lattner
6d27513f6e merge the llvm global variable when there are multiple C decls.
llvm-svn: 44507
2007-12-02 06:30:46 +00:00
Chris Lattner
41af8182d8 implement codegen for functions whose function body type don't match
their prototype.

llvm-svn: 44506
2007-12-02 06:27:33 +00:00
Chris Lattner
c5b3aab66b merge functions with multiple function decls if they have the same name.
llvm-svn: 44505
2007-12-02 05:56:05 +00:00
Chris Lattner
e15d0dd63f Teach clang the prototype for __builtin_alloca.
llvm-svn: 44504
2007-12-02 05:42:36 +00:00
Chris Lattner
f0780fae43 convert the rest of the stderr users in codegen to use diagnostics.
llvm-svn: 44503
2007-12-02 01:49:16 +00:00
Chris Lattner
fc94434faf move unsupported warning into a centralized place.
llvm-svn: 44502
2007-12-02 01:43:38 +00:00
Chris Lattner
c8dbe1e5d6 Warn about unsupported codegen with the diags machinery, giving us:
t.c:3322:5: warning: cannot codegen this yet
    __asm__ ("bswap   %0" : "+r" (_data));
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

instead of:

Unimplemented stmt!
(AsmStmt 0x80eaa0 <t.c:3331:5, line:3334:28>)

llvm-svn: 44501
2007-12-02 01:40:18 +00:00
Chris Lattner
963540dc28 register clz and ctz builtins.
llvm-svn: 44500
2007-12-02 01:20:23 +00:00
Chris Lattner
f3a59a1fb8 fix a crash when the rewriter would scan off the beginning of the file.
llvm-svn: 44499
2007-12-02 01:13:47 +00:00
Chris Lattner
e6535cfdd2 add support for custom client-specific diagnostics. As a testcase, make the
rewriter emit this error if it fails to rewrite an @encode:

t.m:17:9: error: rewriter could not replace sub-expression due to macros
    c = ENC(char *)[2] + 4;
        ^~~~~~~~~~~

... where ENC is: #define ENC @encode

llvm-svn: 44498
2007-12-02 01:09:57 +00:00
Oliver Hunt
a96fe8d5c5 Add support for __builtin_expect which is needed for assert,
among other things.

Also change a codegen warning to dump to stderr so it doesn't
mess with -emit-llvm output

llvm-svn: 44497
2007-12-02 01:03:24 +00:00
Chris Lattner
9724ce12f9 improve VC++ compatibility, patch by Cédric Venet.
llvm-svn: 44496
2007-12-02 00:47:03 +00:00
Oliver Hunt
aefc8fd415 Support initalisers for more than just int-typed static variables.
We now use the CodeGenModule logic for generating the constant 
initialiser expression, so happily further initialiser fixes should 
automatically work for statics as well.

llvm-svn: 44495
2007-12-02 00:11:25 +00:00
Gordon Henriksen
3e41367dd5 Adding ocamldoc-style comments for the Ocaml bindings.
llvm-svn: 44494
2007-12-01 21:01:15 +00:00
Gordon Henriksen
e000c6022f Fix a typo noticed by Alain Frisch.
llvm-svn: 44493
2007-12-01 20:59:23 +00:00
Fariborz Jahanian
9fac54d881 Compute side-effect for conditional expression.
llvm-svn: 44492
2007-12-01 19:58:28 +00:00
Chris Lattner
53efb14795 Add #include, patch by Cédric Venet
llvm-svn: 44491
2007-12-01 18:59:50 +00:00
Christopher Lamb
7d303b2a20 Better match llvm-gcc's behavior for CodeGen naming of anonymous structs and unions.
llvm-svn: 44490
2007-12-01 09:20:34 +00:00
Christopher Lamb
b0e6094a22 When generating the CodeGen type name of a struct, union, enum use the typedef
name if a tag type name is not available for the type. This matches how llvm-gcc 
chooses CodeGen type names.

This means that "typedef struct {...} foo" now results in a CodeGen name of 
"struct.foo" rather than "struct."

llvm-svn: 44489
2007-12-01 09:08:41 +00:00
Seo Sanghyeon
34f92ace1f Test commit
llvm-svn: 44488
2007-12-01 08:06:07 +00:00
Duncan Sands
68b6f50938 Integrate the readonly/readnone logic more deeply
into alias analysis.  This meant updating the API
which now has versions of the getModRefBehavior,
doesNotAccessMemory and onlyReadsMemory methods
which take a callsite parameter.  These should be
used unless the callsite is not known, since in
general they can do a better job than the versions
that take a function.  Also, users should no longer
call the version of getModRefBehavior that takes
both a function and a callsite.  To reduce the
chance of misuse it is now protected.

llvm-svn: 44487
2007-12-01 07:51:45 +00:00
Chris Lattner
ae7a834e74 make the unused expression warning less noisy by not warning about comma exprs whose
LHS and RHS both have side effects.

llvm-svn: 44486
2007-12-01 06:07:34 +00:00
Chris Lattner
e69d662bae simplify some code, add support for functions without a proto
llvm-svn: 44485
2007-12-01 05:58:21 +00:00
Chris Lattner
9e137aad78 fix a couple switch codegen problems Oliver reported.
llvm-svn: 44484
2007-12-01 05:27:33 +00:00
Ted Kremenek
3e14c152c6 Fixed bug in the serialization of SelectorTable where we did not register the
pointer of MultiKeywordSelectors.

Added optimization to the serialization of SelectorTable where we only serialize
out MultiKeywordSelectors that are ever referenced by an object other than the
SelectorTable.

llvm-svn: 44483
2007-12-01 04:43:17 +00:00
Evan Cheng
388f6f51a0 Fix a bug where splitting cause some unnecessary spilling.
llvm-svn: 44482
2007-12-01 04:42:39 +00:00
Owen Anderson
7f09c88977 Fixes for MachineLoopInfo, mostly from Evan. With these, it should be almost useable!
llvm-svn: 44480
2007-12-01 03:01:39 +00:00
Evan Cheng
69fda0a716 Allow some reloads to be folded in multi-use cases. Specifically testl r, r -> cmpl [mem], 0.
llvm-svn: 44479
2007-12-01 02:07:52 +00:00
Eric Christopher
e62b441b51 Add target triple to include/llvm/Config/config.h.in. Regenerate all files.
llvm-svn: 44478
2007-12-01 00:34:39 +00:00
Devang Patel
c7d9af8d6d Change LinkTimeOptimizer.h install location.
llvm-svn: 44477
2007-12-01 00:24:50 +00:00
Devang Patel
0fceaea8be Change lib lto install location.
llvm-svn: 44476
2007-11-30 23:27:57 +00:00
Chris Lattner
4431a1b19b start partitioning the diagnostics into two classes: those
that are builtin and those that are aren't.  This is a bunch
of API refactoring that will make this possible, but there is
no functionality change yet.

llvm-svn: 44473
2007-11-30 22:53:43 +00:00
Anders Carlsson
7a9a38abe0 String literals are always valid LValues.
llvm-svn: 44472
2007-11-30 22:47:59 +00:00
Ted Kremenek
c9bcda94ae Implemented serialization of SelectorTable and Selectors.
Modified serialization of IdentifierTable to self-register itself with
the Deserializer.

llvm-svn: 44471
2007-11-30 22:46:56 +00:00
Ted Kremenek
8ded669b04 Fixed subtle bug in Deserializer::JumpTo when jumping when the block-nesting
information matching did not exactly match the underlying stream's scoping
information.

llvm-svn: 44470
2007-11-30 22:45:05 +00:00
Ted Kremenek
1f80e8b6eb Fixed potential bug where CurWord is not zeroed out in JumpToBit.
llvm-svn: 44469
2007-11-30 22:39:46 +00:00
Chris Lattner
e9c810c87c pass diagnostics into the rewrite test client.
llvm-svn: 44468
2007-11-30 22:25:36 +00:00
Evan Cheng
b10dc27b20 Do not fold reload into an instruction with multiple uses. It issues one extra load.
llvm-svn: 44467
2007-11-30 21:23:43 +00:00
Anders Carlsson
3b754452eb Initialize CurMethodDecl to 0.
llvm-svn: 44463
2007-11-30 20:01:38 +00:00
Anders Carlsson
801c5c7467 GCC has an extension where the left hand side of the ? : operator can be omitted. Handle this in a few more places.
llvm-svn: 44462
2007-11-30 19:04:31 +00:00
Chris Lattner
907703cecd chain update requests properly.
llvm-svn: 44460
2007-11-30 18:52:58 +00:00
Anders Carlsson
452815a6b2 Initialize LaxVectorConversions.
llvm-svn: 44459
2007-11-30 18:29:41 +00:00
Duncan Sands
d4d7f9d69e Small optimization of parameter attribute lookup.
llvm-svn: 44458
2007-11-30 18:20:58 +00:00
Duncan Sands
b41f872013 Add a convenience method for modifying parameter
attributes.  While there, I noticed that not all
attribute methods returned a pointer-to-constant,
so I fixed that.

llvm-svn: 44457
2007-11-30 18:19:18 +00:00
Chris Lattner
1386de8757 fix a bug handling typedefs in member expr codegen. Patch
by Seo Sanghyeon

llvm-svn: 44455
2007-11-30 18:02:19 +00:00
Chris Lattner
b6a7b582ee Fix a codegen crash on void ?: reported by Oliver
llvm-svn: 44454
2007-11-30 17:56:23 +00:00
Chris Lattner
aa0b570dfb Support fully general case expressions, patch by Sanghyeon Seo!
llvm-svn: 44453
2007-11-30 17:44:57 +00:00
Duncan Sands
4e8c071612 Check that there are not more attributes than
function parameters.

llvm-svn: 44452
2007-11-30 15:52:20 +00:00
Christopher Lamb
0112f62bb9 Doh! Check in this long overdue test fix.
llvm-svn: 44450
2007-11-30 06:35:48 +00:00
Anders Carlsson
e1af1d20ef Support lax vector conversions.
llvm-svn: 44449
2007-11-30 04:21:22 +00:00
Devang Patel
cc45c338d1 Provide a way to update DescGlobals cache directly.
llvm-svn: 44446
2007-11-30 00:51:33 +00:00
Steve Naroff
205ec3d07a Yesterday, I simplified how we stream top-level decls.
After a discussion with Ted, we both came to the conclusion that adding a "HandleTopLevelDeclaration" hook to ASConsumer is far more elegant. The default implementation of HandleTopLevelDeclaration will be responsible for iterating over the ScopedDecl (which has a chain of the decls:-).

TODO: Once Ted adds HandleTopLevelDeclaration, make sure TagDecls are chainged appropriately...
llvm-svn: 44445
2007-11-29 23:05:20 +00:00
Ted Kremenek
bfcf8cdbd7 Added method "HandleTopLevelDeclaration" to ASTConsumer. This will eventually
be the new hook that ASTStreamer calls to feed top-level Decls to
ASTConsumers.

The difference between "HandleTopLevelDeclaration" and "HandleTopLevelDecl" is
that "HandleTopLevelDecl" is currently called by ASTStreamer for every
top-level declaration, including those that appear within a Decl chain. Using
the new interface, ASTStreamer would only call HandleTopLevelDeclaration for
Decls that appear that the beginning of a Decl chain (i.e., a group of related
decls).

To preserve the behavior that all subclasses of ASTConsumer currently expect,
the default implementation of HandleTopLevelDeclaration simply calls
HandleTopLevelDecl, and for decl chains it calls HandleTopLevelDecl for each
Decl* in a chain of Decls.

The advantage of this interface is that some subclasses of ASTConsumer only
really want the Decl chain, and not each individual Decl passed to them. This
extra level of indirection allows subclasses to override the default behavior
if they so desire.

llvm-svn: 44444
2007-11-29 23:05:17 +00:00
Evan Cheng
d35b5acae4 Do not lose rematerialization info when spilling already split live intervals.
llvm-svn: 44443
2007-11-29 23:02:50 +00:00
Christopher Lamb
2ed9afd777 Update the initializer's type, in addition to the decl, if we've changed the type of the decl based on it.
llvm-svn: 44440
2007-11-29 19:09:19 +00:00
Ted Kremenek
22a0d616f6 Added "complex.c" (a copy of test/Codegen/complex.) to the serialization
test suite.

llvm-svn: 44439
2007-11-29 19:05:51 +00:00
Ted Kremenek
870600d625 Only serialize top-level decls that appear at the head of a decl chain.
llvm-svn: 44438
2007-11-29 19:04:54 +00:00
Owen Anderson
ffa55112e0 Fix a miscompilation in spiff on PPC.
llvm-svn: 44437
2007-11-29 18:02:22 +00:00
Evan Cheng
8494ee175c Fix a major performance issue with splitting. If there is a def (not def/use)
in the middle of a split basic block, create a new live interval starting at
the def. This avoid artifically extending the live interval over a number of
cycles where it is dead. e.g.

bb1:
       = vr1204   (use / kill) <= new interval starts and ends here.
...
...
vr1204 =          (new def)   <= start a new interval here.
       = vr1204   (use)

llvm-svn: 44436
2007-11-29 10:12:14 +00:00
Evan Cheng
37ed3e6320 Update tests.
llvm-svn: 44435
2007-11-29 10:03:54 +00:00
Evan Cheng
f85c063ec0 Replace the odd kill# hack with something less fragile.
llvm-svn: 44434
2007-11-29 09:49:23 +00:00
Duncan Sands
8dfcd5975e Small parameter attributes cleanup.
llvm-svn: 44433
2007-11-29 08:30:15 +00:00
Chris Lattner
f5a095359e Pass the whole StringMapEntry into StringMapEntryInitializer::Initialize.
llvm-svn: 44432
2007-11-29 06:14:41 +00:00
Christopher Lamb
42e69f219d Support floating point literals of the form "1e-16f" which specify an exponent but no decimal point.
llvm-svn: 44431
2007-11-29 06:06:27 +00:00
Chris Lattner
d1f0e3d791 provide an optional API to allow datatypes in a stringmap to be *gasp*
initialized with a value if they want, by specializing the 
StringMapEntryInitializer class.

llvm-svn: 44430
2007-11-29 06:04:41 +00:00
Ted Kremenek
1150e25901 Enhanced serialization testing by also pretty-printing CFGs constructed from ASTs
both before and after serialization/deserialization. If the CFGs between the pre-
and post- serialized/deserialized ASTs differ, the serialization has failed.

llvm-svn: 44429
2007-11-29 01:24:25 +00:00
Evan Cheng
be255b0650 Fixed various live interval splitting bugs / compile time issues.
llvm-svn: 44428
2007-11-29 01:06:25 +00:00
Evan Cheng
147f7799c5 Kill info update bug.
llvm-svn: 44427
2007-11-29 01:05:47 +00:00
Ted Kremenek
2501c8294f Fixed test case to not expect a warning when one should not be emitted.
Removed redundant test case.

llvm-svn: 44426
2007-11-29 01:03:21 +00:00
Ted Kremenek
0865d8a5d0 Added test cases for -Wfloat-equal to test comparisons against literals that can be
represented exactly and inexactly by APFloats. For the former, we do not emit a
warning.

llvm-svn: 44425
2007-11-29 01:00:11 +00:00
Ted Kremenek
eda40e273e Enhanced implementation of -Wfloat-equal to check for comparisons against
floating-point literals that are represented exactly by the APFloat in
FloatingLiteral. For such literals, we do not emit a warning since such checks are
often performed in real code to see if a variable has changed from its original
value. This heuristic clearly can lead to false negatives, but the hope is it will
significantly reduce false positives to help make the compiler flag more useful.

llvm-svn: 44424
2007-11-29 00:59:04 +00:00
Ted Kremenek
3a2c950401 Added "isExact" field to FloatingLiteral. This flag indicates whether or not
the APFloat representing the parsed literal can represent the literal value
exactly.  This is useful when performing various semantic checks on the code,
and issuing appropriate warnings to users.

llvm-svn: 44423
2007-11-29 00:56:49 +00:00
Ted Kremenek
9924ca2e14 Removed potential buffer overrun (spotted by Neil Booth) when NumericLiteralParser
converts a parsed literal into an APFloat. We are still performing a copy of the
string, which hopefully will be removed eventually for performance reasons. This
version now is at least safe.

Changed rounding in APFloat construction in NumericLiteralParser from rmTowardsZero
to rmNearestTiesToEven.

llvm-svn: 44422
2007-11-29 00:54:29 +00:00
Steve Naroff
197616c3a8 Several fixes/simplifications surrounding how we stream top-level decl AST's.
The following code...

typedef struct cssm_data {} CSSM_DATA, *CSSM_DATA_PTR;

struct Y { int A; };

struct X { int A; } D; 

struct X E, F;

...now produces the following output...

> ../../Debug/bin/clang xx.c -ast-print
Read top-level tag decl: 'cssm_data'
typedef struct cssm_data CSSM_DATA;
typedef struct cssm_data *CSSM_DATA_PTR;
Read top-level tag decl: 'Y'
Read top-level tag decl: 'X'
Read top-level variable decl: 'D'
Read top-level variable decl: 'E'
Read top-level variable decl: 'F'

...which is much more accurate than the previous -ast-print output...

typedef struct cssm_data CSSM_DATA;
typedef struct cssm_data CSSM_DATA;
Read top-level variable decl: 'D'
Read top-level variable decl: 'E'
Read top-level variable decl: 'E'

llvm-svn: 44421
2007-11-28 22:54:11 +00:00
Chris Lattner
cee633a873 New testcase for PR1744
llvm-svn: 44418
2007-11-28 22:43:34 +00:00
Ted Kremenek
5933768bec Converted AST Pretty-Printer to use iostreams instead of FILE*. This fixes
a bug where the statement pretty-printer used iostreams but the AST printer
did not.  This was an issue when dumping ASTs to something other than stderr.

Updated SerializationTest to use the new iostreams interface for the AST printer.

llvm-svn: 44417
2007-11-28 21:32:21 +00:00
Ted Kremenek
5d169cf285 Inlined test case to make it independent of the stmt_exprs test case in test/Sema.
llvm-svn: 44416
2007-11-28 21:29:54 +00:00
Chris Lattner
246b7b2dbf Work around a GCC bug, producing this code:
unsigned char *llvm_cbe_X;
...
  llvm_cbe_X = 0; *((void**)&llvm_cbe_X) = __builtin_stack_save();

instead of:

  llvm_cbe_X = __builtin_stack_save();

See PR1809 for details.

llvm-svn: 44415
2007-11-28 21:26:17 +00:00
Chris Lattner
3fbb6a83a8 Add a note
llvm-svn: 44414
2007-11-28 19:26:42 +00:00
Ted Kremenek
31540ed8fe Added the "Serialization" test directory to the set of tests executed.
Introduced a few line breaks to make the Makefile easier to read.

llvm-svn: 44413
2007-11-28 19:24:15 +00:00
Ted Kremenek
46cfdb9625 Added initial test case for testing serialization of ASTs. This test
case simply performs --test-pickling on the code found in Sema/stmt_exprs.c.

llvm-svn: 44412
2007-11-28 19:23:15 +00:00
Ted Kremenek
ac76a41717 Modified --test-pickling to perform an actual cross-check of serialized ASTs:
(1) Parsed ASTs are pretty-printed to a text file.
(2) The ASTs are serialized to disk.
(3) The ASTs are deserialized from disk.
(4) The deserialized ASTs are pretty-printed to a text file.
(5) The two pretty-printed files are compared. If they are different, the test
    fails.

llvm-svn: 44411
2007-11-28 19:21:47 +00:00
Ted Kremenek
44d5166cdb Changed TestRunner.sh to dump the output and generated script files in
subdirectories mirroring where the test case file is located

For example, for the test case "Sema/stmt_exprs.c", instead of the files
"Output/stmt_exprs.c.out" and "Output/stmt_exprs.c.out.script" being created, the
files "Output/Sema/stmt_exprs.c.out" and "Output/Sema/stmt_exprs.c.out.script" are
created. This prevents any collisions from different test directories that have the
same file name for a test case, and also makes it clear where the test case was
drawn from.

llvm-svn: 44410
2007-11-28 19:16:54 +00:00
Ted Kremenek
ab18e6d7fd Added missing "RUN:" to comment for test case file. This fixed a bug where the test
case testing the frontend's support of statement expressions was not being
executed.

llvm-svn: 44409
2007-11-28 19:05:11 +00:00
Chris Lattner
db2a6ef881 Fix a bug checking for 'int foo(void)' that didn't look through typedefs of void.
Bug pointed out by Michael Zolda, thanks!

llvm-svn: 44408
2007-11-28 18:51:29 +00:00
Chris Lattner
57ee7c6630 Implement ExpandOperationResult for ppc i64 fp->int, which fixes
CodeGen/Generic/fp_to_int.ll among others.  Its unclear why this 
just started failing...

llvm-svn: 44407
2007-11-28 18:44:47 +00:00
Chris Lattner
749478a61b for consistency, allow a fallthrough if the final check returns null.
llvm-svn: 44406
2007-11-28 18:30:18 +00:00
Chris Lattner
f4769da4b3 upgrade this test
llvm-svn: 44405
2007-11-28 18:22:12 +00:00
Chris Lattner
d6109cf328 make this test have a deterministic result.
llvm-svn: 44404
2007-11-28 18:20:49 +00:00
Duncan Sands
5208d1ab4a Add some convenience methods for querying attributes, and
use them.

llvm-svn: 44403
2007-11-28 17:07:01 +00:00
Duncan Sands
b5452fb829 Revert previous "fix" - the breakage was due to some
local changes, not the "not".

llvm-svn: 44402
2007-11-28 16:50:29 +00:00
Duncan Sands
0497916c88 This test somehow got an extra "not" during the
recent stderr updates.

llvm-svn: 44401
2007-11-28 15:36:27 +00:00
Duncan Sands
ff306287ff My compiler complains that "x always evaluates to true"
in this call:

	Result.IntVal = APInt(80, 2, x);

What is x?

	uint16_t x[8];

I deduce that the APInt constructor being used is this one:

  APInt(uint32_t numBits, uint64_t val, bool isSigned = false);

rather than this one:

  APInt(uint32_t numBits, uint32_t numWords, const uint64_t bigVal[]);

That doesn't seem right!  This fix compiles but is otherwise completely
untested.

llvm-svn: 44400
2007-11-28 10:36:19 +00:00
Duncan Sands
45a0c3265f Add missing newlines at EOF.
llvm-svn: 44399
2007-11-28 10:13:38 +00:00
Oliver Hunt
93c4ce650c Fix typo in writable string test
llvm-svn: 44398
2007-11-28 06:52:03 +00:00
Oliver Hunt
a951571941 Adding code gen tests for writable and shared string literals.
llvm-svn: 44397
2007-11-28 06:27:12 +00:00
Anders Carlsson
0e136ec1d3 Add correct types for the last remaining intrinsics.
llvm-svn: 44396
2007-11-28 06:09:44 +00:00
Chris Lattner
e499816a23 xfail a test
llvm-svn: 44395
2007-11-28 05:37:13 +00:00
Chris Lattner
fb30009465 Implement support for -fwritable-strings and make the code generator
merge string literals when it is not provided.

llvm-svn: 44394
2007-11-28 05:34:05 +00:00
Chris Lattner
e04dc1fa4d update this test after the fmrrd fix
llvm-svn: 44393
2007-11-28 05:27:07 +00:00
Anders Carlsson
299f2fc648 Add more intrinsics. We can now correctly parse both Carbon.h and Cocoa.h without having to do -arch ppc.
llvm-svn: 44392
2007-11-28 05:19:59 +00:00
Tanya Lattner
ec072113f0 Fix typo
llvm-svn: 44391
2007-11-28 05:14:49 +00:00
Tanya Lattner
8460374e30 Modified instructions to configure llvm-test by configure llvm with the Path --with-llvmgccdir set.
llvm-svn: 44390
2007-11-28 05:13:45 +00:00
Tanya Lattner
8f342f8ef3 Fix bug in regression tests that ignored stderr output in RUN lines. Updated tests and fixed broken run lines.
XFAILed 3 arm regressions (will file bugs)

llvm-svn: 44389
2007-11-28 04:57:00 +00:00
Chris Lattner
d0d8d4e3b9 fix compilation error noticed by Nuno Lopes
llvm-svn: 44388
2007-11-28 04:30:09 +00:00
Evan Cheng
c1648b6a0d Recover compile time regression.
llvm-svn: 44386
2007-11-28 01:28:46 +00:00
Owen Anderson
30767b15e9 Add MachineLoopInfo. This is not yet tested.
llvm-svn: 44384
2007-11-27 22:47:08 +00:00
Chris Lattner
f247e27666 commit testcase I forgot to svn add.
llvm-svn: 44383
2007-11-27 22:43:37 +00:00
Chris Lattner
57662f3882 several entries got significantly better, though they still aren't done.
llvm-svn: 44382
2007-11-27 22:41:52 +00:00
Chris Lattner
f3f4ad9dd6 implement a trivial readme entry.
llvm-svn: 44380
2007-11-27 22:36:16 +00:00
Chris Lattner
79ae9895f6 Fix a crash on invalid code due to memcpy lowering.
llvm-svn: 44378
2007-11-27 22:14:42 +00:00
Ted Kremenek
7c81bdd4e7 Migrated static functions that print decls into a DeclPrinter class,
which is now used (or subclasssed) by the ASTConsumers.  This new class
stores a FILE* that is used for writing, instead of just hardwiring output
to stderr (it defaults to stderr if no FILE* is provided).

Modified CreateASTPrinter() to accept a FILE* for printing.

llvm-svn: 44377
2007-11-27 21:46:50 +00:00
Chris Lattner
da22eeca44 add several cases that Expr::hasStaticStorage missed, pointed out by Oliver Hunt
llvm-svn: 44376
2007-11-27 21:35:27 +00:00
Chris Lattner
1a6bb70ad0 Set loc earlier in CheckSingleInitializer to avoid emitting a
diagnostic without a location.  This produces:

simpleTest.c:2:18: error: initializer element is not constant
int *myPointer = &(myArray[2]);
                 ^~~~~~~~~~~~~

instead of:

error: initializer element is not constant
llvm-svn: 44375
2007-11-27 21:21:35 +00:00
Chris Lattner
be5f3cb6f1 Make this actually work on systems that support ppc long double.
llvm-svn: 44374
2007-11-27 20:45:25 +00:00
Chris Lattner
fffd0ae2f1 Unbreak all of the darwin/ppc32 JIT failures having to do
with not being able to find printf.

llvm-svn: 44373
2007-11-27 20:41:32 +00:00
Ted Kremenek
14d5f741ab Updated GenLibDeps.pl to employ "use strict" to help prevent uses of variables
that have not yet been defined.

Removed used of grep and sed when parsing the results of "nm". This was
originally motivated because if the user has specified options to grep using
the environment variable GREP_OPTIONS this could break the script. Piping
through grep/sed/sort/uniq is also (to my understanding) not necessary, and
the equivalent operations can be done much faster in the Perl script.

Using a crude benchmark, these changes resulted in a 3x speedup in the
execution of GenLibDeps.pl.

llvm-svn: 44372
2007-11-27 19:31:11 +00:00
Nate Begeman
6f026a654c Support returning non-power-of-2 vectors to unblock some work
llvm-svn: 44371
2007-11-27 19:28:48 +00:00
Andrew Lenharth
b960acebde something wrong with this opt
llvm-svn: 44370
2007-11-27 18:31:30 +00:00
Chris Lattner
a7944d86de sizeof is defined by bitsin(char) not by units of 8 bits.
llvm-svn: 44369
2007-11-27 18:22:04 +00:00
Anton Korobeynikov
75445ae2c3 Add testcase for last llvm-gcc tweaks
llvm-svn: 44368
2007-11-27 18:21:29 +00:00
Chris Lattner
1cfe02c38b update to match change in mainline llvm.
llvm-svn: 44367
2007-11-27 18:20:52 +00:00
Steve Naroff
0ee0b0ab8c Move the null pointer constant check from Sema::CheckSingleInitializer/ActOnCallExpr/CheckMessageArgumentTypes/ActOnReturnStmt to Sema::CheckSingleAssignmentConstraints. This makes sure all null pointer assignments are considered compatible.
Thanks to Seo Sanghyeon for the bug, follow-through, and patch!

llvm-svn: 44366
2007-11-27 17:58:44 +00:00
Ted Kremenek
c6298de211 Added quotes around $(NM_PATH) argument to GenLibDeps.pl script so that
the "-p" option is actually seen by nm (it was being dropped as it was
considered as separate argument to the Perl script).

llvm-svn: 44365
2007-11-27 17:53:54 +00:00
Chris Lattner
1dfc48d4f6 Unbreak backwards compatibility with bytecode format. Regression
introduced by this patch:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20071126/055824.html

llvm-svn: 44364
2007-11-27 17:48:06 +00:00
Duncan Sands
ad0ea2d430 Fix PR1146: parameter attributes are longer part of
the function type, instead they belong to functions
and function calls.  This is an updated and slightly
corrected version of Reid Spencer's original patch.
The only known problem is that auto-upgrading of
bitcode files doesn't seem to work properly (see
test/Bitcode/AutoUpgradeIntrinsics.ll).  Hopefully
a bitcode guru (who might that be? :) ) will fix it.

llvm-svn: 44359
2007-11-27 13:23:08 +00:00
Chris Lattner
db3467f8d4 handle __vector_size__ like vector_size
llvm-svn: 44358
2007-11-27 07:28:18 +00:00
Anders Carlsson
61d6f8d6c3 Add builtin type signature support for vector types. Add correct type signatures for a bunch of MMX builtins. We now parse all the intrinsics in mmintrin.h
llvm-svn: 44357
2007-11-27 07:22:09 +00:00
Anders Carlsson
24c59958f4 Add comment to CheckVectorCast.h
llvm-svn: 44356
2007-11-27 07:16:40 +00:00
Chris Lattner
f04b69b26c take an initial stab at setting function linkage right. Handle
static and inline at least.

llvm-svn: 44355
2007-11-27 06:46:51 +00:00
Zhou Sheng
34ffaeeeed Make this pass for CYGWIN.
llvm-svn: 44354
2007-11-27 06:23:59 +00:00
Zhou Sheng
73286d6309 Make this testcase compatible with CYGWIN.
llvm-svn: 44353
2007-11-27 06:17:01 +00:00
Chris Lattner
698b1cb28d err, no really.
llvm-svn: 44352
2007-11-27 06:14:32 +00:00
Chris Lattner
28caf2717a don't depend on ADL.
llvm-svn: 44351
2007-11-27 06:14:12 +00:00
Anders Carlsson
de71adff60 Report errors for invalid casts from/to vectors.
llvm-svn: 44350
2007-11-27 05:51:55 +00:00
Anders Carlsson
f511f646a4 Add more semantic analysis for inline asm statements.
llvm-svn: 44349
2007-11-27 04:11:28 +00:00
Owen Anderson
b0dd27ee91 Make LoopInfoBase more generic, in preparation for having MachineLoopInfo. This involves a small interface change.
llvm-svn: 44348
2007-11-27 03:43:35 +00:00
Owen Anderson
5aad0d7ea2 Add accessor for getting the underlying templated type. This is necessary for templated LoopInfo.
llvm-svn: 44347
2007-11-27 03:33:40 +00:00
Chuck Rose III
20a104c87f Moving TGLexer.h from source to header file tab in TableGen project file
llvm-svn: 44346
2007-11-27 01:25:12 +00:00
Dan Gohman
8bba724afc Change &| to |&.
llvm-svn: 44345
2007-11-27 00:50:57 +00:00
Dan Gohman
2dba0788a5 Change grep '' to grep {}.
Change 2>&1 | to |&.

llvm-svn: 44344
2007-11-27 00:10:35 +00:00
Dan Gohman
9ab9e9fa03 Don't redirect llvm-as's stderr to llvm-dis.
Change grep '' to grep {}.

llvm-svn: 44343
2007-11-27 00:07:33 +00:00
Dan Gohman
f151c8e760 Remove unnecessary && from the RUN lines of this test.
llvm-svn: 44342
2007-11-27 00:03:38 +00:00
Dan Gohman
9a69341725 Don't lower srem/urem X%C to X-X/C*C unless the division is actually
optimized. This avoids creating illegal divisions when the combiner is
running after legalize; this fixes PR1815. Also, it produces better
code in the included testcase by avoiding the subtract and multiply
when the division isn't optimized.

llvm-svn: 44341
2007-11-26 23:46:11 +00:00
Chuck Rose III
084b0eb3ca Add TGParser files to VStudio project files. Removed generated files section from TableGen project file as it is no longer needed. #Include <algorithm> directly from TGParser.cpp so it can see std::reverse.
llvm-svn: 44340
2007-11-26 23:19:59 +00:00
Ted Kremenek
fbb08bc2e2 Added optional pass-by-reference argument "isExact" to
NumericLiteralParser::GetFloatValue(). Upon method return, this flag has the value
true if the returned APFloat can exactly represent the number in the parsed text,
and false otherwise.

Modified the implementation of GetFloatValue() to parse literals using APFloat's
convertFromString method (which allows us to set the value of isExact).

llvm-svn: 44339
2007-11-26 23:12:30 +00:00
Ted Kremenek
871422eca9 Removed dependence on #including iostream.
llvm-svn: 44338
2007-11-26 22:50:46 +00:00
Ted Kremenek
6eefb85ef5 Fixed #include of objc/objc.h so that it works on case-sensitive filesystems.
llvm-svn: 44337
2007-11-26 22:49:09 +00:00
Ted Kremenek
2b0ce11952 Reverted changed to getTagDeclType() introduced in patch 44089:
http://llvm.org/viewvc/llvm-project?view=rev&revision=44089

"Decl" once again can no longer be NULL, so the NULL checks are not needed.

llvm-svn: 44336
2007-11-26 21:16:01 +00:00
Fariborz Jahanian
96502afb6f Fixed a rewrite bug in class synthesis (which I first thought was a rewrite API bug).
llvm-svn: 44335
2007-11-26 20:59:57 +00:00
Kevin
e01743a3a3 Removes link to status page till the info gets added. Someone put us on Reddit; Don't want it to look bad on the project. :)
http://programming.reddit.com/info/61f8g/comments/

llvm-svn: 44334
2007-11-26 20:47:14 +00:00
Fariborz Jahanian
a883d6ed89 Patch to fix a regression caused by recent rewrite changes.
A potential API bug in ReplaceText pending (A FIXME is added).

llvm-svn: 44333
2007-11-26 19:52:57 +00:00
Ted Kremenek
ebb1c0ca74 Fixed StmtPrinter to handle GCC extension to the ternary operator "?:" where
the LHS subexpression can be NULL.  Patch provided by Nuno Lopes!

llvm-svn: 44328
2007-11-26 18:27:54 +00:00
Ted Kremenek
138988765c Fixed bug in CFG construction where we did not properly handle the GCC
extension "?:" for the ternary operator, e.g.: x ?: y; This expression is
represented in the clang ASTs as a ConditionalOperator whose LHS expression is
NULL. Now we handle this special case, causing the block containing the
condition to be a predecessor to the block that "merges" the values of the
ternary operator.

Thanks to Nuno Lopes for identifying and diagnosing this bug!

llvm-svn: 44327
2007-11-26 18:20:26 +00:00
Bill Wendling
8da1db4f34 The checking for the delimiters of expected error/warning messages was
looking only for { and } instead of {{ and }}. Changed it to check for
this explicitly.

llvm-svn: 44326
2007-11-26 08:26:20 +00:00
Owen Anderson
9f0b6e9d46 Fix another bug that was causing siod to fail.
llvm-svn: 44325
2007-11-26 07:17:19 +00:00
Owen Anderson
7cad745d49 Fix a silly bug that Nicholas noticed.
llvm-svn: 44324
2007-11-26 03:27:38 +00:00
Owen Anderson
4f833c7610 Allow GVN to eliminate read-only function calls when it can detect that they are redundant.
llvm-svn: 44323
2007-11-26 02:26:36 +00:00
Chris Lattner
2ab40a6207 Fix sema support for the gnu ?: expression with a
missing middle expression, and fix a codegen bug where
we didn't correctly promote the condition to the right 
result type.  This fixes PR1824.

llvm-svn: 44322
2007-11-26 01:40:58 +00:00
Chris Lattner
a3ee6fa84f this works.
llvm-svn: 44321
2007-11-26 01:39:17 +00:00
Anton Korobeynikov
2f76e373ae Remove another leak. Due to some reason AliasSetTracker didn't had any dtor...
llvm-svn: 44320
2007-11-25 23:52:02 +00:00
Nick Lewycky
cdb7e54ca7 Add new SCEV, SCEVSMax. This allows LLVM to analyze do-while loops.
llvm-svn: 44319
2007-11-25 22:41:31 +00:00
Chris Lattner
c00e8adfe0 Implement PR1822
llvm-svn: 44318
2007-11-25 21:27:53 +00:00
Anton Korobeynikov
bd9df0f200 Remove a leak. Destroy LoopInfoBase object. releaseMemory() is actually called in its dtor.
llvm-svn: 44317
2007-11-25 18:41:39 +00:00
Chris Lattner
852ed06d60 sizeof() return size in bytes, not bits, patch by Nuno Lopes!
llvm-svn: 44316
2007-11-25 17:48:21 +00:00
Duncan Sands
185eeac0f8 Fix PR1816. If a bitcast of a function only exists because of a
trivial difference in function attributes, allow calls to it to
be converted to direct calls.  Based on a patch by Török Edwin.
While there, move the various lists of mutually incompatible
parameters etc out of the verifier and into ParameterAttributes.h.

llvm-svn: 44315
2007-11-25 14:10:56 +00:00
Reid Spencer
f7121af96d Don't ignore files that are no longer in use.
llvm-svn: 44313
2007-11-25 07:05:05 +00:00
Ted Kremenek
43fb8b0799 Moved logic for -Wfloat-equal to SemaChecking.cpp.
Moved utility functions IgnoreParen and friends to be static inline functions
defined in SemaUtil.h.

Added SemaUtil.h to Xcode project.

llvm-svn: 44312
2007-11-25 00:58:00 +00:00
Anders Carlsson
290aa8560b Check that the clobber registers are valid.
llvm-svn: 44311
2007-11-25 00:25:21 +00:00
Chris Lattner
5728bdd4db Fix a long standing deficiency in the X86 backend: we would
sometimes emit "zero" and "all one" vectors multiple times,
for example:

_test2:
	pcmpeqd	%mm0, %mm0
	movq	%mm0, _M1
	pcmpeqd	%mm0, %mm0
	movq	%mm0, _M2
	ret

instead of:

_test2:
	pcmpeqd	%mm0, %mm0
	movq	%mm0, _M1
	movq	%mm0, _M2
	ret

This patch fixes this by always arranging for zero/one vectors
to be defined as v4i32 or v2i32 (SSE/MMX) instead of letting them be
any random type.  This ensures they get trivially CSE'd on the dag.
This fix is also important for LegalizeDAGTypes, as it gets unhappy
when the x86 backend wants BUILD_VECTOR(i64 0) to be legal even when
'i64' isn't legal.

This patch makes the following changes:

1) X86TargetLowering::LowerBUILD_VECTOR now lowers 0/1 vectors into
   their canonical types.
2) The now-dead patterns are removed from the SSE/MMX .td files.
3) All the patterns in the .td file that referred to immAllOnesV or
   immAllZerosV in the wrong form now use *_bc to match them with a
   bitcast wrapped around them.
4) X86DAGToDAGISel::SelectScalarSSELoad is generalized to handle 
   bitcast'd zero vectors, which simplifies the code actually.
5) getShuffleVectorZeroOrUndef is updated to generate a shuffle that
   is legal, instead of generating one that is illegal and expecting
   a later legalize pass to clean it up.
6) isZeroShuffle is generalized to handle bitcast of zeros.
7) several other minor tweaks.

This patch is definite goodness, but has the potential to cause random
code quality regressions.  Please be on the lookout for these and let 
me know if they happen.

llvm-svn: 44310
2007-11-25 00:24:49 +00:00
Anders Carlsson
c163657f2f Forgot some X86 registers
llvm-svn: 44309
2007-11-25 00:23:10 +00:00
Anders Carlsson
5fa3f348f7 Add tables for GCC register names and aliases. This will be used for inline asm
llvm-svn: 44308
2007-11-24 23:38:12 +00:00
Ted Kremenek
0d20033c6a Added more test cases for uninitialized values checker.
llvm-svn: 44307
2007-11-24 23:06:58 +00:00
Ted Kremenek
2e04d73d83 Fixed bogus culling of uninitialized-values "taint" propagation during assignments.
We accidentally were throttling the propagation of uninitialized state across
assignments (e.g. x = y).  Thanks to Anders Carlsson for spotting this problem.

Added test cases to test suite to provide regression testing for the
uninitialized values analysis.

llvm-svn: 44306
2007-11-24 20:07:36 +00:00
Ted Kremenek
33407b3338 Moved dead-stores test cast to a new test suite subdirectory: Analysis.
llvm-svn: 44305
2007-11-24 19:49:35 +00:00
Chris Lattner
cab915f9cf Implement expand support for MERGE_VALUEs that only produces one result.
llvm-svn: 44304
2007-11-24 19:12:15 +00:00
Chris Lattner
6a49593aa5 add a immAllZerosV_bc pattern fragment for consistency with others.
llvm-svn: 44303
2007-11-24 19:02:07 +00:00
Chris Lattner
f72ad16263 remove bogus assertion that broke CodeGen/Generic/cast-fp.ll on x86
among others.

llvm-svn: 44302
2007-11-24 18:37:20 +00:00
Chris Lattner
6e3641897b Implement support for custom legalization in DAGTypeLegalizer::ExpandOperand.
Improve a comment.
Unbreak Duncan's carefully written path compression where I didn't realize
what was happening!

llvm-svn: 44301
2007-11-24 18:11:42 +00:00
Chris Lattner
f81d5886c6 Several changes:
1) Change the interface to TargetLowering::ExpandOperationResult to 
   take and return entire NODES that need a result expanded, not just
   the value.  This allows us to handle things like READCYCLECOUNTER,
   which returns two values.
2) Implement (extremely limited) support in LegalizeDAG::ExpandOp for MERGE_VALUES.
3) Reimplement custom lowering in LegalizeDAGTypes in terms of the new
   ExpandOperationResult.  This makes the result simpler and fully 
   general.
4) Implement (fully general) expand support for MERGE_VALUES in LegalizeDAGTypes.
5) Implement ExpandOperationResult support for ARM f64->i64 bitconvert and ARM
   i64 shifts, allowing them to work with LegalizeDAGTypes.
6) Implement ExpandOperationResult support for X86 READCYCLECOUNTER and FP_TO_SINT,
   allowing them to work with LegalizeDAGTypes.

LegalizeDAGTypes now passes several more X86 codegen tests when enabled and when
type legalization in LegalizeDAG is ifdef'd out.

llvm-svn: 44300
2007-11-24 07:07:01 +00:00
Chris Lattner
ab98c41337 add a note
llvm-svn: 44299
2007-11-24 06:13:33 +00:00
Chris Lattner
f5dfd15e98 upgrade this test
llvm-svn: 44298
2007-11-24 05:39:29 +00:00
Anders Carlsson
660bdd1c87 Keep track of whether the asm is volatile or not.
llvm-svn: 44297
2007-11-23 23:12:25 +00:00
Chris Lattner
893fe3bbd1 Fix PR1816, by correcting the broken definition of APInt::countTrailingZeros.
llvm-svn: 44296
2007-11-23 22:42:31 +00:00
Chris Lattner
69ec1ec86a simplify some code.
llvm-svn: 44295
2007-11-23 22:36:49 +00:00
Chris Lattner
c2c4c7456c Fix APInt::countTrailingZeros to return BitWidth if the input is zero instead of returning some random large number.
llvm-svn: 44294
2007-11-23 22:36:25 +00:00
Chris Lattner
0cf083815a add a comment.
llvm-svn: 44293
2007-11-23 22:35:18 +00:00
Chris Lattner
7514abe56e splice some lines together, no functionality change.
llvm-svn: 44292
2007-11-23 22:34:59 +00:00
Chris Lattner
752b05fe94 !< is >=, not >. Thanks to Max Hailperin for pointing this out!
llvm-svn: 44291
2007-11-23 22:19:33 +00:00
Chris Lattner
136449a6d7 improve codegen for global variable initializers, implementing
test/CodeGen/global-with-initialiser.c

Patch by Oliver Hunt!

llvm-svn: 44290
2007-11-23 22:07:55 +00:00
Anders Carlsson
80a5ea3552 Check asm input and output expressions.
llvm-svn: 44289
2007-11-23 19:43:50 +00:00
Duncan Sands
8a3e9d2bee Ding dong, the DoesntAccessMemoryFns and
OnlyReadsMemoryFns tables are dead!  We
get more, and more accurate, information
from gcc via the readnone and readonly
function attributes.

llvm-svn: 44288
2007-11-23 19:30:27 +00:00
Duncan Sands
b23192f483 Remove some logic I thoughtlessly copied over
from the old ADCE implementation (there it was
correct because the transform was being done
for read-only functions).

llvm-svn: 44287
2007-11-23 09:10:17 +00:00
Chris Lattner
a8fbde3f78 Fix a bug where we'd try to find a scev value for a bitcast operand,
even though the bitcast operand did not have integer type.  This fixes
PR1814.

llvm-svn: 44286
2007-11-23 08:46:22 +00:00
Chris Lattner
9fcdc52243 Fix PR1820, an incredibly subtle macro expansion bug that Neil discovered.
Neil, please review this fix.

llvm-svn: 44285
2007-11-23 06:50:21 +00:00
Chris Lattner
1985d96dc9 Fix PR1817.
llvm-svn: 44284
2007-11-22 23:47:13 +00:00
Chris Lattner
a717ce7c70 add some static icmpinst predicates.
llvm-svn: 44283
2007-11-22 23:43:29 +00:00
Chris Lattner
176d048901 add missing #include
llvm-svn: 44282
2007-11-22 23:19:05 +00:00
Anton Korobeynikov
59c11686cc Don't crash on bogus llvm.noinline. This is first part of PR1817 (preventing reduction)
llvm-svn: 44281
2007-11-22 22:30:10 +00:00
Duncan Sands
a915b538d3 Turn invokes of nounwind functions into ordinary calls.
llvm-svn: 44280
2007-11-22 22:24:59 +00:00
Duncan Sands
38a5e82ef4 Teach alias analysis about readnone/readonly functions.
Based on a patch by Török Edwin.

llvm-svn: 44279
2007-11-22 21:43:27 +00:00
Duncan Sands
1c97d752df Readonly/readnone functions are allowed to throw
exceptions, so don't turn invokes of them into
calls.

llvm-svn: 44278
2007-11-22 21:40:06 +00:00
Chris Lattner
5241695dca resolve the last fixme's in the new tblgen parser.
llvm-svn: 44277
2007-11-22 21:06:59 +00:00
Chris Lattner
695506c046 change the Init print methods to return strings, and implement
print in terms of that.

llvm-svn: 44276
2007-11-22 21:05:25 +00:00
Chris Lattner
1b1e96b8d7 eliminate a bunch of print methods that are duplicate with the getAsString() method.
llvm-svn: 44275
2007-11-22 20:51:34 +00:00
Chris Lattner
f4127dd48e Rewrite the tblgen parser in a recursive descent style, eliminating the bison parser.
This makes the parser much easier to understand, eliminates a ton of global variables,
and gives tblgen nice caret diagnostics.  It is also faster, but tblgen probably doesn't
care about performance.

There are a couple of FIXMEs which I will take care of next.

llvm-svn: 44274
2007-11-22 20:49:04 +00:00
Duncan Sands
a89a113a20 Rename the 'const' parameter attribute to 'readnone',
and the 'pure' parameter attribute to 'readonly'.
Names suggested by DannyB.

llvm-svn: 44273
2007-11-22 20:23:04 +00:00
Nick Lewycky
3783b46f9e Instead of calculating constant factors, calculate the number of trailing
bits. Patch from Wojciech Matyjewicz.

llvm-svn: 44268
2007-11-22 07:59:40 +00:00
Nick Lewycky
016547d226 Create nodes for inline asm so that we don't crash looking for the node later.
llvm-svn: 44267
2007-11-22 03:07:37 +00:00
Anders Carlsson
94ea8aab34 Store output and input operands as well as clobber information in the AsmStmt. Ted, could you please review the serialization/deserialization code?
llvm-svn: 44266
2007-11-22 01:36:19 +00:00
Anders Carlsson
091a059c55 GCC fails if there is a trailing colon but no clobbers.
llvm-svn: 44265
2007-11-21 23:27:34 +00:00
Chuck Rose III
738fa17c4e Switching back to strtoll. Including config.h. On VStudio builds, this overrides strtoll.
llvm-svn: 44264
2007-11-21 19:36:25 +00:00
Duncan Sands
b87dde7e8e Fix a bug in which node A is replaced by node B, but later
node A gets back into the DAG again because it was hiding in
one of the node maps: make sure that node replacement happens
in those maps too.

llvm-svn: 44263
2007-11-21 16:43:19 +00:00
Nick Lewycky
1d6f196245 typo
llvm-svn: 44262
2007-11-21 05:21:54 +00:00
Dale Johannesen
e70850cf7b Fix compiler warning.
llvm-svn: 44261
2007-11-21 00:45:00 +00:00
Chuck Rose III
07b57d2626 This change does a couple of things. First it gets the Visual Studio builds working.
I added the lexing files to the VStudio projects and removed the .l files from the 
VStudio projects.  There was a problem with use of strtoll in TGLexer.cpp and Chris
suggested switching to strtol, so that's included here.

Additionally, this checkin adds minimal x64 builds to the VStudio builds.  Build issues
related to x64 in the windows specific files for DynamicLibrary.inc and Singals.inc
are worked around, but not ultimately solved.  Binaries used to be stored in

...\win32\{Debug|Release}

but are now kept in

...\win32\bin\{win32|x64}\{Debug|Release}

intermediate files will continue to be stored in the individual project directories under 
win32.  

Some names will likely change in the future to reflect that the vstudio projects
are no longer 32-bit only, but I wanted to get things up and running today so kept away
from bigger restructuring.

llvm-svn: 44260
2007-11-21 00:37:56 +00:00
Dale Johannesen
f265bec4b0 File missing from previous patch.
llvm-svn: 44259
2007-11-20 23:25:17 +00:00
Dale Johannesen
763e110a9f Fix .eh table linkage issues on Darwin. Some EH support
for Darwin PPC, but it's not fully working yet.

llvm-svn: 44258
2007-11-20 23:24:42 +00:00
Chris Lattner
8b9ecdad0c Add the ability to convert a tblgen type to a string.
llvm-svn: 44257
2007-11-20 22:25:16 +00:00
Anders Carlsson
81a5a69682 Store inline asm code in the AST.
llvm-svn: 44255
2007-11-20 19:21:03 +00:00
Anders Carlsson
4f8eb127e1 Add __builtin_abs
llvm-svn: 44254
2007-11-20 19:05:17 +00:00
Chris Lattner
5c3f1541a7 Improve function decl merging, patch by Oliver Hunt!
llvm-svn: 44253
2007-11-20 19:04:50 +00:00
Duncan Sands
04eb67e69a In order for parameter attribute uniquing to make
any sense it is important that ParamAttr::None gets
treated the same as not supplying an attribute at
all.  Rather than stripping ParamAttr::None out of
the list of attributes, assert if ParamAttr::None
is seen.  Fix up the bitcode reader which liked to
insert ParamAttr::None all over the place.  Patch
based on one by Török Edwin.

llvm-svn: 44250
2007-11-20 14:09:29 +00:00
Nick Lewycky
74a26e3750 Small cleanup. Use APInt::getHighBitsSet method instead of shift left.
"setcc" -> "icmp op" in comments. No functionality change.

llvm-svn: 44249
2007-11-20 08:44:50 +00:00
Nick Lewycky
5b18bd3368 Be more careful when transforming | to +. Patch from Wojciech Matyjewicz.
llvm-svn: 44248
2007-11-20 08:24:44 +00:00
Ted Kremenek
9e823c745d Added another test case for the Dead Stores checker that tests that
block-level expressions are evaluated the same as regular expressions. Test
case provided by Nuno Lopes.

llvm-svn: 44247
2007-11-20 03:03:00 +00:00
Ted Kremenek
9d0acca967 Updated CFGStmtVisitor and CFGRecStmtVisitor to have a notion of
"block-expressions" when visiting arbitrary expressions (via calls to
"Visit()").  This results in a refactoring where a dataflow analysis no
longer needs to always special case when handling block-expressions versus
non-block expressions.

Updated LiveVariables and UninitializedValues to conform to the slightly
altered interface of these visitor classes.

Thanks to Nuno Lopes for providing a test case that illustrated some
fundamental problems in the current design of the CFGXXXStmtVisitor classes
and how they were used.

llvm-svn: 44246
2007-11-20 03:01:58 +00:00
Chris Lattner
6edac0ad1d Testcase for PR1811
llvm-svn: 44244
2007-11-19 21:43:22 +00:00
Chris Lattner
09c0393d5e ExpandUnalignedLoad doesn't handle vectors right at all apparently.
Fix a couple of problems:
1. Don't assume the VT-1 is a VT that is half the size.
2. Treat vectors of FP in the vector path, not the FP path.

This has a couple of remaining problems before it will work with
the code in PR1811: the code below this change assumes that it can
use extload/shift/or to construct the result, which isn't right for
vectors.

This also doesn't handle vectors of 1 or vectors that aren't pow-2.

llvm-svn: 44243
2007-11-19 21:38:03 +00:00
Chris Lattner
6fa95ec19d Implement vector expand support for shuffle_vector. This fixes PR1811.
llvm-svn: 44242
2007-11-19 21:16:54 +00:00
Dan Gohman
aad83c8ee5 Remove meaningless qualifiers from return types, avoiding compiler warnings.
llvm-svn: 44240
2007-11-19 20:46:23 +00:00
Chris Lattner
67d77945e7 Implement splitting of UNDEF nodes. This is the first step towards fixing PR1811
llvm-svn: 44239
2007-11-19 20:21:32 +00:00
Ted Kremenek
e866e7b6fc Removed PersistentMap. It is now superseded in every way by the ImmutableMap
and ImmutableSet classes in the main LLVM libraries.

llvm-svn: 44237
2007-11-19 17:25:30 +00:00
Owen Anderson
c280216c00 Teach me to do stuff late at night.
llvm-svn: 44236
2007-11-19 16:10:59 +00:00
Dan Gohman
12a8610490 Fix a typo in a comment.
llvm-svn: 44235
2007-11-19 15:36:19 +00:00
Dan Gohman
d32081002e Add explicit keywords.
llvm-svn: 44234
2007-11-19 15:30:20 +00:00
Dan Gohman
36347a26f9 Add support in SplitVectorOp for remainder operators.
llvm-svn: 44233
2007-11-19 15:15:03 +00:00
Owen Anderson
99057116f6 Fix a factually incorrect statement pointed out by Max Hailperin.
llvm-svn: 44228
2007-11-19 07:44:43 +00:00
Chris Lattner
4205d25f06 Record the start of the current token, for use in error reporting.
llvm-svn: 44227
2007-11-19 07:43:52 +00:00
Chris Lattner
1a26296453 Add carat diagnostics to tblgen lexer errors.
llvm-svn: 44226
2007-11-19 07:38:58 +00:00
Ted Kremenek
eb8471bfa1 Added test case for dead stores checker (live variables analysis) that tests
for correct propagation/update of liveness information within subexpressions
of Block-Level expressions.  Test case provided by Nuno Lopes.

llvm-svn: 44225
2007-11-19 06:38:23 +00:00
Ted Kremenek
850f1155ad Fixed bug where LiveVariables was not properly propagating updates to liveness
state that occurred in subexpressions of Block-Level expressions. Bug and fix
provided by Nuno Lopes.

llvm-svn: 44224
2007-11-19 06:36:49 +00:00
Anders Carlsson
9c1011c090 Put back the flags field in the constant CF string type.
llvm-svn: 44222
2007-11-19 00:25:30 +00:00
Ted Kremenek
094079c0dc Added test case for dead-stores checker. Test case provided by Nuno Lopes.
llvm-svn: 44221
2007-11-18 20:06:35 +00:00
Ted Kremenek
7016e4d509 Fixed bug in WalkaST_VisitDeclSubExprs where we failed to properly check if
the StmtIterator referring to the initializers of a chain of Decls was equal
to the "end" iterator. The particular bug manifested when an iterator was
created on a chain of decls with no initializers.

Thanks to Nuno Lopes for reporting this bug and providing a patch.

llvm-svn: 44220
2007-11-18 20:06:01 +00:00
Chris Lattner
44158478bb Fix the Linker testcase regressions, by making MemoryBuffer::getFileOrSTDIN return
a valid but empty buffer if stdin is empty.

llvm-svn: 44219
2007-11-18 18:52:28 +00:00
Chris Lattner
b01e500f16 autoupgrade files that use callfoo as call foo.
llvm-svn: 44218
2007-11-18 18:43:24 +00:00
Chris Lattner
f527037485 print a call to a fastcc function as:
call x86_fastcallcc void @func( i32* %X, i64 0 )
not:
	callx86_fastcallcc  void @func( i32* %X, i64 0 )

This fixes Codegen/X86/fast-cc-merge-stack-adj.ll

llvm-svn: 44217
2007-11-18 18:32:16 +00:00
Chris Lattner
861302e264 fix bogus test that the more strict lexer is finding.
llvm-svn: 44216
2007-11-18 18:26:45 +00:00
Chris Lattner
c3cc30cdb8 Bugfix, this fixes CodeGen/X86/ldzero.ll and CodeGen/X86/2007-10-16-fp80_select.ll
llvm-svn: 44215
2007-11-18 18:25:18 +00:00
Chris Lattner
660c6b9a92 Replace the original flex lexer with a hand writen one. This
drops a dependency on flex and lets us make future progress more 
easily.  Yay for 2 fewer .cvs files to make silly conflicts with.

llvm-svn: 44213
2007-11-18 08:46:26 +00:00
Chris Lattner
6070028736 minor cleanups
llvm-svn: 44212
2007-11-18 05:48:46 +00:00
Chris Lattner
98c39513ab ensure header is self contained.
llvm-svn: 44211
2007-11-18 05:25:45 +00:00
Chris Lattner
da4ab67127 reimplement the tblgen lexer with a simple hand-written lexer. This eliminates
one dependency on flex and gets rid of two ".cvs" files.

llvm-svn: 44210
2007-11-18 02:57:27 +00:00
Steve Naroff
14f5f79bb6 Now that we are passing back "free standing decls", make sure -ast-dump works like -ast-print.
Also added a cast to be safe...

llvm-svn: 44209
2007-11-17 21:37:36 +00:00
Steve Naroff
c1e6d60b14 Make sure Sema::ParsedFreeStandingDeclSpec() returns a decl representing the type.
Adding basic printing to StmtPrinter::PrintRawDecl().

llvm-svn: 44208
2007-11-17 21:21:01 +00:00
Nate Begeman
d4d45c268c Add support for vectors to int <-> float casts.
llvm-svn: 44204
2007-11-17 03:58:34 +00:00
Ted Kremenek
b6c40f3f1b Reverted patch 44199:
http://llvm.org/viewvc/llvm-project?rev=44199&view=rev

This patch completely broke serialization due to an invariant I assumed but
did not hold. The assumed invariant was that all pointer IDs emitted by a call
to BatchEmitOwnedPtrs would be consecutive. This is only the case if there has
been no forward references to an owned pointer (and hence already registered
with the Serializer object).

llvm-svn: 44203
2007-11-17 03:34:33 +00:00
Dale Johannesen
7d97662467 Remove indeterminism from a loop. We think this will
fix an occasional nonrepeatable bootstrap failure we've
been seeing on Darwin.

llvm-svn: 44202
2007-11-17 02:48:01 +00:00
Dale Johannesen
06a10df562 Fix denormal check in float->APInt conversion.
PR 1804.

llvm-svn: 44201
2007-11-17 01:02:27 +00:00
Ted Kremenek
9d89f980aa Changed implementation of Serialize::EmitDiffPtrID and
Deserialize::ReadDiffPtrID to read and emit bools instead of unsigned
integers. This should result in a nice space optimization once we have
"auto-abbreviation" generation in place.

llvm-svn: 44200
2007-11-17 00:45:37 +00:00
Ted Kremenek
4d1e79c8ac Implemented optimization for BatchEmitOwnedPtrs that we only emit one complete
SerializedPtrID, followed by the *differences* in IDs. The big idea is that
most IDs will be just be 1 off from the previous (either that or NULL, which
we encode as a difference if 0), so this will greatly reduce the encoding
space for extra IDs to just 1 bit per pointer.

So far this optimization reduces serialization of Carbon.h by only 1%, but
we aren't using any abbreviations now in the Bitcode file to properly take
advantage of this optimization.

llvm-svn: 44199
2007-11-17 00:40:45 +00:00
Evan Cheng
8e22379303 Live interval splitting:
When a live interval is being spilled, rather than creating short, non-spillable
intervals for every def / use, split the interval at BB boundaries. That is, for
every BB where the live interval is defined or used, create a new interval that
covers all the defs and uses in the BB.

This is designed to eliminate one common problem: multiple reloads of the same
value in a single basic block. Note, it does *not* decrease the number of spills
since no copies are inserted so the split intervals are *connected* through
spill and reloads (or rematerialization). The newly created intervals can be
spilled again, in that case, since it does not span multiple basic blocks, it's
spilled in the usual manner. However, it can reuse the same stack slot as the
previously split interval.

This is currently controlled by -split-intervals-at-bb.

llvm-svn: 44198
2007-11-17 00:40:40 +00:00
Evan Cheng
aa72f72bd3 Shrinkfy.
llvm-svn: 44197
2007-11-17 00:31:16 +00:00
Evan Cheng
13e8b022f5 Typo.
llvm-svn: 44196
2007-11-16 23:55:08 +00:00
Dale Johannesen
a674612d94 Testcase from PR 1508 (although its's somewhat
orthogonal to the main problem there)

llvm-svn: 44194
2007-11-16 23:16:35 +00:00
Tanya Lattner
1db762ba63 Fix for PR1801
llvm-svn: 44193
2007-11-16 22:44:50 +00:00
Ted Kremenek
f115550f6f Added assertion in serialization of DeclRefExprs. DeclRefExprs can only
own the decl they reference if it is a FunctionDecl.  Note that his
ownership property is still considered a hack, and should be fixed.

llvm-svn: 44192
2007-11-16 19:00:35 +00:00
Ted Kremenek
50d7f6f620 Fixed bug in the serialization of FunctionDecls. We would incorrectly
query for the number of parameters for FunctionDecls that had type
FunctionTypeNoProto.

llvm-svn: 44191
2007-11-16 18:11:10 +00:00
Chris Lattner
48d52848d7 Tighten up address-of checking, implementing test/Sema/expr-address-of.c.
This fixes a bug reported by Seo Sanghyeon.

This was meant to be committed yesterday, but the commit failed.  doh.

llvm-svn: 44190
2007-11-16 17:46:48 +00:00
Anton Korobeynikov
b8a47244ac These were implemented
llvm-svn: 44189
2007-11-16 11:12:01 +00:00
Chris Lattner
c53b18362a Fix PR1800 by correcting mistaken logic.
llvm-svn: 44188
2007-11-16 06:04:17 +00:00
Chris Lattner
1b3f58a816 fix a typo
llvm-svn: 44187
2007-11-16 05:32:05 +00:00
Anton Korobeynikov
91460e43f1 Implement codegen for flt_rounds on x86
llvm-svn: 44183
2007-11-16 01:31:51 +00:00
Anton Korobeynikov
66b91e66ec Implement necessary bits for flt_rounds gcc builtin.
Codegen bits and llvm-gcc support will follow.

llvm-svn: 44182
2007-11-15 23:25:33 +00:00
Nate Begeman
bd117f06ba Basic non-power-of-2 vector support
llvm-svn: 44181
2007-11-15 21:15:26 +00:00
Chris Lattner
0640e3ef35 Fix transient failure on Lex/c90.c due to an uninit variable.
llvm-svn: 44180
2007-11-15 19:22:40 +00:00
Chris Lattner
4dcbc2090a add header file I forgot to check in
llvm-svn: 44179
2007-11-15 19:22:18 +00:00
Chris Lattner
609d413363 fix a bug Steve noticed, where a #import of the main file itself would fail.
llvm-svn: 44178
2007-11-15 19:07:47 +00:00
Anton Korobeynikov
6a7ddfdb8f Reverted r44163 per request
llvm-svn: 44177
2007-11-15 18:33:16 +00:00
Ted Kremenek
07941e21e9 Added hack when serializing DeclRefExprs. This should probably be fixed.
Some FunctionDecls do not appear at the top-level or are owned by a DeclStmt.
In calls to implicitly defined functions, a FunctionDecl is created, but only
the DeclRefExprs reference them. Since an implicitly defined function may be
called multiple times, there is no clear ownership model for such objects.

Temporary solution: when serializing out DeclRefExprs, emit an ownership bit
for the Decl. This bit is determined by querying the serializer to see if the
Decl has already been serialized. If it hasn't, emit the Decl as an owned
pointer.

I repeat: this is a hack.  This should be fixed.

llvm-svn: 44176
2007-11-15 18:26:39 +00:00
Ted Kremenek
4791e1a7bd Started separate section for method definitions for ObjC serialization.
Added missing deserialization case in Stmt::Create() switch statement.

llvm-svn: 44175
2007-11-15 18:10:29 +00:00
Daniel Berlin
bb3b099f82 Fix bugs in iterator invalidation
llvm-svn: 44174
2007-11-15 18:06:49 +00:00
Steve Naroff
c8fcbe09d0 No need to forward declare definition of objc_super...
llvm-svn: 44173
2007-11-15 17:06:21 +00:00
Steve Naroff
e3ffc2f4a9 Finish up variadic methods/messages.
llvm-svn: 44172
2007-11-15 13:05:42 +00:00
Steve Naroff
d8ea1ac576 Implement support for variadic methods (work in progress).
llvm-svn: 44171
2007-11-15 12:35:21 +00:00
Steve Naroff
05caa48fb4 Extend RewriteTest::RewriteObjCIvarRefExpr() to cope with static typing (when using -> on a type which corresponds to the implementation type).
llvm-svn: 44170
2007-11-15 11:33:00 +00:00
Steve Naroff
44864e48bd Tweak funky cast to accommodate messaging 'super'. This removes any spurious warnings.
llvm-svn: 44169
2007-11-15 10:43:57 +00:00
Steve Naroff
7fa2f040f3 Rewrite for messaging 'super'.
The code gen. results in some spurious warnings...a cast is forthcoming.

llvm-svn: 44168
2007-11-15 10:28:18 +00:00
Duncan Sands
d4494352f8 This assertion was bogus.
llvm-svn: 44167
2007-11-15 09:54:37 +00:00
Evan Cheng
2c1a50455c Fix a thinko in post-allocation coalescer.
llvm-svn: 44166
2007-11-15 08:13:29 +00:00
Nate Begeman
847bfbcaf0 Break out bool/true/false support into a LangOption
llvm-svn: 44164
2007-11-15 07:30:50 +00:00
Nick Lewycky
fbb24817cc Fix handling of overflow in loop calculation by adding new UDiv SCEV. This SCEV
is disabled in the sense that it will refuse to create one from a UDiv
instruction, until the code is better tested.

llvm-svn: 44163
2007-11-15 06:30:50 +00:00
Chris Lattner
0841c3b560 Fix PR1788 by taking the approach suggested by Richard Smith.
Thanks to him for his detailed analysis of the problem.

llvm-svn: 44162
2007-11-15 06:10:55 +00:00
Chris Lattner
820c1447b4 Import the boost scoped_ptr class to LLVM. This patch was prepared by
Cédric Venet.

llvm-svn: 44161
2007-11-15 05:57:06 +00:00
Nate Begeman
4c18c23eb3 Implement codegen of CXX Bool
llvm-svn: 44160
2007-11-15 05:40:03 +00:00
Chris Lattner
bb31a42fef Handle "bool" in all places that touch _Bool.
This fixes code like "if((bool)x) {}" for example.

Patch by Nate Begeman.

llvm-svn: 44159
2007-11-15 05:25:19 +00:00
Owen Anderson
1b74a9a628 More templatization.
llvm-svn: 44158
2007-11-15 05:00:15 +00:00
Chris Lattner
add10eecf9 many edits, patch by Kelly Wilson!
llvm-svn: 44157
2007-11-15 04:51:31 +00:00
Steve Naroff
f60782b8c9 - Implement ivar rewrite (patch by Fariborz).
- RewriteMessageExpr()...make implicit casts explicit with synthesizing call (removing warnings when calling objc_msgSend()).

llvm-svn: 44156
2007-11-15 02:58:25 +00:00
Bill Wendling
b3712f8146 Adding debug output during coalescing.
llvm-svn: 44154
2007-11-15 02:06:30 +00:00
Bill Wendling
8269925b1e Need to increment the iterator.
llvm-svn: 44153
2007-11-15 00:40:48 +00:00
Ted Kremenek
c5f3e5371c Fixed serious bug in BatchReadOwnedPtrs where in a chain of calls to
deserialize objects if BatchReadOwnedPtrs was called more than once in the
same call chain then the second call would overwrite the SerializedPtrIDs
being used by the first call. Solved this problem by making the vector that
holds the pointer IDs local to a function call. Now BatchReadOwnedPtrs is
reentrant.

llvm-svn: 44152
2007-11-15 00:05:03 +00:00
Steve Naroff
909d666681 Refinement to previous commit. Always cast the first argument to "id"...no need to special case self.
llvm-svn: 44149
2007-11-15 00:00:21 +00:00
Steve Naroff
e7f181986a Cast implicit "self" argument to "id". This removes all warnings associated with implicit references to self. It doesn't yet deal withexplicit references to self...
llvm-svn: 44148
2007-11-14 23:54:14 +00:00
Ted Kremenek
cf7a20a6c4 Fixed bug in serialization of EnumConstantDecl where we improperly
"default constructed" an APSInt.  Fixed another bug in the same method
where we did not allow the NextDeclarator to be NULL.

llvm-svn: 44147
2007-11-14 23:38:09 +00:00
Ted Kremenek
c77e5a126c Fixed bug when serializing QualTypes where we were serializing in the
qualifiers as part of the pointer address.

llvm-svn: 44146
2007-11-14 23:35:01 +00:00
Steve Naroff
03f2767368 Always generate a typedef for @class. The typedef removal logic that I'm removing only made sense when we were operating on preprocess files without typedef guards. Now that we have guards, it is incorrect to ever remove one (since it may increase the likelihood that the rewritten header can't be included stand alone).
llvm-svn: 44145
2007-11-14 23:02:56 +00:00
Chris Lattner
174a825f01 Fix a rewriter bug that steve noticed. Don't skip arbitrary things
between an @ and a p, just skip whitespace.

llvm-svn: 44144
2007-11-14 22:57:51 +00:00
Ted Kremenek
83b75f5ee8 Added QualType::ReadBackpatch to allow QualType initialization with
backpatching. This original was available, but then we removed it. It is back
again to help with deserialization of FieldDecls. Because FieldDecls are
currently owned by RecordDecls, which are owned by a TagType, the type of the
FieldDecl may not be deserialized prior to deserializing the FieldDecl. Thus
backpatching solves the problem of constructing a FieldDecl that references a
type that has not yet been deserialized.

Simplified serialization of TagType to not require passing in the
SerializedPtrID. Registration of the materialized type object is done after
the CreateImpl method returns (as with other types).

llvm-svn: 44143
2007-11-14 22:51:02 +00:00
Fariborz Jahanian
c6225532c3 Patch to comment out use of protocol qualifiers when rewriting ivars.
llvm-svn: 44142
2007-11-14 22:26:25 +00:00
Duncan Sands
f171b35c8b I discover array_lengthof, thanks to gabor on #llvm.
llvm-svn: 44139
2007-11-14 21:58:02 +00:00
Ted Kremenek
e25b79ff84 Implemented serialization of InitListExpr.
llvm-svn: 44137
2007-11-14 21:31:46 +00:00
Ted Kremenek
3db07a7016 Implemented serialization of CompoundLiteralExpr.
llvm-svn: 44134
2007-11-14 21:18:36 +00:00
Ted Kremenek
fab0c76a25 Added serialization of Union decls.
llvm-svn: 44133
2007-11-14 21:15:42 +00:00
Duncan Sands
730a32643f Tweak the descriptions of the new 'const' and 'pure' attributes.
llvm-svn: 44132
2007-11-14 21:14:02 +00:00
Ted Kremenek
00e0b40599 Removed assertion inserted only for temporary debugging.
llvm-svn: 44131
2007-11-14 19:36:11 +00:00
Ted Kremenek
ec56081f38 Added missing break statement.
Reordered serialization methods for FunctionTypeProto and FunctionTypeNoProto
to be alphabetical by serialized type name.

llvm-svn: 44130
2007-11-14 19:33:01 +00:00
Steve Naroff
dde78986fb Fairly major surgery to RewriteTest::SynthesizeObjcInternalStruct().
This allows us to handle funky stuff like...

#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
@interface NSLayoutManager : NSObject <NSCoding, NSGlyphStorage> {
#else /* MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 */
@interface NSLayoutManager : NSObject <NSCoding> {
#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 */

...which now rewrites to...

#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
#ifndef _REWRITER_typedef_NSLayoutManager
#define _REWRITER_typedef_NSLayoutManager
typedef struct objc_object NSLayoutManager;
#endif

struct NSLayoutManager {
    struct NSObject _NSObject;

#else /* MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 */
// @interface NSLayoutManager : NSObject <NSCoding> {
#endif /* MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3 */

llvm-svn: 44129
2007-11-14 19:25:57 +00:00
Evan Cheng
0cbe920d7c Oops. Debugging code shouldn't have been checked in.
llvm-svn: 44128
2007-11-14 19:08:32 +00:00
Ted Kremenek
26ba7973ea Implemented serialization of EnumDecl and EnumConstantDecl.
llvm-svn: 44127
2007-11-14 18:12:19 +00:00
Ted Kremenek
8e93ca3de5 Implemented serialization of FieldDecls.
llvm-svn: 44126
2007-11-14 17:47:01 +00:00
Ted Kremenek
31ae973708 SourceManager, IdentifierTable, Selectors are now serialized in their own
block separate from ASTContext. This block is serialized out AFTER writing out
ASTContext, but deserialized BEFORE reading in ASTContext. This permits the
optimization of the serialization of the IdentifierTable where we only write
out identifiers that are used.

This was needed because TagDecls are owned by Types, and TagDecls contain
identifiers. Thus types need to be written out first to register with the
serializer any identifiers they refer to (and hence need to be serialized out
with IdentifierTable).

llvm-svn: 44125
2007-11-14 17:46:35 +00:00
Ted Kremenek
1172416d65 Removed debug #define that was accidentally checked in while debugging
the deserializer.

Fixed assertion when "stream jumping" in the deserializer to properly function
when we have reached the end of the stream.

llvm-svn: 44124
2007-11-14 17:42:09 +00:00
Fariborz Jahanian
794793ec1c Removed unused variabel.
llvm-svn: 44123
2007-11-14 17:35:46 +00:00
Chris Lattner
e6c7a858b0 Fix a bug handling hex floats in c90 mode, pointed out by Neil.
llvm-svn: 44120
2007-11-14 16:14:50 +00:00
Steve Naroff
a509f04034 Fix yesterday's regression with rewriting @optional/@required.
llvm-svn: 44119
2007-11-14 15:03:57 +00:00
Steve Naroff
58ed6c04f2 Rewrite methods that span multiple lines.
llvm-svn: 44118
2007-11-14 14:34:23 +00:00
Steve Naroff
9e0887cff4 Allow properties within a protocol. The case below was asserting...now it works fine.
@protocol CAMediaTiming

@property int beginTime;

@end

Comments in the code tell the rest of the story...

llvm-svn: 44117
2007-11-14 14:15:31 +00:00
Duncan Sands
9e12a3f020 Simplify the attribute verification code.
llvm-svn: 44116
2007-11-14 14:02:11 +00:00
Duncan Sands
544e64aa96 Un XFAIL these tests, now that Bill has backported
the fix from 4.2.

llvm-svn: 44115
2007-11-14 13:40:53 +00:00
Anton Korobeynikov
46f4446bba Document pure/const parameter attributes
llvm-svn: 44111
2007-11-14 10:30:13 +00:00
Anton Korobeynikov
6ca98cd532 Regenerate
llvm-svn: 44110
2007-11-14 09:53:48 +00:00
Anton Korobeynikov
ea09c697d7 Add pure/const attributes. Documentation will follow.
llvm-svn: 44109
2007-11-14 09:52:30 +00:00
Anton Korobeynikov
2c6387803e Fix PIC jump table codegen on x86-32/linux. In fact, such thing should be applied
to all targets uses GOT-relative offsets for PIC (Alpha?)

llvm-svn: 44108
2007-11-14 09:18:41 +00:00
Duncan Sands
e2287ed552 Eliminate the recently introduced CCAssignToStackABISizeAlign
in favour of teaching CCAssignToStack that size 0 and/or align
0 means to use the ABI values.  This seems a neater solution.
It is safe since no legal value type has size 0.

llvm-svn: 44107
2007-11-14 08:29:13 +00:00
Ted Kremenek
3c9c7b84fe Implemented serialization of RecordDecls. Changed serialization of TagType to
have an owning pointer to the referred TagDecl. This should hopefully fix a
bug where TagDecls (including decls from structs, etc.) were not serialized.

llvm-svn: 44106
2007-11-14 08:06:37 +00:00
Ted Kremenek
545f7e39e1 Added two new overloaded versions of BatchEmitOwnedPtrs and
BatchReadOwnedPtrs.

llvm-svn: 44105
2007-11-14 08:05:03 +00:00
Evan Cheng
7f02cfa599 Clean up sub-register implementation by moving subReg information back to
MachineOperand auxInfo. Previous clunky implementation uses an external map
to track sub-register uses. That works because register allocator uses
a new virtual register for each spilled use. With interval splitting (coming
soon), we may have multiple uses of the same register some of which are
of using different sub-registers from others. It's too fragile to constantly
update the information.

llvm-svn: 44104
2007-11-14 07:59:08 +00:00
Duncan Sands
9c30fc234c XFAIL these tests until the fix gets backported
from llvm-gcc-4.2 to 4.0.

llvm-svn: 44103
2007-11-14 07:42:50 +00:00
Chris Lattner
322a04ec7c Document a limitation, patch contributed by George Russell
llvm-svn: 44102
2007-11-14 07:04:44 +00:00
Nick Lewycky
c6243020a6 Allow the block extractor take to take a list of basic blocks to not extract
from a file containing Function/BasicBlock pairings. This is not safe against
anonymous or abnormally-named Funcs or BBs.

Make bugpoint use this interface to pass the BBs list to the child bugpoint.

llvm-svn: 44101
2007-11-14 06:47:06 +00:00
Chris Lattner
07b201d9c0 implement test/Sema/typedef-prototype.c, allowing code
to declare a function with a typedef:

typedef int unary_int_func(int arg);
unary_int_func add_one;

This patch contributed by Seo Sanghyeon!

llvm-svn: 44100
2007-11-14 06:34:38 +00:00
Chris Lattner
a77e74edba Implement PR1796 and Transforms/SimplifyCFG/noreturn-call.ll
by inserting unreachable after no-return calls.

llvm-svn: 44099
2007-11-14 06:19:25 +00:00
Steve Naroff
c17b056427 Comment out recent regression r44096.
llvm-svn: 44098
2007-11-14 03:37:28 +00:00
Owen Anderson
9306de0727 Start the process of making MachineLoopInfo possible by templating Loop.
llvm-svn: 44097
2007-11-14 02:33:58 +00:00
Fariborz Jahanian
fe38ba24af Rewrite @optional/@required directives used inside protocol definitions.
llvm-svn: 44096
2007-11-14 01:37:46 +00:00
Fariborz Jahanian
da6165c3dc Rewrite of forward protocol declaration.
llvm-svn: 44095
2007-11-14 00:42:16 +00:00
Ted Kremenek
164faf98f3 Implemented serialization of FunctionTypeNoProto.
llvm-svn: 44094
2007-11-14 00:38:50 +00:00
Ted Kremenek
7068cef079 Implemented serialization of VariableArrayTypes.
llvm-svn: 44093
2007-11-14 00:31:36 +00:00
Ted Kremenek
eef4a6296f Implemented serialization of TypedefType.
llvm-svn: 44092
2007-11-14 00:27:46 +00:00
Ted Kremenek
ea27383d68 Implemented serialization of ConstantArrayType.
llvm-svn: 44091
2007-11-14 00:17:21 +00:00
Ted Kremenek
f35e589847 Implemented serialization of TagTypes.
llvm-svn: 44090
2007-11-14 00:03:56 +00:00
Ted Kremenek
919858a428 Modified ASTContext::getTagDeclType() to accept a NULL pointer for the passed
in TagDecl*. This allows the deserializer to use ASTContext to create the
TagTypes. Deserialize TagTypes then rely on pointer-backpatching to resolve
the decls.

This may not be the interface that we want, but as the implementation of
TagTypes will potentially change significantly in the future, I'm leaving this
for now. An appropriate FIXME is in place.

llvm-svn: 44089
2007-11-14 00:03:20 +00:00
Steve Naroff
971d2f1242 Fix regression with ObjC method definitions and -ast-print
llvm-svn: 44088
2007-11-13 23:48:03 +00:00
Fariborz Jahanian
bc92fd7542 Type encoding for structs.
llvm-svn: 44087
2007-11-13 23:21:38 +00:00
Hartmut Kaiser
6f5421cbee Fixed a compilation error.
llvm-svn: 44083
2007-11-13 23:04:28 +00:00
Hartmut Kaiser
dde99f6a07 Fixed a strange construct. Please review.
llvm-svn: 44082
2007-11-13 23:04:06 +00:00
Hartmut Kaiser
1d4816584f Updated VC++ build system
llvm-svn: 44081
2007-11-13 23:03:32 +00:00
Steve Naroff
7b8fa4746a Rewrite method definition bodies. Also renamed a method to distinguish between method declarations and definitions.
llvm-svn: 44080
2007-11-13 23:01:27 +00:00
Ted Kremenek
204a1d3976 Removed line with typo (declared friendship with ASTContext). Line was
not needed since friendship is declared elsewhere.

llvm-svn: 44079
2007-11-13 22:57:59 +00:00
Ted Kremenek
767e7507c2 Added pretty-printing of statements during serialization.
llvm-svn: 44078
2007-11-13 22:56:10 +00:00
Ted Kremenek
049059a7db Implemented serialization of AsmStmt (or rather what is currently implemented
in AsmStmt).

llvm-svn: 44077
2007-11-13 22:55:51 +00:00
Ted Kremenek
d86dcfe8ca Fixed bug in FunctionDecl serialization where we crashed when the
FunctionDecl had decls for its parameters but still had greater than 0
arguments.

llvm-svn: 44076
2007-11-13 22:51:08 +00:00
Ted Kremenek
da551c3b1e Implemented serialization for SizeOfAlignOfTypeExpr.
llvm-svn: 44075
2007-11-13 22:30:29 +00:00
Ted Kremenek
b8f51d5512 Implemented serialization for MemberExpr.
llvm-svn: 44074
2007-11-13 22:16:23 +00:00
Nate Begeman
a0f78974a6 Give AST-walk passes a way to access DeclSpec attributes on functions and
variables.

llvm-svn: 44073
2007-11-13 22:14:47 +00:00
Fariborz Jahanian
989e03989b Fixed a rewrite of metadata bug when category implementation has no matching interface.
llvm-svn: 44072
2007-11-13 22:09:49 +00:00
Ted Kremenek
24726c3fc9 Rewrote type serialization to used the same methodology as we do for Decls.
Removed tons of dead code in ASTContext concerning how types use to be
serialized.
Removed serialization methods from QualType that are no longer used.

llvm-svn: 44070
2007-11-13 22:02:55 +00:00
Nate Begeman
313f8ca67b Rename Sema method to follow class naming convention
llvm-svn: 44069
2007-11-13 21:49:48 +00:00
Chris Lattner
68f04fa941 Fix the regression on Transforms/GlobalOpt/deadglobal-2.ll from my
patch on friday.

llvm-svn: 44068
2007-11-13 21:46:23 +00:00
Chris Lattner
f150ace6cb upgrade test
llvm-svn: 44067
2007-11-13 21:42:48 +00:00
Fariborz Jahanian
5633835d17 Populate metadata with adrress of method code.
llvm-svn: 44066
2007-11-13 21:02:00 +00:00
Chris Lattner
47791a4051 Parse "sizeof(arr)[0]" as a sizeof of an expr if arr
is an expression.

llvm-svn: 44065
2007-11-13 20:50:37 +00:00
Owen Anderson
d8167ab332 Run computeDomForest() on the set of registers that need to be tested for
interference.

llvm-svn: 44064
2007-11-13 20:13:24 +00:00
Owen Anderson
569ef71e44 Preserve LiveVariables when doing critical edge splitting.
llvm-svn: 44063
2007-11-13 20:04:45 +00:00
Fariborz Jahanian
c54d8462fb Rewrite of method definitions in categories.
llvm-svn: 44062
2007-11-13 20:04:28 +00:00
Owen Anderson
4696e959fe Wow. I definitely shouldn't write code when I'm tird.
Make my previous patch actually do what it was intended to do.

llvm-svn: 44061
2007-11-13 19:56:28 +00:00
Fariborz Jahanian
98ba6cde3d Order of methods are OK and generated .c file can be compiled.
llvm-svn: 44060
2007-11-13 19:21:13 +00:00
Ted Kremenek
794d8a6cde Updated test case to flag about comparisons against constants. We may
invert this case (i.e., not flag a warning) in the future.

llvm-svn: 44059
2007-11-13 19:18:22 +00:00
Ted Kremenek
b83f182b59 Modified -Wfloat-equal logic to suppress warnings where floating point values
are compared against builtins such as __builtin_inf.

llvm-svn: 44058
2007-11-13 19:17:00 +00:00
Dale Johannesen
7904708369 Revert previous; these files aren't ready to go in yet.
llvm-svn: 44057
2007-11-13 19:16:02 +00:00
Dale Johannesen
7a7085f6d3 Add parameter to getDwarfRegNum to permit targets
to use different mappings for EH and debug info;
no functional change yet.
Fix warning in X86CodeEmitter.

llvm-svn: 44056
2007-11-13 19:13:01 +00:00
Fariborz Jahanian
1e5f64e2ea First patch in rewrie of method definitions. This is work in progress.
llvm-svn: 44055
2007-11-13 18:44:14 +00:00
Ted Kremenek
577437de8b Updated diagnostic for -Wfloat-equal to underline the offending expressions.
llvm-svn: 44054
2007-11-13 18:40:33 +00:00
Ted Kremenek
2272f72723 Added -Wfloat-equal option to the driver. This makes warnings about
floating point comparisons using == or != an opt-in rather than a default
warning.

Updated test case to use -Wfloat-equal.

llvm-svn: 44053
2007-11-13 18:37:02 +00:00
Chris Lattner
07328f0b8b Make llvm2cpp better, patch for PR1794, contributed by Zack Rusin.
llvm-svn: 44051
2007-11-13 18:22:33 +00:00
Chris Lattner
034b49dca0 Clean up types, removing some casts. Patch contributed by
Cedric Venet.

llvm-svn: 44050
2007-11-13 18:16:41 +00:00
Chris Lattner
2f72c427cf improve handling of address of global when checking for
constants and initializers.  Patch by Sanghyeon Seo, thanks!

llvm-svn: 44049
2007-11-13 18:05:45 +00:00
Evan Cheng
c891ae92dc Fix x86-64 jit: remove reliance on Dwarf numbers.
llvm-svn: 44048
2007-11-13 17:54:34 +00:00
Steve Naroff
b666625493 Teach Sema::CheckCompareOperands() about "void *" (C99 6.5.9p2)
llvm-svn: 44047
2007-11-13 14:57:38 +00:00
Bill Wendling
77b13af9a6 Unifacalize the CALLSEQ{START,END} stuff.
llvm-svn: 44045
2007-11-13 09:19:02 +00:00
Chris Lattner
61ce4dff7a Implement PR1786 by iterating between dead cycle elimination
and simplifycfg in the rare cases when it is needed.

llvm-svn: 44044
2007-11-13 07:32:38 +00:00
Chris Lattner
36d5575660 Many typos, grammaro, and wording fixes. Patch by
Kelly Wilson, thanks!

llvm-svn: 44043
2007-11-13 07:06:30 +00:00
Steve Naroff
e50478e0b0 Tune the lookup logic in Sema::ActOnInstanceMessage() to handle private methods (declared within the implementation).
llvm-svn: 44041
2007-11-13 04:10:18 +00:00
Steve Naroff
9d0d4dc7bd Minor indenting changes and removed a level of casting in getClassInterface();
llvm-svn: 44039
2007-11-13 01:40:57 +00:00
Fariborz Jahanian
3a9fe93286 Patch to set context (interface, category, etc.) in which method is declared.
llvm-svn: 44038
2007-11-13 01:10:08 +00:00
Bill Wendling
f359fed9f9 Unify CALLSEQ_{START,END}. They take 4 parameters: the chain, two stack
adjustment fields, and an optional flag. If there is a "dynamic_stackalloc" in
the code, make sure that it's bracketed by CALLSEQ_START and CALLSEQ_END. If
not, then there is the potential for the stack to be changed while the stack's
being used by another instruction (like a call).

This can only result in tears...

llvm-svn: 44037
2007-11-13 00:44:25 +00:00
Steve Naroff
4a158f37f9 Fix Sema::CheckAssignmentConstraints() to operate on the canonical, unqualified type.
llvm-svn: 44036
2007-11-13 00:31:42 +00:00
Ted Kremenek
e9b83bbd68 Renamed all serialization "Materialize" methods to "Create" to conform with
the new serialization API.

llvm-svn: 44035
2007-11-13 00:25:37 +00:00
Ted Kremenek
e7033b0356 Renamed serialization method "Materialize" to "Create". This is an API change.
llvm-svn: 44034
2007-11-13 00:25:08 +00:00
Ted Kremenek
cd51750512 Restructured serialization code for decls to make it cleaner, easier to
understand, and batched the emission owned subobjects (using
BatchEmitOwnedPtr) to get a smaller output bitcode size.

llvm-svn: 44033
2007-11-13 00:15:39 +00:00
Ted Kremenek
be0a4b734e Fixed bug with inconsistent serialization/deserialization in matching
calls to BatchEmitOwnedPtrs and BatchReadOwnedPtrs.

llvm-svn: 44032
2007-11-13 00:13:57 +00:00
Bill Wendling
c8f2f68e87 Move SYSCTL stuff close to where it's used.
llvm-svn: 44031
2007-11-12 23:55:19 +00:00
Devang Patel
f48ae28600 Build universal llvm.
llvm-svn: 44030
2007-11-12 23:53:43 +00:00
Anton Korobeynikov
bfb139ec93 Completely forgot, that we have some debug information emission on PPC. This should fix
some regressions on ppc nightly tests.

llvm-svn: 44029
2007-11-12 23:36:13 +00:00
Fariborz Jahanian
21f54eeacf Patch to do statically typed ivar references.
llvm-svn: 44028
2007-11-12 22:29:28 +00:00
Steve Naroff
fedb49771d Add category method definitions incrementally, removing a FIXME (like we do for class implementations).
llvm-svn: 44027
2007-11-12 22:05:31 +00:00
Fariborz Jahanian
2d0d3ba43e Minor twik for when there is no super class and 'super' is errornously used.
llvm-svn: 44026
2007-11-12 20:20:37 +00:00
Fariborz Jahanian
d98a734bd6 'super' nailed.
llvm-svn: 44025
2007-11-12 20:13:27 +00:00
Bruno Cardoso Lopes
b439132d16 Added JumpTable support
Fixed some AsmPrinter issues
Added GLOBAL_OFFSET_TABLE Node handle.

llvm-svn: 44024
2007-11-12 19:49:57 +00:00
Steve Naroff
040f696bfc Fix regression to Sema::ObjcActOnStartOfMethodDef()...need to initialize InvalidType field to false.
llvm-svn: 44023
2007-11-12 19:48:27 +00:00
Steve Naroff
cd002f5a0e Add an error diagnostic to Parse::ParseObjCMessageExpression().
This now exposes the following bug...

******************** TEST 'Sema/message.m' FAILED! ********************
Command: 
 clang -fsyntax-only -verify Sema/message.m
Output:
Errors seen but not expected:
  Line 9: invalid receiver to message expression
******************** TEST 'Sema/message.m' FAILED! ********************

As far as I can tell, all messages to method agruments fail.

The method arguments are built by Sema::ObjcActOnStartOfMethodDef().

llvm-svn: 44022
2007-11-12 19:18:37 +00:00
Ted Kremenek
e33ba16368 Added versions of ReadPtr that takes an explicit SerializedPtrID. This allows
clients of the Deserializer to read the pointer ID before they are ready
to deserialize the object (which can mean registering a pointer reference
with the backpatcher).

Changed some methods that took an argument "SerializedPtrID" to "const SerializedPtrID&" (pass-by-reference).  This is to accommodate a future
revision of SerializedPtrID where it may be much fatter than an unsigned
integer.

llvm-svn: 44021
2007-11-12 19:11:15 +00:00
Ted Kremenek
0035bf33c4 In Stmt serialization, renamed directEmit to EmitImpl and
directMaterialize to CreateImpl.

llvm-svn: 44020
2007-11-12 18:04:32 +00:00
Owen Anderson
c520c4b325 Break critical edges coming into blocks with PHI nodes.
llvm-svn: 44019
2007-11-12 17:27:27 +00:00
Steve Naroff
b342361c0d Now that we can refer to instance variables, make sure they are considered lvalues.
llvm-svn: 44017
2007-11-12 14:34:27 +00:00
Steve Naroff
e46504b278 Implement instance variable references.
llvm-svn: 44016
2007-11-12 14:29:37 +00:00
Steve Naroff
e3d1ab29da - Minor cleanup to yesterday's changes to Sema::ObjcActOnStartOfMethodDef();
- Add Sema::CurMethodDecl, in preparation for adding ObjcIvarRefExpr.
- Add ObjcInterfaceDecl::lookupInstanceVariable(), in prep for adding ivars.
- A couple renames in ObjcInterfaceDecl, while I was in the vicinity:-)

llvm-svn: 44015
2007-11-12 13:56:41 +00:00
Gordon Henriksen
1ced282c73 Typo fix in the tutorial.
llvm-svn: 44014
2007-11-12 13:46:21 +00:00
Duncan Sands
5dc0c9282f Compile fix.
llvm-svn: 44013
2007-11-12 13:43:23 +00:00
Owen Anderson
933b5b7e62 Add a flag for indirect branch instructions.
Target maintainers: please check that the instructions for your target are correctly marked.

llvm-svn: 44012
2007-11-12 07:39:39 +00:00
Evan Cheng
be51f28e2b Refactor some code.
llvm-svn: 44010
2007-11-12 06:35:08 +00:00
Steve Naroff
8e5c112add Forgot this file from my last commit...
llvm-svn: 44009
2007-11-12 05:02:46 +00:00
Steve Naroff
ff4dbff4f4 Remove Action::ObjcActOnMethodDefinition(). Rationale:
- It is not an "action" - it is never called by the parser.
- It was only used by one method, Sema::ObjcActOnStartOfMethodDef().

As a result, the logic it embodied is now directly implemented in Sema::ObjcActOnStartOfMethodDef().

llvm-svn: 44008
2007-11-12 04:59:00 +00:00
Steve Naroff
3434bebec9 Make sure @property is allowed within a category.
Bug submitted by Keith Bauer.

CookieJar:Desktop keith$ cat test.m
#import <WebKit/WebKit.h>

llvm-svn: 44007
2007-11-12 04:22:52 +00:00
Steve Naroff
d0bf516e70 Remove Sema::ObjcBuildMethodParameter().
Modify Sema::ParseParamDeclarator() to work for both ActOnStartOfFunctionDef() and ObjcActOnStartOfMethodDef().

llvm-svn: 44006
2007-11-12 03:44:46 +00:00
Owen Anderson
556fb3467b Fix rewriting of PHI nodes.
Could someone more familiar with machine-level stuff review this for me?

llvm-svn: 44005
2007-11-12 02:13:07 +00:00
Hartmut Kaiser
28af9f7d00 Updated VC++ build system
llvm-svn: 44004
2007-11-12 01:24:50 +00:00
Owen Anderson
f66f0d619a Remove unnecessary #include's.
llvm-svn: 44003
2007-11-12 01:19:28 +00:00
Owen Anderson
a1cd45213d As Chris and Evan pointed out, BreakCriticalMachineEdges doesn't really need
to be a pass of its own.  Instead, move it out into a helper method.

llvm-svn: 44002
2007-11-12 01:05:09 +00:00
Owen Anderson
55f4e5d2dd Fix on 64-bit machines.
llvm-svn: 44001
2007-11-12 00:56:04 +00:00
Steve Naroff
b313fc3203 Replace 2 method definition actions (ActOnFunctionDefBody, ActOnMethodDefBody) with 1 method definition action (ActOnFinishFunctionBody). I can't think of any reason that we would need two action hooks.
llvm-svn: 44000
2007-11-11 23:20:51 +00:00
Steve Naroff
bb87572d70 Replace 3 method definition functions (ObjcParseMethodDefinition, ParseObjCInstanceMethodDefinition, ParseObjCClassMethodDefinition) with 1 method definition function (ParseObjCMethodDefinition).
Less code/confusion.

llvm-svn: 43999
2007-11-11 19:54:21 +00:00
Anton Korobeynikov
0644bb865e Clarify the meaning of '-2' register number
llvm-svn: 43998
2007-11-11 19:53:50 +00:00
Anton Korobeynikov
4edfea438a Use TableGen to emit information for dwarf register numbers.
This makes DwarfRegNum to accept list of numbers instead.
Added three different "flavours", but only slightly tested on x86-32/linux.
Please check another subtargets if possible,

llvm-svn: 43997
2007-11-11 19:50:10 +00:00
Steve Naroff
49effdefef Tweak Sema::ActOnInstanceMessage() to treat the built-in "Class" type the same as "id".
llvm-svn: 43996
2007-11-11 17:52:25 +00:00
Steve Naroff
cac26f4f5f This is the last 5% of the solution to teaching Sema::ActOnInstanceMessage() about private methods (r43989).
While the diff is large, the idea is very simple. When we parse method definitions (in an @implementation), we need to add them incrementally (rather than wait until the @end).

Other details...

- Renamed Sema::ActOnAddMethodsToObjcDecl() to Sema::ActOnAtEnd(). The methods are now optional arguments.
- Removed Parser::AllImplMethods (a nice cleanup).
- Added location info to ObjcImplementationDecl (since we will need it very soon:-)
- Modified message.m test to no longer allow the bogus diagnostic.

llvm-svn: 43995
2007-11-11 17:19:15 +00:00
Steve Naroff
5f9ae64f6e Make sure Sema::CheckIncrementDecrementOperand() removes typedefs when doing it's analysis.
Thanks to Seo Sanghyeon for his excellent (first) bug fix!

llvm-svn: 43994
2007-11-11 14:15:57 +00:00
Anton Korobeynikov
a468a11d80 Add convenient helper to obtain list of ints
llvm-svn: 43993
2007-11-11 11:19:37 +00:00
Steve Naroff
22e078e013 Teach Sema::ActOnInstanceMessage() about private methods. That is, methods declared in an implementation (but not listed in the interface).
This commit is only 95% of the bug fix. The last piece to this puzzle is to add the method decls to the implementation incrementally (as we encounter them). At the moment, the methods aren't added until we see an @end (which is too late).

I will complete this later...

llvm-svn: 43989
2007-11-11 00:10:47 +00:00
Dale Johannesen
b988e7e8cd Add CCAssignToStackABISizeAlign for convenience in
dealing with types whose size & alignment are
different on different subtargets.  Use it for x86 f80.

llvm-svn: 43988
2007-11-10 22:07:15 +00:00
Fariborz Jahanian
0bd56b7727 Fixed a bug which exposed the internally built type to user code.
llvm-svn: 43987
2007-11-10 22:00:55 +00:00
Fariborz Jahanian
16e3123071 pretty priting for method definitions.
llvm-svn: 43986
2007-11-10 20:59:13 +00:00
Steve Naroff
257b4a2467 Fix a basic bug (having to do with typedefs) in Sema::UsualArithmeticConversions().
This resuled in the following crash below.

Also modified the usual-float.c test case to capture this case.

[steve-naroffs-imac:clang/test/Sema] snaroff% ../../../../Debug/bin/clang usual-float.c
Assertion failed: (0 && "Sema::UsualArithmeticConversions(): illegal float comparison"), function UsualArithmeticConversions, file SemaExpr.cpp, line 960.
0   clang                               0x001ef9b9 _ZN40_GLOBAL__N_Signals.cpp_00000000_4E6DAF8315PrintStackTraceEv + 45
1   clang                               0x001efd5f _ZN40_GLOBAL__N_Signals.cpp_00000000_4E6DAF8313SignalHandlerEi + 323
2   libSystem.B.dylib                   0x90c6297b _sigtramp + 43
3   ???                                 0xffffffff 0x0 + 4294967295
4   libSystem.B.dylib                   0x90cdb782 raise + 26
5   libSystem.B.dylib                   0x90cead3f abort + 73
6   libSystem.B.dylib                   0x90cdc923 __assert_rtn + 101
7   clang                               0x00077316 _ZN5clang4Sema26UsualArithmeticConversionsERPNS_4ExprES3_b + 1004
8   clang                               0x000803cf _ZN5clang4Sema27CheckMultiplyDivideOperandsERPNS_4ExprES3_NS_14SourceLocationEb + 181
9   clang                               0x0007a8e8 _ZN5clang4Sema10ActOnBinOpENS_14SourceLocationENS_3tok9TokenKindEPvS4_ + 472
10  clang                               0x000cf058 _ZN5clang6Parser26ParseRHSOfBinaryExpressionENS_6Action12ActionResultILj0EEEj + 1286
11  clang                               0x000cf2de _ZN5clang6Parser25ParseAssignmentExpressionEv + 86

llvm-svn: 43985
2007-11-10 19:45:54 +00:00
Ted Kremenek
b0cdfeb4ba Fixed a bug introduced by my last patch. Now we properly clear out the BatchIDVec
vector before reusing it.

llvm-svn: 43984
2007-11-10 19:33:26 +00:00
Ted Kremenek
cdf5fca367 Fixed hack in BatchReadOwnedPtrs to no longer use the array of pointers passed in for
deserialization as a temporary location for storing serialized pointer identifiers. The
definition of SerializedPtrID will likely change significantly in the future, and the
current implementation caused compilation errors on some 64-bit machines.

llvm-svn: 43983
2007-11-10 19:28:49 +00:00
Ted Kremenek
195c478e1b Updated method signature to conform with the typedef in the method prototype.
llvm-svn: 43982
2007-11-10 19:19:32 +00:00
Steve Naroff
68754c59bc Since we are all working on Leopard, change the built-in MacOS X version number (__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) to target Leopard. This is only a short term solution, until the clang driver implements the "-mmacosx-version-min" flag (which will compute this value based on the target).
llvm-svn: 43981
2007-11-10 18:06:36 +00:00
Fariborz Jahanian
6aafd4130b Minor code clean up in method def area.
llvm-svn: 43980
2007-11-10 17:40:57 +00:00
Fariborz Jahanian
85e1d0d807 Represent method definitions as separate AST nodes. Pretty print will come next.
llvm-svn: 43979
2007-11-10 16:31:34 +00:00
Arnold Schwaighofer
d2c16ff905 Update tailcall code to include inline attribute operand for memcpy.
llvm-svn: 43978
2007-11-10 10:48:01 +00:00
Ted Kremenek
739156ab7c Changed the serialization of IdentifierTable to only serialize out entries
that are referenced in the ASTs. This assumes that we serialize out the
decls/stmts first, and use the pointer-tracking logic in the Serializer to
determine if an IdentifierInfo (or its string key) is ever referenced.

This is a significant space optimization for serialized ASTs.

Consider the following program:

void foo(int x,int y) {
  return x > y ? x : y+1;
}

Here are the sizes of the files for the serialized ASTs:

        Full IdentifierTable: 23676 bytes
 Only-referenced Identifiers:   304 bytes.

For this simple program, this is a 77% reduction in the file size of the
serialized ASTs.

llvm-svn: 43975
2007-11-10 02:11:55 +00:00
Ted Kremenek
11d700bfba Modifed the test serialization driver to...
(1) serialize out top-level decls BEFORE serializing out translation unit
structures like ASTContext.

(2) deserialize out translation unit structures like ASTContext before
top-level decls by first skipping the decls in the bitstream, deserializing
ASTContext and friends, and then jumping back to the bitstream block with the
decls and then deserializing them.

Change (1) allows us to utilize the pointer-tracking system in the Serializer
to only serialize out metadata that is actually referenced by the ASTS.

Change (2) allows us to deserialize the metadata first as before, which
signficantly reduces the amount of pointer backpatching the deserializer
would have to do if the decls were deserialized first.

llvm-svn: 43974
2007-11-10 02:07:12 +00:00
Ted Kremenek
55e30be8ec Added "random access" to the Deserializer to allow a client to jump to any
serialized block in the bitstream, including a block in an entirely different
nesting than the current block. This is useful for deserializing objects from
a bitstream in an order different from the order that they were serialized.

llvm-svn: 43973
2007-11-10 02:02:34 +00:00
Ted Kremenek
a7f49ce570 Made Deserializer a friend class of BitstreamReader.
Moved some of the logic in BitstreamReader::ExitBlock into a utility function
BitstreamReader::PopBlockScope. The latter is a private method. It will also
be called by Deserializer to manipulate the current "block scope."

llvm-svn: 43972
2007-11-10 02:00:38 +00:00
Evan Cheng
9e0216deab Added -test-opts to specify test options.
llvm-svn: 43971
2007-11-10 01:33:27 +00:00
Chris Lattner
ef067a2828 rename getInstantiationLoc to match the scheme of isPhysicalLoc.
llvm-svn: 43969
2007-11-09 23:59:17 +00:00
Chris Lattner
198b3e085d change source location to have two bits for macros, tracking
whether the location is the start and/or end of an expansion.
These are currently not set or used by anything.

llvm-svn: 43968
2007-11-09 23:52:16 +00:00
Fariborz Jahanian
7a017215eb Some code clean up in the form of name changes for functions which
process method definitions.

llvm-svn: 43967
2007-11-09 22:27:59 +00:00
Chris Lattner
f9f08bf4b0 Update links.
llvm-svn: 43964
2007-11-09 21:49:08 +00:00
Evan Cheng
05b94b8c13 Fix tests.
llvm-svn: 43961
2007-11-09 20:46:00 +00:00
Hartmut Kaiser
67297144ab Fixed a strange construct. Please review.
llvm-svn: 43960
2007-11-09 19:59:00 +00:00
Hartmut Kaiser
76886e1875 Updated VC++ build system
llvm-svn: 43959
2007-11-09 19:54:59 +00:00
Hartmut Kaiser
03f4d47254 Updated VC++ build system
llvm-svn: 43958
2007-11-09 19:53:21 +00:00
Fariborz Jahanian
b5605179c4 Added class context to method declarations. Provide "interface *" type
to 'self' method of instance methods.

llvm-svn: 43957
2007-11-09 19:52:12 +00:00
Chris Lattner
da043b68ad try again
llvm-svn: 43956
2007-11-09 19:24:54 +00:00
Evan Cheng
fb13fd6f93 Unbreak x86-64 jumptable.
llvm-svn: 43955
2007-11-09 19:11:23 +00:00
Anton Korobeynikov
5db5e352b9 Silence a warning
llvm-svn: 43954
2007-11-09 19:06:14 +00:00
Dale Johannesen
dfb85c7831 Revert previous rewrite per chris's comments.
llvm-svn: 43950
2007-11-09 18:07:11 +00:00
Chris Lattner
f9c0fd7488 Tighten up a check for folding away loads from (newly constant) globals. This
fixes a crash on Transforms/GlobalOpt/2007-11-09-GEP-GEP-Crash.ll and 
rdar://5585488.

llvm-svn: 43949
2007-11-09 17:33:02 +00:00
Fariborz Jahanian
19d4dbd217 Insert invisble arguments to method definition header.
llvm-svn: 43948
2007-11-09 17:18:29 +00:00
Steve Naroff
2011338446 Rewrite global variable initializers.
llvm-svn: 43947
2007-11-09 15:20:18 +00:00
Steve Naroff
8570fdec1a Recognize ObjCStringLiteral as a constant expression.
llvm-svn: 43946
2007-11-09 15:00:03 +00:00
Duncan Sands
303a5d6c8b Thanks to the XTARGET line, this test should still
be run on darwin, but I have no way of checking...

llvm-svn: 43945
2007-11-09 13:50:25 +00:00
Duncan Sands
e795efea5b Move MinAlign to MathExtras.h.
llvm-svn: 43944
2007-11-09 13:41:39 +00:00
Steve Naroff
1b232132ad - add typedef guards.
- tweak scanForProtocolRefs heuristic.
- disable RewriteInclude() for now.

llvm-svn: 43942
2007-11-09 12:50:28 +00:00
Anton Korobeynikov
550b98e147 Fix indent
llvm-svn: 43941
2007-11-09 12:34:20 +00:00
Anton Korobeynikov
98638aede6 Forget to commit users part of value mapper interface
llvm-svn: 43940
2007-11-09 12:27:04 +00:00
Anton Korobeynikov
8eeca1c252 And delete this one
llvm-svn: 43939
2007-11-09 12:22:04 +00:00
Anton Korobeynikov
7a96822f32 Make this header public
llvm-svn: 43938
2007-11-09 12:16:58 +00:00
Duncan Sands
e7a9ac929f Fix some load/store logic that would be wrong for
apints on big-endian machines if the bitwidth is
not a multiple of 8.  Introduce a new helper,
MVT::getStoreSizeInBits, and use it.

llvm-svn: 43934
2007-11-09 08:57:19 +00:00
Duncan Sands
bab9dc9433 Add terminating newline.
llvm-svn: 43933
2007-11-09 08:30:21 +00:00
Duncan Sands
0c7fba914d Check that the first and third characters, s and u,
are accessed with an alignment of 2 not 1.

llvm-svn: 43932
2007-11-09 07:47:29 +00:00
Duncan Sands
1445725759 Check that accesses to the second short, t, have
an alignment of 2 rather than 4.

llvm-svn: 43931
2007-11-09 07:46:02 +00:00
Bill Wendling
71df1dd59e Initial commit of files that support building LLVM the "Apple" way.
llvm-svn: 43929
2007-11-09 06:59:33 +00:00
Nick Lewycky
70248c92cf Add a link to the tutorial.
llvm-svn: 43928
2007-11-09 05:45:51 +00:00
Evan Cheng
797d56ff17 Much improved pic jumptable codegen:
Then:
        call    "L1$pb"
"L1$pb":
        popl    %eax
		...
LBB1_1: # entry
        imull   $4, %ecx, %ecx
        leal    LJTI1_0-"L1$pb"(%eax), %edx
        addl    LJTI1_0-"L1$pb"(%ecx,%eax), %edx
        jmpl    *%edx

        .align  2
        .set L1_0_set_3,LBB1_3-LJTI1_0
        .set L1_0_set_2,LBB1_2-LJTI1_0
        .set L1_0_set_5,LBB1_5-LJTI1_0
        .set L1_0_set_4,LBB1_4-LJTI1_0
LJTI1_0:
        .long    L1_0_set_3
        .long    L1_0_set_2

Now:
        call    "L1$pb"
"L1$pb":
        popl    %eax
		...
LBB1_1: # entry
        addl    LJTI1_0-"L1$pb"(%eax,%ecx,4), %eax
        jmpl    *%eax

		.align  2
		.set L1_0_set_3,LBB1_3-"L1$pb"
		.set L1_0_set_2,LBB1_2-"L1$pb"
		.set L1_0_set_5,LBB1_5-"L1$pb"
		.set L1_0_set_4,LBB1_4-"L1$pb"
LJTI1_0:
        .long    L1_0_set_3
        .long    L1_0_set_2

llvm-svn: 43924
2007-11-09 01:32:10 +00:00
Evan Cheng
f14006f4d6 Didn't mean to check these in.
llvm-svn: 43923
2007-11-09 01:28:33 +00:00
Evan Cheng
1bf166312b Bug fix. Passive nodes are not in SUnitMap.
llvm-svn: 43922
2007-11-09 01:27:11 +00:00
Chuck Rose III
0e7937654c Adding some recently added files to the VStudio projects
llvm-svn: 43919
2007-11-09 00:48:27 +00:00
Dale Johannesen
04fd82088e Rewrite Dwarf number handling per review comments.
llvm-svn: 43918
2007-11-09 00:47:10 +00:00
Ted Kremenek
908f96a2cf Changed method call to reflect updated serialization API.
llvm-svn: 43917
2007-11-09 00:43:55 +00:00
Ted Kremenek
1d9406c1ca Updated Deserializer class to provide more information about the current
block that is being visited in the bitstream.  The client can also now
skip blocks before reading them, and query the current abbreviation number
as seen from the perspective of the Deserializer.  This allows the client
to be more interactive in the deserialization process (if they so choose).

llvm-svn: 43916
2007-11-09 00:43:51 +00:00
Fariborz Jahanian
56ff146ec4 First patch toward rewriting of method definitions. This is work in progress.
llvm-svn: 43915
2007-11-08 23:49:49 +00:00
Devang Patel
94785aa1c7 Run this test only on darwin.
llvm-svn: 43912
2007-11-08 22:26:46 +00:00
Owen Anderson
65d2fcdd2a This preserves critical edge breaking.
llvm-svn: 43911
2007-11-08 22:23:57 +00:00
Owen Anderson
3bc8124a66 Make BreakCriticalMachineEdges available as a pass that can be depended on.
llvm-svn: 43910
2007-11-08 22:20:23 +00:00
Chris Lattner
f546408406 remove some temporary code.
llvm-svn: 43906
2007-11-08 20:53:07 +00:00
Chris Lattner
b74f6e82e4 add a getAtOffset() member to simplify some code.
llvm-svn: 43905
2007-11-08 20:51:02 +00:00
Ted Kremenek
da4c6c183d Rewrote serialization of IdentifierInfo and IdentifierTable to use methods Emit
and Materialize/Read instead of using specializations of SerializeTrait<>. The
resulting code is much cleaner. We are also setting the stage so that only the
parts of the IdentifierTable that are ever referenced within the ASTs are
serialized, and not the whole table.

llvm-svn: 43904
2007-11-08 19:52:41 +00:00
Ted Kremenek
67135ebaff Added typedef "SerializedPtrID" to represent the pointer handle written to disk
instead of just using "unsigned".  This gives us more flexibility in changing
the definition of the handle later, and is more self-documenting.

Added tracking of block stack in the Deserializer.  Now clients can query
if they are still within a block using the methods GetCurrentBlockLocation()
and FinishedBlock().

llvm-svn: 43903
2007-11-08 19:50:46 +00:00
Chris Lattner
34660fb75a add a fixme.
llvm-svn: 43902
2007-11-08 19:40:23 +00:00
Chris Lattner
bedd411589 significantly simplify the implementation of RewriteRope by changing the
implementation to be list<RopePiece> instead of vector<RopePiece*>.

llvm-svn: 43901
2007-11-08 19:39:57 +00:00
Fariborz Jahanian
8e632940fc Refactored parsing of main function body for reuse by objective-c methods.
llvm-svn: 43898
2007-11-08 19:01:26 +00:00
Andrew Lenharth
19ca5c7021 Better check
llvm-svn: 43897
2007-11-08 18:45:15 +00:00
Chris Lattner
3eb670721f improve MakeRopeString to avoid doing a malloc for every 2-character string
that gets inserted.  This speeds up the rewriter another 10%.

llvm-svn: 43896
2007-11-08 18:32:01 +00:00
Chris Lattner
9a00d3ec90 Simplify interface to MakeRopeString.
llvm-svn: 43895
2007-11-08 17:59:48 +00:00
Chris Lattner
3a21bd50e7 Fix backwards assert.
llvm-svn: 43894
2007-11-08 17:56:40 +00:00
Andrew Lenharth
8cf11aa330 Fix PR1780
llvm-svn: 43893
2007-11-08 17:39:28 +00:00
Lauro Ramos Venancio
f6a67bf700 [ARM] Implement __builtin_thread_pointer.
llvm-svn: 43892
2007-11-08 17:20:05 +00:00
Ted Kremenek
f2d68452c6 Implemented serialization of AddrLabelExpr.
Implemented serialization of ConditionalOperator.
Implemented serialization of StmtExpr.
Fixed bug in serialization of IndirectGoto (did not properly serialize subexpression).

llvm-svn: 43891
2007-11-08 16:32:00 +00:00
Steve Naroff
265a6b9693 Rewrite RewriteObjCStringLiteral(). This version is simpler (and unlike the previous one, works:-)
llvm-svn: 43890
2007-11-08 14:30:50 +00:00
Evan Cheng
ece4c68b82 If both parts of smul_lohi, etc. are used, don't simplify. If only one part is used, try simplify it.
llvm-svn: 43888
2007-11-08 09:25:29 +00:00
Owen Anderson
0be8c1dafe Add the majority of machine-level critical edge breaking pass. Most of this was written by Fernando, cleanup and updating to TOT by me.
This still needs a bit of work, particularly to handle jump tables properly.

llvm-svn: 43885
2007-11-08 07:55:43 +00:00
Chris Lattner
e90ce8def3 Add a new RewriteRope data structure which is a smarter way to represent the text
backing a rewrite buffer than using an std::vector<char>.  This class was hacked
together very quickly and needs to be cleaned up, but it seems to work.  It speeds
up rewriting a a 7M file from 6.43s to 0.24s on my machine.  The impl could also
be made to be a lot more algorithmically sound.

This produces identical output to using vector on this testcase, if it causes a
problems or bugs are encountered, it can be disabled by changing the 
RewriteBuffer::Buffer typedef back.

llvm-svn: 43884
2007-11-08 07:35:14 +00:00
Chris Lattner
7a7da75916 abstract out buffer type a bit better
llvm-svn: 43883
2007-11-08 05:42:25 +00:00
Chris Lattner
dc0cfc9fe3 use insert instead of replacing 0 bytes with text :)
llvm-svn: 43882
2007-11-08 04:41:51 +00:00
Chris Lattner
edebdb5b29 minor cleanups
llvm-svn: 43881
2007-11-08 04:41:04 +00:00
Chris Lattner
9fd5890e52 use std::copy instead of memcpy for abstraction.
Disable rewrite-tabs.  This speeds up processing of the commentified huge
crazy testcase steve gave me from 20s to 6.6s in a release build.

llvm-svn: 43880
2007-11-08 04:27:23 +00:00
Chris Lattner
4573cc708a Fix a rewriter bug that fariborz hit, when an @interface was the very very very
first thing in the file.

The trick is that text replacement should go after the insert point, 
not before it, because it will be replacing text after the point, not before 
it.

llvm-svn: 43879
2007-11-08 04:09:59 +00:00
Owen Anderson
bfbc12973d Take another stab at getting isLiveIn() and isLiveOut() right.
llvm-svn: 43869
2007-11-08 01:32:45 +00:00
Owen Anderson
4ac4ec215f Fix MachineDominators' getAnalysisUsage.
llvm-svn: 43868
2007-11-08 01:22:53 +00:00
Owen Anderson
17296e74b1 Oops, forgot to commit this file.
llvm-svn: 43867
2007-11-08 01:22:24 +00:00
Owen Anderson
9d86ef12c8 Bring UsedBlocks back. StrongPHIElimination needs this information.
llvm-svn: 43866
2007-11-08 01:20:48 +00:00
Ted Kremenek
a34b057762 Revised serialization of CaseStmt to emit all of the owned pointers (its
subexpressions) all together in one block at the end.

llvm-svn: 43862
2007-11-08 00:56:26 +00:00
Ted Kremenek
89704afa43 Revised BatchEmitOwnedPtrs to work better with constant pointers.
llvm-svn: 43861
2007-11-08 00:55:31 +00:00
Ted Kremenek
c1cddef7c9 Implemented serialization of CompoundAssignOperator.
llvm-svn: 43860
2007-11-08 00:41:37 +00:00
Devang Patel
ec51171319 Add assert for the case that is not handled.
struct { char a; short b:2; };

llvm-svn: 43859
2007-11-08 00:32:12 +00:00
Ted Kremenek
2419ac8792 Implemented serialization of UnaryOperator.
llvm-svn: 43858
2007-11-08 00:26:24 +00:00
Devang Patel
7c7a07d949 Keep track of beginning offset for the bit field that does not start at byte boundry.
llvm-svn: 43857
2007-11-08 00:17:59 +00:00
Ted Kremenek
8f74abd34a Revised implementation of BatchReadOwnedPtrs() that deserializes an
array of pointers to not allocate a second array to contain the pointer ids.

Fixed bug in the same member function where deserialized pointers were
not being registered with the backpatcher.

llvm-svn: 43855
2007-11-08 00:04:50 +00:00
Ted Kremenek
766fc8c14a Implemented serialization of CallExpr.
llvm-svn: 43854
2007-11-07 23:32:20 +00:00
Ted Kremenek
14b5fe537e Fixed bug where we did not properly serialize owned objects due to a missing
dereference.

llvm-svn: 43853
2007-11-07 23:32:06 +00:00
Ted Kremenek
1125bfa648 Added version of BatchEmitOwnedPtrs and BatchReadOwnedPtrs that emits/reads
an array of pointers of the same type.

llvm-svn: 43852
2007-11-07 23:18:40 +00:00
Ted Kremenek
2c325386b8 Implemented serialization of ArraySubscriptExpr.
Added "using ..." for "Serializer" and "Deserializer" to reduce amount
of typing for serialization methods.

llvm-svn: 43849
2007-11-07 22:53:01 +00:00
Ted Kremenek
e87ceeeb4a Implemented serialization of CastExpr.
llvm-svn: 43848
2007-11-07 22:42:34 +00:00
Ted Kremenek
b2b5e73f89 Implemented serialization of ImplicitCastExpr.
llvm-svn: 43847
2007-11-07 22:39:17 +00:00
Ted Kremenek
9d2bf704de Modified serialization of BinaryOperator and CaseStmt to use the new
BatchEmitOwnedPtrs() and BatchReadOwnedPtrs() methods.

Modified serialization of all Stmts to start their own record in the bitstream.

llvm-svn: 43846
2007-11-07 22:32:23 +00:00
Ted Kremenek
e079cb7b08 Added methods to batch emit and deserialize owned pointers. This allows
to group the pointer IDs together in the bitstream before their referenced
contents (which will lend itself to more efficient encoding).

llvm-svn: 43845
2007-11-07 22:30:29 +00:00
Dale Johannesen
1b9de4dd6f Complete conditionalization of Dwarf reg numbers.
Would somebody not on Darwin please make sure this
doesn't break anything.  Exception handling failures
would be the most likely symptom.

llvm-svn: 43844
2007-11-07 21:48:35 +00:00
Devang Patel
ef2d838fef Stay within 80 columns.
llvm-svn: 43843
2007-11-07 21:04:59 +00:00
Bill Wendling
6e976915a3 Add testcase
llvm-svn: 43839
2007-11-07 19:36:26 +00:00
Hartmut Kaiser
abcbb0493a Updated VC++ build system
llvm-svn: 43838
2007-11-07 19:34:40 +00:00
Hartmut Kaiser
b1d7cb2938 Updated VC++ build system
llvm-svn: 43837
2007-11-07 19:34:09 +00:00
Hartmut Kaiser
b964f650c9 Fixed compilation errors on VC++.
llvm-svn: 43836
2007-11-07 19:33:31 +00:00
Ted Kremenek
d68db575f3 Implemented serialization of StringLiteral.
llvm-svn: 43834
2007-11-07 19:08:19 +00:00
Ted Kremenek
f9062be688 Implemented serialization of ImaginaryLiteral.
llvm-svn: 43833
2007-11-07 18:53:02 +00:00
Ted Kremenek
569725f827 Implemented serialization of FloatingLiteral.
llvm-svn: 43832
2007-11-07 18:45:55 +00:00
Steve Naroff
1601858de5 Finishing touches on code generation for @try and friends.
- declare functions we use.
- cast arguments to objc_exception_match().
- don't take the & of _stack.buf.

llvm-svn: 43831
2007-11-07 18:43:40 +00:00
Fariborz Jahanian
1299a92327 Emit objective-c's meta-data at the end of rewriting to stdout.
llvm-svn: 43830
2007-11-07 18:40:28 +00:00
Ted Kremenek
81ad944c94 Implemented generic serialization of APFloat.
llvm-svn: 43829
2007-11-07 18:39:22 +00:00
Ted Kremenek
cc88d37531 Implemented serialization of signed integers.
llvm-svn: 43828
2007-11-07 18:24:34 +00:00
Steve Naroff
b7a032eb20 Remove old asserts from ASTContext::isObjcIdType() and isObjcClassType(). Instead, return false if the declarations aren't in scope. This was a hold over from when 'id' and 'Class' were initialized lazily.
llvm-svn: 43827
2007-11-07 18:07:59 +00:00
Fariborz Jahanian
8a348705a8 Fixed an array overflow bug.
llvm-svn: 43826
2007-11-07 17:43:16 +00:00
Fariborz Jahanian
e044087b56 Fixed typo.
llvm-svn: 43825
2007-11-07 17:29:15 +00:00
Ted Kremenek
c874c6a959 Implemented serialization of CharacterLiteral.
llvm-svn: 43824
2007-11-07 17:15:49 +00:00
Ted Kremenek
3c58662411 Implemented serialiation of PreDefinedExpr.
llvm-svn: 43823
2007-11-07 17:11:58 +00:00
Ted Kremenek
d47c8125a1 Implemented serialization of ContinueStmt.
llvm-svn: 43822
2007-11-07 17:05:07 +00:00
Ted Kremenek
3b4c08deae Implemented serialization of IndirectGotoStmt.
Added "FIXME" regarding the lack of source location information for IndirectGotoStmt.

llvm-svn: 43821
2007-11-07 17:02:32 +00:00
Steve Naroff
a733c7ffe4 Implement rewrite for @throw.
llvm-svn: 43820
2007-11-07 15:32:26 +00:00
Evan Cheng
e742ee1dbe Simplify my (il)logic.
llvm-svn: 43819
2007-11-07 08:08:25 +00:00
Ted Kremenek
5fd3040c57 Implemented serialization of GotoStmt.
llvm-svn: 43818
2007-11-07 08:07:46 +00:00
Ted Kremenek
35e20410aa Implemented serialization for ForStmt.
llvm-svn: 43817
2007-11-07 08:02:55 +00:00
Ted Kremenek
83e96b8d5a Implemented serialization of DoStmt.
llvm-svn: 43816
2007-11-07 07:53:55 +00:00
Ted Kremenek
f6d8ce1052 Implemented serialization for WhileStmt.
llvm-svn: 43815
2007-11-07 07:50:10 +00:00
Ted Kremenek
154c790538 Implemented serialization of IfStmt.
Fixed declarations of several "directEmit" methods of classes that subclass
Stmt that were missing a "virtual" keyword.

llvm-svn: 43814
2007-11-07 07:19:30 +00:00
Chris Lattner
4df68cf26a minor edit
llvm-svn: 43813
2007-11-07 07:07:55 +00:00
Chris Lattner
23dea1ef07 final edits.
llvm-svn: 43812
2007-11-07 06:46:51 +00:00
Chris Lattner
0903ac4837 chapter 7 edits
llvm-svn: 43811
2007-11-07 06:34:39 +00:00
Chris Lattner
d80488f0df edits for chapter 7
llvm-svn: 43810
2007-11-07 06:06:38 +00:00
Steve Naroff
4d7b367652 Teach ASTContext::tagTypesAreCompatible() about the built-in ObjC types (Class and id), removing a bogus warning.
llvm-svn: 43809
2007-11-07 06:03:51 +00:00
Chris Lattner
60ba5ef387 edits for chapter 5
llvm-svn: 43808
2007-11-07 05:47:48 +00:00
Chris Lattner
b2145a86f7 minor edits
llvm-svn: 43807
2007-11-07 05:28:43 +00:00
Ted Kremenek
acb9bcf22a Implemented serialization of SwitchStmt, CaseStmt, BreakStmt, DefaultStmt,
and ParenExpr.

llvm-svn: 43806
2007-11-07 05:25:31 +00:00
Owen Anderson
c6a5387d09 Add some more of StrongPHIElim.
llvm-svn: 43805
2007-11-07 05:17:15 +00:00
Chris Lattner
30f1db1ad9 edits.
llvm-svn: 43804
2007-11-07 05:07:10 +00:00
Steve Naroff
bf478ece48 Rewrite ObjC @try/@catch/@finally. Some minor tweaks to the AST nodes...
Still need to rewrite @throw (and do more testing)...

llvm-svn: 43803
2007-11-07 04:08:17 +00:00
Fariborz Jahanian
adfbbc3330 AST for objective-c's @throw statement and its pretty-printing.
llvm-svn: 43802
2007-11-07 02:00:49 +00:00
Devang Patel
b1ecfc6e25 Start struct bit field laout work.
This is far from complete.

llvm-svn: 43801
2007-11-07 01:57:13 +00:00
Ted Kremenek
a8cdf31aa0 Implemented serialization of LabelStmts.
llvm-svn: 43800
2007-11-07 00:48:04 +00:00
Ted Kremenek
ee4e7d4f25 Added special version of ReadPtr() that returns a deserialized pointer
by value.  This version prohibits backpatching of pointers, so it
useful when a pointee is always known to be deserialized beforehand.

llvm-svn: 43799
2007-11-07 00:47:33 +00:00
Fariborz Jahanian
defbf9a86c Fixed a pretty-printer bug whereby a @try statement with no @finally seg faulted.
llvm-svn: 43798
2007-11-07 00:46:42 +00:00
Ted Kremenek
ad1bc400d7 Added serialization/deserialization of NullStmts.
llvm-svn: 43797
2007-11-07 00:40:53 +00:00
Ted Kremenek
80fe8904e1 Added serialization/deserialization of DeclStmts.
Reordered stmt serialization method implementations to be in alphabetical order.

llvm-svn: 43796
2007-11-07 00:37:40 +00:00
Ted Kremenek
5fe293d7bc Fixed default ctor for APInt to properly initialize BitWidth to a
non-random value.

llvm-svn: 43795
2007-11-07 00:27:59 +00:00
Dale Johannesen
fbe69d2cd6 Interchange Dwarf numbers of ESP and EBP on x86 Darwin.
Much improvement in exception handling.

llvm-svn: 43794
2007-11-07 00:25:05 +00:00
Ted Kremenek
148aa5edbc Overhauled serialization of statements. We no longer use specialized SerializeTrait<> classes,
but methods in Stmt (like other objects we are serializing).  Full serialization of all statements
is not yet complete.

llvm-svn: 43793
2007-11-07 00:17:35 +00:00
Ted Kremenek
abcfe90802 Added static inline method "ReadVal" to QualType for more succinct
deserialization code of objects containing QualTypes.

llvm-svn: 43792
2007-11-07 00:13:45 +00:00
Fariborz Jahanian
e8a3016ac7 Rewrite for properties.
llvm-svn: 43791
2007-11-07 00:09:37 +00:00
Ted Kremenek
fa2bf434cc Fixed typo in the name of "ReadPreamble".
llvm-svn: 43790
2007-11-06 23:52:19 +00:00
Fariborz Jahanian
bcce2f8d54 Fix an inverted conditional,
--chris

llvm-svn: 43789
2007-11-06 23:06:16 +00:00
Tanya Lattner
5de0daf6b1 Implement the XTARGET feature for PR1778
This will mark a test as PASS for all targets specified. It will override whatever is in XFAIL.

llvm-svn: 43788
2007-11-06 22:32:17 +00:00
Ted Kremenek
453ab7d126 Started work on new serialization approach within ASTContext to
serialize Type objects in the order they are serialized in the Types
vector.  We also now rely on the methods within ASTContext to unique
Type objects and handle the actual creation of Type objects (these are
now called by the deserialization code).  This approach solves some
hairy issues with ownership of objects and allows us to naturally
handle recursive types.

llvm-svn: 43787
2007-11-06 22:26:16 +00:00
Ted Kremenek
7c91ccae88 QualType deserialization now requires that the underlying pointer type
must be deserialized without requiring backpatching.

llvm-svn: 43786
2007-11-06 22:23:53 +00:00
Ted Kremenek
93d446f535 Bug fix: inverted test condition to see if a serialized AST-bitcode
file had the correct preamble.

llvm-svn: 43785
2007-11-06 22:23:03 +00:00
Ted Kremenek
bf75685321 Serializer no longer automatically emits a root-level block in the bitstream.
llvm-svn: 43784
2007-11-06 22:22:25 +00:00
Ted Kremenek
cd0c32865c Augmented ReadPtr and ReadOwnedPtr to control whether or not a pointer is allowed to be backpatched
or can be registered with the deserializer to backpatch other pointers.

llvm-svn: 43783
2007-11-06 22:21:14 +00:00
Chris Lattner
581f006f5d make smallptrset more const and type correct, which caught a few
minor bugs.

llvm-svn: 43782
2007-11-06 22:12:43 +00:00
Dan Gohman
ccfc028283 Remainder operations must be either integer or floating-point.
llvm-svn: 43781
2007-11-06 22:11:54 +00:00
Chris Lattner
8201a9bca0 fix const correctness, BB is const, so its predecessors are too
llvm-svn: 43780
2007-11-06 22:07:40 +00:00
Chris Lattner
cbad11e027 don't put erase or query for non-allocainst pointers in an set of allocainsts*'s
llvm-svn: 43779
2007-11-06 22:07:22 +00:00
Fariborz Jahanian
f76f2b0c1c Patch for objc2's property ASTs, as well as pretty-priting the ASTs.
llvm-svn: 43778
2007-11-06 22:01:00 +00:00
Chris Lattner
d8515f8e80 Implement PR1777 by detecting dependent phis that
all compute the same value.

llvm-svn: 43777
2007-11-06 21:52:06 +00:00
Evan Cheng
dd71a5c37b When the allocator rewrite a spill register with new virtual register, it replaces other operands of the same register. Watch out for situations where
only some of the operands are sub-register uses.

llvm-svn: 43776
2007-11-06 21:12:10 +00:00
Duncan Sands
f042e862fd At the point of calculating the shift amount, the
type of SV has changed from what it originally was.
However we need the store width of the original.

llvm-svn: 43775
2007-11-06 20:39:11 +00:00
Ted Kremenek
77068e17d4 Misc. serialization changes to ASTContext and Decls. Serialization
for ASTContext is still rapidly evolving.

llvm-svn: 43774
2007-11-06 19:51:47 +00:00
Ted Kremenek
3a68de993a Revampled Serialization Tester to serialize and deserialize out an entire ASTContext and top-level decls.
llvm-svn: 43773
2007-11-06 19:50:53 +00:00
Ted Kremenek
e344bbbe84 Renamed "Flush()" to "FlushRecord()".
llvm-svn: 43772
2007-11-06 19:49:50 +00:00
Ted Kremenek
d015c7b4fd Added support for processing abbreviations in the Deserializer.
Added some #ifdef-controlled messages for debugging backpatching.

llvm-svn: 43771
2007-11-06 19:49:16 +00:00
Steve Naroff
2d8aaa7d74 Fix a "basic" bug that resulted in a bogus SourceLocation.
Off hand, I don't know why this change makes a difference (I thought the two constructor idioms were equivalent).

llvm-svn: 43770
2007-11-06 19:37:09 +00:00
Chris Lattner
26f288b9ea fixes from Kelly Wilson.
llvm-svn: 43767
2007-11-06 18:13:32 +00:00
Bill Wendling
56235a28ce Clarify some of the iostreams stuff.
llvm-svn: 43766
2007-11-06 09:36:34 +00:00
Evan Cheng
d5d59ad634 First step towards moving the coalescer to priority_queue based machinery.
llvm-svn: 43764
2007-11-06 08:52:21 +00:00
Evan Cheng
92d23e5204 Fix a bug where a def use operand isn't being detected as a sub-register use.
llvm-svn: 43763
2007-11-06 08:50:44 +00:00
Evan Cheng
2dbffa4e76 Add pseudo dependency to force two-address instruction to be scheduled after
other uses. There was a overly restricted check that prevented some obvious
cases.

llvm-svn: 43762
2007-11-06 08:44:59 +00:00
Chris Lattner
ff25240bae edits for chapter 3
llvm-svn: 43761
2007-11-06 07:26:32 +00:00
Chris Lattner
401bf39fa4 chapter 2 edits
llvm-svn: 43760
2007-11-06 07:16:22 +00:00
Chris Lattner
f0d84f1cc7 edits
llvm-svn: 43758
2007-11-06 06:32:18 +00:00
Chris Lattner
45d561ad99 improve decl merging logic to be more correct with
functions.  Patch contributed by Nuno Lopes, thanks!

llvm-svn: 43757
2007-11-06 06:07:26 +00:00
Chris Lattner
0fc613b85d Fix PR1774 and BasicAA/2007-11-05-SizeCrash.ll
llvm-svn: 43756
2007-11-06 05:58:42 +00:00
Owen Anderson
d378cea030 Add a few comments.
llvm-svn: 43755
2007-11-06 05:26:02 +00:00
Owen Anderson
eb964eb2c8 DomForest is a forest of registers, not instructions.
llvm-svn: 43754
2007-11-06 05:22:43 +00:00
Chris Lattner
978ec3c389 clarify what proto is.
llvm-svn: 43753
2007-11-06 05:07:30 +00:00
Chris Lattner
0bf330a1bc Add a real intro to the series.
llvm-svn: 43752
2007-11-06 05:02:48 +00:00
Owen Anderson
a9057f0b97 StrongPHIElimination requires LiveVariables.
llvm-svn: 43751
2007-11-06 04:49:43 +00:00
Chris Lattner
3209725c68 Add better validation for array types when merging decls. Patch
contributed by Oliver Hunt, thanks!

llvm-svn: 43750
2007-11-06 04:28:31 +00:00
Bruno Cardoso Lopes
87bb032c05 Better processor definition
llvm-svn: 43749
2007-11-06 03:15:20 +00:00
Chris Lattner
4f4048a174 typo from Ryan Brown.
llvm-svn: 43748
2007-11-06 01:40:41 +00:00
Chris Lattner
e6819aeee0 fixes from Ryan Brown.
llvm-svn: 43747
2007-11-06 01:39:12 +00:00
Owen Anderson
0d28238a1f Add a missing #include.
llvm-svn: 43746
2007-11-06 01:26:56 +00:00
Chris Lattner
362709dff1 wrap long lines
llvm-svn: 43745
2007-11-06 01:15:27 +00:00
Dan Gohman
08143e397d Add support for vector remainder operations.
llvm-svn: 43744
2007-11-05 23:35:22 +00:00
Dan Gohman
4decbc5002 Fix an abort in instcombine when folding creates a vector rem instruction.
llvm-svn: 43743
2007-11-05 23:16:33 +00:00
Rafael Espindola
fa0df55bdd Move the LowerMEMCPY and LowerMEMCPYCall to a common place.
Thanks for the suggestions Bill :-)

llvm-svn: 43742
2007-11-05 23:12:20 +00:00
Ted Kremenek
f7f7ddfd7e Added registration to deserialization engine of IdentifierInfo* as
IdentifierInfos are deserialized.

llvm-svn: 43741
2007-11-05 22:42:32 +00:00
Ted Kremenek
72f073acd4 Implemented serialization of TypedefDecls.
Fixed infinite recursion in VarDecl::InternalRead.

llvm-svn: 43739
2007-11-05 21:49:34 +00:00
Ted Kremenek
15f50ba755 In driver code implemented serialization of ASTContext. Working on serialization of simple ASTs.
llvm-svn: 43738
2007-11-05 21:39:35 +00:00
Ted Kremenek
7f6e70c5c2 Added skeleton for dispatch of Decl serialization.
llvm-svn: 43737
2007-11-05 21:38:00 +00:00
Ted Kremenek
4556582e2b Added support in serializer and deserializer to create arbitrary blocks.
Added detection of end-of-stream in deserializer.

llvm-svn: 43736
2007-11-05 21:36:35 +00:00
Dale Johannesen
4646aa3e33 Make labels work in asm blocks; allow labels as
parameters.  Rename ValueRefList to ParamList
in AsmParser, since its only use is for parameters.

llvm-svn: 43734
2007-11-05 21:20:28 +00:00
Ted Kremenek
58473ab478 For serialization of ASTContext, added special-casing of serialization
of type sets when emitting complex types and pointer types that are
also considered builtins.  These types are automatically created in
the ctor of ASTContext, and thus should not be serialized (was
producing an error during deserialization).

llvm-svn: 43733
2007-11-05 20:49:23 +00:00
Ted Kremenek
e7fb505f58 Added default creation of root-level block by bitstream serializer.
llvm-svn: 43732
2007-11-05 20:47:27 +00:00
Chris Lattner
2f86ed734d merge in various fixes from Kelly Wilson.
llvm-svn: 43731
2007-11-05 20:13:56 +00:00
Chris Lattner
fbfae1bd7e add some links to the tutorial index and between chapters.
llvm-svn: 43730
2007-11-05 20:04:56 +00:00
Chris Lattner
a25729e0d0 grammaro
llvm-svn: 43729
2007-11-05 19:33:52 +00:00
Devang Patel
b98d2050a2 If a value is incoming from outside the loop then the value does not need remapping and the value is never tracked through LastValueMap.
llvm-svn: 43728
2007-11-05 19:32:30 +00:00
Chris Lattner
4484d8d7f0 recursive types are our friend.
llvm-svn: 43727
2007-11-05 19:28:07 +00:00
Chris Lattner
2a8fd134ea mention possibility of using a visitor
llvm-svn: 43726
2007-11-05 19:25:14 +00:00
Chris Lattner
a94cfa13e7 clarify why prototype::codegen returns a function.
llvm-svn: 43725
2007-11-05 19:22:50 +00:00
Chris Lattner
fd3cb0890b TOC for chapter 8
llvm-svn: 43724
2007-11-05 19:10:15 +00:00
Chris Lattner
639a18dc26 add table of contents to each chapter.
llvm-svn: 43723
2007-11-05 19:06:59 +00:00
Lauro Ramos Venancio
1a30c18e88 [ARM] Fix code generation for:
static __thread struct {
    int a;
    int b;
} teste = {0, 0};

llvm-svn: 43722
2007-11-05 18:33:37 +00:00
Ted Kremenek
e93520d977 Fixed bug where tombstone key and empty key for DenseMap used for
pointer backpatching in deserializer were improperly created and
resulted in an assertion failure.

llvm-svn: 43721
2007-11-05 18:13:03 +00:00
Duncan Sands
f7ae8bd090 Don't output ABI size padding twice. By using the store
size for the field we get ABI padding automatically, so
no need to put it in again when we emit the field.

llvm-svn: 43720
2007-11-05 18:03:02 +00:00
Chris Lattner
38eec3071a add link to llvmbuilder doxygen docs
llvm-svn: 43719
2007-11-05 18:02:15 +00:00
Chris Lattner
9b2f7773ac spell identifier correctly.
llvm-svn: 43718
2007-11-05 17:54:34 +00:00
Chris Lattner
e02310d5e3 fix typo
llvm-svn: 43717
2007-11-05 17:52:04 +00:00
Fariborz Jahanian
63ac80e76a Misc. fixes. 1) Resurrect meta-data generation turned off by a previous patch.
2) Fixed a regression in meta-data generation caused by removal of '_interface' prefix from synthesize class name.
3) Added stubs for @try/@catch/@finally statements.

llvm-svn: 43716
2007-11-05 17:47:33 +00:00
Chris Lattner
2172186c7b Dan points out that mem2reg also promotes vectors: be more precise.
llvm-svn: 43715
2007-11-05 17:45:54 +00:00
Evan Cheng
8bb30184a8 Move SimpleRegisterCoalescing.h to lib/CodeGen since there is now a common
register coalescer interface: RegisterCoalescing.

llvm-svn: 43714
2007-11-05 17:41:38 +00:00
Ted Kremenek
a6d9f3c2cf Made methods "Emit" and "Materialize" in ASTContext (used for serialization) public.
llvm-svn: 43713
2007-11-05 17:41:25 +00:00
Chris Lattner
3527796804 clarify
llvm-svn: 43712
2007-11-05 17:39:26 +00:00
Chris Lattner
3a39ad630a fix typo
llvm-svn: 43711
2007-11-05 17:38:34 +00:00
Ted Kremenek
31b789c0d8 Added TypeSerialization.cpp and DeclSerialization.cpp to the XCode project.
llvm-svn: 43710
2007-11-05 17:04:40 +00:00
Duncan Sands
d6f131ba6f Fix some typos.
llvm-svn: 43709
2007-11-05 16:04:58 +00:00
Steve Naroff
96d20616c4 Sema::ActOnClassMessage()...if a class method isn't found, lookup an instance method. Since all classes are also instances, this is appropriate.
llvm-svn: 43708
2007-11-05 15:27:52 +00:00
Duncan Sands
f8bc406d5d Trivial fixes.
llvm-svn: 43707
2007-11-05 15:15:50 +00:00
Steve Naroff
bd72289baa Declare objc_selector outside the prototype for objc_msgSend(), removing a silly warning.
llvm-svn: 43706
2007-11-05 14:55:35 +00:00
Steve Naroff
e4f9b23458 Rewrite @selector(sel).
llvm-svn: 43705
2007-11-05 14:50:49 +00:00
Steve Naroff
98eb8d1275 - change the synthesized typedef (for classes) to be of type "objc_object".
- fix a couple bugs in RewriteObjCStringLiteral.
- convert "Class" -> "id" in RewriteMessageExpr.

llvm-svn: 43704
2007-11-05 14:36:37 +00:00
Evan Cheng
9337929aae Use movups to spill / restore SSE registers on targets where stacks alignment is
less than 16. This is a temporary solution until dynamic stack alignment is
implemented.

llvm-svn: 43703
2007-11-05 07:30:01 +00:00
Chris Lattner
6cdadb6041 add a link.
llvm-svn: 43702
2007-11-05 07:02:49 +00:00
Chris Lattner
044edf41df finish the tutorial, yaay.
comments and feedback welcome.

llvm-svn: 43701
2007-11-05 07:00:54 +00:00
Evan Cheng
17b0e3e1ae Skip over deleted val#'s.
llvm-svn: 43700
2007-11-05 06:46:45 +00:00
Evan Cheng
a406b47f14 Handle cases where a register and one of its super-register are both marked as
defined on the same instruction. This fixes PR1767.

llvm-svn: 43699
2007-11-05 03:11:55 +00:00
Evan Cheng
e12363dac5 Fix test case. Chris didn't do make check. :-)
llvm-svn: 43698
2007-11-05 03:04:26 +00:00
Bruno Cardoso Lopes
3e0d030dad Added support for PIC code with "explicit relocations" *only*.
Removed all macro code for PIC (goodbye "la").
Support tested with shootout bench.

llvm-svn: 43697
2007-11-05 03:02:32 +00:00
Gordon Henriksen
2657b218ea Bringing Passes.html up-to-date with the deletion of the
-emitbitcode option and the addition of -preverify.

llvm-svn: 43696
2007-11-05 02:05:35 +00:00
Chris Lattner
b7a5dbb4db Add the first section of chapter 8.
llvm-svn: 43695
2007-11-05 01:58:13 +00:00
Gordon Henriksen
2ed067a0d9 Deleting redundant copy of block extractor pass. See also PR1775.
llvm-svn: 43694
2007-11-05 01:54:05 +00:00
Evan Cheng
c68023a955 Doh. PR1187 -> PR1766.
llvm-svn: 43693
2007-11-05 01:00:44 +00:00
Evan Cheng
a8044084ac Fix PR1187.
llvm-svn: 43692
2007-11-05 00:59:10 +00:00
Duncan Sands
f07fa24289 If a long double is in a packed struct, it may be
that there is no padding.

llvm-svn: 43691
2007-11-05 00:35:07 +00:00
Steve Naroff
3865e4d8b4 Remove HandleObjcMetaDataEmission(), I inadvertantly resurrected it.
llvm-svn: 43690
2007-11-05 00:25:00 +00:00
Chris Lattner
350759513b finish the chapter.
llvm-svn: 43689
2007-11-05 00:23:57 +00:00
Duncan Sands
283207a71c Eliminate the remaining uses of getTypeSize. This
should only effect x86 when using long double.  Now
12/16 bytes are output for long double globals (the
exact amount depends on the alignment).  This brings
globals in line with the rest of LLVM: the space
reserved for an object is now always the ABI size.
One tricky point is that only 10 bytes should be
output for long double if it is a field in a packed
struct, which is the reason for the additional
argument to EmitGlobalConstant.

llvm-svn: 43688
2007-11-05 00:04:43 +00:00
Steve Naroff
f36987c79b Two additions...
- Synthesize the funky cast for objc_msgSend(). For the basic case, it looks like...

((id (*)(id, SEL))(void *)objc_msgSend)(obj, sel);

The "void *" cast is needed to workaround a GCC "bandaid" (Chris says it has something to do with the inliner). Without the extra "void *" cast, we get spurious warnings/notes that look like...

xx.m:17: warning: function called through a non-compatible type
xx.m:17: note: if this code is reached, the program will abort

- Add prototypes for the ObjC functions we call, objc_msgSend/objc_getClass for now (don't depend on them being included).

llvm-svn: 43685
2007-11-04 22:37:50 +00:00
Owen Anderson
eea82746b3 Another step of stronger PHI elimination down.
llvm-svn: 43684
2007-11-04 22:33:26 +00:00
Gordon Henriksen
35f398a9cd Deleting -emitbitcode option which did nothing.
llvm-svn: 43683
2007-11-04 20:28:31 +00:00
Chris Lattner
0e6b674993 fix typos
llvm-svn: 43682
2007-11-04 19:42:13 +00:00
Chris Lattner
9329e780cd Fix PR1761 by not printing (rip) suffix when in -static mode.
Evan, please review this.

llvm-svn: 43680
2007-11-04 19:23:28 +00:00
Gordon Henriksen
ad45991a86 Validation fix.
llvm-svn: 43679
2007-11-04 18:17:58 +00:00
Gordon Henriksen
c55d1f6c7f Typo fix.
llvm-svn: 43678
2007-11-04 18:14:08 +00:00
Gordon Henriksen
9f6c4c45d7 Completing Passes.html with the exception of -emitbitcode, which should be
removed. This document could still stand for significant improvement:

  * Editing the pass descriptions; most were lifted with minimal editing from
    comments. Although implementation details were elided, many of the were not
    written for the audience that would be interested in this document.
  * More "before and after" examples.
  * More implicit dependency details. (Perhaps listing transforms in
    -std-compile-opts order would help alleviate this.)
  * Adding documentation for how to invoke passes programmatically.
  * Rearranging the document into a more logical taxonomy. For instance, putting
    profiling passes together.

llvm-svn: 43677
2007-11-04 18:10:18 +00:00
Nick Lewycky
d954dcd138 Fix crash before main on ppc/linux with static constructors. PR1771
llvm-svn: 43676
2007-11-04 17:32:10 +00:00
Gordon Henriksen
a18a276350 Fix a validation error.
llvm-svn: 43675
2007-11-04 16:17:00 +00:00
Gordon Henriksen
d568767ecb Finishing initial docs for all transformations in Passes.html.
Also cleaned up some comments in source files.

llvm-svn: 43674
2007-11-04 16:15:04 +00:00
Gordon Henriksen
d210e9d880 Removing a dead reference from LLVM.xcodeproj.
llvm-svn: 43673
2007-11-04 16:12:17 +00:00
Duncan Sands
399d97987b Change uses of getTypeSize to getABITypeSize, getTypeStoreSize
or getTypeSizeInBits as appropriate in ScalarReplAggregates.
The right change to make was not always obvious, so it would
be good to have an sroa guru review this.  While there I noticed
some bugs, and fixed them: (1) arrays of x86 long double have
holes due to alignment padding, but this wasn't being spotted
by HasStructPadding (renamed to HasPadding).  The same goes
for arrays of oddly sized ints.  Vectors also suffer from this,
in fact the problem for vectors is much worse because basic
vector assumptions seem to be broken by vectors of type with
alignment padding.   I didn't try to fix any of these vector
problems.  (2) The code for extracting smaller integers from
larger ones (in the "int union" case) was wrong on big-endian
machines for integers with size not a multiple of 8, like i1.
Probably this is impossible to hit via llvm-gcc, but I fixed
it anyway while there and added a testcase.  I also got rid of
some trailing whitespace and changed a function name which
had an obvious typo in it.

llvm-svn: 43672
2007-11-04 14:43:57 +00:00
Evan Cheng
5c1b044899 If an interval is being undone clear its preference as well since the source interval may have been undone as well.
llvm-svn: 43670
2007-11-04 08:32:21 +00:00
Chris Lattner
296160d443 Fix PR1763 by allowing the 'q' constraint to work with 64-bit
regs on x86-64.

llvm-svn: 43669
2007-11-04 06:51:12 +00:00
Chris Lattner
ce8c62665a Disable tail duplication of call instructions. The cost
metric is way off for these in general, and this works around
buggy code like that in PR1764.  we'll see if there is a big
performance impact of this.  If so, I'll revert it tomorrow.

llvm-svn: 43668
2007-11-04 06:37:55 +00:00
Chris Lattner
65a146d418 finish the 'Memory in LLVM' section
llvm-svn: 43667
2007-11-03 22:22:30 +00:00
Steve Naroff
66697aa72f Add a method prototype slot/getter to the ObjCMessageExpr AST.
llvm-svn: 43666
2007-11-03 16:37:59 +00:00
Steve Naroff
a397efd915 Implement rewrite rules for ObjC string constants.
llvm-svn: 43665
2007-11-03 11:27:19 +00:00
Chris Lattner
dfcc3f26ae hack and slash the first 20% of chapter seven.
llvm-svn: 43663
2007-11-03 08:55:29 +00:00
Evan Cheng
66298e226f There are times when the coalescer would not coalesce away a copy but the copy
can be eliminated by the allocator is the destination and source targets the
same register. The most common case is when the source and destination registers
are in different class. For example, on x86 mov32to32_ targets GR32_ which
contains a subset of the registers in GR32.

The allocator can do 2 things:
1. Set the preferred allocation for the destination of a copy to that of its source.
2. After allocation is done, change the allocation of a copy destination (if
   legal) so the copy can be eliminated.

This eliminates 443 extra moves from 403.gcc.

llvm-svn: 43662
2007-11-03 07:20:12 +00:00
Chris Lattner
376cdaf50b Fix ownership model of ParseAST to allow the dtor of
ASTConsumer to process the AST before it is destroyed.
This allows elimination of HandleObjcMetaDataEmission.

llvm-svn: 43659
2007-11-03 06:24:16 +00:00
Fariborz Jahanian
9ffbd2d648 Provide both const and non-const accessor methods for @try and @finally ASTs.
My previous patch did the same for @catch AST.

llvm-svn: 43654
2007-11-03 00:38:38 +00:00
Fariborz Jahanian
e21451fc0d Provide const and none-const version of methods accessing various @catch nodes
llvm-svn: 43653
2007-11-03 00:34:02 +00:00
Dan Gohman
d7917b6248 Add std:: to sort calls.
llvm-svn: 43652
2007-11-02 22:24:01 +00:00
Dan Gohman
c981d72d1a Change illegal uses of ++ to uses of STLExtra.h's next function.
llvm-svn: 43651
2007-11-02 22:22:02 +00:00
Fariborz Jahanian
8815795049 pretty-print @try/@catch/@finally from AST as the validation of AST.
llvm-svn: 43649
2007-11-02 18:16:07 +00:00
Ted Kremenek
dda9a56975 Added most of the boilerplate code for Decl serialization. Still a few
key functions to implement.

llvm-svn: 43648
2007-11-02 18:05:11 +00:00
Ted Kremenek
3ae79b3d13 Added overloaded version of Deserializer::ReadOwnedPtr which allows
the target pointer to be passed by reference.  This can result in less
typing, as the object to be deserialized can be inferred from the
argument.

llvm-svn: 43647
2007-11-02 18:04:20 +00:00
Evan Cheng
2b93a20b09 Unbreak tailcall opt.
llvm-svn: 43646
2007-11-02 17:45:40 +00:00
Evan Cheng
0442889b18 Add run line.
llvm-svn: 43645
2007-11-02 17:36:58 +00:00
Evan Cheng
f851163c53 One more extract_subreg coalescing bug.
llvm-svn: 43644
2007-11-02 17:35:08 +00:00
Chris Lattner
0b271eb7af Expose InsertText, fixing an oversight.
llvm-svn: 43643
2007-11-02 17:26:47 +00:00
Chris Lattner
389d430c49 add a note
llvm-svn: 43642
2007-11-02 17:04:20 +00:00
Anders Carlsson
bfd60eedd7 Generate code for member exprs.
llvm-svn: 43641
2007-11-02 16:59:10 +00:00
Fariborz Jahanian
f859ef293c AST for @try statement.
llvm-svn: 43640
2007-11-02 15:39:31 +00:00
Duncan Sands
04059dd351 Fix a thinko.
llvm-svn: 43639
2007-11-02 15:18:06 +00:00
Neil Booth
758d0fd736 Remove some unnecessary C-style statics.
Restore an assertion that arithmetic can be performed on this format.

llvm-svn: 43638
2007-11-02 15:10:05 +00:00
Chris Lattner
74f87df108 fix typos
llvm-svn: 43637
2007-11-02 05:54:25 +00:00
Chris Lattner
ba2c3cdebb Finish chapter 6, and add a spiffy demo that shows off the language.
llvm-svn: 43636
2007-11-02 05:42:52 +00:00
Owen Anderson
2fd26c3641 VAArgInst does, in fact, read memory.
llvm-svn: 43633
2007-11-02 04:01:21 +00:00
Hartmut Kaiser
4a7d2d65e3 Updated VC++ build system
llvm-svn: 43632
2007-11-02 01:44:32 +00:00
Hartmut Kaiser
7d888fa180 Updated VC++ build system
llvm-svn: 43631
2007-11-02 01:44:08 +00:00
Evan Cheng
e453ff4913 Missing a getNumOperands check.
llvm-svn: 43630
2007-11-02 01:26:22 +00:00
Fariborz Jahanian
71234d8a9e AST for @finally statement.
llvm-svn: 43629
2007-11-02 00:18:53 +00:00
Fariborz Jahanian
9e63b98de7 AST build for @catch clause (this is work in progress).
llvm-svn: 43628
2007-11-01 23:59:59 +00:00
Neil Booth
ae077d232c Add back line whose removal somehow crept into prior patch
llvm-svn: 43627
2007-11-01 22:51:07 +00:00
Neil Booth
618d0fc377 When converting to integer, do bit manipulations in the destination
memory rather than in a copy of the APFloat.  This avoids problems
when the destination is wider than our significand and is cleaner.

Also provide deterministic values in all cases where conversion
fails, namely zero for NaNs and the minimal or maximal value
respectively for underflow or overflow.

llvm-svn: 43626
2007-11-01 22:43:37 +00:00
Ted Kremenek
5e2eb261af Simplified Serialization code for SourceLocation and SourceRange, and
updated it to the recently updated Serialization API.

Changed clients of SourceLocation serialization to call the
appropriate new methods.

Updated Decl serialization code to put new skeleton serialization code
in place that is much better than the older trait-specialization
approach.

llvm-svn: 43625
2007-11-01 22:25:41 +00:00
Ted Kremenek
478c6982a8 Removed ReadVal from SerializeTrait<T>, and also removed it from
Deserializer.

There were issues with Visual C++ barfing when instantiating
SerializeTrait<T> when "T" was an abstract class AND
SerializeTrait<T>::ReadVal was *never* called:

template <typename T>
struct SerializeTrait {
 <SNIP>
  static inline T ReadVal(Deserializer& D) { T::ReadVal(D); }
 <SNIP>
};

Visual C++ would complain about "T" being an abstract class, even
though ReadVal was never instantiated (although one of the other
member functions were).

Removing this from the trait is not a big deal.  It was used hardly
ever, and users who want "read-by-value" deserialization can simply
call the appropriate methods directly instead of relying on
trait-based-dispatch.  The trait dispatch for
serialization/deserialization is simply sugar in many cases (like this
one).

llvm-svn: 43624
2007-11-01 22:23:34 +00:00
Fariborz Jahanian
65590b2504 Bunch of class declarations for objective-c's @try-catch statement.
llvm-svn: 43623
2007-11-01 21:12:44 +00:00
Duncan Sands
44b8721de8 Executive summary: getTypeSize -> getTypeStoreSize / getABITypeSize.
The meaning of getTypeSize was not clear - clarifying it is important
now that we have x86 long double and arbitrary precision integers.
The issue with long double is that it requires 80 bits, and this is
not a multiple of its alignment.  This gives a primitive type for
which getTypeSize differed from getABITypeSize.  For arbitrary precision
integers it is even worse: there is the minimum number of bits needed to
hold the type (eg: 36 for an i36), the maximum number of bits that will
be overwriten when storing the type (40 bits for i36) and the ABI size
(i.e. the storage size rounded up to a multiple of the alignment; 64 bits
for i36).

This patch removes getTypeSize (not really - it is still there but
deprecated to allow for a gradual transition).  Instead there is:

(1) getTypeSizeInBits - a number of bits that suffices to hold all
values of the type.  For a primitive type, this is the minimum number
of bits.  For an i36 this is 36 bits.  For x86 long double it is 80.
This corresponds to gcc's TYPE_PRECISION.

(2) getTypeStoreSizeInBits - the maximum number of bits that is
written when storing the type (or read when reading it).  For an
i36 this is 40 bits, for an x86 long double it is 80 bits.  This
is the size alias analysis is interested in (getTypeStoreSize
returns the number of bytes).  There doesn't seem to be anything
corresponding to this in gcc.

(3) getABITypeSizeInBits - this is getTypeStoreSizeInBits rounded
up to a multiple of the alignment.  For an i36 this is 64, for an
x86 long double this is 96 or 128 depending on the OS.  This is the
spacing between consecutive elements when you form an array out of
this type (getABITypeSize returns the number of bytes).  This is
TYPE_SIZE in gcc.

Since successive elements in a SequentialType (arrays, pointers
and vectors) need to be aligned, the spacing between them will be
given by getABITypeSize.  This means that the size of an array
is the length times the getABITypeSize.  It also means that GEP
computations need to use getABITypeSize when computing offsets.
Furthermore, if an alloca allocates several elements at once then
these too need to be aligned, so the size of the alloca has to be
the number of elements multiplied by getABITypeSize.  Logically
speaking this doesn't have to be the case when allocating just
one element, but it is simpler to also use getABITypeSize in this
case.  So alloca's and mallocs should use getABITypeSize.  Finally,
since gcc's only notion of size is that given by getABITypeSize, if
you want to output assembler etc the same as gcc then getABITypeSize
is the size you want.

Since a store will overwrite no more than getTypeStoreSize bytes,
and a read will read no more than that many bytes, this is the
notion of size appropriate for alias analysis calculations.

In this patch I have corrected all type size uses except some of
those in ScalarReplAggregates, lib/Codegen, lib/Target (the hard
cases).  I will get around to auditing these too at some point,
but I could do with some help.

Finally, I made one change which I think wise but others might
consider pointless and suboptimal: in an unpacked struct the
amount of space allocated for a field is now given by the ABI
size rather than getTypeStoreSize.  I did this because every
other place that reserves memory for a type (eg: alloca) now
uses getABITypeSize, and I didn't want to make an exception
for unpacked structs, i.e. I did it to make things more uniform.
This only effects structs containing long doubles and arbitrary
precision integers.  If someone wants to pack these types more
tightly they can always use a packed struct.

llvm-svn: 43620
2007-11-01 20:53:16 +00:00
Devang Patel
e11664a0ef Rename classes and collections that maintain record layout information.
Now, at AST level record info is maintained by ASTRecordLayout class.
Now, at code gen  level record info is maintained by CGRecordLayout class.

llvm-svn: 43619
2007-11-01 19:11:01 +00:00
Ted Kremenek
26a7f3fd56 Implemented serialization of QualTypes within ASTContext. Clarified
ownership model of some type pointers.  Added FIXMEs to serialization.

Added comments to ASTContext indicating which variables we are intentionally
*not* serializing.

llvm-svn: 43618
2007-11-01 18:11:32 +00:00
Fariborz Jahanian
ac73ff8868 Remaining work to collect objective-c's type qualifiers and use them to encode
method types.

llvm-svn: 43617
2007-11-01 17:18:37 +00:00
Steve Naroff
63006473d5 - Remove _interface_ prefix for the synthesized tag names.
- Also removed a tab from the generated struct (minor).

llvm-svn: 43616
2007-11-01 17:12:31 +00:00
Ted Kremenek
53155f379e Changed serialization/deserialization of BuiltinTypes to explicitly serialize
each type.  This ensures that the order in which the types are serialized
is clear and remains persistent.

llvm-svn: 43615
2007-11-01 17:10:34 +00:00
Ted Kremenek
baa461893b Reverted unnecessary inlining of operator!=, since negating operator== is
just as efficient and much more succinct.

llvm-svn: 43614
2007-11-01 16:35:25 +00:00
Devang Patel
32714064b1 Propagate bitfield info.
llvm-svn: 43613
2007-11-01 16:29:56 +00:00
Steve Naroff
50d4205ff9 Implement rewrite rule for commenting out protocol references. For example:
extern id /*<NSObject>*/ NSAllocateObject(Class aClass, unsigned extraBytes, NSZone *zone);

extern void NSDeallocateObject(id /*<NSObject>*/object);

extern id /*<NSObject>*/ NSCopyObject(id /*<NSObject>*/object, unsigned extraBytes, NSZone *zone);

llvm-svn: 43612
2007-11-01 13:24:47 +00:00
Duncan Sands
e0e774b6fd Don't barf on empty basic blocks. Do not rely on assert
doing something - this needs to work for release builds
too.  I chose to just abort rather than following the
fancy logic of abortIfBroken, because (1) it is a pain
to do otherwise, and (2) nothing is going to work if the
module is this broken.

llvm-svn: 43611
2007-11-01 10:50:26 +00:00
Bill Wendling
87f460f8ba Silence a warning saying that the variables always resolve to "true" in an
expression.

llvm-svn: 43610
2007-11-01 09:38:19 +00:00
Bill Wendling
b7cabbe295 Silence, accersed warning
llvm-svn: 43609
2007-11-01 08:51:44 +00:00
Bill Wendling
2b3f7a7e3b Get rid of compilation warning during release builds
llvm-svn: 43608
2007-11-01 08:24:40 +00:00
Chris Lattner
68613c7d31 Add the start of chapter 6, still much to go.
llvm-svn: 43607
2007-11-01 06:49:54 +00:00
Evan Cheng
fe1ac52836 - Coalesce extract_subreg when both intervals are relatively small.
- Some code clean up.

llvm-svn: 43606
2007-11-01 06:22:48 +00:00
Owen Anderson
2ed651ace7 Fix test/Transforms/DeadStoreElimination/PartialStore.ll, which had been
silently failing because of an incorrect run line for some time.

llvm-svn: 43605
2007-11-01 05:29:16 +00:00
Chris Lattner
b338a6b9f3 add support for vector type compatibility checking. Patch by Nate Begeman.
llvm-svn: 43604
2007-11-01 05:03:41 +00:00
Chris Lattner
dff7a3e919 remove verifier command line option: this should be part of the API, not
a command line optn.

llvm-svn: 43603
2007-11-01 04:43:13 +00:00
Chris Lattner
059a8df289 add a broken gcc version, thanks to P. Durante for pointing this out.
llvm-svn: 43602
2007-11-01 04:20:16 +00:00
Owen Anderson
fe41d79112 Now with less tabs!
llvm-svn: 43601
2007-11-01 03:54:23 +00:00
Steve Naroff
2f55b98725 Tweak RewriteInterfaceDecl() to generate a typedef (if one hasn't already been generated).
llvm-svn: 43600
2007-11-01 03:35:41 +00:00
Chris Lattner
c3ebf29ef6 Implement test/Sema/init.c by treating functions as constants.
llvm-svn: 43599
2007-11-01 02:45:17 +00:00
Dale Johannesen
440f9abab4 Test that expand_vector_elt(v2i64) works in 32-bit mode.
llvm-svn: 43598
2007-11-01 02:38:24 +00:00
Chris Lattner
6ab19ed78d Fix InstCombine/2007-10-31-StringCrash.ll by removing an obvious
(in hindsight) infinite recursion.  Simplify the code.

llvm-svn: 43597
2007-11-01 02:30:35 +00:00
Chris Lattner
74709473ed Fix InstCombine/2007-10-31-RangeCrash.ll
llvm-svn: 43596
2007-11-01 02:18:41 +00:00
Ted Kremenek
fb764e52b0 Rewrote backpatcher. Backpatcher now stores the "has final pointer"
flag in the **key** of the backpatch map, as opposed to the mapped
value which contains either the final pointer, or a pointer to a chain
of pointers that need to be backpatched.  The bit flag was moved to
the key because we were erroneously assuming that the backpatched
pointers would be at an alignment of >= 2 bytes, which obviously
doesn't work for character strings.  Now we just steal the bit from the key.

llvm-svn: 43595
2007-11-01 00:57:37 +00:00
Ted Kremenek
df0768e1b1 Added typedef "value_type" to DenseMap (similar typedef appears in std::map).
Added method FindAndConstruct() to DenseMap, which does the same thing as
operator[], except that it refers value_type& (a reference to both the
key and mapped data pair).  This method is useful for clients that wish
to access the stored key value, as opposed to the key used to do the
actual lookup (these need not always be the same).

Redefined operator[] to use FindAndConstruct() (same logic).

llvm-svn: 43594
2007-11-01 00:54:57 +00:00
Anders Carlsson
41b7c6b250 Put constant CFStrings in the __DATA,__cfstring section.
llvm-svn: 43593
2007-11-01 00:41:52 +00:00
Anders Carlsson
1e27f9b296 Stub out codegen for __builtin_constant_p. Remove any implicit cast exprs in the call to __builtin___CFStringMakeConstantString.
llvm-svn: 43592
2007-11-01 00:39:26 +00:00
Devang Patel
0b59b45870 Remove unnecessary method.
llvm-svn: 43591
2007-11-01 00:11:37 +00:00
Devang Patel
ad175428c6 start adding pading fields.
llvm-svn: 43590
2007-11-01 00:07:12 +00:00
Fariborz Jahanian
7a9c47480d 1) More additions for objective-c's qualifier type.
2) Fixed a test failure (which should have failed all along!).

llvm-svn: 43589
2007-10-31 23:53:01 +00:00
Anders Carlsson
e89b84ab29 Fix a typo that prevented pointer-to-int conversions from working.
llvm-svn: 43588
2007-10-31 23:18:02 +00:00
Devang Patel
f5fcb9870a Refactor code into a separate method.
llvm-svn: 43587
2007-10-31 23:17:19 +00:00
Fariborz Jahanian
c3cda76362 Fixed a bug exposed by fixing the assert in previous patch (one of the tests asserted).
llvm-svn: 43586
2007-10-31 23:08:24 +00:00
Fariborz Jahanian
aa9a95ca4f Changed direction of assert. Added more comments.
llvm-svn: 43585
2007-10-31 22:57:04 +00:00
Ted Kremenek
6aff871a84 Implemented more of serialization/deserialization for ASTContext. We now
(hypothetically) read in/write out most of the types.  Bugs likely exist.

llvm-svn: 43584
2007-10-31 22:44:07 +00:00
Ted Kremenek
fb41f72916 constified several pointer arguments for methods in the Deserializer.
llvm-svn: 43583
2007-10-31 22:42:03 +00:00
Steve Naroff
9c4fdddd0c Fix two rewriter bugs:
- For @class, don't generate multiple typedefs.
- Handle the following edge case interface...

@interface NSMiddleSpecifier : NSObject {}

@end

...which was incorrectly being rewritten to...

struct _interface_NSMiddleSpecifier {
        struct _interface_NSObject _NSObject;
};
{}

llvm-svn: 43582
2007-10-31 22:11:35 +00:00
Anders Carlsson
0370eb2034 Handle function calls that return aggregate expressions.
llvm-svn: 43581
2007-10-31 22:04:46 +00:00
Fariborz Jahanian
d822d68b74 More infrastructure to recognize objective-c's type qualifiers (in,inout, etc.)
llvm-svn: 43580
2007-10-31 21:59:43 +00:00
Dan Gohman
b43e020cdb Fix a regression in test/CodeGen/X86/2007-04-24-VectorCrash.ll introduced
by r43510. Gracefully handle constants with vector type that aren't
ConstantVector or ConstantAggregateZero.

llvm-svn: 43579
2007-10-31 21:36:31 +00:00
Owen Anderson
9396c39501 Add a preverifier pass to check that every basic block ends in a terminator, so that we don't segfault when verifying invalid code.
llvm-svn: 43578
2007-10-31 21:04:18 +00:00
Devang Patel
cc4c2930ae New test to verify llvm struct layout.
llvm-svn: 43577
2007-10-31 21:02:10 +00:00
Devang Patel
6029cbf872 Check whether next slot meets field type's alignment requirements.
If it does not then assert at the moment.

llvm-svn: 43576
2007-10-31 21:01:37 +00:00
Steve Naroff
aaba027717 Implement ObjC built-in types in MinimalAction.
This fixes the recent regression with selector-1.m and -parse-noop.

llvm-svn: 43575
2007-10-31 20:55:39 +00:00
Ted Kremenek
b681c68a7e Implemented short-circuited version of Builtin::Info::operator!=.
llvm-svn: 43574
2007-10-31 20:55:27 +00:00
Devang Patel
1c8788bbd0 Keep track of field offsets during structure layout.
Take 2.

llvm-svn: 43573
2007-10-31 20:08:22 +00:00
Devang Patel
75ef2f0b45 Take 2.
Make target info available to clang code generator.  This is far from complete but this helps clang codegen module make progress.

At the moment target triplet and target description strings are hard coded in clang::TargetInfo

llvm-svn: 43572
2007-10-31 20:01:01 +00:00
Ted Kremenek
c55cd9a38a Adjusted QualType deserialization to reflect updated deserialization API.
We now serialize ivar references inside of ASTContext.

llvm-svn: 43571
2007-10-31 20:00:03 +00:00
Ted Kremenek
705770664d Implemented deserialization of references. References are handled
just like pointers, except that they cannot be backpatched.  This
means that references are essentially non-owning pointers where the
referred object must be deserialized prior to the reference being
deserialized.  Because of the nature of references, this ordering of
objects is always possible.

Fixed a bug in backpatching code (returning the backpatched pointer
would accidentally include a bit flag).

llvm-svn: 43570
2007-10-31 19:58:32 +00:00
Devang Patel
7abb7acafd Initialize MemCpyFn
llvm-svn: 43569
2007-10-31 19:54:57 +00:00
Fariborz Jahanian
95b6076c77 Fixed problem with rewriting stand-alone @implementation (with no matching @interface).
A new test case added.

llvm-svn: 43568
2007-10-31 18:48:14 +00:00
Steve Naroff
6d40db0dde Implement a more sensible strategy for ObjC built-in types (addressing a long standing FIXME in Sema::GetObjcIdType()).
This removes several gross hacks to work around the previous "lazy" behavior.

Two notes:
- MinimalActions still needs to be taught about the built-in types (This breaks one of the -noop test cases). I started this, then added a FIXME.
- I didn't convert Sema::GetObjcProtoType() yet.

llvm-svn: 43567
2007-10-31 18:42:27 +00:00
Ted Kremenek
e32c067cc4 Preliminary support for serializing statements.
llvm-svn: 43566
2007-10-31 18:41:19 +00:00
Ted Kremenek
e119266c19 Added Serializer::EmitRef to deal with emitting arbitrary references.
Modified Serializer::EmitPtr to handle const pointers.

llvm-svn: 43565
2007-10-31 18:23:21 +00:00
Ted Kremenek
d2f7cc9f2b Updated path to clang.cpp in build documentation.
llvm-svn: 43564
2007-10-31 17:58:51 +00:00
Ted Kremenek
468b1cb96f Updated build instructions to not include an absolute line number in clang.cpp to add hard-coded paths.
llvm-svn: 43563
2007-10-31 17:57:30 +00:00
Ted Kremenek
08bed095eb Updated a comment to hopefully silence a Lattner warning.
llvm-svn: 43562
2007-10-31 17:53:38 +00:00
Ted Kremenek
9cc9335bdf Implemented serialization of Variable Array Types (VLAs).
llvm-svn: 43561
2007-10-31 17:50:23 +00:00
Fariborz Jahanian
aff228dfc7 Rewriteing of ivars changed to just copy directly from the source.
llvm-svn: 43560
2007-10-31 17:29:28 +00:00
Ted Kremenek
ff70faead8 Changed access control within FoldingSet for some ivars from "private"
to "protected".  This allows iterators to work.

llvm-svn: 43559
2007-10-31 17:12:47 +00:00
Ted Kremenek
fc581a9a89 Renamed ivar "ArrayTypes" in ASTContext to "ComplexArrayTypes".
Added skeleton code for serialization of ASTContext.

llvm-svn: 43558
2007-10-31 17:10:13 +00:00
Steve Naroff
ac0216385f Checking in some code that is still under construction.
I need to (finally) change the way Class/id/SEL/IMP are built-in...the current approach of doing it in the preprocessor is "broken". The other problem is Sema::GetObjcIdType/GetObjcSelType/GetObjcClassType, the hooks that initialize ASTContext lazily. These built-in types need to be done up front...

llvm-svn: 43557
2007-10-31 16:03:04 +00:00
Fariborz Jahanian
d728e949bb After Anders check-in, we can now encode 'Class' type.
llvm-svn: 43556
2007-10-31 16:00:13 +00:00
Ted Kremenek
f1d34d3fea Added a few clarifying steps the the "building clang" section.
llvm-svn: 43555
2007-10-31 15:31:24 +00:00
Rafael Espindola
419b6d7ce4 Make ARM and X86 LowerMEMCPY identical by moving the isThumb check into getMaxInlineSizeThreshold
and by restructuring the X86 version.

New I just have to move this to a common place :-)

llvm-svn: 43554
2007-10-31 14:39:58 +00:00
Dan Gohman
54048ec9e0 Fix a typo in a comment.
llvm-svn: 43553
2007-10-31 14:35:39 +00:00
Rafael Espindola
063f177300 Make ARM an X86 memcpy expansion more similar to each other.
Now both subtarget define getMaxInlineSizeThreshold and the expansion uses it.

This should not change generated code.

llvm-svn: 43552
2007-10-31 11:52:06 +00:00
Duncan Sands
3b4668a5d8 Promotion of sdiv/srem/udiv/urem.
llvm-svn: 43551
2007-10-31 08:57:43 +00:00
Duncan Sands
21ca939683 Add a newline at the end of the file.
llvm-svn: 43550
2007-10-31 08:49:24 +00:00
Chris Lattner
75045da563 fix validation
llvm-svn: 43549
2007-10-31 07:30:39 +00:00
Chris Lattner
1db6e89b7a okay, fine, make me finish this chapter. :)
Feedback appreciated!

llvm-svn: 43548
2007-10-31 07:29:43 +00:00
Chris Lattner
6b0fb58110 add the code for expression code that we'll add, though most of the
description is missing.

llvm-svn: 43547
2007-10-31 06:47:39 +00:00
Chris Lattner
149c55aba4 Add the first half of chapter 5: if/then/else.
To come: for statement.

llvm-svn: 43546
2007-10-31 06:30:21 +00:00
Chris Lattner
da1988477d __main is dead along with llvm-gcc3.
llvm-svn: 43545
2007-10-31 05:53:31 +00:00
Chris Lattner
5087e267c2 temporarily revert devang's patch to link in the llvm codegen etc.
llvm-svn: 43544
2007-10-31 04:53:03 +00:00
Steve Naroff
37e011ce43 Add some plumbing to help cope with rewriting "id<p>", "Class<p>*".
llvm-svn: 43543
2007-10-31 04:38:33 +00:00
Owen Anderson
0b59fa0605 Add the skeleton of a better PHI elimination pass.
llvm-svn: 43542
2007-10-31 03:37:57 +00:00
Owen Anderson
9b8f34f2ac Some fixes to get MachineDomTree working better.
llvm-svn: 43541
2007-10-31 03:30:14 +00:00
Anders Carlsson
f56a7aee2f Encode Class, SEL and Objective-C objects.
llvm-svn: 43540
2007-10-31 02:53:19 +00:00
Devang Patel
df62bc067a Keep track of field offsets during structure layout.
llvm-svn: 43539
2007-10-31 01:23:10 +00:00
Devang Patel
46c7003052 Make target info available to clang code generator.
This is far from complete but this helps clang codegen module
make progress.

llvm-svn: 43536
2007-10-31 00:59:29 +00:00
Dale Johannesen
b066c1f216 Make i64=expand_vector_elt(v2i64) work in 32-bit mode.
llvm-svn: 43535
2007-10-31 00:32:36 +00:00
Fariborz Jahanian
ca5338196f Added new type and bitfield fields in some decl types in preparation for objective-c's type qualifiers.
Added initialization of Class/SEMA types.

llvm-svn: 43534
2007-10-31 00:12:35 +00:00
Evan Cheng
240c1adade At end of LSR, replace uses of now constant (as result of SplitCriticalEdge) PHI node with the constant value.
llvm-svn: 43533
2007-10-30 23:45:15 +00:00
Ted Kremenek
4f4c3f9fd5 Added member function "size()" to FoldingSet to return the number of
nodes in the FoldingSet.

llvm-svn: 43531
2007-10-30 23:35:55 +00:00
Devang Patel
82ae5f255f Avoid unnecessary PATypeHolder copy.
llvm-svn: 43530
2007-10-30 23:22:14 +00:00
Steve Naroff
5cdcd9b61c Stop pre-defining objc_msgSend/objc_getClass in the preprocessor. Instead, I generate these declaration on the fly when rewriting a message expression.
llvm-svn: 43529
2007-10-30 23:14:51 +00:00
Devang Patel
17833d7068 New test.
llvm-svn: 43527
2007-10-30 23:07:47 +00:00
Ted Kremenek
e26f3c50c5 Updated some comments.
Disabled assignments for ContentCache.
Copy-ctor for ContentCache now has an assertion preventing it to
be copied from an object that already has an allocated buffer.

llvm-svn: 43526
2007-10-30 22:57:35 +00:00
Chris Lattner
595db86c9d __real__ and __imag__ can be lvalues. Add support to ast and codegen for them.
llvm-svn: 43525
2007-10-30 22:53:42 +00:00
Evan Cheng
c2dbfee43f It's not safe to tell SplitCriticalEdge to merge identical edges. It may delete the phi instruction that's being processed.
llvm-svn: 43524
2007-10-30 22:27:26 +00:00
Dale Johannesen
d50c8bcef6 Add missing SSE builtins: CVTPD2PI, CVTPS2PI,
CVTTPD2PI, CVTTPS2PI, CVTPI2PD, CVTPI2PS.

llvm-svn: 43523
2007-10-30 22:15:38 +00:00
Ted Kremenek
4c0ef37fbb Refactored CFG construction code that processes DeclStmts to use StmtIterator.
Now CFG construction transparently supports Variable Length Array declarations
with expressions for their sizes, and typedefs that include VLAs.

llvm-svn: 43520
2007-10-30 21:48:34 +00:00
Devang Patel
73721a12ca Refactor code into a separate method.
llvm-svn: 43519
2007-10-30 21:27:20 +00:00
Ted Kremenek
c08bca6ae8 Removed SrcMgr::FileInfo and SrcMgr::InfoRec and replaced them with a
single class: ContentCache.  This simplifies the logic in
SourceManager and makes the ownership of MemoryBuffers clearer.

llvm-svn: 43518
2007-10-30 21:08:08 +00:00
Ted Kremenek
78036cdd5c Tightened IgnoreParen.
llvm-svn: 43517
2007-10-30 21:03:09 +00:00
Devang Patel
ffe1e218f2 Fix 80 col violations.
llvm-svn: 43516
2007-10-30 20:59:40 +00:00
Chris Lattner
0b11172e8c minor tweaks
llvm-svn: 43515
2007-10-30 20:57:56 +00:00
Devang Patel
f5bda316c5 Use
+  llvm::DenseMap<Type *, llvm::PATypeHolder> TypeHolderMap;
instead of
-  llvm::DenseMap<Type *, llvm::PATypeHolder *> TypeHolderMap;

llvm-svn: 43514
2007-10-30 20:46:47 +00:00
Fariborz Jahanian
4d5b2baa1c Fixed tests.
llvm-svn: 43513
2007-10-30 20:41:57 +00:00
Chris Lattner
e0218997ab minor code cleanup
llvm-svn: 43512
2007-10-30 20:27:44 +00:00
Evan Cheng
0747bc1df6 Typo.
llvm-svn: 43511
2007-10-30 20:11:21 +00:00
Dan Gohman
9f39660c20 Add support for folding binary operators with vector zero operands.
llvm-svn: 43510
2007-10-30 19:00:49 +00:00
Chris Lattner
de21d55e70 shrinkify storage class to a bitfield, add a fixme about merging it in the future.
llvm-svn: 43509
2007-10-30 18:54:50 +00:00
Devang Patel
fa0cb1ef3a Remove commented out line.
llvm-svn: 43508
2007-10-30 18:31:12 +00:00
Fariborz Jahanian
18d7b30241 Revisited my last patch to be able to do encoding of ivar types with 'id'.
llvm-svn: 43507
2007-10-30 18:27:03 +00:00
Chris Lattner
74a0ae2c2a update some comments.
llvm-svn: 43506
2007-10-30 17:46:51 +00:00
Chris Lattner
39afd571a0 Avoid using macro expansions, which causes these to come out in -E mode.
llvm-svn: 43505
2007-10-30 17:45:43 +00:00
Fariborz Jahanian
509d8d6fc6 Added type encoding for 'id' type.
llvm-svn: 43504
2007-10-30 17:06:23 +00:00
Steve Naroff
f921385f40 Rewrite protocols.
llvm-svn: 43503
2007-10-30 16:42:30 +00:00
Ted Kremenek
9139310c76 Added vector to ASTContext to store references to "complete" VLA types
(VLAs with a specified size expresssion).  This vector owns the
references to these type objects.

llvm-svn: 43502
2007-10-30 16:41:53 +00:00
Steve Naroff
5448cf6d61 - Add location info to category/protocol AST's
- Rewrite categories.

llvm-svn: 43501
2007-10-30 13:30:57 +00:00
Duncan Sands
b508c53c63 Fix for visibility warnings generated by gcc-4.2.
llvm-svn: 43500
2007-10-30 13:14:37 +00:00
Duncan Sands
9ad5465005 Add support for expanding trunc stores. Consider
storing an i170 on a 32 bit machine.  This is first
promoted to a trunc-i170 store of an i256.  On a
little-endian machine this expands to a store of
an i128 and a trunc-i42 store of an i128.  The
trunc-i42 store is further expanded to a trunc-i42
store of an i64, then to a store of an i32 and a
trunc-i10 store of an i32.  At this point the operand
type is legal (i32) and expansion stops (legalization
of the trunc-i10 needs to be handled in LegalizeDAG.cpp).
On big-endian machines the high bits are stored first,
and some bit-fiddling is needed in order to generate
aligned stores.

llvm-svn: 43499
2007-10-30 12:50:39 +00:00
Duncan Sands
341f093bb1 If a call to getTruncStore is for a normal store,
offload to getStore rather than trying to handle
both cases at once (the assertions for example
assume the store really is truncating).

llvm-svn: 43498
2007-10-30 12:40:58 +00:00
Steve Naroff
4cd61acc33 Remove a couple FIXME's for rewriting ObjC interfaces (which are now being rewritten properly).
llvm-svn: 43494
2007-10-30 03:43:13 +00:00
Steve Naroff
c54840433f More support for rewriting ObjC intefaces. Still some edge cases to handle...
llvm-svn: 43493
2007-10-30 02:23:23 +00:00
Dale Johannesen
3f156de60d Fix argument types for PSLLQ, PSRLQ.
llvm-svn: 43490
2007-10-30 01:44:33 +00:00
Dale Johannesen
6aa304e529 Add missing MMX PSUBQ.
llvm-svn: 43488
2007-10-30 01:18:38 +00:00
Anders Carlsson
df4cc6160f Handle function types.
llvm-svn: 43485
2007-10-30 00:06:20 +00:00
Fariborz Jahanian
31d05db565 Assert if isObjcIdType is called before 'id' type is built.
llvm-svn: 43484
2007-10-30 00:00:49 +00:00
Ted Kremenek
843ebedde4 VariableArrayTypes (VLAs) without a size expression are now uniqued
and inserted into a FoldingSet owned by ASTContext.

llvm-svn: 43482
2007-10-29 23:37:31 +00:00
Fariborz Jahanian
797f24cd7e Encoding for objectiive-c methods.
llvm-svn: 43481
2007-10-29 22:57:28 +00:00
Evan Cheng
b024c4c81d - Bug fixes.
- Allow icmp rewrite using an iv / stride of a smaller integer type.

llvm-svn: 43480
2007-10-29 22:07:18 +00:00
Hartmut Kaiser
f557d896cb Updated VC++ build system
llvm-svn: 43479
2007-10-29 21:56:15 +00:00
Hartmut Kaiser
b20beb88cd Updated VC++ build system
llvm-svn: 43478
2007-10-29 21:54:46 +00:00
Hartmut Kaiser
ae240716ec Added a missing #include.
llvm-svn: 43477
2007-10-29 21:54:12 +00:00
Steve Naroff
e093339601 Remove a bunch of TODO's that have been done for quite some time...
llvm-svn: 43476
2007-10-29 21:39:29 +00:00
Steve Naroff
33a1e80dd1 This commit contains lot's of small tweaks to how we pass around and store SourceLocation's for interfaces/protocols/categories/implementations.
llvm-svn: 43475
2007-10-29 21:38:07 +00:00
Ted Kremenek
31974dfcdf Added support for StmtIterators to iterate over the size expressions
of VariableArrayTypes that appear in TypedefDecls.

for example:

  typedef int T[x][x];

the StmtIterator will iterate over "x" and "x" as subexpressions of
the DeclStmt for T.

llvm-svn: 43474
2007-10-29 21:38:03 +00:00
Ted Kremenek
899ef13376 Fixed deadcode bug where check for NULL decl occured within a block
where the decl would always be non-NULL.  Moved the check to after the
block to properly tidy up the iterator's state.

llvm-svn: 43473
2007-10-29 21:23:58 +00:00
Devang Patel
134b3f4b55 Add RecordOrganizer::layoutUnionFields()
llvm-svn: 43472
2007-10-29 20:50:19 +00:00
Ted Kremenek
2f70e71dcc Modified StmtIterator to support iteration over the size expressions
of VariableTypeArray types that appear in DeclStmts.

Removed operator-- from StmtIterator.  operator-- added undesired
complexity, and we have no consumers of it.

llvm-svn: 43471
2007-10-29 20:50:16 +00:00
Dan Gohman
ae95d72a52 Fix a DAGCombiner abort on a bitcast from a scalar to a vector.
llvm-svn: 43470
2007-10-29 20:44:42 +00:00
Ted Kremenek
6d845f0414 Modified CFG pretty-printing to directly use the (reverse) body
iterator of a CompountStmt instead of relying on StmtIterators.

llvm-svn: 43469
2007-10-29 20:41:04 +00:00
Dan Gohman
2aec186dd0 Don't bitcast from pointer-to-vector to pointer-to-array when
lowering load and store instructions.

llvm-svn: 43468
2007-10-29 20:34:35 +00:00
Dan Gohman
3bcd5fe9f1 Use an array instead of a fixed-length std::vector.
llvm-svn: 43467
2007-10-29 20:24:00 +00:00
Dan Gohman
d9911e21df Do a real assert if there is an unhandled vector instruction instead
of just printing to cerr.

llvm-svn: 43466
2007-10-29 20:14:29 +00:00
Evan Cheng
e106e2f142 Enable more fold (sext (load x)) -> (sext (truncate (sextload x)))
transformation. Previously, it's restricted by ensuring the number of load uses
is one. Now the restriction is loosened up by allowing setcc uses to be
"extended" (e.g. setcc x, c, eq -> setcc sext(x), sext(c), eq).

llvm-svn: 43465
2007-10-29 19:58:20 +00:00
Dan Gohman
1961c28d46 Add explicit keywords.
llvm-svn: 43464
2007-10-29 19:52:04 +00:00
Dan Gohman
7414e21ec0 Update a comment to reflect the current code.
llvm-svn: 43463
2007-10-29 19:32:39 +00:00
Dan Gohman
f5feb01056 Remove an unused function argument.
llvm-svn: 43462
2007-10-29 19:31:25 +00:00
Dan Gohman
50d42224d0 Fix a typo in a comment.
llvm-svn: 43461
2007-10-29 19:26:14 +00:00
Dan Gohman
8e8adada83 Avoid calling ValidStride when not all uses are addresses.
llvm-svn: 43460
2007-10-29 19:23:53 +00:00
Ted Kremenek
ef23e34bba Fixed warning concerning implicit conversion from a NULL pointer
constant to an unsigned int.  We now just directly assign the literal 0.

llvm-svn: 43459
2007-10-29 18:43:39 +00:00
Ted Kremenek
a80b257a21 Renamed internal variables of StmtIteratorBase to make the code
slightly more succinct.

Introduced VariableArrayType* within StmtIteratorBase to (soon)
support iteration over the size expressions of variable length arrays.

llvm-svn: 43455
2007-10-29 18:04:38 +00:00
Fariborz Jahanian
bc2759372b Do the encoding of ivar types in the ivar metadata.
llvm-svn: 43454
2007-10-29 17:16:25 +00:00
Ted Kremenek
e2763b0948 Added some comments.
Moved a dependent predicate in an if statement to be an assertion
within the if statement body.

llvm-svn: 43453
2007-10-29 17:13:39 +00:00
Chris Lattner
00860d7574 update testcase
llvm-svn: 43452
2007-10-29 17:06:35 +00:00
Ted Kremenek
5d18ce750a Added to test case for "self-comparison check" uses of relation operators: x < x and x > x
should emit warnings.

llvm-svn: 43451
2007-10-29 17:02:56 +00:00
Ted Kremenek
e451eae8d7 For non-floating point types, added check for expressions of the form
"x == x" and "x != x".  We emit a warning for these since they always evaluate
to a constant value and often indicate a logical error.

Added test case for this check.

llvm-svn: 43450
2007-10-29 16:58:49 +00:00
Devang Patel
d45e055f2c Insetead of assert() just emit an error message for
an unimplemented work  and continue.

llvm-svn: 43449
2007-10-29 16:56:27 +00:00
Ted Kremenek
fa907b8168 For floating point equality check, we now ignore parentheses. e.g.:
(x) == x  is the treated the same as x == x.

llvm-svn: 43448
2007-10-29 16:45:23 +00:00
Ted Kremenek
d4ecc6da67 For checking for floating point comparison using == or !=, we now suppress
errors for cases such as "x == x".

Added test case to test this feature.

llvm-svn: 43447
2007-10-29 16:40:01 +00:00
Evan Cheng
7b3f7feaea Avoid doing something dumb like rewriting using a 64-bit iv in 32-bit mode.
llvm-svn: 43446
2007-10-29 07:57:50 +00:00
Anders Carlsson
18acd44514 Address Chris's comments.
llvm-svn: 43445
2007-10-29 06:33:42 +00:00
Chris Lattner
909a54ccd4 add a note.
llvm-svn: 43444
2007-10-29 06:19:48 +00:00
Anders Carlsson
0f1cacd049 Fix logic error.
llvm-svn: 43443
2007-10-29 05:58:43 +00:00
Chris Lattner
c541c3ee15 Model stacksave and stackrestore as both writing memory, since we
don't model their dependences on allocas correctly.  This fixes
PR1745.

llvm-svn: 43442
2007-10-29 05:47:52 +00:00
Chris Lattner
b104d31bd9 when checking for type equality, ignore typedefs.
llvm-svn: 43441
2007-10-29 05:15:40 +00:00
Chris Lattner
5c5808a9a3 improve error recovery handling broken 'then' or 'else' stmts in
if statements.  This implements Sema/if-empty-body.c:f3, silencing
a bogus secondary warning.  It also improve the location info for
the nullstmts created for recovery purposes.

llvm-svn: 43440
2007-10-29 05:08:52 +00:00
Anders Carlsson
d849982e84 Add (partial) support for @encode.
llvm-svn: 43439
2007-10-29 05:01:08 +00:00
Owen Anderson
3692dbe492 Add a first attempt at dominator information for MBB's. Use with caution: this has been tested to compile. It has not yet been confirmed to generate correct analysis.
llvm-svn: 43438
2007-10-29 04:50:50 +00:00
Chris Lattner
70ae491e42 The callers of ParseStructDeclaration are not expecting it to
eat the terminating ;.  Fix one place where it did, allowing this
to compile without error:

struct x {
 int a;
 union {
  int b;
  float c;
 };

 int d;
};

This reduces diagnostics on PR1750 from 33 to 27.

llvm-svn: 43437
2007-10-29 04:42:53 +00:00
Chris Lattner
3bc4d20862 casting to void is ok for structs (C99 6.5.4p2), this fixes
one bogus error on PR1750.

llvm-svn: 43436
2007-10-29 04:26:44 +00:00
Chris Lattner
cc779571b8 Add prototype info for __builtin_memcpy, reducing #diagnostics from 37 to 34 on
PR1750

llvm-svn: 43435
2007-10-29 04:18:06 +00:00
Chris Lattner
645ff3ff61 Fix a parser bug on labeled inline asm stmts, allowing us
to parse stuff like:

asm volatile("1:  rex64/fxrstor (%[fx])\n\t"
       "2:\n"
       ".section .fixup,\"ax\"\n"
       "3:  movl $-1,%[err]\n"
       "    jmp  2b\n"
       ".previous\n"
       ".section __ex_table,\"a\"\n"
       "   .align 8\n"
       "   .quad  1b,3b\n"
       ".previous"
       : [err] "=r" (err)
       : [fx] "cdaSDb" (fx), "m" (*fx), "0" (0));

This reduces # diagnostics on PR1750 from 49 to 37.

llvm-svn: 43434
2007-10-29 04:06:22 +00:00
Chris Lattner
73c56c0735 Implement *skeletal* support for representing GNU inline asm stmts in the AST,
resolving a crash on a .i file in PR1750.  We now generate 49 errors on the
.i file in that bug.

llvm-svn: 43433
2007-10-29 04:04:16 +00:00
Chris Lattner
1159f065be Fix a major bug in the Type::getAs*Type methods: they didn't strip off
typeof(type) and typeof(expr) correctly.  Now provide a single point of
contact (Type::getDesugaredType) for doing the shallow stripping we need.

llvm-svn: 43432
2007-10-29 03:41:11 +00:00
Chris Lattner
b6fc40e60f I am not sure this is a good idea to be an option, but rename the option for
now.  It conflicts with clang's -pedantic flag.

llvm-svn: 43431
2007-10-29 03:14:55 +00:00
Chris Lattner
5e99fd8c0d Add support for the x86-64 'q' regigster modifier, and add support for the
b/h/w/k/q inline asm memory modifiers, which are just ignored.  This fixes
PR1748 and CodeGen/X86/2007-10-28-inlineasm-q-modifier.ll

llvm-svn: 43430
2007-10-29 03:09:07 +00:00
Anders Carlsson
ceced4ca73 Generate code for __builtin_classify_type.
llvm-svn: 43429
2007-10-29 02:59:40 +00:00
Anders Carlsson
7080597adf Add BuiltinType::Char_S to Type::isCharType
llvm-svn: 43428
2007-10-29 02:52:18 +00:00
Chris Lattner
9a641510bd Fix PR1749 and InstCombine/2007-10-28-EmptyField.ll by handling
zero-length fields better.

llvm-svn: 43427
2007-10-29 02:40:02 +00:00
Chris Lattner
4a15e04aee Fix PR1752 and LoopSimplify/2007-10-28-InvokeCrash.ll: terminators
can have uses too.  Wouldn't it be nice if invoke didn't exist? :)

llvm-svn: 43426
2007-10-29 02:30:37 +00:00
Ted Kremenek
8be9bc64ce Fixed assertion in Deserializer::~Deserializer that checks for
pointers that were not backpatched (previously checked the wrong invariant).

llvm-svn: 43425
2007-10-28 23:38:38 +00:00
Anton Korobeynikov
9dced3f9ae Add 'pedantic' mode to verifier rejecting syntactically valid, but 'bad' due to other reasons code
llvm-svn: 43424
2007-10-28 22:50:32 +00:00
Ted Kremenek
b6fafb6bf0 Implemented serialization for TypedefType.
llvm-svn: 43423
2007-10-28 21:21:04 +00:00
Ted Kremenek
387204749b Updated backpatching logic during object deserialization to perform
eager backpatching instead of waithing until all objects have been
deserialized.  This allows us to reduce the memory footprint needed
for backpatching.

llvm-svn: 43422
2007-10-28 21:17:59 +00:00
Duncan Sands
1826deda68 The guaranteed alignment of ptr+offset is only the minimum of
of offset and the alignment of ptr if these are both powers of
2.  While the ptr alignment is guaranteed to be a power of 2,
there is no reason to think that offset is.  For example, if
offset is 12 (the size of a long double on x86-32 linux) and
the alignment of ptr is 8, then the alignment of ptr+offset
will in general be 4, not 8.  Introduce a function MinAlign,
lifted from gcc, for computing the minimum guaranteed alignment.
I've tried to fix up everywhere under lib/CodeGen/SelectionDAG/.
I also changed some places that weren't wrong (because both values
were a power of 2), as a defensive change against people copying
and pasting the code.
Hopefully someone who cares about alignment will review the rest
of LLVM and fix up the remaining places.  Since I'm on x86 I'm
not very motivated to do this myself...

llvm-svn: 43421
2007-10-28 12:59:45 +00:00
Evan Cheng
c826ac533b New entry.
llvm-svn: 43420
2007-10-28 04:01:09 +00:00
Ted Kremenek
3fd831fd14 Implemented serialization of FunctionTypeProto.
llvm-svn: 43419
2007-10-28 00:59:26 +00:00
Ted Kremenek
d33b4adaed Implemented serialization of FunctionTypeNoProto.
llvm-svn: 43418
2007-10-27 19:58:08 +00:00
Ted Kremenek
3e6c227f97 Implemented serialization for VectorType.
llvm-svn: 43417
2007-10-27 19:05:09 +00:00
Ted Kremenek
8e8bf5d0bf More work on type serialization: added support for serializing BuiltinTypes.
llvm-svn: 43414
2007-10-26 23:52:52 +00:00
Ted Kremenek
9dd1e702fa Fixed bug where default SerializeTrait<>::Materialize would not return the materialized object pointer.
llvm-svn: 43413
2007-10-26 23:44:59 +00:00
Bill Wendling
2305de81a4 Test to make sure that if we have an unaligned memcpy, it will still compile.
llvm-svn: 43412
2007-10-26 23:43:35 +00:00
Fariborz Jahanian
801b63525d Path to synthesize 'instance' size field of _objc_class metadata.
llvm-svn: 43409
2007-10-26 23:09:28 +00:00
Evan Cheng
9dbe99dcd6 A number of LSR fixes:
- ChangeCompareStride only reuse stride that is larger than current stride. It
  will let the general reuse mechanism to try to reuse a smaller stride.
- Watch out for multiplication overflow in ChangeCompareStride.
- Replace std::set with SmallPtrSet.

llvm-svn: 43408
2007-10-26 23:08:19 +00:00
Ted Kremenek
6698b43389 Completed serialization of ConstantArrayTypes (now that APInt serialization is in place).
llvm-svn: 43407
2007-10-26 22:00:08 +00:00
Ted Kremenek
5e7133b090 Added SerializeAPInt.cpp and DeserializeAPInt.cpp to the XCode project.
llvm-svn: 43406
2007-10-26 21:53:37 +00:00
Ted Kremenek
2d95094bea Added serialization support for APInt.
llvm-svn: 43405
2007-10-26 21:50:10 +00:00
Steve Naroff
161a92b976 Start rewriting ObjC interfaces. As a start, we comment out all the methods. This involved refining how the parser/AST passes/manages SourceLocations for ObjcMethodDecl's.
llvm-svn: 43404
2007-10-26 20:53:56 +00:00
Fariborz Jahanian
3339d0d14e This patch allows synthesis generation of ivar offset for legacy objective-c @implementation
decl without an @interface decl.

llvm-svn: 43403
2007-10-26 20:50:24 +00:00
Ted Kremenek
18c1393ddb Fixed incorrect "path name" in preamble (comment) of header file.
llvm-svn: 43402
2007-10-26 20:44:02 +00:00
Ted Kremenek
f8555a23ec Fixed incorrect "path name" in preamble (comment) of header file.
llvm-svn: 43401
2007-10-26 20:42:45 +00:00
Bill Wendling
b0bfd69684 On second thought. Remove this as it should never be generated in the first
place.

llvm-svn: 43400
2007-10-26 20:34:37 +00:00
Bill Wendling
6d15b32c15 - Remove the hacky code that forces a memcpy. Alignment is taken care of in the
FE.
- Explicitly pass in the alignment of the load & store.
- XFAIL 2007-10-23-UnalignedMemcpy.ll because llc has a bug that crashes on
  unaligned pointers.

llvm-svn: 43398
2007-10-26 20:24:42 +00:00
Ted Kremenek
16c7d8ce5b Added skeleton implementation of serialization for types (not complete).
llvm-svn: 43397
2007-10-26 20:24:35 +00:00
Ted Kremenek
fc88b1ddb8 Added default implementation of SerializeTrait<> that dispatches to
calling member functions of the target type to perform type-specific
serialization.
                         
Added version of ReadPtr that allows passing references to uintptr_t
(useful for smart pointers).

llvm-svn: 43396
2007-10-26 20:23:27 +00:00
Fariborz Jahanian
99e96b0f11 Patch to synthesize computation of Ivar offset in rewritten c file.
Thanks to Steve N. to point out using of offsetof for this.

llvm-svn: 43391
2007-10-26 19:46:17 +00:00
Devang Patel
ed93c3c3b3 Codegen union member references.
llvm-svn: 43390
2007-10-26 19:42:18 +00:00
Devang Patel
7718d7a2eb Handle non LValue base expressions.
llvm-svn: 43387
2007-10-26 18:15:21 +00:00
Devang Patel
ffdb07c939 Code gen static initializer.
llvm-svn: 43386
2007-10-26 17:50:58 +00:00
Devang Patel
8717417b3b Codegen array initializers.
llvm-svn: 43385
2007-10-26 17:44:44 +00:00
Evan Cheng
d78a3e5555 Fix a crash. Make sure TLI is not null.
llvm-svn: 43384
2007-10-26 17:24:46 +00:00
Devang Patel
19c2b9a66f Codegen global array initializers.
llvm-svn: 43383
2007-10-26 16:31:40 +00:00
Fariborz Jahanian
22c6a22d76 Pretty printing for ivar list of an interface block.
llvm-svn: 43382
2007-10-26 16:29:12 +00:00
Anton Korobeynikov
d07d6a411c Fix off-by-one stack offset computations (dwarf information) for callee-saved
registers in case, when FP pointer was eliminated. This should fixes misc. random
EH-related crahses, when stuff is compiled with -fomit-frame-pointer.
Thanks Duncan for nailing this bug!

llvm-svn: 43381
2007-10-26 09:13:24 +00:00
Eric Christopher
18063916b5 clo/clz aren't supported on mips I. Keep them around for when we'll
want them later (mips32/64).

llvm-svn: 43380
2007-10-26 04:00:13 +00:00
Owen Anderson
b7971bbdd7 Make a comment better.
llvm-svn: 43379
2007-10-26 03:47:14 +00:00
Gordon Henriksen
78c63ac41e More fleshing out of docs/Passes.html, plus some typo fixes and
improved wording in source files.

llvm-svn: 43377
2007-10-26 03:03:51 +00:00
Evan Cheng
7f3d02471d Loosen up iv reuse to allow reuse of the same stride but a larger type when truncating from the larger type to smaller type is free.
e.g.
Turns this loop:
LBB1_1: # entry.bb_crit_edge
        xorl    %ecx, %ecx
        xorw    %dx, %dx
        movw    %dx, %si
LBB1_2: # bb
        movl    L_X$non_lazy_ptr, %edi
        movw    %si, (%edi)
        movl    L_Y$non_lazy_ptr, %edi
        movw    %dx, (%edi)
		addw    $4, %dx
		incw    %si
		incl    %ecx
		cmpl    %eax, %ecx
		jne     LBB1_2  # bb
	
into

LBB1_1: # entry.bb_crit_edge
        xorl    %ecx, %ecx
        xorw    %dx, %dx
LBB1_2: # bb
        movl    L_X$non_lazy_ptr, %esi
        movw    %cx, (%esi)
        movl    L_Y$non_lazy_ptr, %esi
        movw    %dx, (%esi)
        addw    $4, %dx
		incl    %ecx
        cmpl    %eax, %ecx
        jne     LBB1_2  # bb

llvm-svn: 43375
2007-10-26 01:56:11 +00:00
Hartmut Kaiser
1207cd6b1b Silenced a VC++ warning.
llvm-svn: 43374
2007-10-25 23:49:14 +00:00
Ted Kremenek
542e5f29b7 Updated backpatching during object deserialization to support "smart"
pointers that employ unused bits in a pointer to store extra data.

llvm-svn: 43373
2007-10-25 23:40:35 +00:00
Hartmut Kaiser
fc69d322f2 Clarified operator precedence.
Silenced VC++ warning.

llvm-svn: 43372
2007-10-25 23:15:31 +00:00
Hartmut Kaiser
d57aca25fc Disambiguated variable name to comply with VC++'s archaic variable scoping rules.
llvm-svn: 43371
2007-10-25 22:59:17 +00:00
Hartmut Kaiser
414d7e373e Updated VC++ build system
llvm-svn: 43370
2007-10-25 22:58:31 +00:00
Hartmut Kaiser
7e16ce5270 Disambiguated variable name to comply with VC++'s archaic variable scoping rules.
llvm-svn: 43369
2007-10-25 22:57:48 +00:00
Hartmut Kaiser
3a0cda1cf7 Updated VC++ build system
llvm-svn: 43368
2007-10-25 22:56:13 +00:00
Evan Cheng
29e29e63bd Do not rewrite compare instruction using iv of a different stride if the new
stride may be rewritten using the stride of the compare instruction.

llvm-svn: 43367
2007-10-25 22:45:20 +00:00
Ted Kremenek
066f60321d Modified StmtIterator to now include visiting the initialization expression for EnumConstantDecls.
llvm-svn: 43366
2007-10-25 22:24:19 +00:00
Devang Patel
b989c9e65c Fix "strbuf += stufflen;" crash.
llvm-svn: 43365
2007-10-25 22:19:13 +00:00
Dale Johannesen
65e804a9c3 Support non-POSIX hosts by removing use of strncasecmp.
llvm-svn: 43364
2007-10-25 21:54:43 +00:00
Devang Patel
5ea6d7f1be Document ConvertNewType() method and make it a private method.
llvm-svn: 43363
2007-10-25 21:40:12 +00:00
Ted Kremenek
5749aaedd9 Added DeclSerialization.cpp to XCode project.
llvm-svn: 43362
2007-10-25 21:39:10 +00:00
Ted Kremenek
1f1e756483 Added skeleton for Decl serialization.
llvm-svn: 43361
2007-10-25 21:37:16 +00:00
Fariborz Jahanian
51f2182338 Refactored several meta data for reusability.
Changed the entire rewrite of metadata to write to std::string
object instead of stdout.

llvm-svn: 43360
2007-10-25 20:55:25 +00:00
Bill Wendling
f73340efb9 Changed XXX to FIXME, and added comment to the README file
llvm-svn: 43359
2007-10-25 19:49:32 +00:00
Ted Kremenek
a83e6bc246 Added special treatment of serializing NULL pointers.
llvm-svn: 43357
2007-10-25 18:42:52 +00:00
Evan Cheng
5a38108374 Remove code that's commented out.
llvm-svn: 43356
2007-10-25 18:38:24 +00:00
Devang Patel
29e3824453 Cache llvm::Type through PATypeHolder.
llvm-svn: 43355
2007-10-25 18:32:36 +00:00
Ted Kremenek
222211a425 changed #include of Serialization.h to SerializationFwd.h to reduce
compilation time.

llvm-svn: 43354
2007-10-25 18:27:10 +00:00
Bill Wendling
5f7ed00d44 Added comment explaining why we are doing this check.
llvm-svn: 43353
2007-10-25 18:23:45 +00:00
Ted Kremenek
0cf94e9c91 Created header file to include minimal forward references needed for
object serialization.

llvm-svn: 43352
2007-10-25 18:19:29 +00:00
Chris Lattner
991b6b9d0c typo
llvm-svn: 43351
2007-10-25 18:05:29 +00:00
Chris Lattner
76a2273f6e some minor edits, link to Passes.html, make one point
I forgot about yesterday.

llvm-svn: 43350
2007-10-25 17:52:39 +00:00
Chris Lattner
36f81fb065 Fix a recovery bug Fariborz and I noticed yesterday. We were producing:
method.c:4:3: error: use of undeclared identifier 'BADIDENT'
        &BADIDENT, 0
         ^
method.c:5:2: error: expected '}'
};
 ^
method.c:3:14: error: to match this '{'
struct S A = {
             ^

now we only produce:

method.c:4:3: error: use of undeclared identifier 'BADIDENT'
        &BADIDENT, 0
         ^

llvm-svn: 43349
2007-10-25 17:27:01 +00:00
Chris Lattner
88710ff5b8 simplify change.
llvm-svn: 43348
2007-10-25 17:18:59 +00:00
Chris Lattner
94a41ff6c1 Fix a bug steve noticed when handling nested rewrites. We now turn this:
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

into:

    NSAutoreleasePool * pool = objc_msgSend(objc_msgSend(objc_getClass("NSAutoreleasePool"), sel_getUid("alloc")), sel_getUid("init"));

instead of:

    NSAutoreleasePool * pool = objc_msgSend(objc_msgSend(objc_getClass("NSAutoreleasePool"), sel_getUid("alloc")), sel_getUid("init"))utoreleasePool"), sel_getUid("alloc")) init];

llvm-svn: 43347
2007-10-25 17:17:34 +00:00
Chris Lattner
211f8b8352 Convert one type of metadata to use std::string instead of
printf as an example.

llvm-svn: 43346
2007-10-25 17:07:24 +00:00
Ted Kremenek
93345274c2 Added Serialization.h, Serialize.h, Deserialize.h, Serialize.cpp, and
Deserialize.cpp to the XCode project.

llvm-svn: 43345
2007-10-25 16:09:09 +00:00
Ted Kremenek
bd8497b011 Added SourceLocation.cpp to XCode project.
llvm-svn: 43344
2007-10-25 16:03:53 +00:00
Ted Kremenek
4edcb4d676 Implemented serialization of SourceLocation and SourceRange objects.
llvm-svn: 43343
2007-10-25 16:02:43 +00:00
Ted Kremenek
6e64c3f8ec Added constness to accessors in CompoundStmt.
llvm-svn: 43342
2007-10-25 15:39:09 +00:00
Duncan Sands
d385f0759c Small formatting changes. Add a sanity check.
Use NVT rather than looking it up, since we have
it to hand.

llvm-svn: 43341
2007-10-25 12:35:51 +00:00
Duncan Sands
a8f4ba6eb9 Promote SETCC operands.
llvm-svn: 43340
2007-10-25 12:32:31 +00:00
Duncan Sands
cf0da03312 Correctly extract the ValueType from a VTSDNode.
llvm-svn: 43339
2007-10-25 12:30:51 +00:00
Duncan Sands
7e6e33beab Fix comment typos.
llvm-svn: 43338
2007-10-25 12:28:12 +00:00
Gordon Henriksen
77d27523b1 Fleshing out docs/Passes.html for some analyses.
llvm-svn: 43337
2007-10-25 10:18:27 +00:00
Evan Cheng
133694db06 If a loop termination compare instruction is the only use of its stride,
and the compaison is against a constant value, try eliminate the stride
by moving the compare instruction to another stride and change its
constant operand accordingly. e.g.

loop:
...
v1 = v1 + 3
v2 = v2 + 1
if (v2 < 10) goto loop
=>
loop:
...
v1 = v1 + 3
if (v1 < 30) goto loop

llvm-svn: 43336
2007-10-25 09:11:16 +00:00
Gordon Henriksen
ac72db5dbe Passes.html now 'passes' validation.
llvm-svn: 43335
2007-10-25 08:58:56 +00:00
Gordon Henriksen
50768f89d9 Bringing Passes.html structurally up-to-date, and enabling
semi-automated maintenance.

llvm-svn: 43334
2007-10-25 08:46:12 +00:00
Owen Anderson
4cee0451f0 Fix an obvious typo.
llvm-svn: 43333
2007-10-25 06:50:30 +00:00
Owen Anderson
4c209da848 More tutorial cleanups.
llvm-svn: 43332
2007-10-25 06:49:29 +00:00
Owen Anderson
af8059c1a7 Add proper footers.
llvm-svn: 43331
2007-10-25 06:45:01 +00:00
Owen Anderson
a24e5d6996 Don't bother providing code samples. Maintaining zip files in the repository is a pain.
llvm-svn: 43330
2007-10-25 06:41:23 +00:00
Chris Lattner
8b59eafb89 Add chapter 4, feedback appreciated.
llvm-svn: 43329
2007-10-25 06:23:36 +00:00
Chris Lattner
f98427142c remove unimplemented ctor, add some comments.
llvm-svn: 43328
2007-10-25 05:19:24 +00:00
Chris Lattner
46b4281b6a Run the verifier on generated code.
llvm-svn: 43327
2007-10-25 04:30:35 +00:00
Owen Anderson
7827a3f366 Fix for PR1741.
llvm-svn: 43326
2007-10-25 02:36:18 +00:00
Dale Johannesen
ea839ef1f0 Testcase for PR 1397.
llvm-svn: 43323
2007-10-25 00:50:14 +00:00
Chris Lattner
35e564ed09 Add a new ChooseExpr::isConditionTrue method to unify
some code.

llvm-svn: 43322
2007-10-25 00:29:32 +00:00
Owen Anderson
00974dce68 Make it possible for DomTreeBase to be constructed from MachineFunction's as well as just Function's.
llvm-svn: 43321
2007-10-25 00:16:57 +00:00
Fariborz Jahanian
3df412a6ea Refactored RewriteObjcMethodsMetaData to better rewrite
instance/class methods metadata.

llvm-svn: 43320
2007-10-25 00:14:44 +00:00
Ted Kremenek
d5cb7b055d Implemented prototype serialization of pointers, including support
for backpatching.

Added Deserialize::ReadVal.

llvm-svn: 43319
2007-10-25 00:10:21 +00:00
Ted Kremenek
ed763de6cb Added accessors to CompoundStmt to retrieve the source locations for the
left and right bracket.  This is useful for serialization.

llvm-svn: 43318
2007-10-25 00:08:50 +00:00
Devang Patel
e85285b9f3 Remove unused #includes
llvm-svn: 43317
2007-10-24 23:42:18 +00:00
Steve Naroff
574440fa58 More work on translating message expressions.
Still to do:

- Chris will fix a bug in the rewriting engine for nested stmts. For example, the following:

    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; 

tranlates to:

    NSAutoreleasePool * pool = objc_msgSend(objc_msgSend(objc_getClass("NSAutoreleasePool"), sel_getUid("alloc")), sel_getUid("init"))utoreleasePool"), sel_getUid("alloc")) init];

...which is correct, except there is garbage after sel_getUid("init"). This is because the rewriter isn't updating the extent of the containing message expression. 

- Do the crazy cast thang.

llvm-svn: 43316
2007-10-24 22:48:43 +00:00
Devang Patel
d68df20620 Handle
foo()->a = 42;

llvm-svn: 43315
2007-10-24 22:26:28 +00:00
Dale Johannesen
a4a972e32d Another expansion for i64 multiply, suitable for PPC.
llvm-svn: 43314
2007-10-24 22:26:08 +00:00
Fariborz Jahanian
aa29fb4be8 Remove explicit use of size of known structs in metadata generation.
llvm-svn: 43313
2007-10-24 21:25:12 +00:00
Dale Johannesen
52bbe1b171 This was failing on Darwin, which defaults to PIC;
no lea was generated.  I think this follows the intent.

llvm-svn: 43312
2007-10-24 20:58:14 +00:00
Fariborz Jahanian
486f718f14 Couple of minor changes. 1) Metaclass metadata also has a reference to
protocol meta-data (unlike what documentation says). 2) Include objc.h so,
we can compile the generated metadata with both gcc and clang.

llvm-svn: 43311
2007-10-24 20:54:23 +00:00
Devang Patel
bc50aab635 Move RecordOrganizer into CodeGenTypes.cpp
llvm-svn: 43310
2007-10-24 20:38:06 +00:00
Dale Johannesen
4d06391c47 Fix off by 1 bug in printf->puts lowering.
llvm-svn: 43309
2007-10-24 20:14:50 +00:00
Fariborz Jahanian
b2f525dabc Refactord instance and class metadata emission. Refactored protocols metadata emission.
Implemented emission of category metadata,

llvm-svn: 43308
2007-10-24 19:23:36 +00:00
Ted Kremenek
83610ae6f4 Split Serialization.h into separate headers: Serialize.h and
Deserialize.h Serialization.h now includes trait speciailizations for
unsigned long, etc.

llvm-svn: 43307
2007-10-24 19:06:40 +00:00
Ted Kremenek
37a3275919 Modified current clients of Bitcode-Object serialization to use the
new split-header file configuration (Serialize.h and Deserialize.h)
now in place in the core LLVM repository.

Removed unneeded SerializeTrait specializations for enums in
TokenKinds.h

llvm-svn: 43306
2007-10-24 19:06:02 +00:00
Chris Lattner
55b8302dfe simplify some code by using the new isNaN predicate
llvm-svn: 43305
2007-10-24 18:54:45 +00:00
Chris Lattner
b6ed689722 add a nice predicate to check to see if nan
llvm-svn: 43304
2007-10-24 18:54:28 +00:00
Devang Patel
b67e596d86 Handle non-constant initializers.
llvm-svn: 43301
2007-10-24 18:05:48 +00:00
Devang Patel
43fc86d0f2 Visit CompoundLiteralExpr and InitListExpr
llvm-svn: 43300
2007-10-24 17:18:43 +00:00
Chris Lattner
3c799d7e9a Fix some long lines, move code around into logical groups.
llvm-svn: 43299
2007-10-24 17:06:59 +00:00
Chris Lattner
6953469880 Use Ted's new mutable child iterators to update the tree as we rewrite it.
This will make nested subexprs work.

llvm-svn: 43296
2007-10-24 16:57:36 +00:00
Ted Kremenek
38f87dd9d0 Modified operator* for StmtIterator to return Stmt*& instead of Stmt*.
This permits in-place replacement of the original AST statements.

llvm-svn: 43295
2007-10-24 16:52:34 +00:00
Owen Anderson
544f860f59 Update Makefile to use simpler llvm-config parameters.
llvm-svn: 43292
2007-10-24 16:06:42 +00:00
Owen Anderson
4c9dbd1e9f Update Makefile to use simpler llvm-config parameters.
llvm-svn: 43291
2007-10-24 16:04:08 +00:00
Chris Lattner
0083d8f38d switch some calls to SelectionDAG::getTargetNode to use
the one that takes an operand list instead of explicit
operands.  There is one left though, the more interesting
one :)

llvm-svn: 43290
2007-10-24 06:25:09 +00:00
Chris Lattner
c62877e9da Implement a couple of foldings for ordered and unordered comparisons,
implementing cases related to PR1738.

llvm-svn: 43289
2007-10-24 05:38:08 +00:00
Chris Lattner
9a760ebf32 further simplify run options, thanks to gordonh for pointing this out
llvm-svn: 43288
2007-10-24 05:09:48 +00:00
Chris Lattner
1fb0d5df69 Fix instructions now that PR1739 is fixed.
llvm-svn: 43287
2007-10-24 04:37:23 +00:00
Chris Lattner
4c9ec1aaa2 Fix PR1739.
llvm-svn: 43286
2007-10-24 04:35:54 +00:00
Steve Naroff
c77380b46f Incorporate some feedback from Chris...
llvm-svn: 43285
2007-10-24 01:09:48 +00:00
Devang Patel
ea37aa7d64 Constify methods and reuse RecordOrganizer object.
llvm-svn: 43284
2007-10-24 00:56:23 +00:00
Devang Patel
790afb0444 check base type.
llvm-svn: 43283
2007-10-24 00:54:17 +00:00
Devang Patel
f2423473b1 Add notes.
llvm-svn: 43282
2007-10-24 00:32:16 +00:00
Devang Patel
e531ae687a Use isUnionType() predicate.
llvm-svn: 43281
2007-10-24 00:28:49 +00:00
Devang Patel
c4e224e59c untabify
llvm-svn: 43280
2007-10-24 00:26:24 +00:00
Hartmut Kaiser
1759e27951 Added VC++ solution file allowing to build clang.
llvm-svn: 43279
2007-10-24 00:13:40 +00:00
Hartmut Kaiser
5277af121a Fixed a strange construct, please review.
llvm-svn: 43278
2007-10-24 00:07:36 +00:00
Hartmut Kaiser
d37ea4f6ed Silenced a VC++ warning.
llvm-svn: 43277
2007-10-24 00:06:59 +00:00
Hartmut Kaiser
36309e56eb Silenced a VC++ warning.
llvm-svn: 43276
2007-10-24 00:06:31 +00:00
Hartmut Kaiser
f8b2612b0c Updated VC++ build system
llvm-svn: 43275
2007-10-23 23:57:01 +00:00
Steve Naroff
db1ab1c2b0 Add some plumbing to rewrite message expressions (still under construction).
llvm-svn: 43274
2007-10-23 23:50:29 +00:00
Bill Wendling
38ccabcae9 Fix comment and use the "Size" variable that's already provided.
llvm-svn: 43271
2007-10-23 23:36:57 +00:00
Bill Wendling
e3b859298a If there's an unaligned memcpy to/from the stack, don't lower it. Just call the
memcpy library function instead.

llvm-svn: 43270
2007-10-23 23:32:40 +00:00
Devang Patel
61eaea88f8 Fix typo.
llvm-svn: 43269
2007-10-23 23:29:51 +00:00
Devang Patel
65c4afb940 Handle nested structs.
typdef struct A { int i; struct A *next; } A

llvm-svn: 43268
2007-10-23 23:26:46 +00:00
Dale Johannesen
10f4152471 Disable a couple more things for ppcf128.
llvm-svn: 43267
2007-10-23 23:20:14 +00:00
Ted Kremenek
f25f4a3de0 Implemented serialization for IdentifierInfo and IdentifierTable.
Updated serialization test code in the driver to test serialization of
these types.

llvm-svn: 43266
2007-10-23 22:18:37 +00:00
Ted Kremenek
97e3be7995 Added "ReadEnum" and "WriteEnum" to serialization classes.
llvm-svn: 43265
2007-10-23 22:17:03 +00:00
Bill Wendling
6f149c0571 This broke lots. Reverting.
llvm-svn: 43264
2007-10-23 22:04:26 +00:00
Owen Anderson
39b52ee00b Make DomTreeBase not a FunctionPass.
llvm-svn: 43263
2007-10-23 21:42:49 +00:00
Bill Wendling
8971440e56 Lowering a memcpy to the stack is killing PPC. The ARM and X86 backends already
have their own custom memcpy lowering code. This code needs to be factored out
into a target-independent lowering method with hooks to the backend. In the
meantime, just call memcpy if we're trying to copy onto a stack.

llvm-svn: 43262
2007-10-23 21:30:25 +00:00
Ted Kremenek
bd3501887f Added preliminary implementation of generic object serialization to bitcode.
llvm-svn: 43261
2007-10-23 21:29:33 +00:00
Owen Anderson
4ca0ca7e64 Unbreak the build. Forgot to commit this file.
llvm-svn: 43260
2007-10-23 21:04:37 +00:00
Owen Anderson
9c614117da Make DomTree and PostDomTree thin wrappers around DomTreeBase, rather than inheriting from it.
llvm-svn: 43259
2007-10-23 20:58:37 +00:00
Devang Patel
30efa2eec9 Handle simple struct member expr.
llvm-svn: 43258
2007-10-23 20:28:39 +00:00
Steve Naroff
e670dbb9e6 - Add rewrite rule for @class.
- Add setter/getter to ObjcClassDecl.
- Predefined key runtime functions.

llvm-svn: 43257
2007-10-23 20:20:08 +00:00
Evan Cheng
5d7032bb08 It's possible to commute instrctions with more than 3 operands.
llvm-svn: 43256
2007-10-23 20:14:40 +00:00
Fariborz Jahanian
f3d5a54722 Patch to complete metadata generation for each implemented class.
llvm-svn: 43255
2007-10-23 18:53:48 +00:00
Chris Lattner
07ae732cc4 new testcase
llvm-svn: 43252
2007-10-23 18:07:23 +00:00
Chris Lattner
788f0d340a llvm/test programs should not be execution programs. This
will hopefully fix Gabor's Sparc problem.

llvm-svn: 43251
2007-10-23 17:56:04 +00:00
Evan Cheng
847d42a85c isSubRegOf() is a dup of isSubRegister.
llvm-svn: 43249
2007-10-23 06:51:50 +00:00
Evan Cheng
ec271b104c Temporary solution: added a different set of BCTRL_Macho / BCTRL_ELF with right callee-saved defs set for ppc64.
llvm-svn: 43248
2007-10-23 06:42:42 +00:00
Chris Lattner
c3def1530a Fix validation problems, which were somewhat ironically in the "valid html" button code :)
llvm-svn: 43247
2007-10-23 06:30:50 +00:00
Chris Lattner
e9b16ec28a add a skeleton for part 4
llvm-svn: 43246
2007-10-23 06:27:55 +00:00
Chris Lattner
a02ab559a1 complete the codegen chapter
llvm-svn: 43245
2007-10-23 06:23:57 +00:00
Owen Anderson
b5d8904909 Now with valid HTML 4.01!
llvm-svn: 43244
2007-10-23 06:22:21 +00:00
Owen Anderson
3ee597e34a Add a link to the "writing an optimization" tutorial.
llvm-svn: 43243
2007-10-23 06:17:39 +00:00
Owen Anderson
c4bb8c75ca Add downloadable code sample for tutorial 2.
llvm-svn: 43242
2007-10-23 06:05:37 +00:00
Owen Anderson
299be453b5 Add the second of the "basic topics" tutorials.
llvm-svn: 43241
2007-10-23 06:03:24 +00:00
Owen Anderson
9e87698ec1 Reorder the optimization and bitcode tutorials.
llvm-svn: 43240
2007-10-23 06:02:14 +00:00
Chris Lattner
61353b41df Fix up a broken #include, move code to its own section, add conclusions.
llvm-svn: 43239
2007-10-23 05:43:01 +00:00
Chris Lattner
93b76e0c60 Finish up expr codegen.
llvm-svn: 43238
2007-10-23 04:51:30 +00:00
Chris Lattner
61b4ec70aa several improvements suggested by Dan, thanks!
llvm-svn: 43237
2007-10-23 04:27:44 +00:00
Devang Patel
3e11ccea96 Begin struct layout work.
llvm-svn: 43236
2007-10-23 02:10:49 +00:00
Fariborz Jahanian
d752eae488 Patch for initialization of class's Meta-class metadata.
llvm-svn: 43235
2007-10-23 00:02:02 +00:00
Evan Cheng
1f2dd35898 Fix memcpy lowering when addresses are 4-byte aligned but size is not multiple of 4.
llvm-svn: 43234
2007-10-22 22:11:27 +00:00
Fariborz Jahanian
6eafb030f0 This patch generates protocol metadata and all its sub-metadata.
llvm-svn: 43233
2007-10-22 21:41:37 +00:00
Dan Gohman
d09f1c40a2 The #include <iterator> isn't needed in this header.
llvm-svn: 43232
2007-10-22 20:44:10 +00:00
Dan Gohman
e0c3d9f338 Strength reduction improvements.
- Avoid attempting stride-reuse in the case that there are users that
   aren't addresses. In that case, there will be places where the
   multiplications won't be folded away, so it's better to try to
   strength-reduce them.

 - Several SSE intrinsics have operands that strength-reduction can
   treat as addresses. The previous item makes this more visible, as
   any non-address use of an IV can inhibit stride-reuse.

 - Make ValidStride aware of whether there's likely to be a base
   register in the address computation. This prevents it from thinking
   that things like stride 9 are valid on x86 when the base register is
   already occupied.

Also, XFAIL the 2007-08-10-LEA16Use32.ll test; the new logic to avoid
stride-reuse elimintes the LEA in the loop, so the test is no longer
testing what it was intended to test.

llvm-svn: 43231
2007-10-22 20:40:42 +00:00
Dan Gohman
bf474959a3 Fix the folding of multiplication into addresses on x86, which was broken
by the recent {U,S}MUL_LOHI changes.

llvm-svn: 43230
2007-10-22 20:22:24 +00:00
Evan Cheng
bdbed66333 Use ptr type in the immediate field of a BxA instruction so we don't end up selecting 32-bit call instruction for ppc64.
llvm-svn: 43228
2007-10-22 19:46:19 +00:00
Evan Cheng
5163a8f53e Add missing paratheses.
llvm-svn: 43227
2007-10-22 19:42:28 +00:00
Chris Lattner
fee916334a add a 'don't use me' marker.
llvm-svn: 43226
2007-10-22 19:41:46 +00:00
Duncan Sands
941db4da0a Support for expanding extending loads of integers with
funky bit-widths.

llvm-svn: 43225
2007-10-22 19:00:05 +00:00
Dan Gohman
a37eaf2bf9 Move the SCEV object factors from being static members of the individual
SCEV subclasses to being non-static member functions of the ScalarEvolution
class.

llvm-svn: 43224
2007-10-22 18:31:58 +00:00
Duncan Sands
8fc995069b Fix up the logic for result expanding the various extension
operations so they work right for integers with funky
bit-widths.  For example, consider extending i48 to i64
on a 32 bit machine.  The i64 result is expanded to 2 x i32.
We know that the i48 operand will be promoted to i64, then
also expanded to 2 x i32.  If we had the expanded promoted
operand to hand, then expanding the result would be trivial.
Unfortunately at this stage we can only get hold of the
promoted operand.  So instead we kind of hand-expand, doing
explicit shifting and truncating to get the top and bottom
halves of the i64 operand into 2 x i32, which are then used
to expand the result.  This is harmless, because when the
promoted operand is finally expanded all this bit fiddling
turns into trivial operations which are eliminated either
by the expansion code itself or the DAG combiner.

llvm-svn: 43223
2007-10-22 18:26:21 +00:00
Chris Lattner
ce2c3a456f fit in 80 cols :)
llvm-svn: 43222
2007-10-22 16:44:31 +00:00
Chris Lattner
560762d118 start of chapter 3
llvm-svn: 43221
2007-10-22 07:01:42 +00:00
Owen Anderson
c2b2fc0a26 Fix a few typos I noticed.
llvm-svn: 43220
2007-10-22 06:48:28 +00:00
Owen Anderson
3295cfde98 Add downloadable code samples.
llvm-svn: 43219
2007-10-22 06:35:07 +00:00
Chris Lattner
3a48708c91 Check in part 2: parser and ast.
llvm-svn: 43218
2007-10-22 06:34:15 +00:00
Owen Anderson
bbed04336c Fix some code to make it actually work.
llvm-svn: 43217
2007-10-22 06:29:31 +00:00
Bill Wendling
8830ffed4c Put correct link in example
llvm-svn: 43216
2007-10-22 05:10:05 +00:00
Chris Lattner
5e0f459da6 add part 1, review appreciated.
llvm-svn: 43215
2007-10-22 04:32:37 +00:00
Chris Lattner
5e63999d71 add an outline for "part 2".
llvm-svn: 43214
2007-10-22 03:19:07 +00:00
Chris Lattner
c14c8cd1a7 rename tutorial 1 -> JITTutorial1, make unimplemented links not be dead links.
llvm-svn: 43213
2007-10-22 03:12:24 +00:00
Evan Cheng
c92446af1f Fix an unfolding bug.
llvm-svn: 43212
2007-10-22 03:03:20 +00:00
Evan Cheng
8557603781 - Only perform the unfolding optimization when the folding in question is modref.
- Remove a bogus assertion.

llvm-svn: 43211
2007-10-22 03:01:44 +00:00
Chris Lattner
fd6f3257b8 add a mechanism for the JIT to invoke a function to lazily create functions as they are referenced.
llvm-svn: 43210
2007-10-22 02:50:12 +00:00
Chris Lattner
bf5e958ba0 llvm-gcc3 is dead, along with it __main.
llvm-svn: 43209
2007-10-22 02:39:47 +00:00
Anton Korobeynikov
7499a3b092 Reg2Mem cleanup and optimizations:
- enable phi instructions demotion to stack
 - create alloca instructions in the entry block

llvm-svn: 43208
2007-10-21 23:05:16 +00:00
Chris Lattner
edaf0b4651 LoadLibraryPermanently doesn't throw.
llvm-svn: 43207
2007-10-21 22:58:11 +00:00
Chris Lattner
b5163bb9f0 Add a convenience method for creating EE's.
llvm-svn: 43206
2007-10-21 22:57:11 +00:00
Dale Johannesen
8ee70112ea Allow for copysign having f80 second argument.
Fixes 5550319.

llvm-svn: 43205
2007-10-21 01:07:44 +00:00
Chris Lattner
36f06c80e6 Add promote operand support for [su]int_to_fp.
llvm-svn: 43204
2007-10-20 22:57:56 +00:00
Owen Anderson
18be874e67 Some improvements based on feedback from Anders.
llvm-svn: 43203
2007-10-20 06:12:33 +00:00
Owen Anderson
9f2be01f86 Fix some weird indenting in code.
llvm-svn: 43202
2007-10-20 05:41:39 +00:00
Owen Anderson
f747ab10fb Use getOrInsertFunction() in tutorial 1. This makes for shorter, simpler, and better example code.
llvm-svn: 43201
2007-10-20 05:40:47 +00:00
Owen Anderson
b207ff2c18 Add the beginnings of an LLVM tutorial. If anyone has suggestions, comments,
or would like to contribute, let me know!

llvm-svn: 43200
2007-10-20 05:23:06 +00:00
Chris Lattner
2ba4b148f3 Add result promotion of FP_TO_*INT, fixing CodeGen/X86/trunc-to-bool.ll
with the new legalizer.

llvm-svn: 43199
2007-10-20 04:32:38 +00:00
Chris Lattner
1c87f0c620 simplify some code.
llvm-svn: 43198
2007-10-20 04:09:48 +00:00
Chris Lattner
2bcac640b7 Implement promote and expand for operands of memcpy and friends.
This fixes CodeGen/X86/mem*.ll.

llvm-svn: 43197
2007-10-20 04:07:07 +00:00
Evan Cheng
f12967124c Added missing curly braces which renders the if clause useless in debug build.
llvm-svn: 43196
2007-10-20 04:01:47 +00:00
Dale Johannesen
771188cf60 Fix a few places vector operations were not getting
the operand's type from the right place.

llvm-svn: 43195
2007-10-20 00:07:52 +00:00
Evan Cheng
45e096c77e Resolve unfold tables ambiguity.
llvm-svn: 43194
2007-10-19 23:50:58 +00:00
Evan Cheng
f52a6fc50c New test case.
llvm-svn: 43193
2007-10-19 22:05:00 +00:00
Evan Cheng
35ff79370b Local spiller optimization:
Turn a store folding instruction into a load folding instruction. e.g.
     xorl  %edi, %eax
     movl  %eax, -32(%ebp)
     movl  -36(%ebp), %eax
     orl   %eax, -32(%ebp)
=>
     xorl  %edi, %eax
     orl   -36(%ebp), %eax
     mov   %eax, -32(%ebp)
This enables the unfolding optimization for a subsequent instruction which will
also eliminate the newly introduced store instruction.

llvm-svn: 43192
2007-10-19 21:23:22 +00:00
Bill Wendling
ac5c93040f Don't branch fold inline asm statements.
llvm-svn: 43191
2007-10-19 21:09:55 +00:00
Duncan Sands
a87c9e4b75 Add support for a few more nodes.
llvm-svn: 43190
2007-10-19 20:29:48 +00:00
Dale Johannesen
6802d0c96f Redo "last ppc long double fix" as Chris wants.
llvm-svn: 43189
2007-10-19 20:29:00 +00:00
Chris Lattner
8beb9dee0e Fix a crash on test/Sema/invalid-decl.c
llvm-svn: 43188
2007-10-19 20:10:30 +00:00
Bill Wendling
b5bc897864 Removed "-arch i386" by popular demand...
llvm-svn: 43186
2007-10-19 18:49:16 +00:00
Bill Wendling
5f1a253a3f Now with RUN line!
llvm-svn: 43185
2007-10-19 18:40:53 +00:00
Bill Wendling
89151b1f0a Remove the Foundation.h file because not everyone has that.
llvm-svn: 43184
2007-10-19 18:36:04 +00:00
Devang Patel
c0ced49a14 This test now passes.
llvm-svn: 43183
2007-10-19 17:11:01 +00:00
Anton Korobeynikov
f93fa13de7 Update this file for 2.0 syntax. Contributed by Jan Rehders
llvm-svn: 43182
2007-10-19 16:54:13 +00:00
Chris Lattner
064c31ebac Fix a really nasty vector miscompilation bill recently introduced.
llvm-svn: 43181
2007-10-19 16:47:35 +00:00
Hartmut Kaiser
321be0cd86 Updated VC++ build system
llvm-svn: 43180
2007-10-19 15:51:20 +00:00
Hartmut Kaiser
b5371d22eb Silenced a VC++ warning.
llvm-svn: 43179
2007-10-19 15:50:35 +00:00
Gabor Greif
24032f1ac2 add NL at end of file
llvm-svn: 43178
2007-10-19 15:38:32 +00:00
Chris Lattner
3ea519e56d rename ExpandOperation to ExpandOperationResult, as suggested
by Duncan

llvm-svn: 43177
2007-10-19 15:28:47 +00:00
Rafael Espindola
18a831d783 split LowerMEMCPY into LowerMEMCPYCall and LowerMEMCPYInline in the ARM backend.
llvm-svn: 43176
2007-10-19 14:35:17 +00:00
Duncan Sands
a9953e4d0a Support for expanding ADDE and SUBE.
llvm-svn: 43175
2007-10-19 13:06:17 +00:00
Duncan Sands
d9834b29dd If the value types are equal then this routine
asserts in later checks rather than producing
the ordinary load it is supposed to.  Avoid all
such hassles by directly returning an ordinary
load in this case.

llvm-svn: 43174
2007-10-19 13:05:40 +00:00
Rafael Espindola
813a0b1d29 Test byval with a 8 bit aligned struct
llvm-svn: 43173
2007-10-19 11:29:21 +00:00
Rafael Espindola
846c19dd70 Add support for byval function whose argument is not 32 bit aligned.
To do this it is necessary to add a "always inline" argument to the
memcpy node. For completeness I have also added this node to memmove
and memset.  I have also added getMem* functions, because the extra
argument makes it cumbersome to use getNode and because I get confused
by it :-)

llvm-svn: 43172
2007-10-19 10:41:11 +00:00
Chris Lattner
e5a6448533 Implement a few new operations.
llvm-svn: 43171
2007-10-19 04:46:45 +00:00
Chris Lattner
e31365eecc Implement expansion of SINT_TO_FP and UINT_TO_FP operands.
llvm-svn: 43170
2007-10-19 04:32:47 +00:00
Chris Lattner
9081d08083 implement support for custom expansion of any node type, in one place.
llvm-svn: 43169
2007-10-19 04:14:36 +00:00
Chris Lattner
b193576bc6 comment fixes
llvm-svn: 43168
2007-10-19 04:08:28 +00:00
Chris Lattner
d01b8ea4a5 Make use of TLI.ExpandOperation, remove softfloat stuff.
llvm-svn: 43167
2007-10-19 03:58:25 +00:00
Chris Lattner
3c7ee41c78 add expand support for bit_convert result, even allowing custom expansion.
llvm-svn: 43166
2007-10-19 03:33:14 +00:00
Chris Lattner
579db81f1c add a new target hook.
llvm-svn: 43165
2007-10-19 03:31:45 +00:00
Chris Lattner
5d979d57ae Add an easy microoptimization I noticed.
llvm-svn: 43164
2007-10-19 03:29:26 +00:00
Devang Patel
e1b7fa3410 New test.
llvm-svn: 43162
2007-10-19 01:28:02 +00:00
Bill Wendling
de16ad1446 Negative indices aren't allowed here.
llvm-svn: 43161
2007-10-19 01:10:49 +00:00
Dale Johannesen
10432e5a67 More ppcf128 issues (maybe the last)?
llvm-svn: 43160
2007-10-19 00:59:18 +00:00
Fariborz Jahanian
74a1cfaf21 rewrite of metadata for implemented instance methods.
llvm-svn: 43159
2007-10-19 00:36:46 +00:00
Steve Naroff
648e029a3d Include a simple test case for the previous commit...
llvm-svn: 43158
2007-10-19 00:05:15 +00:00
Steve Naroff
684dc4107f Fix the previous (short lived:-) FIXME.
I didn't realize that GCC considers this a hard error (I thought it was built-in).

Since it's not, we should simply emit an error.

[dylan:~/llvm/tools/clang] admin% cc -c trivial.m
trivial.m:6: error: cannot find interface declaration for 'NSConstantString'

[administrators-powerbook59:~/llvm/tools/clang] admin% ../../Debug/bin/clang trivial.m 
trivial.m:6:16: error: cannot find interface declaration for 'NSConstantString'
NSString *s = @"123";
               ^
1 diagnostic generated.

llvm-svn: 43157
2007-10-18 23:53:51 +00:00
Ted Kremenek
04746ce6f9 Fixed DeclStmt::child_begin() to actually create an iterator that
visits its decls, rather than just creating an "end()" iterator.

Fixed child_end() for statements and expressions to use
child_iterator() to create the end() iterator, rather than just
returning NULL.

Fixed bug in StmtIterator where we did not correctly detect if we had
marched off the end of the ScopedDecls.

llvm-svn: 43156
2007-10-18 23:28:49 +00:00
Fariborz Jahanian
e183a8259d Check for Nullness of value built in GetObjcProtoType.
llvm-svn: 43155
2007-10-18 22:59:23 +00:00
Ted Kremenek
efc244722f Minor grammar fix.
llvm-svn: 43154
2007-10-18 22:50:52 +00:00
Evan Cheng
463e2ab0ac - Added getOpcodeAfterMemoryUnfold(). It doesn't unfold an instruction, but only returns the opcode of the instruction post unfolding.
- Fix some copy+paste bugs.

llvm-svn: 43153
2007-10-18 22:40:57 +00:00
Steve Naroff
eee59ebb15 Add a FIXME to an assert.
Change a dyn_cast_or_null back to cast (which is more efficient).

llvm-svn: 43152
2007-10-18 22:17:45 +00:00
Fariborz Jahanian
c34409c281 Patch to rewrite ivar tables metadata for classes defined.
llvm-svn: 43151
2007-10-18 22:09:03 +00:00
Evan Cheng
aa9a225699 Use SmallVectorImpl instead of SmallVector with hardcoded size in MRegister public interface.
llvm-svn: 43150
2007-10-18 21:29:24 +00:00
Chris Lattner
0d466153b9 remove dead #include
llvm-svn: 43149
2007-10-18 21:23:00 +00:00
Devang Patel
df49cf52e2 Try again.
Instead of loading small global string from memory, use
integer constant.

llvm-svn: 43148
2007-10-18 19:52:32 +00:00
Owen Anderson
09b83ba6f1 Allow GVN to eliminate redundant calls to functions without side effects.
llvm-svn: 43147
2007-10-18 19:39:33 +00:00
Christopher Lamb
64035f3b8e Add an uppercase conversion utility function.
llvm-svn: 43146
2007-10-18 19:31:38 +00:00
Christopher Lamb
79dfbed6f6 Fix a misnamed parameter.
llvm-svn: 43145
2007-10-18 19:29:45 +00:00
Christopher Lamb
7f68cf0d57 Fix a typo
llvm-svn: 43144
2007-10-18 19:28:55 +00:00
Fariborz Jahanian
93191afdef First patch toward rewriting of objective-c's meta data.
llvm-svn: 43143
2007-10-18 19:23:00 +00:00
Steve Naroff
1bb21df47f Tweak a recent fix to UsualArithmeticConversions (made by Chris - r43113). The benefit of this tweak is it guarantees the entire routine operates on unqualified types (which I believe is a bit clearer).
llvm-svn: 43142
2007-10-18 18:55:53 +00:00
Chris Lattner
9715d9fb59 Fix PR1735 and Transforms/DeadArgElim/2007-10-18-VarargsReturn.ll by
fixing some obviously broken code :(

llvm-svn: 43141
2007-10-18 18:49:29 +00:00
Bill Wendling
5616a608df Fix the command line.
llvm-svn: 43140
2007-10-18 18:26:40 +00:00
Ted Kremenek
0f39de13a0 Added StmtIterator.cpp and StmtIterator.h to the XCode project.
llvm-svn: 43139
2007-10-18 18:22:01 +00:00
Ted Kremenek
2ba761c7b8 Refactored StmtIterator into classes StmtIteratorBase (non-templated)
and StmtIteratorImpl (templated), which StmtIterator and
ConstStmtIterator now succintly subclass.

Implemented iteration over the initializers in DeclStmts.  This is not
thoroughly tested, so there may be bugs.

llvm-svn: 43138
2007-10-18 18:19:31 +00:00
Ted Kremenek
614d84aab3 Replaced virtual method call to child_begin() in child_end() by
directly inlining its logic.

llvm-svn: 43137
2007-10-18 18:17:43 +00:00
Devang Patel
371a5ef1de Fix test.
llvm-svn: 43136
2007-10-18 17:54:49 +00:00
Chris Lattner
ef6500992f this doesn't need dynamic_cast.
llvm-svn: 43133
2007-10-18 16:26:24 +00:00
Ted Kremenek
7aef89101d Fixed broken build.
llvm-svn: 43132
2007-10-18 16:25:40 +00:00
Chris Lattner
7813cec0d0 remove dead file
llvm-svn: 43131
2007-10-18 16:12:54 +00:00
Chris Lattner
9afb8e4e29 Reduce reliance on rtti info
llvm-svn: 43130
2007-10-18 16:11:18 +00:00
Chris Lattner
9b6ec77647 fix typo
llvm-svn: 43129
2007-10-18 16:10:48 +00:00
Chris Lattner
b12dce4bce update comment.
llvm-svn: 43128
2007-10-18 16:10:17 +00:00
Chris Lattner
1b88e3c2dd This requires rtti info because tblgen uses commandline,
and tblgen requires rtti.

llvm-svn: 43127
2007-10-18 15:57:29 +00:00
Chris Lattner
604b2314c8 tblgen uses dynamic_cast heavily, so it needs rtti info
llvm-svn: 43126
2007-10-18 15:54:45 +00:00
Hartmut Kaiser
c8107e54d5 Silenced a couple of VC++ warnings.
llvm-svn: 43125
2007-10-18 12:47:01 +00:00
Hartmut Kaiser
597e172d0a Updated VC++ build system
llvm-svn: 43124
2007-10-18 12:32:10 +00:00
Hartmut Kaiser
a420cf3f77 Updated VC++ build system
llvm-svn: 43123
2007-10-18 12:31:51 +00:00
Gordon Henriksen
ea31de8dc1 Work around downrev gccs which do not inherit visibility of the
Registry<>::iterator member class.

llvm-svn: 43122
2007-10-18 11:53:05 +00:00
Gordon Henriksen
03368e85b8 Missing 'public' keyword.
llvm-svn: 43121
2007-10-18 11:31:21 +00:00
Bill Wendling
070aca5d25 Pointer arithmetic should be done with the index the same size as the pointer.
llvm-svn: 43120
2007-10-18 08:32:37 +00:00
Duncan Sands
cb7aca0dcb Support for ADDC/SUBC.
llvm-svn: 43119
2007-10-18 08:22:16 +00:00
Evan Cheng
e6a41c066a Really fix PR1734. Carefully track which register uses are sub-register uses by
traversing inverse register coalescing map.

llvm-svn: 43118
2007-10-18 07:49:59 +00:00
Evan Cheng
0b18ddf55a Remove unnecessary include.
llvm-svn: 43117
2007-10-18 07:47:55 +00:00
Chris Lattner
84f3461c49 legalizing the ret operation on f64 shouldn't introduce a new
i64 bit convert needlessly.

llvm-svn: 43116
2007-10-18 06:17:07 +00:00
Owen Anderson
ca831a829d Move Split<...>() into DomTreeBase. This should make the #include's of DominatorInternals.h
in CodeExtractor and LoopSimplify unnecessary.

Hartmut, could you confirm that this fixes the issues you were seeing?

llvm-svn: 43115
2007-10-18 05:13:52 +00:00
Steve Naroff
a78c464c9e Fix a bug in Sema::CheckConditionalOperands(). When mixing pointers and null pointer constants, we need to promote the null pointer constant (which is an integer) to the pointer type. Test case is self explanatory.
This surfaced yesterday, when compiling test/Sema/cocoa.m on Leopard. Since this has nothing to do with ObjC, it's kind of bizarre this hasn't shown up before. I imagine Cocoa.h on Leopard may have changed recently? 

Thanks to Ted for localizing the bug and giving me a useful AST dump...

llvm-svn: 43114
2007-10-18 05:13:08 +00:00
Chris Lattner
fac7ac4130 UsualArithmeticConversions is crashing with an assert
when comparing "float" and "const float".  This "fixes" the
issue, but may not be the right fix.  Steve, please review.

Testcase here: test/Sema/usual-float.c

llvm-svn: 43113
2007-10-18 03:50:33 +00:00
Steve Naroff
8569d77349 Fix the following bug...
unsigned char asso_values[] = { 34 };
int legal2() { 
  return asso_values[0]; 
}

The code that creates the new constant array type was operating on the original type.

As a result, the constant type being generated was "unsigned char [1][]" (which is wrong).

The fix is to operate on the element type - in this case, the correct type is "unsigned char [1]"

I added this case to array-init.c, which clearly didn't catch this bogosity...

llvm-svn: 43112
2007-10-18 03:27:23 +00:00
Devang Patel
9497767458 XFAIL for now.
llvm-svn: 43111
2007-10-18 00:48:43 +00:00
Chris Lattner
c7f3981b27 remove extraneous space in @selector()
llvm-svn: 43110
2007-10-18 00:39:29 +00:00
Chris Lattner
810c1db3f5 remove typedef.
llvm-svn: 43109
2007-10-18 00:38:23 +00:00
Ted Kremenek
da9639d1a7 Changed the return type of type-specific Allocate() methods to return
void*.  This is hint that we are returning uninitialized memory rather
than a constructed object.

Patched ImutAVLTree to conform to this new interface.

llvm-svn: 43106
2007-10-18 00:30:14 +00:00
Ted Kremenek
336886a344 Implemented 90% functionality of new child_iterator for Stmt objects
that will (soon) allow iteration over the initializers in
declarations.  This new iterator mechanism is implemented by the
classes StmtIterator and ConstStmtIterator.

Patched a few files to use "operator++" instead of "operator+" on
child_iterators.

Friendship added in VarDecl to StmtIterator to allow returning a
reference to the initializer within the VarDecl.  We may not wish this
as a permanent solution.

llvm-svn: 43105
2007-10-18 00:24:38 +00:00
Chris Lattner
9c0f9fe151 Make control flow in Expr::isConstantExpr more simple and
local, making the code easier to read.

llvm-svn: 43104
2007-10-18 00:20:32 +00:00
Evan Cheng
cdcc1d0444 Reverting r43070 for now. It's causing llc test failures.
llvm-svn: 43103
2007-10-17 23:51:13 +00:00
Bill Wendling
37f888e6e8 Test to make sure we don't generate unwind info for non-64-bit Objective-C.
llvm-svn: 43102
2007-10-17 23:14:56 +00:00
Chris Lattner
c6d91c0f6d Add new API to rewrite one stmt/expr with another.
llvm-svn: 43101
2007-10-17 22:35:30 +00:00
Ted Kremenek
603fbbfcb7 ImutAVLTree now allocates tree nodes from the BumpPtrAllocator using
the new type-aligned Allocate() method.

llvm-svn: 43100
2007-10-17 22:17:01 +00:00
Ted Kremenek
3830606dee Removed inclusion of cassert, which is no longer needed.
llvm-svn: 43099
2007-10-17 22:12:14 +00:00
Ted Kremenek
27d207d2e7 Minor cosmetic cleanups in the calculation of alignments for
StringMapEntry objects.  No functionality change.

llvm-svn: 43097
2007-10-17 22:09:45 +00:00
Ted Kremenek
02c3267039 Added template function alignof() which provides a clean
function-based interface to getting the alignment of a type.

llvm-svn: 43096
2007-10-17 22:08:55 +00:00
Gordon Henriksen
0ab3d27641 Reverting unnecessary commit of generated files.
llvm-svn: 43095
2007-10-17 21:36:08 +00:00
Gordon Henriksen
ef5d08f4ea Switching TargetMachineRegistry to use the new generic Registry.
llvm-svn: 43094
2007-10-17 21:28:48 +00:00
Chris Lattner
9515625d0c Add rewriter support for @encode expressions. For example,
we currently turn:

    c = @encode(char *)[2] + 4;

into:

    c = "foo"[2] + 4;

Right now the foo string is hard coded, but you can imagine a world
where it wouldn't be :)

llvm-svn: 43093
2007-10-17 21:28:00 +00:00
Chris Lattner
42ebe5c1e6 The size returned by Rewriter::getRangeSize should include
the size of the last token.

llvm-svn: 43092
2007-10-17 21:23:07 +00:00
Chris Lattner
fd64ebd3e4 Fix assertion for raw lexer.
llvm-svn: 43091
2007-10-17 21:22:38 +00:00
Chris Lattner
8e129c23c8 Move token length calculation out of the diagnostics machinery into
the lexer, where it can be shared.

llvm-svn: 43090
2007-10-17 21:18:47 +00:00
Ted Kremenek
dbc8e043c2 Updated StringMap to use llvm::AlignOf to compute the alignment of map
entries.

llvm-svn: 43089
2007-10-17 21:13:50 +00:00
Gordon Henriksen
9c750f6fd1 Ignoring test/Transforms/LoopIndexSplit/Output.
llvm-svn: 43088
2007-10-17 21:11:33 +00:00
Ted Kremenek
a26294201f Added member template functions to MallocAllocator and
BumpPtrAllocator that implement allocations that return a properly
typed pointer.  For BumpPtrAllocator, the allocated memory is
automatically aligned to the minimum alignment of the type (as
calculated by llvm::AlignOf::Alignment).

llvm-svn: 43087
2007-10-17 21:10:21 +00:00
Ted Kremenek
391b728a99 Added llvm::AlignOf, a template class whose purpose is to portably
compute the minimum memory alignment of arbitrary types.

llvm-svn: 43086
2007-10-17 20:56:47 +00:00
Chris Lattner
4050f071e1 wean the diagnostics machinery off the preprocessor.
llvm-svn: 43085
2007-10-17 20:53:57 +00:00
Chris Lattner
02b436a05a Add a new type of lexer: a raw lexer, which does not require a preprocessor
object in order to do its thing.

llvm-svn: 43084
2007-10-17 20:41:00 +00:00
Devang Patel
b3dac3f5d9 Do not raise free() call that is called through invoke instruction.
llvm-svn: 43083
2007-10-17 20:12:58 +00:00
Steve Naroff
a3f1336e39 rename test file for builtin "id"...
llvm-svn: 43082
2007-10-17 18:39:04 +00:00
Hartmut Kaiser
2f842e613f Fixed linker errors (unresolved externals: split<>(...)) when compiling with VC++. Please review.
llvm-svn: 43081
2007-10-17 18:37:09 +00:00
Ted Kremenek
5c84c01c8b Fixed includes of "clang/AST/DeclObjC.h" to work on case-sensitive
filesystems (was "#include "clang/AST/DeclObjc.h", which worked fine
on a case-insensitive HFS+ volume on the Mac).

llvm-svn: 43080
2007-10-17 18:36:42 +00:00
Chris Lattner
caecf03215 add some comments.
llvm-svn: 43079
2007-10-17 18:28:59 +00:00
Dan Gohman
d0806a0508 Don't mention -enable-unsafe-fp-math in LangRef.html, as that option is
assumed to globally mutate the spec.

llvm-svn: 43078
2007-10-17 18:05:13 +00:00
Steve Naroff
0f7a2d2dd1 Predefine all the ObjC goodies from <objc/objc.h>. Removed all the ObjC goodies from the respective test files. Moving forward, it will be very nice to assume these builtin!
llvm-svn: 43077
2007-10-17 17:53:50 +00:00
Dan Gohman
07159205dd Define a helper function ConstantVector::getSplatValue for testing for
and working with broadcasted constants.

llvm-svn: 43076
2007-10-17 17:51:30 +00:00
Fariborz Jahanian
a32aaefadc Implementation of AST for @protocol expression.
llvm-svn: 43075
2007-10-17 16:58:11 +00:00
Hartmut Kaiser
7078da8e58 Updated VC++ build system.
Silenced some VC++ warnings.
Had to rephrase a partial specialization of the IntrospectionTrait struct in SerializationTest.cpp, please review.
Added a compiler specific workaround in IdentifierTable.h. Is that the way to fix this kind of issues?

llvm-svn: 43074
2007-10-17 15:00:17 +00:00
Hartmut Kaiser
ec8a8d1f51 Updated VC++ build system.
Silenced some VC warnings.

I'm getting linker errors, though: unresolved externals:

llvm::Split<class llvm::BasicBlock *,struct llvm::GraphTraits<class llvm::BasicBlock *> >(class llvm::DominatorTreeBase<class llvm::BasicBlock> &,class llvm::BasicBlock *)

and

llvm::Split<struct llvm::Inverse<class llvm::BasicBlock *>,struct llvm::GraphTraits<struct llvm::Inverse<class llvm::BasicBlock *> > >(class llvm::DominatorTreeBase<class llvm::BasicBlock> &,class llvm::BasicBlock *)

Where are these defined?

llvm-svn: 43073
2007-10-17 14:56:40 +00:00
Dan Gohman
8f518b9875 Add support for ISD::SELECT in SplitVectorOp.
llvm-svn: 43072
2007-10-17 14:48:28 +00:00
Duncan Sands
d42c812f4a Return Expand from getOperationAction for all extended
types.  This is needed for SIGN_EXTEND_INREG at least.
It is not clear if this is correct for other operations.
On the other hand, for the various load/store actions
it seems to correct to return the type action, as is
currently done.
Also, it seems that SelectionDAG::getValueType can be
called for extended value types; introduce a map for
holding these, since we don't really want to extend
the vector to be 2^32 pointers long!
Generalize DAGTypeLegalizer::PromoteResult_TRUNCATE
and DAGTypeLegalizer::PromoteResult_INT_EXTEND to handle
the various funky possibilities that apints introduce,
for example that you can promote to a type that needs
to be expanded.

llvm-svn: 43071
2007-10-17 13:49:58 +00:00
Devang Patel
91ff13edcc Apply "Instead of loading small c string constant, use integer constant directly" transformation while processing load instruction.
llvm-svn: 43070
2007-10-17 07:24:40 +00:00
Evan Cheng
0dde6e5761 Apply Chris' suggestions.
llvm-svn: 43069
2007-10-17 06:53:44 +00:00
Chris Lattner
12d5da49d3 Change fp to sint legalization on x86-32 to do 2 x i32
loads instead of 1 x i64 loads.  This doesn't change any functionality yet.

llvm-svn: 43068
2007-10-17 06:17:29 +00:00
Chris Lattner
253023b25f fix problems with test/sema/Cocoa.m etc on non-apple machines.
llvm-svn: 43067
2007-10-17 06:04:46 +00:00
Chris Lattner
693cbeadff fix some funny indentation, add comments.
llvm-svn: 43066
2007-10-17 06:02:13 +00:00
Evan Cheng
c8b5397000 One more extract_subreg coalescing bug fix.
llvm-svn: 43065
2007-10-17 05:29:37 +00:00
Evan Cheng
5cfc2c640f Update comments.
llvm-svn: 43064
2007-10-17 02:16:40 +00:00
Evan Cheng
7587d1bd19 Yet another test case for extract_subreg coalescing crash.
llvm-svn: 43063
2007-10-17 02:15:06 +00:00
Evan Cheng
9b0a44a2ce Fix MergeValueInAsValue(). It allows overlapping live ranges but should replace
their value numbers with the specified value number.

llvm-svn: 43062
2007-10-17 02:13:29 +00:00
Evan Cheng
a6fd8bc97e Clean up code that calculate MBB live-in's.
llvm-svn: 43061
2007-10-17 02:12:22 +00:00
Evan Cheng
8b8c7c9927 Clean up code that calculate MBB live-in's.
llvm-svn: 43060
2007-10-17 02:10:22 +00:00
Owen Anderson
84490d44ec Move splitBlock into DomTreeBase from DomTree.
llvm-svn: 43059
2007-10-17 02:03:17 +00:00
Anders Carlsson
f94cd1ffe6 Generate code for static variables that don't have initializers. Also, report an error if a static initializer is not constant.
llvm-svn: 43058
2007-10-17 00:52:43 +00:00
Anders Carlsson
86edafc6d6 Fix the build.
llvm-svn: 43057
2007-10-17 00:50:25 +00:00
Devang Patel
8d818f5e80 Use immediate stores.
llvm-svn: 43055
2007-10-16 23:44:18 +00:00
Ted Kremenek
970217fae9 Added Driver/SerializationTest.cpp to the XCode project.
llvm-svn: 43054
2007-10-16 23:40:12 +00:00
Dale Johannesen
e5facd51cb Disable attempts to constant fold PPC f128.
Remove the assumption that this will happen from
various places.

llvm-svn: 43053
2007-10-16 23:38:29 +00:00
Ted Kremenek
4e816133c8 Started work on clang object serialization. Experimental
serialization logic as well as driver code is now in
Driver/SerializationTest.cpp.  The status of this code is that it
should be used by no clients.

Added --test-pickling option to driver to run the serialization code.

Modified IdentifierInfo and IdentifierTable to have friend classes
that permit object serialization.  Such friendship may not be needed
in the final design.

llvm-svn: 43052
2007-10-16 23:37:27 +00:00
Fariborz Jahanian
6bd1d612ac Fix location processing of @selector: the range should include the @ sign.
llvm-svn: 43051
2007-10-16 23:21:02 +00:00
Steve Naroff
077c83bddb Add Sema::CheckMessageArgumentTypes()...
llvm-svn: 43050
2007-10-16 23:12:48 +00:00
Owen Anderson
7bcc28bf6c Fix some formatting.
llvm-svn: 43049
2007-10-16 22:59:15 +00:00
Chris Lattner
37390bed4d Fix location processing of @encode: the range should include the @ sign.
@selector probably gets this wrong also.

llvm-svn: 43048
2007-10-16 22:51:17 +00:00
Chris Lattner
a7c19feca2 Add a new Rewriter::getRangeSize method.
Rename SourceRange::Begin()/End() to getBegin()/getEnd() for
consistency with other code.
Start building the rewriter towards handling @encode.

llvm-svn: 43047
2007-10-16 22:36:42 +00:00
Fariborz Jahanian
ebac2cb235 Patch to diagnose duplicate method implementations.
llvm-svn: 43046
2007-10-16 21:52:23 +00:00
Steve Naroff
d275426449 Remove ObjcMethodDecl::getNumMethodParams/getMethodParamDecl, they aren't used/needed.
Change ObjcMethodDecl::getMethodType to getResultType, to match FunctionDecl.

llvm-svn: 43045
2007-10-16 21:36:54 +00:00
Chris Lattner
5a2fe28aca publish location info
llvm-svn: 43044
2007-10-16 21:21:26 +00:00
Evan Cheng
8f644cef0f Some clean up.
llvm-svn: 43043
2007-10-16 21:09:14 +00:00
Fariborz Jahanian
923aebe09c Steve, pointer out that getName() is available for selectors. Made code much smaller, thanks.
llvm-svn: 43042
2007-10-16 21:07:53 +00:00
Chris Lattner
0bd1c97293 Push the rewriter forward a bit more. Now it rewrites
#import to #include's as a test.

llvm-svn: 43041
2007-10-16 21:07:07 +00:00
Chris Lattner
9a36bb84ea these aren't const.
llvm-svn: 43040
2007-10-16 21:04:49 +00:00
Fariborz Jahanian
81ccd88f0e Fix problem dumping/printing method names with null selector.
llvm-svn: 43039
2007-10-16 20:52:13 +00:00
Fariborz Jahanian
4bef462a3e Patch to implement AST generation for objective-c's @selector expression.
llvm-svn: 43038
2007-10-16 20:40:23 +00:00
Steve Naroff
55f52da24c Emit diagnostics for methods not found.
llvm-svn: 43037
2007-10-16 20:39:36 +00:00
Owen Anderson
4187801f85 Template DominatorTreeBase by node type. This is the next major step towards
having dominator information on MBB's.

llvm-svn: 43036
2007-10-16 19:59:25 +00:00
Evan Cheng
fab7ca89d5 Fix PR1734.
llvm-svn: 43035
2007-10-16 19:29:47 +00:00
Dale Johannesen
e43b960d3b New test for svn rev 43033, radar 5538745.
llvm-svn: 43034
2007-10-16 18:10:14 +00:00
Dale Johannesen
e5530a35d4 Check for invalid cc's in f80 select.
llvm-svn: 43033
2007-10-16 18:09:08 +00:00
Chris Lattner
1366653e2f Fix a bug handling frame references in ppc inline asm when the frame offset
doesn't fit into 16 bits.

llvm-svn: 43032
2007-10-16 18:00:18 +00:00
Duncan Sands
ce042d0bc0 Document the fact that the verifier currently requires the
top bit of a ValueType to be zero.  Enforce this by ensuring
an assertion failure if someone tries to create a ValueType
without this property.  I chose this minimal approach rather
than a more official integration of the notion of reserved
bits into ValueType because I'm hoping that the verifier will
be changed to no longer require this :)

llvm-svn: 43031
2007-10-16 13:34:11 +00:00
Duncan Sands
bbbfbe95f7 Initial infrastructure for arbitrary precision integer
codegen support.  This should have no effect on codegen
for other types.  Debatable bits: (1) the use (abuse?)
of a set in SDNode::getValueTypeList; (2) the length of
getTypeToTransformTo, which maybe should be refactored
with a non-inline part for extended value types.

llvm-svn: 43030
2007-10-16 09:56:48 +00:00
Anton Korobeynikov
002c52ce6e Unbreak mingw32. Maybe there should be something like libClandSystem? :)
llvm-svn: 43029
2007-10-16 09:09:44 +00:00
Duncan Sands
052c843559 Fixes due to lack of type-safety for ValueType: (1) ValueType
being passed instead of an opcode; (2) ValueType being passed
for isVolatile (!) in getLoad.

llvm-svn: 43028
2007-10-16 09:07:20 +00:00
Arnold Schwaighofer
b3d58b98d0 Correction to tail call optimization code. The new return address
was stored to the acutal stack slot before the parameters were
lowered to their stack slot. This could cause arguments to be
overwritten by the return address if the called function had less
parameters than the caller function. The update should remove the
last failing test case of llc-beta: SPASS.

llvm-svn: 43027
2007-10-16 09:05:00 +00:00
Evan Cheng
ecf62cb763 Code clean up.
llvm-svn: 43026
2007-10-16 08:04:24 +00:00
Chris Lattner
cece03dd89 implement promotion of select and select_cc, allowing MallocBench/gs to
work with type promotion on x86.

llvm-svn: 43025
2007-10-16 03:00:22 +00:00
Chris Lattner
e6dcd505d0 initialization of references should not do default fn/array promotions.
This fixes a bug Anders noticed.

llvm-svn: 43024
2007-10-16 02:55:40 +00:00
Steve Naroff
698495522d Bad cast...need to use dyn_cast_or_null. Also changed Sema::InitBuiltinVaListType (which had the same bug).
llvm-svn: 43023
2007-10-16 00:00:18 +00:00
Fariborz Jahanian
76a9427783 Patch to parse @selector expressions.
llvm-svn: 43022
2007-10-15 23:39:13 +00:00
Steve Naroff
f73b784a5e Change the type of ObjCStringLiteral from "struct __builtin_CFString *" to "NSConstantString *".
This makes the typecheck much happier. Without this change, the type checker would have to special case "struct __builtin_CFString *". This change does assume the interface for NSConstantString is declared in the translation unit.

I left ASTContext::getCFConstantStringType() around for now (with a comment that says it is currently unused).

llvm-svn: 43021
2007-10-15 23:35:17 +00:00
Dan Gohman
9aa4fc5cd6 Teach IntrinsicLowering.cpp about the sin, cos, and pow intrinsics.
llvm-svn: 43020
2007-10-15 22:07:31 +00:00
Evan Cheng
04c44712d3 Make CalcLatency() non-recursive.
llvm-svn: 43017
2007-10-15 21:33:22 +00:00
Dan Gohman
a8656d4798 Fix a typo in a comment.
llvm-svn: 43016
2007-10-15 21:10:03 +00:00
Dan Gohman
d4f2165007 Document the -view-sunit-dags option.
llvm-svn: 43015
2007-10-15 21:07:59 +00:00
Steve Naroff
126b4d835f Fix a parser bug with message expressions - need to call ParsePostfixExpressionSuffix().
Now were correctly allow the following...

    i = [str rangeOfString:@"]"].length;

llvm-svn: 43012
2007-10-15 20:55:58 +00:00
Steve Naroff
32e44c0032 Move type compatibility predicates from Type to ASTContext. In addition, the predicates are now instance methods (they were previously static class methods on Type).
This allowed me to fix the following hack from this weekend...

// FIXME: Devise a way to do this without using strcmp.
// Would like to say..."return getAsStructureType() == IdStructType;", but
// we don't have a pointer to ASTContext.
bool Type::isObjcIdType() const {
  if (const RecordType *RT = getAsStructureType())
    return !strcmp(RT->getDecl()->getName(), "objc_object");
  return false;
}

...which is now...

bool isObjcIdType(QualType T) const {
  return T->getAsStructureType() == IdStructType;
}

Side notes:

- I had to remove a convenience function from the TypesCompatibleExpr class.

int typesAreCompatible() const {return Type::typesAreCompatible(Type1,Type2);}

Which required a couple clients get a little more verbose...

-    Result = TCE->typesAreCompatible();
+    Result = Ctx.typesAreCompatible(TCE->getArgType1(), TCE->getArgType2());

Overall, I think this change also makes sense for a couple reasons...

1) Since ASTContext vends types, it makes sense for the type compatibility API to be there.
2) This allows the type compatibility predeciates to refer to data not strictly present in the AST (which I have found problematic on several occasions).

llvm-svn: 43009
2007-10-15 20:41:53 +00:00
Dan Gohman
b6324c1243 Document the new llvm.sin, llvm.cos, and llvm.pow intrinsics. Feedback
is welcome!

llvm-svn: 43007
2007-10-15 20:30:11 +00:00
Anders Carlsson
7e13ab88a2 Add code generation and sema checking for __builtin_va_arg.
llvm-svn: 43006
2007-10-15 20:28:48 +00:00
Chris Lattner
06a4954e6e Change LowerFP_TO_SINT to create the specific code it needs instead of
unconditionally creating an i64 bitcast.  With the future legalizer
design, operation legalization can't introduce new nodes with illegal
types.

This fixes the rest of olden on ppc32.

llvm-svn: 43005
2007-10-15 20:14:52 +00:00
Evan Cheng
7bcfd8f880 LowerFP_TO_SINT must not create a stack object if it's not needed.
llvm-svn: 43004
2007-10-15 20:11:21 +00:00
Devang Patel
324fe8904f Add removeModuleProvider()
llvm-svn: 43002
2007-10-15 19:56:32 +00:00
Dan Gohman
e862243e1c Reapply the fix in 42908 for this file. This changes the function names
from "test" to "foo" so that they don't match the grep -i ST.

llvm-svn: 43001
2007-10-15 19:22:17 +00:00
Fariborz Jahanian
d4b3015dd7 Several name lookup conflict detection fixes involving objective-c names.
llvm-svn: 43000
2007-10-15 19:16:57 +00:00
Ted Kremenek
7bbc582bb3 Fixed incorrect renaming of method name (forgot two characters).
llvm-svn: 42999
2007-10-15 19:15:48 +00:00
Ted Kremenek
fcce4f378f Added more doxygen comments.
Renamed internal method of ImutAVLTree::RemoveMutableFlag to MarkImmutable.
Added enum for bit manipulation (more self-documentating).

llvm-svn: 42998
2007-10-15 18:52:34 +00:00
Evan Cheng
a5abba65b6 Fix PR1729: watch out for val# with no def.
llvm-svn: 42996
2007-10-15 18:33:50 +00:00
Chris Lattner
d6f7d44eae Move CreateStackTemporary out to SelectionDAG
llvm-svn: 42995
2007-10-15 17:48:57 +00:00
Chris Lattner
9eb7a829e6 add a new CreateStackTemporary helper method.
llvm-svn: 42994
2007-10-15 17:47:20 +00:00
Chris Lattner
9d5b131e70 implement promotion of BR_CC operands, fixing bisort on ppc.
llvm-svn: 42992
2007-10-15 17:16:12 +00:00
Chris Lattner
8555e69def updates from duncan
llvm-svn: 42991
2007-10-15 16:46:29 +00:00
Tanya Lattner
9486b19066 Fix run line.
llvm-svn: 42990
2007-10-15 16:35:13 +00:00
Devang Patel
80b1222274 New test.
llvm-svn: 42986
2007-10-15 15:41:07 +00:00
Devang Patel
bff4aea328 Achieve same result but use fewer lines of code.
llvm-svn: 42985
2007-10-15 15:31:35 +00:00
Neil Booth
9130551996 Fast-track obviously over-large and over-small exponents during decimal->
integer conversion.  In some such cases this makes us one or two orders
of magnitude faster than NetBSD's libc.  Glibc seems to have a similar
fast path.

Also, tighten up some upper bounds to save a bit of memory.

llvm-svn: 42984
2007-10-15 15:00:55 +00:00
Steve Naroff
66e9f331ba Added ASTContext::setObjcIdType/getObjcIdType(), set by Sema.
Also noticed ASTContext::BuiltinVaListType wasn't being initialized to the null type (so I set it).

llvm-svn: 42983
2007-10-15 14:41:52 +00:00
Duncan Sands
f6977d9842 Fix some typos. Call getTypeToTransformTo rather than
getTypeToExpandTo.  The difference is that
getTypeToExpandTo gives the final result of expansion
(eg: i128 -> i32 on a 32 bit machine) while
getTypeToTransformTo does just one step (i128 -> i64).

llvm-svn: 42982
2007-10-15 13:30:18 +00:00
Chris Lattner
3cfb56d489 One mundane change: Change ReplaceAllUsesOfValueWith to *optionally*
take a deleted nodes vector, instead of requiring it.

One more significant change:  Implement the start of a legalizer that
just works on types.  This legalizer is designed to run before the 
operation legalizer and ensure just that the input dag is transformed
into an output dag whose operand and result types are all legal, even
if the operations on those types are not.

This design/impl has the following advantages:

1. When finished, this will *significantly* reduce the amount of code in
   LegalizeDAG.cpp.  It will remove all the code related to promotion and
   expansion as well as splitting and scalarizing vectors.
2. The new code is very simple, idiomatic, and modular: unlike 
   LegalizeDAG.cpp, it has no 3000 line long functions. :)
3. The implementation is completely iterative instead of recursive, good
   for hacking on large dags without blowing out your stack.
4. The implementation updates nodes in place when possible instead of 
   deallocating and reallocating the entire graph that points to some 
   mutated node.
5. The code nicely separates out handling of operations with invalid 
   results from operations with invalid operands, making some cases
   simpler and easier to understand.
6. The new -debug-only=legalize-types option is very very handy :), 
   allowing you to easily understand what legalize types is doing.

This is not yet done.  Until the ifdef added to SelectionDAGISel.cpp is
enabled, this does nothing.  However, this code is sufficient to legalize
all of the code in 186.crafty, olden and freebench on an x86 machine.  The
biggest issues are:

1. Vectors aren't implemented at all yet
2. SoftFP is a mess, I need to talk to Evan about it.
3. No lowering to libcalls is implemented yet.
4. Various operations are missing etc.
5. There are FIXME's for stuff I hax0r'd out, like softfp.

Hey, at least it is a step in the right direction :).  If you'd like to help,
just enable the #ifdef in SelectionDAGISel.cpp and compile code with it.  If
this explodes it will tell you what needs to be implemented.  Help is 
certainly appreciated.

Once this goes in, we can do three things:

1. Add a new pass of dag combine between the "type legalizer" and "operation
   legalizer" passes.  This will let us catch some long-standing isel issues
   that we miss because operation legalization often obfuscates the dag with
   target-specific nodes.
2. We can rip out all of the type legalization code from LegalizeDAG.cpp,
   making it much smaller and simpler.  When that happens we can then 
   reimplement the core functionality left in it in a much more efficient and
   non-recursive way.
3. Once the whole legalizer is non-recursive, we can implement whole-function
   selectiondags maybe...

llvm-svn: 42981
2007-10-15 06:10:22 +00:00
Chris Lattner
b193517eed One xform performed by LegalizeDAG is transformation of "store of fp" to "store of int".
Make two changes:
1) only xform "store of f32" if i32 is a legal type for the target.
2) only xform "store of f64" if either i64 or i32 are legal for the target.
3) if i64 isn't legal, manually lower to 2 stores of i32 instead of letting a
   later pass of legalize do it.  This is ugly, but helps future changes I'm 
   about to commit.

llvm-svn: 42980
2007-10-15 05:46:06 +00:00
Chris Lattner
2b827fd70d avoid an APFloat copy.
llvm-svn: 42979
2007-10-15 05:34:10 +00:00
Chris Lattner
90e0b271df Add a (disabled by default) way to view the ID of a node.
llvm-svn: 42978
2007-10-15 05:32:43 +00:00
Chris Lattner
bfdebe33a0 remove dead enum, make setNodeId public.
llvm-svn: 42977
2007-10-15 05:30:55 +00:00
Chris Lattner
a2ebb9aadd Fix 80 col violation
llvm-svn: 42976
2007-10-15 05:30:27 +00:00
Steve Naroff
271643620b Teach the type checker about "id". This removes the following bogus warning...
[dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang t.m
t.m:29:18: warning: incompatible pointer types assigning 'id' to 'NSString *'
    resultString = [[NSString alloc] initWithFormat:0 arguments:0];
    ~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

llvm-svn: 42975
2007-10-15 03:14:16 +00:00
Anders Carlsson
cbfc4b8824 Add support for Pascal strings.
llvm-svn: 42974
2007-10-15 02:50:23 +00:00
Anders Carlsson
b30f47a869 Fix a warning
llvm-svn: 42973
2007-10-15 02:50:04 +00:00
Dale Johannesen
207bd4d90e Handle PPC long double in CBackend.
llvm-svn: 42972
2007-10-15 01:05:37 +00:00
Steve Naroff
5d15254496 - Teach ObjcInterfaceDecl::lookupInstance/ClassMethod to look through protocols.
- Start looking up methods in the global method pools (for "id").
- Start integrating interface types into the type system.

llvm-svn: 42971
2007-10-14 23:13:51 +00:00
Chris Lattner
fbbe570994 remove misleading comment.
llvm-svn: 42970
2007-10-14 20:35:12 +00:00
Chris Lattner
ebe491ea9c If a target doesn't have HasMULHU or HasUMUL_LOHI, ExpandOp would return
without lo/hi set.  Fall through to making a libcall instead.

llvm-svn: 42969
2007-10-14 18:35:05 +00:00
Steve Naroff
ca0ecfe048 Add category lookup (removing a couple FIXME's).
Changed ObjcInterfaceDecl::ListCategories->CategoryList.

llvm-svn: 42968
2007-10-14 18:27:41 +00:00
Steve Naroff
e7ed06e6fc Fix -ast-dump for ObjC.
llvm-svn: 42967
2007-10-14 17:03:01 +00:00
Neil Booth
5fe658b21d Consolidate logic for creating NaNs. Silence compiler warning.
llvm-svn: 42966
2007-10-14 10:39:51 +00:00
Neil Booth
06077e7c3c Whether arithmetic is supported is a property of the semantics. Make it
so, and clean up the checks by putting them in an inline function.

llvm-svn: 42965
2007-10-14 10:29:28 +00:00
Neil Booth
4ed401b898 Separate out parsing of decimal number. Use this to only allocate
memory for the significand once up-front.  Also ignore insignificant
trailing zeroes; this saves unnecessary multiplications later.

llvm-svn: 42964
2007-10-14 10:16:12 +00:00
Evan Cheng
d8771e915c New test case.
llvm-svn: 42963
2007-10-14 10:15:03 +00:00
Evan Cheng
4099f4f91a Unbreak x86-64.
llvm-svn: 42962
2007-10-14 10:09:39 +00:00
Evan Cheng
8d6da9142c When coalescing an EXTRACT_SUBREG and the dst register is a physical register,
the source register will be coalesced to the super register of the LHS. Properly
merge in the live ranges of the resulting coalesced interval that were part of
the original source interval to the live interval of the super-register.

llvm-svn: 42961
2007-10-14 10:08:34 +00:00
Evan Cheng
cdf3609130 Revert 42908 for now.
llvm-svn: 42960
2007-10-14 05:57:21 +00:00
Dale Johannesen
2f6b6d6fb0 Fix type mismatch error in PPC Altivec (only causes
a problem when asserts are on).  From vecLib.

llvm-svn: 42959
2007-10-14 01:58:32 +00:00
Dale Johannesen
19db093b35 Disable some compile-time optimizations on PPC
long double.

llvm-svn: 42958
2007-10-14 01:56:47 +00:00
Steve Naroff
5811baf1a0 - Added Sema::AddFactoryMethodToGlobalPool and Sema::AddInstanceMethodToGlobalPool and DenseMaps. This will allow us to efficiently lookup a method from a selector given no type information (for the "id" data type).
- Fixed some funky "}
                    else {" indentation in Sema::ActOnAddMethodsToObjcDecl(). I'd prefer we stay away from this style...it wastes space and isn't any easier to read (from my perspective, at least:-)

- Changed Parser::ParseObjCInterfaceDeclList() to only call Action::ActOnAddMethodsToObjcDecl() when it actually has methods to add (since most interface have methods, this is a very minor cleanup).

llvm-svn: 42957
2007-10-14 00:58:41 +00:00
Gordon Henriksen
a699c4dc65 Fixing a typo. Found by Kevin André!
llvm-svn: 42956
2007-10-14 00:34:53 +00:00
Duncan Sands
29af26f147 Clarify that fastcc has a problem with nested function
trampolines, rather than with nested functions themselves.

llvm-svn: 42955
2007-10-13 07:38:37 +00:00
Chris Lattner
f47e30627a Enhance the truncstore optimization code to handle shifted
values and propagate demanded bits through them in simple cases.

This allows this code:
void foo(char *P) {
   strcpy(P, "abc");
}
to compile to:

_foo:
        ldrb r3, [r1]
        ldrb r2, [r1, #+1]
        ldrb r12, [r1, #+2]!
        ldrb r1, [r1, #+1]
        strb r1, [r0, #+3]
        strb r2, [r0, #+1]
        strb r12, [r0, #+2]
        strb r3, [r0]
        bx lr

instead of:

_foo:
        ldrb r3, [r1, #+3]
        ldrb r2, [r1, #+2]
        orr r3, r2, r3, lsl #8
        ldrb r2, [r1, #+1]
        ldrb r1, [r1]
        orr r2, r1, r2, lsl #8
        orr r3, r2, r3, lsl #16
        strb r3, [r0]
        mov r2, r3, lsr #24
        strb r2, [r0, #+3]
        mov r2, r3, lsr #16
        strb r2, [r0, #+2]
        mov r3, r3, lsr #8
        strb r3, [r0, #+1]
        bx lr

testcase here: test/CodeGen/ARM/truncstore-dag-combine.ll

This also helps occasionally for X86 and other cases not involving 
unaligned load/stores.

llvm-svn: 42954
2007-10-13 06:58:48 +00:00
Chris Lattner
2ce649ebea new testcase
llvm-svn: 42953
2007-10-13 06:56:18 +00:00
Chris Lattner
5e6fe054a2 Add a simple optimization to simplify the input to
truncate and truncstore instructions, based on the 
knowledge that they don't demand the top bits.

llvm-svn: 42952
2007-10-13 06:35:54 +00:00
Anders Carlsson
d5f857f2e5 Fix an incorrect assertion.
llvm-svn: 42951
2007-10-13 05:52:34 +00:00
Neil Booth
c799fe9ed9 If the power of 5 is exact, and the reciprocal exact, the error is zero not one half-ulps. This prevents an infinite loop in rare cases.
llvm-svn: 42950
2007-10-13 03:34:08 +00:00
Evan Cheng
f86204baf4 Fix test case.
llvm-svn: 42949
2007-10-13 03:14:06 +00:00
Evan Cheng
54bec86754 New tests.
llvm-svn: 42948
2007-10-13 03:10:54 +00:00
Evan Cheng
b63076504e Local spiller optimization:
Turn this:
movswl  %ax, %eax
movl    %eax, -36(%ebp)
xorl    %edi, -36(%ebp)
into
movswl  %ax, %eax
xorl    %edi, %eax
movl    %eax, -36(%ebp)
by unfolding the load / store xorl into an xorl and a store when we know the
value in the spill slot is available in a register. This doesn't change the
number of instructions but reduce the number of times memory is accessed.

Also unfold some load folding instructions and reuse the value when similar
situation presents itself.

llvm-svn: 42947
2007-10-13 02:50:24 +00:00
Evan Cheng
7082dcf605 Change unfoldMemoryOperand(). User is now responsible for passing in the
register used by the unfolded instructions. User can also specify whether to
unfold the load, the store, or both.

llvm-svn: 42946
2007-10-13 02:35:06 +00:00
Evan Cheng
9490e0d078 Optionally create a MachineInstr without default implicit operands.
llvm-svn: 42945
2007-10-13 02:23:01 +00:00
Chris Lattner
6a91cc03ad haha, my devious plot is complete:
$ clang rewrite.c -rewrite-test
prints:

int foo() {
        b:      foo();
f:      foo();
    foo();
}

for:

int foo() {
	b:	foo();
f:	foo();
    foo();
}

amazing.

llvm-svn: 42944
2007-10-13 00:46:29 +00:00
Anders Carlsson
a7408e742a Add __builtin_va_list definitions for x86_64 and ppc64.
llvm-svn: 42943
2007-10-13 00:45:48 +00:00
Chris Lattner
2a8ab05f5f With this I can now insert stuff before tabs, woo.
llvm-svn: 42942
2007-10-13 00:21:23 +00:00
Chris Lattner
58bad341bc Woo, tab deletion now works. Next lets see if we can
insert stuff.

llvm-svn: 42941
2007-10-13 00:17:04 +00:00
Chris Lattner
2fcf1b83c1 another step forward in rewriter stuff. This still has
some incredibly subtle details that I'm working on getting
right.

llvm-svn: 42940
2007-10-13 00:11:23 +00:00
Anders Carlsson
24ebce6fca Generate code for va_start and va_end.
llvm-svn: 42939
2007-10-12 23:56:29 +00:00
Fariborz Jahanian
fd0312ed79 Patch to check for duplicate method decls in protocols.
llvm-svn: 42938
2007-10-12 23:43:31 +00:00
Chris Lattner
bee82b0675 remove dead method with bogus comment.
llvm-svn: 42937
2007-10-12 23:18:19 +00:00
Fariborz Jahanian
ecfe4f1453 Check and diagnose that objective-c objects may not be statically allocated.
llvm-svn: 42936
2007-10-12 22:10:42 +00:00
Arnold Schwaighofer
e8d0bf2669 Correcting the corrections. Bad bad baaad emacs!
llvm-svn: 42935
2007-10-12 21:53:12 +00:00
Arnold Schwaighofer
1f0da1fefb Corrected many typing errors. And removed 'nest' parameter handling
for fastcc from X86CallingConv.td.  This means that nested functions
are not supported for calling convention 'fastcc'.

llvm-svn: 42934
2007-10-12 21:30:57 +00:00
Ted Kremenek
41362cea7b Added notion of '*' specified format width/specifiers when checking
printf format strings.  Added type checking to see if the matching
width/precision argument was of type 'int'.

Thanks to Anders Carlsson for reporting this missing feature.

llvm-svn: 42933
2007-10-12 20:51:52 +00:00
Dan Gohman
e0ad9ea7cd Fix this test to not depend on the assembly output containing something
that includes the string "st". This probably fixes the regression on
Darwin.

llvm-svn: 42932
2007-10-12 20:42:14 +00:00
Chris Lattner
2c06f7ea45 add a new SM::getDecomposedFileLoc method.
llvm-svn: 42931
2007-10-12 20:24:19 +00:00
Devang Patel
371e6ca690 Dest type is always i8 *. This allows some simplification.
Do not filter memmove.

llvm-svn: 42930
2007-10-12 20:10:21 +00:00
Devang Patel
da53e9c9c1 t
llvm-svn: 42929
2007-10-12 20:04:24 +00:00
Fariborz Jahanian
02fbb68e85 Fixed typo in comment.
llvm-svn: 42928
2007-10-12 19:53:08 +00:00
Gordon Henriksen
3fb03e4080 Fix ocaml bindings for picky linkers. :)
Thanks to Török Edvin for helping to track this down.

llvm-svn: 42927
2007-10-12 19:48:13 +00:00
Fariborz Jahanian
c7afeebb12 Fixed a @compatible_alias bug. In the process, discovered unnecessary 2ndry lookup
ok class names and streamlined this logic to do the lookup once.

llvm-svn: 42926
2007-10-12 19:38:20 +00:00
Duncan Sands
a6286bd502 Due to the new tail call optimization, trampolines can no
longer be created for fastcc functions.

llvm-svn: 42925
2007-10-12 19:37:31 +00:00
Dale Johannesen
61c574fc51 ppc long double. Implement fabs and fneg.
llvm-svn: 42924
2007-10-12 19:02:17 +00:00
Steve Naroff
b915146a5d Replace one FIXME with another. We handle protocols just fine now. The ObjC decl will only be 0 when we have an error on the ObjC decl. I would prefer we pass in a decl that is marked as invalid. I don't think this is critical to fix now, however I'd like us to be consistent. There are currently many places that don't mark the decl as invalid (which need to be fixed)...
llvm-svn: 42923
2007-10-12 18:49:25 +00:00
Evan Cheng
409fa443fc Update.
llvm-svn: 42922
2007-10-12 18:22:55 +00:00
Chris Lattner
e6f1c3813d don't use intptr_t without including it.
llvm-svn: 42921
2007-10-12 18:16:23 +00:00
Chris Lattner
ad618f66e6 Fix a bug in my patch last night that broke InstCombine/2007-10-12-Crash.ll
llvm-svn: 42920
2007-10-12 18:05:47 +00:00
Dale Johannesen
a1a4a9ebfa Implement i64->ppcf128 conversions.
llvm-svn: 42919
2007-10-12 17:52:03 +00:00
Chris Lattner
4c461477bd Make this compute the correct offset, handling alignment of the element
pointer correctly.

llvm-svn: 42918
2007-10-12 17:49:52 +00:00
Anders Carlsson
431ef632cb Add some more diagnostics for va_start, fix tests so they pass with these new diags.
llvm-svn: 42917
2007-10-12 17:48:41 +00:00
Evan Cheng
1410b8512c Did mean to leave this in. INSERT_SUBREG isn't being coalesced yet.
llvm-svn: 42916
2007-10-12 17:16:50 +00:00
Fariborz Jahanian
d52cd41630 Fixed a bug whereby, struct tag name matches a typedef/objc-class name
and hid them.

llvm-svn: 42915
2007-10-12 16:34:10 +00:00
Steve Naroff
b213da2a70 Temporary fix to test case. This area is currently under construction...test case will be changing again soon.
llvm-svn: 42914
2007-10-12 16:15:17 +00:00
Neil Booth
d502a82092 Remove duplicate comment.
llvm-svn: 42913
2007-10-12 16:05:57 +00:00
Neil Booth
b93d90e98c Implement correctly-rounded decimal->binary conversion, i.e. conversion
from user input strings.

Such conversions are more intricate and subtle than they may appear;
it is unlikely I have got it completely right first time.  I would
appreciate being informed of any bugs and incorrect roundings you
might discover.

llvm-svn: 42912
2007-10-12 16:02:31 +00:00
Neil Booth
e9dbe094aa Remove a field that was never used.
llvm-svn: 42911
2007-10-12 15:35:10 +00:00
Neil Booth
146fdb3eeb If we're trying to be arbitrary precision, unsigned char clearly won't cut it. Needed for dec->bin conversions.
llvm-svn: 42910
2007-10-12 15:33:27 +00:00
Neil Booth
7e74b17ad2 Don't attempt to mask no bits
llvm-svn: 42909
2007-10-12 15:31:31 +00:00
Dan Gohman
dc35bd79ca Change the names used for internal labels to use the current
function symbol name instead of a codegen-assigned function
number.

Thanks Evan! :-)

llvm-svn: 42908
2007-10-12 14:53:36 +00:00
Dan Gohman
e3583817ac Fix some corner cases with vectors in copyToRegs and copyFromRegs.
llvm-svn: 42907
2007-10-12 14:33:11 +00:00
Dan Gohman
4f056f3c10 Add support to SplitVectorOp for powi, where the second operand
is a scalar integer.

llvm-svn: 42906
2007-10-12 14:13:46 +00:00
Dan Gohman
8d978da3b0 Mark vector ctpop, cttz, and ctlz as Expand on x86.
llvm-svn: 42905
2007-10-12 14:09:42 +00:00
Dan Gohman
9013eaff9a Mark vector pow, ctpop, cttz, and ctlz as Expand on PowerPC.
llvm-svn: 42904
2007-10-12 14:08:57 +00:00
Evan Cheng
11330f7526 Restrict EXTRACT_SUBREG coalescing to avoid negative performance impact.
llvm-svn: 42903
2007-10-12 09:15:53 +00:00
Evan Cheng
f8e28b152a Doh.
llvm-svn: 42901
2007-10-12 09:10:27 +00:00
Evan Cheng
b83a379f4f EXTRACT_SUBREG test case.
llvm-svn: 42900
2007-10-12 09:03:31 +00:00
Evan Cheng
aa2d6ef81d EXTRACT_SUBREG coalescing support. The coalescer now treats EXTRACT_SUBREG like
(almost) a register copy. However, it always coalesced to the register of the
RHS (the super-register). All uses of the result of a EXTRACT_SUBREG are sub-
register uses which adds subtle complications to load folding, spiller rewrite,
etc.

llvm-svn: 42899
2007-10-12 08:50:34 +00:00
Evan Cheng
89d5916921 Some clean up.
llvm-svn: 42898
2007-10-12 08:45:27 +00:00
Evan Cheng
6fd54fd19c Cosmetic.
llvm-svn: 42897
2007-10-12 08:40:44 +00:00
Evan Cheng
2e3d609da6 Fix typos.
llvm-svn: 42896
2007-10-12 08:39:02 +00:00
Evan Cheng
09c0fe0a7f Fold load / store into MOV32to32_ and MOV16to16_.
llvm-svn: 42895
2007-10-12 08:38:01 +00:00
Evan Cheng
f8c23f074b Flag MOV32to32_ with EXTRACT_SUBREG. They should not be scheduled apart.
llvm-svn: 42894
2007-10-12 07:55:53 +00:00
Arnold Schwaighofer
9653e677d5 Added missing -march=x86 flag.
llvm-svn: 42893
2007-10-12 07:49:48 +00:00
Gabor Greif
5d8f7e0cc7 eliminate warning
llvm-svn: 42892
2007-10-12 07:44:54 +00:00
Chris Lattner
d8675e4915 Fix some 80 column violations.
Fix DecomposeSimpleLinearExpr to handle simple constants better.
Don't nuke gep(bitcast(allocation)) if the bitcast(allocation) will
fold the allocation.  This fixes PR1728 and Instcombine/malloc3.ll

llvm-svn: 42891
2007-10-12 05:30:59 +00:00
Chris Lattner
3e99eb25ee testcase for PR1728
llvm-svn: 42890
2007-10-12 05:29:53 +00:00
Chris Lattner
7119397fa1 make operator== work with non-equal sized bitvectors, as long as
the extra bits are all zeros.  This allows  "010" and "010000" to be
treated as equal.

llvm-svn: 42889
2007-10-12 03:48:59 +00:00
Dale Johannesen
05ff9e8cda PPC long double. Implement a couple more conversions.
llvm-svn: 42888
2007-10-12 01:37:08 +00:00
Chris Lattner
3ec1bad331 add comments.
llvm-svn: 42887
2007-10-12 00:37:26 +00:00
Ted Kremenek
6a6c08c319 Printf argument checking now supports dynamically-passed precision
specifiers.

llvm-svn: 42886
2007-10-12 00:11:27 +00:00
Dan Gohman
be37007e64 Add intrinsics for sin, cos, and pow. These use llvm_anyfloat_ty, and so
may be overloaded with vector types. And add a testcase for codegen for
these.

llvm-svn: 42885
2007-10-12 00:01:22 +00:00
Dan Gohman
2a7de41682 Codegen support for vector intrinsics.
Factor out the code that expands the "nasty scalar code" for unrolling
vectors into a separate routine, teach it how to handle mixed
vector/scalar operands, as seen in powi, and use it for several operators,
including sin, cos, powi, and pow.

Add support in SplitVectorOp for fpow, fpowi and for several unary
operators.

llvm-svn: 42884
2007-10-11 23:57:53 +00:00
Fariborz Jahanian
49c6425ee6 This patch implementa objective-c's @compatibilty-alias declaration.
llvm-svn: 42883
2007-10-11 23:42:27 +00:00
Dale Johannesen
6472eb63c2 Implement ppc long double->uint conversion.
Make ppc long double constants print.

llvm-svn: 42882
2007-10-11 23:32:15 +00:00
Dan Gohman
482732af9d Set ISD::FPOW to Expand.
llvm-svn: 42881
2007-10-11 23:21:31 +00:00
Dan Gohman
fd66486950 Add runtime library names for pow.
llvm-svn: 42880
2007-10-11 23:09:10 +00:00
Dan Gohman
daee002438 Add an ISD::FPOW node type.
llvm-svn: 42879
2007-10-11 23:06:37 +00:00
Dan Gohman
3554448947 Add an explicit target triple to make this test behave as expected on
non-Apple hosts. And use the count script instead of wc + grep.

llvm-svn: 42878
2007-10-11 23:04:36 +00:00
Ted Kremenek
3b74526054 Provided accessors to internal allocator for ImutAVLTree and ImmutableSet.
Added postfix ++,-- support for ImmutableSet::iterator.

llvm-svn: 42877
2007-10-11 21:51:04 +00:00
Dale Johannesen
62f65edc32 Add missing argument to PALIGNR
llvm-svn: 42874
2007-10-11 20:58:37 +00:00
Gabor Greif
cb6832efe0 Fix an assertion abort on sparc. malloc(0) is allowed to
return NULL.

llvm-svn: 42871
2007-10-11 19:40:35 +00:00
Arnold Schwaighofer
9ccea99165 Added tail call optimization to the x86 back end. It can be
enabled by passing -tailcallopt to llc.  The optimization is
performed if the following conditions are satisfied:
* caller/callee are fastcc
* elf/pic is disabled OR
  elf/pic enabled + callee is in module + callee has
  visibility protected or hidden

llvm-svn: 42870
2007-10-11 19:40:01 +00:00
Arnold Schwaighofer
29cfef59ff Adding myself
llvm-svn: 42869
2007-10-11 18:54:49 +00:00
Chris Lattner
16a0de468f Push the rewriting APIs along. Build a trivial client that replaces tabs
with x's for now.  The APIs are all unimplemented, so it doesn't do 
anything yet! :)

llvm-svn: 42868
2007-10-11 18:38:32 +00:00
Fariborz Jahanian
d797113659 Implemented parsing of objctive-c protocol conforming type used in
an identifier statement. Fixed up pretty priting to print this type 
correctly.

llvm-svn: 42866
2007-10-11 18:08:47 +00:00
Dale Johannesen
007aa378ad Next PPC long double bits. First cut at constants.
No compile-time support for constant operations yet,
just format transformations.  Make readers and
writers work.  Split constants into 2 doubles in
Legalize.

llvm-svn: 42865
2007-10-11 18:07:22 +00:00
Devang Patel
899cc56612 Lower memcpy if it makes sense.
llvm-svn: 42864
2007-10-11 17:21:57 +00:00
Chris Lattner
168d63b289 add RewriterTest.cpp to xcode project.
llvm-svn: 42863
2007-10-11 16:34:20 +00:00
Chris Lattner
e9ab4ca686 clarify
llvm-svn: 42862
2007-10-11 16:06:02 +00:00
Chris Lattner
bbd5530754 make bitvector &= do the right thing if vectors have mismatched length.
llvm-svn: 42860
2007-10-11 06:12:33 +00:00
Chris Lattner
fc668d1233 Add a new use_iterator::atEnd() method, which allows us to shrink
pred_iterator down to a single ivar.

llvm-svn: 42859
2007-10-11 04:18:11 +00:00
Chris Lattner
f709a1495d slightly simplify interface
llvm-svn: 42858
2007-10-11 03:36:41 +00:00
Anders Carlsson
87c149bf51 Add __builtin_va_start to the list of builtins, make __builtin_va_list available to builtin functions.
llvm-svn: 42857
2007-10-11 01:00:40 +00:00
Fariborz Jahanian
70e8f1024a Patch to create protocol conforming class types.
llvm-svn: 42856
2007-10-11 00:55:41 +00:00
Chris Lattner
e99c8329af add scafolding to play around with and bring up the code rewriter.
llvm-svn: 42855
2007-10-11 00:43:27 +00:00
Chris Lattner
5039ac74c7 update argument.
llvm-svn: 42854
2007-10-11 00:38:03 +00:00
Chris Lattner
3472aeedfd rename -parse-ast-view to -ast-view
llvm-svn: 42853
2007-10-11 00:37:43 +00:00
Chris Lattner
5e4c75f4ef rename -parse-ast-print to -ast-print
rename -parse-ast-dump to -ast-dump
remove -parse-ast, which is redundant with -fsyntax-only

llvm-svn: 42852
2007-10-11 00:18:28 +00:00
Ted Kremenek
41eee516d7 Added iterators to ImmutableSet.
llvm-svn: 42851
2007-10-11 00:14:49 +00:00
Ted Kremenek
6a97cf6d65 Added some doxygen comments to ImmutableSet.
llvm-svn: 42850
2007-10-10 23:47:03 +00:00
Chris Lattner
9c7a0361c0 Fix 80 col violations.
llvm-svn: 42849
2007-10-10 23:42:28 +00:00
Ted Kremenek
abd77cccb8 Removed uninformative assertions that catch problems that will
fire anyway at runtime due to a NULL dereference.

llvm-svn: 42848
2007-10-10 23:35:04 +00:00
Ted Kremenek
4d984579da Removed "height" of an AVL tree node from its Profile. This is
implicitly captured by using the addresses of its children in the
profile.

llvm-svn: 42847
2007-10-10 23:32:01 +00:00
Chris Lattner
7b4ab65c7d fix a bunch of regressions I introduced :(
llvm-svn: 42846
2007-10-10 23:31:03 +00:00
Steve Naroff
783a7a0698 Refinements to Sema::GetObjcIdType()...
- Cache the typedef, not the type (avoids importing AST/Type.h).
- Emit an error if "id" cannot be found.
- Comment the routine and add a FIXME to reconsider how we emulate GCC's new fangled behavior. This isn't a priority for now, since almost no code depends on having "id" built-in.
- Add a test.

llvm-svn: 42845
2007-10-10 23:24:43 +00:00
Ted Kremenek
a1cf09f51d Commented out header with no section body. Will write this eventually.
llvm-svn: 42844
2007-10-10 23:22:00 +00:00
Ted Kremenek
035b0cd34a Added some documentation on clang CFGs. It is very rough.
llvm-svn: 42843
2007-10-10 23:01:43 +00:00
Steve Naroff
7f549f1897 - Make sure default return/argument types (for methods) default to "id".
- Cache the "id" type in Sema...initialize ObjcIdType and TUScope (oops).
- Fix ActOnInstanceMessage to allow for "id" type receivers...still work to do (next).

llvm-svn: 42842
2007-10-10 21:53:07 +00:00
Chris Lattner
d2b8ce4259 avoid accessing off the end of identifiers.
llvm-svn: 42841
2007-10-10 20:59:57 +00:00
Anders Carlsson
db83d77c78 Emit a warning when the body of an if block is a NullStmt.
llvm-svn: 42840
2007-10-10 20:50:11 +00:00
Ted Kremenek
4479f86c0f Removed spurious forward declaration to a structure that will no longer be used.
llvm-svn: 42839
2007-10-10 20:45:34 +00:00
Chris Lattner
3ff2e69713 clang -E should not print tokens from the predefines buffer.
llvm-svn: 42838
2007-10-10 20:45:16 +00:00
Ted Kremenek
45f3bb8239 Added some doxygen comments to a few methods of ImutAVLTree.
llvm-svn: 42837
2007-10-10 20:44:21 +00:00
Hartmut Kaiser
3fa191b6b2 Updated VC++ build system.
llvm-svn: 42836
2007-10-10 19:50:45 +00:00
Hartmut Kaiser
04bd66bd43 Updated VC++ build system.
llvm-svn: 42835
2007-10-10 19:50:09 +00:00
Ted Kremenek
9e9dae0b57 Added idea for a simple C++ checker.
llvm-svn: 42834
2007-10-10 18:52:22 +00:00
Ted Kremenek
6c5107ced1 Added preliminary support for iterators in ImutAVLTree.
Implemented ImutAVLTree::isEqual.

llvm-svn: 42833
2007-10-10 18:11:16 +00:00
Chris Lattner
d9c9c919da Fix CodeGen/Generic/BasicInstrs.llx on sparc by marking divrem
illegal.  Thanks to gabor for pointing this out!

llvm-svn: 42832
2007-10-10 18:10:57 +00:00
Chris Lattner
a9839f73fb add an idea
llvm-svn: 42831
2007-10-10 18:08:07 +00:00
Chris Lattner
ed2a9eb820 resolve a fixme, by moving __builtin_va_list to a more logical
place and making it correctly parameterized on the target.

llvm-svn: 42830
2007-10-10 17:48:53 +00:00
Steve Naroff
8308f60d51 Fix a latent bug in MinimalActions (created by a recent name change).
llvm-svn: 42829
2007-10-10 17:45:44 +00:00
Steve Naroff
93eb5f1438 Remove Scope argument from ObjC actions that either don't need it or can now use TUScope.
Also improve a recently added comment.

llvm-svn: 42826
2007-10-10 17:32:04 +00:00
Ted Kremenek
0818f6e7e4 Renamed internal method "Create" of ImutAVLTree to "CreateNode".
llvm-svn: 42825
2007-10-10 16:27:33 +00:00
Duncan Sands
56ab90d3ad Correct swapped arguments to getConstant.
llvm-svn: 42824
2007-10-10 09:54:50 +00:00
Bill Wendling
f7c7ed2740 Fix 80-column violations
llvm-svn: 42823
2007-10-10 05:45:59 +00:00
Dale Johannesen
666323eacd Next PPC long double bits: ppcf128->i32 conversion.
Surprisingly complicated.
Adds getTargetNode for 2 outputs, no inputs (missing).

llvm-svn: 42822
2007-10-10 01:01:31 +00:00
Evan Cheng
a9830a04eb Bad choice of variable name.
llvm-svn: 42821
2007-10-10 00:11:40 +00:00
Evan Cheng
ad55a6079a Fix an extremely stupid bug that prevented first round of coalescing (physical registers only) from happening.
llvm-svn: 42820
2007-10-09 23:36:27 +00:00
Chris Lattner
5d45178179 Add a dummy for the id typedef. Steve, plz fill this in. :)
llvm-svn: 42819
2007-10-09 22:58:09 +00:00
Chris Lattner
1f1b0dbc28 Make a significant change to invert the control flow handling
predefined macros.  Previously, these were handled by the driver,
now they are handled by the preprocessor.

Some fallout of this:

1. Instead of preprocessing two buffers (the predefines, then the 
   main source file)  we now start preprocessing the main source 
   file and inject the predefines as a "psuedo #include" from the
   main source file.
2. #1 allows us to nuke the Lexer::IsMainFile flag and simplify
   Preprocessor::isInPrimaryFile.
3. The driver doesn't have to know about standard #defines, the
   preprocessor knows, which is nice for people wanting to define
   their own drivers.
4. This allows us to put normal tokens in the predefine buffer,
   for example a definition for __builtin_va_list that is 
   target-specific, and a typedef for id in objc.

llvm-svn: 42818
2007-10-09 22:10:18 +00:00
Steve Naroff
c62adb6d1a Make sure methods with no return type default to "id".
This fixes a crasher in Sema::MatchTwoMethodDeclarations(), identified by selector-overload.m (just added).

Added Action::ActOnTranslationUnitScope() and renamed Action::PopScope to ActOnPopScope.

Added a Translation Unit Scope instance variable to Sema (will be very useful to ObjC-related actions, since ObjC declarations are always file-scoped).

llvm-svn: 42817
2007-10-09 22:01:59 +00:00
Ted Kremenek
230c6cc516 Modified XCode project to contain...
ADT/DenseSet.h
ADT/ImmutableMap.h
ADT/ImmutableSet.h

llvm-svn: 42816
2007-10-09 21:49:49 +00:00
Chris Lattner
f5ea386698 Add new MemoryBuffer::getMemBufferCopy method.
llvm-svn: 42815
2007-10-09 21:46:38 +00:00
Devang Patel
1999d22b7f Fix indentation.
llvm-svn: 42814
2007-10-09 21:41:00 +00:00
Ted Kremenek
12bfa1ccbc Added implementation of immutable (functional) maps and sets, as
implemented on top of a functional AVL tree.  The AVL balancing code
is inspired by the OCaml implementation of Map, which also uses a functional
AVL tree.

Documentation is currently limited and cleanups are planned, but this code
compiles and has been tested.

llvm-svn: 42813
2007-10-09 21:38:09 +00:00
Devang Patel
2af23f976b Do not walk invalid iterator.
llvm-svn: 42812
2007-10-09 21:31:36 +00:00
Devang Patel
152f18f671 Recognize while(1) and avoid extra blocks.
llvm-svn: 42811
2007-10-09 20:51:27 +00:00
Devang Patel
f8a76755df new test
llvm-svn: 42810
2007-10-09 20:37:41 +00:00
Chris Lattner
87547e6c15 avoid a noop virtual method call on the hot scope poping path.
llvm-svn: 42809
2007-10-09 20:37:18 +00:00
Devang Patel
c1380400d5 Recognize "do {} while (0)" idiom and avoid extra basic blocks.
llvm-svn: 42808
2007-10-09 20:33:39 +00:00
Devang Patel
7ad0c2f1f9 Use LLVMFoldingBuilder
llvm-svn: 42807
2007-10-09 19:49:58 +00:00
Devang Patel
530f975cf0 Add LLVMFoldingBuilder
llvm-svn: 42806
2007-10-09 19:49:19 +00:00
Dan Gohman
850ff11022 Remove an unnecessary friend declaration.
llvm-svn: 42805
2007-10-09 18:39:48 +00:00
Fariborz Jahanian
eb2b34a9a5 Remove comment about protocols and namespace no longer relevant.
llvm-svn: 42804
2007-10-09 18:28:41 +00:00
Fariborz Jahanian
c8e7a93b02 Minor code clean up to make it more readable.
llvm-svn: 42803
2007-10-09 18:22:59 +00:00
Chris Lattner
516ca70f5d Update DeclKind enums to reflect ObjcProtocolDecl's inheritance change.
llvm-svn: 42802
2007-10-09 18:18:24 +00:00
Fariborz Jahanian
06f84f5f84 Remove addition of protocol names to declaration scopes, use a separate
DenseMap to keep track of such declarations and derive ObjcProtocolDecl
directyly from NamedScope.

llvm-svn: 42801
2007-10-09 18:03:53 +00:00
Chris Lattner
3c69f12cbc convert driver over to use Token::is/isNot APIs. fwew, all done.
llvm-svn: 42800
2007-10-09 18:03:42 +00:00
Chris Lattner
98c1f7cfde Switch lexer/pp over to new Token::is/isNot api
llvm-svn: 42799
2007-10-09 18:02:16 +00:00
Chris Lattner
0ef1352a94 swtich to Token::is/isNot
llvm-svn: 42798
2007-10-09 17:51:17 +00:00
Chris Lattner
feb00b6e12 switch more code to use Token::is/isNot where possible.
llvm-svn: 42797
2007-10-09 17:41:39 +00:00
Chris Lattner
76c7228ef9 switch some more of the parser over to using Token::is and isNot
llvm-svn: 42796
2007-10-09 17:33:22 +00:00
Chris Lattner
0ab032aa8f Add two new Token helper functions, "is" and "isNot". This allows us to write
stuff like this:

       // If we don't have a comma, it is either the end of the list (a ';') or
       // an error, bail out.
       if (Tok.isNot(tok::comma))
         break;
instead of:
       // If we don't have a comma, it is either the end of the list (a ';') or
       // an error, bail out.
       if (Tok.getKind() != tok::comma)
         break;

There is obviously no functionality change, but the code reads a bit better and is 
more terse.

llvm-svn: 42795
2007-10-09 17:23:58 +00:00
Fariborz Jahanian
f483847233 Added better comment about protocol list for class ObjcQualifiedInterfaceType.
llvm-svn: 42794
2007-10-09 17:14:13 +00:00
Chris Lattner
a55a2cc25c rename some "Parse" actions to "ActOn". Move code around in
ParseFunctionDefinition so that ActOnFunctionDefBody is always
called if ActOnStartOfFunctionDef is called.  This fixes a crash
reported by Nuno Lopes.

llvm-svn: 42793
2007-10-09 17:14:05 +00:00
Devang Patel
eac5948348 Use const& for RHS.
Use copy for LHS, because it is incremented using ++ operator.

llvm-svn: 42792
2007-10-09 17:10:59 +00:00
Devang Patel
49a44f3b52 Fix comment. Describe what it is, instead of how it is used.
llvm-svn: 42791
2007-10-09 17:08:50 +00:00
Fariborz Jahanian
cb995d8981 Prevent memory leak by not creating a category object when there is a
fatal error of category's undefined interface.

llvm-svn: 42790
2007-10-09 17:05:22 +00:00
Chris Lattner
fc16c0a026 update prototype, fixing build error
llvm-svn: 42789
2007-10-09 16:27:44 +00:00
Dan Gohman
66966403ce Pass argc by value, not by reference, since it isn't modified.
llvm-svn: 42788
2007-10-09 16:04:57 +00:00
Dan Gohman
e8c8ef5234 LowerIntegerDivOrRem no longer exists.
llvm-svn: 42787
2007-10-09 15:45:13 +00:00
Dan Gohman
51554bf30e Fix grammar in a comment.
llvm-svn: 42786
2007-10-09 15:44:37 +00:00
Dan Gohman
6d28778bfd This is done.
llvm-svn: 42785
2007-10-09 15:42:21 +00:00
Dan Gohman
678387a299 These two tests now require only two multiply instructions,
instead of four.

llvm-svn: 42784
2007-10-09 15:39:37 +00:00
Evan Cheng
82bc90ac60 Under 64-bit mode use LEA64_32r instead of LEA64r to save a byte.
llvm-svn: 42783
2007-10-09 07:14:53 +00:00
Chris Lattner
38d49f5d90 Fix problems where DenseMap used operator!= instead of correctly
calling the traits implementation of isEqual.

llvm-svn: 42782
2007-10-09 05:42:12 +00:00
Chris Lattner
5c50f59690 Change a #include into a forward declaration
llvm-svn: 42781
2007-10-09 03:40:30 +00:00
Bruno Cardoso Lopes
66d9572ced Position Independent Code (PIC) support [3]
llvm-svn: 42780
2007-10-09 03:15:11 +00:00
Bruno Cardoso Lopes
35d86e60b6 Position Independent Code (PIC) support [2]
- Added a function to hold the stack location 
  where GP must be stored during LowerCALL
- AsmPrinter now emits directives based on
  relocation type
- PIC_ set to default relocation type (same as GCC)

llvm-svn: 42779
2007-10-09 03:01:19 +00:00
Bruno Cardoso Lopes
5cef9cfd09 Position Independent Code (PIC) support [1]
- Modified instruction format to handle pseudo instructions
- Added LoadAddr SDNode to load symbols.

llvm-svn: 42778
2007-10-09 02:55:31 +00:00
Steve Naroff
8e748cb4e9 Remove 2 protocol related actions from MinimalActions (protocols shouldn't be recognized as types).
llvm-svn: 42777
2007-10-08 23:10:47 +00:00
Fariborz Jahanian
da6c012ee7 Added a new class for Interfaces qualified by protocol list.
Protocols are now sorted and made unique in the list.
Enhanced pretty printer for @interface (So, I can see the protocol list).

llvm-svn: 42776
2007-10-08 23:06:41 +00:00
Evan Cheng
3b3e6097a3 Update test.
llvm-svn: 42775
2007-10-08 22:20:32 +00:00
Evan Cheng
f5ec10b64c Bug fix. X86 was emitting redundant setcc and test instructions before a conditional move.
llvm-svn: 42774
2007-10-08 22:16:29 +00:00
Steve Naroff
b163154c2d Removed unused instance variable from FieldDecl.
llvm-svn: 42773
2007-10-08 21:56:47 +00:00
Chris Lattner
ba9dddb01e Rename FileVariable -> FileVar for consistency with its class name,
likewise block and param.  Reorder the layout of the Decl kind enum
so that the inheritance tree is reflected in the ordering.  This allows
trivial range comparisons to determine whether something is an instance
of some abstract class, making classof faster.

llvm-svn: 42772
2007-10-08 21:37:32 +00:00
Chris Lattner
15b7278931 add a comment.
llvm-svn: 42771
2007-10-08 21:36:22 +00:00
Chris Lattner
6776a8d359 Move identifierTable.h to the right folder.
llvm-svn: 42770
2007-10-08 21:35:59 +00:00
Dan Gohman
5942e5a5fb Call getFunctionNumber() instead of referencing FunctionNumber directly,
for consistency.

llvm-svn: 42769
2007-10-08 21:27:12 +00:00
Dan Gohman
ac546cc28f Mark the prefetch intrinsic as IntrWriteArgMem, instead of the
default of IntrWriteMem, to at least indicate that it doesn't
"capture" the argument pointer.

llvm-svn: 42768
2007-10-08 21:15:07 +00:00
Steve Naroff
71c3c1c715 Convert Selector Maps/Sets to use stronger typing (now that we have DenseMapInfo in IdentifierTable.h).
llvm-svn: 42767
2007-10-08 21:05:34 +00:00
Devang Patel
1166312e8b Code gen case statement ranges.
llvm-svn: 42766
2007-10-08 20:57:48 +00:00
Dan Gohman
a24b431b27 These two tests now require only three multiply instructions,
instead of four.

llvm-svn: 42765
2007-10-08 20:48:12 +00:00
Fariborz Jahanian
e90597f593 Several small patches to do pretty printing for objective-c top-level decls
(minimal printing), Derive ObjcClassDecl from Decl. Ted may want to 
take note of the change I made to CFGRecStmtDeclVisitor.h

llvm-svn: 42764
2007-10-08 18:53:38 +00:00
Chris Lattner
104c48ab8f Various improvements to the documentation, contributed by
Joshua Haberman!

llvm-svn: 42763
2007-10-08 18:42:45 +00:00
Dan Gohman
a160361c85 Migrate X86 and ARM from using X86ISD::{,I}DIV and ARMISD::MULHILO{U,S} to
use ISD::{S,U}DIVREM and ISD::{S,U}MUL_HIO. Move the lowering code
associated with these operators into target-independent in LegalizeDAG.cpp
and TargetLowering.cpp.

llvm-svn: 42762
2007-10-08 18:33:35 +00:00
Evan Cheng
18109c88c3 Allow x86 compare to be commutable by default.
llvm-svn: 42761
2007-10-08 18:27:46 +00:00
Gordon Henriksen
44dd8fbd26 C and Objective Caml bindings for PHINode::addIncoming etc.
llvm-svn: 42760
2007-10-08 18:14:39 +00:00
Dan Gohman
5c6d0c3b99 DAGCombiner support for UDIVREM/SDIVREM and UMUL_LOHI/SMUL_LOHI.
Check if one of the two results unneeded so see if a simpler operator
could bs used. Also check to see if each of the two computations could be
simplified if they were split into separate operators. Factor out the code
that calls visit() so that it can be used for this purpose.

llvm-svn: 42759
2007-10-08 17:57:15 +00:00
Evan Cheng
4c73befe28 LLVM does not use the old style simple isel any more.
llvm-svn: 42758
2007-10-08 17:54:24 +00:00
Evan Cheng
acc8b68e5f Remove debugging printf to get build going on x86-64.
llvm-svn: 42757
2007-10-08 17:49:43 +00:00
Fariborz Jahanian
092e34d15b Removed unnecessary base class from some of objective-c classes:
ObjcProtocolDecl is now derived from ScopedDecl. ObjcForwardProtocolDecl from Decl.
ObjcImplementationDecl fom NamedDecl.

llvm-svn: 42756
2007-10-08 17:35:11 +00:00
Dan Gohman
71f0d7d76e When we start enabling SMUL_LOHI/UMUL_LOHI or SDIVREM/UDIVREM in
target-indepenent lowering, don't use them on PowerPC.

llvm-svn: 42755
2007-10-08 17:28:24 +00:00
Fariborz Jahanian
4b2113c281 Return NULL on invalid protocol.
llvm-svn: 42754
2007-10-08 16:07:03 +00:00
Dan Gohman
b08c8bfe41 Add convenience overloads of SelectionDAG::getNode that take a SDVTList
and individual SDOperand operands.

llvm-svn: 42753
2007-10-08 15:49:58 +00:00
Dan Gohman
2c6a821fd7 Move the space in overview output for commands out of each of the
commands and into the common code.

llvm-svn: 42752
2007-10-08 15:45:12 +00:00
Dan Gohman
afedc063ab Simplify getIntPtrType, allowing it to work for arbitrary pointer sizes.
llvm-svn: 42751
2007-10-08 15:16:25 +00:00
Dan Gohman
5e79a6108f Use correct parentheses with the '&& "..."' idiom in an assert.
llvm-svn: 42750
2007-10-08 15:13:30 +00:00
Dan Gohman
fadf40a655 In -debug mode, dump SelectionDAGs both before and after the
optimization passes.

llvm-svn: 42749
2007-10-08 15:12:17 +00:00
Dan Gohman
ea3c73629f Fix grammar in a comment.
llvm-svn: 42748
2007-10-08 15:10:04 +00:00
Dan Gohman
13ab93efde Add explicit keywords.
llvm-svn: 42747
2007-10-08 15:08:41 +00:00
Neil Booth
49c6aab7b8 Use APInt::tcExtract. It's cleaner, and works :)
llvm-svn: 42746
2007-10-08 14:39:42 +00:00
Neil Booth
b618216e56 Add a new function tcExtract for extracting a bignum from an
arbitrary range of bits embedded in the middle of another bignum.
This kind of operation is desirable in many cases of software
floating point, e.g. converting bignum integers to floating point
numbers of fixed precision (you want to extract the precision most
significant bits).

Elsewhere, add an assertion, and exit the shift functions early if
the shift count is zero.

llvm-svn: 42745
2007-10-08 13:47:12 +00:00
Gordon Henriksen
acf684315e Fixed downrev Ocaml compatibility.
llvm-svn: 42744
2007-10-08 12:16:59 +00:00
Owen Anderson
74529b7d5f Begin the process of allowing DomTree on MBB's. Step One: template DomTreeNode by making it a typedef of a templated DomTreeNodeBase.
llvm-svn: 42743
2007-10-08 07:44:39 +00:00
Evan Cheng
21a58a72c5 Kill cycle of an live range is always the last use index + 1.
llvm-svn: 42742
2007-10-08 06:59:30 +00:00
Chris Lattner
bcd30bb0cd Allow passes to just pass up "FunctionPass(&ID)" instead of "FunctionPass((intptr_t)&ID)"
llvm-svn: 42741
2007-10-08 03:45:44 +00:00
Gordon Henriksen
783f7bbabd C and Objective Caml bindings for getFunction and getNamedGlobal. Also enhanced
the Objective Caml 'declare_*' functions to behave more or less like
getOrInsertFunction.

llvm-svn: 42740
2007-10-08 03:45:09 +00:00
Chris Lattner
b20757d578 disable this entirely: it is causing use of invalidated iterators and infinite looping.
llvm-svn: 42739
2007-10-07 22:00:31 +00:00
Chris Lattner
8dd66ab3b2 Fix many regressions on x86 by avoiding dereferencing the end iterator.
llvm-svn: 42738
2007-10-07 21:53:12 +00:00
Chris Lattner
7cdae91966 Finish off PR1723, by working around some strange compiler bug.
llvm-svn: 42737
2007-10-07 17:57:10 +00:00
Gordon Henriksen
751ebf7b9a C and Objective Caml bindings for GlobalVariable::isConstant.
llvm-svn: 42736
2007-10-07 17:31:42 +00:00
Neil Booth
03f58ab706 Add back convertFromSignExtendedInteger.
llvm-svn: 42735
2007-10-07 12:15:41 +00:00
Neil Booth
ba205229e7 Now that convertFromUnsignedParts has a sane, constant interface,
convertFromZeroExtendedInteger can be simplified as it doesn't need
to make a copy of the source bignum.

llvm-svn: 42734
2007-10-07 12:10:57 +00:00
Neil Booth
6c1c8588ae Reimplement convertFromUnsignedInteger so it is passed a const bignum.
It used to modify its argument in-place.

This interface is saner and the implementation more efficient.  It will
be needed for decimal->binary conversion.

llvm-svn: 42733
2007-10-07 12:07:53 +00:00
Neil Booth
5f00973393 convertFromInteger, as originally written, expected sign-extended
input.  APInt unfortunately zero-extends signed integers, so Dale
modified the function to expect zero-extended input.  Make this
assumption explicit in the function name.

llvm-svn: 42732
2007-10-07 11:45:55 +00:00
Chris Lattner
c330d008f4 remove unneeded #include
llvm-svn: 42731
2007-10-07 08:59:27 +00:00
Chris Lattner
ef6b136781 move IdentifierTable.h from liblex to libbasic.
llvm-svn: 42730
2007-10-07 08:58:51 +00:00
Neil Booth
d3985924f4 combineLostFractions does not need to be a member function
llvm-svn: 42729
2007-10-07 08:51:21 +00:00
Chris Lattner
4894f485c7 implement the Token class in the Lexer.cpp file instead of IdentifierInfo.cpp
llvm-svn: 42728
2007-10-07 08:47:24 +00:00
Chris Lattner
c43ddc84a3 improve layering:
Now instead of IdentifierInfo knowing anything about MacroInfo,
only the preprocessor knows.  This makes MacroInfo truly private
to the Lex library (and its direct clients) instead of being 
accessed in the Basic library.

llvm-svn: 42727
2007-10-07 08:44:20 +00:00
Chris Lattner
259716a6e1 change calls to getMacroInfo into hasMacroDefinition() where possible.
llvm-svn: 42726
2007-10-07 08:04:56 +00:00
Chris Lattner
d7b971bf3d add a hasMacroDefinition() method to IdentifierInfo, strength reduce a
call to getMacroInfo to call it.

llvm-svn: 42725
2007-10-07 07:57:27 +00:00
Chris Lattner
f49523d6ea update comment.
llvm-svn: 42724
2007-10-07 07:54:23 +00:00
Chris Lattner
ff067ce555 Remove the PPID bitfield from IdentifierInfo, shrinking it by a word
(because all bitfields now fit in 32 bits).  This shrinks the identifier
table for carbon.h from 1634428 to 1451424 bytes (12%) and has no impact 
on compile time.

llvm-svn: 42723
2007-10-07 07:52:34 +00:00
Chris Lattner
a441ca651f First step to fixing a long lived layering violation: this
moves the MacroInfo pointer to a side hash table (which currently 
lives in IdentifierTable.cpp).  This removes a pointer from 
Identifier info, but doesn't shrink it, as it requires a new bit 
be added.  This strange approach with the 'hasmacro' bit is needed
to not lose preprocessor performance.

llvm-svn: 42722
2007-10-07 07:09:52 +00:00
Chris Lattner
65cc87ffc2 The identifier shouldn't be added to the scope, the decl should.
This fixes strange assertions that just started triggering.

llvm-svn: 42721
2007-10-07 07:05:08 +00:00
Chris Lattner
65fc0f1fca classof isn't right. This is causing assertion failures somehow now.
llvm-svn: 42720
2007-10-07 07:04:41 +00:00
Chris Lattner
730160d32f Shrink the builtinID down by 3 bits, allowing all the bitfields to
fit in 32-bits, shrinking IdentifierInfo by a word.

This shrinks the total size of the identifier pool from 
1817264 to 1634428 bytes (11%) on carbon.h.

llvm-svn: 42719
2007-10-07 06:29:32 +00:00
Chris Lattner
d1cdee7d1f Rename ASTStreamers.* -> ASTConsumers.*
llvm-svn: 42718
2007-10-07 06:04:32 +00:00
Daniel Berlin
fb6a79cdd5 Some more problems noticed by Curtis
llvm-svn: 42717
2007-10-07 04:47:57 +00:00
Chris Lattner
5700fab189 simplify the interfaces to create selectors: getSelector can take any
number of arguments now and does the right thing, but the nullary/unary
accessors are preserved as convenience functions.  This allows us to
slightly simplify clients.

llvm-svn: 42716
2007-10-07 02:00:24 +00:00
Chris Lattner
f7f34d09e4 simplify some Selector interfaces.
llvm-svn: 42715
2007-10-07 01:33:16 +00:00
Chris Lattner
ee2d84133c move ImplementationClassInfo out of ASTContext into Sema.
llvm-svn: 42714
2007-10-07 01:13:46 +00:00
Gordon Henriksen
ffb4876cfb C and Objective Caml bindings for PATypeHolder.
llvm-svn: 42713
2007-10-07 00:13:35 +00:00
Chris Lattner
efc0b5e372 add comments.
llvm-svn: 42712
2007-10-06 23:30:21 +00:00
Chris Lattner
6a2b09ecd9 switch ObjcCategoryImplDecl over to being a NamedDecl, remove dead ctor argument.
llvm-svn: 42711
2007-10-06 23:12:31 +00:00
Chris Lattner
a4016555d2 introduce a new NamedDecl class, switch a couple of things over to using it.
NamedDecl is a Decl that has an IdentifierInfo (for example, ScopedDecl), 
but not ObjcMethodDecl.

Simplify some code in ActOnAddMethodsToObjcDecl, by doing the cast from 
DeclTy to Decl at the start of the method.

llvm-svn: 42710
2007-10-06 22:53:46 +00:00
Chris Lattner
18d3a13bef Every decl has a SourceLocation, move the location info into the Decl class instead of being in subclasses.
llvm-svn: 42709
2007-10-06 22:16:01 +00:00
Kevin
6261e98ea8 future notes & minor changes
llvm-svn: 42708
2007-10-06 21:28:47 +00:00
Gordon Henriksen
c3d661a0ee Bindings for the verifier.
llvm-svn: 42707
2007-10-06 21:00:36 +00:00
Chris Lattner
ae0ec1d09f simplify the interface to create ObjcClassDecl's.
llvm-svn: 42706
2007-10-06 20:08:36 +00:00
Chris Lattner
11eca782a3 simplify the interface for creating ObjcForwardProtocolDecl
llvm-svn: 42705
2007-10-06 20:05:59 +00:00
Chris Lattner
f0d15d470f add a missing ;
llvm-svn: 42704
2007-10-06 19:08:22 +00:00
Chris Lattner
5ccf60fc44 stub out some printing of objc decls.
llvm-svn: 42703
2007-10-06 18:52:10 +00:00
Gordon Henriksen
8689fa69e2 Deleting some unnecessary glue.
llvm-svn: 42702
2007-10-06 17:10:44 +00:00
Gordon Henriksen
fc560cef9a Adopting a uniform naming convention for type constructors in
bindings (part le deux).

llvm-svn: 42701
2007-10-06 16:56:09 +00:00
Anton Korobeynikov
67ac2de8bf Oops, I really wanted to commit this part also :)
llvm-svn: 42700
2007-10-06 16:39:43 +00:00
Anton Korobeynikov
c59496f737 Move merge code into new helper function.
llvm-svn: 42699
2007-10-06 16:17:49 +00:00
Gordon Henriksen
ed7beaa3fa Adopting a uniform naming convention for type constructors in bindings.
llvm-svn: 42698
2007-10-06 16:05:20 +00:00
Gordon Henriksen
1046c73d12 Adopting a uniform naming convention for constant constructors in bindings.
llvm-svn: 42697
2007-10-06 15:11:06 +00:00
Gordon Henriksen
7ce3176696 Adding C and Ocaml bindings for ConstantExpr.
llvm-svn: 42696
2007-10-06 14:29:36 +00:00
Anton Korobeynikov
8d8f94c278 Include DataTypes.h to provide intptr_t type. This fixes OpenBSD compilation of this file.
Inspired by Laurence Tratt's patch

llvm-svn: 42695
2007-10-06 13:07:11 +00:00
Evan Cheng
0de312dd7d Reapply 42677.
llvm-svn: 42692
2007-10-06 08:19:55 +00:00
Evan Cheng
8ff5335bb6 Oops. Forgot this.
llvm-svn: 42691
2007-10-06 08:09:29 +00:00
Neil Booth
32897f5eb0 Cleaner, more general exponent output.
llvm-svn: 42690
2007-10-06 07:29:25 +00:00
Chris Lattner
b2d486a357 speed up clang startup another 28% by avoiding std::vector<std::string>
for holding builtin target-specific macros.

llvm-svn: 42689
2007-10-06 06:57:34 +00:00
Chris Lattner
b5fc6fbcfc speed up clang startup time by about 23% by avoiding lots of
stringmap operations when there are no secondary targets.

llvm-svn: 42688
2007-10-06 06:29:41 +00:00
Chris Lattner
2a9bcb9ea7 silence warnings in no-assert build.
llvm-svn: 42687
2007-10-06 06:13:42 +00:00
Chris Lattner
82217bd155 revert evan's patch until the header is committed
llvm-svn: 42686
2007-10-06 06:08:17 +00:00
Chris Lattner
17b1330b04 fix grammaro
llvm-svn: 42685
2007-10-06 05:48:57 +00:00
Chris Lattner
a1513f7198 edits
llvm-svn: 42684
2007-10-06 05:42:47 +00:00
Chris Lattner
25d8a70dc3 fix accidental commit
llvm-svn: 42683
2007-10-06 05:38:32 +00:00
Chris Lattner
609ca3ec97 edits
llvm-svn: 42682
2007-10-06 05:30:19 +00:00
Chris Lattner
01607a94c0 various minor edits, e.g. & -> &amp;
llvm-svn: 42681
2007-10-06 05:23:00 +00:00
Kevin
eddf1f0966 New directory.
llvm-svn: 42680
2007-10-06 05:15:30 +00:00
Chris Lattner
48ce755498 add a warning.
llvm-svn: 42679
2007-10-06 05:13:47 +00:00
Chris Lattner
8c03979f91 minor edits
llvm-svn: 42678
2007-10-06 05:09:04 +00:00
Evan Cheng
f4b5d491df Added DAG xforms. e.g.
(vextract (v4f32 s2v (f32 load $addr)), 0) -> (f32 load $addr) 
(vextract (v4i32 bc (v4f32 s2v (f32 load $addr))), 0) -> (i32 load $addr)
Remove x86 specific patterns.

llvm-svn: 42677
2007-10-06 02:46:29 +00:00
Bill Wendling
bc03521fc9 Fix spacing issues.
llvm-svn: 42676
2007-10-06 01:56:01 +00:00
Bill Wendling
650dcf6027 Just say "No" to non-ASCII things.
llvm-svn: 42675
2007-10-06 01:53:09 +00:00
Bill Wendling
3ef6b60eeb Remove non-ASCII '
llvm-svn: 42674
2007-10-06 01:44:57 +00:00
Kevin
4fbcd6c01b 1. May fix encoding issues: server uses UTF; HTML file assumes Western (ISO 8859-1).
2. Added strict doctype.

Closing out tags like <br/> and <meta.../> may still be a problem (necessary for XHTML, but wrong for HTML)....

llvm-svn: 42673
2007-10-06 01:28:23 +00:00
Dale Johannesen
f864ac96d8 Next powerpc long double bits. Comparisons work,
although not well, and shortening FP converts.

llvm-svn: 42672
2007-10-06 01:24:11 +00:00
Dale Johannesen
bcfa7c1255 Make test work on non-x86 hosts.
llvm-svn: 42671
2007-10-06 01:22:39 +00:00
Neil Booth
c8b650ab14 Fix and clarify some comments.
llvm-svn: 42670
2007-10-06 00:43:45 +00:00
Neil Booth
0ea72a9a91 Generalize tcFullMultiply so that the operands can be of differing
part widths.  Also, return the number of parts actually required to
hold the result's value.
Remove an over-cautious condition from rounding of float->hex conversion.

llvm-svn: 42669
2007-10-06 00:24:48 +00:00
Gordon Henriksen
1d0d24c4fd Wrapping Value::dump.
llvm-svn: 42668
2007-10-06 00:08:49 +00:00
Gordon Henriksen
7330acdec7 Removing the silly CHelpers header by rolling wrap and unwrap into the C
bindings headers themselves, hidden behind #ifdef __cplusplus.

llvm-svn: 42666
2007-10-05 23:59:36 +00:00
Evan Cheng
5ee9cf6bca Test case for 3-address conversion.
llvm-svn: 42664
2007-10-05 23:33:09 +00:00
Ted Kremenek
8a7bf82206 Modifications to XCode project:
- Added include/Analysis/ExprDeclBitVector.h
- Added include/Analysis/ProgramEdge.h
- Removed include/Analysis/Visitors/DataflowStmtVisitor.h

llvm-svn: 42663
2007-10-05 23:32:54 +00:00
Ted Kremenek
fd8d8ca214 Removed DataflowStmtVisitor. It is no longer used, and is obsoleted
by newer visitor interfaces.

llvm-svn: 42662
2007-10-05 23:27:24 +00:00
Evan Cheng
1151ffde70 Commute x86 cmove instructions by swapping the operands and change the condition
to its inverse.
Testing this as llcbeta

llvm-svn: 42661
2007-10-05 23:13:21 +00:00
Evan Cheng
42a13757de This is done.
llvm-svn: 42656
2007-10-05 22:34:59 +00:00
Evan Cheng
484cab7a2f Enable convertToThreeAddress for X86 by default.
llvm-svn: 42655
2007-10-05 22:31:10 +00:00
Devang Patel
a69f987b66 Fix bug in updating dominance frontier after loop
unswitch when frontier includes basic blocks that 
are not inside loop.

llvm-svn: 42654
2007-10-05 22:29:34 +00:00
Evan Cheng
d3ccf00870 INC64_32r -> LEA64_32r is better than INC64_32r -> LEA32r, but it still can
cause performance degradation.

llvm-svn: 42653
2007-10-05 21:55:32 +00:00
Kevin
9f413446de A message on the main page about bulding clang.
llvm-svn: 42652
2007-10-05 21:44:03 +00:00
Kevin
aa4692883a new site -- the rest of it
llvm-svn: 42651
2007-10-05 21:18:52 +00:00
Kevin
32a4c17af9 new site
llvm-svn: 42650
2007-10-05 21:17:52 +00:00
Fariborz Jahanian
ea7a98d8d6 This is the first patch toward supporting protocol conforming
objective-c types. It also removes use of Scope* parameter in
getObjCProtocolDecl.

llvm-svn: 42649
2007-10-05 21:01:53 +00:00
Devang Patel
64a9ca7c58 Support case statement ranges.
llvm-svn: 42648
2007-10-05 20:54:07 +00:00
Evan Cheng
fa2c828687 In 64-bit mode, avoid using leal with 32-bit 32-bit address size, e.g.
leal 1(%ecx), %edi, which requires 67H prefix.

llvm-svn: 42647
2007-10-05 20:34:26 +00:00
Kevin
e5be925a22 Per request... about to make changes to the website.
llvm-svn: 42646
2007-10-05 20:31:57 +00:00
Chris Lattner
dadc762ac5 Implement DenseMapInfo for Selector, allowing use of DenseMap/DenseSet of
Selector's instead of requiring void* to be used.  I converted one use of
DenseSet<void*> over to use DenseSet<Selector> but the others should change
as well.

llvm-svn: 42645
2007-10-05 20:15:24 +00:00
Dale Johannesen
c0154c06d6 First round of ppc long double. call/return and
basic arithmetic works.
Rename RTLIB long double functions to distinguish
different flavors of long double; the lib functions
have different names, alas.

llvm-svn: 42644
2007-10-05 20:04:43 +00:00
Steve Naroff
e61bfa8bb4 Layering refinements for selectors (suggested by Chris). Specifics...
- Add SelectorTable, which enables us to remove MultiKeywordSelector from the public header.
- Remove FoldingSet from IdentifierInfo.h and Preprocessor.h.
- Remove Parser::ObjcGetUnarySelector and Parser::ObjcGetKeywordSelector, they are subsumed by SelectorTable.
- Add MultiKeywordSelector to IdentifierInfo.cpp.
- Move a bunch of selector related methods from ParseObjC.cpp to IdentifierInfo.cpp.
- Added some comments.

llvm-svn: 42643
2007-10-05 18:42:47 +00:00
Evan Cheng
aac0f8e351 Add support to convert more 64-bit instructions to 3-address instructions.
llvm-svn: 42642
2007-10-05 18:20:36 +00:00
Fariborz Jahanian
458f7114db Patch for 1) Checking for duplicate methods decls in intterface and category.
2) Use of the new DenseSet<t> abstractions instead of DenseMap<t,char>.

llvm-svn: 42641
2007-10-05 18:00:57 +00:00
Evan Cheng
97eba74a52 ADC and SBB uses EFLAGS.
llvm-svn: 42640
2007-10-05 17:59:57 +00:00
Chris Lattner
f85527e131 Mark count method const.
llvm-svn: 42639
2007-10-05 17:40:38 +00:00
Dan Gohman
43c29dce18 Change a few more spaces to tabs in assembly output.
llvm-svn: 42638
2007-10-05 15:58:41 +00:00
Dan Gohman
b074f23dff Change a space to a tab in the assembly output of a .globl directive
for consistency.

llvm-svn: 42637
2007-10-05 15:54:58 +00:00
Dan Gohman
12334acbfb Legalize support for MUL_LOHI and DIVREM.
llvm-svn: 42636
2007-10-05 14:17:22 +00:00
Dan Gohman
2682bb6df2 Fix a typo in a comment.
llvm-svn: 42635
2007-10-05 14:11:58 +00:00
Dan Gohman
1a77dfba15 Provide names for MUL_LOHI and DIVREM operators.
llvm-svn: 42634
2007-10-05 14:11:04 +00:00
Dan Gohman
3c2c1c3cce SMUL_LOHI and UMUL_LOHI are commutative.
llvm-svn: 42633
2007-10-05 14:09:33 +00:00
Dan Gohman
5b89b1ef8f Define target-indepenent SDNode types for multiply and divide that
produce two results.

llvm-svn: 42632
2007-10-05 14:07:56 +00:00
Duncan Sands
99452793ac Fix typo in comment.
llvm-svn: 42631
2007-10-05 10:37:00 +00:00
Evan Cheng
a8a9c15e30 Testing convertToThreeeAddress as X86 llcbeta.
llvm-svn: 42630
2007-10-05 08:04:01 +00:00
Daniel Berlin
f86366ec2d Fix intersectWithComplement bug noticed by Curtis Dunham
Optimize |= case for empty RHS

llvm-svn: 42629
2007-10-05 05:10:53 +00:00
Evan Cheng
90a4185b5f New test case.
llvm-svn: 42628
2007-10-05 01:44:22 +00:00
Evan Cheng
84d0ebc10a Chain producing nodes cannot be moved, not chain reading nodes.
llvm-svn: 42627
2007-10-05 01:42:35 +00:00
Evan Cheng
991cf47221 Oops. Didn't mean to leave this in.
llvm-svn: 42626
2007-10-05 01:39:40 +00:00
Evan Cheng
79e9713b11 If a node that defines a physical register that is expensive to copy. The
scheduler will try a number of tricks in order to avoid generating the
copies. This may not be possible in case the node produces a chain value
that prevent movement. Try unfolding the load from the node before to allow
it to be moved / cloned.

llvm-svn: 42625
2007-10-05 01:39:18 +00:00
Evan Cheng
a851e2b92e Added storeRegToAddr, loadRegFromAddr, and unfoldMemoryOperand's.
llvm-svn: 42624
2007-10-05 01:34:55 +00:00
Evan Cheng
6912b50958 Not needed any more.
llvm-svn: 42623
2007-10-05 01:34:14 +00:00
Evan Cheng
1ef9edce5f Forgot these.
llvm-svn: 42622
2007-10-05 01:33:45 +00:00
Evan Cheng
f4cf5dcdd2 - Added a few target hooks to generate load / store instructions from / to any
address (not just from / to frameindexes).
- Added target hooks to unfold load / store instructions / SDNodes into separate
load, data processing, store instructions / SDNodes.

llvm-svn: 42621
2007-10-05 01:32:41 +00:00
Evan Cheng
4852303bdb Add a variant of getTargetNode() that takes a vector of MVT::ValueType.
llvm-svn: 42620
2007-10-05 01:10:49 +00:00
Evan Cheng
fd11ef4665 Silence a warning.
llvm-svn: 42619
2007-10-05 01:09:32 +00:00
Devang Patel
da5d6bbc40 switch statement code gen.
llvm-svn: 42616
2007-10-04 23:45:31 +00:00
Daniel Berlin
f5009110bf Fix the previous bug a slightly different way (by modifying how find_next works)
llvm-svn: 42613
2007-10-04 21:27:17 +00:00
Daniel Berlin
c1973961c9 Fix off by one error in iterator
llvm-svn: 42612
2007-10-04 21:18:20 +00:00
Fariborz Jahanian
9081457cbf this patch accomodates clattner's comments on expression processing in @try-statement.
llvm-svn: 42611
2007-10-04 20:19:06 +00:00
Bill Wendling
eaa909f08e Support Objective C++ too.
llvm-svn: 42610
2007-10-04 18:47:25 +00:00
Bill Wendling
c20518d0df Added testcase for creation of metadata with null pointers.
llvm-svn: 42609
2007-10-04 18:46:06 +00:00
Fariborz Jahanian
76aff36d64 More tab removal activity.
llvm-svn: 42608
2007-10-04 17:06:28 +00:00
Chris Lattner
1f2b5f0e13 add a note.
llvm-svn: 42607
2007-10-04 15:47:27 +00:00
Bill Wendling
2fba4a85ea un-XFAIL this test.
llvm-svn: 42606
2007-10-04 09:33:08 +00:00
Daniel Berlin
ffffead7df It helps a lot when you check for the end of your list before randomly
dereferencing things.

llvm-svn: 42605
2007-10-04 05:29:36 +00:00
Daniel Berlin
2738730c0f Make SparseBitVector::set actually work properly when sets are not in ascending or descending order.
llvm-svn: 42604
2007-10-04 05:25:51 +00:00
Chris Lattner
01d7f489a9 minor cleanups, make code more defensive, less branchy in Selector ctor.
llvm-svn: 42603
2007-10-04 05:21:22 +00:00
Chris Lattner
0f26288998 fix an incorrect assertion
llvm-svn: 42602
2007-10-04 05:16:42 +00:00
Fariborz Jahanian
673414067b Fixed tabs in couple of sources.
llvm-svn: 42601
2007-10-04 00:45:27 +00:00
Fariborz Jahanian
c9cd8a185d Fixed all my recent test cases to have the RUN command and
fixed consequence of these changes in clang.

llvm-svn: 42600
2007-10-04 00:22:33 +00:00
Gordon Henriksen
14d7680b00 Do use the actual ocaml stdlib (not the install dir) to find the
caml/*.h headers.

llvm-svn: 42599
2007-10-04 00:07:50 +00:00
Neil Booth
8f1946fa22 Add APFloat -> hexadecimal string conversion, as per %a and %A in C99.
Useful for diagnostics and debugging.

llvm-svn: 42598
2007-10-03 22:26:02 +00:00
Chris Lattner
644e1b7a10 minor cleanup
llvm-svn: 42596
2007-10-03 22:03:06 +00:00
Chris Lattner
02cbd095dd move DeclObjc.h down to be alphabetically organized
llvm-svn: 42594
2007-10-03 21:56:39 +00:00
Owen Anderson
8313e75ea7 Completely merge the implementation details of DomTree and PostDomTree.
Also, add a FIXME for a bug in PostDomTree calculation I noticed while writing this,

llvm-svn: 42593
2007-10-03 21:25:45 +00:00
Owen Anderson
87337924d5 Add a GraphTraits partial specialization to make the inverse of an inverse be the same as the underlying graph.
llvm-svn: 42592
2007-10-03 21:24:38 +00:00
Devang Patel
3574759d85 Fix 80 col violation.
llvm-svn: 42591
2007-10-03 21:17:43 +00:00
Devang Patel
e192e32577 Refactor code in a separate method.
llvm-svn: 42590
2007-10-03 21:16:08 +00:00
Chris Lattner
99f6ab7e4c Add initial iterator support for folding set.
llvm-svn: 42589
2007-10-03 21:12:09 +00:00
Chris Lattner
f0e5011d21 Clarify that shifts that are too large are undefined.
llvm-svn: 42588
2007-10-03 21:01:14 +00:00
Steve Naroff
4810c3a1d6 Finish renaming ObjC declaration actions.
Add comments.
Switch to new indentation style for the Action class. Since many actions take many arguments, the new style will...
- make it easier to add/remove arguments without messing up the indentation...
- make it easier to add comments to each argument (see ActOnMethodDeclaration for an example)...
- in general, just makes it easier to see what is being passed.

The rest of Actions will be converted "lazily"...there is no immediate need to hack all the existing methods.

llvm-svn: 42587
2007-10-03 21:00:46 +00:00
Chris Lattner
8c41ed61d1 Simplify implementation of the FoldingSet circular list, a necessary step
to giving it iterators.

llvm-svn: 42586
2007-10-03 20:45:43 +00:00
Dan Gohman
c731c97fac Use empty() member functions when that's what's being tested for instead
of comparing begin() and end().

llvm-svn: 42585
2007-10-03 19:26:29 +00:00
Dan Gohman
8c43e41d9b Fix a using namespace llvm; in a header file.
llvm-svn: 42584
2007-10-03 19:04:09 +00:00
Bill Wendling
354504060c Temporarily XFAIL this test.
llvm-svn: 42583
2007-10-03 17:46:54 +00:00
Dale Johannesen
9d559cfff5 Tone down an overzealous optimization.
llvm-svn: 42582
2007-10-03 17:45:27 +00:00
Chris Lattner
87a3dbe743 remove extraneous tag
llvm-svn: 42581
2007-10-03 17:34:29 +00:00
Chris Lattner
6a6fb7f7b7 remove misleading documentation: LLVM has no atomic support yet.
llvm-svn: 42580
2007-10-03 17:33:51 +00:00
Chris Lattner
4bdb84fe53 add a note
llvm-svn: 42579
2007-10-03 17:10:03 +00:00
Tanya Lattner
30f65fe4a7 Fix PR1719, by not marking llvm.global.annotations internal.
llvm-svn: 42578
2007-10-03 17:05:40 +00:00
Fariborz Jahanian
6cc3803f0b Renamed getCatLoc() to getLocation() to be consistant for such
getter names.

llvm-svn: 42577
2007-10-03 16:23:52 +00:00
Neil Booth
1ca1f80b38 Tweak RoundAwayFromZero the bit number below which is truncated, and make
it const.

Preparation for APFloat -> hexadecimal string conversion.

llvm-svn: 42576
2007-10-03 15:16:41 +00:00
Gordon Henriksen
80f35e0d4c Regenerate.
llvm-svn: 42575
2007-10-03 12:07:14 +00:00
Gordon Henriksen
485739d801 Fixing a typo in configure.ac.
Patch by Adam Goode.

llvm-svn: 42574
2007-10-03 12:06:41 +00:00
Chris Lattner
4d4e9cdb62 add a note
llvm-svn: 42573
2007-10-03 06:10:59 +00:00
Chris Lattner
b511029eaf testcase for PR1647
llvm-svn: 42570
2007-10-03 05:29:07 +00:00
Chris Lattner
d66e0cd6c0 Fix PR1719, by not marking llvm.noinline internal.
llvm-svn: 42565
2007-10-03 03:59:15 +00:00
Chris Lattner
21ba176c4b Bill's example is still not enough to repro this, but it has other issues that
seem significant as well.

llvm-svn: 42564
2007-10-03 03:40:24 +00:00
Owen Anderson
b60f254975 Factor some code from the DomTree and PostDomTree calculate methods up into
each one's runOnFunction method.

llvm-svn: 42563
2007-10-03 03:20:17 +00:00
Ted Kremenek
88b7439a8c Fixed bug where intrusive_ptr_add_ref and intrusive_ptr_release were
not declared "static inline."

Removed member templates for operator= and copy constructor.  They simply
didn't work as expected.

Fixed reference counting bug when a smart pointer is assigned the
value of another smart pointer that refers to the same address.

llvm-svn: 42562
2007-10-03 00:48:55 +00:00
Steve Naroff
0c37b0cb5a Rename several ObjC action methods to use the "ActOn" prefix (still a few more to do).
Remove Action::ObjCStartCategoryInterface/ObjCFinishInterface - they are unused.
.

llvm-svn: 42559
2007-10-02 22:39:18 +00:00
Fariborz Jahanian
b75640c9f1 Unified SuperClass field name in an objective-c class.
llvm-svn: 42556
2007-10-02 22:12:45 +00:00
Fariborz Jahanian
b8d9e088a7 Unified such names as protocol references, instance methods and class methods
and their accessors in a variety of objective-c classes.

llvm-svn: 42555
2007-10-02 22:05:16 +00:00
Bill Wendling
3efc0758ae Another micro-opt.
llvm-svn: 42554
2007-10-02 21:49:31 +00:00
Steve Naroff
d174155204 Remove Action::ActOnImpleIvarVsClassIvars(), it is only called by Sema (not Parser).
Add Sema::CheckImplementationIvars() to replace the previous action.

llvm-svn: 42553
2007-10-02 21:43:37 +00:00
Bill Wendling
f214ff8701 Another missed optimization with LICM.
llvm-svn: 42552
2007-10-02 21:43:06 +00:00
Bill Wendling
855011e5c6 Small label changes.
llvm-svn: 42549
2007-10-02 21:02:53 +00:00
Bill Wendling
4eb7ca4b4c Now with source code.
llvm-svn: 42548
2007-10-02 21:01:16 +00:00
Bill Wendling
96ed3bb2d4 Now with LL code!
llvm-svn: 42547
2007-10-02 20:54:32 +00:00
Bill Wendling
9c4d61b523 Another missed optimization.
llvm-svn: 42546
2007-10-02 20:42:59 +00:00
Steve Naroff
f5a55c5a9f Rename ObjcInterfaceDecl::getIsForwardDecl() to isForwardDecl().
Rename ObjcProtocolDecl::getIsForwardProtoDecl() to isForwardDecl().
Rename ObjcInterfaceDecl::setIsForwardDecl() to setForwardDecl().
Rename ObjcProtocolDecl::setIsForwardProtoDecl() to setForwardDecl().

Two reasons:

#1: boolean predicates should start with "is".
#2: Since these two sets of methods represent the same concept, they should be named the same (polymorphism is good:-)

llvm-svn: 42545
2007-10-02 20:26:23 +00:00
Fariborz Jahanian
adf84f3f3c Previously, I warned those methods not implemented in implementation class/category.
Now, I also warn those class/categories which are incomplete because of this.

llvm-svn: 42544
2007-10-02 20:06:01 +00:00
Steve Naroff
c6814ea670 - Add ObjcInterfaceDecl::lookupInstanceMethod(), lookupClassMethod().
- Add ObjcMessageExpr::getSelector(), getClassName().
- Change Sema::getObjCInterfaceDecl() to simply take an IdentifierInfo (no Scope needed).
- Remove FIXME for printing ObjCMessageExpr's.

llvm-svn: 42543
2007-10-02 20:01:56 +00:00
Bill Wendling
88ea107fdb Micro-optimization -- missed LICM opportunity.
llvm-svn: 42542
2007-10-02 19:55:05 +00:00
Gordon Henriksen
a3fc412d82 Updating my credits entry.
llvm-svn: 42541
2007-10-02 18:04:24 +00:00
Dale Johannesen
dd89d2758e Document new sqrt and powi handling.
llvm-svn: 42540
2007-10-02 17:47:38 +00:00
Dale Johannesen
4d4e77af8e Rewrite sqrt and powi to use anyfloat. By popular demand.
llvm-svn: 42537
2007-10-02 17:43:59 +00:00
Fariborz Jahanian
19d765fa6c ObjcCategoryDecl Does not subclass from ScopedDecl any more.
Ted may want to take a look at the change I made at 
FGRecStmtDeclVisitor.h.

llvm-svn: 42535
2007-10-02 17:36:55 +00:00
Ted Kremenek
190b1ed4fc Moved ProgramEdge out out include/.../Analysis/PathSensitive to include/.../Analysis, as it is now used by the FlowSensitive subsystem as well.
Removed "Edge" nested class by CFG, as it is now subsumed by ProgramEdge.

Adjusted DataflowSolver and DataflowValues to use ProgramEdges instead
of CFG::Edge.

llvm-svn: 42534
2007-10-02 17:12:02 +00:00
Gordon Henriksen
da5d5b57bf Regenerate.
llvm-svn: 42533
2007-10-02 16:42:22 +00:00
Gordon Henriksen
3be1f10097 Providing --with-ocaml-libdir for ./configure. The default is the
stdlib if it's beneath --prefix, and is libdir/ocaml otherwise.

If someone has a better way than this to test whether $B is a path
within $A, I'd love to hear it:

  if test "$A" \< "$B" -a "$B" \< "${A}~"

llvm-svn: 42532
2007-10-02 16:42:10 +00:00
Fariborz Jahanian
89b8ef92be This patch introduces the ObjcCategoryImplDecl class and does the checking related to
unimplemented methods in category implementation.

llvm-svn: 42531
2007-10-02 16:38:50 +00:00
Ted Kremenek
a6d930a925 Added DenseMapInfo traits for ProgramEdges
llvm-svn: 42530
2007-10-02 16:38:05 +00:00
Gordon Henriksen
acc2a838fa Regenerate.
llvm-svn: 42529
2007-10-02 10:14:42 +00:00
Gordon Henriksen
61400d1192 Fixing (harmless) typos.
llvm-svn: 42528
2007-10-02 10:14:32 +00:00
Gordon Henriksen
e61dd67a2b Regenerate.
llvm-svn: 42527
2007-10-02 09:50:32 +00:00
Gordon Henriksen
d48f4598a4 Add explicit --enable-bindings option to configure.
llvm-svn: 42526
2007-10-02 09:50:18 +00:00
Steve Naroff
b6c0518d11 Use Identifier::getLength() instead of strlen() in Selector::getName() and MultiKeywordSelector::getName().
llvm-svn: 42524
2007-10-02 02:01:22 +00:00
Devang Patel
18c2fa7225 Fix test.
llvm-svn: 42522
2007-10-02 00:47:43 +00:00
Owen Anderson
888477339e Fix typo.
llvm-svn: 42521
2007-10-02 00:44:20 +00:00
Owen Anderson
d263cfa1c0 Mention memdep in the AA documentation.
llvm-svn: 42519
2007-10-02 00:43:25 +00:00
Devang Patel
0d4958f1b0 New test.
llvm-svn: 42517
2007-10-02 00:39:19 +00:00
Hartmut Kaiser
9f4dee8973 Added a missing #include.
llvm-svn: 42516
2007-10-02 00:36:52 +00:00
Tanya Lattner
cf316c2eb7 If the user did not check out LLVM and request it to be built, it should be a build error. This relies on the user having a successful build of LLVM, but the tests will fail if they dont.
llvm-svn: 42514
2007-10-02 00:19:27 +00:00
Steve Naroff
bf81db14c5 Add comment to ObjcClassDecl.
Move ObjcClassDecl to be next to ObjcForwardProtocolDecl. Since they are very similar, might want to unify their names (e.g. ObjcForwardClassDecl).
Change indentation of ObjcForwardProtocolDecl to conform to everything else in DeclObjC.h.

llvm-svn: 42513
2007-10-02 00:10:42 +00:00
Hartmut Kaiser
587cc42864 Updated VC++ build system.
llvm-svn: 42512
2007-10-01 23:57:52 +00:00
Evan Cheng
1f79ba6fe6 Refactor code to add load / store folded instructions -> register only
instructions reverse map.

llvm-svn: 42509
2007-10-01 23:44:33 +00:00
Dale Johannesen
b6c05b1f90 Fix stride computations for long double arrays.
llvm-svn: 42508
2007-10-01 23:08:35 +00:00
Steve Naroff
e5e25fae1d Add comments for ObjC Decl's.
Removed a constructor that was #if 0's out.
Added a FIXME for fariborz...categories shouldn't inherit from ScopedDecl.

llvm-svn: 42507
2007-10-01 22:54:34 +00:00
Dan Gohman
9765cc3bbb Move the code that emits the .file directives so that it runs after the
SourceFiles list is fully filled in so that it sees all of the files.

llvm-svn: 42506
2007-10-01 22:40:20 +00:00
Evan Cheng
89ca5b091f -pre-RA-sched=none, simple, simple-noitin are gone.
llvm-svn: 42505
2007-10-01 22:17:20 +00:00
Devang Patel
e595d107e6 PR 1603 test case.
llvm-svn: 42502
2007-10-01 21:22:57 +00:00
Evan Cheng
a3a67596f6 Remove simple scheduler.
llvm-svn: 42499
2007-10-01 20:44:07 +00:00
Ted Kremenek
fb4750b639 Migrated LiveVariables and UninitializedVariables to now use the
tracked BlkExpr information now maintained by the CFG class.

llvm-svn: 42498
2007-10-01 20:33:52 +00:00
Ted Kremenek
f2d4372ba9 CFG objects now internally store a (lazily created) map from block-level
expressions to IDs.  This is used by various dataflow analyses, but is
also useful for anyone querying a CFG to determine where an expression
is evaluated.

llvm-svn: 42495
2007-10-01 19:33:33 +00:00
Steve Naroff
67391b8a54 Move ObjC decls to DeclObjC.h, a new AST header.
Update clients and add to project file.

llvm-svn: 42494
2007-10-01 19:00:59 +00:00
Devang Patel
2a60ff1aeb Relax unsafe use check. If there is one unconditional use inside the loop then it is safe to promote value even if there is another conditional use inside the loop.
llvm-svn: 42493
2007-10-01 18:12:58 +00:00
Evan Cheng
a1b7e95039 Typo. X86comi doesn't read / write chain's.
llvm-svn: 42492
2007-10-01 18:12:48 +00:00
Fariborz Jahanian
ebb34d7141 Moved two bitfields back to top of class ObjcMethodDecl so they pack
with those in their base class. In response to clattner's 
September 30, 2007 12:54:49 AM PDT email.

llvm-svn: 42491
2007-10-01 17:19:59 +00:00
Fariborz Jahanian
f26702eb54 Took care of clatter's suggestions, dated.
September 30, 2007 12:36:58 AM PDT and
September 30, 2007 12:50:05 AM PDT

llvm-svn: 42490
2007-10-01 16:53:59 +00:00
Ted Kremenek
7f74e13535 Removed "hasImplicitControlFlow" from class CFG, and moved it to class Stmt
as a member function.  This function is no longer needed within the CFG
class, and logically belongs to the Stmt class as a predicate for a
Stmt instance.

llvm-svn: 42489
2007-10-01 16:34:52 +00:00
Dale Johannesen
28e19a48ce Add getABITypeSize, getABITypeSizeInBits
llvm-svn: 42488
2007-10-01 16:03:14 +00:00
Dan Gohman
9b943453f5 Add empty() member functions to a few container-like classes.
llvm-svn: 42487
2007-10-01 16:01:23 +00:00
Dale Johannesen
c0855f8a88 remove dup comment
llvm-svn: 42486
2007-09-30 19:08:12 +00:00
Fariborz Jahanian
a725bf7782 Unused ObjcProtoMethod is removed.
llvm-svn: 42485
2007-09-30 18:53:32 +00:00
Dale Johannesen
9150652b21 Constant fold int-to-long-double conversions;
use APFloat for int-to-float/double; use
round-to-nearest for these (implementation-defined,
seems to match gcc).

llvm-svn: 42484
2007-09-30 18:19:03 +00:00
Dale Johannesen
28a2c4a9c4 Simplify and fix signed int -> FP conversions.
llvm-svn: 42483
2007-09-30 18:17:01 +00:00
Gordon Henriksen
0b7cf862bc AsmPrinters overriding getAnalysisUsage should call super.
And not super's super, either.

llvm-svn: 42482
2007-09-30 13:39:29 +00:00
Chris Lattner
2b6abdce50 Add a new getLength() method to IdentifierInfo, which relies on a newly added
method to StringMapEntry.  Steve, please use this to remove the
strlen calls in selector processing.

llvm-svn: 42481
2007-09-30 08:32:27 +00:00
Chris Lattner
b06396c588 Add a helper useful when mapping from a map element to its hash node.
llvm-svn: 42480
2007-09-30 08:31:46 +00:00
Chris Lattner
6c44b9f145 Fix a bug I just introduced.
llvm-svn: 42479
2007-09-30 08:31:00 +00:00
Chris Lattner
90c26ba9de improve comment.
llvm-svn: 42478
2007-09-30 08:13:22 +00:00
Chris Lattner
4730430bd8 simplify an expression
llvm-svn: 42477
2007-09-30 08:01:04 +00:00
Owen Anderson
46ade4eb9b Template-ize more of the DomTree internal implementation details. Only the calculate() methods for DomTree and PostDomTree remain to be merged/template-ized.
llvm-svn: 42476
2007-09-30 04:17:16 +00:00
Chris Lattner
bd0079c603 document DenseSet.
llvm-svn: 42475
2007-09-30 00:58:59 +00:00
Chris Lattner
18a9273e61 Add a new DenseSet abstraction.
llvm-svn: 42474
2007-09-30 00:47:20 +00:00
Fariborz Jahanian
0886d252d7 This patch fixes all issues mentioned in clattner's feedback of
September 28, 2007 4:39:24 PM PDT
Please let me know if I missed anything.

llvm-svn: 42473
2007-09-29 18:24:58 +00:00
Fariborz Jahanian
ec7b3333e1 Code clean up. Moved couple of static functions to be private members of Sema class.
Avoiding passing a Sema object to these utility functions.

llvm-svn: 42472
2007-09-29 17:14:55 +00:00
Fariborz Jahanian
fa0667b547 Patch to remove use of has table for protocol name lookup. This patch mirrors my
previous patch to do the same for class name lookup using a hash table.

llvm-svn: 42471
2007-09-29 17:04:06 +00:00
Duncan Sands
7b908dda92 Add newline at end of file.
llvm-svn: 42470
2007-09-29 16:38:37 +00:00
Duncan Sands
f72ff0c379 Check that the second parameter of init_trampoline
can be resolved to a function.  This is required
for codegen and used by instcombine.

llvm-svn: 42469
2007-09-29 16:25:54 +00:00
Gordon Henriksen
f5aa229ede This is done already.
llvm-svn: 42467
2007-09-29 02:23:08 +00:00
Gordon Henriksen
37ca83d4e9 Collector is the base class for garbage collection code generators.
This version enhances the previous patch to add root initialization
as discussed here:

http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070910/053455.html

Collector gives its subclasses control over generic algorithms:

  unsigned NeededSafePoints; //< Bitmask of required safe points.
  bool CustomReadBarriers;   //< Default is to insert loads.
  bool CustomWriteBarriers;  //< Default is to insert stores.
  bool CustomRoots;          //< Default is to pass through to backend.
  bool InitRoots;            //< If set, roots are nulled during lowering.

It also has callbacks which collectors can hook:

  /// If any of the actions are set to Custom, this is expected to
  /// be overriden to create a transform to lower those actions to
  /// LLVM IR.
  virtual Pass *createCustomLoweringPass() const;

  /// beginAssembly/finishAssembly - Emit module metadata as
  /// assembly code.
  virtual void beginAssembly(Module &M, std::ostream &OS,
                             AsmPrinter &AP,
                             const TargetAsmInfo &TAI) const;
  virtual void finishAssembly(Module &M,
                              CollectorModuleMetadata &CMM,
                              std::ostream &OS, AsmPrinter &AP,
                              const TargetAsmInfo &TAI) const;  

Various other independent algorithms could be implemented, but were
not necessary for the initial two collectors. Some examples are
listed here:

http://llvm.org/docs/GarbageCollection.html#collector-algos

llvm-svn: 42466
2007-09-29 02:13:43 +00:00
Gordon Henriksen
6547e5a2bc Demoting CHelpers.h to include/llvm/Support.
llvm-svn: 42465
2007-09-29 01:38:42 +00:00
Fariborz Jahanian
343f7098db Removed use of hash table for class decls and do a name look up directly.
There is still an issue if doing ScopedLookup is an overkill and we can
just access the decl using the identifier.

llvm-svn: 42463
2007-09-29 00:54:24 +00:00
Daniel Berlin
342181c51d Switch to densemap rather than std::set
llvm-svn: 42462
2007-09-29 00:50:40 +00:00
Gordon Henriksen
2717f3bd60 Regenerate.
llvm-svn: 42461
2007-09-29 00:42:56 +00:00
Gordon Henriksen
da70a73f28 PR1601: etags not configured correctly
Resolving this by deleting vestigal etags remnants.

llvm-svn: 42460
2007-09-29 00:42:21 +00:00
Evan Cheng
5fb5a1f389 Enabling new condition code modeling scheme.
llvm-svn: 42459
2007-09-29 00:00:36 +00:00
Devang Patel
f96df8d777 Do not ignore packed member size while selecting union type.
llvm-svn: 42458
2007-09-28 23:54:26 +00:00
Dan Gohman
a90183e7d1 Teach SplitVectorOp how to split INSERT_VECTOR_ELT.
llvm-svn: 42457
2007-09-28 23:53:40 +00:00
Steve Naroff
92866f4fbb Add some comments to MultiKeywordSelector, make all methods private, add a friend, move some methods around.
llvm-svn: 42456
2007-09-28 23:39:26 +00:00
Ted Kremenek
1b61261a25 Added ProgramEdge.h, which defines ProgramEdge (and subclasses) that
encapsulate a program point within a CFG for use by our path-sensitive
dataflow solver.

llvm-svn: 42455
2007-09-28 23:15:21 +00:00
Tanya Lattner
586eb8ee47 Update how to release document.
Add release version to getting started guide.

llvm-svn: 42454
2007-09-28 22:50:54 +00:00
Evan Cheng
a5e595d23a If two instructions are both two-address code, favors (schedule closer to
terminator) the one that has a CopyToReg use. This fixes
2006-05-11-InstrSched.ll with -new-cc-modeling-scheme.

llvm-svn: 42453
2007-09-28 22:32:30 +00:00
Steve Naroff
8017506d9c Yesterday I discovered that 78% of all selectors in "Cocoa.h" take 0/1 argument.
This motivated implementing a devious clattner inspired solution:-)

This approach uses a small value "Selector" class to point to an IdentifierInfo for the 0/1 case. For multi-keyword selectors, we instantiate a MultiKeywordSelector object (previously known as SelectorInfo). Now, the incremental cost for selectors is only 24,800 for Cocoa.h! This saves 156,592 bytes, or 86%!! The size reduction is also the result of getting rid of the AST slot, which was not strictly necessary (we will associate a selector with it's method using another table...most likely in Sema).

This change was critical to make now, before we have too many clients.

I still need to add some comments to the Selector class...will likely add later today/tomorrow.

llvm-svn: 42452
2007-09-28 22:22:11 +00:00
Devang Patel
8ec4f837fa Do not codegen dummy block.
Dummy block is an empty block with no predecessors.

llvm-svn: 42451
2007-09-28 21:49:18 +00:00
Ted Kremenek
14851c3de3 Fixed bug where assignments to variables wrapped in parentheses would not
properly kill variables.  e.g:

(x) = 1;

llvm-svn: 42450
2007-09-28 21:29:33 +00:00
Ted Kremenek
a1c256dd0e Fixed UninitializedValues to properly propagate uninitialized "taint"
in assignment operations of the form +=, -=, *=, etc.

llvm-svn: 42449
2007-09-28 21:08:51 +00:00
Chris Lattner
8861abe6f2 really fix PR1581, thanks to Daniel Dunbar for pointing
this out.

llvm-svn: 42448
2007-09-28 20:50:50 +00:00
Ted Kremenek
a6ef56e6d2 DeadStores no longer reports warnings for stores to non-local variables.
llvm-svn: 42447
2007-09-28 20:48:41 +00:00
Ted Kremenek
0064ff47e6 Significant cleanups and bug-fixes to LiveVariables. Uses new refactored
ExprDeclBitVector class for defining dataflow state.

llvm-svn: 42446
2007-09-28 20:38:59 +00:00
Ted Kremenek
254c126c15 Refactored ExprDeclBitVector into two classes:
DeclBitVector
 ExprDeclBitVector (which subclasses the former)

DeclBitVector is for analyses that just want to track bitvector state
for declarations.

ExprDeclBitVector is for analyses that want to track bitvector state
for both both declarations and CFGBlock-level expressions.

llvm-svn: 42445
2007-09-28 20:12:10 +00:00
Chris Lattner
2be9ec5c91 Make Value::getNameLen not crash on an empty name, fixing PR1712.
llvm-svn: 42444
2007-09-28 20:09:40 +00:00
Evan Cheng
f72693f36e Remove a poor scheduling heuristic.
llvm-svn: 42443
2007-09-28 19:37:35 +00:00
Evan Cheng
038dcc5136 Trim some unneeded fields.
llvm-svn: 42442
2007-09-28 19:24:24 +00:00
Dale Johannesen
03d4ad9f03 Record latest work.
llvm-svn: 42441
2007-09-28 18:46:28 +00:00
Dale Johannesen
789b5a505b Fix long double -> uint64 conversion.
llvm-svn: 42440
2007-09-28 18:44:17 +00:00
Dale Johannesen
6bf69ed3cc minor long double related changes
llvm-svn: 42439
2007-09-28 18:06:58 +00:00
Ted Kremenek
483e305210 Fixed bug where declaration initializer expressions were not
traversed by the visitor.

llvm-svn: 42438
2007-09-28 17:55:50 +00:00
Ted Kremenek
07eff9a2fe Added iterator mechanism to iterator over the decls and expressions
tracked by an ExprDeclBitVector analysis.

llvm-svn: 42437
2007-09-28 17:55:22 +00:00
Fariborz Jahanian
b75db4cc8c Patch to warn on umimplemented methods coming from class's
protocols.

llvm-svn: 42436
2007-09-28 17:40:07 +00:00
Dan Gohman
25d506c41b Make the checks for DW_FORM_data4 consistent with the others, and
add more such code for DIEDwarfLabel::SizeOf and DIEObjectLabel::SizeOf.

llvm-svn: 42435
2007-09-28 16:50:28 +00:00
Dan Gohman
0d23d63b9e Use 32-bit data directives for DW_FORM_data4 format data, even on
targets with 64-bit addresses.

llvm-svn: 42434
2007-09-28 15:43:33 +00:00
Rafael Espindola
6c04ac1db0 Refactor the memcpy lowering for the x86 target.
The only generated code difference is that now we call memcpy when
the size of the array is unknown. This matches GCC behavior and is
better since the run time value can be arbitrarily large.

llvm-svn: 42433
2007-09-28 12:53:01 +00:00
Evan Cheng
1f516560d1 Stop inventing new words. :-)
llvm-svn: 42429
2007-09-28 01:35:02 +00:00
Owen Anderson
d0d5c11d18 Remove unneeded #include.
llvm-svn: 42428
2007-09-28 01:25:07 +00:00
Owen Anderson
0fbef94cd0 Have PostDomTree use the newly templated DFSPass.
llvm-svn: 42427
2007-09-28 01:23:47 +00:00
Evan Cheng
edfc5b2204 Pessimisively assume ADJCALLSTACKDOWN / ADJCALLSTACKUP (which becomes sub / add) clobbers EFLAGS.
llvm-svn: 42426
2007-09-28 01:19:48 +00:00
Dale Johannesen
25a00a63eb Add sqrt and powi intrinsics for long double.
llvm-svn: 42423
2007-09-28 01:08:20 +00:00
Dale Johannesen
1d1d0e7735 Don't do SRA for unions with long double fields.
Fixes a SWB crash.

llvm-svn: 42422
2007-09-28 00:21:38 +00:00
Ted Kremenek
f91d1c92ba Fixed several bugs in the propagation of "uninitialized value"
taintness across expressions.

Made "smart-culling" of taint propagation (for error reporting)
correctly handle conditional expressions and a few other edge cases.

llvm-svn: 42421
2007-09-28 00:09:38 +00:00
Owen Anderson
ee73e0b8cb Convert DFSPass into a templated friend function, in preparation for making it common to DomTree and PostDomTree.
llvm-svn: 42420
2007-09-27 23:23:00 +00:00
Dan Gohman
a1d46c7d0a TargetAsmInfo::getAddressSize() was incorrect for x86-64 and 64-bit targets
other than PPC64. Instead of fixing it, just remove it and fix all the
places that use it to use TargetData::getPointerSize() instead, as there
aren't very many. Most of the references were in DwarfWriter.cpp.

llvm-svn: 42419
2007-09-27 23:12:31 +00:00
Gordon Henriksen
613afce430 CollectorMetadata abstractly describes stack maps for a function.
It includes:

 - location and of each safe point in machine code (identified by a
   label)
 - location of each root within the stack frame (identified by an
   offset), including the metadata tag provided to llvm.gcroot in
   the user program
 - size of the stack frame (for collectors which want to cheat on
   stack crawling :)
 - and eventually will include liveness

It is to be populated by back-ends during code-generation.

CollectorModuleMetadata aggregates this information across the
entire module.

llvm-svn: 42418
2007-09-27 22:18:46 +00:00
Evan Cheng
99dc695da5 Use GR64 in 64-bit mode.
llvm-svn: 42417
2007-09-27 21:50:05 +00:00
Fariborz Jahanian
fa80e80da9 Patch to use case-stmt for keywords used as selectgor names.
llvm-svn: 42416
2007-09-27 19:52:15 +00:00
Gordon Henriksen
658c57eb66 My previous Registry.h header, as well as Collectors.h, which is the
registry for dynamically-loaded garbage collection compiler plugins.

llvm-svn: 42415
2007-09-27 19:34:27 +00:00
Gordon Henriksen
0076a6727e GarbageCollection.html is expanded to encompass the coming
capabilities. This is a major rewrite and is easier to read en toto
rather than patchwise.

llvm-svn: 42414
2007-09-27 19:31:36 +00:00
Evan Cheng
5a71402be6 Doh. Calls clobber EFLAGS.
llvm-svn: 42413
2007-09-27 19:01:55 +00:00
Fariborz Jahanian
f6546b38b2 Patch for method implementation. It populates ObjcImplementationDecl object with method implementation declarations .
It checks and warns on those methods declared in class interface and not implemented.

llvm-svn: 42412
2007-09-27 18:57:03 +00:00
Steve Naroff
65ca537b55 Fix bug in SelectorInfo::getName() - method buffer needs to be passed by reference.
llvm-svn: 42411
2007-09-27 18:52:21 +00:00
Evan Cheng
e6f92253f5 Avoid inserting a live register more than once.
llvm-svn: 42410
2007-09-27 18:46:06 +00:00
Ted Kremenek
b9ce295b0a Created new "ExprDeclBitVector" type bundle for dataflow analyses that need boolean
values associated with ScopedDecls and CFGBlock-level Exprs.  This is the common
boilerplate needed by UninitializedValues and LiveVariables.

Refactored UninitializedValues to use ExprDeclBitVector.

Shortened the string diagnostic for UninitializedValues.

llvm-svn: 42408
2007-09-27 18:20:22 +00:00
Tanya Lattner
0d675ee06e Couple of fixes to mention bunzip2 and make instructions more clear.
llvm-svn: 42407
2007-09-27 18:14:33 +00:00
Devang Patel
f68d3e1a0d While searching for appropriate place for temporaries, do not over-incerement iterator.
llvm-svn: 42406
2007-09-27 18:02:47 +00:00
Devang Patel
11611f876e Mention Loop Index Split
llvm-svn: 42405
2007-09-27 17:32:04 +00:00
Chris Lattner
d2bc9d8c77 new testcase for PR1708
llvm-svn: 42398
2007-09-27 15:47:16 +00:00
Daniel Berlin
a447de7065 Ignore redundant constraints
llvm-svn: 42397
2007-09-27 15:42:23 +00:00
Chris Lattner
cc61bf5e0c Fix some use of uninit variables issues, reported by Anton.
llvm-svn: 42396
2007-09-27 15:15:46 +00:00
Steve Naroff
f73590dbb1 Add SelectorInfo (similar in spirit to IdentifierInfo). The key difference is SelectorInfo is not string-oriented, it is a unique aggregate of IdentifierInfo's (using a folding set). SelectorInfo also has a richer API that simplifies the parser/action interface. 3 noteworthy benefits:
#1: It is cleaner. I never "liked" storing keyword selectors (i.e. foo:bar:baz) in the IdentifierTable.

#2: It is more space efficient. Since Cocoa keyword selectors can be quite long, this technique is space saving. For Cocoa.h, pulling the keyword selectors out saves ~180k. The cost of the SelectorInfo data is ~100k. Saves ~80k, or 43%.

#3: It results in many API simplifications. Here are some highlights:

- Removed 3 actions (ActOnKeywordMessage, ActOnUnaryMessage, & one flavor of ObjcBuildMethodDeclaration that was specific to unary messages).
- Removed 3 funky structs from DeclSpec.h (ObjcKeywordMessage, ObjcKeywordDecl, and ObjcKeywordInfo).
- Removed 2 ivars and 2 constructors from ObjCMessageExpr (fyi, this space savings has not been measured).

I am happy with the way it turned out (though it took a bit more hacking than I expected). Given the central role of selectors in ObjC, making sure this is "right" will pay dividends later.

Thanks to Chris for talking this through with me and suggesting this approach. 

llvm-svn: 42395
2007-09-27 14:38:14 +00:00
Nick Lewycky
3934961878 Build the correct range for loops with unusual bounds. Fix from Jay Foad.
llvm-svn: 42394
2007-09-27 14:12:54 +00:00
Bill Wendling
c9a8c74d28 No, really, it *is* SSSE3. ;-)
llvm-svn: 42393
2007-09-27 08:47:31 +00:00
Duncan Sands
a1779909ff SSSE3 -> SSE3. Reported by Alex Kellett.
llvm-svn: 42392
2007-09-27 08:24:36 +00:00
Duncan Sands
2f060736e2 Grammer fix reported by Alex Kellett.
llvm-svn: 42391
2007-09-27 08:24:02 +00:00
Evan Cheng
75439b3b78 Silence a compiler warning.
llvm-svn: 42389
2007-09-27 07:35:39 +00:00
Evan Cheng
bde499be60 Boogs.
llvm-svn: 42388
2007-09-27 07:29:27 +00:00
Evan Cheng
1ec79b41db Be smarter about which node to force schedule. Reduce # of duplications + copies; Added statistics.
llvm-svn: 42387
2007-09-27 07:09:03 +00:00
Gordon Henriksen
eb42c4e221 Remove debugging.
llvm-svn: 42385
2007-09-27 02:47:27 +00:00
Evan Cheng
cfd5f82890 Backtracking only when it won't create a cycle.
llvm-svn: 42384
2007-09-27 00:25:29 +00:00
Dale Johannesen
34aa41c475 Make temporaries explicit to avoid premature
destruction of compiler-created ones.

llvm-svn: 42383
2007-09-26 23:20:33 +00:00
Gordon Henriksen
43b66447f4 Updating LLVM.xcodeproj.
llvm-svn: 42382
2007-09-26 22:44:45 +00:00
Chris Lattner
e6d9ca5443 objc messages have side effects, return true from hasLocalSideEffect,
fixing:

VoidMethod.m:14:5: warning: expression result unused
    [Greeter hello];
    ^~~~~~~~~~~~~~~

llvm-svn: 42380
2007-09-26 22:06:30 +00:00
Evan Cheng
478134e5f4 Oops. Forgot this.
llvm-svn: 42377
2007-09-26 21:38:03 +00:00
Ted Kremenek
d80ee7d287 Added extra guard for null Stmt* when traversing the AST using VisitChildren.
Added assertion that Block-level statements should not be NULL.

llvm-svn: 42376
2007-09-26 21:36:20 +00:00
Evan Cheng
8e136a9dc4 - Move getPhysicalRegisterRegClass() from ScheduleDAG to MRegisterInfo.
- Added ability to emit cross class register copies to the BBRU scheduler.
- More aggressive backtracking.

llvm-svn: 42375
2007-09-26 21:36:17 +00:00
Neil Booth
0fa3ea79ac Whitespace cleanup.
llvm-svn: 42374
2007-09-26 21:35:05 +00:00
Neil Booth
9acbf5aaf9 Whitespace and compiler warning cleanup.
llvm-svn: 42373
2007-09-26 21:33:42 +00:00
Evan Cheng
8728c3376a - Added MRegisterInfo::getCrossCopyRegClass() hook. For register classes where reg to reg copies are not possible, this returns another register class which registers in the specified register class can be copied to (and copy back from).
- X86 copyRegToReg() now supports copying between EFLAGS and GR32 / GR64 registers.

llvm-svn: 42372
2007-09-26 21:31:07 +00:00
Evan Cheng
b93de587cb Some assemblers do not recognize aliases pushfd, pushfq, popfd, and popfq. Just emit them as pushf and popf.
llvm-svn: 42371
2007-09-26 21:28:00 +00:00
Ted Kremenek
5c50fd1add Fixed two bugs in CFG construction:
BUG 1) 

CFG failed to build for empty functions, or functions containing only
NullStmts or empty compound statements.

We now handle such cases, although now we cannot test for CFG
construction failure by asserting that the last block constructed is
not NULL (since it now may be).

BUG 2)

CFG construction segfaulted on some cases when walking the AST and not
taking into account that some children of a statement may be NULL.

llvm-svn: 42370
2007-09-26 21:23:31 +00:00
Dale Johannesen
b805d35d16 Modernize fabs.ll, add long double. Add tests
for direct codegen of fsin/fcos.

llvm-svn: 42369
2007-09-26 21:12:10 +00:00
Dale Johannesen
b6d56401aa Enable codegen for long double abs, sin, cos
llvm-svn: 42368
2007-09-26 21:10:55 +00:00
Gordon Henriksen
c23b66c58b Added C and Ocaml bindings for functions, basic blocks, and
instruction creation. No support yet for instruction introspection.

Also eliminated allocas from the Ocaml bindings for portability,
and avoided unnecessary casts.

llvm-svn: 42367
2007-09-26 20:56:12 +00:00
Ted Kremenek
0883fd5817 Removed option "-parse-ast-check" from clang driver. This is now implemented
using "-parse-ast -verify".

Updated all test cases (using a sed script) that invoked -parse-ast-check to
now use -parse-ast -verify.

Fixed a bug where using "-verify" instead of "-parse-ast-check" would not
correctly create the DiagClient needed to accumulate diagnostics.

llvm-svn: 42365
2007-09-26 20:14:22 +00:00
Ted Kremenek
a054c5bedd Moved "VerifyDiagnostics" variable declaration to right below ProgAction
declaration.  This is because this option is logically tightly connected
to the actions defined in ProgAction.

llvm-svn: 42364
2007-09-26 19:42:19 +00:00
Ted Kremenek
cbd2af8a0a Removed inclusion of <memory>, which is no longer needed since we
aren't used auto_ptr's anymore.

llvm-svn: 42363
2007-09-26 19:41:07 +00:00
Ted Kremenek
8742a45565 Refactored driver so that any action that is implemented using an
ASTConsumer can also be verified using the diagnostics checker.  From
the command line, users may activate diagnostic checking using the
"-verify" option.  For example, "clang -verify -warn-dead-stores"
checks if the warnings flagged by the dead store checker match those
in the comments.

Note that we still have the option "-parse-ast-check" for backwards
comptability with existing test cases.  This option is now equivalent to 
"-parse-ast -verify".

llvm-svn: 42362
2007-09-26 18:39:29 +00:00
Fariborz Jahanian
2a4dd316a0 This patch inserts ivars declared in @implementation in its object and verifies
that they conform(in type, name and numbers) to those declared in @interface. 
Test case highlights kind of checking we do here.

llvm-svn: 42360
2007-09-26 18:27:25 +00:00
Dale Johannesen
f04d37d3a9 Fix f80 UNDEF.
llvm-svn: 42359
2007-09-26 17:26:49 +00:00
Fariborz Jahanian
19529eec8a Removed a few TODOs on things which are done.
llvm-svn: 42358
2007-09-26 17:03:44 +00:00
Duncan Sands
755d9306a3 X86 -> X86-32 in appropriate places.
llvm-svn: 42357
2007-09-26 16:24:52 +00:00
Duncan Sands
47fc0a2a5f Various cleanups. Especially, EH is turned on by default!
llvm-svn: 42356
2007-09-26 15:59:54 +00:00
Chris Lattner
f13af33221 ok ok we get it. CBE and vectors don't like each other yet.
llvm-svn: 42355
2007-09-26 15:50:21 +00:00
Chris Lattner
4480f42166 be less redundantly redundant.
llvm-svn: 42354
2007-09-26 15:48:33 +00:00
Duncan Sands
0bcbceb647 Test the C front-end, not the C++ front-end.
llvm-svn: 42350
2007-09-26 07:28:20 +00:00
Chris Lattner
31d319dce7 make old crappy browsers produce less crappy output :)
llvm-svn: 42349
2007-09-26 06:38:59 +00:00
Evan Cheng
b4b352656a Typos: POPQ -> POPFQ, POPD -> POPFD.
llvm-svn: 42348
2007-09-26 06:38:29 +00:00
Chris Lattner
c9e7b8ec50 move PR1160 here.
llvm-svn: 42347
2007-09-26 06:29:31 +00:00
Evan Cheng
c1e4e3743b Allow copyRegToReg to emit cross register classes copies.
Tested with "make check"!

llvm-svn: 42346
2007-09-26 06:25:56 +00:00
Chris Lattner
fef69f5b4a move PR1264 here.
llvm-svn: 42345
2007-09-26 06:15:48 +00:00
Chris Lattner
d0382a8550 noone uses etags. Connected to PR1601
llvm-svn: 42344
2007-09-26 06:10:47 +00:00
Chris Lattner
828eb3b91f we support attribute(noinline) now :)
llvm-svn: 42343
2007-09-26 06:04:15 +00:00
Chris Lattner
8e06116b8a update bugs list
llvm-svn: 42342
2007-09-26 06:01:35 +00:00
Chris Lattner
4734a358fd now with more prose.
llvm-svn: 42341
2007-09-26 05:44:21 +00:00
Duncan Sands
9b626f0ada Test that local variables are aligned as the user requested.
llvm-svn: 42338
2007-09-26 04:04:29 +00:00
Evan Cheng
0a6f47cff9 Add pushf{d|q}, popf{d|q} to push and pop EFLAGS register.
llvm-svn: 42335
2007-09-26 01:29:06 +00:00
Chris Lattner
f7ab334803 Handle (int)1.0e40 as an i-c-e.
llvm-svn: 42334
2007-09-26 00:47:26 +00:00
Evan Cheng
9b7f0e6eb4 translateX86CC updates the last two operands.
llvm-svn: 42333
2007-09-26 00:45:55 +00:00
Anton Korobeynikov
e291f727e3 Correctly restore stack pointer after realignment in main() on Cygwin/Mingw32
llvm-svn: 42332
2007-09-26 00:13:34 +00:00
Daniel Berlin
08f8188adc Fix small bug in operator== for iterators
llvm-svn: 42331
2007-09-26 00:11:59 +00:00
Hartmut Kaiser
fcecf23d48 Updated VC++ build system.
llvm-svn: 42330
2007-09-25 23:32:45 +00:00
Dale Johannesen
17663f40b9 Remove no-longer-used variable.
llvm-svn: 42329
2007-09-25 23:32:20 +00:00
Dale Johannesen
e7439eff5a Make APFloat->int conversions deterministic even in
cases with undefined behavior.

llvm-svn: 42328
2007-09-25 23:07:07 +00:00
Ted Kremenek
a88f7bcea3 Updated XCode project to reflect that DataflowValues.h and DataflowSolver.h have
moved to include/clang/Analysis/FlowSensitive.

llvm-svn: 42327
2007-09-25 22:45:38 +00:00
Chris Lattner
ccc1b69a52 explain why not vector<bool>
llvm-svn: 42324
2007-09-25 22:37:50 +00:00
Evan Cheng
5321fa44f4 Missing load / store folding entries.
llvm-svn: 42323
2007-09-25 22:10:43 +00:00
Anton Korobeynikov
90910745bb Partly revert invalid r41774
llvm-svn: 42322
2007-09-25 21:52:30 +00:00
Ted Kremenek
39fc60f280 Moved "DataflowSolver.h" to the "include/" subtree. Adjusted client
code that uses the solver to reflect the new location.

Created "FlowSensitive" subdirectory in include/clang/Analysis to hold
header files relating to flow-sensitive analyses.  Moved
"DataflowValues.h" into this subdirectory.

llvm-svn: 42320
2007-09-25 21:00:24 +00:00
Fariborz Jahanian
e2017c1d1d Patch to make ObjcImplementationDecl derived from TypeDecl and supprt legacy
objective-c code with no @interface declaration.

llvm-svn: 42319
2007-09-25 21:00:20 +00:00
Bill Wendling
982d57da39 Grammar fix.
llvm-svn: 42318
2007-09-25 20:45:10 +00:00
Ted Kremenek
9c3fe8d2e8 Fixed broken English in comment.
llvm-svn: 42317
2007-09-25 20:37:28 +00:00
Dan Gohman
57211c5550 More explicit keywords.
llvm-svn: 42316
2007-09-25 20:27:06 +00:00
Duncan Sands
384f4bd878 Add a newline to the end of this file.
llvm-svn: 42314
2007-09-25 20:08:48 +00:00
Dan Gohman
06919e8ef2 Fix a typo in a comment.
llvm-svn: 42313
2007-09-25 19:37:26 +00:00
Evan Cheng
8ee1ecfc50 New style x87 cmp instructions.
llvm-svn: 42312
2007-09-25 19:08:02 +00:00
Fariborz Jahanian
bfe13c566c This patch introduces a new class to keep track of class implementation info. It also adds more
semantic checks for class and protocol declarations. Test cases are good indications of kind of 
checking being done in this patch.

llvm-svn: 42311
2007-09-25 18:38:09 +00:00
Ted Kremenek
558be36672 Added "CheckASTConsumer", a function that generalizes
"CheckDiagnostics" (used for -parse-ast-check) to check the
diagnostics of any ASTConsumer.

Reimplemented CheckDiagnostics to use CheckASTConsumer instead.

Added driver option -warn-dead-stores-check, which checks the
diagnostics generated by the DeadStores checker.  This is implemented
using CheckASTConsumer.111

llvm-svn: 42310
2007-09-25 18:37:20 +00:00
Devang Patel
7bba386f72 Handle multiple induction variables.
This fixes PR714.

llvm-svn: 42309
2007-09-25 18:24:48 +00:00
Dan Gohman
31599685c7 When both x/y and x%y are needed (x and y both scalar integer), compute
both results with a single div or idiv instruction. This uses new X86ISD
nodes for DIV and IDIV which are introduced during the legalize phase
so that the SelectionDAG's CSE can automatically eliminate redundant
computations.

llvm-svn: 42308
2007-09-25 18:23:27 +00:00
Ted Kremenek
2826f6e63f Changed command line options "-check-dead-stores" and
"-check-uninit-values" to "-warn-dead-stores" and
"-warn-uninit-values"

llvm-svn: 42307
2007-09-25 18:05:45 +00:00
Devang Patel
440d13b55b Do not reserve DOM check for GetElementPtrInst.
llvm-svn: 42306
2007-09-25 17:55:50 +00:00
Ted Kremenek
2af52eb454 Comment formatting changes. No real content changes.
llvm-svn: 42305
2007-09-25 17:53:38 +00:00
Ted Kremenek
67f6ea19d7 Minor comment changes.
llvm-svn: 42304
2007-09-25 17:51:05 +00:00
Dale Johannesen
97d4bf2c41 Some tests for APFloat conversions.
llvm-svn: 42303
2007-09-25 17:50:55 +00:00
Evan Cheng
6cb71f7fe0 Forgot to check in the changes. Fix test case so it doesn't break with any scheduling changes.
llvm-svn: 42302
2007-09-25 17:47:38 +00:00
Ted Kremenek
9716d61923 Removed "EverKilled" class in DeadStores checker; it is no longer used.
llvm-svn: 42301
2007-09-25 17:47:04 +00:00
Devang Patel
5e1651d270 doh..
llvm-svn: 42300
2007-09-25 17:43:08 +00:00
Devang Patel
87d7e8ebcb Add transformation to update loop interation space. Now,
for (i=A; i<N; i++) {
  if (i < X && i > Y)
    do_something();
}

is transformed into

U=min(N,X); L=max(A,Y);
for (i=L;i<U;i++)
  do_somethihg();                            

llvm-svn: 42299
2007-09-25 17:31:19 +00:00
Dale Johannesen
4f55d9fe0f Fix long double<->shorter FP type conversions
of zero, infinity, and NaNs.

llvm-svn: 42298
2007-09-25 17:25:00 +00:00
Dan Gohman
5e1a428344 Move the setOperationAction(ISD::DEBUG_LOC, MVT::Other, Expand) and
the check to see if the assembler supports .loc from X86TargetLowering
into the superclass TargetLowering.

llvm-svn: 42297
2007-09-25 15:10:49 +00:00
Duncan Sands
4a229e908a Fix spelling.
llvm-svn: 42296
2007-09-25 13:53:22 +00:00
Hartmut Kaiser
c173edd271 Updated VC++ build system
llvm-svn: 42295
2007-09-25 13:08:03 +00:00
Duncan Sands
734b861299 Add missing end-of-file newlines.
llvm-svn: 42294
2007-09-25 07:10:01 +00:00
Ted Kremenek
ad8bce02f0 Further refactored DataflowSolver. Now most code for the solver is shared
between forward and backward analyses, with trait classes being used
to implement the key differences in operations/functionality.

Converted the LiveVariables analysis to use the generic DataflowSolver.  This,
along with removing some extra functionality that was not needed, reduced
the code for LiveVariables by over half.

Modified Driver code to handle the updated interface to LiveVariables.

Modified the DeadStores checker to handle the update interface to
LiveVariables.

Updated DataflowValues (generic ADT to store dataflow values) to also
store values for blocks.  This is used by DeadStores.  Updated some comments.

llvm-svn: 42293
2007-09-25 04:31:27 +00:00
Ted Kremenek
7e839f10cf Added extra "constness" to parameter.
llvm-svn: 42292
2007-09-25 04:30:51 +00:00
Chris Lattner
70d1faa17d use the right rounding mode.
llvm-svn: 42291
2007-09-25 04:29:44 +00:00
Ted Kremenek
ce5568f568 Added PersistentMap, an ADT that implements a map data structure that
is persistent.  Adds/removals to a PersistentMap do not result in
a map being modified, but a new map being created.  This will be useful
for path-sensitive analyses.  

The current implementation mainly makes copies to implement this
functionality.  If the map turns out to be extensively used, this
implementation will be replaced with a more efficient one that uses
data sharing (see comments in PersistentMap.h for more information).

llvm-svn: 42290
2007-09-25 04:26:20 +00:00
Owen Anderson
5d913aa357 Fill in the sections about my contributions.
llvm-svn: 42286
2007-09-25 02:10:58 +00:00
Evan Cheng
e95f391ef1 Added support for new condition code modeling scheme (i.e. physical register dependency). These are a bunch of instructions that are duplicated so the x86 backend can support both the old and new schemes at the same time. They will be deleted after
all the kinks are worked out.

llvm-svn: 42285
2007-09-25 01:57:46 +00:00
Evan Cheng
5924bf7d3b Added major new capabilities to scheduler (only BURR for now) to support physical register dependency. The BURR scheduler can now backtrace and duplicate instructions in order to avoid "expensive / impossible to copy" values (e.g. status flag EFLAGS for x86) from being clobbered.
llvm-svn: 42284
2007-09-25 01:54:36 +00:00
Evan Cheng
8a7dec736d New temporary option -new-cc-modeling-scheme to test the new cc modeling scheme.
llvm-svn: 42283
2007-09-25 01:50:04 +00:00
Evan Cheng
43686dad3d Rename keyword "modify" -> "implicit".
llvm-svn: 42282
2007-09-25 01:48:59 +00:00
Dale Johannesen
0241bb57b2 When mixing SSE and x87 codegen, it's possible to
have situations where an SSE instruction turns into
multiple blocks, with the live range of an x87
register crossing them.  To do this correctly make
sure we examine all blocks when inserting
FP_REG_KILL.  PR 1697.  (This was exposed by my
fix for PR 1681, but the same thing could happen
mixing x87 long double with SSE.)

llvm-svn: 42281
2007-09-24 22:52:39 +00:00
Bill Wendling
d40e795c19 Don't execute dump unless NDEBUG isn't defined.
llvm-svn: 42280
2007-09-24 22:43:48 +00:00
Daniel Berlin
c82c9f078a Comment fixups
llvm-svn: 42279
2007-09-24 22:20:45 +00:00
Dan Gohman
1b2156fcae Add support on x86 for having Legalize lower ISD::LOCATION to ISD::DEBUG_LOC
instead of ISD::LABEL with a manual .debug_line entry when the assembler
supports .file and .loc directives.

llvm-svn: 42278
2007-09-24 21:54:14 +00:00
Dan Gohman
3165699e4b Don't emit .debug_line header data if there aren't any lines to put in it,
such as will happen when .loc directives are used.

llvm-svn: 42277
2007-09-24 21:43:52 +00:00
Dan Gohman
9b00c07be5 Move the Asm->EOL() call for EmitDebugARanges outside the #ifdef for
consistency with the other currently empty sections.

llvm-svn: 42276
2007-09-24 21:36:21 +00:00
Dan Gohman
0baf84b2e1 Add support for emitting .file directives to set up file numbers for
use with .loc directives.

llvm-svn: 42275
2007-09-24 21:32:18 +00:00
Dan Gohman
0cc9d1b93b Merge hasDotLoc and hasDotFile into hasDotLocAndDotFile since .loc and .file
aren't really usable without each other. 

llvm-svn: 42274
2007-09-24 21:09:53 +00:00
Dale Johannesen
5026f4ba93 float->int conversion rounds toward 0. Duh.
Fixes PR1698.

llvm-svn: 42273
2007-09-24 21:06:09 +00:00
Dan Gohman
bd8331da87 Add a routine for emitting .file directives, for setting up
file numbers to use with .loc directives.

llvm-svn: 42272
2007-09-24 20:58:13 +00:00
Bruno Cardoso Lopes
6d5ada23db Added "LoadEffective" pattern to handle stack locations.
Fixed some comments

llvm-svn: 42271
2007-09-24 20:15:11 +00:00
Devang Patel
9e30e1a3be Do not promote null values because it may be unsafe to do so.
llvm-svn: 42270
2007-09-24 20:02:42 +00:00
Daniel Berlin
5d7136a1df Implement offline variable substitution in order to reduce memory
and time usage.
Fixup operator == to make this work, and add a resize method to DenseMap
so we can resize our hashtable once we know how big it should be.

llvm-svn: 42269
2007-09-24 19:45:49 +00:00
Dan Gohman
071efe28bb Fix the syntax for the .loc directive in preparation for using it.
llvm-svn: 42268
2007-09-24 19:25:06 +00:00
Daniel Berlin
d746bbd908 Add section on bit containers.
(Not the most well written stuff in the universe :P)

llvm-svn: 42267
2007-09-24 17:52:25 +00:00
Tanya Lattner
583e27d755 XFAIL for llvm-gcc4.0
llvm-svn: 42266
2007-09-24 17:14:53 +00:00
Dan Gohman
82dcfd2dab The code that used the StartLabelId label was removed, so remove the
code that creates the label too.

llvm-svn: 42265
2007-09-24 16:44:26 +00:00
Dan Gohman
6002818999 Use the correct result value type instead of using getValueType(0)
in ExpandEXTRACT_VECTOR_ELT and SplitVectorOp. This fixes an abort
in the included testcase.

llvm-svn: 42264
2007-09-24 15:54:53 +00:00
Dan Gohman
f818ccd463 Fix a typo in a comment.
llvm-svn: 42263
2007-09-24 15:50:11 +00:00
Dan Gohman
75470c3bf1 explicit keywords.
llvm-svn: 42262
2007-09-24 15:48:49 +00:00
Dan Gohman
043689cf7d Remove an unnecessary static_cast.
llvm-svn: 42261
2007-09-24 15:46:02 +00:00
Ted Kremenek
962942f7a4 Added smart pointer class "IntrusiveSPtr" that handles reference
counted objects that maintain their own internal reference count.
This smart pointer implementation is compatible with LLVM-style
down-casting (see in llvm: include/llvm/Support/Casting.h).

Implemented "RefCounted", a base class that objects that wish to be
managed using IntrusiveSPtrs can subclass.

Reference counted objects are being targeted for use in path-sensitive
dataflow analyses where managing many live objects becomes difficult.

llvm-svn: 42260
2007-09-24 06:10:20 +00:00
Chris Lattner
5b5484db63 claim that "st" is from the 80-bit register file. This causes x87-using inline
asm to die with:

ScheduleDAG.cpp:269: failed assertion `false && "Couldn't find the register class"'

instead of:
failed assertion `RegMap->getRegClass(VReg) == RC && "Register class of operand and regclass of use don't agree!"'

yay.

llvm-svn: 42259
2007-09-24 05:27:37 +00:00
Chris Lattner
d05e44e74e If we see an invalid #ifdef directive, enter a conditional compilation region
so that we don't emit an error on the #endif.  Suggestion by Neil.

llvm-svn: 42258
2007-09-24 05:14:57 +00:00
Chris Lattner
7d98b23f1a When emitting .set directives, make sure the EH and Debug labels can't conflict.
llvm-svn: 42257
2007-09-24 03:35:37 +00:00
Owen Anderson
32eed1542e Fix typo.
llvm-svn: 42256
2007-09-24 02:33:22 +00:00
Owen Anderson
4f7c390939 Merge significant portions of the DomTree and PostDomTree implementations.
The two remaining unmerged parts are DFSPass, and the Calculate().

llvm-svn: 42255
2007-09-24 02:29:29 +00:00
Dale Johannesen
acbb26f125 Just use APFloat for const / const. Fixes
-1. / -0.

llvm-svn: 42254
2007-09-24 00:32:45 +00:00
Chris Lattner
071107120c Fix for 64-bit systems.
llvm-svn: 42253
2007-09-23 23:53:07 +00:00
Hartmut Kaiser
e675ff918b Fixed VC++ bitfield to unsigned/signed sign propagation issue.
llvm-svn: 42252
2007-09-23 23:39:51 +00:00
Owen Anderson
15efb43db7 Factor the calculation details for PostDomTree out of PostDominators.cpp and
into a separate header file.

Next step: merging PostDominatorCalculation.h with DominatorCalculation.h.

llvm-svn: 42251
2007-09-23 22:21:00 +00:00
Owen Anderson
da853a400f Move DFSPass back down into DominatorTree. I need to figure out what the difference is between it
and the PostDomTree version first.

llvm-svn: 42250
2007-09-23 22:16:38 +00:00
Owen Anderson
7888658c5f Fix header.
llvm-svn: 42249
2007-09-23 21:32:55 +00:00
Owen Anderson
84c357fc26 Factor the dominator tree calculation details out into DominatorCalculation.h. This
change is not useful in and of itself, but it lays the groundwork for combining
the dominator and postdominator implementations.

Also, factor a few methods that are common to DominatorTree and PostDominatorTree
into DominatorTreeBase.  Again, this will make merging the two calculation methods
simpler in the future.

llvm-svn: 42248
2007-09-23 21:31:44 +00:00
Dale Johannesen
ae4bb05103 Implementation of +sse -sse2 has changed; add
-sse to preserve intent of this test.

llvm-svn: 42247
2007-09-23 14:58:14 +00:00
Dale Johannesen
e36c400255 Fix PR 1681. When X86 target uses +sse -sse2,
keep f32 in SSE registers and f64 in x87.  This
is effectively a new codegen mode.
Change addLegalFPImmediate to permit float and
double variants to do different things.
Adjust callers.

llvm-svn: 42246
2007-09-23 14:52:20 +00:00
Gordon Henriksen
9af2d596ed Fix srcdir <> objdir builds with ocaml 2.10. Downrev versions don't care whether
'dir' exists in 'ocamldep -I dir ...', but recent ones demand that it actually
exists.

llvm-svn: 42245
2007-09-23 13:37:44 +00:00
Chris Lattner
0af0591143 fix syntax
llvm-svn: 42242
2007-09-22 23:41:15 +00:00
Gordon Henriksen
6ab5c57663 Regenerate.
llvm-svn: 42241
2007-09-22 21:36:59 +00:00
Gordon Henriksen
54fd757f4f Fix for srcdir <> objdir builds.
Thanks Bill.

llvm-svn: 42240
2007-09-22 21:36:22 +00:00
Chris Lattner
e48195e0f3 Fix PR1679, by printing GEP indices as signed values instead of unsigned.
llvm-svn: 42239
2007-09-22 20:16:48 +00:00
Chris Lattner
322abe3573 Use the APFloat routines to evaluate FP immediates as
integer constant expressions.  The only questionable
thing is that we now reject:

void foo() {
  switch (1) {
  case (int)1.0e10000:
    ;
  }
}

with:

t.c:5:13: error: case label does not reduce to an integer constant
  case (int)1.0e10000:
       ~~~~~^~~~~~~~~

GCC accepts this, emitting the pedwarn:
t.c:5: warning: floating constant exceeds range of 'double'

llvm-svn: 42238
2007-09-22 19:04:13 +00:00
Chris Lattner
9da7bc110a add comments.
llvm-svn: 42237
2007-09-22 18:48:32 +00:00
Chris Lattner
2dd003e807 further apfloat'ize the front-end, allowing codegen to pass
APFloat straight through to LLVM now.

llvm-svn: 42236
2007-09-22 18:47:25 +00:00
Chris Lattner
c2d09cfe75 work around bugs and missing features in apfloat.
llvm-svn: 42235
2007-09-22 18:38:30 +00:00
Chris Lattner
ec0a6d9be5 Use APFloat for the representation of FP immediates, ask the target
for *which* apfloat to use for a particular type.

llvm-svn: 42234
2007-09-22 18:29:59 +00:00
Bill Wendling
20e469e99b Validation fixes
llvm-svn: 42232
2007-09-22 10:17:08 +00:00
Bill Wendling
99dbd04c5d Validation fixes
llvm-svn: 42231
2007-09-22 10:13:39 +00:00
Bill Wendling
31e1e5e37a Validation fixes
llvm-svn: 42230
2007-09-22 10:07:00 +00:00
Bill Wendling
bdd6bd8236 Validation fixes
llvm-svn: 42229
2007-09-22 10:03:25 +00:00
Bill Wendling
370dac7346 Validation fixes
llvm-svn: 42228
2007-09-22 09:56:28 +00:00
Bill Wendling
beee622c4d Validation fixes
llvm-svn: 42227
2007-09-22 09:54:47 +00:00
Bill Wendling
8715e0c490 Validation fixes
llvm-svn: 42226
2007-09-22 09:39:19 +00:00
Bill Wendling
252570f0ad Validation fixes
llvm-svn: 42225
2007-09-22 09:23:55 +00:00
Bill Wendling
6637c57c54 Validation fixes
llvm-svn: 42224
2007-09-22 09:20:07 +00:00
Bill Wendling
6275c23755 Formatting changes.
llvm-svn: 42223
2007-09-22 09:16:44 +00:00
Chris Lattner
10671ad650 initialize isstore/isload fields in ctor, fixing PR1695
llvm-svn: 42222
2007-09-22 07:02:12 +00:00
Chris Lattner
5b95a171e2 fix bugs in the manual
llvm-svn: 42221
2007-09-22 03:17:52 +00:00
Neil Booth
a8d7269269 Handle storage complications of float->float conversions.
llvm-svn: 42220
2007-09-22 02:56:19 +00:00
Tanya Lattner
cf3e26fff2 Correct names.
llvm-svn: 42219
2007-09-22 00:03:01 +00:00
Fariborz Jahanian
7e5d533098 This patch adds to new things to clang:
1. Handles saving and checking on protocols used in an @interface declaration
2. Checks and saves class's super class.
3. Adds semantic check to category declarations.

llvm-svn: 42218
2007-09-22 00:01:35 +00:00
Tanya Lattner
08abc81a44 Fix typo.
llvm-svn: 42217
2007-09-22 00:01:26 +00:00
Tanya Lattner
0186a65ac7 One last fix to get name correct.
llvm-svn: 42216
2007-09-21 23:57:59 +00:00
Tanya Lattner
afcdaf58d4 Fix silly typo.
llvm-svn: 42215
2007-09-21 23:57:04 +00:00
Tanya Lattner
23dbd57214 Update annotation intrinsic with more details.
llvm-svn: 42214
2007-09-21 23:56:27 +00:00
Tanya Lattner
293c037336 Adding support for __builtin_annotation with an intrinsic called llvm.annotation. This is similar to llvm.var.annotation but is applied to expressions.
llvm-svn: 42211
2007-09-21 22:59:12 +00:00
Dale Johannesen
4230512f32 Change APFloat::convertFromInteger to take the incoming
bit width instead of number of words allocated, which
makes it actually work for int->APF conversions.
Adjust callers.  Add const to one of the APInt constructors
to prevent surprising match when called with const
argument.

llvm-svn: 42210
2007-09-21 22:09:37 +00:00
Devang Patel
361e52f39c Fix PR1692
llvm-svn: 42209
2007-09-21 21:18:19 +00:00
Owen Anderson
3e466535cf Fix CopyFrom for non-POD data types.
llvm-svn: 42208
2007-09-21 20:55:54 +00:00
Chris Lattner
87ce0bec91 #ifdef out unsafe tracing code, which fixes PR1689
llvm-svn: 42205
2007-09-21 18:30:39 +00:00
Chris Lattner
51ce795c92 don't read Block after it is freed. This fixes PR1684
llvm-svn: 42204
2007-09-21 18:25:53 +00:00
Chris Lattner
4b2ff02f72 Make case sorting deterministic by not depending on pointer
values.  Patch mostly by Gabor Greif for PR1682.

llvm-svn: 42203
2007-09-21 18:15:22 +00:00
Devang Patel
d331c8565f Add missing entry.
llvm-svn: 42202
2007-09-21 18:02:24 +00:00
Chris Lattner
af6912f980 gcroot testcase, patch by Eric Christopher.
llvm-svn: 42198
2007-09-21 17:48:39 +00:00
Chris Lattner
1af762f736 I cannot spell coalesce :)
llvm-svn: 42196
2007-09-21 17:43:52 +00:00
Chris Lattner
12477735f9 gcroot must take concrete types, not arbitrary types.
clean up intrinsic descriptions in langref a bit.

llvm-svn: 42194
2007-09-21 17:30:40 +00:00
Chris Lattner
b3d01d2f56 initialize SetCCResultContents, fixing PR1693
llvm-svn: 42193
2007-09-21 17:06:39 +00:00
Rafael Espindola
4730c04904 Don't add a default STACK_ALIGN (use the generic ABI alignment)
Implement calls to functions with byval arguments on X86

llvm-svn: 42192
2007-09-21 15:50:22 +00:00
Fariborz Jahanian
876e27dafa This patch instantiates objects for forward protocols and in general handles use of
protocols referenced in @protocol declarations.

llvm-svn: 42191
2007-09-21 15:40:54 +00:00
Dan Gohman
3bb3452dbc There is no {rsqrt,rcp}{p,s}d.
llvm-svn: 42190
2007-09-21 15:24:00 +00:00
Rafael Espindola
f065f0e2a1 small cleanup: use LowerMemArgument in LowerFastCCArguments also
llvm-svn: 42189
2007-09-21 14:55:38 +00:00
Chris Lattner
0a1fd10483 Initial hack at 2.1 release notes.
llvm-svn: 42186
2007-09-21 03:54:09 +00:00
Owen Anderson
46da2a6262 Add partial caching of non-local memory dependence queries. This provides a modest
speedup for GVN.

llvm-svn: 42185
2007-09-21 03:53:52 +00:00
Evan Cheng
1ff71872c2 Honor user-defined section specification of a global, ignores whether its initializer is null.
llvm-svn: 42182
2007-09-21 00:41:19 +00:00
Dale Johannesen
146a0ea071 Fix PR 1688. See comments there.
llvm-svn: 42181
2007-09-20 23:47:58 +00:00
Devang Patel
83cc3f8f51 Update aux. info associated with an instruction before erasing instruction.
llvm-svn: 42180
2007-09-20 23:45:50 +00:00
Devang Patel
d29f938335 Do not override user specified section.
llvm-svn: 42179
2007-09-20 23:07:37 +00:00
Devang Patel
6117a3b696 Don't increment invalid iterator.
llvm-svn: 42178
2007-09-20 23:01:50 +00:00
Hartmut Kaiser
3f5d492c70 Updated VC++ project files
llvm-svn: 42177
2007-09-20 21:54:10 +00:00
Ted Kremenek
8483a4ab05 Updated XCode project with locations of "Analysis" visitor header files.
llvm-svn: 42176
2007-09-20 21:47:32 +00:00
Ted Kremenek
24c624477e Updated header file inlcude to new location of
Analysis/Visitors/*Visitors.h files.

llvm-svn: 42175
2007-09-20 21:42:55 +00:00
Ted Kremenek
3b2050b322 Renamed "include/clang/Analysis/CFGVisitors" "<snip>/Analysis/Visitors".
"Visitors" is more general than "CFGVisitors", as we aren't just using
visitation useful for CFG analysis.

llvm-svn: 42174
2007-09-20 21:42:03 +00:00
Ted Kremenek
706df48fea Moved include/clang/Analysis/*Visitor.h to include/clang/Analysis/CFGVisitors.
We had enough visitors that it was cluttering the Analysis directory.

llvm-svn: 42173
2007-09-20 21:40:36 +00:00
Fariborz Jahanian
397d8de9ed Handle forward declaration of classes and prevent re-instantiation of
ObjcInterfaceClass Objects.

llvm-svn: 42172
2007-09-20 20:26:44 +00:00
Duncan Sands
416b9f0410 Testcase for PR1678.
llvm-svn: 42171
2007-09-20 18:56:24 +00:00
Evan Cheng
723dab1005 Disable if-conversion for this test.
llvm-svn: 42170
2007-09-20 18:06:22 +00:00
Evan Cheng
77d4771405 -enable-arm-if-conversion is gone.
llvm-svn: 42169
2007-09-20 18:03:23 +00:00
Fariborz Jahanian
a8bbc63c1f Match to do some semantic analysis on objective-c class decl.
1. Detect used of undeclared/forward declared super class.
2. Detect duplicate definition of a class.

llvm-svn: 42168
2007-09-20 17:54:07 +00:00
Dale Johannesen
cc7c475705 Fix dumb regression in constant folding (Regression/C/casts)
llvm-svn: 42165
2007-09-20 16:50:21 +00:00
Gordon Henriksen
d1e1645a4e Regenerate.
llvm-svn: 42164
2007-09-20 16:48:18 +00:00
Gordon Henriksen
1f982339e7 Incorporating review feedback for GC verifier patch.
llvm-svn: 42163
2007-09-20 16:47:41 +00:00
Dan Gohman
4dbc582a36 Fix several more entries in the x86 reload/remat folding tables.
llvm-svn: 42162
2007-09-20 14:17:21 +00:00
Hartmut Kaiser
8a43d50f40 Updated VC++ project files.
Disambiguated a variable.

llvm-svn: 42161
2007-09-20 13:35:09 +00:00
Gabor Greif
4a46052d30 use typenames equivalent to
(u)intval, because latter are not
present in older caml/mlvalues.h
(e.g. 2004/07/07, 1.48.6.1)

Using this as a workaround for now,
until --without-ocaml works
or we settle on a better solution

llvm-svn: 42160
2007-09-20 10:20:34 +00:00
Dale Johannesen
95be037d67 another long double buglet
llvm-svn: 42159
2007-09-20 01:27:54 +00:00
Nick Lewycky
e7be16a053 Excuse me.
llvm-svn: 42158
2007-09-20 00:57:00 +00:00
Nick Lewycky
eae7e7d00b Fix optimization. %x = sub %x, %y does not imply that %y is zero.
llvm-svn: 42157
2007-09-20 00:48:36 +00:00
Evan Cheng
8010320365 Enable if-conversion for ARM by default.
llvm-svn: 42156
2007-09-20 00:48:22 +00:00
Dale Johannesen
7d67e547b5 More long double fixes. x86_64 should build now.
llvm-svn: 42155
2007-09-19 23:55:34 +00:00
Evan Cheng
d0e360e16e Avoid referencing deleted instruction.
llvm-svn: 42153
2007-09-19 21:48:07 +00:00
Ted Kremenek
66d130a584 Added support to clang driver to view ASTs using GraphViz. This
functionality is still preliminary.

llvm-svn: 42152
2007-09-19 21:29:43 +00:00
Ted Kremenek
ebc5500e50 Previously GraphWriter assumed operator*() for node_iterator always
returned a reference type.  This patch allows operator*() to return a
non-reference type while still maintaining the old behavior when it
does return a reference type.

This patch was motivated when I tried to use "df_iterator" (see
llvm/ADT/DepthFirstIterator.h) as a "node_iterator", as df_iterator
does not return a reference type and thus we would get a compilation
error when trying to take the address of a temporary.

llvm-svn: 42151
2007-09-19 21:26:49 +00:00
Ted Kremenek
a8f4ef5846 Moved GraphTraits<Stmt*> to StmtGraphTraits.h. This allows consumers of Stmt.h not to have to pay the cost
of parsing the GraphTraits templates if they don't need that functionality.

Defined nodes_iterator for GraphTraits<Stmt*> to be based on llvm::df_iterator.

llvm-svn: 42150
2007-09-19 21:21:39 +00:00
Devang Patel
464276f831 Avoid unsafe promotion.
llvm-svn: 42149
2007-09-19 20:18:51 +00:00
Fariborz Jahanian
62fd2b4730 Patch to parse objective-c's @try-statement and @throw-statement.
llvm-svn: 42148
2007-09-19 19:14:32 +00:00
Evan Cheng
513874cf3c PSHUFDmi, etc. are actually folding a load, not a store.
llvm-svn: 42147
2007-09-19 19:02:47 +00:00
Ted Kremenek
a3d706a778 Added GraphTraits template specialization for Stmt* to treat ASTs like graphs.
llvm-svn: 42146
2007-09-19 18:18:40 +00:00
Ted Kremenek
ec55ce39a6 More refactoring: decl and expr regisitration now uses CFGRecStmtDeclVisitor.
llvm-svn: 42145
2007-09-19 18:00:03 +00:00
Ted Kremenek
5885a5b417 Added two new visitors that extend CFGStmtVisitor: CFGRecStmtVisitor and CFGRecStmtDeclVisitor.
The extended functionality of these visitors is that they automatically visit all statements in
an AST (no explicit recursion is required from subclasses), and the for the latter, decls are visited
as well.

llvm-svn: 42144
2007-09-19 17:59:28 +00:00
Dale Johannesen
b59d25fe54 Fix longdouble -> uint conversion.
llvm-svn: 42143
2007-09-19 17:53:26 +00:00
Chris Lattner
d79f3d51b1 reject things like "declare internal @foo"
llvm-svn: 42140
2007-09-19 17:14:45 +00:00
Steve Naroff
2cd263ff71 Remove SelectorTable/SelectorInfo, simply store all selectors in the central IdentifierTable.
Rationale:

We currently have a separate table to unique ObjC selectors. Since I don't need all the instance data in IdentifierInfo, I thought this would save space (and make more sense conceptually).

It turns out the cost of having duplicate entries for unary selectors (i.e. names without colons) outweighs the cost difference between the IdentifierInfo & SelectorInfo structures. Here is the data:

Two tables:

*** Selector/Identifier Stats:
# Selectors/Identifiers: 51635 
Bytes allocated:         1999824

One table:

*** Identifier Table Stats:
# Identifiers:   49500
Bytes allocated: 1990316

llvm-svn: 42139
2007-09-19 16:18:46 +00:00
Owen Anderson
c201cbc802 Add a flag to mark a dirty cache entry. This is not yet used, but will eventually
help non-local memdep caching.

llvm-svn: 42137
2007-09-19 16:13:57 +00:00
Dale Johannesen
f4bad97ea0 Fix some long double issues.
llvm-svn: 42133
2007-09-19 14:22:58 +00:00
Duncan Sands
d31649bc59 Improve comment.
llvm-svn: 42132
2007-09-19 10:25:38 +00:00
Duncan Sands
a38e527523 Partial fix for PR1678: correct some parts of constant
fold that were missed in the fix for PR1646.  Probably
this null/not-null logic should be factorized somewhere.

llvm-svn: 42131
2007-09-19 10:16:17 +00:00
Duncan Sands
56df7dec2b A global variable with external weak linkage can be null, while
an alias could alias such a global variable.

llvm-svn: 42130
2007-09-19 10:10:31 +00:00
Gabor Greif
ef858c9ff6 include alloca.h if available. this helps Solaris, but intnat and uintnat types are still undefined, causing errors
llvm-svn: 42129
2007-09-19 09:29:58 +00:00
Duncan Sands
4e426623f5 Testcase for PR1678.
llvm-svn: 42128
2007-09-19 07:43:17 +00:00
Steve Naroff
59155be0b2 Remove #include of config.h, it is no longer needed.
llvm-svn: 42126
2007-09-19 03:01:22 +00:00
Evan Cheng
0effc3a6b8 Use struct SDep instead of std::pair for SUnit pred and succ lists. First step
in tracking physical register output dependencies.

llvm-svn: 42125
2007-09-19 01:38:40 +00:00
Evan Cheng
17f589f76e Set CCR (EFLAGS) copy cost to -1, i.e. extremely expensive to copy.
llvm-svn: 42124
2007-09-19 01:36:39 +00:00
Evan Cheng
f73fb6261b Add CopyCost to TargetRegisterClass. This specifies the cost of copying a value
between two registers in the specific class.

llvm-svn: 42123
2007-09-19 01:35:01 +00:00
Devang Patel
69a55a38ed Relax loop ExitCondition predicate restriction.
llvm-svn: 42122
2007-09-19 00:28:47 +00:00
Devang Patel
455a53b7db Filter loops where split condition's false branch is not empty. For example
for (int i = 0; i < N; ++i) {
  if (i == somevalue)
    dosomething();
   else
    dosomethingelse();
}

llvm-svn: 42121
2007-09-19 00:15:16 +00:00
Devang Patel
4c238c451f Bail out early, before modifying anything.
llvm-svn: 42120
2007-09-19 00:11:01 +00:00
Devang Patel
31f2c8592c Work is incomplete. Loop is not modified at all right now.
llvm-svn: 42119
2007-09-19 00:08:13 +00:00
Devang Patel
ee35011d01 ooops...
llvm-svn: 42118
2007-09-18 23:58:14 +00:00
Steve Naroff
467e619a65 Remove alloca import...
llvm-svn: 42117
2007-09-18 23:56:42 +00:00
Steve Naroff
d54978ba8b Progress on message expressions...
- Add ObjcMessageExpr AST node and associated constructors.
- Add SourceLocation's to ActOnKeywordMessage/ActOnUnaryMessage API.
- Instantiate message expressions...
- Replace alloca usage with SmallString.

Next step, installing a correct type, among other tweaks...

llvm-svn: 42116
2007-09-18 23:55:05 +00:00
Ted Kremenek
fb9ea52a13 DataflowSolver now acccepts an "_Equal" template parameter that allows the user
to specify how two dataflow values should be compared for equality.  The default
is to use std::equal_to.

llvm-svn: 42115
2007-09-18 23:40:51 +00:00
Ted Kremenek
d51126b97e Fixed bug where getBitRef would incorrectly grab the bit from the
wrong bitvector.

llvm-svn: 42114
2007-09-18 23:30:45 +00:00
Ted Kremenek
9427b0e23b Changed solver to use "==" operator when comparing dataflow values
rather than a special "equal" method defined in the class for the
value.

llvm-svn: 42113
2007-09-18 23:30:21 +00:00
Evan Cheng
e7ff9da64b Clean up.
llvm-svn: 42112
2007-09-18 22:56:31 +00:00
Evan Cheng
e2e8f2d96b Fix a bogus splat xform:
shuffle <undef, undef, x, undef>, <undef, undef, undef, undef>, <2, 2, 2, 2>
!=
<undef, undef, x, undef>

llvm-svn: 42111
2007-09-18 21:54:37 +00:00
Ted Kremenek
8d4dcc5409 Minor performance fix in transfer function logic. Previously we
called VisitStmt, but VisitChildren is more direct and creates less
boilerplate logic.

llvm-svn: 42110
2007-09-18 21:47:41 +00:00
Ted Kremenek
271161078b More refactoring and code reduction.
llvm-svn: 42109
2007-09-18 21:43:18 +00:00
Gabor Greif
49122edc98 rename test, it is obviously misspelled
llvm-svn: 42108
2007-09-18 21:42:39 +00:00
Ted Kremenek
b1361eaaa7 Add overloaded versions of DataflowSolver::runOnBlock to simplify
invocation of the solver.

UninitializedValues checker now uses CFG::runOnAllBlocks to query the
computed dataflow values (tighter code).

llvm-svn: 42107
2007-09-18 21:08:21 +00:00
Ted Kremenek
360c3b4abb Added member template CFG::VisitBlockStmts to provide a succinct way
of visiting all block-level statements in a CFG.

Tightened implementation of UninitializedValues.

llvm-svn: 42106
2007-09-18 20:59:00 +00:00
Ted Kremenek
2bde624474 Additional comments and cosmetic cleanups.
llvm-svn: 42105
2007-09-18 20:44:03 +00:00
Fariborz Jahanian
867a7eb5cb Patch for object creation and handling of category declarations.
llvm-svn: 42104
2007-09-18 20:26:58 +00:00
Dale Johannesen
af12b57405 Prevent crash on long double.
llvm-svn: 42103
2007-09-18 18:36:59 +00:00
Ted Kremenek
df9a2a9f8b Moved TransferFunction object within DataflowSolver to be a instance
variable instead of a temporary.

llvm-svn: 42102
2007-09-18 18:17:19 +00:00
Gordon Henriksen
dc88c06732 Tests of the ocaml (and thus C) bindings for constants.
llvm-svn: 42101
2007-09-18 18:07:51 +00:00
Ted Kremenek
584e21a349 Modified DataFlowValues and DataflowSolver to associate dataflow value
with CFG *edges* instead of blocks.  This will fascilitate dataflow
analyses that are sensitive to block terminators, and also simplifies
some reasoning.

Updated UninitializedValues to comply to this new interface.

llvm-svn: 42099
2007-09-18 18:02:44 +00:00
Ted Kremenek
1d77d76837 Added type "CFG::Edge" to encapsulate the notion of directed-edges
within source-level CFGs.

llvm-svn: 42098
2007-09-18 18:01:15 +00:00
Dan Gohman
8cca8469de Move the entries for 64-bit CMP, IMUL, and a few others into the correct
tables so that they are eligible for reload/remat folding. And add
entries for JMP and CALL.

llvm-svn: 42094
2007-09-18 14:59:14 +00:00
Gordon Henriksen
37582f74cd Adding ocaml language bindings for the vmcore and bitwriter libraries. These are
built atop the C language bindings, and user programs can link with them as 
such:

  # Bytecode
  ocamlc -cc g++ llvm.cma llvmbitwriter.cma -o example example.ml
  # Native
  ocamlopt -cc g++ llvm.cmxa llvmbitwriter.cmxa -o example.opt example.ml

The vmcore.ml test exercises most/all of the APIs thus far bound. Unfortunately,
they're not yet numerous enough to write hello world. But:

  $ cat example.ml
  (* example.ml *)
  
  open Llvm
  open Llvm_bitwriter
  
  let _ =
    let filename = Sys.argv.(1) in
    let m = create_module filename in
    
    let v = make_int_constant i32_type 42 false in
    let g = define_global "hello_world" v m in
    
    if not (write_bitcode_file m filename) then exit 1;
    
    dispose_module m;

  $ ocamlc -cc g++ llvm.cma llvm_bitwriter.cma -o example example.ml
  File "example.ml", line 11, characters 6-7:
  Warning Y: unused variable g.
  $ ./example example.bc
  $ llvm-dis < example.bc
  ; ModuleID = '<stdin>'
  @hello_world = global i32 42            ; <i32*> [#uses=0]

The ocaml test cases provide effective tests for the C interfaces.

llvm-svn: 42093
2007-09-18 12:49:39 +00:00
Gordon Henriksen
4c7ca7d61e Regenerate.
llvm-svn: 42092
2007-09-18 12:27:13 +00:00
Gordon Henriksen
c0f56013e1 (no commit message)
llvm-svn: 42091
2007-09-18 12:26:59 +00:00
Gordon Henriksen
5c4d7b8052 (no commit message)
llvm-svn: 42090
2007-09-18 12:26:17 +00:00
Hartmut Kaiser
ae27fdc0f4 alloca.h doesn't exist on Windows.
llvm-svn: 42089
2007-09-18 12:16:59 +00:00
Gabor Greif
56c83140c1 alloca.h is needed on Solaris
llvm-svn: 42088
2007-09-18 11:01:25 +00:00
Gordon Henriksen
be6bd16418 Incorporating review feedback for GC verifier patch.
llvm-svn: 42087
2007-09-18 10:14:30 +00:00
Bill Wendling
e8c885f261 Don't pass back a reference to a temporary.
llvm-svn: 42086
2007-09-18 09:10:16 +00:00
Bill Wendling
a83fd8014d Update my entry.
llvm-svn: 42079
2007-09-18 05:28:19 +00:00
Bill Wendling
69833b61ac The exception handling function info should be reset for each new
function. The information isn't used heavily -- it's only used at the end
of exception handling emission -- so there's no need to cache it.

llvm-svn: 42078
2007-09-18 05:03:44 +00:00
Gordon Henriksen
76a0374b25 C bindings for libLLVMCore.a and libLLVMBitWriter.a.
- The naming prefix is LLVM.
- All types are represented using opaque references.
- Functions are not named LLVM{Type}{Method}; the names became
  unreadable goop. Instead, they are named LLVM{ImperativeSentence}.
- Where an attribute only appears once in the class hierarchy (e.g.,
  linkage only applies to values; parameter types only apply to
  function types), the class is omitted from identifiers for
  brevity. Tastes like methods.
- Strings are C strings or string/length tuples on a case-by-case
  basis.
- APIs which give the caller ownership of an object are not mapped
  (removeFromParent, certain constructor overloads). This keeps
  keep memory management as simple as possible.

For each library with bindings:

  llvm-c/<LIB>.h       - Declares the bindings.
  lib/<LIB>/<LIB>.cpp  - Implements the bindings.

So just link with the library of your choice and use the C header
instead of the C++ one.

llvm-svn: 42077
2007-09-18 03:18:57 +00:00
Gordon Henriksen
64e72c034a Fixing an comment in Module.h that refers to a nonexistent parameter.
Also adding some missing svn:ignores that've been bothering me.

llvm-svn: 42076
2007-09-18 02:09:34 +00:00
Devang Patel
fcda998ab2 Fix PR1657
llvm-svn: 42075
2007-09-18 01:54:42 +00:00
Bill Wendling
067f1d8e95 Objective-C was generating EH frame info like this:
"_-[NSString(local) isNullOrNil]".eh = 0
        .no_dead_strip  "_-[NSString(local) isNullOrNil]".eh

The ".eh" should be inside the quotes.

llvm-svn: 42074
2007-09-18 01:47:22 +00:00
Fariborz Jahanian
0c74e9d161 Uses more description name for method implementation kind argument.
Moves such argument as the last argument and uses defaul value.

llvm-svn: 42073
2007-09-18 00:25:23 +00:00
Hartmut Kaiser
a9deb50918 Updated VC++ project files after file rename.
llvm-svn: 42072
2007-09-17 23:33:12 +00:00
Bill Wendling
5752f692ed Add support for appending a suffix to the end of a mangled name.
llvm-svn: 42071
2007-09-17 22:39:32 +00:00
Fariborz Jahanian
cfacdae9a8 Patch to remove ObjcProtoMethodDecl and use ObjcMethodDecl
instead for @protocol method decls.

llvm-svn: 42070
2007-09-17 22:36:42 +00:00
Evan Cheng
ffd6995cc7 Bug fix and minor clean up of generated code.
llvm-svn: 42069
2007-09-17 22:26:41 +00:00
Devang Patel
00064e1bab Do not hide APInt::dump() inside #ifndef NDEBUG.
llvm-svn: 42068
2007-09-17 22:24:00 +00:00
Ted Kremenek
3c996d9a60 Bug fix to merging of data flow values (merge incorrectly made values
too "conservative").

Several revisions to UninitializedValues checker after testing.  We
now appear to be working correctly (probably some bugs still, but main
functionality appears to be there).  Implemented careful emitting of
warnings so that we wouldn't get a cascade of warnings for simply not
defining a single variable and using it everywhere.  This way the
warnings point closer to the root cause rather than "symptoms" from
using values derived from uninitialized variables.

llvm-svn: 42067
2007-09-17 21:59:08 +00:00
Tanya Lattner
613ccacb49 Fix broken default help strings for enable-shared, enable-static, and enable-fast-install. Regenerate configure script.
llvm-svn: 42066
2007-09-17 21:41:15 +00:00
Steve Naroff
c4657d00bb Add a comment and remove unused constructors.
llvm-svn: 42063
2007-09-17 21:26:50 +00:00
Ted Kremenek
fb5c46c740 Made driver flag --check-uninit-values more self-explanatory.
llvm-svn: 42062
2007-09-17 21:21:20 +00:00
Hartmut Kaiser
f696cfcf06 Fixed a VC++ issue related to bitmasks. As it turns out the compiler fills the unused bits of the word a bitmask is stored in with '1' (or randomly, I can't tell, I've seen '1' so far only), which creates wrong results in certain cases.
Please review.

llvm-svn: 42061
2007-09-17 21:11:08 +00:00
Fariborz Jahanian
39d641f526 Patch to add objective-c's @protocl type declaration.
llvm-svn: 42060
2007-09-17 21:07:36 +00:00
Steve Naroff
f0f2afce5a Finish defining Action API for message expressions.
llvm-svn: 42059
2007-09-17 21:01:15 +00:00
Devang Patel
267c07b51f Do not eliminate loop when it is invalid to do so. For example,
for(int i = 0; i < N; i++) {
	if ( i == XYZ) {
		A;
	else
		B;
	}
	C;
	D;
}

llvm-svn: 42058
2007-09-17 21:01:05 +00:00
Ted Kremenek
1abd5c9d8f Re-added UninitializedValues.cpp to the XCode project because the file was renamed.
llvm-svn: 42057
2007-09-17 20:52:52 +00:00
Ted Kremenek
d0b206fd98 Renamed file due to mispelling.
llvm-svn: 42056
2007-09-17 20:50:02 +00:00
Ted Kremenek
7e61e81bbf UninitialuzedValues now only tracks BlockVarDecls; obviating false positives with
globals and function parameters.

llvm-svn: 42055
2007-09-17 20:49:30 +00:00
Devang Patel
712dbe9d13 Skeleton for transformations to truncate loop's iteration space.
llvm-svn: 42054
2007-09-17 20:39:48 +00:00
Gordon Henriksen
a2f3e13cf4 Fix for PR1633: Verifier doesn't fully verify GC intrinsics
LLVM now enforces the following prototypes for the write barriers:

<ty>* @llvm.gcread(<ty2>*, <ty>**)
void @llvm.gcwrite(<ty>*, <ty2>*, <ty>**)

And for @llvm.gcroot, the first stack slot is verified to be an alloca or a 
bitcast of an alloca.

Fixes test/CodeGen/Generic/GC/lower_gcroot.ll, which violated these.

llvm-svn: 42051
2007-09-17 20:30:04 +00:00
Steve Naroff
486760aee3 - Refactored ObjcKeywordInfo into ObjcKeywordInfo, ObjcKeywordDecl, and ObjcKeywordMessage.
- Removed helper ObjcGetSelectorInfo(), moving the code directly into ObjcBuildMethodDeclaration().
- Many refinements to ParseObjCMessageExpression().
- Add ActOnMessageExpression().

Next step, finish the message actions and (finally) create/instantiate an ObjcMessageExpr AST.

llvm-svn: 42050
2007-09-17 20:25:27 +00:00
Dale Johannesen
ff7e443792 Remove RSTRegClass case from loadRegFromStackSlot
and storeRegToStackSlot.  Evan and I concluded this
should never be needed and it appears to be true.
(It if is needed, adjustment would be needed for
long double to work.)

llvm-svn: 42049
2007-09-17 20:15:38 +00:00
Devang Patel
9d1af9b63d Fix comment.
llvm-svn: 42048
2007-09-17 20:07:40 +00:00
Devang Patel
77ae4d358f This is not ideal but unbreaks build failure.
APInt::dump() is inside #ifndef NDEBUG, however SelectionDAG dump() routines are not.

llvm-svn: 42047
2007-09-17 20:03:03 +00:00
Ted Kremenek
dd3015375c More progress on UnitializedValues checker. We now have preliminary support
for reporting errors and running the checker.

llvm-svn: 42046
2007-09-17 19:59:27 +00:00
Dale Johannesen
a1336cf57e Implement x86 long double in jit (not really
complete, but common cases work)

llvm-svn: 42043
2007-09-17 18:44:13 +00:00
Chris Lattner
0625bd6472 Merge DenseMapKeyInfo & DenseMapValueInfo into DenseMapInfo
Add a new DenseMapInfo::isEqual method to allow clients to redefine
the equality predicate used when probing the hash table.

llvm-svn: 42042
2007-09-17 18:34:04 +00:00
Ted Kremenek
6f0751475a Split tracking of unitialized values for Decls and CFGBlock-level expressions.
llvm-svn: 42041
2007-09-17 18:31:23 +00:00
Daniel Berlin
bd590a8287 That's what i get for using carbon emacs in a terminal
llvm-svn: 42040
2007-09-17 18:05:59 +00:00
Daniel Berlin
28ae955181 Fix iterator so it doesn't sometimes report bits that aren't in the bitmap
llvm-svn: 42039
2007-09-17 18:04:21 +00:00
Dan Gohman
e903c1021f Add a utility function to SDOperand for testing if a value is unused.
llvm-svn: 42038
2007-09-17 17:44:31 +00:00
Evan Cheng
8070099fef X86ISD::TEST is dead.
llvm-svn: 42037
2007-09-17 17:42:53 +00:00
Chris Lattner
1406f7143b regenerate
llvm-svn: 42036
2007-09-17 17:40:48 +00:00
Dan Gohman
2ac2652779 Instcombine x-((x/y)*y) into a remainder operator.
llvm-svn: 42035
2007-09-17 17:31:57 +00:00
Ted Kremenek
789ea076a8 Removed "ObserverTy" from core DataflowValues types. The observer
mechanism can be implemented simply by affixing the Observer to an
analysis meta data, so it doesn't need to be a required type.  This
also permits analyses not to implement an Observer if it doesn't make
sense.

Changed "DataflowValues::MetaDataTy" to
"DataflowValues::AnalysisDataTy" to reflect that the type
enscapsulated the data associated with analyzing a given CFG.

Changed CFGStmtVisitor::BlockStmt_VisitImplicitControlFlowStmt(Stmt*)
to ...VisitImplicitControlFlowExpr(Expr*).  The type narrowing is more
precise and more useful to clients.

Added CFGStmtVisitor::BlockStmt_VisitExpr to reflect the visitation of
expressions at the block statement level.  This captures all implicit
control-flow statements as well as other expressions that are hoisted
to the block level (such as conditions for terminators and function
calls).  This is especially useful for dataflow analysis.

llvm-svn: 42034
2007-09-17 17:14:52 +00:00
Ted Kremenek
c3fddac8e7 Removed check for NULL CFG. Bad CFGs will fire an assertion failure
in the CFG builder logic.

llvm-svn: 42033
2007-09-17 17:10:02 +00:00
Gordon Henriksen
8f0e2f2329 Adding myself to credits.
llvm-svn: 42032
2007-09-17 17:04:44 +00:00
Ted Kremenek
cdc0bc45e4 When building CFGs we now (unconditionally) add an empty CFGBlock to the CFG
to serve as the entry block.  An empty entry block (just as with an
empty exit block, which we already have) simplifies building analyses on top
of CFGs with very little extra overhead.

llvm-svn: 42031
2007-09-17 16:18:02 +00:00
Ted Kremenek
186a669014 Added ASTConsumer.h to XCode project.
llvm-svn: 42030
2007-09-17 16:09:32 +00:00
Dan Gohman
3243e10ef0 Add 64-bit jmp instructions to the list of instructions that
can terminate a block with no fall-through.

llvm-svn: 42029
2007-09-17 15:19:08 +00:00
Steve Naroff
ed977473fe Fix a few 80 column violations.
llvm-svn: 42028
2007-09-17 15:07:43 +00:00
Dan Gohman
96aee15d33 Use xorl instead of xorq to enter a zero into a 64-bit register.
llvm-svn: 42027
2007-09-17 14:55:08 +00:00
Dan Gohman
863bdc332d Emit integer x<1 as x<=0, as comparisons with zero (now includeing
64-bit) can use test instead of cmp with an immediate.

llvm-svn: 42026
2007-09-17 14:49:27 +00:00
Steve Naroff
83763f2c40 Add const to debug hook...
llvm-svn: 42025
2007-09-17 14:49:06 +00:00
Dan Gohman
51d1929b9e Use "test reg,reg" in place of "cmp reg,0" for 64-bit operands. This was
previously only done for 32-bit and smaller operands.

llvm-svn: 42024
2007-09-17 14:35:24 +00:00
Steve Naroff
73d534a2e0 Add support for ObjC keyword selectors.
- Add SelectorInfo/SelectorTable classes, modeled after IdentifierInfo/IdentifierTable.
- Add SelectorTable instance to ASTContext, created lazily through ASTContext::getSelectorInfo().
- Add SelectorInfo slot to ObjcMethodDecl.
- Add helper function to derive a SelectorInfo from ObjcKeywordInfo.

Misc: Got the Decl stats stuff up and running again...it was missing support for ObjC AST's.
llvm-svn: 42023
2007-09-17 14:16:13 +00:00
Hartmut Kaiser
ffb47d0679 Fixed unterminated string issue.
llvm-svn: 42022
2007-09-17 12:29:55 +00:00
Duncan Sands
6d5da71288 Factor the trampoline transformation into a subroutine.
llvm-svn: 42021
2007-09-17 10:26:40 +00:00
Chris Lattner
699c2410a8 make var in anon namespace static. Use \n instead of std::endl.
llvm-svn: 42020
2007-09-17 06:16:32 +00:00
Dale Johannesen
7511e6b622 Implement x86 long double (uses host long double,
so only works on x86 target).

llvm-svn: 42019
2007-09-17 00:38:27 +00:00
Daniel Berlin
90aaa1dcf7 Fix bug in andersen's related to test_and_set.
Add operator == and != to SparseBitVector.
Simplify code for test_and_set

llvm-svn: 42018
2007-09-16 23:59:53 +00:00
Daniel Berlin
c637abee96 Fix a few bugs related to zero'ing of elements
llvm-svn: 42017
2007-09-16 22:31:47 +00:00
Daniel Berlin
ffce584d1c Rewrite of andersen's to be about 100x faster, cleaner, and begin to support field sensitivity
llvm-svn: 42016
2007-09-16 21:45:02 +00:00
Hartmut Kaiser
af2584fbaf Silenced a VC++ warning.
Updated VC++ project files.

llvm-svn: 42015
2007-09-16 21:35:35 +00:00
Chris Lattner
93c7f855e5 remove some obsolete interfaces.
llvm-svn: 42014
2007-09-16 19:47:56 +00:00
Chris Lattner
7ea6ca70f5 switch the llvm emitter to ASTConsumer interface.
llvm-svn: 42013
2007-09-16 19:46:59 +00:00
Chris Lattner
aadfe2f973 From Justin Handville:
"The ExpectedStr search was starting at the end of the comment string.
This patch starts the search at the beginning of the comment string.
After applying this patch, clang -parse-ast-check on negative test
case source files worked as expected."

llvm-svn: 42012
2007-09-16 19:27:16 +00:00
Chris Lattner
ac81722ff6 Fix html problem, patch by Justin Handville
llvm-svn: 42011
2007-09-16 19:25:23 +00:00
Chris Lattner
793d10ca38 fix some warnings, patch by Justin Handville
llvm-svn: 42010
2007-09-16 19:23:47 +00:00
Chris Lattner
81b7624c6f decl counting isn't implemented yet for objc. -stats probably crashes for it.
Patch by Justin Handville

llvm-svn: 42009
2007-09-16 19:23:04 +00:00
Bill Wendling
327e1a386c Follow-up to patch r41999. Make the conditional that emits the personality stub
match the conditional that turns on exception handling emittion in the asm
printer.

llvm-svn: 42008
2007-09-16 19:21:08 +00:00
Chris Lattner
b38b0ad095 Fix a GCC warning, patch by Justin Handville
llvm-svn: 42007
2007-09-16 19:12:45 +00:00
Chris Lattner
8ad0e6a484 fix warning.
llvm-svn: 42006
2007-09-16 19:11:53 +00:00
Dale Johannesen
7f724e9b94 Adjust per revew comments.
llvm-svn: 42002
2007-09-16 16:51:49 +00:00
Steve Naroff
2f742085f5 Fixes/tweaks that prevent "defaults-i.m" from compiling.
- Allow classnames as the receiver (removing a FIXME from ParseObjCMessageExpression).
- Added a FIXME to ParseObjCMessageExpression()...we need to return a message expr AST node!

llvm-svn: 42001
2007-09-16 16:16:00 +00:00
Steve Naroff
66356bda5d Rename statement actions (from Parse-prefix to ActOn-prefix).
llvm-svn: 42000
2007-09-16 14:56:35 +00:00
Bill Wendling
e5615156cc Only emit the personality function as a global value if the backend actually
supports it. This solves this error on the Darwin x86-64 platform:

$ cat testcase.ii
struct A {
  A();
};

A *bork() {
  return new A;
}
$ llvm-g++ -arch x86_64 -c testcase.ii
/var/tmp//cc3U8fd8.s:52:unknown section type: non_lazy_symbol_pointers
/var/tmp//cc3U8fd8.s:52:Rest of line ignored. 1st junk character valued 76 (L).
/var/tmp//cc3U8fd8.s:53:Unknown pseudo-op: .indirect_symbol
/var/tmp//cc3U8fd8.s:53:Rest of line ignored. 1st junk character valued 95 (_).

llvm-svn: 41999
2007-09-16 10:36:17 +00:00
Owen Anderson
4cd516b50b Be more careful when constant-folding PHI nodes.
llvm-svn: 41998
2007-09-16 08:04:16 +00:00
Steve Naroff
83895f7888 Rename expression actions (from Parse-prefix to ActOn-prefix).
llvm-svn: 41997
2007-09-16 03:34:24 +00:00
Hartmut Kaiser
6d100165ae Fixed a problem VC++ revealed in release mode. Please verify.
llvm-svn: 41996
2007-09-16 00:31:07 +00:00
Hartmut Kaiser
04bd2ef629 Fixed two problems VC++ revealed in release mode. Please verify.
llvm-svn: 41995
2007-09-16 00:28:28 +00:00
Hartmut Kaiser
0a6b11db24 Updated VC++ build system.
Silenced a couple of VC++ warnings.

llvm-svn: 41994
2007-09-16 00:04:22 +00:00
Chris Lattner
254987c411 switch the various CFG-based stuff over to using ASTConsumer interface,
this eliminates their dependence on the preprocessor and eliminates some
duplicated code.

llvm-svn: 41993
2007-09-15 23:21:08 +00:00
Chris Lattner
09c39db0c4 convert ast printer and dumper ocver to ASTConsumer interface,
genericizing them and eliminating boilerplate code.

llvm-svn: 41992
2007-09-15 23:02:28 +00:00
Chris Lattner
75e0c8cf4c add a new ASTConsumer consumer to simplify stuff in the driver.
Switch -parse-ast over to it.

llvm-svn: 41991
2007-09-15 22:56:56 +00:00
Chris Lattner
e27d865e36 Initial checkin of rewriter interface. It is just stubbed out for now.
llvm-svn: 41990
2007-09-15 22:21:22 +00:00
Chris Lattner
5a4e9d2666 pretty print some nodes more nicely.
llvm-svn: 41989
2007-09-15 21:49:37 +00:00
Chris Lattner
1cf7bb15ea fix comment
llvm-svn: 41988
2007-09-15 21:48:50 +00:00
Steve Naroff
30d242c99f Start converting Action methods from Parse-prefix to ActOn-prefix.
The previous naming scheme was confusing, since it resulted in both the Parser and Action modules having methods with the same name. In addition, the Action module never does any parsing...

llvm-svn: 41986
2007-09-15 18:49:24 +00:00
Fariborz Jahanian
29f99d7142 Couple of new classes for objective-c's @protocol typings.
llvm-svn: 41985
2007-09-15 18:27:26 +00:00
Chris Lattner
dd76f2f4ab remove obsolete tests.
llvm-svn: 41984
2007-09-15 17:38:04 +00:00
Chris Lattner
4f230451e1 Fix PR1666, SPASS with the CBE and 254.gap with the CBE.
GCC optimizes away things like ptr < NULL  to false.  To "fix" this,
have the CBE emit casts of pointers to intptr_t when doing relational
pointer comparisons.

llvm-svn: 41983
2007-09-15 06:51:03 +00:00
Chris Lattner
6ad68c220a New testcase for PR1662. GCC trees are horrible :(
llvm-svn: 41979
2007-09-15 05:46:41 +00:00
Dan Gohman
48ea03d169 Add patterns for SHLD64* and SHRD64*.
llvm-svn: 41975
2007-09-14 23:17:45 +00:00
Ted Kremenek
15d3b38ff2 Added several files to XCode project file...
Analysis/DataflowSolver.h
    Analysis/UnintializedValues.cpp
    include/clang/Analysis/CFGVarDeclVisitor.h
    include/clang/Analysis/DataflowValues.h
    include/clang/Analysis/UninitializedValues.h

llvm-svn: 41974
2007-09-14 23:13:28 +00:00
Steve Naroff
2e688fde14 Rename Action::ParseRecordBody() to ProcessFieldDecls(), and add a visibility argument.
Remove Action::ObjcAddVisibilityToIvars(). No need for an extra API when it is trivial to add this info to the previous hook.

In general, I want to start migrating away from having Actions prefixed with "Parse" (which is confusing, since the Action API doesn't do any parsing, per se).

llvm-svn: 41973
2007-09-14 23:09:53 +00:00
Chris Lattner
6395e5060d fix a gcc warning: comparison between signed and unsigned integer expressions
llvm-svn: 41972
2007-09-14 22:57:00 +00:00
Owen Anderson
3454dd3750 Remove RLE from the headers, since the pass itself is gone now.
llvm-svn: 41971
2007-09-14 22:54:46 +00:00
Ted Kremenek
5746d06a5d Prototype implementation of new template-based dataflow solver.
Preliminary implementation of UninitializedValues, which is based on
new solver (doesn't work yet, but compiles).

llvm-svn: 41970
2007-09-14 22:49:21 +00:00
Owen Anderson
8d0cb881e5 Remove RLE. It is subsumed by GVN.
llvm-svn: 41968
2007-09-14 22:33:52 +00:00
Dale Johannesen
98d3a08d8f Remove the assumption that FP's are either float or
double from some of the many places in the optimizers
it appears, and do something reasonable with x86
long double.
Make APInt::dump() public, remove newline, use it to
dump ConstantSDNode's.
Allow APFloats in FoldingSet.
Expand X86 backend handling of long doubles (conversions
to/from int, mostly).

llvm-svn: 41967
2007-09-14 22:26:36 +00:00
Steve Naroff
db47ee203a Several improvement to Sema::ParseRecordBody()...
- Adding a safer prologue. The previous prologue would accept a null and therefore assume we had an interface (which was incorrect).
- Fixed FieldDecl's classof method. This allowed me to simplify some unnecessary casting.
- When diagnosing errors, make sure the FieldDecl/EnclosingDecl are marked as invalid. In addition, don't delete the field...rather, add all fields to the enclosing decl. Memory management can/should be done elsewhere. This code was never "upgraded" to the recently added invalid decl strategy.

llvm-svn: 41964
2007-09-14 22:20:54 +00:00
Evan Cheng
483e1ce16e Add implicit def of EFLAGS on those instructions that may modify flags.
llvm-svn: 41962
2007-09-14 21:48:26 +00:00
Fariborz Jahanian
f3287bf871 Patch to store ivars into interface class object.
llvm-svn: 41961
2007-09-14 21:08:27 +00:00
Dan Gohman
14cf78cde5 And an FoldingSetImpl::NodeID::AddInteger overload for int64_t, to avoid
ambiguity.

llvm-svn: 41960
2007-09-14 20:48:42 +00:00
Dan Gohman
c519c38629 Add explicit triples to avoid default behavior that varies by host.
llvm-svn: 41959
2007-09-14 20:37:18 +00:00
Dan Gohman
9da02f5ee2 Remove isReg, isImm, and isMBB, and change all their users to use
isRegister, isImmediate, and isMachineBasicBlock, which are equivalent,
and more popular.

llvm-svn: 41958
2007-09-14 20:33:02 +00:00
Dan Gohman
a7b26e6bb3 Change "tmp." to "tmp" for temporaries created by ScalarEvolutionExpander
for consistency with many other transforms.

llvm-svn: 41957
2007-09-14 20:11:40 +00:00
Dan Gohman
58c468fb09 Remove spurious consts. This fixes warnings with compilers that
are strict about such things.

llvm-svn: 41956
2007-09-14 20:08:19 +00:00
Fariborz Jahanian
aefb23092c Semantic analysis for objective-c ivars.
llvm-svn: 41954
2007-09-14 16:27:55 +00:00
Rafael Espindola
272f7304f0 Add support for functions with byval arguments on x86
llvm-svn: 41953
2007-09-14 15:48:13 +00:00
Chris Lattner
5d13fb538f Fix a logic error in ValueIsOnlyUsedLocallyOrStoredToOneGlobal that caused
miscompilation of 188.ammp.  Reject select and bitcast in 
ValueIsOnlyUsedLocallyOrStoredToOneGlobal because RewriteHeapSROALoadUser can't handle it.

llvm-svn: 41950
2007-09-14 03:41:21 +00:00
Chris Lattner
d9111b88d1 silence a bogus gcc warning.
llvm-svn: 41949
2007-09-14 03:07:24 +00:00
Steve Naroff
1d4b5eaeab Now that the dust has settled on the Decl refactoring, I noticed FieldDecl didn't need NextDeclarator. As a result, I'm removing it.
Removing both slots (NextDeclarator/Next) end up reducing the size of fields/ivars by 40%.

llvm-svn: 41948
2007-09-14 02:20:46 +00:00
Evan Cheng
5196f617a1 Fix comments.
llvm-svn: 41947
2007-09-14 01:57:02 +00:00
Tanya Lattner
36a6fcd327 Change to 2.2svn.
llvm-svn: 41941
2007-09-14 01:24:13 +00:00
Bill Wendling
264d4813c7 Temporary reverting r41817
(http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070910/053370.html). It's
causing SPASS to fail.

llvm-svn: 41938
2007-09-14 01:13:55 +00:00
Steve Naroff
a23cc79654 Move Decl::NextDeclarator (w/ setters/getters) down to ScopedDecl/FieldDecl.
Decl is now svelte:-)

llvm-svn: 41935
2007-09-13 23:52:58 +00:00
Steve Naroff
9def2b15c1 Phase 2 of making the Decl class more lightweight...
Move Identifier/Loc instance variables (and associated getters/setters) down from Decl to ScopedDecl/FieldDecl.

Objc AST's can now inherit from Decl without getting instance variables and types that are C specific. For now, I am keeping NextDeclarator, since I believe it may be useful to ObjC. If not, it can be moved later.

llvm-svn: 41934
2007-09-13 21:41:19 +00:00
Chris Lattner
011f91b5b2 Teach GlobalLoadUsesSimpleEnoughForHeapSRA and the SROA rewriter how to handle
a limited form of PHI nodes.  This finally fixes PR1639, speeding 179.art up
from 7.84s to 3.13s on PPC.

llvm-svn: 41933
2007-09-13 21:31:36 +00:00
Fariborz Jahanian
6812cbb230 Patch for collecting ivars before running action on them.
llvm-svn: 41932
2007-09-13 20:56:13 +00:00
Steve Naroff
9324db12b2 Add "ScopedDecl" AST, used by ValueDecl and TypeDecl.
This allows us to sink the "Next" field, which isn't used by FieldDecl and ObjcIvarDecl.

llvm-svn: 41931
2007-09-13 18:10:37 +00:00
Chris Lattner
ba98f89388 be tolerant of PHI nodes when rewriting heap SROA code. This is a step
along the way of PR1639

llvm-svn: 41930
2007-09-13 18:00:31 +00:00
Chris Lattner
f315d4f1a7 refactor some code, no functionality change. On the path to PR1639
llvm-svn: 41929
2007-09-13 17:29:05 +00:00
Chris Lattner
6eed0e7366 Make ValueIsOnlyUsedLocallyOrStoredToOneGlobal smart enough to see through
bitcasts and phis.  This is a step to fixing PR1639.

llvm-svn: 41928
2007-09-13 16:37:20 +00:00
Chris Lattner
2d2892ee6e Make AllUsesOfLoadedValueWillTrapIfNull strong enough to see through PHI
nodes.  This is the first step of the fix for PR1639.

llvm-svn: 41927
2007-09-13 16:30:19 +00:00
Chris Lattner
d3d8aca074 update to match llvm mainline api
llvm-svn: 41926
2007-09-13 06:19:18 +00:00
Chris Lattner
3fd6bf8275 remove dead enum value.
llvm-svn: 41925
2007-09-13 06:18:04 +00:00
Chris Lattner
6ff85b2e5a Make single-argument ctors explicit to avoid tricky bugs :)
llvm-svn: 41924
2007-09-13 06:15:57 +00:00
Chris Lattner
7955bbd9fd Fix build problems on Cygwin (PR1652), patch by Patrick Walton.
llvm-svn: 41923
2007-09-13 06:09:48 +00:00
Chris Lattner
6fb276d433 adjust to a change in the LLVM APIs, this is still very hackish until
the front-end adopts APFloat though.  This fixes test/CodeGen/mandel.c

llvm-svn: 41908
2007-09-13 01:26:11 +00:00
Chris Lattner
69de3f4af6 When dumping out errors about unsupported stuff, emit loc info.
llvm-svn: 41907
2007-09-13 01:17:29 +00:00
Chris Lattner
5a5b35c07b make the sourcemgr available through ASTContext.
llvm-svn: 41906
2007-09-13 01:14:03 +00:00
Evan Cheng
b2c42621df Added getNumDefs().
llvm-svn: 41901
2007-09-13 00:16:29 +00:00
Evan Cheng
100c8d6c8f Bug fixes.
llvm-svn: 41900
2007-09-13 00:06:00 +00:00
Evan Cheng
57ff158255 Remove dead code.
llvm-svn: 41899
2007-09-12 23:45:46 +00:00
Evan Cheng
bb6a574def Yet another getTargetNode variant.
llvm-svn: 41898
2007-09-12 23:39:49 +00:00
Evan Cheng
59c39dc197 Initial support for multi-result patterns:
1.
[(set GR32:$dst, (add GR32:$src1, GR32:$src2)),
 (modify EFLAGS)]
This indicates the source pattern expects the instruction would produce 2 values. The first is the result of the addition. The second is an implicit definition in register EFLAGS.
2.
def : Pat<(parallel (addc GR32:$src1, GR32:$src2), (modify EFLAGS)), ()>
Similar to #1 except this is used for def : Pat patterns.

llvm-svn: 41897
2007-09-12 23:30:14 +00:00
Steve Naroff
3aa4efbdee Add ASTContext::StringMap<char> to unique selector names.
llvm-svn: 41894
2007-09-12 23:08:22 +00:00
Evan Cheng
d8317967aa Fixed a typo that's causing a missing kill marker.
llvm-svn: 41893
2007-09-12 23:02:04 +00:00
Ted Kremenek
302def221c Minor space tightening.
Removed extraneous call to Observer->ObserveStmt when handling DeclRefExprs.

llvm-svn: 41890
2007-09-12 20:28:48 +00:00
Steve Naroff
437b4d8bda Remove a FIXME. Replace a couple asserts with an appropriate error
diagnostic for illegal initializers.

llvm-svn: 41889
2007-09-12 20:13:48 +00:00
Ted Kremenek
fe1da5ec56 Fixed recursion bug: should call Visit on child instead of VisitStmt.
llvm-svn: 41888
2007-09-12 20:11:39 +00:00
Ted Kremenek
b10f1d881e Fixed logic bug in recursion to visiting child statements.
llvm-svn: 41887
2007-09-12 20:08:31 +00:00
Ted Kremenek
439b19928f Added files CFGStmtVisitor and DataflowStmtVisitor to XCode project.
llvm-svn: 41886
2007-09-12 19:12:02 +00:00
Ted Kremenek
1147e36fe0 Migrated LiveVariables to use the new DataflowStmtVisitor interface. The code
is much simpler now.

llvm-svn: 41885
2007-09-12 19:10:52 +00:00
Ted Kremenek
d160034330 Added extensions (subclasses) to the StmtVisitor class that
are useful for dataflow analysis: CFGStmtVisitor and DataflowStmtVisitor.

CFGStmtVisitor is the same as StmtVisitor is that it has separate visitors
for "root" statements in a CFGBlock (statements that have a designated
slot int the list of statements in a CFGBlock).  It also recognizes statements
that have implicit control-flow, and calls special visitor methods for those.

DataflowStmtVisitor extends CFGStmtVisitor to serve as a template for
implementing transfer functions.  It does a pre-/post-order traversal of
substatements depending on whether we are doing a forward/backward analysis.
It also has special handling for implicit-control-flow statements so that
they are visited only once.

llvm-svn: 41884
2007-09-12 19:09:12 +00:00
Chris Lattner
909ef0973b add a new BF->LLVM translator, contributed by Sterling Stein.
llvm-svn: 41881
2007-09-12 18:24:00 +00:00
Fariborz Jahanian
cfb31fab5e Patch for building method declaration nodes. Also fixed a segfault in cocoa.m due
to use of @property.

llvm-svn: 41880
2007-09-12 18:23:47 +00:00
Chris Lattner
7b412cb823 Change llvm.gcroot to not init the root to null at runtime, this prevents
using it for live-in values etc.

llvm-svn: 41879
2007-09-12 17:53:10 +00:00
Hartmut Kaiser
0249104aa5 Removed clang solution file for VC++, which didn't work properly because of hard coded paths in the llvm project files.
Changed windows detection to use LLVM pp constant.

llvm-svn: 41878
2007-09-12 15:39:04 +00:00
Steve Naroff
6109140b00 Fix the following bug submitted by Ted Kremenek:
void func() {
int xx = xx; // incorrectly diagnosed 'xx' as an undeclared identifier.
}

This smallish bug resulted in a largish fix. Here are some highlights:

- Needed to make sure ParseDeclarator is called *before* parsing any
initializer. Removed the "Init" argument to ParseDeclarator.
- Added AddInitializerToDecl() to the Action & Sema classes.
In Sema, this hook is responsible for validating the initializer and
installing it into the respective decl.
- Moved several semantic checks from ParseDeclarator() to 
FinalizeDeclaratorGroup(). Previously, this hook was only responsible for 
reversing a list. Now it plays a much larger semantic role. 

All of the above changes ended up simplifying ParseDeclarator(), which
is goodness...

llvm-svn: 41877
2007-09-12 14:07:44 +00:00
Dale Johannesen
100410af13 Generated files for previous patch.
llvm-svn: 41876
2007-09-12 03:31:28 +00:00
Dale Johannesen
028084efe5 Revise previous patch per review comments.
Next round of x87 long double stuff.
Getting close now, basically works.

llvm-svn: 41875
2007-09-12 03:30:33 +00:00
Dale Johannesen
521988b604 Compensate for partCount change in Bogus definition
(could break hash table in ConstantFP)

llvm-svn: 41874
2007-09-12 01:22:05 +00:00
Bill Wendling
66c22e8fd6 Enable indirect encoding for the personality function
llvm-svn: 41873
2007-09-11 23:55:40 +00:00
Daniel Berlin
a3bba5ce20 Move dump out of class, use "\n" instead of endl
llvm-svn: 41872
2007-09-11 22:58:27 +00:00
Evan Cheng
c16847b157 Sometimes a MI can define a register as well as defining a super-register at the
same time. Do not mark the "smaller" def as dead.

llvm-svn: 41871
2007-09-11 22:34:47 +00:00
Anton Korobeynikov
9811eb3d07 Fix date :)
llvm-svn: 41870
2007-09-11 22:20:27 +00:00
Anton Korobeynikov
38f9e2a4b6 Testcase for recent pragma pack stuff
llvm-svn: 41869
2007-09-11 22:12:26 +00:00
Ted Kremenek
3a5aa768c6 Added static method "CFG::hasImplicitControlFlow".
This method is used to determine if an expression contains implicit
control-flow, and thus appears in a distinct statement slot in the CFG.

For example:

  (1) x = ... ? ... ? ...

  logically becomes:

  (1) ... ? ... : ...  (a unique statement slot for the ternary ?)
  (2) x = [E1]         (where E1 is actually the ConditionalOperator*)

A client of the CFG, when walking the statement at (2), will encounter
E1.  In this case, hasImplicitControlFlow(E1) == true, and the client
will know that the expression E1 is explicitly placed into its own statement
slot to capture the implicit control-flow it has.

llvm-svn: 41868
2007-09-11 22:08:24 +00:00
Ted Kremenek
3dd952ba72 Fixed bug where ternary expressions and GCC-style conditional expressions
where not reversing the order of their subexpression blocks.

Added feature where CallExprs are placed in their own statement slot in
a CFGBlock.  Thus we have a designated "return site" within a CFGBlock when
reasoning about function calls.

llvm-svn: 41866
2007-09-11 21:29:43 +00:00
Steve Naroff
f2fb4ad08e - Add an ObjcIvarDecl AST node (a subclass of FieldDecl).
- Instantiate the node in Sema::ParseField(), based on the type of the TagDecl.
- Add Sema::ObjcAddInstanceVariable(), responsible for adorning/adding the ObjcIvarDecl.

llvm-svn: 41864
2007-09-11 21:17:26 +00:00
Evan Cheng
3e18e504ae Remove (somewhat confusing) Imp<> helper, use let Defs = [], Uses = [] instead.
llvm-svn: 41863
2007-09-11 19:55:27 +00:00
Evan Cheng
50b6730ae4 Added status flags register: EFLAGS.
llvm-svn: 41862
2007-09-11 19:53:28 +00:00
Evan Cheng
c7852a689a Allow set operators with multiple destinations, i.e. (set x, y, (op a, b)).
llvm-svn: 41861
2007-09-11 19:52:18 +00:00
Fariborz Jahanian
cfc3e4d346 Change ObjcMethodDecl class derivation.
llvm-svn: 41860
2007-09-11 18:45:55 +00:00
Dale Johannesen
216788aacb Generated files for previous patch.
llvm-svn: 41859
2007-09-11 18:33:39 +00:00
Dale Johannesen
245dceb06d Add APInt interfaces to APFloat (allows directly
access to bits).  Use them in place of float and
double interfaces where appropriate.
First bits of x86 long double constants handling 
(untested, probably does not work).

llvm-svn: 41858
2007-09-11 18:32:33 +00:00
Daniel Berlin
32ef96186f Convert to use ilist and non-pointer lists for extra goodness
llvm-svn: 41855
2007-09-11 17:42:22 +00:00
Bill Wendling
beb541544d Add accessor method.
llvm-svn: 41854
2007-09-11 17:24:38 +00:00
Ted Kremenek
2f1a79d329 For looking at "dead stores" in declarations, we now check to see
if the assigned value is a constant expression, e.g.:

int x = 0;

We then check to see if "x" is ever reassigned later.  If so, we don't
emit a warning.  This is because programmers frequently use defensive
programming to make sure a variable has a defined value.

llvm-svn: 41853
2007-09-11 17:24:14 +00:00
Bill Wendling
74fb0f1a1c Add a bool to indicate if we should set the "indirect encoding" bit in the Dwarf
information for EH.

llvm-svn: 41852
2007-09-11 17:20:55 +00:00
Chris Lattner
69c1b10993 Reenable libgc and libprofile is explicitly requested.
llvm-svn: 41851
2007-09-11 17:12:32 +00:00
Chris Lattner
e09791c399 remove an obsolete library.
llvm-svn: 41850
2007-09-11 17:10:52 +00:00
Chris Lattner
9190ffe62e update this to use llvm-config, patch by Jose M. Moya
llvm-svn: 41849
2007-09-11 17:09:54 +00:00
Ted Kremenek
ca6c2b750b Fixed potential NULL dereference when iterating over a chain of Decls.
llvm-svn: 41848
2007-09-11 17:00:40 +00:00
Gabor Greif
412af03cee get rid of ugly "warning: no newline at end of file"
warnings that some compilers diagnose

llvm-svn: 41847
2007-09-11 15:32:40 +00:00
Duncan Sands
94580c7522 Test that a call to a trampoline is turned into a call to
the underlying nested function.

llvm-svn: 41846
2007-09-11 15:07:50 +00:00
Duncan Sands
d781335d39 Two ParamAttrsVectors which differ by a permutation
of their elements do not yield the same ParamAttrsList,
though they should.  On the other hand, everyone seems
to pass such vectors with elements ordered by increasing
index, so rather than sorting the elements simply assert
that the elements are ordered in this way.

llvm-svn: 41845
2007-09-11 14:40:04 +00:00
Duncan Sands
9204663bcb Turn calls to trampolines into calls to the underlying
nested function.

llvm-svn: 41844
2007-09-11 14:35:41 +00:00
Duncan Sands
86e0119822 Fold the adjust_trampoline intrinsic into
init_trampoline.  There is now only one
trampoline intrinsic.

llvm-svn: 41841
2007-09-11 14:10:23 +00:00
Duncan Sands
1a11e1c14f My compiler warns about the semicolon.
llvm-svn: 41840
2007-09-11 12:30:25 +00:00
Bill Wendling
2b8fc31df9 The personality function on Darwin needs a global stub. We then refer to
that global stub instead of doing the ".set" thingy we were doing before.

llvm-svn: 41838
2007-09-11 08:27:17 +00:00
Owen Anderson
887ecdeb01 Add a ValueInfoT template parameter to DenseMap so that it can properly make decisions
based on whether the key AND the value require ctors/dtors.

llvm-svn: 41837
2007-09-11 05:08:05 +00:00
Owen Anderson
d7a698afc5 Don't bother to initialize values corresponding to empty or tombstone
keys.

llvm-svn: 41834
2007-09-11 04:43:51 +00:00
Owen Anderson
f9203ab36a Fix a typo in memdep, which was causing PR1648.
llvm-svn: 41833
2007-09-11 04:31:00 +00:00
Daniel Berlin
d10be14a97 Fix bugs with &=, intersect with complement. Add three argument version of intersect with complement.
llvm-svn: 41832
2007-09-11 04:11:28 +00:00
Owen Anderson
4484d0d51a Fix non-deterministic behavior in the DenseMap copy constructor.
llvm-svn: 41831
2007-09-11 03:48:08 +00:00
Daniel Berlin
2b6e98b89a Add remaining functions necessary for andersen's
llvm-svn: 41830
2007-09-11 01:38:07 +00:00
Devang Patel
7ed6eb8992 Avoid negative logic.
llvm-svn: 41829
2007-09-11 01:10:45 +00:00
Devang Patel
8c95373ced Refactor code into a separate method.
llvm-svn: 41826
2007-09-11 00:42:56 +00:00
Chris Lattner
0678def8d3 Testcase for PR1634
llvm-svn: 41824
2007-09-11 00:39:43 +00:00
Devang Patel
d67479b6ee Clear split info object.
llvm-svn: 41823
2007-09-11 00:23:56 +00:00
Devang Patel
a28a7f1b2d Split condition does not have to be ICmpInst in all cases.
llvm-svn: 41822
2007-09-11 00:12:56 +00:00
Devang Patel
f4202e91f8 Check all terminators inside loop.
llvm-svn: 41821
2007-09-10 23:57:58 +00:00
Chris Lattner
6cf04f4952 remove obsolete testcase
llvm-svn: 41820
2007-09-10 23:51:41 +00:00
Chris Lattner
e804567cd8 remove some dead code, this is handled by constant folding.
llvm-svn: 41819
2007-09-10 23:46:29 +00:00
Chris Lattner
52fe869374 Fix a buggy constant folding transformation when handling aliases.
llvm-svn: 41818
2007-09-10 23:42:42 +00:00
Devang Patel
2181b8e86a Swap exit condition operands if it works.
llvm-svn: 41817
2007-09-10 23:34:06 +00:00
Chris Lattner
740d8049f4 regenerate
llvm-svn: 41816
2007-09-10 23:24:14 +00:00
Chris Lattner
dae70d4d36 Fix PR1645 by resolving forward alias references.
llvm-svn: 41815
2007-09-10 23:23:53 +00:00
Ted Kremenek
ba3fdc9daf Fixed isFunctionPointerType to correctly handle typedefs.
llvm-svn: 41814
2007-09-10 22:54:34 +00:00
Dale Johannesen
62a48cea56 Add missing llvm-dis.
llvm-svn: 41813
2007-09-10 22:47:59 +00:00
Evan Cheng
f948772f9e 80 col.
llvm-svn: 41812
2007-09-10 22:22:23 +00:00
Steve Naroff
4292bde14f Fix the following bug submitted by Justin Handville.
int main(int argc, char* argv[])
{
  return 0;
}

After speaking briefly with Chris, we decided this should be a front-end fix.

The fix...have Sema::GetTypeForDeclarator() do the default function/array conversion, as
I outlined in the 9/9 email on this topic.

Since this conversion is done before Sema::ParseParamDeclarator(), I thought I could
remove the conversion from Sema::ParseParamDeclarator(). Unfortunately, this didn't work.
The conversion apparently needs to be done in both places (which doesn't make sense to me).

Will investigate.

llvm-svn: 41811
2007-09-10 22:17:00 +00:00
Evan Cheng
8c3c198499 New entry.
llvm-svn: 41810
2007-09-10 22:16:37 +00:00
Evan Cheng
3b9f777f47 Observation of rematerialization.
llvm-svn: 41809
2007-09-10 22:11:18 +00:00
Chris Lattner
6777b72659 Add some notes about better flag handling.
llvm-svn: 41808
2007-09-10 21:43:18 +00:00
Chris Lattner
58c227bd09 Emit:
cmpl    %eax, %ecx
        setae   %al
        movzbl  %al, %eax

instead of:

        cmpl    %eax, %ecx
        setb    %al
        xorb    $1, %al
        movzbl  %al, %eax

when using logical not of a C comparison.

llvm-svn: 41807
2007-09-10 21:39:07 +00:00
Chris Lattner
7a9935c31f this is not infinite recursion.
llvm-svn: 41806
2007-09-10 21:16:23 +00:00
Chris Lattner
33a7f51412 1. Don't call Value::getName(), which is slow.
2. Lower calls to fabs and friends to FABS nodes etc unless the function has
   internal linkage.  Before we wouldn't lower if it had a definition, which
   is incorrect.  This allows us to compile:

define double @fabs(double %f) {
        %tmp2 = tail call double @fabs( double %f )
        ret double %tmp2
}

into:

_fabs:
        fabs f1, f1
        blr 

llvm-svn: 41805
2007-09-10 21:15:22 +00:00
Chris Lattner
c75cbe6473 Prevent tailcallelim from breaking "recursive" calls to builtins.
llvm-svn: 41804
2007-09-10 20:58:55 +00:00
Steve Naroff
acb1e7478f Some small tweaks to the recent Objc support...
llvm-svn: 41803
2007-09-10 20:51:04 +00:00
Evan Cheng
637395e6bd It's not safe to rematerialize MOV32r0 etc. by simply cloning the original
instruction. These are implemented with xor which will modify the conditional
code. They should be rematerialized as move instructions.

llvm-svn: 41802
2007-09-10 20:48:53 +00:00
Fariborz Jahanian
33d037441e Early patch to collect objective-c methods inserts them in
class object.

llvm-svn: 41801
2007-09-10 20:33:04 +00:00
Devang Patel
f8ab0a9acc Filter exit conditions which are not yet handled.
llvm-svn: 41800
2007-09-10 18:33:42 +00:00
Devang Patel
c24099ac82 New test.
llvm-svn: 41799
2007-09-10 18:12:52 +00:00
Devang Patel
d7409fdce5 Require SCEV before LCSSA.
llvm-svn: 41798
2007-09-10 18:08:23 +00:00
Ted Kremenek
bd9cc5ca89 Fixed LiveVariables to no longer track the liveness of function pointers
that refer to direct function calls.

Modified interface of LiveVariables to only track liveness of VarDecls.
This cleans up a bunch of edge cases, and removed the bug just mentioned.

llvm-svn: 41797
2007-09-10 17:36:42 +00:00
Ted Kremenek
5f64ca8ec5 Modified dumping of Decl information to including the Decl type.
llvm-svn: 41796
2007-09-10 17:32:55 +00:00
Ted Kremenek
0319fc07fc Added "isFunctionPointerType()" so that we can readily see if a DeclRefExpr
refers to a function.

llvm-svn: 41795
2007-09-10 17:20:54 +00:00
Ted Kremenek
cfe207c112 Renaming of the LiveVariablesAuditor interface. Changed "Auditor" and
"Audit" to "Observer" and "Observe"

llvm-svn: 41794
2007-09-10 15:56:38 +00:00
Owen Anderson
82e4fa1020 Remove an un-needed dependence query. This improves compile time marginally on 401.bzip2.
llvm-svn: 41792
2007-09-09 21:43:49 +00:00
Daniel Berlin
e80ca9c2c6 Add SparseBitVector implementation
llvm-svn: 41790
2007-09-09 01:10:40 +00:00
Owen Anderson
4266bb73e8 Turn GVN on by default.
llvm-svn: 41787
2007-09-08 22:23:52 +00:00
Dale Johannesen
29e6ac4281 Implement misaligned FP loads and stores.
llvm-svn: 41786
2007-09-08 19:29:23 +00:00
Nick Lewycky
a9b13d5cc1 Fix description of the call instruction. There are two types, with one being
optional.

llvm-svn: 41785
2007-09-08 13:57:50 +00:00
Chuck Rose III
bf19e0a556 Fix for VisualStudio. It is treating a 2 bit enum as a signed int for comparison purposes, causing failures. Using an extra bit fixes it.
llvm-svn: 41784
2007-09-08 04:17:08 +00:00
Chris Lattner
f8a3dadd40 Don't rely on ADL to find this member, patch by Justin Handville
llvm-svn: 41783
2007-09-08 01:29:20 +00:00
Evan Cheng
ee8d9a0e81 Smarter Reset(). Instead of deallocating all memory regions and reallocate the
first region, just deallocate all but the last region in the list.

llvm-svn: 41782
2007-09-08 00:02:17 +00:00
Evan Cheng
cef2c0efcc TableGen no longer emit CopyFromReg nodes for implicit results in physical
registers. The scheduler is now responsible for emitting them.

llvm-svn: 41781
2007-09-07 23:59:02 +00:00
Ted Kremenek
35fff1e656 -check-dead-stores now no longer prints out the function declarations
for each function.  This was the behavior prior to the following patch:

http://llvm.org/viewvc/llvm-project?view=rev&revision=41779

llvm-svn: 41780
2007-09-07 23:54:15 +00:00
Ted Kremenek
45c9e96c2b Refactored driver options that perform analyses/work over CFGs to use
"CFGVisitor", which now handles all the boilerplate for iterating over
the function definitions in a translation unit and building the CFGs.
This logic was previously replicated for each driver option that used
CFGs.

The options -dump-cfg, -view-cfg, -check-dead-stores, and
-dump-live-variables now use this refactored code.

llvm-svn: 41779
2007-09-07 23:47:56 +00:00
Bill Wendling
9929bc403d Add missing index versions of instructions to the map.
llvm-svn: 41776
2007-09-07 22:01:02 +00:00
Dan Gohman
a95cbb0007 Avoid storing and reloading zeros and other constants from stack slots
by flagging the associated instructions as being trivially rematerializable.

llvm-svn: 41775
2007-09-07 21:32:51 +00:00
Dale Johannesen
9e70086c8f Apply feedback from previous patch.
llvm-svn: 41774
2007-09-07 21:07:57 +00:00
Dale Johannesen
b6d795c1fc Revert previous change to IR.
llvm-svn: 41769
2007-09-07 18:31:50 +00:00
Rafael Espindola
1de0c86717 Add support for having different alignment for objects on call frames.
The x86-64 ABI states that objects passed on the stack have
8 byte alignment. Implement that.

llvm-svn: 41768
2007-09-07 14:52:14 +00:00
Hartmut Kaiser
ec7531c9f6 Fixed compilation on Windows.
Silenced a couple of warnings.
Added *.vcproj file for new clangAnalysis library.
Renamed Basic to clangBasic projects.

llvm-svn: 41767
2007-09-07 14:34:20 +00:00
Anton Korobeynikov
122bf4be7e Split eh.select / eh.typeid.for intrinsics into i32/i64 versions. This is needed, because they just "mark" register
liveins and we let frontend solve type issue, not lowering code :)

llvm-svn: 41763
2007-09-07 11:39:35 +00:00
Bill Wendling
5f912b9149 Test for PR1641.
llvm-svn: 41762
2007-09-07 08:30:09 +00:00
Chris Lattner
85a51e0060 Don't zap back to back volatile load/stores
llvm-svn: 41759
2007-09-07 05:33:03 +00:00
Owen Anderson
e2f23a3abf Add lengthof and endof templates that hide a lot of sizeof computations.
Patch by Sterling Stein!

llvm-svn: 41758
2007-09-07 04:06:50 +00:00
Ted Kremenek
3ce57c6baf Added more checking in "dead stores" for values that are initialized
but never used.

Fix a bug in LiveVariables where uses on the LHS of self-assign
operators (e.g +=, *=, etc) would not be properly recorded in the
liveness state of the variable.

llvm-svn: 41757
2007-09-06 23:39:53 +00:00
Ted Kremenek
10e7870746 Minor bug fixes to corner cases where LiveVariables would crash on some CFGs
that contained no declarations, or when a variable is declared but never used.

llvm-svn: 41756
2007-09-06 23:25:10 +00:00
Ted Kremenek
1bb9f2596f Forgot to check in the actual "dead stores" checker in the last commit!
llvm-svn: 41755
2007-09-06 23:01:46 +00:00
Ted Kremenek
6dc7b11d32 Added "Dead Stores", a flow-sensitive checker that checks for stores
to variables that are no longer live.  This analysis is built on top
of CFGs and the LiveVariables analysis.

changes to driver:
 added driver option "-check-dead-stores" to run the analysis

llvm-svn: 41754
2007-09-06 23:00:42 +00:00
Ted Kremenek
3f8ed2653c LiveVariables:
- Finished 99% of analysis logic.  Probably a few bugs.
 - Added querying functions to query liveness.
 - Added better pretty printing of liveness.
 - Added better bookkeeping of per-variable liveness information.
 - Added LiveVariablesAuditor interface, which allows "lazy" querying
   of intra-basic block liveness information.

Driver:
 - Minor cleanups involved in dumping liveness information.

llvm-svn: 41753
2007-09-06 21:26:58 +00:00
Steve Naroff
09bf815f89 The goal of this commit is to get just enough Sema support to recognize Objective-C classes
as types. That said, the AST nodes ObjcInterfaceDecl, ObjcInterfaceType, and ObjcClassDecl are *very*
preliminary.

The good news is we no longer need -parse-noop (aka MinimalActions) to parse cocoa.m.

llvm-svn: 41752
2007-09-06 21:24:23 +00:00
David Greene
517d5d8ebe Constify to catch bugs.
llvm-svn: 41751
2007-09-06 19:46:46 +00:00
Dale Johannesen
bed9dc423c Next round of APFloat changes.
Use APFloat in UpgradeParser and AsmParser.
Change all references to ConstantFP to use the
APFloat interface rather than double.  Remove
the ConstantFP double interfaces.
Use APFloat functions for constant folding arithmetic
and comparisons.
(There are still way too many places APFloat is
just a wrapper around host float/double, but we're
getting there.)

llvm-svn: 41747
2007-09-06 18:13:44 +00:00
Anton Korobeynikov
a07765b8f4 Proper handle case, when aliasee is external weak symbol referenced only by alias itself.
Also, fix a case, when target doesn't have weak symbols supported.

llvm-svn: 41746
2007-09-06 17:21:48 +00:00
Ted Kremenek
73c18e0362 Added LabelLoc to GotoStmt to record the source location of the label token
in the actual GotoStmt.

Fixed bug where GotoStmt::getSourceRange incorrectly used the target LabelStmt
to compute its extent.

llvm-svn: 41745
2007-09-06 17:11:52 +00:00
David Greene
a6d5d2a6a0 Add instruction dump output. This helps find bugs.
llvm-svn: 41744
2007-09-06 16:36:39 +00:00
David Greene
65d2a697dc Pluggable coalescers inplementation.
llvm-svn: 41743
2007-09-06 16:18:45 +00:00
Ted Kremenek
e80505643d Added libClangAnalysis
llvm-svn: 41742
2007-09-06 15:58:13 +00:00
Nick Lewycky
0c5c47944a Use isTrueWhenEqual. Thanks Chris!
llvm-svn: 41741
2007-09-06 02:40:25 +00:00
Nick Lewycky
b0b066eaaa When the two operands of an icmp are equal, there are five possible predicates
that would make the icmp true. Fixes PR1637.

llvm-svn: 41740
2007-09-06 01:10:22 +00:00
Evan Cheng
d059eed1c1 Fix a memory leak.
llvm-svn: 41739
2007-09-06 01:07:24 +00:00
Ted Kremenek
b56a990955 Added an early implementation of Live-Variables analysis built on
source-level CFGs.  This code may change significantly in the near
future as we explore different means to implement dataflow analyses.

Added a driver option, -dump-live-variables, to view the output of
live variable analysis.  This output is very ALPHA; it will be improved shortly.

llvm-svn: 41737
2007-09-06 00:17:54 +00:00
Chris Lattner
542a440062 remove the FATAL classifier.
llvm-svn: 41736
2007-09-06 00:16:35 +00:00
Evan Cheng
189df733ed Fix a bug in X86InstrInfo::convertToThreeAddress that caused it to codegen:
leal    (,%rcx,8), %rcx
It should be
leal    (,%rcx,8), %ecx

llvm-svn: 41735
2007-09-06 00:14:41 +00:00
Chris Lattner
aa4b29c52b remove sorry.
llvm-svn: 41734
2007-09-06 00:14:09 +00:00
Bill Wendling
b65ef38590 LVXL and STVXL are also a load and store resp.
llvm-svn: 41733
2007-09-05 23:47:12 +00:00
Steve Naroff
ca85d1dc07 Start implementing Actions interface for ObjC classes, instance variables, and methods.
Lot's of small changes to the parser.

llvm-svn: 41732
2007-09-05 23:30:30 +00:00
Fariborz Jahanian
bd25f7d4a5 Patch for parsing objective-c style method calls.
llvm-svn: 41731
2007-09-05 23:08:20 +00:00
Evan Cheng
26038c3918 Accidentially left this out.
llvm-svn: 41730
2007-09-05 21:58:18 +00:00
Evan Cheng
db53aef53e Use pool allocator for all the VNInfo's to improve memory access locality. This reduces coalescing time on siod Mac OS X PPC by 35%. Also remove the back ptr from VNInfo to LiveInterval and other tweaks.
llvm-svn: 41729
2007-09-05 21:46:51 +00:00
Evan Cheng
3dba41bf37 Added Reset() to free all allocated memory regions and reset state to be the same as right after ctor.
llvm-svn: 41728
2007-09-05 21:41:34 +00:00
Evan Cheng
19ce37a1cd Missing break. Patch by Wojciech Matyjewicz.
llvm-svn: 41727
2007-09-05 21:36:14 +00:00
Dale Johannesen
728687c423 Fix mod so it actually works. Fix conversions to
native types to handle denormals correctly.

llvm-svn: 41726
2007-09-05 20:39:49 +00:00
Chuck Rose III
2320323647 Forgot to obey 80 column rule. Fixing that.
llvm-svn: 41725
2007-09-05 20:36:41 +00:00
Ted Kremenek
813dd67a34 Moved tracking of CFG block IDs into the CFG class.
Added CFG::getNumBlockIDs() to query the number of distinct block ids created.

llvm-svn: 41724
2007-09-05 20:02:05 +00:00
Fariborz Jahanian
7db004df78 1. Fix parsing of method prototype involving c-style argument declarations.
2. Fixes all allowable key-words used as selectors.
3. Template to do the messaging parse.
4. A test case for all allowable selector names.

llvm-svn: 41723
2007-09-05 19:52:07 +00:00
Dale Johannesen
6480cc6f8c Change all floating constants that are not exactly
representable to use hex format.

llvm-svn: 41722
2007-09-05 17:50:36 +00:00
Chuck Rose III
e58572233d Added default parameters to GetElementPtrInstr constructor call. Visual Studio 2k5 was getting confused and was unable to compile it. Suspected compiler error.
llvm-svn: 41721
2007-09-05 16:54:38 +00:00
Duncan Sands
2c0a0fb725 Due to label merging, the last label for an invoke
may be the same as the first label for the following
invoke.  Remove a micro-optimization which was wrong
in this case.

llvm-svn: 41720
2007-09-05 14:12:46 +00:00
Duncan Sands
6820abe101 Testcases for PR1628.
llvm-svn: 41719
2007-09-05 11:53:04 +00:00
Duncan Sands
3c1b7fc056 Fix PR1628. When exception handling is turned on,
labels are generated bracketing each call (not just
invokes).  This is used to generate entries in
the exception table required by the C++ personality.
However it gets in the way of tail-merging.  This
patch solves the problem by no longer placing labels
around ordinary calls.  Instead we generate entries
in the exception table that cover every instruction
in the function that wasn't covered by an invoke
range (the range given by the labels around the invoke).
As an optimization, such entries are only generated for
parts of the function that contain a call, since for
the moment those are the only instructions that can
throw an exception [1].  As a happy consequence, we
now get a smaller exception table, since the same
region can cover many calls.  While there, I also
implemented folding of invoke ranges - successive
ranges are merged when safe to do so.  Finally, if
a selector contains only a cleanup, there's a special
shorthand for it - place a 0 in the call-site entry.
I implemented this while there.  As a result, the
exception table output (excluding filters) is now
optimal - it cannot be made smaller [2].  The
problem with throw filters is that folding them
optimally is hard, and the benefit of folding them is
minimal.

[1] I tested that having trapping instructions (eg
divide by zero) in such a region doesn't cause trouble.
[2] It could be made smaller with the help of higher
layers, eg by having branch folding reorder basic blocks
ending in invokes with the same landing pad so they
follow each other.  I don't know if this is worth doing.

llvm-svn: 41718
2007-09-05 11:27:52 +00:00
Bill Wendling
b9bf812ba5 Add the 64-bit versions of the DS* Altivec instructions.
llvm-svn: 41717
2007-09-05 04:05:20 +00:00
Fariborz Jahanian
7eccba3b8e Fixed a typo pointed out by Anders Calrsson.
llvm-svn: 41716
2007-09-04 21:42:12 +00:00
Steve Naroff
67ae443954 Simplified initializer semantic analysis by adding the following 2 methods:
- ArrayType::getBaseType(), and 
- ConstantArrayType::getMaximumElements().

Wanted to do this cleanup before adding structure support, which will add more complexity.

llvm-svn: 41715
2007-09-04 21:13:33 +00:00
Devang Patel
42e2abe0e8 Enable loop index split pass.
llvm-svn: 41714
2007-09-04 20:46:58 +00:00
Devang Patel
f6ef552f3d Insert cloned loop basic blocks before original loop header.
llvm-svn: 41713
2007-09-04 20:46:35 +00:00
Evan Cheng
e0cb6bb8da Fix for PR1632. EHSELECTION always produces a i32 value.
llvm-svn: 41712
2007-09-04 20:39:26 +00:00
Evan Cheng
4dbd9f254a Fix for PR1613: added 64-bit rotate left PPC instructions and patterns.
llvm-svn: 41711
2007-09-04 20:20:29 +00:00
Evan Cheng
20711a8b9a Always check the type of node. This prevents situations such as selecting 32-bit rotate target instruction for a 64-bit node when 64-bit pattern is missing.
llvm-svn: 41710
2007-09-04 20:18:28 +00:00
Fariborz Jahanian
d8e12d3df3 Patch to parse objective-c's @compatibility_alias directive.
llvm-svn: 41709
2007-09-04 19:26:51 +00:00
Hartmut Kaiser
d9a1de4c72 Set eol and mime type properties for VC8 build files
llvm-svn: 41708
2007-09-04 19:15:17 +00:00
Hartmut Kaiser
db48641837 Updated VC8 project files.
llvm-svn: 41707
2007-09-04 19:06:30 +00:00
David Greene
85948d7474 Update generated files.
llvm-svn: 41706
2007-09-04 18:46:50 +00:00
Dale Johannesen
427faa9247 fix reversal bug in preceding checkin
llvm-svn: 41705
2007-09-04 17:32:27 +00:00
Ted Kremenek
c81587d240 Updated calls to CreateGEP to new interface in LLVM mainline.
llvm-svn: 41704
2007-09-04 17:20:08 +00:00
David Greene
9bf8760a52 Revert this because the interface hasn't been updated yet.
llvm-svn: 41703
2007-09-04 17:15:07 +00:00
David Greene
4f4dc729d4 Fix typo.
llvm-svn: 41702
2007-09-04 17:00:44 +00:00
Chris Lattner
73ab7fa9c6 disable this for now.
llvm-svn: 41701
2007-09-04 16:49:09 +00:00
Evan Cheng
623dd88775 Mac OS X X86-64 ABI is same as the standard.
llvm-svn: 41700
2007-09-04 16:44:41 +00:00
David Greene
c656cbb8c2 Update GEP constructors to use an iterator interface to fix
GLIBCXX_DEBUG issues.

llvm-svn: 41697
2007-09-04 15:46:09 +00:00
Steve Naroff
77b97002e9 Make sure initializer type promotions get propagated.
This fixes a recent regression with Codegen/mandel.c.

llvm-svn: 41696
2007-09-04 14:36:54 +00:00
Chris Lattner
7717c56b4f updates (?) to the vc++ files, patch by Hartmut Kaiser
llvm-svn: 41695
2007-09-04 02:46:31 +00:00
Chris Lattner
0dc165b5f1 silence VC++ warnings, patch by Hartmut Kaiser
llvm-svn: 41694
2007-09-04 02:46:00 +00:00
Chris Lattner
9cf21c5a2c Silence VC++ warnings, patch by Hartmut Kaiser
llvm-svn: 41693
2007-09-04 02:45:27 +00:00
Chris Lattner
fb2eb6941a eliminate some VC++ warnings, patch contributed by Hartmut Kaiser
llvm-svn: 41692
2007-09-04 02:34:27 +00:00
Chris Lattner
e15fa6c89c add a VC++ solution file, contributed by Hartmut Kaiser
llvm-svn: 41691
2007-09-04 02:31:11 +00:00
Steve Naroff
ac074b4df4 More fun with initializers!
- Fixed many bugs, enhanced test case considerably, added a diagnostic, etc.
- Refactored CheckInitList() into CheckVariableInitList()/CheckConstantInitList().
- Added CheckInitExpr().
- Support for multi-dimensional arrays looking good.

llvm-svn: 41690
2007-09-04 02:20:04 +00:00
Chris Lattner
ff3fa8b624 VC++ doesn't define S_ISDIR
llvm-svn: 41688
2007-09-03 18:37:14 +00:00
Chris Lattner
1463cca1cc Add a method required by the VC++ STL, patch by Hartmut Kaiser!
llvm-svn: 41687
2007-09-03 18:31:57 +00:00
Chris Lattner
a263393d11 Add #include required on win32.
llvm-svn: 41686
2007-09-03 18:30:32 +00:00
Chris Lattner
78b6221ff9 Eliminate some VC++ warnings, patch by Hartmut Kaiser!
llvm-svn: 41685
2007-09-03 18:28:41 +00:00
Chris Lattner
cd1e8d2c9d Add #ifdefs to make the source portable to windows. Patch contributed
by Hartmut Kaiser!

llvm-svn: 41684
2007-09-03 18:24:56 +00:00
Chris Lattner
4d37b81df9 initial checkin of vc++ project files, contributed by
Hartmut Kaiser!

llvm-svn: 41683
2007-09-03 18:21:31 +00:00
Steve Naroff
7d2c5ed92e Finish getting "array-init.c" to work properly.
Array scalar initialization is now is reasonable shape.

Next step, structure and array of structure initializers.

llvm-svn: 41681
2007-09-03 01:24:23 +00:00
Anton Korobeynikov
50ab26e835 Reapply r41578 with proper fix
llvm-svn: 41680
2007-09-03 00:36:06 +00:00
Anton Korobeynikov
35322d745c Silence warning while compiling with gcc 4.2
llvm-svn: 41676
2007-09-02 22:11:14 +00:00
Anton Korobeynikov
38ce90fd44 Emit proper "secrel" directive, where possible. This fixes invalid asm syntax of debug info on mingw32. Also, cleanup
some stuff.

llvm-svn: 41675
2007-09-02 22:07:21 +00:00
Steve Naroff
b03f5940d1 More progress on array initializers.
- Added Expr::isConstantExpr().
- Added type checking for InitListExpr elements.
- Added diagnostic for trying to initialize a variable sized object.

llvm-svn: 41674
2007-09-02 20:30:18 +00:00
Steve Naroff
f33527a1aa More semantic analysis of initializers.
Added 2 errors and one warning, updated test case.

llvm-svn: 41672
2007-09-02 15:34:30 +00:00
Steve Naroff
2fea13926f Start implementing semantic analysis for C initializers.
Step 1: Start instantiating InitListExpr's.
Step 2: Call newly added function Sema::CheckInitializer() from Sema::ParseDeclarator().
Step 3: Give InitListExpr's a preliminary type.
Step 4: Start emitting diagnostics for simple assignments.

Note:

As a result of step 1, the CodeGen/mandel.c test asserts "Unimplemented agg expr!", which is expected.

As a result of step 4, the test below now fails. This isn't expected and needs to be investigated (it appears type checking for C++ references is flawed in some way).

******************** TEST 'Sema/cxx-references.cpp' FAILED! ********************
Command: 
 clang -fsyntax-only Sema/cxx-references.cpp
Output:
Sema/cxx-references.cpp:8:12: warning: incompatible pointer types assigning 'int &*' to 'int *'
  int *p = &r;
           ^~
Sema/cxx-references.cpp:10:20: error: incompatible types assigning 'int (int)' to 'int (&)(int)'
  int (&rg)(int) = g;
                   ^
Sema/cxx-references.cpp:13:18: error: incompatible types assigning 'int [3]' to 'int (&)[3]'
  int (&ra)[3] = a;
                 ^
Sema/cxx-references.cpp:16:14: error: incompatible types assigning 'int *' to 'int *&'
  int *& P = Q;
             ^
4 diagnostics generated.
******************** TEST 'Sema/cxx-references.cpp' FAILED! ********************

llvm-svn: 41671
2007-09-02 02:04:30 +00:00
Steve Naroff
42a350a18a Finish converting SwitchStmt AST to source ranges.
Move DumpSourceRange() to DumpStmt().

Now -parse-ast-dump will display source range info for all stmts/exprs.

One day we should implement the source range protocol for Decls.

llvm-svn: 41670
2007-09-01 21:08:38 +00:00
Evan Cheng
2089a21360 More tweaks to improve compile time.
llvm-svn: 41669
2007-09-01 02:03:17 +00:00
Evan Cheng
ffac17a223 Fix a gcroot lowering bug.
llvm-svn: 41668
2007-09-01 02:00:51 +00:00
Fariborz Jahanian
53cacaec46 Patch to parse @implementation prologue, method definitions,
objc2's @synthesize and @dynamic.

llvm-svn: 41667
2007-09-01 00:26:16 +00:00
Steve Naroff
dc9f36e6c4 Convert more statments over to SourceRanges...
llvm-svn: 41666
2007-08-31 23:49:30 +00:00
Dale Johannesen
689d17d282 Oops, should be part of 41664; won't work very well without this piece.
llvm-svn: 41665
2007-08-31 23:35:31 +00:00
Dale Johannesen
446b900192 Add mod, copysign, abs operations to APFloat.
Implement some constant folding in SelectionDAG and
DAGCombiner using APFloat.  Remove double versions
of constructor and getValue from ConstantFPSDNode.

llvm-svn: 41664
2007-08-31 23:34:27 +00:00
Steve Naroff
33f3d05081 Move SourceRange protocol from Expr->Stmt.
Converted many of the statements over. Still a hanful left...

llvm-svn: 41663
2007-08-31 23:28:33 +00:00
Chris Lattner
49e3bfa8a4 add stmtexpr support for aggregates
llvm-svn: 41662
2007-08-31 22:54:14 +00:00
Chris Lattner
1c3ad19714 add support for complex stmtexpr's
llvm-svn: 41661
2007-08-31 22:51:38 +00:00
Chris Lattner
4647a21825 Generalize RValue to handle complex better, generalize EmitCompoundStmt to
support any sort of expr, add a new EmitAnyExpr routine.

llvm-svn: 41660
2007-08-31 22:49:20 +00:00
Ted Kremenek
cc778061e5 Fixed missing '(' and ')' characters in (CFG) pretty-printing of
statement expressions.

llvm-svn: 41659
2007-08-31 22:47:06 +00:00
Ted Kremenek
391f94a694 Added better pretty printing in CFGs for __builtin_choose_expr
llvm-svn: 41658
2007-08-31 22:29:13 +00:00
Ted Kremenek
f8b50e91b7 Further cleanups in CFG printing for comma expressions, statement expressions, and indirect gotos.
llvm-svn: 41657
2007-08-31 22:26:13 +00:00
Chris Lattner
04a913b958 implement code generation for scalar stmt expressions.
llvm-svn: 41656
2007-08-31 22:09:40 +00:00
Chris Lattner
cac27a5478 Fix a bug/missing-feature Ted noticed: the 'unused' warning should not
warn about the last stmt in a stmtexpr, f.e. there should be no warning for:

int maxval_stmt_expr(int x, int y) {
  return ({int _a = x, _b = y; _a > _b ? _a : _b; });
}

llvm-svn: 41655
2007-08-31 21:49:55 +00:00
Ted Kremenek
7f7dd7602c Cleanups for printing the terminators of CFGBlocks for "?", "||", and "&&" operators.
llvm-svn: 41654
2007-08-31 21:49:40 +00:00
Chris Lattner
78502cf4c9 diagnose extended uses of offsetof
llvm-svn: 41653
2007-08-31 21:49:13 +00:00
Chris Lattner
51728b7282 new diag
llvm-svn: 41652
2007-08-31 21:48:38 +00:00
Ted Kremenek
04f3cee11f Added "PrinterHelper" interface (include/AST/PrinterHelper) that can
be passed as an (optional) argument to StmtPrinter to customize
printing of AST nodes.

Used new PrinterHelper interface to enhance printing and visualization
of CFGs.  The CFGs now illustrate the semantic connectives between
statements and terminators, wheras in the previous printing certain
expressions would (visible) be printed multiple times to reflect which
expressions used the results of other expressions.

The end result is that the CFG is easier to read for flow of
expression values (following principles similar to the LLVM IR).

llvm-svn: 41651
2007-08-31 21:30:12 +00:00
Evan Cheng
7bef79a1c3 std::map -> DenseMap for slight compile time benefit.
llvm-svn: 41650
2007-08-31 21:23:06 +00:00
Reid Spencer
5028b76f93 Allow the configure options to be set according to the llvm-top options.
Patch improved from one by Holger Schurig.

llvm-svn: 41649
2007-08-31 19:53:42 +00:00
Ted Kremenek
bf57321068 Added #ifndef/#endif statements to protect the header from multiple inclusion.
llvm-svn: 41648
2007-08-31 17:53:25 +00:00
Steve Naroff
096dd942cf Removed Sema::VerifyConstantArrayType(). With the new Array/ConstantArray/VariableArray nodes, this
routine was causing more trouble than it was worth. Anders/Chris noticed that it could return an error code
without emiting a diagnostic (which results in an silent invalid decl, which should *never* happen). In addition,
this routine didn't work well for typedefs and field decls. Lastly, it didn't consider that initializers aren't
in place yet.

Added Type::getAsConstantArrayType(), Type::getAsVariableArrayType(), Type::getAsVariablyModifiedType(),
and Type::isVariablyModifiedType();

Modified Sema::ParseDeclarator() and Sema::ParseField() to use the new predicates. Also added a FIXME for
the initializer omission. Also added a missing test for "static" @ file scope.

llvm-svn: 41647
2007-08-31 17:20:07 +00:00
Ted Kremenek
527ec81d8b Added support for __builtin_choose_expr (ChooseExpr) in CFGs.
llvm-svn: 41646
2007-08-31 17:03:41 +00:00
Dale Johannesen
da7469f2b5 Revise per review of previous patch.
llvm-svn: 41645
2007-08-31 17:03:33 +00:00
Fariborz Jahanian
9fca6dfad3 Author: F. Jahanian
Log:
Implement parsing of objective-c's new @property declaration.

Modified:
include/clang/Basic/DiagnosticKinds.def
include/clang/Parse/Parser.h
Parse/ParseObjc.cpp
Parse/Parser.cpp

llvm-svn: 41644
2007-08-31 16:11:31 +00:00
Rafael Espindola
e636fc05d6 Initial support for calling functions with byval arguments on x86-64
llvm-svn: 41643
2007-08-31 15:06:30 +00:00
Rafael Espindola
bb8a5cff67 Align i64 and f64 at 8 byte on x86-64.
This is mandated table 3.1 at
http://www.x86-64.org/documentation/abi.pdf

llvm-svn: 41642
2007-08-31 12:23:58 +00:00
Evan Cheng
91becf4ffa Remove an unnecessary element, saving 4 bytes per LiveInterval.
llvm-svn: 41641
2007-08-31 08:26:44 +00:00
Evan Cheng
262596e76a Use std::map instead of a (potentially very sparse) array to track val# defined by copy from the other live range. Minor compile time win when number of val# is large.
llvm-svn: 41640
2007-08-31 08:04:17 +00:00
Evan Cheng
2e9d48aa0d Update test case to reflect Dale's change.
llvm-svn: 41639
2007-08-31 06:29:32 +00:00
Chris Lattner
319079c003 don't turn semantic errors into parse errors.
llvm-svn: 41638
2007-08-31 05:01:50 +00:00
Chris Lattner
c6c66c461f fix some memory leaks when recovering.
llvm-svn: 41637
2007-08-31 04:58:34 +00:00
Anders Carlsson
4692db0e7e Add InitListExpr class.
llvm-svn: 41636
2007-08-31 04:56:16 +00:00
Chris Lattner
57c523f50c add actions for deleting expr/stmt nodes.
llvm-svn: 41635
2007-08-31 04:53:24 +00:00
Chris Lattner
9e47ead594 Implement codegen support for lowering "library builtins" like __builtin_isinf
to their corresponding library routines (e.g. isinf).  This allows us to handle
all the stuff in macos math.h, and other stuff as it's added to *Builtins.def.

llvm-svn: 41634
2007-08-31 04:44:06 +00:00
Chris Lattner
1eec6601d9 add the ability to get the llvm function corresponding to a library builtin.
llvm-svn: 41633
2007-08-31 04:31:45 +00:00
Dale Johannesen
3cf889f75e Enhance APFloat to retain bits of NaNs (fixes oggenc).
Use APFloat interfaces for more references, mostly
of ConstantFPSDNode.

llvm-svn: 41632
2007-08-31 04:03:46 +00:00
Chris Lattner
7e2e459c48 add some accessors for querying attributes of builtins. Add the new 'F' attribute.
llvm-svn: 41631
2007-08-31 03:44:20 +00:00
Steve Naroff
43b8f7fa4f Sema::ParseCastExpr() missing call to UsualUnaryConversions().
The following case now works...

void empty(void * a ) {}

void test()
{
    unsigned char A[4]; 
    empty( (void *) A); 
}

Thanks to Patrick Flannery for finding this...

llvm-svn: 41630
2007-08-31 00:32:44 +00:00
Raul Herbster
ab871baaf8 Instruction formats added used to generate multiply instructions of V5TE.
llvm-svn: 41629
2007-08-30 23:34:14 +00:00
Raul Herbster
ff32b62942 Unused relocation type reloc_arm_absolute removed.
llvm-svn: 41628
2007-08-30 23:31:35 +00:00
Raul Herbster
1457b2b3b1 Comments added. It now generates V5TE multiply instructions. However, it is still necessary to model PUWLSH bits more clearly.
llvm-svn: 41627
2007-08-30 23:29:26 +00:00
Raul Herbster
73489273ae ARM instruction table was modified by adding information to generate multiply instruction of V5TE.
llvm-svn: 41626
2007-08-30 23:25:47 +00:00
Raul Herbster
ae1b924c79 JITInfo now resolves function addrs and also relocations. It always emits a stub.
llvm-svn: 41625
2007-08-30 23:21:27 +00:00
Steve Naroff
d57fa94148 Final phase of array cleanup (for now), removing a FIXME from yesterday.
Moved several array constraints checks from Sema::VerifyConstantArrayType() to
Sema::GetTypeForDeclarator(). VerifyConstantArrayType() is now very simple, and
could be removed eventually.

Now, we get the following (correct) messages for BlockVarDecls:-)

[dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang x.c -pedantic
x.c:4:20: error: size of array has non-integer type 'float'
  int size_not_int[f];
                   ^
x.c:5:21: error: array size is negative
  int negative_size[1-2];
                    ^~~
x.c:6:17: warning: zero size arrays are an extension
  int zero_size[0];
                ^
3 diagnostics generated.

llvm-svn: 41624
2007-08-30 22:35:45 +00:00
Ted Kremenek
fc7aafcef0 Minor cleanups to pretty-printing for loops in CFGs.
llvm-svn: 41623
2007-08-30 21:28:02 +00:00
Ted Kremenek
55e91e8bdd Fixed a bug in constructing CFG blocks for case statement fall-through
introduced by moving "CaseStmt" pointers out of the list of statements
and into the explicit "label" associated with a CFGBlock.  --This
line, and those below, will be ignored--

M    AST/CFG.cpp

llvm-svn: 41622
2007-08-30 18:48:11 +00:00
Steve Naroff
09b0fd24a7 Diff is self small & self explanatory...
llvm-svn: 41621
2007-08-30 18:45:57 +00:00
Ted Kremenek
e961050104 Fixed bug in CFG construction where we failed to handle loop bodies with
no statements (or just full of ';' statements).

llvm-svn: 41620
2007-08-30 18:39:40 +00:00
Ted Kremenek
f9b1756029 Fixed bug in CFG construction involving use of labels and "empty"
blocks involving only ';' statements.  We now correctly handle the following:

void empty_label() { l1: ; }

llvm-svn: 41619
2007-08-30 18:20:57 +00:00
Steve Naroff
cadebd086f Fix a comment.
llvm-svn: 41618
2007-08-30 18:14:25 +00:00
Ted Kremenek
bbad8ce2e7 Fixed bug where the CFG would fail to build when an 'if' statement had
an empty then or else block (or contained only ';' statements).

For example, we now handle the following:

int empty_else() { if (0) { int a; } else ; }
int empty_then() { if (0) ; else { int a; } }

Thanks to Nico Weber for spotting this problem.

llvm-svn: 41617
2007-08-30 18:13:31 +00:00
Steve Naroff
90dfdd5774 Polish yesterday's Array/ConstantArray/VariableArray rewrite, removing a couple FIXME's.
Refactored Array/VariableArray, moving SizeModifier/IndexTypeQuals back up to Array. These
attributes are not specific to VLA's. Most of them are specific to array parameter types.

llvm-svn: 41616
2007-08-30 18:10:14 +00:00
Chris Lattner
98dbf0a3b8 implement pretty printing of offsetof
llvm-svn: 41615
2007-08-30 17:59:59 +00:00
Chris Lattner
8718fcf35e a new testcase
llvm-svn: 41614
2007-08-30 17:51:09 +00:00
Chris Lattner
f17bd423c2 implement initial sema support for __builtin_offsetof
llvm-svn: 41613
2007-08-30 17:45:32 +00:00
Chris Lattner
e4ee2dfcf5 Pass the location of the type.
llvm-svn: 41612
2007-08-30 17:08:45 +00:00
Chris Lattner
55343038f4 Fix 80 col violations.
llvm-svn: 41611
2007-08-30 17:08:17 +00:00
Ted Kremenek
ed99b8a2a8 Added Graphviz escaping for the '|' character.
llvm-svn: 41610
2007-08-30 17:01:41 +00:00
Ted Kremenek
14f0d1a85a Fixed bug for CaseStmt where the child_begin/child_end methods were not
including the expressions in the case statement itself (not the body of
the case).

This required moving SubStmt out of SwitchCase into CaseStmt and DefaultStmt
respectively.  getSubStmt() now is a virtual call for SwitchCase, but is
a direct (static) call for CaseStmt and DefaultStmt.

llvm-svn: 41609
2007-08-30 16:50:46 +00:00
Tanya Lattner
ffb806cf0e Do not run on darwin.
llvm-svn: 41608
2007-08-30 16:07:20 +00:00
Chris Lattner
5ad4f46fd6 make sure to parse postfix expression suffixes after builtin
primary expressions.

llvm-svn: 41607
2007-08-30 15:52:49 +00:00
Chris Lattner
687d609f04 add an action callback for __builtin_offsetof
llvm-svn: 41606
2007-08-30 15:51:11 +00:00
Chris Lattner
fec2519b4b -C mode doesn't return comments on "#" lines, so the diag checker doesn't pick them up.
Test this the hard way.

llvm-svn: 41605
2007-08-30 06:38:49 +00:00
Chris Lattner
e41d2d3b22 When relexing the file to find expected warnings/errors, make sure
to turn off all lexer-related warnings.

llvm-svn: 41604
2007-08-30 06:34:23 +00:00
Chris Lattner
1e43547a53 fix a bug that is causing CodeGen/complex.c to be grumpy.
llvm-svn: 41603
2007-08-30 06:19:11 +00:00
Chris Lattner
11e30d355e Teach the stmtdumper to dump location/range info when a SourceMgr is available.
For example, -parse-ast-dump now prints:

static inline int __inline_isinff(float __x)
(CompoundStmt 0x2409a20
  (ReturnStmt 0x2409a10
    (BinaryOperator 0x24099f0 'int' <///usr/include/architecture/i386/math.h:183:63, col:102> '=='
      (CallExpr 0x24098f0 'float' <col:63, col:82>
        (ImplicitCastExpr 0x24098e0 'float (*)(float)' <col:63>
          (DeclRefExpr 0x2409880 'float (float)' <col:63> Decl='__builtin_fabsf' 0x2409840))
        (DeclRefExpr 0x24098a0 'float' <col:79> Decl='__x' 0x2409810))
      (CallExpr 0x24099c0 'float' <col:87, col:102>
        (ImplicitCastExpr 0x2409870 'float (*)(void)' <col:87>
          (DeclRefExpr 0x2409980 'float (void)' <col:87> Decl='__builtin_inff' 0x2409940))))))

where it only prints filename/line# if it changes from the previous value.  We 
really need loc info on stmts though, like we have on exprs.

llvm-svn: 41602
2007-08-30 06:17:34 +00:00
Chris Lattner
270228599d Fix a regression on test/Sema/unused-expr.c by fixing the type predicates
to test for the right type class.

llvm-svn: 41601
2007-08-30 06:10:41 +00:00
Chris Lattner
257fa2ae22 constify a method.
llvm-svn: 41600
2007-08-30 05:59:30 +00:00
Evan Cheng
ebb8540067 Added support to fold X86 load / store instructions. This allow rematerialized loads to be folded into their uses.
llvm-svn: 41599
2007-08-30 05:54:07 +00:00
Evan Cheng
32a0a995c6 Try fold re-materialized load instructions into its uses.
llvm-svn: 41598
2007-08-30 05:53:02 +00:00
Evan Cheng
9a25d98c86 Add a variant of foldMemoryOperand to fold any load / store, not just load / store from / to stack slots.
llvm-svn: 41597
2007-08-30 05:52:20 +00:00
Evan Cheng
ecf5342104 Added CreateFrameIndex to create a FrameIndex MachineOperand without a MachineInstr.
llvm-svn: 41596
2007-08-30 05:50:32 +00:00
Evan Cheng
c2081fe573 Mark load instructions with isLoad = 1.
llvm-svn: 41595
2007-08-30 05:49:43 +00:00
Steve Naroff
5c13180a27 Fix the following redefinition errors submitted by Keith Bauer...
[dylan:~/llvm/tools/clang] admin% cat tentative_decls.c 
// incorrectly generates redefinition error
extern int array[3];
int array[3];

// incorrectly generates a redefinition error
extern void nup(int a[3]);
void nup(int a[3]) {}

It turns out that this exposed a fairly major flaw in the type system,
array types were never getting uniqued! This is because all array types
contained an expression, which aren't unique.

To solve this, we now have 2 array types, ConstantArrayType and
VariableArrayType. ConstantArrayType's are unique, VAT's aren't.

This is a fairly extensive set of fundamental changes. Fortunately,
all the tests pass. Nevertheless, there may be some collateral damage:-)
If so, let me know!

llvm-svn: 41592
2007-08-30 01:06:46 +00:00
Chris Lattner
84ca3762ae Previous commit should have been:
Use Ted's child walking interface to allow the dumper to walk the tree 
  in one place and only have node-specific callbacks worry about 
  formatting the nodes (instead of formatting the nodes plus walking the
  tree).

This commit eliminates now default cases by letting them fall through with
the normal visitor stuff.

llvm-svn: 41591
2007-08-30 01:00:35 +00:00
Bill Wendling
10e18dea2a Use i64 on a PPC64 machine
llvm-svn: 41590
2007-08-30 00:59:19 +00:00
Chris Lattner
cfb83dd7f2 elimiante some virtual calls.
llvm-svn: 41589
2007-08-30 00:53:54 +00:00
Chris Lattner
779d5d9476 Allow a SourceManager to optionally be passed into Stmt::dump
llvm-svn: 41588
2007-08-30 00:40:08 +00:00
Dale Johannesen
d246b2ca5c Change LegalFPImmediates to use APFloat.
Add APFloat interfaces to ConstantFP, SelectionDAG.
Fix integer bit in double->APFloat conversion.
Convert LegalizeDAG to use APFloat interface in
ConstantFPSDNode uses.

llvm-svn: 41587
2007-08-30 00:23:21 +00:00
Ted Kremenek
7142e18823 Added comments about -dump-cfg and -view-cfg modes for the clang driver.
llvm-svn: 41586
2007-08-29 23:26:37 +00:00
Ted Kremenek
71eca01291 Added an (optional) explicit "Label" statement to CFGBlock. If a
block begins with a label or case statement, CFGBlock::getLabel() will
return the corresponding LabelStmt/CaseStmt/DefaultStmt.

LabelStmts and SwitchCases no longer appear within the "executable"
statements of a CFGBlock.

More cleanups on visualization/pretty-printing of CFGs (less verbose).

llvm-svn: 41585
2007-08-29 23:20:49 +00:00
Anton Korobeynikov
2bdec2a5ee Fix use of declaration inside case block
llvm-svn: 41584
2007-08-29 23:18:48 +00:00
Chris Lattner
6678284a73 cleanup context-sensitive objc keyword recognition. Patch by Fariborz Jahanian.
llvm-svn: 41583
2007-08-29 22:54:08 +00:00
Neil Booth
4a1ee0562d Spaces not tabs.
llvm-svn: 41582
2007-08-29 22:13:52 +00:00
Neil Booth
ac582c5ecb Ensure we diagnose long long literals in C90 mode.
llvm-svn: 41581
2007-08-29 22:00:19 +00:00
Ted Kremenek
4e5f99da6c Added GraphTraits to source-level CFGs (CFG and CFGBlock) to allow
(LLVM-provided) graph algorithms such as DFS and graph visualization
to work effortless on source-level CFGs.

Further cleanup on pretty printing of CFGs.  CFGBlock::dump and
CFGBlock::print now take the parent CFG as an argument.  This allows
CFGBlocks to print their own appropriate label indicating whether or
not they are the Entry/Exit/IndirectGotoBlock without the CFG::print
routine doing it instead.

Added Graphviz visualization for CFGs: CFG::viewCFG.  This employs the
GraphTraits just implemented.

Added "-view-cfg" mode the to clang driver.  This is identical to
"-dump-cfg" except that it calls Graphviz to visualize the CFGs
instead of dumping them to the terminal.

llvm-svn: 41580
2007-08-29 21:56:09 +00:00
Evan Cheng
1ad4a6117b Change LiveRange so it keeps a pointer to the VNInfo rather than an index.
Changes related modules so VNInfo's are not copied. This decrease
copy coalescing time by 45% and overall compilation time by 10% on siod.

llvm-svn: 41579
2007-08-29 20:45:00 +00:00
Anton Korobeynikov
830b1cb4e9 Lower FRAME_TO_ADDR_OFFSET to zero by default (if not custom lowered)
llvm-svn: 41578
2007-08-29 19:28:29 +00:00
Duncan Sands
7741427a09 Move getX86RegNum into X86RegisterInfo and use it
in the trampoline lowering.  Lookup the jump and
mov opcodes for the trampoline rather than hard
coding them.

llvm-svn: 41577
2007-08-29 19:01:20 +00:00
Raul Herbster
f1aaa801ed Alphabetize Raul's entry.
llvm-svn: 41576
2007-08-29 18:21:29 +00:00
Ted Kremenek
5ccf0d832d Added checking (during parsing) of comparison of floating point values using == or !=.
This is the same functionality gcc provides via --Wfloat-equal.

llvm-svn: 41574
2007-08-29 18:06:12 +00:00
Chris Lattner
8a241f9359 Teach Type::is[un]SignedIntegerType about enum decls. This allows the code generator
to emit signed comparisons when needed for enum decl references.  This implements
test/CodeGen/enum.c.  I think enums should be good now.

llvm-svn: 41572
2007-08-29 17:48:46 +00:00
Chris Lattner
3a370bf33f Implement GCC-compatible layout and typing of enum constants and enum decl.
A small bit of codegen work is still pending.

llvm-svn: 41571
2007-08-29 17:31:48 +00:00
Chris Lattner
959bcdcae6 add some accessors
llvm-svn: 41570
2007-08-29 17:23:37 +00:00
Raul Herbster
4c5fac3977 New contributor added
llvm-svn: 41569
2007-08-29 16:51:52 +00:00
Tanya Lattner
bca16c80ed Updating configure script to enable MIPS.
llvm-svn: 41568
2007-08-29 16:38:16 +00:00
Chris Lattner
2198ea9097 Silence implicit 64->32-bit conversion warnings.
llvm-svn: 41567
2007-08-29 16:32:50 +00:00
Chris Lattner
2408d769eb getMinSignedBits needs to take into consider the sign bit when the value is positive.
llvm-svn: 41566
2007-08-29 16:21:18 +00:00
Chris Lattner
8d22b4e18a update these
llvm-svn: 41565
2007-08-29 16:15:23 +00:00
Chris Lattner
c92bc4ce2f Fix a null dereference Neil ran into
llvm-svn: 41564
2007-08-29 16:03:41 +00:00
Chris Lattner
fb38f274ff remove some ugly code now that implicit defs are being generated in this case, thanks Steve!
llvm-svn: 41560
2007-08-29 06:38:44 +00:00
Steve Naroff
c5e5027b86 Re-teach Expr::isNullPointerConstant() about ImplicitCastExpr:-)
This fixes the following bug submitted by Neil...

const char *f (void) { return 0; }

...which would incorrectly warn with -pedantic enabled.

llvm-svn: 41559
2007-08-29 00:00:02 +00:00
Steve Naroff
0b66158248 Implement default argument promotions (for old-style function calls and variable argument lists).
[dylan:~/llvm/tools/clang] admin% cat x.c

int printf(const char *, ...);

int oldschool();

void foo() {
  float f; 
  short i;
  printf("foo %f", 1.0f);

  oldschool(f,i);
}

[dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang x.c -parse-ast-dump

int printf(char const *, ...);

int oldschool();

void foo()
(CompoundStmt 0x3105f00
  (DeclStmt 0x3105ba0
    0x3105ce0 "float f")
  (DeclStmt 0x3105c90
    0x3105d10 "short i")
  (CallExpr 0x3105df0 'int'
    (ImplicitCastExpr 0x3105dc0 'int (*)(char const *, ...)'
      (DeclRefExpr 0x3105c20 'int (char const *, ...)' Decl='printf' 0x3105bd0))
    (ImplicitCastExpr 0x3105dd0 'char const *'
      (StringLiteral 0x3105d60 'char *' "foo %f"))
    (ImplicitCastExpr 0x3105de0 'double'
      (FloatingLiteral 0x3105d80 'float' 1.000000)))
  (CallExpr 0x3105ed0 'int'
    (ImplicitCastExpr 0x3105ea0 'int (*)()'
      (DeclRefExpr 0x3105e20 'int ()' Decl='oldschool' 0x3105c40))
    (ImplicitCastExpr 0x3105eb0 'double'
      (DeclRefExpr 0x3105e40 'float' Decl='f' 0x3105ce0))
    (ImplicitCastExpr 0x3105ec0 'int'
      (DeclRefExpr 0x3105e60 'short' Decl='i' 0x3105d10))))

llvm-svn: 41558
2007-08-28 23:30:39 +00:00
Steve Naroff
1d8ce44aa4 Teach Expr::isNullPointerConstant() about ImplicitCastExpr's.
This fixes the following (recent) regression noticed by Keith Bauer (thanks!).

void func(void *a);

main() {
  void *p;
  p = 0;
  func(0);
}

...which now works as you would expect.

llvm-svn: 41557
2007-08-28 21:20:34 +00:00
Dan Gohman
81b62e1218 Add an option, -view-sunit-dags, for viewing the actual SUnit DAGs used by
scheduling.

llvm-svn: 41556
2007-08-28 20:32:58 +00:00
Steve Naroff
f93b6726b1 Finish converting decls over to the new invalid decl API.
Also removed an old FIXME (FIXME: "auto func();" passes through...).

llvm-svn: 41555
2007-08-28 20:14:24 +00:00
Ted Kremenek
eda180e239 Added support for indirect-gotos (GCC extension) in source-level CFGs.
This involves the construction of a specialized "dispatch" block that
all basic blocks containing indirect gotos unconditionally transfer
control-flow to.  The successors of the dispatch block has as its successors
all of the blocks containing labels whose address was taken somewhere in
the function.

llvm-svn: 41554
2007-08-28 19:26:49 +00:00
Chuck Rose III
e87935b379 Update win32 VStudio project files to keep pace with recently added and deleted files
llvm-svn: 41553
2007-08-28 18:59:02 +00:00
Steve Naroff
cf871f59bf Move the "invalid decl" idiom up to Decl (where we have some bits to steal:-)
Converted ParmVarDecl, FileVarDecl, BlockVarDecl, and Sema::ParseIdentifierExpr() to use the idiom.

Updated array-constraint.c to make sure we no longer get "undeclared identifier" errors:-)

llvm-svn: 41552
2007-08-28 18:45:29 +00:00
Chris Lattner
24b51ff752 Emit a slightly better warning for unused values for unary and binary operators:
t2.c:3:18: warning: expression result unused
     x = ++x, ++y, y+2;
     ~~~~~~~~~~~~^ ~~~

llvm-svn: 41551
2007-08-28 18:40:30 +00:00
Chris Lattner
c11005faa1 add a sourcelocation to binary operator to keep track of the location of the operator.
llvm-svn: 41550
2007-08-28 18:36:55 +00:00
Ted Kremenek
105efce68f Added support for GCC-style statement expressions in source-level CFGs.
llvm-svn: 41549
2007-08-28 18:30:10 +00:00
Chris Lattner
1c1f932433 Change EnumDecl to store its corresponding integer type
directly in it.  Remove TargetInfo::getEnumPolicy, as there is only
one policy that we support right now.

llvm-svn: 41548
2007-08-28 18:24:31 +00:00
Ted Kremenek
25fb681907 Added support for comma expressions and DeclStmts which may have
arbitrarily complex control-flow in their subexpressions.

llvm-svn: 41547
2007-08-28 18:14:37 +00:00
Ted Kremenek
e07a8cd7ff Fixed return-of-stack-address checker to correctly handle stack/global
variables that have a pointer type, or arrays that contain pointers.

This fixes a crash on the following code:

int *h[3];

int **foo(int i)
{
   return &(h[i]);
}

This bug was reported by Keith Bauer (thanks!).

llvm-svn: 41546
2007-08-28 17:02:55 +00:00
Chris Lattner
35da3e29dd extwarn about VLAs in C89 mode.
llvm-svn: 41545
2007-08-28 16:54:00 +00:00
Chris Lattner
8ed218afb9 c++'0x has long long also.
llvm-svn: 41544
2007-08-28 16:41:29 +00:00
Chris Lattner
f2c338b7d1 warn about long long when in c89 mode.
llvm-svn: 41543
2007-08-28 16:40:32 +00:00
Steve Naroff
4ca5d5a9e8 Tweak declaration...
llvm-svn: 41542
2007-08-28 16:31:47 +00:00
Chris Lattner
613cef84b4 new testcase
llvm-svn: 41541
2007-08-28 16:20:14 +00:00
Ted Kremenek
91e8d2a974 Removed special-casing in CFG construction for ParenExprs.
llvm-svn: 41540
2007-08-28 16:18:58 +00:00
Evan Cheng
a5b10b334f Recover most of the compile time regression due to recent live interval changes.
1. Eliminate the costly live interval "swapping".
2. Change ValueNumberInfo container from SmallVector to std::vector. The former
   performs slowly when the vector size is very large.

llvm-svn: 41536
2007-08-28 08:28:51 +00:00
Chris Lattner
c4f6d0c5cf fix 80 col violation
llvm-svn: 41533
2007-08-28 06:17:15 +00:00
Chris Lattner
b8a501ccf1 compute the required destination type for an enum, emitting various warnings.
TODO: update the types of the constants and the enum.
llvm-svn: 41532
2007-08-28 06:15:15 +00:00
Chris Lattner
d0e7ed3f2c remove dead method.
llvm-svn: 41531
2007-08-28 05:56:37 +00:00
Chris Lattner
bf478cbef2 add a diagnostic:
t.c:1:12: warning: ISO C restricts enumerator values to range of 'int' (180388626432 is too large)
enum e {A, B = 42LL << 32, C = -4, D = 12456 };
           ^

llvm-svn: 41530
2007-08-28 05:27:00 +00:00
Bruno Cardoso Lopes
43318839c9 Added method to get Mips register numbers
Changed the stack frame layout, StackGrowsUp fits better to Mips strange stack.
Stack offset calculation bug fixed!

llvm-svn: 41529
2007-08-28 05:13:42 +00:00
Chris Lattner
67933c0aae move a todo
llvm-svn: 41528
2007-08-28 05:10:31 +00:00
Bruno Cardoso Lopes
14033fb5cb Changed stack allocation On LowerFORMAL_ARGUMENTS.
Added comments about new stack allocation.
Expand SelectCC for i32 results

llvm-svn: 41527
2007-08-28 05:08:16 +00:00
Bruno Cardoso Lopes
cfd1638e2d Mask directive completed with CalleeSave info
Comments for Mips directives added.

llvm-svn: 41526
2007-08-28 05:06:17 +00:00
Bruno Cardoso Lopes
f55a785e56 Added methods to record SPOffsets from LowerFORMAL_ARGUMENTS
llvm-svn: 41525
2007-08-28 05:04:41 +00:00
Chris Lattner
39f920f35b now that all the infrastructure is in place, enforce C99 6.8.5p3.
Note the FIXME: we need some way to mark a decl erroneous :)

llvm-svn: 41524
2007-08-28 05:03:08 +00:00
Chris Lattner
773c0596b8 If the condition of a for statement is promoted, make sure the
implicit cast gets linked back into the AST.

llvm-svn: 41523
2007-08-28 04:55:47 +00:00
Chris Lattner
0e258b8518 Cut off crazy computation. This helps PR1622 slightly.
llvm-svn: 41522
2007-08-28 04:23:55 +00:00
Steve Naroff
7e6f7c25bf Implement more thoughful error recovery when dealing with bogus declarator types.
For example, the following code was resulting in spurious warnings. This was the result of
Sema::GetTypeForDeclarator() synthesizing a type to hand back to the caller (in this case,
"int []", instead of "struct s[]", which is invalid).

struct s; 
struct s* t (struct s z[]) {   // expected-error {{array has incomplete element type}}
  return z;
}

Strategy: Flag the error in Declarator/DeclaratorChunk. This info is later stored in 
the ParmVarDecl. If the decl is referenced, Sema::ParseIdentifierExpr() will check if 
the type is invalid. If so, it quietly returns "true", without instantiating a DeclRefExpr.

This seems to work nicely. If Chris is happy with the approach, I will generalize this to
all VarDecls.

llvm-svn: 41521
2007-08-28 03:03:08 +00:00
Ted Kremenek
12687ff9b8 Added support for short-circuit '&&' and '||' operators in source-level CFGs.
llvm-svn: 41520
2007-08-27 21:54:41 +00:00
Steve Naroff
a042db2b80 Some minor aesthetic changes to the control flow.
llvm-svn: 41517
2007-08-27 21:43:43 +00:00
Devang Patel
d2456a171d Use simpler test to filter loops.
llvm-svn: 41516
2007-08-27 21:34:31 +00:00
Steve Naroff
e31313d792 Fix remaining bugs with complex/float promotions.
llvm-svn: 41515
2007-08-27 21:32:55 +00:00
Ted Kremenek
9e248870e5 Implemented support for ternary "?" operators in source-level CFGs.
llvm-svn: 41514
2007-08-27 21:27:44 +00:00
Chris Lattner
0515e4b26a Fix a few enum-related fixme's
llvm-svn: 41513
2007-08-27 21:16:18 +00:00
Ted Kremenek
251c9544e8 Fixed bug in child_begin/child_end for CallExpr where we incorrectly calculated a Stmt** pointer
based on an offset within SubExprs.

llvm-svn: 41512
2007-08-27 21:11:44 +00:00
Ted Kremenek
5b3ed283f5 Fixed bug in child_begin/child_end for ReturnStmt where the iterator
would be invalid when RetValExp == NULL.

llvm-svn: 41511
2007-08-27 20:58:16 +00:00
Dan Gohman
312b70a970 Add explicit triples to avoid default behavior that varies by host.
llvm-svn: 41510
2007-08-27 20:54:48 +00:00
Ted Kremenek
81e1485d4c Changes to CFGBuilder:
+ Added the creation of an empty Entry block at the end of CFG
  construction if the Entry block in the CFG contains multiple
  predecessors (which can happen with labels and do loops).

+ Fixed bug in the creation of an empty Exit block with functions where not
  all paths end in a return statement (but some do).  Basic blocks with
  return statements were jumping to a (sometimes) non-empty block.

+ FinishBlock no longer checks for labels at the beginning of a basic
  block before reversing the statements in the block.  This is because
  the recursion invariants of the builder methods have been cleaned up,
  and blocks are only passed to FinishBlock at most once.

+ Modified handling of "if", "for", "while", "do", and "switch" to allow
  condition expressions that can span multiple basic blocks.  This allows
  such conditions to contain short-circuit expressions (which span multiple
  blocks in the CFG).

llvm-svn: 41508
2007-08-27 19:46:09 +00:00
David Greene
703623d571 Update InvokeInst to work like CallInst
llvm-svn: 41506
2007-08-27 19:04:21 +00:00
Chris Lattner
8f63b9d534 constify some stuff
llvm-svn: 41503
2007-08-27 17:56:57 +00:00
Rafael Espindola
b602461f48 Add a comment about using libc memset/memcpy or generating inline code.
llvm-svn: 41502
2007-08-27 17:48:26 +00:00
Chris Lattner
304ff47b1a teach codegen to lay out enum types.
llvm-svn: 41501
2007-08-27 17:44:34 +00:00
Chris Lattner
a9e7961a44 implement sizeof(enum x), patch inspired by Keith Bauer.
llvm-svn: 41500
2007-08-27 17:38:00 +00:00
Chris Lattner
f283a37179 better error recovery for non-i-c-e enum constants.
llvm-svn: 41499
2007-08-27 17:37:24 +00:00
Chris Lattner
37256fbdec C++ allows empty enum list.
llvm-svn: 41498
2007-08-27 17:24:30 +00:00
Duncan Sands
dd94bde661 Remove this test as it is too hard to fix after the
latest EH changes, and in any case it is hard to
imagine how the original bug could be reintroduced.

llvm-svn: 41497
2007-08-27 17:08:14 +00:00
Chris Lattner
1c14d71010 add some accessors.
llvm-svn: 41496
2007-08-27 16:50:56 +00:00
Chris Lattner
db37c8391c Add enum type conversion policies, patch by Keith Bauer
llvm-svn: 41495
2007-08-27 16:48:59 +00:00
Duncan Sands
68b773df24 Fix this test: llvm-gcc-4.2 optimizes almost everything away,
resulting in zero matches, while llvm-gcc-4.1 manages to
remove one pointless selector changing the number of matches.

llvm-svn: 41494
2007-08-27 16:47:32 +00:00
Ted Kremenek
d11e460810 Updated checker for "return of address of stack variable" to look for
implicit casts from T to T& at the topmost part of the return-value expression.

This checking may be needed within EvalAddr later on.  We'll wait until
test cases show this kind of logic is necessary (as more C++ features are
implemented in clang).

llvm-svn: 41493
2007-08-27 16:39:17 +00:00
Chris Lattner
23bf38b8c5 add some more testcases now that sema is happier :)
llvm-svn: 41492
2007-08-27 16:37:44 +00:00
Dan Gohman
9625d812c9 Make DAGCombiner's global alias analysis query more precise in the case
where both pointers have non-zero offsets.

llvm-svn: 41491
2007-08-27 16:32:11 +00:00
Duncan Sands
90064ed445 Now that we don't output cleanups by default, the action
offset needs to be adjusted in this test.

llvm-svn: 41490
2007-08-27 16:30:05 +00:00
Dan Gohman
8dc0b93151 If the source and destination pointers in an llvm.memmove are known
to not alias each other, it can be translated as an llvm.memcpy.

llvm-svn: 41489
2007-08-27 16:26:13 +00:00
Dan Gohman
71eaf62e5f Change comments to refer to @malloc and @free instead of %malloc and %free.
llvm-svn: 41488
2007-08-27 16:11:48 +00:00
Duncan Sands
ef5a654216 There is an impedance matching problem between LLVM and
gcc exception handling: if an exception unwinds through
an invoke, then execution must branch to the invoke's
unwind target.  We previously tried to enforce this by
appending a cleanup action to every selector, however
this does not always work correctly due to an optimization
in the C++ unwinding runtime: if only cleanups would be
run while unwinding an exception, then the program just
terminates without actually executing the cleanups, as
invoke semantics would require.  I was hoping this
wouldn't be a problem, but in fact it turns out to be the
cause of all the remaining failures in the LLVM testsuite
(these also fail with -enable-correct-eh-support, so turning
on -enable-eh didn't make things worse!).  Instead we need
to append a full-blown catch-all to the end of each
selector.  The correct way of doing this depends on the
personality function, i.e. it is language dependent, so
can only be done by gcc.  Thus this patch which generalizes
the eh.selector intrinsic so that it can handle all possible
kinds of action table entries (before it didn't accomodate
cleanups): now 0 indicates a cleanup, and filters have to be
specified using the number of type infos plus one rather than
the number of type infos.  Related gcc patches will cause
Ada to pass a cleanup (0) to force the selector to always
fire, while C++ will use a C++ catch-all (null).

llvm-svn: 41484
2007-08-27 15:47:50 +00:00
Steve Naroff
7af82d462a Replaced ASTContext::maxFloatingType() with ASTContext::compareFloatingType().
Changed Sema::UsualArithmeticConversions to use the new API.

This fixes the following case...

_Complex double X;
double y;

void foo() {
  X = X + y;
}

[dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang complex.c -parse-ast-dump
Read top-level variable decl: 'X'
Read top-level variable decl: 'y'

void foo()
(CompoundStmt 0x2605cc0
  (BinaryOperator 0x2605ca0 '_Complex double' '='
    (DeclRefExpr 0x2605c10 '_Complex double' Decl='X' 0x2605ab0)
    (BinaryOperator 0x2605c80 '_Complex double' '+'
      (DeclRefExpr 0x2605c30 '_Complex double' Decl='X' 0x2605ab0)
      (ImplicitCastExpr 0x2605c70 '_Complex double'
        (DeclRefExpr 0x2605c50 'double' Decl='y' 0x2605ae0)))))

llvm-svn: 41483
2007-08-27 15:30:22 +00:00
Dan Gohman
032d89828e Add explicit keywords and remove spurious trailing semicolons.
llvm-svn: 41482
2007-08-27 14:50:10 +00:00
Rafael Espindola
ff33241e16 call libc memcpy/memset if array size is bigger then threshold.
Coping 100MB array (after a warmup) shows that glibc 2.6.1 implementation on
x86-64 (core 2) is 30% faster (from 0.270917s to 0.188079s)

llvm-svn: 41479
2007-08-27 10:18:20 +00:00
Chris Lattner
61f6077814 testcase that doesn't work quite yet
llvm-svn: 41478
2007-08-27 05:23:45 +00:00
Chris Lattner
d864daf5c6 extwarn about decls intermixed with code in c89 mode.
llvm-svn: 41477
2007-08-27 04:29:41 +00:00
Steve Naroff
808eb8fe88 Add Type::getAsBuiltinType() and Type::builtinTypesAreCompatible().
Modified Type::typesAreCompatible() to use the above.

This fixes the following bug submitted by Keith Bauer (thanks!).

int equal(char *a, const char *b)
{
    return a == b;
}

Also tweaked Sema::CheckCompareOperands() to ignore the qualifiers when
comparing two pointer types (though it doesn't relate directly to this bug).

llvm-svn: 41476
2007-08-27 04:08:11 +00:00
Steve Naroff
fc6ffa2513 Tweak a comment and assert.
llvm-svn: 41475
2007-08-27 01:41:48 +00:00
Steve Naroff
9091ef703c Replaced ASTContext::maxComplexType() with ASTContext::getFloatingTypeOfSizeWithinDomain().
Changed Sema::UsualArithmeticConversions to correctly implement complex/float conversions, 
using maxFloatingType() with getFloatingTypeOfSizeWithinDomain().

llvm-svn: 41474
2007-08-27 01:27:54 +00:00
Chris Lattner
dfaf9f8c2f implement a fixme: __extension__ marker on decls in compound stmts.
llvm-svn: 41473
2007-08-27 01:01:57 +00:00
Chris Lattner
bda69f80bc move EmitAggregateCopy into AggExprEmitter
llvm-svn: 41472
2007-08-26 23:13:56 +00:00
Chris Lattner
2dd1b72bde Fix test/Parser/if-scope-*.c. Patch by Neil Booth!
llvm-svn: 41471
2007-08-26 23:08:06 +00:00
Chris Lattner
c1045b1a69 remove dead code
llvm-svn: 41470
2007-08-26 23:02:57 +00:00
Chris Lattner
1916b88723 remove dead protos
llvm-svn: 41469
2007-08-26 23:01:23 +00:00
Chris Lattner
6c555f96e8 eliminate EmitAnyExpr, inlining it and simplifying it into its only caller.
llvm-svn: 41468
2007-08-26 22:58:05 +00:00
Chris Lattner
a811da5fcd eliminate use of EmitAnyExpr.
llvm-svn: 41467
2007-08-26 22:55:13 +00:00
Chris Lattner
a8d8b71680 implement a fixme
llvm-svn: 41466
2007-08-26 22:47:40 +00:00
Chris Lattner
02aac86549 new testcases
llvm-svn: 41465
2007-08-26 22:41:57 +00:00
Chris Lattner
e56d3e1a23 Implement compound assignment operators whose LHS is scalar but RHS is complex.
llvm-svn: 41464
2007-08-26 22:37:40 +00:00
Chris Lattner
624e6d0c68 implement codegen of compound assignment operators for complex.
llvm-svn: 41463
2007-08-26 22:09:01 +00:00
Chris Lattner
6d7b404d08 If a visitor doesn't define VisitBinMulAssign, fallback to VisitCompoundAssignOperator
instead of VisitBinaryOperator.

llvm-svn: 41462
2007-08-26 22:08:29 +00:00
Anton Korobeynikov
24fb6b2f8c Don't promote volatile loads/stores. This is needed (for example) to handle setjmp/longjmp properly.
This fixes PR1520.

llvm-svn: 41461
2007-08-26 21:43:30 +00:00
Chris Lattner
b633469e02 compound assignment operators are of type CompoundAssignOperator
llvm-svn: 41460
2007-08-26 21:41:21 +00:00
Chris Lattner
d65598daa3 dispatch to functions like VisitBinRemAssign with knowledge that
the operand is of type CompoundAssignOperator, not just BinaryOperator.

llvm-svn: 41459
2007-08-26 21:40:28 +00:00
Chris Lattner
2c666fa40d update fixme's
llvm-svn: 41458
2007-08-26 21:27:07 +00:00
Chris Lattner
6f672c150c implement complex division
llvm-svn: 41457
2007-08-26 21:24:19 +00:00
Owen Anderson
2b9ec7ff33 Don't DSe volatile stores.
llvm-svn: 41456
2007-08-26 21:14:47 +00:00
Chris Lattner
dd9a319158 Add isysroot support, patch by Keith Bauer
llvm-svn: 41455
2007-08-26 17:47:35 +00:00
Chris Lattner
0c6aad373f Fix %p format checking, patch by Keith Bauer.
llvm-svn: 41454
2007-08-26 17:39:38 +00:00
Chris Lattner
0d850bfed8 For warnings like this:
t.c:3:9: warning: invalid conversion '%B'
printf("%B\a\n", p);
~~~~~~  ^

Don't beep the console or print the newline.

llvm-svn: 41453
2007-08-26 17:38:22 +00:00
Chris Lattner
9decfbabd3 Fix a bug reported by Keith Bauer
llvm-svn: 41452
2007-08-26 17:32:59 +00:00
Chris Lattner
2e928885b2 fix a typo noticed by Gordon Henriksen
llvm-svn: 41451
2007-08-26 17:25:57 +00:00
Chris Lattner
c3b3707536 llvmgcc is right :)
llvm-svn: 41450
2007-08-26 16:54:05 +00:00
Chris Lattner
183c231cf9 compound assignmetns work for scalars.
llvm-svn: 41449
2007-08-26 16:52:57 +00:00
Chris Lattner
c141c1b390 implement conversions of complex to bool.
llvm-svn: 41448
2007-08-26 16:52:28 +00:00
Chris Lattner
268fcce4f0 remove ConvertScalarValueToBool.
llvm-svn: 41447
2007-08-26 16:46:58 +00:00
Chris Lattner
e004438f4a reimplement ConvertScalarValueToBool in CGExprScalar.cpp
llvm-svn: 41446
2007-08-26 16:42:57 +00:00
Chris Lattner
42e6b8150a refactor some code to expose compex->scalar conversion to CGF
llvm-svn: 41445
2007-08-26 16:34:22 +00:00
Chris Lattner
b84bb95b44 be slightly more volatile correct
llvm-svn: 41444
2007-08-26 16:22:13 +00:00
Steve Naroff
5f90ca9904 Fix bogus warnings (noticed by Chris) with array-constraints.c.
Remove bogus type conversions in Sema::GetTypeForDeclarator(). This commit
only deals with the array types (DeclaratorCheck::Array), though the
rest of this routine should be reviewed. Given the complexity of C declarators,
I don't want to change the entire routine now (will discuss with Chris tomorrow).

llvm-svn: 41443
2007-08-26 14:38:38 +00:00
Chris Lattner
f6dcc9df7e these fixme's are easy :)
llvm-svn: 41442
2007-08-26 07:30:49 +00:00
Chris Lattner
b753f66339 implement a fixme, add a couple more :)
llvm-svn: 41441
2007-08-26 07:29:23 +00:00
Chris Lattner
5de3b174c8 there are no conversions from aggregates to scalars.
llvm-svn: 41440
2007-08-26 07:26:12 +00:00
Chris Lattner
08c611e4dc implement conversions from complex to scalar types.
llvm-svn: 41439
2007-08-26 07:21:11 +00:00
Chris Lattner
46c7161311 Omit EmitConversion
llvm-svn: 41438
2007-08-26 07:16:41 +00:00
Chris Lattner
45067906ad Fix return of aggregate and return of complex.
llvm-svn: 41437
2007-08-26 07:14:44 +00:00
Chris Lattner
44d3e74e22 these implicit conversions are now explicit :)
llvm-svn: 41436
2007-08-26 07:09:42 +00:00
Chris Lattner
cf3da8495a remove uses of EmitConversion
llvm-svn: 41435
2007-08-26 07:08:39 +00:00
Chris Lattner
798da7033f implicit casts take care of this code, remove it now.
llvm-svn: 41434
2007-08-26 07:06:24 +00:00
Chris Lattner
3474c202ab refactor scalar conversions out into CGExprScalar.cpp
llvm-svn: 41433
2007-08-26 06:48:56 +00:00
Chris Lattner
e026ebd6fe steve's recent changes fixed this bogus warning.
llvm-svn: 41432
2007-08-26 06:48:28 +00:00
Chris Lattner
1a76a3c970 Break the assumption that any sort of scope (e.g. a loop scope) can
hold declarations.  Instead, introduce a new "DeclScope" scope type that
holds them explicitly.  For now, all scopes have this bit, but in the 
future we can use them to fix some issues Neil noticed.

llvm-svn: 41431
2007-08-26 06:24:45 +00:00
Chris Lattner
88078594fc remove some dead enum values.
llvm-svn: 41430
2007-08-26 06:03:04 +00:00
Chris Lattner
7460f9620c Implement casts from scalar -> complex and complex->complex.
llvm-svn: 41429
2007-08-26 05:57:57 +00:00
Chris Lattner
e267f5d2f7 require that operands to __real/__imag are complex or arithmetic. This
fixes GCC PR33193

llvm-svn: 41428
2007-08-26 05:39:26 +00:00
Chris Lattner
b5e1262437 implement codegen of __imag of a scalar. Our impl doesn't suffer from
GCC bug PR33192.

llvm-svn: 41427
2007-08-26 05:29:21 +00:00
Chris Lattner
9de9527ad6 Make initialization of complex vars work.
llvm-svn: 41426
2007-08-26 05:13:54 +00:00
Chris Lattner
a01d898ff5 fix codegen of pre/post inc/dec of a pointer.
llvm-svn: 41425
2007-08-26 05:10:16 +00:00
Chris Lattner
c7f06ca780 tolerate unimplemented codegen better
llvm-svn: 41424
2007-08-26 05:06:40 +00:00
Chris Lattner
e7a160b37d int X[] isn't a VLA. This improves support for stdio.h on darwin.
llvm-svn: 41423
2007-08-26 05:02:07 +00:00
Neil Booth
cd995b0b4a Make some diags EXTENSION so they are errors with pedantic errors
llvm-svn: 41422
2007-08-26 05:01:15 +00:00
Chris Lattner
57c269b5d3 implement rudimentary union layout support.
llvm-svn: 41421
2007-08-26 04:50:19 +00:00
Chris Lattner
5e75e8bc71 Why didn't gcc catch this? :(
llvm-svn: 41420
2007-08-26 04:42:42 +00:00
Chris Lattner
881440f5d2 Don't make unknown builtins fatal errors yet.
llvm-svn: 41419
2007-08-26 04:17:05 +00:00
Chris Lattner
c5221650b3 remove a bunch of dead code
llvm-svn: 41418
2007-08-26 04:13:58 +00:00
Chris Lattner
71236d0485 fix a bug introduced by the recent childification of ForStmt.
llvm-svn: 41417
2007-08-26 04:11:23 +00:00
Chris Lattner
b677a9398a Make parse-ast-print print the storage class and inline
specifier of functions.

llvm-svn: 41416
2007-08-26 04:02:13 +00:00
Chris Lattner
1c72d77d01 null pointers don't get an extra newline.
llvm-svn: 41415
2007-08-26 03:53:29 +00:00
Chris Lattner
0fffcb5b28 implement codegen for complex literals.
llvm-svn: 41414
2007-08-26 03:51:12 +00:00
Chris Lattner
1c20a170c0 add a new ImaginaryLiteral AST node that is used to
represent imaginary literals:

float _Complex A;
void foo() {
  A = 1.0iF;
}

generates:

  (BinaryOperator 0x2305ec0 '_Complex float' '='
    (DeclRefExpr 0x2305e60 '_Complex float' Decl='A' 0x2305cf0)
    (ImaginaryLiteral 0x2305f40 '_Complex float'
      (FloatingLiteral 0x2305ea0 'float' 1.000000))))

llvm-svn: 41413
2007-08-26 03:42:43 +00:00
Chris Lattner
ed045421a8 1.0 is double, 1.0F is a float.
llvm-svn: 41412
2007-08-26 03:29:23 +00:00
Chris Lattner
f55ab18663 1) refactor some code.
2) Add support for lexing imaginary constants (a GCC extension):

t.c:5:10: warning: imaginary constants are an extension
  A = 1.0iF;
         ^

3) Make the 'invalid suffix' diagnostic pointer more accurate:

t.c:6:10: error: invalid suffix 'qF' on floating constant
  A = 1.0qF;
         ^

instead of:

t.c:6:10: error: invalid suffix 'qF' on floating constant
  A = 1.0qF;
      ^

llvm-svn: 41411
2007-08-26 01:58:14 +00:00
Chris Lattner
b620c34bb0 merge checkrelational and checkequality into CheckCompareOperands,
to merge duplicate code.

llvm-svn: 41410
2007-08-26 01:18:55 +00:00
Dale Johannesen
b6d2bec418 Revise per review comments.
llvm-svn: 41409
2007-08-26 01:18:27 +00:00
Chris Lattner
1895e58c84 Cases like this:
char *C;
  C != ((void*)0);

Should not warn about incompatible pointer types.  Also, make sure to
insert an implicit conversion even if the operand is null.

llvm-svn: 41408
2007-08-26 01:10:14 +00:00
Dale Johannesen
2cfcf70f82 Add APFloat interface to ConstantFPSDNode. Change
over uses in DAGCombiner.  Fix interfaces to work
with APFloats.

llvm-svn: 41407
2007-08-25 22:10:57 +00:00
Chris Lattner
1bc6fac5c6 new testcase
llvm-svn: 41406
2007-08-25 21:57:08 +00:00
Chris Lattner
27f00282e9 The new correct compound assignment operators exposed a bug in codegen.
llvm-svn: 41405
2007-08-25 21:56:20 +00:00
Steve Naroff
46c72915f4 Surpress the UsualUnaryConversions for compound assignment operators. This change
eliminates the possibility that the left hand expression is an ImplicitCastExpr.
As a result, I removed the check for ImplicitCastExpr in Expr::isLvalue().

This results in the following AST's...

[dylan:~/llvm/tools/clang] admin% cat fix.c

short x; void test4(char c) { 
  x += c; 
  x = x + c;
}
[dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang fix.c -parse-ast-dump
Read top-level variable decl: 'x'

void test4(char c)
(CompoundStmt 0x2605d30
  (CompoundAssignOperator 0x2605c40 'short' '+='
    (DeclRefExpr 0x2605c00 'short' Decl='x' 0x2605a80)
    (DeclRefExpr 0x2605c20 'char' Decl='c' 0x2605bc0))
  (BinaryOperator 0x2605d10 'short' '='
    (DeclRefExpr 0x2605c60 'short' Decl='x' 0x2605a80)
    (ImplicitCastExpr 0x2605d00 'short'
      (BinaryOperator 0x2605ce0 'int' '+'
        (ImplicitCastExpr 0x2605cc0 'int'
          (DeclRefExpr 0x2605c80 'short' Decl='x' 0x2605a80))
        (ImplicitCastExpr 0x2605cd0 'int'
          (DeclRefExpr 0x2605ca0 'char' Decl='c' 0x2605bc0))))))

llvm-svn: 41404
2007-08-25 19:54:59 +00:00
Chris Lattner
479ed3aab8 read and ignore the body of a namespace.
llvm-svn: 41403
2007-08-25 18:15:16 +00:00
Steve Naroff
e2562ff99d Change Expr::isLvalue() to properly deal with ImplicitCastExpr's.
This fixes the following bug...

t.c:1:31: error: expression is not assignable
short x; void foo(char c) { x += c; }

This case, among others are now captured in implicit-casts.c.

llvm-svn: 41402
2007-08-25 14:37:06 +00:00
Steve Naroff
aac9415bfb Give CXXBoolLiteralExpr a type (all expressions need a valid type).
This fixes the following:

******************** TEST 'Parser/cxx-bool.cpp' FAILED! ********************
Command:
clang -fsyntax-only Parser/cxx-bool.cpp
Output:
SemaExpr.cpp:731: failed assertion `!t.isNull() && "DefaultFunctionArrayConversion - missing type"'
Output/cxx-bool.cpp.out.script: line 1: 22697 Abort trap              clang -fsyntax-only Parser/cxx-bool.cpp

llvm-svn: 41401
2007-08-25 14:02:58 +00:00
Chris Lattner
a5235173bc refactor enough of the top-level parsing logic to parse and
ignore 'namespace foo {}'

llvm-svn: 41400
2007-08-25 06:57:03 +00:00
Chris Lattner
66b67efa61 C++ explicitly allows an empty source file.
llvm-svn: 41399
2007-08-25 05:47:03 +00:00
Chris Lattner
e33fbdb898 Fix the test/Sema/format-strings.c regression. This code should be refactored.
llvm-svn: 41398
2007-08-25 05:36:18 +00:00
Chris Lattner
6d5922fd66 reenable this.
llvm-svn: 41397
2007-08-25 05:31:19 +00:00
Chris Lattner
9449fd7bc3 Fix the regression on test/Sema/cfstring.c
llvm-svn: 41396
2007-08-25 05:30:33 +00:00
Chris Lattner
a206358bb6 test the parser only, not sema.
llvm-svn: 41395
2007-08-25 05:26:51 +00:00
Devang Patel
6114751544 Move exit condition and exit branch from exiting block into loop header and dominator info. This avoid execution of dead iteration. Loop is already filter in the beginning such that this change is safe.
llvm-svn: 41394
2007-08-25 02:39:24 +00:00
Chris Lattner
8692811955 Split the ASTNode out for compound assignments out from binary operators. Now
they show up in dumps etc.

llvm-svn: 41393
2007-08-25 02:00:02 +00:00
Chris Lattner
d8c9fc5ed8 fix off-by-one error
llvm-svn: 41392
2007-08-25 01:55:00 +00:00
Chris Lattner
e7d0864aed Fix clang -parse-ast-dump carbon.c
llvm-svn: 41391
2007-08-25 01:49:16 +00:00
Chris Lattner
4d15a0dbc0 rename sNames -> StmtClassInfo. Make lookups constant time.
llvm-svn: 41390
2007-08-25 01:42:24 +00:00
Devang Patel
c1ef32ef3d Constant split values needs upper bound and lower bound check, just like any other split value.
llvm-svn: 41389
2007-08-25 01:09:14 +00:00
Chris Lattner
2ed652f11d Allow target constants to be illegal types. The target should
know how to handle them.  This fixes 
test/CodeGen/Generic/asm-large-immediate.ll

llvm-svn: 41388
2007-08-25 01:00:22 +00:00
Devang Patel
4e63e1f5b5 While calculating upper loop bound for first loop and lower loop bound for second loop, take care of edge cases.
llvm-svn: 41387
2007-08-25 00:56:38 +00:00
Chris Lattner
dbfc4e4b07 Teach the dag scheduler to handle inline asm nodes with multi-value immediate operands.
llvm-svn: 41386
2007-08-25 00:53:07 +00:00
Bill Wendling
48597b4ff8 The personality function might need to be declared as:
.set  Lset0,___gxx_personality_v0-.
    .long Lset0

on some targets. Make it so!

llvm-svn: 41385
2007-08-25 00:51:55 +00:00
Chris Lattner
d8c9cb9182 rename isOperandValidForConstraint to LowerAsmOperandForConstraint,
changing the interface to allow for future changes.

llvm-svn: 41384
2007-08-25 00:47:38 +00:00
Dale Johannesen
45e608ad75 Comment out declaration of operator== (undefined).
llvm-svn: 41383
2007-08-25 00:40:41 +00:00
Neil Booth
02ca902a40 Test
llvm-svn: 41382
2007-08-25 00:36:22 +00:00
Neil Booth
2873711c40 Add self
llvm-svn: 41381
2007-08-25 00:31:24 +00:00
Tanya Lattner
ebd4e7ba2f Rename llvm-gcc4 to llvm-gcc.
llvm-svn: 41380
2007-08-24 23:23:23 +00:00
Steve Naroff
0c1c7ed5e6 This modest change insures ImplicitCastExpr's get generated for all "assignments",
while includes init decls, assignment exprs, call exprs, and return statements.

Here are a few examples with the correct AST's...

[dylan:~/llvm/tools/clang] admin% cat impcomp.c

_Complex double X;
void test2(int c) {
  X = 5;
}
void foo() {
  int i;
  double d = i;
  double _Complex a = 5;

  test2(a);
  a = 5;
  d = i;
}


[dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang impcomp.c -parse-ast-dump
Read top-level variable decl: 'X'

void test2(int c)
(CompoundStmt 0x2605ce0
  (BinaryOperator 0x2605cc0 '_Complex double' '='
    (DeclRefExpr 0x2605c70 '_Complex double' Decl='X' 0x2605af0)
    (ImplicitCastExpr 0x2605cb0 '_Complex double'
      (IntegerLiteral 0x2605c90 'int' 5))))


void foo()
(CompoundStmt 0x2606030
  (DeclStmt 0x2605bd0
    0x2605d90 "int i")
  (DeclStmt 0x2605e20
    0x2605de0 "double d =
      (ImplicitCastExpr 0x2605e10 'double'
        (DeclRefExpr 0x2605dc0 'int' Decl='i' 0x2605d90))")
  (DeclStmt 0x2605e90
    0x2605e50 "_Complex double a =
      (ImplicitCastExpr 0x2605e80 '_Complex double'
        (IntegerLiteral 0x2605e30 'int' 5))")
  (CallExpr 0x2605f20 'void'
    (ImplicitCastExpr 0x2605f00 'void (*)(int)'
      (DeclRefExpr 0x2605ea0 'void (int)' Decl='test2' 0x2605c00))
    (ImplicitCastExpr 0x2605f10 'int'
      (DeclRefExpr 0x2605ec0 '_Complex double' Decl='a' 0x2605e50)))
  (BinaryOperator 0x2605fa0 '_Complex double' '='
    (DeclRefExpr 0x2605f50 '_Complex double' Decl='a' 0x2605e50)
    (ImplicitCastExpr 0x2605f90 '_Complex double'
      (IntegerLiteral 0x2605f70 'int' 5)))
  (BinaryOperator 0x2606010 'double' '='
    (DeclRefExpr 0x2605fc0 'double' Decl='d' 0x2605de0)
    (ImplicitCastExpr 0x2606000 'double'
      (DeclRefExpr 0x2605fe0 'int' Decl='i' 0x2605d90))))

llvm-svn: 41379
2007-08-24 22:33:52 +00:00
Dale Johannesen
bdea32d812 Poison APFloat::operator==. Replace existing uses with bitwiseIsEqual.
This means backing out the preceding change to Constants.cpp, alas.

llvm-svn: 41378
2007-08-24 22:09:56 +00:00
Chris Lattner
74ed76bb0e remove a dead argument
llvm-svn: 41377
2007-08-24 21:41:10 +00:00
Chris Lattner
9f0ad96b3e implement codegen for real/imag. TODO: imag of non-complex.
llvm-svn: 41376
2007-08-24 21:20:17 +00:00
Chris Lattner
30b5dd0b79 Implement sema support for __real/__imag nodes.
llvm-svn: 41375
2007-08-24 21:16:53 +00:00
Ted Kremenek
066dd939c0 Added child_begin/child_end to all subclasses of Stmt in Stmt.h. All
concrete subclasses of Stmt are now required to implement 
child_begin/child_end.

llvm-svn: 41374
2007-08-24 21:09:09 +00:00
Chris Lattner
3d966d6556 Teach emit-llvm for scalars to properly handle compound assignment
operators in all their glory :)

llvm-svn: 41373
2007-08-24 21:00:35 +00:00
Dale Johannesen
7891d8edf0 Use APFloat internally for ConstantFPSDNode.
llvm-svn: 41372
2007-08-24 20:59:15 +00:00
Chris Lattner
0b490b0d38 sink clone() down the class hierarchy from CmpInst into ICmpInst/FCmpInst.
This eliminates a conditional on that path, and ensures ICmpInst/FCmpInst
both have an out-of-line virtual method to home the class.

llvm-svn: 41371
2007-08-24 20:48:18 +00:00
Ted Kremenek
485b13f397 Added ExprCXX.cpp
llvm-svn: 41370
2007-08-24 20:24:16 +00:00
Ted Kremenek
e3a0c14614 Implementation of child_begin/child_end for C++ expressions.
llvm-svn: 41369
2007-08-24 20:21:10 +00:00
Ted Kremenek
acc4903b3e Implemented child_begin/child_end for our current set of C++ expressions.
llvm-svn: 41368
2007-08-24 20:20:38 +00:00
Ted Kremenek
23702b6afb Finished adding child_begin/child_end to all subclasses of Stmt in Expr.h.
llvm-svn: 41366
2007-08-24 20:06:47 +00:00
Devang Patel
f5a01bf025 Fix regression that I caused yesterday night while adding logic to select appropriate split condition branch.
llvm-svn: 41365
2007-08-24 19:32:26 +00:00
Steve Naroff
be4c4d14c3 Surpress ImplicitCastExprs for compound assignment expressions. For compound assignments,
it is o.k. for the LHS and RHS to have different types. Converting the type can cause
errors like the one Chris noticed (below).

This change required a fair number of diffs (since there is a lot of shared code
between single and compound assignments). This makes the API's look a bit uglier,
however I couldn't think of a better way to do it (without duplicating code).

Fix the following (incorrect) error:

int A;
long long B;

void foo() {
  A /= B;
}

$ clang ~/scalar.c -emit-llvm
/Users/sabre/scalar.c:6:5: error: expression is not assignable
  A /= B;
  ~ ^

Now it works properly...

[dylan:~/llvm/tools/clang] admin% cat compound.c
int A;
long long B;

void foo() {
  A /= B;
}
[dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang compound.c -parse-ast-dump
Read top-level variable decl: 'A'
Read top-level variable decl: 'B'

void foo()
(CompoundStmt 0x2605c40
  (BinaryOperator 0x2605c20 'int' '/=' ComputeTy='long long'
    (DeclRefExpr 0x2605be0 'int' Decl='A' 0x2605a80)
    (DeclRefExpr 0x2605c00 'long long' Decl='B' 0x2605ab0)))

llvm-svn: 41364
2007-08-24 19:07:16 +00:00
Ted Kremenek
85e92ec6ff Began implementing "child iterator" interface for Stmts and Exprs. Each
subclass of Stmt will implement child_begin() and child_end(), which will
be used to iterate over all the children (subexpressions/substatements) of
a Stmt object.  This will provide for easy traversal over the AST, which
is useful for a variety of purposes.

None of the interfaces to subclasses of Stmt will be changed (other than
adding the child_begin and child_end methods).

The only caveat is that the implementation of subclasses of Stmt will require
colocating all substatements (subexpressions) in an array.  This is because
we define child_iterator as Stmt**.  All accessor methods to subexpressions
will need to be altered to reflect this new implementation.

This patch includes the typedefs for child_iterator, as well the implementation
for child_begin/child_end for the primary expressions and some postfix
expressions.

llvm-svn: 41363
2007-08-24 18:13:47 +00:00
Steve Naroff
9d13917cff Make sure we get extension diagnostics for GCC's complex extensions.
Now we emit the following when -pedantic-errors is enabled...

[dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang complex.c -pedantic-errors
complex.c:4:3: error: ISO C does not support '++'/'--' on complex integer types
  ++x;
  ^ ~
complex.c:9:7: error: ISO C does not support '~' for complex conjugation
  X = ~Y;
      ^
complex.c:10:7: error: ISO C does not support '~' for complex conjugation
  x = ~y;
      ^

llvm-svn: 41362
2007-08-24 17:20:07 +00:00
Chris Lattner
100198f3f7 print the computation type for compound assignment operators in dumps.
llvm-svn: 41361
2007-08-24 16:24:49 +00:00
Chris Lattner
a124f69c52 Disable EH generation until PPC works 100%.
llvm-svn: 41360
2007-08-24 16:00:15 +00:00
Chris Lattner
51883acec1 add a note
llvm-svn: 41359
2007-08-24 15:17:59 +00:00
Devang Patel
4bc9298f2a It is not safe to execute split condition's true branch first all the time. If split
condition predicate is GT or GE then execute false branch first.

llvm-svn: 41358
2007-08-24 06:17:19 +00:00
Devang Patel
4be56a5d12 Reject ICMP_NE as index split condition.
llvm-svn: 41357
2007-08-24 06:02:25 +00:00
Devang Patel
5e46fac6de Tightenup loop filter.
llvm-svn: 41356
2007-08-24 05:36:56 +00:00
Chris Lattner
2da04b3322 completely refactor codegen of scalar expressions out into its own CGExprScalar.cpp file.
This patch temporarily breaks compound assignment operators, but greatly simplifies many
things.

llvm-svn: 41355
2007-08-24 05:35:26 +00:00
Devang Patel
504dc0aaed Remove incomplete cost analysis.
llvm-svn: 41354
2007-08-24 05:21:13 +00:00
Dale Johannesen
918c33c67a Revised per review feedback from previous patch.
llvm-svn: 41353
2007-08-24 05:08:11 +00:00
Chris Lattner
3da18eb22a silence some warnings in an optimized build.
llvm-svn: 41352
2007-08-24 03:02:34 +00:00
Chris Lattner
11e0de5193 rename two files.
llvm-svn: 41350
2007-08-24 02:22:53 +00:00
Chris Lattner
db0d60d5b5 implement codegen of builtin_choose_expr for complex.
llvm-svn: 41349
2007-08-24 02:18:47 +00:00
Dale Johannesen
a719a60609 Change internal representation of ConstantFP to use APFloat.
Interface to rest of the compiler unchanged, as yet.

llvm-svn: 41348
2007-08-24 00:56:33 +00:00
Chris Lattner
8ad56707ea stub out complex -> bool conversion.
llvm-svn: 41347
2007-08-24 00:01:20 +00:00
Chris Lattner
afd455c0cf make this harder
llvm-svn: 41346
2007-08-23 23:49:47 +00:00
Chris Lattner
0b984995b7 implement complex subtraction
llvm-svn: 41345
2007-08-23 23:46:33 +00:00
Chris Lattner
08b15df766 implement passing of complex and aggregates through call args.
llvm-svn: 41344
2007-08-23 23:43:33 +00:00
Chris Lattner
247ef955bc in the truncation case, make sure to propagate the sign correctly, this
fixes an assertion on:
void f (int z) { switch (z) { case ~0ULL: case -1: return; } }

testcase from Neil.

llvm-svn: 41343
2007-08-23 22:08:35 +00:00
Steve Naroff
8ddb23a6c5 Support '~' for complex conjugation. This is a GCC extension.
This following now compiles without error...

_Complex unsigned X, Y;
_Complex double x, y;
void test2(int c) {
  X = ~Y;
  x = ~y;
}

llvm-svn: 41341
2007-08-23 22:06:40 +00:00
Chris Lattner
7b939cf606 fix a bug where we would type 0ULL as unsigned instead of unsigned long long
llvm-svn: 41340
2007-08-23 21:58:08 +00:00
Chris Lattner
e5b60445e7 Pretty print as:
"case sizeof x:"
instead of:
  "case sizeofx:"

llvm-svn: 41339
2007-08-23 21:46:40 +00:00
Chris Lattner
9568880c3e sizeof(x) doesn't require x to be an i-c-e for sizeof to be an i-c-e. Thanks to Neil for pointing this out.
llvm-svn: 41338
2007-08-23 21:42:50 +00:00
Ted Kremenek
9aae513318 No functionality change. Moved visitor methods for CFGBuilder out-of-line
from the class declaration.  This enables a nice view of what visitor methods
have been implemented.

llvm-svn: 41337
2007-08-23 21:42:29 +00:00
Chris Lattner
1aaab49a3e add support for codegen of calls returning complex.
llvm-svn: 41336
2007-08-23 21:38:16 +00:00
Steve Naroff
9e1e551c01 Remove a FIXME, allowing ++/-- on Complex types (a GCC extension).
Now, the following test case succeeds...

_Complex double x, y;
void test2(int c) {
  ++x;
}

llvm-svn: 41335
2007-08-23 21:37:33 +00:00
Ted Kremenek
04cca64f8c moved CFGBuilder into an anonymous namespace
llvm-svn: 41334
2007-08-23 21:26:19 +00:00
Steve Naroff
4e1f80d255 - Cleanup "hack" comment and fix typos.
- Use getLang().ObjC2 when appropriate.

llvm-svn: 41333
2007-08-23 19:56:30 +00:00
Ted Kremenek
879d8e1f77 Added support for switch, default, and case statements in source-level CFGs.
llvm-svn: 41332
2007-08-23 18:43:24 +00:00
Chris Lattner
67998451c7 finish off switch case overlap checking, adding support for
verifying case ranges.

llvm-svn: 41331
2007-08-23 18:29:20 +00:00
Steve Naroff
7c34817902 Add helper functions Token::isObjCAtKeyword() and Token::getObjCKeywordID().
Convert all clients to the new cleaner, more robust API.

llvm-svn: 41330
2007-08-23 18:16:40 +00:00
Ted Kremenek
13fdfe99cd Refactored "getSubStmt" and "SubStmt" from the CaseStmt and DefaultStmt
class to their common parent class SwitchCase.

llvm-svn: 41329
2007-08-23 18:04:38 +00:00
Chris Lattner
f81460f99c detect and diagnose empty case ranges:
switch.c:16:8: warning: empty case range specified
  case 100 ... 99: ;  // expected-warning {{empty case range}}
       ^~~~~~~~~~

llvm-svn: 41328
2007-08-23 17:48:14 +00:00
Ted Kremenek
9ee3bcf81c For gotos, breaks, and continues where we cannot find a target successor
block (because we are creating a CFG from an incomplete AST) we now
(gracefully) have a block ending with such statements not have any successors
instead of firing an assertion.

llvm-svn: 41327
2007-08-23 17:29:58 +00:00
Duncan Sands
a0f12c5493 Fix this testcase: there are two matches for
llvm.cttz.i64 because of the declaration of
the intrinsic.  Also, emit-llvm is automatic
and doesn't need to be specified.

llvm-svn: 41326
2007-08-23 17:22:50 +00:00
Ted Kremenek
9443f5b1e0 Added support for do..while loops in CFG construction.
llvm-svn: 41325
2007-08-23 17:15:32 +00:00
Ted Kremenek
07b5b52cd0 Modified CFG to have explicit "Exit" pointer for exit block. This should
have been committed with my previous patch.

llvm-svn: 41324
2007-08-23 16:51:52 +00:00
Ted Kremenek
889073f785 Renamed "CFG::BuildCFG" to "CFG::buildCFG" to have more consistent capitalization.
Added explicit "Exit" CFGBlock pointer to the source-level CFG.

Changed the construction of blocks with "return" statements to have the
return statement appear both as a statement in the list of statements for
a CFGBlock as well as appear as a control-flow terminator.  Also removed
the implicit linearization of "return" so that the return value and the
return statement did not appear as separate statements in the block.

llvm-svn: 41323
2007-08-23 16:51:22 +00:00
Anders Carlsson
cb8f832c26 As suggested by Chris, use MatchRHSPunctuation instead of manually looking for a right parenthesis when parsing @encode() and @protocol().
llvm-svn: 41321
2007-08-23 15:31:37 +00:00
Anders Carlsson
e01493d47b Parse ObjC @protocol expressions.
llvm-svn: 41320
2007-08-23 15:25:28 +00:00
Chris Lattner
33800d1428 add some notes on really poor codegen.
llvm-svn: 41319
2007-08-23 15:22:07 +00:00
Chris Lattner
92c6a65d4e new example
llvm-svn: 41318
2007-08-23 15:16:03 +00:00
Chris Lattner
fcb920d32b fix a segfault in cases where there are no cases.
llvm-svn: 41317
2007-08-23 14:29:07 +00:00
Anton Korobeynikov
97cdac8d19 Perform correct codegen for eh_dwarf_cfa intrinsic.
llvm-svn: 41316
2007-08-23 07:21:06 +00:00
Chris Lattner
10cb5e520f report duplicate case values. TODO: report duplicate/overlapping ranges.
llvm-svn: 41315
2007-08-23 06:23:56 +00:00
Chris Lattner
725c6a4279 this test is passing, though it is generating bogus code at the moment.
llvm-svn: 41314
2007-08-23 05:47:53 +00:00
Chris Lattner
fc1c44ac7d start checking case values of switch stmts more closely. Emit overflow
warnings when converting case values to the expression type.

llvm-svn: 41313
2007-08-23 05:46:52 +00:00
Chris Lattner
53e5a38684 Update to match the API from LLVM mainline.
llvm-svn: 41312
2007-08-23 05:22:10 +00:00
Chris Lattner
06eca7a4ca default this to radix 10 like the toString(Un)Signed methods.
llvm-svn: 41311
2007-08-23 05:21:48 +00:00
Chris Lattner
d2d32bae97 Avoid hiding issues.
llvm-svn: 41310
2007-08-23 05:20:48 +00:00
Chris Lattner
b0f158cfdf rename APInt::toString -> toStringUnsigned for symmetry with toStringSigned()
Add an APSInt::toString() method.

llvm-svn: 41309
2007-08-23 05:15:32 +00:00
Chris Lattner
7d75c0d9b6 run .m files as tests
llvm-svn: 41308
2007-08-23 01:09:45 +00:00
Chris Lattner
c4e7a66036 Test that cocoa parses with -parse-noop. In the future
(when ready) this test should change to test -fsyntax-only.

llvm-svn: 41307
2007-08-23 01:08:54 +00:00
Duncan Sands
f2bcd37083 Implement review feedback on trampoline documentation.
llvm-svn: 41304
2007-08-22 23:39:54 +00:00
Steve Naroff
7e901fdf86 With this commit, we now successfully parse "Cocoa.h"!
llvm-svn: 41303
2007-08-22 23:18:22 +00:00
Ted Kremenek
0a6ec03884 Fixed bugs in source-level CFG construction for "for" and "while" loops
where break targets weren't being set and restored properly.  Also
cleaned up CFGBuilder code for "for" and "while" to use less reliance
on globals and to have clearer semantics.

llvm-svn: 41302
2007-08-22 22:35:28 +00:00
Steve Naroff
c6e96bfef3 Fix a misleading comment...
llvm-svn: 41301
2007-08-22 22:19:13 +00:00
Steve Naroff
0b6a01a449 Add support for parsing protocols.
Now we can parse quite a bit of "Foundation.h" (a couple bugs remain).

llvm-svn: 41300
2007-08-22 22:17:26 +00:00
Ted Kremenek
e1810dee74 Added support for "break" statements in source-level ASTs.
Some comment cleanups.

llvm-svn: 41299
2007-08-22 21:51:58 +00:00
Ted Kremenek
1aebee0a4d Added support for "continue" statements in source-level CFGs
Cleaned up some code for "for" and "while" loops by making their
implementations more symmetrical (and added a few comments).

llvm-svn: 41298
2007-08-22 21:36:54 +00:00
Devang Patel
887db2d832 Remove dead code.
llvm-svn: 41295
2007-08-22 21:07:41 +00:00
Ted Kremenek
1c65be13cc Added preliminary support for while loops within source-level CFGs.
Adjusted printing of source-level CFGs to account that the entry block
may not be the first block in the list of blocks a CFG object maintains.

llvm-svn: 41294
2007-08-22 21:05:42 +00:00
Ted Kremenek
88dea224c1 Added explicit pointer within class CFG to the Entry block.
Before we assumed that the first block in the list of blocks was the entry
block, but this has posed hurdles during CFG construction.

llvm-svn: 41293
2007-08-22 21:03:50 +00:00
Devang Patel
6f4f23320d Fix typo.
llvm-svn: 41292
2007-08-22 20:55:18 +00:00
Andrew Lenharth
544fdd27fb update test to check that codegen works with llvm.used in llvm.metadata section
llvm-svn: 41289
2007-08-22 19:36:31 +00:00
Devang Patel
31206b56d5 Cosmetic change
"True Loop" and "False Loop" naming terminology to refer two loops
after loop cloning is confusing. Instead just use A_Loop and B_Loop.

llvm-svn: 41287
2007-08-22 19:33:29 +00:00
Andrew Lenharth
beb80a9832 move this check. ppc outputs .no_dead_strip properly
llvm-svn: 41286
2007-08-22 19:33:11 +00:00
Bill Wendling
862afea91e Add the PCSymbol for Darwin x86 platforms.
llvm-svn: 41284
2007-08-22 18:44:05 +00:00
Steve Naroff
f1bc45b1d1 Finish up method prototype parsing.
Next step...starting installing class names into the type namespace (so we can start parsing Cocoa headers).

llvm-svn: 41283
2007-08-22 18:35:33 +00:00
Devang Patel
90da534987 Refactor loop condition check in a separate function.
llvm-svn: 41282
2007-08-22 18:27:01 +00:00
Ted Kremenek
7e776b1d9c Added CFG support for: for loops
In CFG dumper, refactored the code to print block terminators into a
StmtVisitor.

Added the method "FinishBlock" to CFGBuilder to do the reversal of statements
in a block instead of calling "reverseStmts" for a block directly.  This
was necessary to fix a bug in how blocks with labels were being processed
(some cases would cause the statements to be reversed twice).  FinishBlock
detects blocks that start with labels and doesn't do a second reversal.

llvm-svn: 41281
2007-08-22 18:22:34 +00:00
Devang Patel
cd8beb7645 Fix thinko.
Starting value of second loop's induction variable can not be lower 
then starting value of original loop's induction variable.

llvm-svn: 41280
2007-08-22 18:07:47 +00:00
Steve Naroff
99264b4b04 Add support for parsing method prototypes (and other stuff required by @interface).
Still need to finish Parser::ParseObjCMethodDecl(). Before I do, I need to do a minor
refactoring of ParseDeclarationOrFunctionDefinition(), to disallow function definitions.
At the moment, @inteface allows function defs (which is incorrect).

llvm-svn: 41275
2007-08-22 16:35:03 +00:00
Ted Kremenek
de979aeff3 Changed data structure recording the CFG blocks that need to be backpatched
to labeled blocks from a list to a vector.

llvm-svn: 41274
2007-08-22 15:40:58 +00:00
Anders Carlsson
c5a81ebb1f Parse @encode expressions.
llvm-svn: 41273
2007-08-22 15:14:15 +00:00
Bill Wendling
9bbecaeb55 Testcase for llvm.c* intrinsic failures.
llvm-svn: 41268
2007-08-22 07:26:30 +00:00
Chris Lattner
f265939ebc update todo markers
llvm-svn: 41267
2007-08-22 06:06:56 +00:00
Duncan Sands
d9a21103dc Test handling of complex constants as lvalues.
llvm-svn: 41266
2007-08-22 05:58:22 +00:00
Chris Lattner
8f44d20d69 optimize scope push/pop to avoid work in the common case.
llvm-svn: 41265
2007-08-22 05:33:11 +00:00
Chris Lattner
8fb2625b40 Fix the scoping issue Neil pointed out for the rest of
the selection statements and iteration statements.  Add
spec citations.

llvm-svn: 41264
2007-08-22 05:28:50 +00:00
Chris Lattner
37e54f454a Fix a nasty C99 scope issue that Neil pointed out (for ifs)
This fixes test/Parser/control-scope.c

llvm-svn: 41263
2007-08-22 05:16:28 +00:00
Ted Kremenek
8a63218855 Added CFG support for gotos and labels.
Modified CFG so that getEntry(), getExit(), front() and back() return
CFGBlock& instead of CFGBlock*.

llvm-svn: 41258
2007-08-21 23:26:17 +00:00
Anton Korobeynikov
3fc4a9f78a Dror GCCLibraries: they are obsolete since 2.0 release. This also reduces number of licenses used in LLVM.
llvm-svn: 41257
2007-08-21 22:40:44 +00:00
Chris Lattner
cb1ffbc12e add some fixme's, implement complex struct members.
llvm-svn: 41256
2007-08-21 22:33:41 +00:00
Chris Lattner
d34c999b67 implement codegen for --/++
llvm-svn: 41255
2007-08-21 22:25:29 +00:00
Ted Kremenek
1b8ac851d1 Converted CFGBuilder to use StmtVisitor instead of doing a switch
dispatch to walk the AST.

llvm-svn: 41254
2007-08-21 22:06:14 +00:00
Chris Lattner
ce8f75bd5b add cfg.h/cfg.cpp to the xcode project at Ted's request.
llvm-svn: 41253
2007-08-21 21:44:59 +00:00
Ted Kremenek
4aa1e8b3b8 Added CFG infrastructure (CFG.cpp and CFG.h) for clang ASTs.
Added builder code to translate ASTs to CFGs.  This currently supports
if, return, and non-control flow statements.

Added pretty-printer to debug CFGs.

Added a "-dump-cfg" option to the clang driver to dump CFGs for code
sent through the frontend.

llvm-svn: 41252
2007-08-21 21:42:03 +00:00
Steve Naroff
00433d3d37 Implement parsing for objc instance variables.
Next step, method...

llvm-svn: 41251
2007-08-21 21:17:12 +00:00
Devang Patel
a12000d572 Rename bunch of variables.
llvm-svn: 41250
2007-08-21 21:12:02 +00:00
Chris Lattner
875a519ca6 implement __extension__ and unary~ for complex.
llvm-svn: 41249
2007-08-21 20:41:44 +00:00
Ted Kremenek
76c4ac2363 Added reverse iterators for the body of CompountStmt. These are useful for
CFG construction (among other potential uses).

llvm-svn: 41248
2007-08-21 20:29:50 +00:00
Chris Lattner
ad4569eacb implement codegen for complex unary +/-
llvm-svn: 41247
2007-08-21 20:08:23 +00:00
Devang Patel
f98db5e62a Preserve LCSSA.
llvm-svn: 41246
2007-08-21 19:47:46 +00:00
Anders Carlsson
77621351dd Don't remove the grammar construct, just the TODO.
llvm-svn: 41245
2007-08-21 19:18:49 +00:00
Chris Lattner
d614e7a553 minor nicities.
llvm-svn: 41244
2007-08-21 18:51:13 +00:00
Chris Lattner
43ba25187b Tweak error recovery for missing semicolon after decl. For this:
void foo() {
  int x
  if (x) {
  }
}

We now emit:

a.c:5:3: error: parse error
  if (x) {
  ^
1 diagnostic generated.

instead of:

a.c:5:3: error: parse error
  if (x) {
  ^
a.c:9:1: error: expected '}'

^
2 diagnostics generated.

llvm-svn: 41243
2007-08-21 18:36:18 +00:00
Chris Lattner
592d757c92 add unary operator support to the stmtvisitor
llvm-svn: 41242
2007-08-21 18:18:25 +00:00
Anders Carlsson
4f803dc6d3 Remove objc-string-literal since it's been implemented now.
llvm-svn: 41241
2007-08-21 18:14:25 +00:00
Chris Lattner
a0733a777b implement support for complex subscripts.
llvm-svn: 41240
2007-08-21 18:03:58 +00:00
Chris Lattner
e0e54120b2 allow support for volatile lvalues even though it's still not right.
llvm-svn: 41239
2007-08-21 18:02:02 +00:00
Anders Carlsson
76f4a902d7 Implement parsing and code generation of Objective-C string literals.
llvm-svn: 41238
2007-08-21 17:43:55 +00:00
Chris Lattner
2dc2af3515 add a new builder ivar.
llvm-svn: 41237
2007-08-21 17:39:38 +00:00
Chris Lattner
4b0e7873f6 move EmitLoadOfComplex/EmitStoreOfComplex into ComplexExprEmitter.
llvm-svn: 41236
2007-08-21 17:28:34 +00:00
Chris Lattner
3cf417b369 implement comma for complex.
llvm-svn: 41235
2007-08-21 17:15:50 +00:00
Chris Lattner
64be48fede and/or/xor are invalid for complex, even integer complex apparently.
llvm-svn: 41234
2007-08-21 17:12:50 +00:00
Chris Lattner
bf1bd0dcc7 simplify code slightly
llvm-svn: 41233
2007-08-21 17:03:38 +00:00
Chris Lattner
755a5a9933 add sema support for complex integer types
llvm-svn: 41232
2007-08-21 17:02:28 +00:00
Chris Lattner
96d7256d62 reimplement support for complex comparisons, add support for integer complex compares.
llvm-svn: 41231
2007-08-21 16:57:55 +00:00
Devang Patel
f5e520d892 Use SmallVector.
llvm-svn: 41230
2007-08-21 16:54:51 +00:00
Chris Lattner
f78c30f75d add getAsComplexType() for consistency
llvm-svn: 41229
2007-08-21 16:54:08 +00:00
Devang Patel
a9e7c4f827 No need to hardcode SmallVector size.
llvm-svn: 41228
2007-08-21 16:39:43 +00:00
Chris Lattner
18444b9660 Add the comparisons and logical binops to the visitor.
llvm-svn: 41227
2007-08-21 16:38:51 +00:00
Chris Lattner
6ce75dff4d reimplement complex mul
llvm-svn: 41226
2007-08-21 16:34:16 +00:00
Bruno Cardoso Lopes
b10580ac1e InlineAsm asm support for integer registers added
llvm-svn: 41225
2007-08-21 16:09:25 +00:00
Bruno Cardoso Lopes
d4b9945a21 Instruction Itinerary attribution fixed
llvm-svn: 41224
2007-08-21 16:06:45 +00:00
David Greene
80defa5a62 Doxygenize comments.
llvm-svn: 41222
2007-08-21 14:57:58 +00:00
Chris Lattner
85e9b4336a add a testcase I forgot to check in long ago
llvm-svn: 41219
2007-08-21 05:56:30 +00:00
Chris Lattner
b01cc9d49a update some comments.
llvm-svn: 41218
2007-08-21 05:54:53 +00:00
Chris Lattner
cbfc73b26c Split complex arithmetic codegen out from aggregate codegen.
This means that we get rid of tons of intermediate allocas.  For
example:

void foo(double _Complex a, double _Complex b) {
   a = b+a+a;
}

this used to have 4 temporary allocas, now it has zero of them.
This also simplifies the individual visitor methods because they
now can all operate on real/imag pairs instead of having to 
load/store all over the place.

llvm-svn: 41217
2007-08-21 05:54:00 +00:00
Chris Lattner
926792f726 simplify this a bit to remove indirection
llvm-svn: 41216
2007-08-21 05:02:10 +00:00
Chris Lattner
835635d85a reimplement addition of complex numbers.
llvm-svn: 41215
2007-08-21 04:59:27 +00:00
Chris Lattner
cd9fb2401d Add the ability to visit binary operators without having to
match on binop then explicitly switching again.

llvm-svn: 41214
2007-08-21 04:43:17 +00:00
Chris Lattner
4758b40df0 switch aggregate expr codegen to use a visitor to localize most of the nasty
details in its own file.

llvm-svn: 41213
2007-08-21 04:25:47 +00:00
Chris Lattner
ae963ae217 Now that the visitor is defined in one place, it is nice and easy to allow clients
to have visitors that return non-void.

llvm-svn: 41212
2007-08-21 04:06:29 +00:00
Chris Lattner
62249a6299 Switch StmtVisitor from using dynamic to static dispatch. This makes it
significantly faster and actually reduces the amount of code in the system.
This also allows for future visitor changes.

llvm-svn: 41211
2007-08-21 04:04:25 +00:00
Chris Lattner
91b9a4c8c3 we now correctly emit:
unused-expr.c:8:6: warning: comparison of distinct pointer types ('int volatile *' and 'int *')
  VP == P;
  ~~ ^  ~

llvm-svn: 41210
2007-08-21 01:19:46 +00:00
Chris Lattner
913849b5df Fix potentially N^2 behavior handling arrays with many of the
same value which get RAUW'd.  This speeds up reading the .bc
file in PR1616 from 852s to 0.19s on my G5 with a debug build.

llvm-svn: 41209
2007-08-21 00:55:23 +00:00
Anton Korobeynikov
f335679b52 Use only 1 knob to enable exceptions on Darwin :).
llvm-svn: 41208
2007-08-21 00:31:30 +00:00
Devang Patel
b5933bbbd5 Use SmallVector instead of std::vector.
llvm-svn: 41207
2007-08-21 00:31:24 +00:00
Anders Carlsson
b04ea61b79 Implement code generation for constant CFStrings.
llvm-svn: 41206
2007-08-21 00:21:21 +00:00
Chris Lattner
8e5b2c27a3 simplify code, improve a comment.
llvm-svn: 41205
2007-08-21 00:21:07 +00:00
Devang Patel
8f4228d619 s/ExitBlock/ExitingBlock/g
llvm-svn: 41204
2007-08-20 23:51:18 +00:00
Chris Lattner
fe02c1f97f initial checkin of Neil's APFloat work.
llvm-svn: 41203
2007-08-20 22:49:32 +00:00
Chris Lattner
76ba849ed3 Fix array->pointer decay. This unbreaks test/CodeGen/array.c
llvm-svn: 41202
2007-08-20 22:37:10 +00:00
Steve Naroff
9717080968 Added Parser::ParseStructDeclaration() as a result of refactoring Parser::ParseStructUnionBody().
Motivation: Objective-C can now share this rule. It also makes Parser::ParseStructUnionBody()
a bit smaller/cleaner..

llvm-svn: 41201
2007-08-20 22:28:22 +00:00
Steve Naroff
1eb1ad6c36 Start parsing ObjC classes/categories!
Next step, refactor Parser::ParseStructUnionBody() so that struct declarations can
be shared with Objective-C (for declaring instance variables).

llvm-svn: 41200
2007-08-20 21:31:48 +00:00
Chris Lattner
ad481cd7f6 clarify precedence, no functionality change.
llvm-svn: 41199
2007-08-20 21:31:08 +00:00
Chris Lattner
dbdeb2f7ed add reverse iterators to smallvector
llvm-svn: 41198
2007-08-20 21:22:48 +00:00
Anton Korobeynikov
5849a625ff - Use correct header for SCEV inside LoopPass.cpp
- Move SCEVExpander::expand() out-of-line workarounding possible toolchain bug

llvm-svn: 41197
2007-08-20 21:17:26 +00:00
Devang Patel
49c4f9a889 Replace indunction variable with split value in loop body.
This fixes art miscompile.

llvm-svn: 41195
2007-08-20 20:49:01 +00:00
Devang Patel
c2e2d15f45 Do not split loops rejected by processOneIterationLoop().
llvm-svn: 41194
2007-08-20 20:24:15 +00:00
David Greene
8766c16840 Add FilteredPassNameParser along with PassArgFilter to filter passes
based on their Arg members.

llvm-svn: 41192
2007-08-20 19:54:01 +00:00
Dan Gohman
54a187ea8b Minor cleanups to reduce some spurious differences between different
scheduler implementations.

llvm-svn: 41191
2007-08-20 19:28:38 +00:00
Dan Gohman
f63668e655 Add Type::isIntOrIntVector, like Type::isFPOrFPVector.
llvm-svn: 41190
2007-08-20 19:25:59 +00:00
Dan Gohman
3a0714836e When Intrinsic::getName is constructing names for overloaded intrinsics,
use the ValueType name instead of the llvm type name, to match what the
verifier expects. For integers these are the same, but for floating-point
values the intrinsics use f32/f64 instead of float/double.

llvm-svn: 41189
2007-08-20 19:23:34 +00:00
Anders Carlsson
1d8e521022 Add support for code generation of builtins.
llvm-svn: 41188
2007-08-20 18:05:56 +00:00
Duncan Sands
28e82ccd09 Fix this test for gcc-4.2.
llvm-svn: 41187
2007-08-20 17:14:02 +00:00
Ted Kremenek
9fcbb10e86 Added test cases for the return-stack-address checker to test support
for the following C++ casts: static_cast, reinterpret_cast, and const_cast.

llvm-svn: 41181
2007-08-20 16:28:05 +00:00
Ted Kremenek
c81614d5d1 Modified ArraySubscriptExpr to have accessors getLHS and getRHS in addition
to getBase and getIdx.  getBase and getIdx now return a "normalized" view
of the expression (e.g., always "A[4]" instead of possibly "4[A]").  getLHS
and getRHS return the expressions with syntactic fidelity to the original
source code.

Also modified client code of ArraySubscriptExpr, including the AST dumper
and pretty printer, the return-stack value checker, and the LLVM code
generator.

llvm-svn: 41180
2007-08-20 16:18:38 +00:00
Rafael Espindola
9c3d20d823 Partial implementation of calling functions with byval arguments:
*) The needed information is propagated to the DAG
 *) The X86-64 backend detects it and aborts

llvm-svn: 41179
2007-08-20 15:18:24 +00:00
Chris Lattner
78846b69ae add a note
llvm-svn: 41178
2007-08-20 02:14:33 +00:00
Chris Lattner
5946664ef2 update the xcode project file, patch by Gordon Henriksen
llvm-svn: 41175
2007-08-20 00:56:12 +00:00
Chris Lattner
1cc79985cd Fix PR1611 - Visibility should be ignored for a declaration
when a definition's visibility is different.  Likewise, the
visibility of two declarations mismatching is not an error.

llvm-svn: 41174
2007-08-19 22:22:54 +00:00
Chris Lattner
10f03a644a simplify code and print visibility for declarations.
llvm-svn: 41173
2007-08-19 22:15:26 +00:00
Chris Lattner
855ab6591f add mips target to builder. I'd appreciate it if someone with
the right version of autoconf could regenerate the configure script.

llvm-svn: 41172
2007-08-19 20:45:10 +00:00
Nick Lewycky
bfa9499a88 Oops, remove assert that wasn't meant to be committed.
llvm-svn: 41170
2007-08-18 23:21:28 +00:00
Nick Lewycky
5b5b1ab9e0 Never insert duplicate edges.
llvm-svn: 41169
2007-08-18 23:18:03 +00:00
Nick Lewycky
a0d49dac26 Typo.
llvm-svn: 41168
2007-08-18 15:08:56 +00:00
Nick Lewycky
5dccc83b4b Simplify.
llvm-svn: 41167
2007-08-18 14:46:55 +00:00
Chris Lattner
e2de908a28 Compute the argument list as lazily as possible. This ensures that clients
that don't use it don't have to pay the memory cost for the arguments.  This
allows us to avoid creating Argument nodes for many prototypes and for clients
who lazily deserialize code from a bytecode file.

llvm-svn: 41166
2007-08-18 06:14:52 +00:00
Chris Lattner
45ffa21cb3 use a nicer accessor.
llvm-svn: 41165
2007-08-18 06:13:19 +00:00
Evan Cheng
595401079e Test dag xform: Fold C ? 0 : 1 to ~C or zext(~C) or trunc(~C)
llvm-svn: 41164
2007-08-18 06:11:57 +00:00
Evan Cheng
f5a23abf37 Fold C ? 0 : 1 to ~C or zext(~C) or trunc(~C) depending the types.
llvm-svn: 41163
2007-08-18 05:57:05 +00:00
Ted Kremenek
8b8215a048 Fixed bug in VarDecl::hasAutoStorage: function parameters implicitly have
auto storage, but this routine would incorrectly return false.

llvm-svn: 41162
2007-08-18 04:59:12 +00:00
Bruno Cardoso Lopes
9fbef51078 MipsHi now has ouput flag
MipsAdd SDNode created to add support to an Add opcode which supports input flag
Added an instruction itinerary to all instruction classes
Added branches with zero cond codes
Now call clobbers all non-callee saved registers
Call w/ register support added
Added DelaySlot to branch and load instructions
Added patterns to handle all setcc, brcond/setcc and MipsAdd instructions

llvm-svn: 41161
2007-08-18 02:37:46 +00:00
Bruno Cardoso Lopes
eabe61b080 Fixed stack frame addressing bug
llvm-svn: 41160
2007-08-18 02:19:09 +00:00
Bruno Cardoso Lopes
f3c55807f2 support for Schedule included on Mips.td
llvm-svn: 41159
2007-08-18 02:18:07 +00:00
Bruno Cardoso Lopes
4bd7f4db9f Removed LowerRETURADDR, fixed small bug into LowerRET, LowerGlobalAddress
fixed to generate instructions (add, lui) glued!

llvm-svn: 41158
2007-08-18 02:16:30 +00:00
Bruno Cardoso Lopes
833a1f9b55 Couple of small changes. Delay Slot handle header declared.
Newline added after macros at function init on generated asm!

llvm-svn: 41157
2007-08-18 02:05:24 +00:00
Bruno Cardoso Lopes
5792189590 Added InstrItinClass support for instruction formats
llvm-svn: 41156
2007-08-18 02:01:28 +00:00
Bruno Cardoso Lopes
0c530638c7 Branch Analysis and InsertNoop inserted into header files
llvm-svn: 41155
2007-08-18 01:59:45 +00:00
Bruno Cardoso Lopes
a746512fc5 createMipsDelaySlotFillerPass added to mips codegen runtime
llvm-svn: 41154
2007-08-18 01:58:15 +00:00
Bruno Cardoso Lopes
7b616f5742 Added Branch Analysis support
Added InsertNoop support

llvm-svn: 41153
2007-08-18 01:56:48 +00:00
Bruno Cardoso Lopes
e8d1c52cd4 LowerRETURNADDR removed since it was wrong and does not have utility yet!
MipsAdd opcode added

llvm-svn: 41152
2007-08-18 01:54:09 +00:00
Bruno Cardoso Lopes
87beec9afb InstrItineraryData support on added.
Added Mips3 ISA feature (needed when supporting R4000 machines)

llvm-svn: 41151
2007-08-18 01:52:27 +00:00
Bruno Cardoso Lopes
0b97ce752c A Pass to insert Nops on intructions with DelaySlot
llvm-svn: 41150
2007-08-18 01:50:47 +00:00
Bruno Cardoso Lopes
415ded5d5a Mips generic fallback instruction schedule support!
llvm-svn: 41149
2007-08-18 01:46:44 +00:00
Devang Patel
1282b6e181 Avoid spliting loops where two split condition branches are not independent.
llvm-svn: 41148
2007-08-18 00:00:32 +00:00
Ted Kremenek
cb173fc7d0 Added extra test case to check proper handling of archaic array indexing: 4[A]
llvm-svn: 41147
2007-08-17 22:17:23 +00:00
Devang Patel
cec2ad95f4 Add loop index split tests.
llvm-svn: 41146
2007-08-17 22:02:15 +00:00
Anders Carlsson
f087c0c1c6 Add preliminary support for converting struct types.
llvm-svn: 41145
2007-08-17 22:00:32 +00:00
Devang Patel
d1fcfcc76c When one branch of condition is eliminated then head of the other
branch is not necessary immediate dominators of merge blcok in all cases.

llvm-svn: 41144
2007-08-17 21:59:16 +00:00
Evan Cheng
cb6d65e1bf Avoid issue on 64-bit hosts.
llvm-svn: 41143
2007-08-17 18:02:22 +00:00
Chris Lattner
7a5e8e6502 improve iplist comments. Switch iplist from allocating its sentinal object (for
end()) eagerly to allocating it lazily.  This saves a lot of memory for JIT applications
that read a module but don't materialize most of the functions (e.g. 62K for 252.eon).

llvm-svn: 41142
2007-08-17 16:49:19 +00:00
Ted Kremenek
cff94fa201 Added extra semantic checking to do basic detection of
"return of stack addresses."  ParseReturnStmt now calls CheckReturnStackAddr
to determine if the expression in the return statement evaluates to an
address of a stack variable.  If so, we issue a warning. 

llvm-svn: 41141
2007-08-17 16:46:58 +00:00
Anders Carlsson
a3a9c43837 Return true in case of error, which is what other functions do.
llvm-svn: 41140
2007-08-17 15:44:17 +00:00
David Greene
81db5acab0 Fix GLIBCXX_DEBUG error of comparing two singular iterators
llvm-svn: 41139
2007-08-17 15:13:55 +00:00
Reid Spencer
b813556f35 Regenerate.
llvm-svn: 41138
2007-08-17 05:45:26 +00:00
Reid Spencer
83bcd76596 Fix PR1606:
The AC_CHECK_HEADER macro was used instead of AC_CHECK_HEADERS. The former does
not automatically add a #define to the configure variables while the latter
does. Consequently, the HAVE_PTHREAD_H symbol was not defined which caused the
Mutex.cpp file to compile to an empty implementation. 

llvm-svn: 41137
2007-08-17 05:44:59 +00:00
Anders Carlsson
98f0790fab Add initial support for constant CFStrings.
llvm-svn: 41136
2007-08-17 05:31:46 +00:00
Evan Cheng
2c4ea1e411 New test. Make sure dynamic_stackalloc size is rounded up.
llvm-svn: 41135
2007-08-16 23:52:23 +00:00
Evan Cheng
1393d88cc6 Update test: dynamic_stackalloc size *must* be rounded to ensure stack ptr be left in a valid state.
llvm-svn: 41134
2007-08-16 23:51:28 +00:00
Evan Cheng
631ccc6144 If dynamic_stackalloc alignment is > stack alignment, first issue an instruction to align the stack ptr before the decrement.
llvm-svn: 41133
2007-08-16 23:50:06 +00:00
Evan Cheng
95667c532c - If a dynamic_stackalloc alignment requirement is <= stack alignment, then the alignment argument is ignored.
- *Always* round up the size of the allocation to multiples of stack
alignment to ensure the stack ptr is never left in an invalid state after a dynamic_stackalloc.

llvm-svn: 41132
2007-08-16 23:46:29 +00:00
Owen Anderson
f5023a7a84 Factor out some code into a helper function.
llvm-svn: 41131
2007-08-16 22:51:56 +00:00
Dan Gohman
88ac781644 Fix the verification for overloaded intrinsic types. Check that they are
what they're supposed to be before using them.

llvm-svn: 41130
2007-08-16 22:06:45 +00:00
Owen Anderson
221a43604e Add some more comments to GVN.
llvm-svn: 41129
2007-08-16 22:02:55 +00:00
Dan Gohman
febf946ea7 Add MVT::fAny for overloading intrinsics on floating-point types.
llvm-svn: 41128
2007-08-16 21:57:19 +00:00
Steve Naroff
cdee44c12a Fixed Sema::CheckEqualityOperands() and Sema::CheckRelationalOperands() to deal more
thoughtfully with incompatible pointers. This includes:

- Emit a diagnostic when two pointers aren't compatible!
- Promote one of the pointers/integers so we maintain the invariant expected by the 
code generator (i.e. that the left/right types match).
- Upgrade the pointer/integer comparison diagnostic to include the types. 

llvm-svn: 41127
2007-08-16 21:48:38 +00:00
Owen Anderson
5f208bea91 Cache non-local memory dependence analysis. This is a significant compile
time performance win in most cases.

llvm-svn: 41126
2007-08-16 21:27:05 +00:00
Chris Lattner
6b69568f85 This adds a bunch of static functions that implement unsigned
two's complement bignum arithmetic.  They could be used to
implement much of APInt, but the idea is they are enough to
implement APFloat as well, which the current APInt interface
is not suited for.

Patch by Neil Booth!

llvm-svn: 41124
2007-08-16 15:56:55 +00:00
Rafael Espindola
4ba05408ac add byval test
llvm-svn: 41123
2007-08-16 13:09:02 +00:00
Reid Spencer
19c21c593f Improve error handling in the linker by:
1. Eliminate redundant error messages. LinkInFile and LinkInArchive
   already call the error() method in each case so there's no use
   telling the user again that an item couldn't be linked in.

2. Improve the formatting of error messages (separating content).

3. Change the wording for the warning about unrecognized files. Make
   it clear that the file is being ignored.

llvm-svn: 41121
2007-08-16 07:47:30 +00:00
Evan Cheng
c7ac888ac3 Comments.
llvm-svn: 41119
2007-08-16 07:25:37 +00:00
Evan Cheng
70c2de7bf1 Fix some kill info update bugs; add hidden option -disable-rematerialization to turn off remat for debugging.
llvm-svn: 41118
2007-08-16 07:24:22 +00:00
Reid Spencer
e97fee7188 Ensure that error messages a propagated from calls to LinkInModule so they get
reported to the end user.

llvm-svn: 41117
2007-08-16 07:23:37 +00:00
Reid Spencer
789eb6ce87 Add a test to ensure that obvious link messages are actually produced on
the standard error.

llvm-svn: 41116
2007-08-16 07:22:43 +00:00
Owen Anderson
0f3230c9d5 Forgot a line.
llvm-svn: 41115
2007-08-16 00:25:42 +00:00
Owen Anderson
3fd4d18600 Add a copy constructor and an assignment operator to DenseMap.
llvm-svn: 41114
2007-08-16 00:18:32 +00:00
Ted Kremenek
248d5b277c Added a comment to ArraySubscriptExpr to note that the expressions like
"A[4]" are equivalent to "4[A]", and that a test that the expression
returned by "getBase()" has a pointer type is required to resolve which
subexpression is the "true" base expression of the array index.

llvm-svn: 41113
2007-08-15 22:33:19 +00:00
Lauro Ramos Venancio
a392cd2fde Implement FPOWI ExpandOp.
Fix PR1287.

llvm-svn: 41112
2007-08-15 22:13:27 +00:00
Anton Korobeynikov
b61c63ecd0 Properly use const qualifiers
llvm-svn: 41111
2007-08-15 21:12:30 +00:00
Evan Cheng
2047077272 Test case for PR1609.
llvm-svn: 41110
2007-08-15 20:30:10 +00:00
Evan Cheng
958cf3d43e If the source of a move is in spill slot, the reload may be folded to essentially a load from stack slot. It's ok to mark the stack slot value as available for reuse. But it should not be clobbered since the destination of the move is live.
llvm-svn: 41109
2007-08-15 20:20:34 +00:00
David Greene
87e2554df4 Update .cvs file
llvm-svn: 41106
2007-08-15 17:58:51 +00:00
Anton Korobeynikov
597c8b77e4 Move ReturnAddrIndex variable to X86MachineFunctionInfo structure. This fixed
hard to catch bugs with retaddr lowering

llvm-svn: 41104
2007-08-15 17:12:32 +00:00
Chris Lattner
db8adb9941 add a note.
llvm-svn: 41103
2007-08-15 16:58:38 +00:00
Dan Gohman
e6e74f7bb3 svn propdel the svn:mime-type property of application/x-troff.
llvm-svn: 41102
2007-08-15 14:03:58 +00:00
Dan Gohman
413a23d257 This test used "wc | grep ..."; convert it to use the count script.
llvm-svn: 41101
2007-08-15 13:55:47 +00:00
Dan Gohman
ada7205b76 Convert tests using "grep -c ... | grep ..." to use the count script.
llvm-svn: 41100
2007-08-15 13:49:33 +00:00
Dan Gohman
85c1e51b34 Delete extraneous uses of wc -l.
llvm-svn: 41099
2007-08-15 13:45:35 +00:00
Dan Gohman
5327cf7b48 Convert another test to use the count script. This one didn't fit the
regex used to convert all the others because the first '|' was on a
separate line.

llvm-svn: 41098
2007-08-15 13:42:36 +00:00
Dan Gohman
f9dd170e36 Convert tests using "| wc -l | grep ..." to use the count script.
llvm-svn: 41097
2007-08-15 13:36:28 +00:00
Devang Patel
3640e78057 Dominance frontier is now required.
llvm-svn: 41096
2007-08-15 03:34:53 +00:00
Devang Patel
b81bcbde09 Cleanup removeBlocks.
Use dominance frontier to fixup incoming edges of successor blocks not domianted by DeadBB.
Use df_iterator to walk and delete basic blocks dominated by DeadBB.

llvm-svn: 41095
2007-08-15 03:31:47 +00:00
Reid Spencer
0db035567c Remove unneeded header file.
llvm-svn: 41094
2007-08-15 03:01:04 +00:00
Devang Patel
f55b79fa71 Avoid triangle loops.
llvm-svn: 41093
2007-08-15 02:14:55 +00:00
Ted Kremenek
85786be8e1 Added the following utility methods to VarDecl that provide
canonicalized queries of a variable's storage:

  hasAutoStorage - Does a variable have (implicit) auto storage?

  hasStaticStorage - Does a variable have (implicit) static storage?

  hasLocalStorage - Is the variable a non-static local variable?

  hasGlobalStorage - Is the variable a global variable or a static
                     local variable?

Additional comments documenting these functions are included in the
source.

llvm-svn: 41092
2007-08-15 00:03:46 +00:00
Devang Patel
22c7993ecf Break infinite loop.
llvm-svn: 41091
2007-08-14 23:59:17 +00:00
Devang Patel
7cad917160 Avoid nested loops at the moment.
llvm-svn: 41090
2007-08-14 23:53:57 +00:00
Evan Cheng
7fe896120e New test.
llvm-svn: 41087
2007-08-14 23:34:50 +00:00
Evan Cheng
3f22fffe94 - If a def is dead, do not spill it.
- If the defs of a spilled rematerializable MI are dead after the spill store is deleted, delete
  the def MI as well.

llvm-svn: 41086
2007-08-14 23:25:37 +00:00
Evan Cheng
859a52072e Test case for PR1596.
llvm-svn: 41085
2007-08-14 23:21:10 +00:00
Evan Cheng
94168a4ed0 Fix for PR1596: AdjustCopiesBackFrom() should conservatively check if any of its sub-registers may overlap with the interval of the copy that's being coalesced.
llvm-svn: 41084
2007-08-14 23:19:28 +00:00
Evan Cheng
6cb9fd7be5 If a MI's def is remat as well as spilled, and the store is later deemed dead, mark the def operand as isDead.
llvm-svn: 41083
2007-08-14 20:23:13 +00:00
Devang Patel
33ba97d747 Fix dominance frontier update while removing blocks.
llvm-svn: 41082
2007-08-14 18:35:57 +00:00
Owen Anderson
bc271a02fd Eliminate PHI nodes with constant values during normal GVN processing, even when
they're not related to eliminating a load.

llvm-svn: 41081
2007-08-14 18:33:27 +00:00
Owen Anderson
398602a6eb Be more aggressive in pruning unnecessary PHI nodes when doing PHI construction.
llvm-svn: 41080
2007-08-14 18:16:29 +00:00
Ted Kremenek
c48affb81f Removed dead variable "hadError" in ParseReturnStmt.
llvm-svn: 41079
2007-08-14 18:14:14 +00:00
Owen Anderson
676070d503 Make GVN iterative.
llvm-svn: 41078
2007-08-14 18:04:11 +00:00
Owen Anderson
a7b220f23a Fix a case where GVN was failing to return true when it had, in fact, modified
the function.

llvm-svn: 41077
2007-08-14 17:59:48 +00:00
Ted Kremenek
e68f1aad65 Added support for additional format string checking for the printf
family of functions.  Previous functionality only included checking to
see if the format string was a string literal.  Now we check parse the
format string (if it is a literal) and perform the following checks:

(1) Warn if: number conversions (e.g. "%d") != number data arguments.

(2) Warn about missing format strings  (e.g., "printf()").

(3) Warn if the format string is not a string literal.

(4) Warn about the use se of '%n' conversion.  This conversion is
    discouraged for security reasons.

(5) Warn about malformed conversions.  For example '%;', '%v'; these
    are not valid.

(6) Warn about empty format strings; e.g. printf("").  Although these
    can be optimized away by the compiler, they can be indicative of
    broken programmer logic.  We may need to add additional support to
    see when such cases occur within macro expansion to avoid false
    positives.

(7) Warn if the string literal is wide; e.g. L"%d".

(8) Warn if we detect a '\0' character WITHIN the format string.

Test cases are included.

llvm-svn: 41076
2007-08-14 17:39:48 +00:00
Devang Patel
367260c0df Assert sooner. Fix wordings.
llvm-svn: 41075
2007-08-14 16:53:52 +00:00
Devang Patel
f120013eca No need to use iterator to erase basic block.
llvm-svn: 41074
2007-08-14 16:53:24 +00:00
Chris Lattner
687dbf1a99 tcl seems to hate |& for some reason.
llvm-svn: 41073
2007-08-14 16:19:35 +00:00
Chris Lattner
0e92458068 switch this to use fastcc to avoid fpstack traffic on x86-32. Switch to
using the count script instead of wc -l

llvm-svn: 41072
2007-08-14 16:14:10 +00:00
Evan Cheng
5c6d53d2ff Update test case. A spill should now be deleted.
llvm-svn: 41070
2007-08-14 09:16:00 +00:00
Evan Cheng
234386509b If a spilled value is being reused and the use is a kill, that means there are
no more uses within the MBB and the spilled value isn't live out of the MBB.
Then it's safe to delete the spill store.

llvm-svn: 41069
2007-08-14 09:11:18 +00:00
Evan Cheng
5e221dbe8f Spiller reuse test case.
llvm-svn: 41068
2007-08-14 05:51:03 +00:00
Evan Cheng
78a8806f4f If a rematerializable def is not deleted, i.e. it is also spilled, check if the
spilled value is available for reuse.

llvm-svn: 41067
2007-08-14 05:42:54 +00:00
Evan Cheng
74c69f7588 Kill info update bugs.
llvm-svn: 41064
2007-08-14 01:56:58 +00:00
Devang Patel
dbe8497d45 Handle last value assignments.
llvm-svn: 41063
2007-08-14 01:30:57 +00:00
Devang Patel
f74ccbb4e8 StartValue is already calculated.
llvm-svn: 41062
2007-08-14 00:15:45 +00:00
Evan Cheng
2814fe847d Now capable of rematerializing coalesced live intervals.
llvm-svn: 41061
2007-08-13 23:54:16 +00:00
Evan Cheng
33820da1da Re-implement trivial rematerialization. This allows def MIs whose live intervals that are coalesced to be rematerialized.
llvm-svn: 41060
2007-08-13 23:45:17 +00:00
Evan Cheng
b2823dac69 Fix a typo pointd out by Maarten ter Huurne.
llvm-svn: 41059
2007-08-13 23:27:11 +00:00
Ted Kremenek
86aeed9236 Added documentation to StringLiteral noting that the strings returned by
getStrData() are not null-terminated, and the lengths of these strings should
be determined using getByteLength().

llvm-svn: 41055
2007-08-13 22:26:47 +00:00
Devang Patel
948653915f Preserve simple analysis.
llvm-svn: 41054
2007-08-13 22:22:13 +00:00
Devang Patel
b8a41bb4f1 Preserve dominator info.
llvm-svn: 41053
2007-08-13 22:13:24 +00:00
Devang Patel
c0fa0c52b3 Add methods to erase basic block entry.
llvm-svn: 41052
2007-08-13 22:10:29 +00:00
Devang Patel
da48cf40db If NewBB dominates DestBB then DestBB is not part of NewBB's dominance frontier.
llvm-svn: 41051
2007-08-13 21:59:17 +00:00
Chris Lattner
2b40caa861 move assertion into mutex guard, a partial fix for PR1606.
llvm-svn: 41050
2007-08-13 20:08:16 +00:00
Dan Gohman
ccb3611881 When x86 addresses matching exceeds its recursion limit, check to
see if the base register is already occupied before assuming it can be
used. This fixes bogus code generation in the accompanying testcase.

llvm-svn: 41049
2007-08-13 20:03:06 +00:00
Chris Lattner
4e7f673f65 Fix PR1607
llvm-svn: 41048
2007-08-13 18:42:37 +00:00
Chris Lattner
3251377104 test that the ptr-to-method is succefully eliminated, leaving just the vtable dispatch.
llvm-svn: 41047
2007-08-13 17:17:03 +00:00
Chris Lattner
aadc778782 Constant fold: getelementptr (i8* inttoptr (i64 1 to i8*), i32 -1)
Into: inttoptr (i64 0 to i8*)  -> null

This occurs in the example in PR1602.  With this fixed, we now compile
the example in PR1602 into fully "devirtualized" code:

define void @_Z1g1S(%struct.S* noalias  %s) {
entry:        %tmp131415 = getelementptr %struct.S* %s, i32 0, i32 0          ; <i32 (...)***> [#uses=1]        %tmp16 = load i32 (...)*** %tmp131415, align 4          ; <i32 (...)**> [#uses=1]
        %tmp26277 = load i32 (...)** %tmp16             ; <i32 (...)*> [#uses=1]
        %tmp2829 = bitcast i32 (...)* %tmp26277 to void (%struct.S*)*           ; <void (%struct.S*)*> [#uses=1]
        tail call void %tmp2829( %struct.S* %s )
        ret void
}

This still has the vtable dispatch (as required) but does not have any pointer
to method cruft left.

llvm-svn: 41046
2007-08-13 17:09:08 +00:00
Evan Cheng
5ca98c657d Kill info update bugs.
llvm-svn: 41043
2007-08-13 07:12:23 +00:00
Reid Spencer
ab13178928 Make use of the llvm-ld tool's new ability to read input from stdin to extract
the list of link time passes to be run, just as for opt, with the
-debug-pass=Arguments option.

llvm-svn: 41040
2007-08-13 06:19:51 +00:00
Reid Spencer
7c38b0dc15 Don't build llvm-stub twice.
llvm-svn: 41039
2007-08-13 00:25:47 +00:00
Chris Lattner
1399f64e3b oops, forgot to commit this.
llvm-svn: 41034
2007-08-12 16:55:14 +00:00
Reid Spencer
f3317d5286 Change casts from old style to new style. This helps document the details
better, gives the compiler a chance to validate the cast and reduces warnings
if the user turns on -Wold-style-cast option.

llvm-svn: 41033
2007-08-12 08:12:35 +00:00
Devang Patel
f258578206 Split loops and do CFG cleanup.
llvm-svn: 41029
2007-08-12 07:02:51 +00:00
Reid Spencer
9f90f965de Remove unused variables.
llvm-svn: 41028
2007-08-12 04:45:36 +00:00
Evan Cheng
af21e9550e No need to remove dead range from soon-to-be-dead live interval. Its val# may be out of whack.
llvm-svn: 41024
2007-08-12 01:26:19 +00:00
Chris Lattner
460e34afed constant fold ptrtoint(inttoptr) with target data when available. This allows
us to fold the entry block of PR1602 to false instead of:

br i1 icmp eq (i32 and (i32 ptrtoint (void (%struct.S*)* inttoptr (i64
1 to void (%struct.S*)*) to i32), i32 1), i32 0), label %cond_next, label
%cond_true

llvm-svn: 41023
2007-08-11 23:49:01 +00:00
Chris Lattner
99c8ee2977 Transform a load from an undef/zero global into an undef/global even if we
have complex pointer manipulation going on.  This allows us to compile
stuff like this:

__m128i foo(__m128i x){
                static const unsigned int c_0[4] = { 0, 0, 0, 0 };
                __m128i v_Zero = _mm_loadu_si128((__m128i*)c_0);
                x  = _mm_unpacklo_epi8(x,  v_Zero);
                return x;
}

into:

_foo:
        xorps   %xmm1, %xmm1
        punpcklbw       %xmm1, %xmm0
        ret

llvm-svn: 41022
2007-08-11 18:48:48 +00:00
Chris Lattner
750b3dfcf5 expand a note
llvm-svn: 41021
2007-08-11 18:19:07 +00:00
Chris Lattner
ee44ab5b5f With evan's explicit flag representation, hopefully we will finally be
able to 3-addressify away stuff like this:

        movl    %ecx, %eax
        decl    %eax

llvm-svn: 41020
2007-08-11 18:16:46 +00:00
Reid Spencer
3687007119 Now that llvm-ld can accept - as input from stdin, use this feature to extract
the pass arguments that it supports.

llvm-svn: 41019
2007-08-11 16:11:22 +00:00
Reid Spencer
2dc9f13278 Fix a comment typo noticed by Sandro Magi.
llvm-svn: 41018
2007-08-11 15:57:56 +00:00
Bill Wendling
cdbd82ee37 64-bit SSSE3 ops that use MMX registers don't require 16-byte alignment.
Make a 'memop' pattern just for them.

llvm-svn: 41017
2007-08-11 09:52:53 +00:00
Evan Cheng
05cc486c7b Code to maintain kill information during register coalescing.
llvm-svn: 41016
2007-08-11 00:59:19 +00:00
Chris Lattner
afada9b077 xfail this for now.
llvm-svn: 41015
2007-08-11 00:05:07 +00:00
Chris Lattner
6278e6ac30 start splitting out aggregate value computation from EmitExpr into EmitAggExpr.
aggregate value and scalar expression computation are very different, this
gets them away from each other.  This causes a temporary regression on some
complex number examples.

llvm-svn: 41014
2007-08-11 00:04:45 +00:00
Christopher Lamb
44e79f8aba Use subregs to improve any_extend code generation when feasible.
llvm-svn: 41013
2007-08-10 22:22:41 +00:00
Christopher Lamb
030a59d967 Fix test so it passes.
llvm-svn: 41012
2007-08-10 22:20:57 +00:00
Chris Lattner
11472debe9 make sure to add a newline at the end of the dump
llvm-svn: 41011
2007-08-10 21:51:12 +00:00
Christopher Lamb
b372abab14 Increase efficiency of sign_extend_inreg by using subregisters for truncation. As the README suggests sign_extend_subreg is selected to (sext(trunc)).
llvm-svn: 41010
2007-08-10 21:48:46 +00:00
Christopher Lamb
f0c236fb8a Edit README in light of previous LEA16 commit.
llvm-svn: 41009
2007-08-10 21:29:05 +00:00
Ted Kremenek
56c864e3fd Added "id_idx" parameter to CheckPrintfArguments. This will be used
by CheckPrintfArguments to determine if a given printf function
accepts a va_arg argument.

llvm-svn: 41008
2007-08-10 21:21:05 +00:00
Christopher Lamb
d36d30b53c Add 2-addr to 3-addr promotion code that allows 32-bit LEA to be used via subregisters when 16-bit LEA is disabled.
llvm-svn: 41007
2007-08-10 21:18:25 +00:00
Ted Kremenek
cfc9419dd4 Moved id_asprintf before id_vsnprintf in the enum used for indexing
KnownFunctionIDs.  This allows us to test for a printf-like function
that accepts a va_arg argument using a range comparison.

llvm-svn: 41006
2007-08-10 21:13:51 +00:00
Christopher Lamb
e081928f49 Move isSubRegOf into MRegisterInfo. Fix a missed move elimination in LowerSubregs and add more debugging output there.
llvm-svn: 41005
2007-08-10 21:11:55 +00:00
Chris Lattner
cccc311110 add support for a top-level __extension__ marker, implementing a todo.
llvm-svn: 41004
2007-08-10 20:57:02 +00:00
Chris Lattner
b87b1b36ee initial support for checking format strings, patch by Ted Kremenek:
"I've coded up some support in clang to flag warnings for non-constant format strings used in calls to printf-like functions (all the functions listed in "man fprintf").  Non-constant format strings are a source of many security exploits in C/C++ programs, and I believe are currently detected by gcc using the flag -Wformat-nonliteral."

llvm-svn: 41003
2007-08-10 20:18:51 +00:00
Chris Lattner
d79671fdf2 New file, just a placeholder for now.
llvm-svn: 41002
2007-08-10 20:13:28 +00:00
Devang Patel
d305c404be Do not overuse std::string. Pass around char * directly.
llvm-svn: 41001
2007-08-10 18:29:32 +00:00
Chris Lattner
ac9823bc5d Build ASTs before relexing the file. This avoids having comment finding mutate the
preprocessor state, causing bogus diagnostics when the file is parsed for real.  This
implements Misc/diag-checker.c.  Thanks to Ted for noticing this.

llvm-svn: 41000
2007-08-10 18:27:41 +00:00
Steve Naroff
47fea35e48 Make sure the arithmetic conversion are done for relation and equality operators.
This fixes the following...

eypedef short S;
int test(S X, long long Y) {
  return X < Y;
}

Before...

(CompoundStmt 0x2905d00
  (ReturnStmt 0x2905cf0
    (BinaryOperator 0x2905cd0 'int' '<'
      (ImplicitCastExpr 0x2905cc0 'int'
        (DeclRefExpr 0x2905c80 'S':'short' Decl='X' 0x2905c20))
      (DeclRefExpr 0x2905ca0 'long long' Decl='Y' 0x2905c50))))

After...

(CompoundStmt 0x2b05c30
  (ReturnStmt 0x2b05c20
    (BinaryOperator 0x2b05c00 'int' '<'
      (ImplicitCastExpr 0x2b05bf0 'long long'
        (DeclRefExpr 0x2b05bb0 'S':'short' Decl='X' 0x2b05b50))
      (DeclRefExpr 0x2b05bd0 'long long' Decl='Y' 0x2b05b80))))

llvm-svn: 40999
2007-08-10 18:26:40 +00:00
Devang Patel
f417c2cc34 Clone loop.
llvm-svn: 40998
2007-08-10 18:07:13 +00:00
Devang Patel
aa36a43908 Add utility to clone loops.
llvm-svn: 40997
2007-08-10 17:59:47 +00:00
Chris Lattner
213ef35a89 fix this test to pass.
llvm-svn: 40996
2007-08-10 17:18:58 +00:00
Chris Lattner
8eab8ff127 fix a codegen bug handling ocuvector element exprs.
llvm-svn: 40995
2007-08-10 17:10:08 +00:00
Chris Lattner
e9a91ae4ea make this harder
llvm-svn: 40994
2007-08-10 17:02:59 +00:00
Chris Lattner
90d9120453 implement initial codegen for aggregate return functions. This implements
codegen for:

_Complex double bar(int);
void test(_Complex double*);

void test2(int c) {
  _Complex double X;
  X = bar(1);
  test(&X);
}

llvm-svn: 40993
2007-08-10 17:02:28 +00:00
Chris Lattner
02697701d9 Fix a bug handling function -> pointer decay and avoid emitting a noop
bitcast.

llvm-svn: 40992
2007-08-10 16:33:59 +00:00
Devang Patel
0b1af29f28 Add #ifndef guard.
llvm-svn: 40991
2007-08-10 15:58:23 +00:00
Chris Lattner
430826179c add #ifndef guards
llvm-svn: 40990
2007-08-10 15:53:08 +00:00
Chris Lattner
5109a88ac3 add Value::getNameStart/getNameLen() accessors.
llvm-svn: 40989
2007-08-10 15:34:35 +00:00
Dan Gohman
97b58e27e6 Add a test script for counting lines. This can be used instead of the
"| grep foo | wc -l | grep 2" idiom used by many tests, so that, for
example, tests don't mistakenly accept a count of 12 when 2 is
expected. Also, the new form is more consice: "| grep foo | count 2".

llvm-svn: 40988
2007-08-10 15:07:05 +00:00
Dan Gohman
a17799a3bd Fix EXTRACT_ELEMENT, EXTRACT_SUBVECTOR, and EXTRACT_VECTOR_ELT to
use an intptr ValueType instead of i32 for the index operand in
getCopyToParts.

llvm-svn: 40987
2007-08-10 14:59:38 +00:00
Rafael Espindola
66011c17d5 propagate struct size and alignment of byval arguments to the DAG
llvm-svn: 40986
2007-08-10 14:44:42 +00:00
Bill Wendling
7014615087 For kicks, I though it would be fun to use the correct opcode.
llvm-svn: 40985
2007-08-10 09:00:17 +00:00
Chris Lattner
0c8aa5cd64 memcpy with zero length is hugely expensive, so avoid it. This speeds up coallescing from 1.17s to 0.88s on siod.
llvm-svn: 40984
2007-08-10 07:02:50 +00:00
Chris Lattner
b21e76ecb1 small speedup in the case where a smallvector is default ctor'd from
an empty vector.  This speeds up llc slightly.

llvm-svn: 40983
2007-08-10 06:54:38 +00:00
Bill Wendling
2377206923 Adding SSSE3 intrinsics.
llvm-svn: 40982
2007-08-10 06:22:27 +00:00
Chris Lattner
de2aa65877 minor simplifications.
llvm-svn: 40981
2007-08-10 06:22:25 +00:00
Chris Lattner
dd6304f6b1 avoid copying strings.
llvm-svn: 40980
2007-08-10 06:17:04 +00:00
Devang Patel
9a4761464f Remove unncessary duplication.
llvm-svn: 40979
2007-08-10 00:59:03 +00:00
Devang Patel
7bdf4531bb Calculate exit and start value of true loop and false loop respectively.
llvm-svn: 40978
2007-08-10 00:53:35 +00:00
Devang Patel
67af6cd7ea ExitCondition and Induction variable are loop constraints
not split condition constraints.

llvm-svn: 40977
2007-08-10 00:33:50 +00:00
Chris Lattner
2b9fe84b07 unbreak the build
llvm-svn: 40976
2007-08-09 23:55:17 +00:00
Evan Cheng
1115a2b412 Bug fix. ~1U marks the val# dead.
llvm-svn: 40975
2007-08-09 23:14:39 +00:00
Dale Johannesen
bdad80977b Patch 10 for long double. Doing constants right needs expanding ConstantFP
to handle values bigger than double.  If we assume host==target and host
long double works correctly, this is not too bad, but we don't want to
have that limitation longterm.  I could implement accepting double
constants as long double or something like that, which would lead to
incorrect codegen with no errors; the more I think about that the worse
it seems.  Rather than do such a hack that would be backed out later,
I'm settling for giving reasonable error messages, for now.

llvm-svn: 40974
2007-08-09 22:51:36 +00:00
Evan Cheng
f855b626e8 Temporarily backing out this change until we know why some dejagnu tests are failing.
llvm-svn: 40973
2007-08-09 22:25:35 +00:00
Evan Cheng
e32e923a6a divb / mulb outputs to ah. Under x86-64 it's not legal to read ah if the instruction requires a rex prefix (i.e. outputs to r8b, etc.). So issue shift right by 8 on AX and then truncate it to 8 bits instead.
llvm-svn: 40972
2007-08-09 21:59:35 +00:00
Chris Lattner
a8e4b4bc7b when we see a unaligned load from an insufficiently aligned global or
alloca, increase the alignment of the load, turning it into an aligned load.

This allows us to compile:

#include <xmmintrin.h>
__m128i foo(__m128i x){
 static const unsigned int c_0[4] = { 0, 0, 0, 0 };
	  __m128i v_Zero = _mm_loadu_si128((__m128i*)c_0);
  x  = _mm_unpacklo_epi8(x,  v_Zero);
  return x;
}

into:

_foo:
	punpcklbw	_c_0.5944, %xmm0
	ret
	.data
	.lcomm	_c_0.5944,16,4		# c_0.5944

instead of:

_foo:
	movdqu	_c_0.5944, %xmm1
	punpcklbw	%xmm1, %xmm0
	ret
	.data
	.lcomm	_c_0.5944,16,2		# c_0.5944

llvm-svn: 40971
2007-08-09 19:05:49 +00:00
Evan Cheng
a05ec4dc52 GR16_ sub-register class should be GR8_, not GR8. That is, it should only be 8-bit registers in 32-bit mode. Ditto for GR32_.
llvm-svn: 40970
2007-08-09 18:05:17 +00:00
Chris Lattner
8f184b12fc implement dumper support for declstmt's. The dumper is now "done".
llvm-svn: 40969
2007-08-09 18:03:18 +00:00
Chris Lattner
db3b3ff74b implement dumper support for the rest of expressions.
llvm-svn: 40968
2007-08-09 17:35:30 +00:00
Chris Lattner
3f5e4680fb move a switch to common code.
llvm-svn: 40967
2007-08-09 17:34:19 +00:00
Chris Lattner
22c46b5851 minor fixes
llvm-svn: 40966
2007-08-09 17:33:55 +00:00
Dale Johannesen
c339e45274 Update per review comments.
llvm-svn: 40965
2007-08-09 17:27:48 +00:00
Chris Lattner
66dfa4b40c dump strings with escapes and other stuff in them nicely.
llvm-svn: 40964
2007-08-09 17:14:24 +00:00
Chris Lattner
599e47e6ff minor cleanups
llvm-svn: 40963
2007-08-09 17:01:07 +00:00
Chris Lattner
7b20dc769a __attribute__ starts a declspec.
llvm-svn: 40962
2007-08-09 16:40:21 +00:00
Owen Anderson
9b1cc8cac0 Make NonLocal and None const in the right way. :-)
llvm-svn: 40961
2007-08-09 04:42:44 +00:00
Devang Patel
42e3e5bec1 Traverse loop blocks' terminators to find split candidates.
llvm-svn: 40960
2007-08-09 01:39:01 +00:00
Chris Lattner
273a1ea2e8 add dumping support for some new nodes
llvm-svn: 40959
2007-08-09 01:04:32 +00:00
Dale Johannesen
ba1a98a4e0 long double 9 of N. This finishes up the X86-32 bits
(constants are still not handled).  Adds ConvertActions
to control fp-to-fp conversions (these are currently
defaulted for all other targets, so no changes there).

llvm-svn: 40958
2007-08-09 01:04:01 +00:00
Dale Johannesen
f5124b36e4 Fix arguments for some Altivec instructions. From SWB.
llvm-svn: 40957
2007-08-09 00:49:19 +00:00
Chris Lattner
9bcd9156b9 Dump out types for expressions, and handle typedefs nicely.
This allows us to dump:

typedef short S;
int test(S X, long long Y) {
  return X < ((100));
}

as:

typedef short S;

int test(S X, long long Y)
(CompoundStmt 0x2905d40
  (ReturnStmt 0x2905d30
    (BinaryOperator 0x2905d10 'int' '<'
      (ImplicitCastExpr 0x2905d00 'int'
        (DeclRefExpr 0x2905c80 'S':'short' Decl='X' 0x2905c20))
      (ParenExpr 0x2905ce0 'int'
        (ParenExpr 0x2905cc0 'int'
          (IntegerLiteral 0x2905ca0 'int' 100))))))

llvm-svn: 40956
2007-08-09 00:36:22 +00:00
Scott Michel
9d09c5ccda If a target really needs to custom lower constants, it should be allowed
to do so.

llvm-svn: 40955
2007-08-08 23:23:31 +00:00
Chris Lattner
cbe4f77c9e add a new AST dumper interface (E->dump()). This dumps out
the AST in a structural, non-pretty, form useful for understanding
the AST.  It isn't quite done yet, but is already somewhat useful.

For this example:

int test(short X, long long Y) {
  return X < ((100));
}

we get (with -parse-ast-dump):

int test(short X, long long Y)
(CompoundStmt 0x2905ce0
  (ReturnStmt 0x2905cd0
    (BinaryOperator 0x2905cb0 '<'
      (ImplicitCastExpr 0x2905ca0
        (DeclRefExpr 0x2905c20 Decl='X' 0x2905bb0))
      (ParenExpr 0x2905c80
        (ParenExpr 0x2905c60
          (IntegerLiteral 0x2905c40 100))))))

llvm-svn: 40954
2007-08-08 22:51:59 +00:00
Owen Anderson
2b21c3c7a8 Add more comments to memdep.
llvm-svn: 40953
2007-08-08 22:26:03 +00:00
Devang Patel
0183c797c4 Add cost analysis.
llvm-svn: 40952
2007-08-08 22:25:28 +00:00
Steve Naroff
12b0447bc6 Finish implementing __builtin_classify_type()...
llvm-svn: 40951
2007-08-08 22:15:55 +00:00
Owen Anderson
fa788358d5 Make memdep fit in 80 cols.
llvm-svn: 40950
2007-08-08 22:01:54 +00:00
Owen Anderson
927f62a3a1 Add one more comment.
llvm-svn: 40949
2007-08-08 21:54:33 +00:00
Owen Anderson
064bad44d1 Cleanup and comment-ize the memdep header.
llvm-svn: 40948
2007-08-08 21:53:20 +00:00
Devang Patel
0e34ee25ab Preserve dom info while processing one iteration loop.
llvm-svn: 40947
2007-08-08 21:39:47 +00:00
Owen Anderson
b84d3b1c92 Change the None and NonLocal markers in memdep to be const.
llvm-svn: 40946
2007-08-08 21:39:39 +00:00
Reid Spencer
fd46badca5 Separate program name from error message with a :
llvm-svn: 40945
2007-08-08 21:19:01 +00:00
Devang Patel
8abc5c82b7 Clear split info.
llvm-svn: 40944
2007-08-08 21:18:27 +00:00
Reid Spencer
f054db3242 Terminate an error message with a newline.
llvm-svn: 40943
2007-08-08 21:17:59 +00:00
Devang Patel
593bf9ceb3 Handle multiple split conditions.
llvm-svn: 40941
2007-08-08 21:02:17 +00:00
Reid Spencer
8574ac95f0 Make it clear that getSTDIN returns null when stdin is empty.
llvm-svn: 40940
2007-08-08 20:02:20 +00:00
Reid Spencer
155533cf73 Make getSTDIN return null if the standard input is empty, as the header file
documentation implies and as its uses depend.

llvm-svn: 40939
2007-08-08 20:01:58 +00:00
Reid Spencer
8609c06956 Allow the filename "-" to be a place holder for stdin. This allows directing
stdin through llvm-ld and llvm-link.

llvm-svn: 40938
2007-08-08 19:52:29 +00:00
Owen Anderson
680862880d Global values also don't undead-ify pointers in our dead alloca's set.
llvm-svn: 40936
2007-08-08 19:12:31 +00:00
Owen Anderson
ddf4aee543 Make handleEndBlock significantly faster with one trivial improvement,
and one hack to avoid hitting a bad case when the alias analysis is imprecise.

llvm-svn: 40935
2007-08-08 18:38:28 +00:00
Owen Anderson
50df9685b0 Small improvement: if a function doesn't access memory, we don't need to scan
it for potentially undeading pointers.

llvm-svn: 40933
2007-08-08 17:58:56 +00:00
Owen Anderson
52aaabf74d Add some comments, remove a dead argument, and simplify some control flow.
No functionality change.

llvm-svn: 40932
2007-08-08 17:50:09 +00:00
Chris Lattner
87f4836184 now that implicit conversions are explicit, we can eliminate
EmitUsualArithmeticConversions.

llvm-svn: 40931
2007-08-08 17:49:18 +00:00
Steve Naroff
4bc57c0de7 Add support for __builtin_classify_type(). This builtin function isn't "public", however
it is used by "tgmath.h" (so we need to support it). It might also come in handy when
developing the overloaded function macros for OpenCU.

Next check-in will make this an integer constant expression...

llvm-svn: 40930
2007-08-08 17:48:34 +00:00
Chris Lattner
5ebb2fed89 now that implicit conversions are explicit, we can eliminate
EmitExprWithUsualUnaryConversions.

llvm-svn: 40929
2007-08-08 17:43:05 +00:00
Chris Lattner
d1fd0db2ae eliminate redundant conditions from the signless types conversion.
llvm-svn: 40927
2007-08-08 16:19:57 +00:00
Chris Lattner
7574ef3ac4 Handle functions with no name better.
llvm-svn: 40926
2007-08-08 16:07:23 +00:00
Evan Cheng
d771b793fe Adding kill info to val#.
llvm-svn: 40925
2007-08-08 07:03:29 +00:00
Chris Lattner
785f9986bd significantly speed up constant folding of calls (and thus all clients that use
ConstantFoldInstruction on calls) by avoiding Value::getName().  getName() constructs
and returns an std::string, which does heap allocation stuff.  This slightly speeds up
instcombine.

llvm-svn: 40924
2007-08-08 06:55:43 +00:00
Chris Lattner
415750e132 Speed up updateDFSNumbers with two observations:
1. domtree is a tree, not a graph.  There is no need to avoid revisiting nodes with a set.
2. the worklist can contain the child iterator pointers so we don't get N^2 rescanning of children.

This speeds up updateDFSNumbers significantly, making it basically free.  On the testcase in PR1432,
this speeds up loopsimplify by another 3x, dropping it from the 12th most expensive pass to the to
the 30th. :)  It used to be #1.

llvm-svn: 40923
2007-08-08 06:24:20 +00:00
Owen Anderson
b17ab03081 A few more small cleanups.
llvm-svn: 40922
2007-08-08 06:06:02 +00:00
Evan Cheng
103947125c Clean up and bug fix.
llvm-svn: 40921
2007-08-08 05:56:18 +00:00
Chris Lattner
c63d4c2e4e reimplement dfs number computation to be significantly faster. This speeds up
natural loop canonicalization (which does many cfg xforms) by 4.3x, for 
example.  This also fixes a bug in postdom dfnumber computation.

llvm-svn: 40920
2007-08-08 05:51:24 +00:00
Owen Anderson
0aecf0ebef First round of cleanups from Chris' feedback.
llvm-svn: 40919
2007-08-08 04:52:29 +00:00
Evan Cheng
a8c2f38617 - Each val# can have multiple kills.
- Fix some minor bugs related to special markers on val# def. ~0U means
  undefined, ~1U means dead val#.

llvm-svn: 40916
2007-08-08 03:00:28 +00:00
Devang Patel
68de1ae816 Embrace patch review feedback.
llvm-svn: 40915
2007-08-08 01:51:27 +00:00
Evan Cheng
c236617ea0 Remove a dead assertion.
llvm-svn: 40914
2007-08-08 01:00:21 +00:00
Evan Cheng
0d0fee269a - LiveInterval value#'s now have 3 components: def instruction #,
kill instruction #, and source register number (iff the value# is defined by a
copy).
- Now def instruction # is set for every value#, not just for copy defined ones.
- Update some outdated code related inactive live ranges.
- Kill info not yet set. That's next patch.

llvm-svn: 40913
2007-08-07 23:49:57 +00:00
Devang Patel
c7e53bdcfd Fix new compare instruction's signness. Caught by Chris during review.
llvm-svn: 40912
2007-08-07 23:17:52 +00:00
Devang Patel
549c0d5175 Fix comment.
llvm-svn: 40911
2007-08-07 23:16:03 +00:00
Owen Anderson
0cc1a76283 Don't insert nearly as many redundant phi nodes.
llvm-svn: 40909
2007-08-07 23:12:31 +00:00
Dale Johannesen
4e7ff3593c Fix spelling of mtvscr and mfvscr.
llvm-svn: 40908
2007-08-07 23:08:00 +00:00
Steve Naroff
773df5cf30 Move the function/array conversion for ParmVarDecl's from Sema::ParseIdentifierExpr()
to Sema::ParseParamDeclarator(). After discussing this with Chris, we decided this
approach has more immediate benefit (though we loose some information in the AST). 
The comment below should describe more (if interested).

llvm-svn: 40907
2007-08-07 22:44:21 +00:00
Dale Johannesen
a47f7d7cfd Long double patch 8 of N: make it partially work in
SSE mode (all but conversions <-> other FP types, I think):
>>Do not mark all-80-bit operations as "Requires[FPStack]"
(which really means "not SSE").
>>Refactor load-and-extend to facilitate this.
>>Update comments.
>>Handle long double in SSE when computing FP_REG_KILL.

llvm-svn: 40906
2007-08-07 20:29:26 +00:00
Reid Spencer
8feb9d67e8 Who thought up this crazy formatting scheme?
llvm-svn: 40905
2007-08-07 17:57:36 +00:00
Reid Spencer
4391aa042c Okay, over/back tags don't next.
llvm-svn: 40904
2007-08-07 17:48:56 +00:00
Devang Patel
19211b6528 Use eraseFromParent().
llvm-svn: 40903
2007-08-07 17:45:35 +00:00
Reid Spencer
5f5bb46e95 Try an indent level for better formatting.
Add the -version option.

llvm-svn: 40902
2007-08-07 17:43:48 +00:00
Chris Lattner
d402939b40 add some helpers
llvm-svn: 40901
2007-08-07 17:33:34 +00:00
Reid Spencer
d64584f64b Add the code generation options.
llvm-svn: 40900
2007-08-07 17:12:43 +00:00
David Greene
c600d65e2b Make this code more efficient
llvm-svn: 40899
2007-08-07 16:57:55 +00:00
David Greene
bacdbaa0da Fix comment typo
llvm-svn: 40898
2007-08-07 16:52:03 +00:00
David Greene
816a190cdf Fix GLIBCXX_DEBUG error triggered by incrementing erased iterator.
llvm-svn: 40897
2007-08-07 16:44:38 +00:00
David Greene
99905f16f8 Add a missing forward declaration.
llvm-svn: 40896
2007-08-07 16:34:05 +00:00
Reid Spencer
50138fec19 Rearrange options into sections and add the last floating point related option.
llvm-svn: 40895
2007-08-07 16:29:57 +00:00
Reid Spencer
30b4ae5005 Add the -disable-excess-fp-precision option.
llvm-svn: 40894
2007-08-07 16:23:42 +00:00
Reid Spencer
ef3a6a3c7a Add another missing option.
llvm-svn: 40893
2007-08-07 16:21:52 +00:00
Reid Spencer
718eb7f19b Add some more missing options.
llvm-svn: 40892
2007-08-07 16:11:57 +00:00
Reid Spencer
a8f72c72a6 Remove the -f option which is no longer supported, but add the -fake-argv0
option which is similar.

llvm-svn: 40891
2007-08-07 15:48:16 +00:00
Reid Spencer
b23b65f1ba Describe the global/local naming convention.
llvm-svn: 40890
2007-08-07 14:34:28 +00:00
Nick Lewycky
76fb226fd4 Add reference to problem report.
llvm-svn: 40889
2007-08-07 12:27:03 +00:00
Evan Cheng
f7c6effc44 Initial JIT support for ARM by Raul Fernandes Herbster.
llvm-svn: 40887
2007-08-07 01:37:15 +00:00
Dale Johannesen
57c6ac5fe5 Long double patch 7 of N, unless I lost count:).
Last x87 bits for full functionality (not
thoroughly tested, and long doubles do not work
in SSE modes at all - use -mcpu=i486 for now)

llvm-svn: 40886
2007-08-07 01:17:37 +00:00
Owen Anderson
a64832f60e Get rid of unnecessary #include.
llvm-svn: 40885
2007-08-07 00:38:16 +00:00
Owen Anderson
68c6732d2c Clean up a bunch of caching stuff in memdep. This reduces the time to run GVN
on 403.gcc from ~15s to ~10s.

llvm-svn: 40884
2007-08-07 00:33:45 +00:00
Devang Patel
c70106cb30 Begin loop index split pass.
llvm-svn: 40883
2007-08-07 00:25:56 +00:00
Owen Anderson
4898513d96 Improve the accuracy of memdep for determining the dependencies of loads.
This brings GVN to parity with GCSE+LoadVN.

llvm-svn: 40882
2007-08-06 23:26:03 +00:00
Dale Johannesen
a010822b45 Replace 4-line function with 10-line version per review comment.
llvm-svn: 40881
2007-08-06 22:10:35 +00:00
Chris Lattner
07b96a78e4 remove #if 0 code.
llvm-svn: 40880
2007-08-06 22:03:19 +00:00
Chris Lattner
cc407f1779 remove #if 0 code.
llvm-svn: 40879
2007-08-06 22:01:53 +00:00
Dale Johannesen
d1822ea7d1 Move lengthy conditional down 1 level per review comment.
llvm-svn: 40878
2007-08-06 21:48:35 +00:00
Dale Johannesen
75169a82d6 Get X86 long double calling convention to work
(on Darwin, anyway).  Fix some table omissions for
LD arithmetic.

llvm-svn: 40877
2007-08-06 21:31:06 +00:00
Chris Lattner
f72a2db072 regenerate
llvm-svn: 40875
2007-08-06 21:00:46 +00:00
Chris Lattner
6a5a2620ba Fix PR1577, a crash on invalid bug.
llvm-svn: 40874
2007-08-06 21:00:37 +00:00
Chandler Carruth
bebc3bb2e3 This resolves a regression of BasicAA which failed to find any memory information for overloaded intrinsics (PR1600). This resolves that issue, and improves the matching scheme to use a BitVector rather than a binary search.
llvm-svn: 40872
2007-08-06 20:57:16 +00:00
Chandler Carruth
f93a82f08f This fixes resizing issues with BitVectors. It ensures that the BitWord type and type size is always used, and ensures completely correct clearing of unused high bits, and setting of bits when resizing. It should resolve PR1563.
llvm-svn: 40871
2007-08-06 20:52:17 +00:00
Nick Lewycky
8052019a20 It's safe to fold not of fcmp.
llvm-svn: 40870
2007-08-06 20:04:16 +00:00
Nick Lewycky
f921f1bc4a Fix the dates on these tests. It's not September yet. Thanks Reid!
llvm-svn: 40869
2007-08-06 20:00:11 +00:00
Dale Johannesen
e279fd6ce8 Make 80-bit store maintain simulated FP stack correctly.
llvm-svn: 40868
2007-08-06 19:50:32 +00:00
Nick Lewycky
96606cec20 Let scalar-evolution analyze loops with an unsigned comparison for the exit
condition. Fixes 1597.

llvm-svn: 40867
2007-08-06 19:21:00 +00:00
Nick Lewycky
b9819f3a8b Don't assume it's safe to transform a loop just because it's dominated by any
comparison. Fixes bug 1598.

llvm-svn: 40866
2007-08-06 18:33:46 +00:00
Reid Spencer
7fffcad5c2 @verbatim needs to be on a line by itself.
llvm-svn: 40865
2007-08-06 17:10:29 +00:00
Chris Lattner
079ebcfae5 Fix a regression compiling 2005-05-11-Popcount-ffs-fls with the CBE,
introduced by chandler's patch.

llvm-svn: 40864
2007-08-06 16:36:18 +00:00
Christopher Lamb
2e5fb9f71e Implement review feedback. No functionality change.
llvm-svn: 40863
2007-08-06 16:33:56 +00:00
David Greene
77b2accbca Make this code more efficient.
llvm-svn: 40861
2007-08-06 15:09:17 +00:00
Chris Lattner
c7ba225705 remove some dead lines
llvm-svn: 40859
2007-08-06 06:21:06 +00:00
Chris Lattner
67f1c3335c 1. Random tidiness cleanups
2. Make domtree printing print dfin/dfout #'s
3. Fix the Transforms/LoopSimplify/2004-04-13-LoopSimplifyUpdateDomFrontier.ll failure from last night (in DominanceFrontier::splitBlock).

w.r.t. #3, my patches last night happened to expose the bug, but this 
has been broken since Owen's r35839 patch to LoopSimplify.  The code
was subsequently moved over from LoopSimplify into Dominators, carrying
the latent bug.  Fun stuff.

llvm-svn: 40858
2007-08-06 06:19:47 +00:00
Chris Lattner
278c924975 update for new domtree dump format
llvm-svn: 40857
2007-08-06 06:17:08 +00:00
Chris Lattner
2eb1e7d1a9 Various random cleanups, add two accessors to DomTreeNode: getDFSNumIn/getDFSNumOut
llvm-svn: 40856
2007-08-06 06:15:43 +00:00
Reid Spencer
ade052e5cf Update links to the command guide generated documentation.
llvm-svn: 40855
2007-08-05 23:43:44 +00:00
Reid Spencer
446282ae3d Fix minor doxygen nits.
llvm-svn: 40854
2007-08-05 20:06:04 +00:00
Reid Spencer
5dc3672e45 Comment out configuration tags not supported by doxygen 1.3.9
llvm-svn: 40853
2007-08-05 19:51:03 +00:00
Reid Spencer
187b41ac8a Document a missing parameter.
llvm-svn: 40852
2007-08-05 19:36:39 +00:00
Reid Spencer
d959cfc882 Silence some warnings from doxygen about @param argument name not matching the
actual argument name of the documented function.

llvm-svn: 40851
2007-08-05 19:35:22 +00:00
Reid Spencer
f13bcdc4a4 Escape some escapes that confuse doxygen.
llvm-svn: 40850
2007-08-05 19:33:11 +00:00
Reid Spencer
05d55b396c Fix a doxygen directive.
llvm-svn: 40849
2007-08-05 19:27:01 +00:00
Dale Johannesen
b1888e73ad Long double patch 4 of N: initial x87 implementation.
Lots of problems yet but some simple things work.

llvm-svn: 40847
2007-08-05 18:49:15 +00:00
Chris Lattner
39d751058a allow this to pass on ppc hosts.
llvm-svn: 40846
2007-08-05 18:48:18 +00:00
Chris Lattner
6299a45277 shorten this name
llvm-svn: 40843
2007-08-05 18:45:33 +00:00
Chris Lattner
f0da7975ea at the end of instcombine, explicitly clear WorklistMap.
This shrinks it down to something small.  On the testcase
from PR1432, this speeds up instcombine from 0.7959s to 0.5000s,
(59%)

llvm-svn: 40840
2007-08-05 08:47:58 +00:00
Chris Lattner
4515601f1b Fix a bug in DenseMap::clear, where we never reset a tombstone
to EmptyKey.

llvm-svn: 40839
2007-08-05 08:43:36 +00:00
Chris Lattner
6493fc79fe Upgrade BasicAliasAnalysis::getModRefBehavior to not call Value::getName,
which dynamically allocates the string result.  This speeds up dse on the
testcase from PR1432 from 0.3781s to 0.1804s (2.1x).

llvm-svn: 40838
2007-08-05 07:50:06 +00:00
Chris Lattner
44f7d3aa0b When clearing a SmallPtrSet, if the set had a huge capacity, but the
contents of the set were small, deallocate and shrink the set.  This
avoids having us to memset as much data, significantly speeding up
some pathological cases.  For example, this speeds up the verifier
from 0.3899s to 0.0763 (5.1x) on the testcase from PR1432 in a 
release build.

llvm-svn: 40837
2007-08-05 07:32:14 +00:00
Steve Naroff
04e8bc8e35 Remove a space from "typeof" printing. It was causing the following error...
[dylan:clang/test/Parser] admin% ../../../../Debug/bin/clang -parse-ast-check typeof.c 
Warnings expected but not seen:
  Line 21: incompatible types assigning 'typeof(*pi) const' to 'int *'
Warnings seen but not expected:
  Line 21: incompatible types assigning 'typeof(*pi)  const' to 'int *'

Also corrected a typo from my previous commit.

llvm-svn: 40832
2007-08-05 03:24:45 +00:00
Steve Naroff
8a4cf97aa9 Make sure the good old "function/array conversion" is done to function parameters.
This resulted in the following error...

[dylan:clang/test/Parser] admin% cat parmvardecl_conversion.c 
// RUN: clang -parse-ast-check %s

void f (int p[]) { p++; }

[dylan:clang/test/Parser] admin% clang -parse-ast-check parmvardecl_conversion.c 
Errors seen but not expected:
  Line 3: cannot modify value of type 'int []'

With this fix, the test case above succeeds.

llvm-svn: 40831
2007-08-05 02:16:31 +00:00
Chris Lattner
d2eb0c9653 Fix an iterator invalidation bug I induced.
llvm-svn: 40830
2007-08-05 00:24:30 +00:00
Chris Lattner
0e8f85f87e Switch some std::sets to SmallPtrSet. This speeds up
domtree by 10% and postdomtree by 17%

llvm-svn: 40829
2007-08-05 00:15:57 +00:00
Chris Lattner
5f5585c432 Switch DomTreeNode::assignDFSNumber from using a std::set to using
a smallptrset.  This speeds up domtree by about 15% and postdomtree by 20%.

llvm-svn: 40828
2007-08-05 00:10:08 +00:00
Chris Lattner
77e05fe20d Switch the internal "Info" map from an std::map to a DenseMap. This
speeds up idom by about 45% and postidom by about 33%.

Some extra precautions must be taken not to invalidate densemap iterators.

llvm-svn: 40827
2007-08-05 00:02:00 +00:00
Chris Lattner
bd0fe01daf switch the DomTreeNodes and IDoms maps in idom/postidom to a
DenseMap instead of an std::map.  This speeds up postdomtree
by about 25% and domtree by about 23%.  It also speeds up clients,
for example, domfrontier by 11%, mem2reg by 4% and ADCE by 6%.

llvm-svn: 40826
2007-08-04 23:48:07 +00:00
Chris Lattner
edce70d2fe rewrite the code used to construct pruned SSA form with the IDF method.
In the old way, we computed and inserted phi nodes for the whole IDF of 
the definitions of the alloca, then computed which ones were dead and
removed them.

In the new method, we first compute the region where the value is live,
and use that information to only insert phi nodes that are live.  This
eliminates the need to compute liveness later, and stops the algorithm
from inserting a bunch of phis which it then later removes.

This speeds up the testcase in PR1432 from 2.00s to 0.15s (14x) in a
release build and 6.84s->0.50s (14x) in a debug build.

llvm-svn: 40825
2007-08-04 22:50:14 +00:00
Chris Lattner
d91576b01e Factor out a whole bunch of code into it's own method.
llvm-svn: 40824
2007-08-04 21:14:29 +00:00
Chris Lattner
4e1b4140eb Use getNumPreds(BB) instead of computing them manually. This is a very small but
measurable speedup.

llvm-svn: 40823
2007-08-04 21:06:15 +00:00
Chris Lattner
b6a4ba808b Change the rename pass to be "tail recursive", only adding N-1 successors
to the worklist, and handling the last one with a 'tail call'.  This speeds
up PR1432 from 2.0578s to 2.0012s (2.8%)

llvm-svn: 40822
2007-08-04 20:40:27 +00:00
Chris Lattner
840259c8d3 cache computation of #preds for a BB. This speeds up
mem2reg from 2.0742->2.0522s on PR1432.

llvm-svn: 40821
2007-08-04 20:24:50 +00:00
Chris Lattner
050bac4bed reserve operand space for phi nodes when we insert them.
llvm-svn: 40820
2007-08-04 20:14:34 +00:00
Chris Lattner
9318785df5 use continue to avoid nesting, no functionality change.
llvm-svn: 40819
2007-08-04 20:07:06 +00:00
Chris Lattner
6b04ecbaf9 Promoting allocas with the 'single store' fastpath is
faster than with the 'local to a block' fastpath.  This speeds
up PR1432 from 2.1232 to 2.0686s (2.6%)

llvm-svn: 40818
2007-08-04 20:03:23 +00:00
Chris Lattner
4a930f9444 When PromoteLocallyUsedAllocas promoted allocas, it didn't remember
to increment NumLocalPromoted, and didn't actually delete the
dead alloca, leading to an extra iteration of mem2reg.

llvm-svn: 40817
2007-08-04 20:01:43 +00:00
Chris Lattner
63c039780c std::map -> DenseMap
llvm-svn: 40816
2007-08-04 19:52:20 +00:00
Nick Lewycky
20f0811fc0 Clean up comments, fix up some confusing code logic.
Predsimplify fails llvm-gcc bootstrap.

llvm-svn: 40815
2007-08-04 18:45:32 +00:00
Chris Lattner
7d382f7680 fix a logic bug where we wouldn't promote single store allocas if the
stored value was a non-instruction value.  Doh.

This increase the # single store allocas from 8982 to 9026, and
speeds up mem2reg on the testcase in PR1432 from 2.17 to 2.13s.

llvm-svn: 40813
2007-08-04 02:45:02 +00:00
Chris Lattner
1b215f0661 When we do the single-store optimization, delete both the store
and the alloca so they don't get reprocessed.

This speeds up PR1432 from 2.20s to 2.17s.

llvm-svn: 40812
2007-08-04 02:38:38 +00:00
Chris Lattner
862f125457 Three improvements:
1. Check for revisiting a block before checking domination, which is faster.
  2. If the stored value isn't an instruction, we don't have to check for domination.
  3. If we have a value used in the same block more than once, make sure to remove the
     block from the UsingBlocks vector.  Not doing so forces us to go through the slow
     path for the alloca.

The combination of these improvements increases the number of allocas on the fastpath
from 8935 to 8982 on PR1432.  This speeds it up from 2.90s to 2.20s (31%)

llvm-svn: 40811
2007-08-04 02:32:22 +00:00
Chris Lattner
ae1e00eb36 switch from using a std::set to using a SmallPtrSet. This speeds up the
testcase in PR1432 from 6.33s to 2.90s (2.22x)

llvm-svn: 40810
2007-08-04 02:21:22 +00:00
Chris Lattner
9181801bb7 In mem2reg, when handling the single-store case, make sure to remove
a using block from the list if we handle it.  Not doing this caused us
to not be able to promote (with the fast path) allocas which have uses (whoops).

This increases the # allocas hitting this fastpath from 4042 to 8935 on the
testcase in PR1432, speeding up mem2reg by 2.6x

llvm-svn: 40809
2007-08-04 02:15:24 +00:00
Chandler Carruth
450f95c857 Regenerating.
llvm-svn: 40808
2007-08-04 01:56:21 +00:00
Chandler Carruth
7132e00de7 This is the patch to provide clean intrinsic function overloading support in LLVM. It cleans up the intrinsic definitions and generally smooths the process for more complicated intrinsic writing. It will be used by the upcoming atomic intrinsics as well as vector and float intrinsics in the future.
This also changes the syntax for llvm.bswap, llvm.part.set, llvm.part.select, and llvm.ct* intrinsics. They are automatically upgraded by both the LLVM ASM reader and the bitcode reader. The test cases have been updated, with special tests added to ensure the automatic upgrading is supported.

llvm-svn: 40807
2007-08-04 01:51:18 +00:00
Chris Lattner
886a41a007 split rewriting of single-store allocas into its own
method.

llvm-svn: 40806
2007-08-04 01:47:41 +00:00
Chris Lattner
3cede09c67 refactor some code to shrink PromoteMem2Reg::run a bit
llvm-svn: 40805
2007-08-04 01:41:18 +00:00
Chris Lattner
d524537fe9 add a typedef, no other change.
llvm-svn: 40804
2007-08-04 01:19:38 +00:00
Chris Lattner
df138be527 avoid an unneeded vector copy. This speeds up mem2reg on the testcase
in PR1432 by 6%

llvm-svn: 40803
2007-08-04 01:07:49 +00:00
Chris Lattner
fd838f0770 make RenamePassWorkList a local var instead of an ivar.
llvm-svn: 40802
2007-08-04 01:04:40 +00:00
Chris Lattner
81a9688e93 Implement codegen for __builtin_choose_expr. For example:
struct X { int A; };

void foo() {
  struct X s;
  int i;
  i = __builtin_choose_expr(0, s, i);
}

compiles to:

        %tmp = load i32* %i             ; <i32> [#uses=1]
        store i32 %tmp, i32* %i

wow :)

llvm-svn: 40801
2007-08-04 00:20:15 +00:00
Chris Lattner
374b06a080 the sse intrinsics are missing, leading to errors.
llvm-svn: 40800
2007-08-04 00:19:10 +00:00
Chris Lattner
2f48d5e2ed fix hang in testsuite
llvm-svn: 40799
2007-08-04 00:18:28 +00:00
Chris Lattner
c9a15cabdc fix constness issues.
llvm-svn: 40798
2007-08-04 00:14:36 +00:00
Dale Johannesen
b0c7585f2d Make x86 long double alignment 32 for everything but
Darwin (which makes size within a struct==96)

llvm-svn: 40796
2007-08-03 22:46:15 +00:00
Steve Naroff
0104731e62 Restrict vector component access (using "." and "[]") to variables.
Chris suggested this, since it simplifies the code generator.
If this features is needed (and we don't think it is), we can revisit.

The following test case now produces an error.
[dylan:~/llvm/tools/clang] admin% cat t.c

typedef __attribute__(( ocu_vector_type(4) )) float float4;

static void test() {
    float4 vec4;

    vec4.rg.g;
    vec4.rg[1];
}
[dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang t.c
t.c:8:12: error: vector component access limited to variables
    vec4.rg.g;
           ^~
t.c:9:12: error: vector component access limited to variables
    vec4.rg[1];
           ^~~
2 diagnostics generated.

llvm-svn: 40795
2007-08-03 22:40:33 +00:00
Steve Naroff
9efdabc565 Implement __builtin_choose_expr.
llvm-svn: 40794
2007-08-03 21:21:27 +00:00
Dale Johannesen
65c8a9ee9a long double patch 3 of N. Add to MVT.
llvm-svn: 40793
2007-08-03 20:51:37 +00:00
Dale Johannesen
c5283ecd6f long double patch 2 of N. Handle it in TargetData.
(I've tried to get the info right for all targets,
but I'm not expert on all of them - check yours.)

llvm-svn: 40792
2007-08-03 20:20:50 +00:00
Owen Anderson
2d19aae4ca Fix a subtle miscompilation. This allows 197.parser to be compiled correctly.
llvm-svn: 40791
2007-08-03 19:59:35 +00:00
Steve Naroff
7d451d614c Add a test case to validate code gen for typeof/builtin_types_compatible.
This test case currently generates the following unexpected warnings (when compared with gcc).

[dylan:clang/test/Parser] admin% ../../../../Debug/bin/clang -parse-ast-check builtin_types_compatible.c
Warnings seen but not expected:
  Line 28: expression result unused
  Line 29: expression result unused
  Line 30: expression result unused
  Line 31: expression result unused
  Line 32: expression result unused
  Line 33: expression result unused

llvm-svn: 40789
2007-08-03 18:38:22 +00:00
Chris Lattner
4048005ad8 implement codegen support for __builtin_types_compatible_p
llvm-svn: 40788
2007-08-03 17:51:03 +00:00
Chris Lattner
477ac778ed fix a buggy comment I added
llvm-svn: 40787
2007-08-03 17:47:51 +00:00
Chris Lattner
d268a7a268 Rename AddrLabel and OCUVectorComponent -> AddrLabelExpr and OCUVectorElementExpr respectively. This is for consistency with other expr nodes end with *Expr.
llvm-svn: 40785
2007-08-03 17:31:20 +00:00
Chris Lattner
b20b94de3a testcase for vector element access stuff.
llvm-svn: 40783
2007-08-03 16:42:43 +00:00
Chris Lattner
3a44aa7461 implement codegen for multidest ocuvector expressions, like:
vec2.yx = vec2; // reverse
 

llvm-svn: 40782
2007-08-03 16:37:04 +00:00
Chris Lattner
41d480e4d8 add codegen support for storing into a single-element ocu lvalue, such as:
vec2.x = f;

llvm-svn: 40781
2007-08-03 16:28:33 +00:00
Chris Lattner
40ff701674 refactor handling of ocuvector lvalue->rvalue codegen into its own method.
llvm-svn: 40780
2007-08-03 16:18:34 +00:00
Chris Lattner
fb837dccac In the common case where we are shuffling a vector, emit an
llvm vector shuffle instead of a bunch of insert/extract operations.
For:   vec4 = vec4.yyyy;  // splat

Emit:
        %tmp1 = shufflevector <4 x float> %tmp, <4 x float> undef, <4 x i32> < i32 1, i32 1, i32 1, i32 1 > 

instead of:

        %tmp1 = extractelement <4 x float> %tmp, i32 1          
        %tmp2 = insertelement <4 x float> undef, float %tmp1, i32 0             
        %tmp3 = extractelement <4 x float> %tmp, i32 1          
        %tmp4 = insertelement <4 x float> %tmp2, float %tmp3, i32 1             
        %tmp5 = extractelement <4 x float> %tmp, i32 1          
        %tmp6 = insertelement <4 x float> %tmp4, float %tmp5, i32 2             
        %tmp7 = extractelement <4 x float> %tmp, i32 1          
        %tmp8 = insertelement <4 x float> %tmp6, float %tmp7, i32 3             

llvm-svn: 40779
2007-08-03 16:09:33 +00:00
Chris Lattner
177bd450e0 add OCUVectorComponent::getNumComponents()
llvm-svn: 40778
2007-08-03 16:00:20 +00:00
Chris Lattner
a1036f9155 Add support for scalar-returning element accesses like V.x
llvm-svn: 40777
2007-08-03 15:52:31 +00:00
Owen Anderson
774761c503 Fix a subtle iterator invalidation bug in a recursive algorithm.
llvm-svn: 40776
2007-08-03 11:03:26 +00:00
Reid Spencer
d8a382f66d Prepare for "core" website.
llvm-svn: 40775
2007-08-03 05:43:35 +00:00
Dale Johannesen
ff4c3be741 Long double, part 1 of N. Support in IR.
llvm-svn: 40774
2007-08-03 01:03:46 +00:00
Chris Lattner
99fbf13dc3 add an observation
llvm-svn: 40772
2007-08-03 00:17:42 +00:00
Chris Lattner
73ab9b3c14 implement lvalue to rvalue conversion for ocuvector components. We can now compile stuff
like this:

typedef __attribute__(( ocu_vector_type(4) )) float float4;
float4 test1(float4 V) {
  return V.wzyx+V;
}

to:
_test1:
        pshufd  $27, %xmm0, %xmm1
        addps   %xmm0, %xmm1
        movaps  %xmm1, %xmm0
        ret

and:

_test1:
        mfspr r2, 256
        oris r3, r2, 4096
        mtspr 256, r3
        li r3, lo16(LCPI1_0)
        lis r4, ha16(LCPI1_0)
        lvx v3, r4, r3
        vperm v3, v2, v2, v3
        vaddfp v2, v3, v2
        mtspr 256, r2
        blr 

llvm-svn: 40771
2007-08-03 00:16:29 +00:00
Chris Lattner
9e751cae27 add support for codegen of an OCUVectorComponent as an lvalue.
We can now codegen:

  vec4.xy;

as nothing!

llvm-svn: 40769
2007-08-02 23:37:31 +00:00
Chris Lattner
885b4959b6 Add support for encoding a OCUVectorComponent into a single integer.
llvm-svn: 40768
2007-08-02 23:36:59 +00:00
Chris Lattner
30709dc432 oops, this is the real fix.
llvm-svn: 40766
2007-08-02 22:41:43 +00:00
Chris Lattner
7aa350019a update test
llvm-svn: 40765
2007-08-02 22:36:03 +00:00
Chris Lattner
7e152dbb1f rename some helpers, have them return the idx of the field being accessed.
llvm-svn: 40764
2007-08-02 22:33:49 +00:00
Chris Lattner
f1cb1c8d70 Use static methods, which don't require an instance of OCUVectorType
llvm-svn: 40763
2007-08-02 22:20:00 +00:00
Chris Lattner
585afabddd mark some methods static, don't consider a vector to be an ocuvector
llvm-svn: 40762
2007-08-02 22:19:39 +00:00
Chris Lattner
acbd22aaec silence some warnings.
llvm-svn: 40761
2007-08-02 21:50:34 +00:00
Chris Lattner
680918a6fc Minor comment improvements.
llvm-svn: 40760
2007-08-02 21:47:28 +00:00
Chris Lattner
181b01bcfd make sure we don't lose the ability to parse carbon.h
llvm-svn: 40759
2007-08-02 21:40:29 +00:00
Chris Lattner
1f70816c73 Fix an accidental commit.
llvm-svn: 40758
2007-08-02 21:33:36 +00:00
Dan Gohman
5f6a9da530 More explicit keywords.
llvm-svn: 40757
2007-08-02 21:21:54 +00:00
Dan Gohman
8932bff7fe Fix the alignment requirements of several unpck and shuf instructions.
Generalize isPSHUFDMask and add a unary SHUFPD pattern so that SHUFPD's
memory operand alignment can be tested as well, with a fix to avoid
breaking MMX's use of isPSHUFDMask.

llvm-svn: 40756
2007-08-02 21:17:01 +00:00
Dan Gohman
4d436e2b7d Fix pastos in vector arithmetic intrinsics.
llvm-svn: 40754
2007-08-02 21:06:40 +00:00
Owen Anderson
a8ba659976 Fix 80 col. violations.
llvm-svn: 40751
2007-08-02 18:20:52 +00:00
Owen Anderson
9699a6ea03 Fix 80 col. violations.
llvm-svn: 40750
2007-08-02 18:16:06 +00:00
Owen Anderson
e3590584b9 Fix 80 col. violations.
llvm-svn: 40749
2007-08-02 18:11:11 +00:00
Chris Lattner
3ffe7187db don't redefine a parameter
llvm-svn: 40748
2007-08-02 18:08:16 +00:00
Owen Anderson
0ac1fc8ac1 Fix a bug that was causing several miscompilations on SPEC.
llvm-svn: 40746
2007-08-02 17:56:05 +00:00
Christopher Lamb
531f260ac0 Implement review feedback.
llvm-svn: 40745
2007-08-02 17:52:00 +00:00
Chris Lattner
9ea0287e25 I don't have time to restore this functionality right now.
llvm-svn: 40743
2007-08-02 17:43:39 +00:00
Chris Lattner
dc2cf228ce Replacing a cast with another one does not reduce the number of
casts in the input.

llvm-svn: 40741
2007-08-02 17:23:38 +00:00
Chris Lattner
498137dbfc Reduced testcase for PR1594
llvm-svn: 40740
2007-08-02 17:11:24 +00:00
Chris Lattner
222b214be7 Disable an xform that causes an infinite loop. This fixes PR1594
llvm-svn: 40739
2007-08-02 16:56:32 +00:00
Chris Lattner
2740694450 wrap some long lines. Major offenders that are left include
gvn, gvnpre, dse, and predsimplify.  To see these, use:

  make check-line-length

llvm-svn: 40738
2007-08-02 16:53:43 +00:00
Devang Patel
a882328e61 Update dominator info for the middle blocks created while spliting
exit edge to preserve LCSSA.

Fix dominance frontier update during loop unswitch. This fixes PR 1589, again

llvm-svn: 40737
2007-08-02 15:25:57 +00:00
Dan Gohman
fa3eeeedc0 Mark the SSE and MMX load instructions that
X86InstrInfo::isReallyTriviallyReMaterializable knows how to handle
with the isReMaterializable flag so that it is given a chance to handle
them. Without hoisting constant-pool loads from loops this isn't very
visible, though it does keep CodeGen/X86/constant-pool-remat-0.ll from
making a copy of the constant pool on the stack.

llvm-svn: 40736
2007-08-02 14:27:55 +00:00
Reid Spencer
3d5386d545 Hyphenate a word, to check auto-update feature. Third times the charm!
llvm-svn: 40734
2007-08-02 09:58:41 +00:00
Reid Spencer
1d32b07d28 Expand a contraction to test auto-update on commit.
llvm-svn: 40733
2007-08-02 09:54:52 +00:00
Reid Spencer
28f1c63015 Test auto-update with minor grammaro fix.
llvm-svn: 40732
2007-08-02 09:50:49 +00:00
Chris Lattner
b0418fc607 Enhance instcombine to be more aggressive about folding casts of
operations of casts.  This implements InstCombine/zext-fold.ll

llvm-svn: 40726
2007-08-02 06:11:14 +00:00
Anders Carlsson
af8908451e Fix bug spotted by Chris.
llvm-svn: 40725
2007-08-02 06:05:19 +00:00
Anders Carlsson
cac9c624a1 Add extend and extOrTrunc methods that do sign or zero extension depending on whether the integer is signed or not
llvm-svn: 40724
2007-08-02 06:00:13 +00:00
Evan Cheng
473c5111c3 Switch some multiplication instructions over to the new scheme for testing.
llvm-svn: 40723
2007-08-02 05:48:35 +00:00
Evan Cheng
358c3d1dac Do not emit copies for physical register output if it's not used.
llvm-svn: 40722
2007-08-02 05:29:38 +00:00
Evan Cheng
824693c87a Fix test.
llvm-svn: 40721
2007-08-02 05:04:16 +00:00
Chris Lattner
d7cb625a9e Fix PR1575 and test/Transforms/CondProp/2007-08-01-InvalidRead.ll
llvm-svn: 40720
2007-08-02 04:47:05 +00:00
Chris Lattner
6a340b4351 Fix a bug in my previous commit
llvm-svn: 40719
2007-08-02 04:22:39 +00:00
Chris Lattner
016f19a37d switch a fixme to an assert.
llvm-svn: 40717
2007-08-02 04:14:33 +00:00
Steve Naroff
a5645cbea9 Tweak to Expr::isIntegerConstantExpr...make sure the result is appropriately size for TypesCompatibleExpr's.
llvm-svn: 40716
2007-08-02 04:09:23 +00:00
Chris Lattner
04e3d20a51 Increase the macro id cache to look up several recent entries, not just the last one.
This is important in insane cases like the one dannyb sent me recently:

#define F0(a) void a(){}
#define F1(a) F0(a##0) F0(a##1) F0(a##2) F0(a##3) F0(a##4) F0(a##5) F0(a##6) F0(a##7)
#define F2(a) F1(a##0) F1(a##1) F1(a##2) F1(a##3) F1(a##4) F1(a##5) F1(a##6) F1(a##7)
#define F3(a) F2(a##0) F2(a##1) F2(a##2) F2(a##3) F2(a##4) F2(a##5) F2(a##6) F2(a##7)
#define F4(a) F3(a##0) F3(a##1) F3(a##2) F3(a##3) F3(a##4) F3(a##5) F3(a##6) F3(a##7)
#define F5(a) F4(a##0) F4(a##1) F4(a##2) F4(a##3) F4(a##4) F4(a##5) F4(a##6) F4(a##7)
#define F6(a) F5(a##0) F5(a##1) F5(a##2) F5(a##3) F5(a##4) F5(a##5) F5(a##6) F5(a##7)
F6(f)

cpp is great.  :)

llvm-svn: 40715
2007-08-02 03:55:37 +00:00
Reid Spencer
e621b07e5e Adjust for new CallInst constructor interface.
This fixes test/Feature/llvm2cpp.ll

llvm-svn: 40714
2007-08-02 03:30:26 +00:00
Steve Naroff
4bd2f71cc7 Tidy up Parser::ParseTypeofSpecifier()...implement FIXME and minor restructure.
llvm-svn: 40713
2007-08-02 02:53:48 +00:00
Scott Michel
5b80ecbcf5 Style police: Expand the tabs to spaces!
llvm-svn: 40712
2007-08-02 02:22:46 +00:00
Christopher Lamb
1a80201426 Teach BasicAA about noalias parameter attributes, but do it correctly this time.
llvm-svn: 40711
2007-08-02 01:18:14 +00:00
Evan Cheng
c5549fc3a0 Instead of adding copyfromreg's to handle physical definitions. Now isel can
simply specify them as results and let scheduledag handle them. That
is, instead of
SDOperand Flag = DAG.getTargetNode(Opc, MVT::i32, MVT::Flag, ...)
SDOperand Result = DAG.getCopyFromReg(Chain, X86::EAX, MVT::i32, Flag)

Just write:
SDOperand Result = DAG.getTargetNode(Opc, MVT::i32, MVT::i32, ...)

And let scheduledag emit the move from X86::EAX to a virtual register.

llvm-svn: 40710
2007-08-02 00:28:15 +00:00
Evan Cheng
c9de9cec18 Added TargetInstrDescriptor::numDefs - num of results.
llvm-svn: 40709
2007-08-02 00:20:17 +00:00
Steve Naroff
ade1649e57 Add a couple const modifiers.
llvm-svn: 40708
2007-08-02 00:19:14 +00:00
Steve Naroff
b3deb2e112 Hack Expr::isConstantExpr() to allow for __builtin_types_compatible_p.
llvm-svn: 40705
2007-08-02 00:13:27 +00:00
Evan Cheng
d3d92890fc Can't handle offset and scale if rip-relative addressing is to be used.
llvm-svn: 40703
2007-08-01 23:46:47 +00:00
Evan Cheng
9a3b2b09ad Mac OS X X86-64 low 4G address not available.
llvm-svn: 40702
2007-08-01 23:46:10 +00:00
Evan Cheng
763cdfd371 Mac OS X X86-64 low 4G address not available.
llvm-svn: 40701
2007-08-01 23:45:51 +00:00
Steve Naroff
788d864d6c - Finish hooking up support for __builtin_types_compatible_p().
- Fix type printing code for recently added TypeOfExpr/TypeOfType.

llvm-svn: 40700
2007-08-01 23:45:51 +00:00
Devang Patel
34890b2f27 Undo previous check-in.
llvm-svn: 40698
2007-08-01 23:24:50 +00:00
Evan Cheng
58c3c30921 Some out operands were incorrectly specified as input operands.
llvm-svn: 40697
2007-08-01 23:07:38 +00:00
Reid Spencer
ae4675226e Make sure these tests pass for the right reasons (verifier error, rather than
failure to assemble).

llvm-svn: 40696
2007-08-01 23:07:36 +00:00
Devang Patel
561b0c29a3 Update dominator info for the middle blocks created while spliting
exit edge to preserve LCSSA.

Fix dominance frontier update during loop unswitch. This fixes PR 1589.

llvm-svn: 40695
2007-08-01 22:23:50 +00:00
Steve Naroff
7886467b35 Add AST/Sema support for __builtin_types_compatible_p (a GNU extension).
Todo...still need to call the action from the parser...

llvm-svn: 40693
2007-08-01 22:05:33 +00:00
Owen Anderson
c321e5e272 Make non-local memdep not be recursive, and fix a bug on 403.gcc that this exposed.
llvm-svn: 40692
2007-08-01 22:01:54 +00:00
Evan Cheng
da549ece5c Missing Requires.
llvm-svn: 40691
2007-08-01 21:42:24 +00:00
Evan Cheng
41ccce7169 New test. Bogus implicit-def prevented a copy from being coalesced.
llvm-svn: 40690
2007-08-01 20:26:40 +00:00
Evan Cheng
6f2ce6b842 Be more precise.
llvm-svn: 40689
2007-08-01 20:22:37 +00:00
Evan Cheng
d8ded48468 Bugs: missing partial uses and redundant partial defs.
llvm-svn: 40688
2007-08-01 20:18:21 +00:00
Lauro Ramos Venancio
e2e7e384e3 Add a test for the load/store alignment.
llvm-svn: 40687
2007-08-01 20:07:59 +00:00
Lauro Ramos Venancio
0db4418a5f Expand unaligned loads/stores when the target doesn't support them. (PR1548)
llvm-svn: 40682
2007-08-01 19:34:21 +00:00
Christopher Lamb
3567bd863f Clean up C++ restrict test cases and add a test for restrict qualified methods.
llvm-svn: 40681
2007-08-01 18:48:29 +00:00
Chris Lattner
bc1a69684c these tests aren't xfailed.
llvm-svn: 40680
2007-08-01 18:37:44 +00:00
Steve Naroff
a773cd5d15 Add comments to getTypeOfExpr/getTypeOfType.
Also add instances of TypeOfExpr/TypeOfType to the Types vector (so we can keep track of them).

llvm-svn: 40677
2007-08-01 18:02:17 +00:00
Steve Naroff
236becbbc3 Two typeof() related changes...
- Changed the name of ASTContext::getTypeOfType(Expr*)->getTypeOfExpr().
- Remove FIXME for TypeOfExpr::getAsStringInternal(). This will work fine for printing the AST. It isn't ideal
for error diagnostics (since it's more natural to display the expressions type). 

One "random" (or at least delayed:-) change...

- Changed all "ext_typecheck_*" diagnostics from EXTENSION->WARNING. Reason: Since -pedantic is now
off (by default), these diagnostics were never being emitted (which is bad). With this change, clang will
emit the warning all the time. The only downside (wrt GCC compatibility) is -pedantic-errors will not turn
this diagnostics into errors (a "feature" of making tagging them with EXTENSION). When/if this becomes
an issue, we can revisit.

llvm-svn: 40676
2007-08-01 17:20:42 +00:00
Chris Lattner
9182684222 we're now handling this right :)
llvm-svn: 40675
2007-08-01 17:10:30 +00:00
Owen Anderson
4d34e40c6d Forgot to update these files for the FastDSE changes.
llvm-svn: 40674
2007-08-01 16:53:51 +00:00
Dan Gohman
34d442f274 More explicit keywords.
llvm-svn: 40673
2007-08-01 15:32:29 +00:00
Dan Gohman
d541c831c3 Change a .size directive to use a tab instead of a space, for consistency.
llvm-svn: 40672
2007-08-01 14:42:30 +00:00
Dan Gohman
f7325ccf90 Make ImmutablePass::runOnModule non-virtual, since it is not
intended to be overridden.

llvm-svn: 40671
2007-08-01 14:28:20 +00:00
Owen Anderson
10e52eddb3 Rename FastDSE to just DSE.
llvm-svn: 40668
2007-08-01 06:36:51 +00:00
Owen Anderson
e4a374812b Move FastDSE in to DeadStoreElimination.
llvm-svn: 40667
2007-08-01 06:30:51 +00:00
Owen Anderson
4894e6d8bc Remove old DSE.
llvm-svn: 40666
2007-08-01 06:30:10 +00:00
Chris Lattner
7b9f04eb19 update this to build with LLVM ToT
llvm-svn: 40665
2007-08-01 06:24:52 +00:00
David Greene
c8e6508572 Update generated files.
llvm-svn: 40663
2007-08-01 03:59:32 +00:00
David Greene
17a5dfe6f7 New CallInst interface to address GLIBCXX_DEBUG errors caused by
indexing an empty std::vector.

Updates to all clients.

llvm-svn: 40660
2007-08-01 03:43:44 +00:00
Chris Lattner
bf2f38693e Print floating point literal values better.
llvm-svn: 40659
2007-08-01 00:23:58 +00:00
Evan Cheng
aa39b39eec Indexed loads each has 2 outputs.
llvm-svn: 40658
2007-08-01 00:12:08 +00:00
Evan Cheng
09a141df31 Requires SSE2.
llvm-svn: 40657
2007-08-01 00:10:12 +00:00
Steve Naroff
872da803b2 Tighten up Parser::ParseTypeofSpecifier().
Add some more tests to typeof.c. Also added a couple of missing "expect" attributes that caused the test to fail.

llvm-svn: 40656
2007-07-31 23:56:32 +00:00
Owen Anderson
10ffa860d8 Don't let the memory allocator outsmart GVN. ;-)
llvm-svn: 40655
2007-07-31 23:27:13 +00:00
Evan Cheng
e02b2d7e69 simpleregistercoalescing -> regcoalescing. It's too long for me to handle.
llvm-svn: 40654
2007-07-31 22:37:44 +00:00
Chris Lattner
0fd893e643 remove more explicit accesses to the canonical type pointer.
llvm-svn: 40653
2007-07-31 21:33:24 +00:00
Chris Lattner
e5a6cbd457 simplify some type checking code, don't explicitly access
canonical types.

llvm-svn: 40652
2007-07-31 21:27:01 +00:00
Chris Lattner
0ddc7ba2e5 move trivial type predicates inline.
llvm-svn: 40651
2007-07-31 21:13:58 +00:00
Owen Anderson
2464f4f048 Fix a failure I accidentally caused in my last commit by mishandling the
removal of redundant phis.

llvm-svn: 40650
2007-07-31 20:18:28 +00:00
Lauro Ramos Venancio
549e775e67 Fix a bug in GetKnownAlignment of packed structs.
llvm-svn: 40649
2007-07-31 20:13:21 +00:00
Dan Gohman
54ec4bfa5f Change the x86 assembly output to use tab characters to separate the
mnemonics from their operands instead of single spaces. This makes the
assembly output a little more consistent with various other compilers
(f.e. GCC), and slightly easier to read. Also, update the regression
tests accordingly.

llvm-svn: 40648
2007-07-31 20:11:57 +00:00
David Greene
87801e8773 Fix GLIBCXX_DEBUG error owing to dereference of end iterator. There's
no guarantee that an instruction returned by getDependency exists in
the maps.

llvm-svn: 40647
2007-07-31 20:01:27 +00:00
Chris Lattner
4197796f65 split the rest of the type predicates into pure predicates:
there is now an isXXXType and a getAsXXXType

llvm-svn: 40646
2007-07-31 19:29:30 +00:00
Chris Lattner
ba32aed8a9 add internals manual to project
llvm-svn: 40645
2007-07-31 18:57:09 +00:00
Chris Lattner
5070523a07 Owen pointed out that this made no sense :)
llvm-svn: 40644
2007-07-31 18:54:50 +00:00
Chris Lattner
ea23d287b5 add two missing files to the xcode project.
llvm-svn: 40643
2007-07-31 18:43:04 +00:00
Owen Anderson
d58fa6b09f Fix a misoptimization in aha.
llvm-svn: 40642
2007-07-31 17:43:14 +00:00
Dan Gohman
8c4da37b1f Use SCEVExpander::InsertCastOfTo instead of calling new IntToPtrInst
directly, because the insert point used by the SCEVExpander may vary
from what LSR originally computes.

llvm-svn: 40641
2007-07-31 17:22:27 +00:00
Chris Lattner
cd1d086b5a rename isReferenceType to follow the new scheme.
llvm-svn: 40640
2007-07-31 16:56:34 +00:00
Chris Lattner
c996b176e8 make isPointerType() a pure predicate, rename the
existing one to getAsPointerType()

llvm-svn: 40639
2007-07-31 16:53:04 +00:00
Devang Patel
d8b1ceb5b4 Add note.
llvm-svn: 40638
2007-07-31 16:52:25 +00:00
Chris Lattner
578611857d update name
llvm-svn: 40637
2007-07-31 16:50:51 +00:00
Chris Lattner
03708acd4e new testcase
llvm-svn: 40636
2007-07-31 16:18:25 +00:00
Christopher Lamb
283152404d Revert overly aggressive interpretation of noalias
llvm-svn: 40635
2007-07-31 16:18:07 +00:00
Reid Spencer
41aa656635 Regenerate.
llvm-svn: 40634
2007-07-31 14:41:17 +00:00
Reid Spencer
753163d95f fp2uint -> fptoui
llvm-svn: 40633
2007-07-31 14:40:14 +00:00
Reid Spencer
b6508349a7 After a discussion with Anton, it turns out that the InReg attribute is not
permitted on function results. So, revert the last patch to make it illegal.

llvm-svn: 40632
2007-07-31 14:39:10 +00:00
Steve Naroff
ad373bdcfe Add parsing and AST support for GNU "typeof".
Many small changes to lot's of files.
Still some FIXME's, however the basic support is in place.

llvm-svn: 40631
2007-07-31 12:34:36 +00:00
Devang Patel
dd34d91e1a Bunch of tests to check loop passes.
llvm-svn: 40629
2007-07-31 08:04:17 +00:00
Evan Cheng
12c6be84ff Redo and generalize previously removed opt for pinsrw: (vextract (v4i32 bc (v4f32 s2v (f32 load ))), 0) -> (i32 load )
llvm-svn: 40628
2007-07-31 08:04:03 +00:00
Devang Patel
d491198000 Loop unswitch preserves dom info.
Use simple analysis interface to preserve analysis info maintained by other loop passes.

llvm-svn: 40627
2007-07-31 08:03:26 +00:00
Devang Patel
b98a097ae9 Implement Simple Analysis interfaces - cloneBasicBlockAnalysis and deleteAnalysisValue.
llvm-svn: 40626
2007-07-31 08:01:41 +00:00
Devang Patel
cc2b233b62 Introduce Simple Analysis interface for loop passes.
Right now, this interface provides hooks for only to operations, 1) clone basic block 2) delete value.

llvm-svn: 40625
2007-07-31 08:00:57 +00:00
Christopher Lamb
b08423b36e Teach BasicAA about noalias function parameters. Passes all of DejaGNU and test-suite.
llvm-svn: 40624
2007-07-31 07:04:51 +00:00
Christopher Lamb
fc1bd87814 Un-XFAIL these tests after r40622 fixed them.
llvm-svn: 40623
2007-07-31 07:03:24 +00:00
Reid Spencer
861245172c Regenerate.
llvm-svn: 40621
2007-07-31 06:37:43 +00:00
Chris Lattner
49820d63dc Oops, I committed the wrong file before. This expands the description of
type.

llvm-svn: 40620
2007-07-31 06:37:39 +00:00
Reid Spencer
4f178405ad Allow the INREG parameter attribute to be added to functions. This permits the
function result to be passed in a register. This implements the GCC regparm
function attribute for llvm by translation to the InReg parameter attribute 
and fixes test/CFrontend/2002-07-30-SubregSetAssertion.c

llvm-svn: 40619
2007-07-31 06:37:27 +00:00
Reid Spencer
160e4faedc The InReg parameter attribute is valid on function results. The llvm-gcc-4.0
front end converts regparm attribute on the gcc function into InReg attribute 
on the llvm function. This fixes test/CFrontend/2002-07-30-SubrefSetAssertion.c

llvm-svn: 40618
2007-07-31 06:33:37 +00:00
Evan Cheng
242a87734a This isn't safe when there are uses of load's chain result.
llvm-svn: 40617
2007-07-31 06:21:44 +00:00
Chris Lattner
364439eb15 Fix PR1581, patch by Timo Savola
llvm-svn: 40616
2007-07-31 06:00:51 +00:00
Chris Lattner
c6684bc0c5 Add a start at a clang internals manual, documenting some
of the more subtle and interesting classes.

llvm-svn: 40615
2007-07-31 05:42:17 +00:00
Chris Lattner
bcb22a9c8d add a link
llvm-svn: 40614
2007-07-31 04:52:37 +00:00
Reid Spencer
66eb88bf48 Regenerate (again).
llvm-svn: 40613
2007-07-31 03:55:56 +00:00
Reid Spencer
36ded45e5d Don't include newlines in the whitespace before newline (WSNL) rule.
Fix the comment for WSNL to describe its actual function.

llvm-svn: 40612
2007-07-31 03:55:43 +00:00
Reid Spencer
22910a08a0 Regenerate.
llvm-svn: 40611
2007-07-31 03:50:36 +00:00
Reid Spencer
d45d07ac72 For PR1553:
Make the AsmParser auto-upgrade the old zext and sext
keywords for parameter attributes and handle the 
end-of-line ambiguity.

llvm-svn: 40610
2007-07-31 02:57:37 +00:00
Devang Patel
7d165e1d84 If loop can be unswitched again, then do it yourself.
llvm-svn: 40609
2007-07-30 23:07:10 +00:00
Anton Korobeynikov
187bf73b5d Add a comment: don't expect from external function resolver in interpreter
things, it wasn't designed to handle.

llvm-svn: 40608
2007-07-30 23:03:25 +00:00
Owen Anderson
850138157e Avoid potential iterator invalidation problems.
llvm-svn: 40607
2007-07-30 21:26:39 +00:00
Devang Patel
14fae50666 Remove dead code.
llvm-svn: 40606
2007-07-30 21:10:44 +00:00
Scott Michel
34e2d22d63 - Allow custom lowering for CTPOP, CTTZ, CTLZ.
- Fixed an existing unexpanded tab.

llvm-svn: 40605
2007-07-30 21:00:31 +00:00
Devang Patel
c5e340eded LCSSA preserves dom info.
llvm-svn: 40604
2007-07-30 20:23:45 +00:00
Devang Patel
698852561c Loop Rotation pass preserves dominator tree and frontier.
llvm-svn: 40603
2007-07-30 20:22:53 +00:00
Devang Patel
bb97ac4dce LICM preserves scalar evolution and dom frontier.
llvm-svn: 40602
2007-07-30 20:19:59 +00:00
Reid Spencer
32046f7b05 Regenerate for __dso_handle, per Anton's request.
llvm-svn: 40601
2007-07-30 20:13:24 +00:00
Anton Korobeynikov
7ac2521021 Add detection of __dso_handle presence during configure. Use this information in the
JITer (short path is added for darwin). This is needed to properly JIT llvm-gcc-4.2-built
binaries, since cxa_atexit is enabled by default on much more targets.

llvm-svn: 40600
2007-07-30 20:02:02 +00:00
Reid Spencer
dff9d69cfb Fix a typo/thinko.
llvm-svn: 40599
2007-07-30 19:53:57 +00:00
Dan Gohman
4ff9fb14f6 Fix a bug in getCopyFromParts turned up in the testcase for PR1132.
llvm-svn: 40598
2007-07-30 19:09:17 +00:00
Chris Lattner
fedeaa3045 Don't use canonical type for sema here. In
void func() {
typedef int foo;
foo *Y;
**Y; // error
}

we now get:
indirection requires pointer operand ('foo' invalid)
instead of:
indirection requires pointer operand ('int' invalid)

llvm-svn: 40597
2007-07-30 18:53:26 +00:00
Owen Anderson
212d5c27f6 Use more caching when computing non-local dependence. This makes bzip2 not
use up the entire 32-bit address space.

llvm-svn: 40596
2007-07-30 17:29:24 +00:00
Owen Anderson
d66e285b2e Fix a bug caused by indiscriminantly asking for the dominators of a predecessor.
llvm-svn: 40595
2007-07-30 16:57:08 +00:00
Dan Gohman
204dece054 Use tabs more consistently in assembler pseudo-ops.
llvm-svn: 40594
2007-07-30 15:08:02 +00:00
Dan Gohman
33d0ea2597 Print a space between the comment character and the basic block name,
for prettiness.

llvm-svn: 40593
2007-07-30 15:06:25 +00:00
Dan Gohman
941e2efd55 Fix the comments for the 'fast' parameter in addPassesToEmitFile.
llvm-svn: 40592
2007-07-30 15:04:59 +00:00
Dan Gohman
070a3f94a2 Remove a FIXME comment that wasn't removed when the code it accompanied
was removed.

llvm-svn: 40591
2007-07-30 15:01:09 +00:00
Dan Gohman
55360dacd4 Fix the comment for getClosestTargetForJIT to reflect the fact that
it does not have a Module parameter.

llvm-svn: 40590
2007-07-30 14:58:59 +00:00
Dan Gohman
e379f08b19 More explicit keywords.
llvm-svn: 40589
2007-07-30 14:51:59 +00:00
Dan Gohman
e6656eb4ad Fix pastos in comments for doFinalization functions.
llvm-svn: 40588
2007-07-30 14:51:13 +00:00
Evan Cheng
c8780b0ae9 New test case.
llvm-svn: 40587
2007-07-30 07:52:03 +00:00
Evan Cheng
581d2795dc Vector fneg must be expanded into fsub -0.0, X.
llvm-svn: 40586
2007-07-30 07:51:22 +00:00
Steve Naroff
2dc379a7ae Upgrade a comment...
llvm-svn: 40585
2007-07-30 03:52:55 +00:00
Steve Naroff
0d595ca0bb Finish up semantic analysis for vector components.
llvm-svn: 40584
2007-07-30 03:29:09 +00:00
Christopher Lamb
3fbfad3547 Add tests for generating noalias parameter attribute from __restrict qualified function parameters. C++ tests are currently XFAILing see PR1582.
llvm-svn: 40583
2007-07-29 23:29:16 +00:00
Reid Spencer
7717ff5368 Be explicit about which level of optimization is being asked for. The -O option
is equivalent to -O1.

llvm-svn: 40581
2007-07-29 18:23:22 +00:00
Steve Naroff
ddf5a1d7a6 Implement pretty diagnostics when doing on-the-fly vector sizing (for vector component access).
For example, before this commit, the following diagnostics would be emitted...

ocu.c:49:12: error: incompatible types assigning 'float  __attribute__((ocu_vector_type(3)))' to 'float4'
    vec4_2 = vec4.rgb; // shorten
    ~~~~~~ ^ ~~~~~~~~
ocu.c:51:7: error: incompatible types assigning 'float  __attribute__((ocu_vector_type(2)))' to 'float'
    f = vec2.xx; // shorten
    ~ ^ ~~~~~~~

Now, the diagnostics look as you would expect...

ocu.c:49:12: error: incompatible types assigning 'float3' to 'float4'
    vec4_2 = vec4.rgb; // shorten
    ~~~~~~ ^ ~~~~~~~~
ocu.c:51:7: error: incompatible types assigning 'float2' to 'float'
    f = vec2.xx; // shorten
    ~ ^ ~~~~~~~

llvm-svn: 40579
2007-07-29 16:33:31 +00:00
Christopher Lamb
5fecb80efa Change the x86 backend to use extract_subreg for truncation operations. Passes DejaGnu, SingleSource and MultiSource.
llvm-svn: 40578
2007-07-29 01:24:57 +00:00
Steve Naroff
f7a5da17d9 Added a new expression, OCUVectorComponent.
llvm-svn: 40577
2007-07-28 23:10:27 +00:00
Christopher Lamb
ac3a364c51 Add register info needed to use subreg sets on X86.
llvm-svn: 40572
2007-07-28 19:03:30 +00:00
Nick Lewycky
62989d6775 Make this explictly signed. Fixes PR1571.
llvm-svn: 40569
2007-07-28 16:43:10 +00:00
Steve Naroff
f8fd09e22b Implement syntax/semantic analysis for OCU Vector Components.
Next step, AST support...

llvm-svn: 40568
2007-07-27 22:15:19 +00:00
Devang Patel
004937bbd9 Add facility to dump pass manager structure
to make it easier to understand failure.

llvm-svn: 40567
2007-07-27 20:06:09 +00:00
Duncan Sands
ce38853cc6 Trampoline codegen support for X86-32.
llvm-svn: 40566
2007-07-27 20:02:49 +00:00
Duncan Sands
27e9159c00 Forget to add 'nest' to the list of parameter
attributes.

llvm-svn: 40565
2007-07-27 19:57:41 +00:00
Devang Patel
381a2a26e9 Fix edge cases in handling basic block split.
llvm-svn: 40564
2007-07-27 19:13:43 +00:00
Devang Patel
e3206cb425 Use SmallPtrSet.
llvm-svn: 40560
2007-07-27 18:34:27 +00:00
Chuck Rose III
1a39a2d13d VStudio compiler errors and placing Function*->ExFunc map under ManagedStatic control.
This commit fixes two things.  One is a pair of VStudio compiler errors stemming from variables
which defined within the for loop statement and also within the body of the for loop.  I fixed these 
by renaming one of the two variables.  Additionally, I've made the Function*->ExFunc map in 
ExternalFunctions.cpp a ManagedStatic object, so that cleanup will be done on llvm_shutdown.  In repeated
uses of the interpreter, where the same Function* address may get used for completely differnet functions,
this was causing a crash.

llvm-svn: 40558
2007-07-27 18:26:35 +00:00
Chuck Rose III
8e9869716c Updates to the VStudio project files:
1. Switch from VStudio 2k3 to VStudio 2k5

2. All pdb files now will be placed as $(OutputDir)/$(ProjectName).pdb.  This puts them alongside the 
binaries with the same base name as the binary.  If you need to copy the results of your llvm build 
into another project's tree, this will simplify that process.

3. Recent files added to the tree were added to the proejects within the VStudio project

4. Project build dependency order fixed so that the build can take place in one pass.  A generated
file was not being built at the correct time, causing a build error in about half the projects until
the build was run a second time.

Note you will need flex and bison installed an in your path in order to build properly.

llvm-svn: 40557
2007-07-27 18:20:11 +00:00
Owen Anderson
49f037ac29 Allow SmallPtrSet to hold pointers to const data.
llvm-svn: 40556
2007-07-27 18:07:02 +00:00
Dan Gohman
4788552deb Re-apply 40504, but with a fix for the segfault it caused in oggenc:
Make the alignedload and alignedstore patterns always require 16-byte
alignment. This way when they are used in the "Fs" instructions, in which
a vector instruction is used for a scalar purpose, they can still require
the full vector alignment. And add a regression test for this.

llvm-svn: 40555
2007-07-27 17:16:43 +00:00
Duncan Sands
5d49bcdce0 It seems logical that InReg should be incompatible
with StructReturn and ByVal, so make it so.

llvm-svn: 40554
2007-07-27 16:45:18 +00:00
Duncan Sands
07c9066238 As the number of parameter attributes increases,
Verifier::visitFunction is suffering a combinatorial
explosion due to the number of mutually incompatible
attributes.  This patch tidies the whole thing up
using attribute masks.  While there I fixed some
small bugs: (1) the ByVal attribute tests cast a
type to a pointer type, which can fail.  Yes, the
fact it is of a pointer type is checked before,
but a failing check does not cause the program
to exit, it continues on outputting further errors;
(2) Nothing was checking that an sret attribute is
on the first parameter; (3) nothing was checking that
a function for which isStructReturn() is true has a
parameter with the sret attribute and vice-versa (I
don't think it is possible for this to go wrong, but
it seems right to check it).

llvm-svn: 40553
2007-07-27 15:09:54 +00:00
Duncan Sands
644f917358 Support for trampolines, except for X86 codegen which is
still under discussion.

llvm-svn: 40549
2007-07-27 12:58:54 +00:00
Christopher Lamb
14bbb15f07 Move subreg lowering pass to be right after regalloc, per feedback.
llvm-svn: 40548
2007-07-27 07:36:14 +00:00
Evan Cheng
931de40afa Reverting 40504 for now. It's breaking oggenc.
llvm-svn: 40547
2007-07-27 01:37:47 +00:00
Devang Patel
a51e0a3d8d Fix thinko. Update return status appropriately.
llvm-svn: 40546
2007-07-26 20:21:42 +00:00
Owen Anderson
0f692f27a3 Fix a bug introduced in my last commit.
llvm-svn: 40542
2007-07-26 18:57:04 +00:00
Steve Naroff
c701ace221 Add Type::isOCUVectorType().
Convert isFunctionType(), isStructureType(), and isUnionType() to the new API.

llvm-svn: 40541
2007-07-26 18:32:01 +00:00
Owen Anderson
dbf23ccaa0 Fix a couple more bugs in the phi construction by pulling in code that does
almost the same things from LCSSA.

llvm-svn: 40540
2007-07-26 18:26:51 +00:00
Evan Cheng
dfa5d283fd Test case for PR1573.
llvm-svn: 40539
2007-07-26 17:45:57 +00:00
Evan Cheng
d204d08b97 Make sure epilogue esp adjustment is placed before any terminator and pop instructions.
llvm-svn: 40538
2007-07-26 17:45:41 +00:00
Evan Cheng
936d17aa1b Don't pollute the meaning of isUnpredicatedTerminator.
llvm-svn: 40537
2007-07-26 17:32:14 +00:00
Evan Cheng
e9ba8e0765 Fix test.
llvm-svn: 40536
2007-07-26 17:07:03 +00:00
Evan Cheng
ca6e041903 Minor bug.
llvm-svn: 40535
2007-07-26 17:02:45 +00:00
Dan Gohman
30f060be80 Fix the alias analysis query in DAGCombiner to not add in two
offsets. The SrcValueOffset values are the real offsets from the
SrcValue base pointers.

llvm-svn: 40534
2007-07-26 16:14:06 +00:00
Dan Gohman
6e853bc73f Move the GET_SIDE_EFFECT_INFO logic from isInstructionTriviallyDead
to Instruction::mayWriteToMemory, fixing a FIXME, and helping
various places that call mayWriteToMemory directly.

llvm-svn: 40533
2007-07-26 16:06:08 +00:00
Dan Gohman
eb47d9213c Remove a bogus return statement, what appears to have been a pasto
from Relation::contradicts in Relation::incorporate.

llvm-svn: 40531
2007-07-26 15:29:35 +00:00
Dan Gohman
f2af2bb6aa DummyInst's member functions don't need to be virtual.
llvm-svn: 40530
2007-07-26 15:25:08 +00:00
Dan Gohman
c9edd977ea In the .loc directive, print the fields as "debug" fields, so they
don't get decorated as if for immediate fields for instructions.

llvm-svn: 40529
2007-07-26 15:24:15 +00:00
Dan Gohman
cecd4b3793 Fix a whitespace difference between CMPSSrr and CMPSDrr.
llvm-svn: 40528
2007-07-26 15:11:50 +00:00
Dan Gohman
336718dd5c Fix a pasto in a comment.
llvm-svn: 40527
2007-07-26 15:11:00 +00:00
Steve Naroff
49ab97761b Fix the following bogus diagnostic...reported by Jeroen.
#include <stdio.h>

int
main(void) {
        int test = 0;

        printf("Type is %s\n", (test >= 1 ? "short" : "char"));

        return (0);
}

It comes up with a diagnostic that's misleading upon first read.

t.c:7:36: error: incompatible operand types ('char *' and 'char *')
        printf("Type is %s\n", (test >= 1 ? "short" : "char"));
                                          ^ ~~~~~~~   ~~~~~~
1 diagnostic generated.

llvm-svn: 40526
2007-07-26 14:35:56 +00:00
Christopher Lamb
e9d738cefc Add a MachineFunction pass, which runs post register allocation, that turns subreg insert/extract instruction into register copies. This ensures correct code gen if the coalescer isn't able to remove all subreg instructions.
llvm-svn: 40521
2007-07-26 08:18:32 +00:00
Christopher Lamb
18603b03e1 Teach DAG scheduling how to properly emit subreg insert/extract machine instructions. PR1350
llvm-svn: 40520
2007-07-26 08:12:07 +00:00
Christopher Lamb
2f3becc49c Have register info provide the inverse mapping of register->superregisters. PR1350
llvm-svn: 40519
2007-07-26 08:01:58 +00:00
Christopher Lamb
cde0ee5221 Add target independent MachineInstr's to represent subreg insert/extract in MBB's. PR1350
llvm-svn: 40518
2007-07-26 07:48:21 +00:00
Evan Cheng
ce5185b181 Same goes for constantpool, etc.
llvm-svn: 40517
2007-07-26 07:35:15 +00:00
Christopher Lamb
a8fc0e527b Add selection DAG nodes for subreg insert/extract. PR1350
llvm-svn: 40516
2007-07-26 07:34:40 +00:00
Christopher Lamb
d37b256f0e Fix 80 col violation.
llvm-svn: 40515
2007-07-26 07:03:08 +00:00
Christopher Lamb
0dbc152d2e Remove subreg index from MachineInstr's and also keep vregs as unsigned when adding operands.
llvm-svn: 40514
2007-07-26 07:00:46 +00:00
Christopher Lamb
c9ea29456a Teach TableGen about the new vector types.
llvm-svn: 40513
2007-07-26 06:41:18 +00:00
Chris Lattner
b50f1e4103 add another link.
llvm-svn: 40512
2007-07-26 06:11:49 +00:00
Chris Lattner
626246e93c don't expect to be able to reparse arbitrary system headers.
llvm-svn: 40511
2007-07-26 05:59:05 +00:00
Christopher Lamb
3fead96121 Fix infinite recursion for when extract_vector_elt is legal. Unfortunately no public targets use this code-path, so no test.
llvm-svn: 40510
2007-07-26 03:33:13 +00:00
Steve Naroff
62b35d41cd Forgot a return stmt (oops).
llvm-svn: 40509
2007-07-26 03:18:02 +00:00
Steve Naroff
185616f293 Various improvements to Sema::ParseMemberReferenceExpr().
- Added source range support to Diag's.
- Used the new type predicate API to remove dealing with the canonical
type explicitly.
- Added Type::isRecordType().
- Removed some casts.
- Removed a const qualifier from RecordType::getDecl(). 

llvm-svn: 40508
2007-07-26 03:11:44 +00:00
Christopher Lamb
6e082ad617 Fix comments for new types.
llvm-svn: 40507
2007-07-26 01:48:57 +00:00
Christopher Lamb
cd97a21064 Add support for 3 element 32-bit vector ValueTypes.
llvm-svn: 40506
2007-07-26 01:46:52 +00:00
Dan Gohman
8455bd3fae Remove X86ISD::LOAD_PACK and X86ISD::LOAD_UA and associated code from the
x86 target, replacing them with the new alignment attributes on memory
references.

llvm-svn: 40504
2007-07-26 00:31:09 +00:00
Owen Anderson
3b8cc30a61 Fix what is _hopefully_ the last corner case for loops.
llvm-svn: 40503
2007-07-25 23:54:42 +00:00
Evan Cheng
630c1f75b8 Mac OS X x86-64 lower 4G address is not available.
llvm-svn: 40502
2007-07-25 23:41:36 +00:00
Evan Cheng
952aa6988b Mac OS X should use 0x90 to fill in gaps to satisfy function alignment requirements.
llvm-svn: 40501
2007-07-25 23:36:05 +00:00
Evan Cheng
86eb3fd97d EmitAlignment() also emits optional fill value.
llvm-svn: 40500
2007-07-25 23:35:07 +00:00
Evan Cheng
5c6a31e9a0 Functions with LinkOnce and weak linkage still need to be aligned. Doh.
llvm-svn: 40499
2007-07-25 22:28:16 +00:00
Owen Anderson
8707412593 My last commit was not correct for nested loops. Fix it, and add a testcase for it.
llvm-svn: 40498
2007-07-25 22:19:40 +00:00
Owen Anderson
3c67004d47 Fix an infinite loop on 300.twolf.
llvm-svn: 40497
2007-07-25 22:03:06 +00:00
Owen Anderson
3f3ca5444e Forgot to include this file in my last commit.
llvm-svn: 40496
2007-07-25 21:30:15 +00:00
Owen Anderson
9b796348bd Fix a bug in non-local memdep that was causing an infinite loop on 175.vpr.
llvm-svn: 40495
2007-07-25 21:26:36 +00:00
Owen Anderson
7bf26ee444 Fix a bug that was causing GVN to crash on 252.eon.
llvm-svn: 40494
2007-07-25 21:13:41 +00:00
Devang Patel
b9f5c0c5be Fix example code.
llvm-svn: 40493
2007-07-25 21:05:39 +00:00
Steve Naroff
b8af1c2bf6 - Fix commit in Parser.h (patch by Kevin Andre).
- Add comment and minor cleanup to yesterday's fix to ParseCallExpr().

llvm-svn: 40492
2007-07-25 20:45:33 +00:00
Owen Anderson
5e5599b7ce Add basic support for performing whole-function RLE.
Note: This has not yet been thoroughly tested.  Use at your own risk.

llvm-svn: 40489
2007-07-25 19:57:03 +00:00
Chandler Carruth
fb95b0ea19 Moving regression test to reflect move in source and headers to Bitcode.
llvm-svn: 40488
2007-07-25 19:47:31 +00:00
Dan Gohman
cf0a5349de Don't ignore the return value of AsmPrinter::doInitialization and
AsmPrinter::doFinalization.

llvm-svn: 40487
2007-07-25 19:33:14 +00:00
Devang Patel
33227115b9 Add BasicInliner interface.
This interface allows clients to inline bunch of functions with module
level call graph information.:wq

llvm-svn: 40486
2007-07-25 18:00:25 +00:00
Chris Lattner
bc15ee2320 test commit
llvm-svn: 40484
2007-07-25 06:15:23 +00:00
Nick Lewycky
5805c46e8f Fix debug info and globals filled with zeros.
llvm-svn: 40483
2007-07-25 03:48:45 +00:00
Chris Lattner
02c0439a44 Fix a couple of bugs, add some new cool stuff.
1. Fix a todo in Parser::ParseTag, to recover better.  On code like
   that in test/Sema/decl-invalid.c it causes us to return a single
   error instead of multiple.
2. Fix an error in Sema::ParseDeclarator, where it would crash if the
   declarator didn't have an identifier.  Instead, diagnose the problem.
3. Start adding infrastructure to track the range of locations covered
   by a declspec or declarator.  This is mostly implemented for declspec,
   but could be improved, it is missing for declarator.

Thanks to Neil for pointing out this crash.

llvm-svn: 40482
2007-07-25 00:24:17 +00:00
Anton Korobeynikov
64b64ae591 Minor cleanup:
- Split EH and debug infiormation
 - Make DwarfWriter more verbose in some cases

llvm-svn: 40481
2007-07-25 00:06:28 +00:00
Dan Gohman
f0bb12848f Add const to CanBeFoldedBy, CheckAndMask, and CheckOrMask.
llvm-svn: 40480
2007-07-24 23:00:27 +00:00
Dan Gohman
5a629d4cee A minor simplication in the generated code.
llvm-svn: 40479
2007-07-24 22:58:00 +00:00
Dan Gohman
f906c7286f Use movaps to load a v4f32 build_vector of all-constant values into a
register instead of loading each element individually.

llvm-svn: 40478
2007-07-24 22:55:08 +00:00
Owen Anderson
d998be79cc Add initial support for non-local memory dependence analysis.
NOTE: This has only been cursorily tested.  Expected improvements soon.

llvm-svn: 40476
2007-07-24 21:52:37 +00:00
Steve Naroff
44fd8ff400 Fix Sema::ParseCallExpr()...it wasn't doing the default array/function promotions on it's argument types.
This resulted in the following errors when compiling promote_types_in_proto.c test...

[dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang test/Parser/promote_types_in_proto.c 
test/Parser/promote_types_in_proto.c:7:24: error: incompatible types passing 'char *[]' to function expecting 'char *const []'
        arrayPromotion(argv);
        ~~~~~~~~~~~~~~ ^~~~
test/Parser/promote_types_in_proto.c:8:27: error: incompatible types passing 'void (char *const [])' to function expecting 'void (char *const [])'
        functionPromotion(arrayPromotion);
        ~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~
2 diagnostics generated.

When fixing this, noticed that both ParseCallExpr() and ParseReturnStmt() were prematurely comparing types for
equivalence. This is incorrect (since the expr. promotions haven't been done yet). To fix this, I moved the
check "down" to Sema::CheckAssignmentConstraints().

I also converted Type::isArrayType() to the modern API (since I needed it). Still more Type predicates to 
convert.

llvm-svn: 40475
2007-07-24 21:46:40 +00:00
Owen Anderson
4c54024319 Make the copy constructor of SmallPtrSet much faster.
llvm-svn: 40474
2007-07-24 21:31:23 +00:00
Anton Korobeynikov
0c46451d2b Heal EH handling stuff by emitting correct offsets to callee-saved registers.
Pretty hackish, but code itself is dirty mess, so we won't make anything worse. :)

llvm-svn: 40472
2007-07-24 21:07:39 +00:00
Chris Lattner
0443a76b11 add documentation skeleton
llvm-svn: 40471
2007-07-24 18:03:18 +00:00
Chris Lattner
b3aee6e87f add a bare bones web page
llvm-svn: 40470
2007-07-24 17:59:54 +00:00
Owen Anderson
ab6ec2eac2 Add a GVN pass, using the value numbering code I developed for GVNPRE and the
load elimination code from RedundantLoadElimination.

llvm-svn: 40469
2007-07-24 17:55:58 +00:00
Chris Lattner
01e4b243c9 Fix a comment, patch by Kevin Andre!
llvm-svn: 40466
2007-07-24 17:03:04 +00:00
Chris Lattner
366727fca1 implement ast building and trivial semantic analysis of stmt exprs.
This implements test/Sema/stmt_exprs.c

llvm-svn: 40465
2007-07-24 16:58:17 +00:00
Reid Spencer
a2e618712d Make output match actual condition tested. Thanks, Duncan.
llvm-svn: 40464
2007-07-24 14:35:44 +00:00
Chris Lattner
1af0e0116a avoid std::string yet again.
llvm-svn: 40462
2007-07-24 06:59:01 +00:00
Chris Lattner
4c4a245475 Use a smallstring instead of an std::string in FileChanged to avoid some malloc traffic.
This speeds up -E on xalancbmk by 2.4%

llvm-svn: 40461
2007-07-24 06:57:14 +00:00
Chris Lattner
830a77fd65 check in an experiment that didn't work out, to allow for future investigation.
llvm-svn: 40460
2007-07-24 06:43:46 +00:00
Chris Lattner
8996ffffe5 Add a cache to SourceManager to accellerate line # lookup. This is a
bottleneck for -E computation, because every token that starts a line needs
to determine *which* line it is on (so -E mode can insert the appropriate 
vertical whitespace).  This optimization improves this common case where
it is striding through the line # table.

This speeds up -E on xalancbmk by 3.2%

llvm-svn: 40459
2007-07-24 05:57:19 +00:00
Devang Patel
13b25df0e9 Unreachable block is not a root node in post dominator tree.
llvm-svn: 40458
2007-07-24 01:02:25 +00:00
Owen Anderson
9baaaa52e6 Rename a lot of things to change FastDLE to RedundantLoadElimination.
llvm-svn: 40457
2007-07-24 00:17:04 +00:00
Owen Anderson
7292a4a93f Rename FastDLE as RedundantLoadElimination.
llvm-svn: 40456
2007-07-24 00:08:38 +00:00
Reid Spencer
0f8fd66a62 1. Make sure we print the Function Value for parameter attribute errors
2. Fold an if statement into the Assert1 macro call.

llvm-svn: 40455
2007-07-23 23:46:43 +00:00
Chris Lattner
d63c8a5963 Fix two paste-avoidance bugs I introduced last night. Patch
by Neil Booth.  This fixes Preprocessor/output_paste_avoid.c

llvm-svn: 40454
2007-07-23 23:21:34 +00:00
Reid Spencer
6c2b393f0c Add better verification of attributes on function types. It is not permitted
to use sret or inreg on the function. It is equally illegal to use noreturn
or nounwind on a parameter; they only go with the function. This patch
enforces these rules.

llvm-svn: 40453
2007-07-23 23:09:55 +00:00
Chris Lattner
49a953ab13 fix bogus warnings about potentially uninit vars Size and Align.
Patch by Neil Booth!

llvm-svn: 40452
2007-07-23 22:46:22 +00:00
Chandler Carruth
1b37d5b019 Fix for PR1567, which involves a weird bug on non-32bit architectures and silly C type sizes.
llvm-svn: 40451
2007-07-23 22:42:15 +00:00
Chris Lattner
f97dbcb4ba Fix a scoping bug that apple gcc doesn't catch for some reason.
llvm-svn: 40450
2007-07-23 22:23:52 +00:00
Owen Anderson
0a75315d35 Add testcases for FastDLE.
llvm-svn: 40449
2007-07-23 22:18:05 +00:00
Owen Anderson
5e68f0c93d Don't delete volatile loads. Doing so is not safe.
llvm-svn: 40448
2007-07-23 22:05:54 +00:00
Owen Anderson
70fce4c689 Forgot to commit this file.
llvm-svn: 40447
2007-07-23 22:00:03 +00:00
Owen Anderson
21d76e4a0c Fix a comment.
llvm-svn: 40446
2007-07-23 21:51:37 +00:00
Owen Anderson
6aba721425 Add FastDLE, the load-elimination counterpart of FastDSE.
llvm-svn: 40445
2007-07-23 21:48:08 +00:00
Owen Anderson
59a6840d47 Move these tests to use FastDSE instead of old DSE.
llvm-svn: 40444
2007-07-23 20:49:13 +00:00
Dan Gohman
b6a8ae20c7 Fix some uses of dyn_cast to be uses of cast.
llvm-svn: 40443
2007-07-23 20:24:29 +00:00
Dan Gohman
17f68f95d8 Delete the svn:executable property on these files, which aren't executable.
llvm-svn: 40441
2007-07-23 19:26:08 +00:00
Owen Anderson
5a201baba9 Fix file header.
llvm-svn: 40440
2007-07-23 18:30:37 +00:00
Chris Lattner
4512cd2cab completely remove a transformation that is unsafe in the face of
undefs.

llvm-svn: 40439
2007-07-23 17:10:17 +00:00
Chris Lattner
54f4d2bd57 correctly verify that default and case are in a switchstmt,
this fixes test/Sema/switch.c.

llvm-svn: 40438
2007-07-23 17:05:23 +00:00
Duncan Sands
b063fa59d3 The Ada f-e produces various auxiliary output files
that cannot be suppressed and cannot be redirected:
they are dumped in the current working directory.
When running the testsuite this means that these
files do not end up in the Output directory.  The
best solution I could find is to change directory
into Output before running tests.

llvm-svn: 40437
2007-07-23 15:23:35 +00:00
Duncan Sands
1747440364 For multipart tests, place the parts with no
RUN line in Support.  Give up on sending output
to /dev/null - this cannot always be arranged.

llvm-svn: 40436
2007-07-23 13:41:53 +00:00
Reid Spencer
fcd7815249 Restore ability to build archives (oops)
Fix -include line so it doesn't reference /dev/null

llvm-svn: 40429
2007-07-23 08:20:46 +00:00
Reid Spencer
63ebdf7994 Remove bizarre use of /dev/null in a makefile include line that
produces warning from make about bad timestamp on /dev/null

Patch by Holger Schurig.

llvm-svn: 40426
2007-07-23 08:09:15 +00:00
Chris Lattner
5cdfebbf10 avoid creating std::strings in MoveToLine
llvm-svn: 40424
2007-07-23 06:31:11 +00:00
Chris Lattner
93c4ea75ec In OutputString, avoid calling memcpy for really tiny strings.
This speeds up -E on 447.dealII by 5.8%

llvm-svn: 40423
2007-07-23 06:23:07 +00:00
Chris Lattner
0af9823e4d Avoid calling getSpelling at all for identifiers, which are
trivial to handle and very very common.  This speeds up -E on 
447.dealII by 2.5%

llvm-svn: 40422
2007-07-23 06:14:36 +00:00
Chris Lattner
4418ce1091 change the concatenation avoidance algorithm to be partially table-driven
and avoid computing the spelling of tokens when not needed.  This speeds
up -E on 447.dealII by 2.2%

llvm-svn: 40421
2007-07-23 06:09:34 +00:00
Chris Lattner
e4c566c604 If a token doesn't need cleaning, we can get its first character
without having to get the whole token.  This speeds up -E on 
447.dealII by 1.8%

llvm-svn: 40420
2007-07-23 05:18:42 +00:00
Chris Lattner
5f075827bf A minor tweak to -E output, speeding up -E 1.5% on 447.dealII
llvm-svn: 40419
2007-07-23 05:14:05 +00:00
Chris Lattner
43eafb4ed5 implement a missing feature in the #include handler, where
it did not handle <xyz> headers coming from macro expansions.
This requires special treatment, as the include name is lexed
as multiple tokens, which require reassembly before processing.

llvm-svn: 40418
2007-07-23 04:56:47 +00:00
Bill Wendling
803a639cff Fix some validation errors.
llvm-svn: 40417
2007-07-23 04:44:02 +00:00
Bill Wendling
922169c385 Converted to "svn" and reformatted.
llvm-svn: 40416
2007-07-23 04:41:42 +00:00
Reid Spencer
ec5058eb96 Remove dead option.
llvm-svn: 40415
2007-07-23 04:23:32 +00:00
Chris Lattner
93ab9f134e refactor the interface to Preprocessor::GetIncludeFilenameSpelling,
no functionality changes.

llvm-svn: 40414
2007-07-23 04:15:27 +00:00
Bill Wendling
d0c5c282de Small change.
llvm-svn: 40413
2007-07-23 03:56:42 +00:00
Bill Wendling
9f1b2d9491 Point to the correct SVN repository.
llvm-svn: 40412
2007-07-23 03:56:11 +00:00
Bill Wendling
3d88e9940a Add missing SSE builtins:
__builtin_ia32_cvtss2si64
    __builtin_ia32_cvttss2si64
    __builtin_ia32_cvtsi642ss
    __builtin_ia32_cvtsd2si64
    __builtin_ia32_cvttsd2si64
    __builtin_ia32_cvtsi642sd

llvm-svn: 40411
2007-07-23 03:07:27 +00:00
Chris Lattner
32e6d64176 fix a bug getting the spelling of an identifier token
that required cleaning.  If the token required cleaning,
don't include the cleaned tokens in the returned length.

llvm-svn: 40410
2007-07-22 22:50:09 +00:00
Chris Lattner
7dd7a1d310 no need to avoid pasting >* It can't form ->*, because we know the previous
token was not -> and if the token before it was -, the - and > would avoid pasting.

llvm-svn: 40409
2007-07-22 22:33:25 +00:00
Chris Lattner
d956fcac86 GCC doesn't set __STDC_VERSION__ usually. It never sets it in
C++ mode, even gnu C++ mode.

llvm-svn: 40408
2007-07-22 22:11:35 +00:00
SVN to Git Conversion
afb1d31c54 Delete stacker project.
(Commit inserted retroactively during svn2git conversion)
2007-07-22 21:53:06 +00:00
Reid Spencer
9be3ca0a1f Modernize llvm-top support.
llvm-svn: 40406
2007-07-22 21:53:05 +00:00
Reid Spencer
71ce927d7b Report an error if one occurs in releaseModule.
llvm-svn: 40405
2007-07-22 21:39:37 +00:00
Chris Lattner
a81b336ba8 Switch TargetInfo::getTargetDefines from using an std::map<std::string, ...> to using
a llvm::StringMap.  This dramatically reduces the startup time of the preprocessor,
speeding up -Eonly on xalankbmk by 2.2%.

llvm-svn: 40396
2007-07-22 20:11:46 +00:00
Chris Lattner
3284ad1b1f Disable the string map copy ctor and assignment operators,
they don't do the right thing.  

Implement StringMap::erase.

Fix a nasty bug in the default ctor.

llvm-svn: 40395
2007-07-22 20:08:01 +00:00
Chris Lattner
5d1c02748f Change hte lexer to start a start pointer to the underlying
memorybuffer instead of a pointer to the memorybuffer itself.  This
reduces coupling and eliminates a pointer dereference on a hot path.
This speeds up -Eonly on 483.xalancbmk by 2.1%

llvm-svn: 40394
2007-07-22 18:44:36 +00:00
Chris Lattner
619c174561 split the slow path out of Lexer::getSourceLocation and do not let the
compiler inline it.  This speeds up -Eonly on 483.xalancbmk by about 1%

llvm-svn: 40393
2007-07-22 18:38:25 +00:00
Duncan Sands
337e9c5b20 Remove -O1 in favour of making llvm-gcc-4.2 a bit
smarter.

llvm-svn: 40391
2007-07-22 10:25:44 +00:00
Chris Lattner
d427542a9b Implement a simple cache in headersearch. This speeds up
preprocessing 483.xalancbmk by about 10%, reducing the number
of file lookup queries from 2139411 to 199466 (over 10x)

llvm-svn: 40390
2007-07-22 07:28:00 +00:00
Anders Carlsson
51873c22d8 Refactor switch analysis to make it possible to detect duplicate case values
llvm-svn: 40388
2007-07-22 07:07:56 +00:00
Chris Lattner
9c691703ce remove redundant test
llvm-svn: 40386
2007-07-22 06:40:36 +00:00
Chris Lattner
9b7962495f avoid a small bit of string traffic by not storing the ""'s around a string in CurFilename
llvm-svn: 40385
2007-07-22 06:38:50 +00:00
Chris Lattner
b9b8597c23 avoid recursion between SkipBCPLComment and SkipWhitespace. In cases like this:
// foo
   // bar
   // baz

we'd get two levels of call (bcpl & whitespace) for each line, leading to some
seriously deep stacks in some cases.

llvm-svn: 40384
2007-07-22 06:29:05 +00:00
Chris Lattner
6b4db176ea when running in -E mode on multiple files, there is no reason to accumulate
fileid's and macroid's across files.  Clearing between files keeps the tables
smaller and slightly speeds up compilation.

llvm-svn: 40383
2007-07-22 06:05:44 +00:00
Chris Lattner
e34b2c298a Catch goto's with a missing identifier, patch by Neil Booth.
llvm-svn: 40381
2007-07-22 04:13:33 +00:00
Chris Lattner
9c724c48ea Fix a really subtle bug in the macro expander caching code, where
redefinition of a macro could cause invalid memory to be deleted.
Found preprocessing 253.perlbmk.

llvm-svn: 40380
2007-07-22 01:16:55 +00:00
Chris Lattner
c850ad6ee1 Fix a lexer bug where we incorrectly rejected
int i = /*/ */ 1;

Thanks to Neil for pointing this out.

llvm-svn: 40379
2007-07-21 23:43:37 +00:00
Chris Lattner
7649abce46 This xform isn't safe, removing it.
llvm-svn: 40378
2007-07-21 21:27:27 +00:00
Steve Naroff
a12a6c986a Minor simplification to Expr::isLvalue().
llvm-svn: 40375
2007-07-21 13:32:03 +00:00
Reid Spencer
737e8a7e22 Update for changes in library.sh
llvm-svn: 40371
2007-07-21 09:33:41 +00:00
Chris Lattner
2e380893e3 Add support for reusing macroid's with negative physical loc deltas. This
keeps the MacroInfo table more compact.

llvm-svn: 40281
2007-07-21 06:41:57 +00:00
Chris Lattner
43c0ed6333 implement getSourceRange for ImplicitCast
llvm-svn: 40264
2007-07-21 06:32:11 +00:00
Chris Lattner
833894bcac Return an exit code of 1 if errors occur, not an exit code equal to the # errors :)
llvm-svn: 40189
2007-07-21 05:40:53 +00:00
Chris Lattner
0f4faa1a59 minor simplifications
llvm-svn: 40176
2007-07-21 05:33:26 +00:00
Chris Lattner
fd5e05f5ce testcase from neil
llvm-svn: 40173
2007-07-21 05:32:22 +00:00
Chris Lattner
e386fab8ac recover from void argument types more nicely.
llvm-svn: 40169
2007-07-21 05:30:18 +00:00
Chris Lattner
26a1b3c6f7 better wording for an error, suggested by Neil.
llvm-svn: 40163
2007-07-21 05:26:43 +00:00
Anders Carlsson
625bfc8716 Implement code generation for __func__, __FUNCTION__ and __PRETTY_FUNCTION__
llvm-svn: 40162
2007-07-21 05:21:51 +00:00
Chris Lattner
5abb82c353 improve and simplify error recovery for calls, fix a crash when diagnosing
invalid arguments.

llvm-svn: 40161
2007-07-21 05:18:12 +00:00
Chris Lattner
bb0ab46fd8 fix a warning on some compilers
llvm-svn: 40139
2007-07-21 04:57:45 +00:00
Chris Lattner
bb26836c35 add an evil macro expansion perf test from Neil.
llvm-svn: 40138
2007-07-21 04:54:14 +00:00
Chris Lattner
a6f5ab5425 Fix off-by-one error when emitting diagnostics. Also, make diagnostic
a bit nicer for people who pass lots of extra arguments to calls by 
selecting them all instead of just the first one:

arg-duplicate.c:13:13: error: too many arguments to function
  f3 (1, 1, 2, 3, 4);   // expected-error {{too many arguments to function}}
            ^~~~~~~

This implements test/Sema/arg-duplicate.c, thanks to Neil for pointing
out this crash.

llvm-svn: 40136
2007-07-21 03:09:58 +00:00
Chris Lattner
38dbdb2c9c move some casts up to the entry of the function for clarity.
llvm-svn: 40135
2007-07-21 03:03:59 +00:00
Chris Lattner
3940737edf Two fixes:
1) fix a crash on test/Sema/default.c by making
   sure that the switch scope is non-null.
2) if there is an error sema'ing a default or case stmt,
   make sure to return the substmt up, so that the error
   recovery code has more acurate info to continue with.

llvm-svn: 40134
2007-07-21 03:00:26 +00:00
Devang Patel
5e39293e62 Apply temporary work around to fix llvm mis-compilation
reported in PR 1556.

llvm-svn: 40133
2007-07-21 00:34:29 +00:00
Evan Cheng
ac1591be42 No more noResults.
llvm-svn: 40132
2007-07-21 00:34:19 +00:00
Dan Gohman
147d9fa57d Don't assume that only Uses can be kills. Defs are marked as kills initially
when there are no uses. This fixes a dangling-pointer bug, where pointers to
deleted instructions were not removed from kills lists. More info here:
http://lists.cs.uiuc.edu/pipermail/llvmdev/2007-July/009749.html

llvm-svn: 40131
2007-07-20 23:17:34 +00:00
Dan Gohman
0648c694c8 Simplify the logic for setVolatile.
llvm-svn: 40130
2007-07-20 23:14:50 +00:00
Duncan Sands
e5bd260ffc Need -O1 or better to have these builtins lowered to
llvm intrinsics in llvm-gcc-4.2.  This is because
get_pointer_alignment bails out: it relies on TER
to compute accurate alignment information.

llvm-svn: 40128
2007-07-20 22:39:06 +00:00
Chris Lattner
363485da82 zext(undef) = 0 and sext(undef) = 0, not undef.
This hopefully fixes a miscompilation of TargetData.cpp when self hosting.

llvm-svn: 40125
2007-07-20 22:09:02 +00:00
Chris Lattner
d82e4a19cc this xform is already done by the constant folder.
llvm-svn: 40124
2007-07-20 22:06:41 +00:00
Evan Cheng
9d5df0a5f6 Added -print-emitted-asm to print out JIT generated asm to cerr.
llvm-svn: 40123
2007-07-20 21:56:13 +00:00
Reid Spencer
7a7fd0b533 Update to include clean and install commands.
llvm-svn: 40119
2007-07-20 20:54:41 +00:00
Chandler Carruth
fd418435be No longer referencing "shared memory" as this can confuse people. The memory is
clearly shared between processors if these instructions are being used, no 
further specification of what type of memory is necessary.

llvm-svn: 40118
2007-07-20 20:14:52 +00:00
Reid Spencer
65a72e3775 Silly HTML
llvm-svn: 40117
2007-07-20 20:03:33 +00:00
Reid Spencer
5b2cb0f88c Fix validation errors.
llvm-svn: 40116
2007-07-20 19:59:11 +00:00
Chandler Carruth
6a5f6bf685 This introduces the atomic operation intrinsics into the documentation. This is
a preview for the intrinsics that are going to be implemented over the next few 
weeks.

llvm-svn: 40115
2007-07-20 19:34:37 +00:00
Owen Anderson
74f833bce1 Make the heuristic for shrinking DenseMap smarter.
llvm-svn: 40114
2007-07-20 18:56:46 +00:00
Chris Lattner
9802144709 Fix a valgrind error noticed by Benoit Boissinot
llvm-svn: 40113
2007-07-20 18:48:28 +00:00
Chris Lattner
e60b21c0b5 remove some old cruft
llvm-svn: 40111
2007-07-20 18:26:45 +00:00
Chris Lattner
ab41b13c90 fix a nasty bug Owen noticed in a gcc warning.
llvm-svn: 40110
2007-07-20 18:13:33 +00:00
Devang Patel
8adae86688 Use SmallVector instead of std::vector.
llvm-svn: 40109
2007-07-20 18:04:54 +00:00
Chris Lattner
ca8ebc095b improve comments, implement a trivial single-entry cache in
SourceManager::getInstantiationLoc.  With this change, every token
expanded from a macro doesn't get its own MacroID.  :)

This reduces # macro IDs in carbon.h from 16805 to 9197

llvm-svn: 40108
2007-07-20 18:00:12 +00:00
Chandler Carruth
5dfeb9940c Fixing some differences between CVS and SVN diff'ing. Reid fixed these already,
but I think it got lost in the conversion mess.

llvm-svn: 40107
2007-07-20 17:21:54 +00:00
Chris Lattner
f14d03f515 Update project for LexerToken.h -> Token.h
llvm-svn: 40106
2007-07-20 17:01:09 +00:00
Chris Lattner
146762e7a4 At one point there were going to be lexer and parser tokens.
Since that point is now long gone, we should rename LexerToken to
Token, as it is the only kind of token we have.

llvm-svn: 40105
2007-07-20 16:59:19 +00:00
Chris Lattner
77e9de50a1 simplify the lexer ctor to take a SLoc instead of a sloc and a redundant buffer*.
llvm-svn: 40104
2007-07-20 16:52:03 +00:00
Chris Lattner
dc5c055fd1 Reimplement SourceLocation. Instead of having a
fileid/offset pair, it now contains a bit discriminating between
mapped locations and file locations.  This separates the tables for
macros and files in SourceManager, and allows better separation of
concepts in the rest of the compiler.  This allows us to have *many*
macro instantiations before running out of 'addressing space'.

This is also more efficient, because testing whether something is a
macro expansion is now a bit test instead of a table lookup (which
also used to require having a srcmgr around, now it doesn't).

This is fully functional, but there are several refinements and
optimizations left.

llvm-svn: 40103
2007-07-20 16:37:10 +00:00
Dan Gohman
e31a61eeca Optimize alignment of loads and stores.
llvm-svn: 40102
2007-07-20 16:34:21 +00:00
Dan Gohman
45863cc202 Update these regression tests to accomodate X86InstrSSE.td now using movups/movaps
for everything.

llvm-svn: 40101
2007-07-20 16:31:26 +00:00
Owen Anderson
4b9cedcea5 Have DenseMap auto-shrink itself on clear(). This improves the time to optimize
403.gcc from 15.2s to 14.3s.

llvm-svn: 40100
2007-07-20 16:15:24 +00:00
Duncan Sands
2be91fcdd8 Place SCCPSolver also in the anonymous namespace. This
pacifies g++-4.2.

llvm-svn: 40089
2007-07-20 08:56:21 +00:00
Owen Anderson
5bd6c3f2c4 Fix a bug where we were marking GEP expressions with the wrong opcode.
llvm-svn: 40085
2007-07-20 08:19:20 +00:00
Owen Anderson
edb926bfe3 When removing instructions from the analysis, be sure to check the confirmed
flag when determining what to do with dependencies.

llvm-svn: 40079
2007-07-20 06:16:07 +00:00
Evan Cheng
f195429a0e New test.
llvm-svn: 40077
2007-07-20 00:27:56 +00:00
Evan Cheng
8fefeffb37 Because we promote SSE logical ops and loads to v2i64, we often end up generate
code that cross integer / floating point domains (e.g. generate pxor / pand for
logical ops on floating point value, movdqa to load / store floating point SSE
values). Given that, it's better to use movaps instead of movdqa and movups
instead of movdqu. They have the same latency but the "aps" variants are one
byte shorter.
If the domain crossing problem is a real performance issue, then we will have to
fix it with dynamic programming based isel.

llvm-svn: 40076
2007-07-20 00:27:43 +00:00
Evan Cheng
869852b03e No need for noResults anymore.
llvm-svn: 40075
2007-07-20 00:21:23 +00:00
Evan Cheng
9081ab8127 Oops. These stores actually produce results.
llvm-svn: 40074
2007-07-20 00:20:46 +00:00
Evan Cheng
a39fd10e32 New test.
llvm-svn: 40073
2007-07-19 23:53:50 +00:00
Evan Cheng
8ab393548f Try fixing it again.
llvm-svn: 40072
2007-07-19 23:53:29 +00:00
Evan Cheng
64738536b3 Fix custom lowering of SSE FXOR.
llvm-svn: 40071
2007-07-19 23:36:01 +00:00
Evan Cheng
7ca3555bfa Fix patterns so we isel the xorps, etc. for floating pt logical SSE ops. DAG combiner may fold away the (bit_convert (load)).
llvm-svn: 40070
2007-07-19 23:34:10 +00:00
Reid Spencer
314e1cb7ee For PR1553:
Change the keywords for the zext and sext parameter attributes to be 
zeroext and signext so they don't conflict with the keywords for the
instructions of the same name. This gets around the ambiguity.

llvm-svn: 40069
2007-07-19 23:13:04 +00:00
Chris Lattner
f2e101f164 implement size/alignment analysis for arrays and vectors. This gets carbon.h working again.
llvm-svn: 40068
2007-07-19 22:06:24 +00:00
Steve Naroff
57eb2c5f58 Finish fixing crasher with compound literals.
We still need to do sematic analysis (and implement initializers), however this 
should complete the parsing & ast building for compound literals.

llvm-svn: 40067
2007-07-19 21:32:11 +00:00
Reid Spencer
68ee4e8efc Hush a noisy warning from GCC 4.2 about overflow during conversion by using
the type "unsigned" instead of uintptr_t for a 1-bit structure field.

llvm-svn: 40066
2007-07-19 21:05:30 +00:00
Owen Anderson
f9e6542969 Make val_replace fail early, which reduces the time to optimize 403.gcc to 14.8s.
llvm-svn: 40064
2007-07-19 19:57:13 +00:00
Bill Wendling
dd96b98bf6 Don't need the "&&" to glue lines together.
llvm-svn: 40063
2007-07-19 18:06:26 +00:00
Devang Patel
a273d1cd3a Verify loop info.
llvm-svn: 40062
2007-07-19 18:02:32 +00:00
Chris Lattner
24dbee71ab Fix a stringizing bug that Neil noticed. We should preprocess this:
#define t(x) #x
t(a
c)

to "a c", not "ac".

llvm-svn: 40060
2007-07-19 16:11:58 +00:00
Anton Korobeynikov
b4acc033cf Properly initialize value :)
llvm-svn: 40059
2007-07-19 15:32:47 +00:00
Duncan Sands
60f28bff4c Replace mysterious code causing a g++-4.2 warning
with hopefully correct code that pleases g++-4.2.

llvm-svn: 40051
2007-07-19 09:42:01 +00:00
Duncan Sands
42f7a9c379 Fix this test. We produce pretty cruddy code for this
nowadays, unfortunately it's not so easy to get good
code here while still producing correct code in exotic
situations.

llvm-svn: 40050
2007-07-19 09:38:34 +00:00
Duncan Sands
85ec2af554 As pointed out by g++-4.2, the original code didn't do
what it thought it was doing.

llvm-svn: 40044
2007-07-19 07:31:58 +00:00
Owen Anderson
ee99010782 Remember to free the heap allocated array if we're not going to use it.
llvm-svn: 40043
2007-07-19 06:45:33 +00:00
Owen Anderson
6aa17f1def Use SmallVector and DenseMap in even more places.
With this, the time to optimize 403.gcc is down to 15.1s.

llvm-svn: 40042
2007-07-19 06:37:56 +00:00
Bill Wendling
e8ea3303ce Testcase for PR1549
llvm-svn: 40041
2007-07-19 06:31:11 +00:00
Owen Anderson
75a244d6eb Change ValueTable to use a DenseMap for mapping expressions to value numbers.
This results in a slight speedup for 403.gcc.

llvm-svn: 40040
2007-07-19 06:13:15 +00:00
Devang Patel
ef43253e2e Set up ground work to verify preserved analysis info.
llvm-svn: 40039
2007-07-19 05:36:09 +00:00
Chris Lattner
2ac26568d4 silence a warning by treating ocuvectors the same as vectors.
llvm-svn: 40037
2007-07-19 05:13:51 +00:00
Owen Anderson
6a4ff8549b Move some sets and maps to SmallPtrSet and DenseMap respectively. This
reduces the time to optimize 403.gcc from 17.6s to 16.4s.

llvm-svn: 40036
2007-07-19 03:32:44 +00:00
Devang Patel
186e0d8b0a After a basic block is split into two parts,
second part dominates all the blocks dominated
by original basic block. And first part dominates
second part.

llvm-svn: 40035
2007-07-19 02:29:24 +00:00
Devang Patel
de5901523c Now this temp. fix is not required.
llvm-svn: 40034
2007-07-19 02:22:21 +00:00
Evan Cheng
94b5a80b93 Change instruction description to split OperandList into OutOperandList and
InOperandList. This gives one piece of important information: # of results
produced by an instruction.
An example of the change:
def ADD32rr  : I<0x01, MRMDestReg, (ops GR32:$dst, GR32:$src1, GR32:$src2),
                 "add{l} {$src2, $dst|$dst, $src2}",
                 [(set GR32:$dst, (add GR32:$src1, GR32:$src2))]>;
=>
def ADD32rr  : I<0x01, MRMDestReg, (outs GR32:$dst), (ins GR32:$src1, GR32:$src2),
                 "add{l} {$src2, $dst|$dst, $src2}",
                 [(set GR32:$dst, (add GR32:$src1, GR32:$src2))]>;

llvm-svn: 40033
2007-07-19 01:14:50 +00:00
Steve Naroff
fbd098332c Work towards fixing crasher with compound literals...
Before this commit, we crashed in ParseBinOp...

[dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang -parse-ast-check compound_literal.c
SemaExpr.cpp:1298: failed assertion `(rhs != 0) && "ParseBinOp(): missing right expression"'

With this commit, we still crash in the newly added action ParseCompoundLiteral (which is progress:-)

[dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang -parse-ast-check compound_literal.c
SemaExpr.cpp:478: failed assertion `(Op != 0) && "ParseCompoundLiteral(): missing expression"'

The crash go away once the actions return AST nodes. I will do this in a separate commit.

llvm-svn: 40032
2007-07-19 01:06:55 +00:00
Evan Cheng
22b0c344db Only adjust esp around calls in presence of alloca.
llvm-svn: 40030
2007-07-19 00:42:58 +00:00
Chris Lattner
5fbd7e0264 Fix a crasher that Neil reported: Sema::GetTypeForDeclarator should never
return a null type.  If there is an error parsing the type, pick a new type
for error recovery purposes.

llvm-svn: 40029
2007-07-19 00:42:40 +00:00
Evan Cheng
7b5b06805a Only adjust esp around calls in presence of alloca.
llvm-svn: 40028
2007-07-19 00:42:05 +00:00
Chris Lattner
5e62929fed Make sure to initialize an ivar, patch by Benoit Boissinot.
llvm-svn: 40027
2007-07-19 00:11:19 +00:00
Chris Lattner
5c98379b1c Correctly respect C99 5.1.1.2p4 when searching for the first '(' of
a function-like macro invocation.  Patch contributed by Neil Booth.

llvm-svn: 40026
2007-07-19 00:07:36 +00:00
Devang Patel
8a1d1ac925 Fix typo.
llvm-svn: 40025
2007-07-18 23:50:19 +00:00
Devang Patel
bb8ea8cefc Fix dominator info update to accommodate CFG changes.
This fixes PR1559.

llvm-svn: 40024
2007-07-18 23:48:20 +00:00
Devang Patel
86dff8f8be New test.
llvm-svn: 40023
2007-07-18 23:47:02 +00:00
Evan Cheng
a8d152a22a Add comment.
llvm-svn: 40022
2007-07-18 23:34:48 +00:00
Evan Cheng
dcc3451f8a New test.
llvm-svn: 40020
2007-07-18 21:39:16 +00:00
Evan Cheng
8941071ae1 Use MOV instead of LEA to restore ESP if callee-saved frame size is 0; if previous instruction updates esp, fold it in.
llvm-svn: 40018
2007-07-18 21:26:06 +00:00
Dan Gohman
68659280fa Add constructor overloads for LoadInst and StoreInst that insert at the
end of a BasicBlock and have an alignment parameter.

llvm-svn: 40016
2007-07-18 20:51:11 +00:00
Dan Gohman
776962a97a Implement initial memory alignment awareness for SSE instructions. Vector loads
and stores that have a specified alignment of less than 16 bytes now use
instructions that support misaligned memory references.

llvm-svn: 40015
2007-07-18 20:23:34 +00:00
Owen Anderson
e21f270858 Fix an issue where assignments that caused a SmallPtrSet to become non-small
would result in calling realloc() on a null pointer.  Instead, if we encounter
this situation, make a normal call to malloc().

llvm-svn: 40014
2007-07-18 19:54:15 +00:00
Chris Lattner
0f0019c36e implement i-c-e correct evaluation for sizeof/alignof, remove some obsolete fixme's.
llvm-svn: 40012
2007-07-18 18:38:36 +00:00
Chris Lattner
647fb22611 implement sizeof/alignof support for structs, unions and complex.
This allows us to compile this:

struct abc { char A; double D; };

int foo() {
  return sizeof(struct abc);
  return __alignof__(struct abc);
}

Into:

        ret i32 16
        ret i32 8

llvm-svn: 40010
2007-07-18 18:26:58 +00:00
Chris Lattner
3f8c6e6e74 implement codegen support for sizeof/alignof
llvm-svn: 40009
2007-07-18 18:12:07 +00:00
Steve Naroff
91fcddb5cc First round of extended vector support. Here is an overview...
- added ocu_vector_type attribute, Sema::HandleOCUVectorTypeAttribute(). 
- added new AST node, OCUVectorType, a subclass of VectorType.
- added ASTContext::getOCUVectorType.
- changed ASTContext::convertToVectorType() to ASTContext::getVectorType(). This is 
unrelated to extended vectors, however I was in the vicinity and it was on my todo list.
Added a FIXME to Sema::HandleVectorTypeAttribute to deal with converting complex types.

llvm-svn: 40007
2007-07-18 18:00:27 +00:00
Chris Lattner
53cfe80407 initial layout support for structures and unions. This isn't actually
hooked up to anything, so it's not very useful yet.

llvm-svn: 40006
2007-07-18 17:52:12 +00:00
Chris Lattner
b5d3f84459 add accessors
llvm-svn: 40005
2007-07-18 17:50:10 +00:00
Dan Gohman
a7b65c30a3 It's not necessary to do rounding for alloca operations when the requested
alignment is equal to the stack alignment.

llvm-svn: 40004
2007-07-18 16:29:46 +00:00
Chris Lattner
bd27073f2a Cast to void is valid, patch by Benoit Boissinot
llvm-svn: 40003
2007-07-18 16:00:06 +00:00
Evan Cheng
f314055706 New entry.
llvm-svn: 39998
2007-07-18 08:21:49 +00:00
Chris Lattner
9c016770bb teach -stats about new types
llvm-svn: 39996
2007-07-18 05:50:59 +00:00
Reid Spencer
c49a5b9952 Fix a sys::Path API error caught by a gcc 4.2 warning.
llvm-svn: 39995
2007-07-18 05:27:33 +00:00
Chris Lattner
d7372ba817 add a note Neil pointed out
llvm-svn: 39994
2007-07-18 05:21:20 +00:00
Chris Lattner
6cc9a08734 Work around a bogus gcc 4.2 warning.
llvm-svn: 39993
2007-07-18 04:51:57 +00:00
Reid Spencer
2e5b07f41d Fix this test to not rely on the path but to use the
configured llvm-gcc instead.

llvm-svn: 39992
2007-07-18 04:37:24 +00:00
Reid Spencer
ead26b672b The property is svn:executable not svn:execute.
llvm-svn: 39991
2007-07-18 04:26:05 +00:00
Nick Lewycky
f433a7f1a6 Alphabetize. Document -mlimit parameter.
llvm-svn: 39990
2007-07-18 04:24:20 +00:00
Chris Lattner
46eeb22fec Add initial switch stmt support, patch by Anders Carlsson!
llvm-svn: 39989
2007-07-18 02:28:47 +00:00
Owen Anderson
a603a80607 Turn on FastDSE by default.
Note: FastDSE now equals or exceeds the results of old DSE on all of SPEC2000 and SPEC2006. Unless major problems
show up in the testers, it will likely completely replace old DSE in the near future.

llvm-svn: 39986
2007-07-17 21:59:21 +00:00
Evan Cheng
97b5dc63d7 Fold prologue esp update when possible.
llvm-svn: 39984
2007-07-17 21:26:42 +00:00
Andrew Lenharth
7c14110757 support poolalloc as checked out from svn
llvm-svn: 39983
2007-07-17 20:37:35 +00:00
Evan Cheng
bd9b21f1c5 Change sroa threshold back.
llvm-svn: 39980
2007-07-17 20:07:21 +00:00
Evan Cheng
f9ef70560e Dead code.
llvm-svn: 39979
2007-07-17 20:01:19 +00:00
Evan Cheng
b2bb4b4040 Make sure not to break eh_return.
llvm-svn: 39978
2007-07-17 18:40:47 +00:00
Evan Cheng
27ba94bf3b Update.
llvm-svn: 39977
2007-07-17 18:39:45 +00:00
Evan Cheng
5184c9d787 Fix test.
llvm-svn: 39976
2007-07-17 18:16:09 +00:00
Tanya Lattner
8817a170f7 Don't use * in XFAIL line unless you want it to XFAIL on everything. I don't believe you can use true regular expressions here. It will just look for those keywords. Please test this on sparc and see if they still are xfailed.
llvm-svn: 39975
2007-07-17 18:08:32 +00:00
Evan Cheng
67e2e22e97 Missed the case where alloca is used but the stack size (not including callee-saved portion) is zero. Thanks Dan.
llvm-svn: 39974
2007-07-17 18:03:34 +00:00
Chris Lattner
59fd8012a0 strtod is more portable than strtof apparently. Instead of making this conditional,
just always use strtod.  This is temporary code anyway.

llvm-svn: 39972
2007-07-17 15:27:33 +00:00
Rafael Espindola
6389ef9854 detect invalid combination of sret and byval
llvm-svn: 39971
2007-07-17 13:34:23 +00:00
Gabor Greif
bea1390e68 cheap change to fix solaris compilation. I can make this a static inline if desired
llvm-svn: 39970
2007-07-17 11:05:49 +00:00
Gabor Greif
6881ace037 XFAIL these on sparc-solaris
llvm-svn: 39969
2007-07-17 10:25:31 +00:00
Evan Cheng
9ae2eb43d8 Use push / pop for prologues and epilogues.
llvm-svn: 39967
2007-07-17 07:59:08 +00:00
Reid Spencer
d6748cf229 Make use of the process_builder_args library function.
llvm-svn: 39965
2007-07-17 07:17:02 +00:00
Reid Spencer
5bc753e26b For PR1558:
Move tests that have C/C++ sources into the appropriate directory. This
allows them to be selected for testing based on whether llvm-gcc is
present or not.

llvm-svn: 39963
2007-07-17 06:20:38 +00:00
Chris Lattner
396156e00b no email addrs in file headers
llvm-svn: 39962
2007-07-17 05:56:43 +00:00
Bill Wendling
89ba70eba6 Use the correct method for getting the ReferenceType from a QualType.
llvm-svn: 39960
2007-07-17 05:09:22 +00:00
Chris Lattner
5b2f6970c1 I forgot to check this in earlier
llvm-svn: 39958
2007-07-17 04:58:06 +00:00
Bill Wendling
ee673372ef Return the correct type from isReferenceType().
llvm-svn: 39956
2007-07-17 04:47:36 +00:00
Bill Wendling
354fb2678d Change dyn_cast for reference types to be more like pointers and not need the canonical type. Also fix so that we're not expecting a return value from a void function
llvm-svn: 39954
2007-07-17 04:16:47 +00:00
Bill Wendling
dfc810717e Fix references:
According to the spec (C++ 5p6[expr]), we need to adjust "T&" to
    "T" before further analysis. We do this via the "implicit cast"
    thingy.

llvm-svn: 39953
2007-07-17 03:52:31 +00:00
Reid Spencer
5060fd0fa3 Unbreak the build by putting calls to free into the implementation file and
having that implementation file #include <cstdlib>.

llvm-svn: 39952
2007-07-17 02:16:12 +00:00
Evan Cheng
20b76421ed Temporarily set SROA threshold to 512.
llvm-svn: 39950
2007-07-17 01:52:05 +00:00
Steve Naroff
dbd9e89334 Convert UsualArithmeticConversions to return "void". Now that we synthesize ImplicitCastExpr's,
there is no compelling need to return the converted type. If both expression type's are arithmetic, then
both types will always be the same. If they aren't (for pointer/int types, say), then the
types will be different. The client is responsible for distinguishing...

llvm-svn: 39947
2007-07-17 00:58:39 +00:00
Owen Anderson
09f86993bd Take advantage of undefined behavior if the source program tries to GEP
beyond the end of an alloca to make FastDSE faster and more aggressive.

llvm-svn: 39945
2007-07-16 23:34:39 +00:00
Reid Spencer
81f1a6c4cb Normally, we don't want to install and we only need to build tools.
llvm-svn: 39944
2007-07-16 23:25:52 +00:00
Steve Naroff
1a2cf6b3b3 Implement semantic analysis for the cast operator.
llvm-svn: 39943
2007-07-16 23:25:18 +00:00
Reid Spencer
19dc0decbe No, we're not looking for a directory named /config.status.
Sigh .. fix copy & paste error.

llvm-svn: 39939
2007-07-16 22:54:42 +00:00
Reid Spencer
b7b081d44a In ModuleInfo.txt, make sure that the script being executed can be
found by prepending a .
In build-for-llvm-top.sh, dereference variables for exansion.

llvm-svn: 39936
2007-07-16 22:25:13 +00:00
Steve Naroff
94a5acac9b Remove the 2 QualType references to method UsualArithmeticConversions. Last week, I added these
to quickly fix a regression. Avoiding them entirely is a much cleaner solution. Clients of 
UsualArithmeticConversions should simply call getType() on the expression to get the
converted type. In practice, only a small number of routines care about this.

llvm-svn: 39934
2007-07-16 22:23:01 +00:00
Reid Spencer
a71bd75e2f Prepare for the future when llvm doesn't depend on llvm-gcc-4-0.
This also avoids a fork bomb from the llvm-top/build script which
doesn't know how to handle cycles in the dependence graph.

llvm-svn: 39933
2007-07-16 22:11:02 +00:00
Chris Lattner
96d423ef37 In the final step for preserving typedef info better in the AST, upgrade
isPointerType and isVectorType to only look through a single level of typedef
when one is present.  For this invalid code:

typedef float float4 __attribute__((vector_size(16)));
typedef int int4 __attribute__((vector_size(16)));
typedef int4* int4p;
void test(float4 a, int4p result, int i) {
    result[i] = a;
}

we now get:

t.c:5:15: error: incompatible types assigning 'float4' to 'int4'
    result[i] = a;
    ~~~~~~~~~ ^ ~

instead of:

t.c:5:15: error: incompatible types assigning 'float4' to 'int  __attribute__((vector_size(16)))'
    result[i] = a;
    ~~~~~~~~~ ^ ~

The rest of the type predicates should be upgraded to do the same thing.

llvm-svn: 39932
2007-07-16 22:05:22 +00:00
Reid Spencer
f54537370a Remove insignificant test no longer needed.
llvm-svn: 39931
2007-07-16 22:03:36 +00:00
Steve Naroff
3109001c19 Change DefaultFunctionArrayConversions and UsualUnaryConversions to return void. The caller
needs to query the expression for the type. Since both these functions guarantee the expression 
contains a valid type, removed old/vacuous asserts (from code calling both of these routines).

llvm-svn: 39930
2007-07-16 21:54:35 +00:00
Owen Anderson
7fcaaadf1c Add support for walking up memory def chains, which enables finding many more
dead stores on 400.perlbench.

llvm-svn: 39929
2007-07-16 21:52:50 +00:00
Chris Lattner
daaa9f207c Fix a GCC warning:
SemaExpr.cpp:561: warning: dereferencing type-punned pointer will break strict-aliasing rules

Patch by Benoit Boissinot!

llvm-svn: 39928
2007-07-16 21:39:03 +00:00
Chris Lattner
e73e4322d6 Implement break and continue. Patch by Anders Carlsson!
llvm-svn: 39927
2007-07-16 21:28:45 +00:00
Owen Anderson
81990a3fc3 Use realloc() to (potentially) resize the contents of SmallPtrSet in place.
llvm-svn: 39926
2007-07-16 21:27:44 +00:00
Chris Lattner
7d138433e9 avoid requiring people to update from llvm svn.
llvm-svn: 39925
2007-07-16 21:04:56 +00:00
Reid Spencer
3363f4ad96 Return Undef if the block has no dominator. This was required to allow
llvm-gcc build to succeed. Without this change it fails in libstdc++
compilation. This causes no regressions in dejagnu tests. However, 
someone who knows this code better might want to review it.

llvm-svn: 39924
2007-07-16 21:03:44 +00:00
Dan Gohman
72efc04d8e Use ConstantFoldFP for folding all unary floating-point operations which may
have an error, and refector out the code for binary operators into
ConstantFoldBinaryFP and use it for all binary floating-point operations
which may have an error. These functions still rely exclusively on errno
to detect errors though.

llvm-svn: 39923
2007-07-16 15:26:22 +00:00
Dan Gohman
33988db5d5 Fix the documentation for llvm.sqrt so that sqrt(0) has defined behavior,
which appears to be the intent.

llvm-svn: 39922
2007-07-16 14:37:41 +00:00
Dan Gohman
06c60b6032 Fix comments about vectors to use the current wording.
llvm-svn: 39921
2007-07-16 14:29:03 +00:00
Dan Gohman
c6e67a6126 Remove the trailing semicolon from function declarations in LLVM,
where it's interpreted as a comment, not part of the syntax.

llvm-svn: 39920
2007-07-16 13:37:30 +00:00
Bill Wendling
a5d30d5d83 Fix validation errors
llvm-svn: 39917
2007-07-16 08:52:56 +00:00
Bill Wendling
af5b63f6da Clean up some formatting
llvm-svn: 39916
2007-07-16 08:46:40 +00:00
Bill Wendling
bcb3b41d99 Clean up some formatting. Add some doc_code div tags.
llvm-svn: 39915
2007-07-16 08:44:39 +00:00
Reid Spencer
f8031b9cf2 Prepare for building from llvm-top. Unfortunately, this doesn't work because
of the cyclic depndency between llvm and llvm-gcc-4-0.

llvm-svn: 39910
2007-07-16 08:05:18 +00:00
Reid Spencer
961eddcfa6 Prepare stacker module for the new llvm-top build mechanism.
llvm-svn: 39909
2007-07-16 07:51:40 +00:00
Bill Wendling
457d1343b1 Constify the is*Lvalue() methods.
llvm-svn: 39907
2007-07-16 07:07:56 +00:00
Chris Lattner
bb1b44f004 Make octal constant lexing use AdvanceToTokenCharacter to give more
accurate diagnostics.  For test/Lexer/comments.c we now emit:

int x = 000000080;  /* expected-error {{invalid digit}} */
               ^
constants.c:7:4: error: invalid digit '8' in octal constant
00080;             /* expected-error {{invalid digit}} */
   ^


The last line is due to an escaped newline.  The full line looks like:

int y = 0000\
00080;             /* expected-error {{invalid digit}} */


Previously, we emitted:
constants.c:4:9: error: invalid digit '8' in octal constant
int x = 000000080;  /* expected-error {{invalid digit}} */
        ^
constants.c:6:9: error: invalid digit '8' in octal constant
int y = 0000\
        ^

which isn't too bad, but the new way is better for the user,
regardless of whether there is an escaped newline or not.

All the other lexer-related diagnostics should switch over 
to using AdvanceToTokenCharacter where appropriate.  Help
wanted :).

This implements test/Lexer/constants.c.

llvm-svn: 39906
2007-07-16 06:55:01 +00:00
Chris Lattner
8a7003cd9f Add a new Preprocessor::AdvanceToTokenCharacter method which, given a sloc
specifying the start of a token and a logical (phase 3) character number,
returns a sloc representing the input character corresponding to it.

llvm-svn: 39905
2007-07-16 06:48:38 +00:00
Chris Lattner
eb5b20ae48 add better comments.
llvm-svn: 39904
2007-07-16 06:46:50 +00:00
Chris Lattner
b0f5d55912 factor a common predicate into a static method.
llvm-svn: 39903
2007-07-16 06:16:59 +00:00
Chris Lattner
651f0e9c8f Add a hack (mirroring llvm-gcc) to pointer difference
codegen to compile:

int test(int *A, int *B) {
  return A-B;
}

into:

_test:
        movl 4(%esp), %eax
        subl 8(%esp), %eax
        sarl $2, %eax
        ret

instead of:

_test:
        movl 4(%esp), %eax
        subl 8(%esp), %eax
        movl %eax, %ecx
        sarl $31, %ecx
        shrl $30, %ecx
        addl %ecx, %eax
        sarl $2, %eax
        ret

llvm-svn: 39902
2007-07-16 05:43:05 +00:00
Chris Lattner
f57999dcb1 add required directories to the path automatically, so the user doesn't need to worry about it.
llvm-svn: 39901
2007-07-16 04:35:52 +00:00
Chris Lattner
8ecc9f60b2 Make check conflicts with the other default llvm target, 'make check' will come later I guess.
llvm-svn: 39900
2007-07-16 04:30:36 +00:00
Chris Lattner
55d278cef9 'make check' is what more people expect.
llvm-svn: 39899
2007-07-16 04:26:57 +00:00
Chris Lattner
31e39e9cdb Doug Gregor pointed out that _Complex actually isn't C++ at all.
llvm-svn: 39898
2007-07-16 04:22:42 +00:00
Chris Lattner
539007a78a Add support for C++'0x keywords, patch by Doug Gregor
llvm-svn: 39897
2007-07-16 04:18:29 +00:00
Chris Lattner
640fd5124d Repair a regression in Transforms/InstCombine/mul.ll that Reid noticed.
llvm-svn: 39896
2007-07-16 04:15:34 +00:00
Chris Lattner
d8bdf53335 rename function to avoid llvm-upgrade warning
llvm-svn: 39895
2007-07-16 04:09:00 +00:00
Nick Lewycky
b7c0c8a350 Start adding and cleaning up comments.
llvm-svn: 39894
2007-07-16 02:58:37 +00:00
Nick Lewycky
5246026c8c Handle decrementing loops properly. Fixes PR1533.
Always pass the constant as the second parameter to HowManyLessThans.

Remove obsolete "isSigned" parameter.

llvm-svn: 39893
2007-07-16 02:08:00 +00:00
Chris Lattner
aee0cfd486 Now that isPointerType can return a pointer type, avoid stripping off typedef
information in the common case.  On this invalid code:

typedef float float4 __attribute__((vector_size(16)));
typedef int int4 __attribute__((vector_size(16)));
void test(float4 a, int4 *result, int i) {
    result[i] = a;
}

we now generate:
  t.c:5:15: error: incompatible types assigning 'float4' to 'int4'
instead of:
  t.c:5:15: error: incompatible types assigning 'float4' to 'int  __attribute__((vector_size(16)))'

This implements test/Sema/typedef-retain.c

llvm-svn: 39892
2007-07-16 00:23:25 +00:00
Chris Lattner
36d572b9ea Use the return value of isPointerType and isVectorType to significantly simplify
ParseArraySubscriptExpr.  Notably, the new code doesn't have to think about 
canonical types at all.

llvm-svn: 39891
2007-07-16 00:14:47 +00:00
Chris Lattner
68ebef886a as a very useful feature, make isVectorType and isPointerType return
the actual vectortype or pointertype when they return success.

llvm-svn: 39890
2007-07-16 00:13:25 +00:00
Chris Lattner
5981db49a2 rename variables to be more consistent. Always use LHS/RHS intead of T1/T2 sometimes.
llvm-svn: 39889
2007-07-15 23:59:53 +00:00
Chris Lattner
51aff8bd7c Remove an extraneous QualType from CastExpr, it's type is always
the result type of the expr node.

Implement isIntegerConstantExpr for ImplicitCastExpr nodes the same
was as for CastExpr nodes.

Implement proper sign/zero extension as well as truncation and noop
conversion in the i-c-e evaluator.  This allows us to correctly
handle i-c-e's like these:

char array[1024/(sizeof (long))];
int x['\xBb' == (char) 187 ? 1: -1];

this implements test/Sema/i-c-e2.c

llvm-svn: 39888
2007-07-15 23:54:50 +00:00
Chris Lattner
48f84b85b7 don't let builtin-type handling code fall into pointer handling code
not all builtin types have size and alignment equal to pointers :)

llvm-svn: 39887
2007-07-15 23:46:53 +00:00
Chris Lattner
5c4664e355 set the correct width for a character literal when evaluating it as an i-c-e.
llvm-svn: 39886
2007-07-15 23:32:58 +00:00
Chris Lattner
0f0adc6b9d add a helper method.
llvm-svn: 39885
2007-07-15 23:32:03 +00:00
Chris Lattner
0e9d6226ca Refactor code so that isIntegerConstantExpr has an ASTContext available.
llvm-svn: 39884
2007-07-15 23:26:56 +00:00
Chris Lattner
ec6480e235 new testcase
llvm-svn: 39882
2007-07-15 22:30:34 +00:00
Chris Lattner
d4fef8dbca Implement shift-simplify.ll:test[45].
First teach instcombine that sign bit checks only demand the 
sign bit, this allows simplify demanded bits to hack on 
expressions better.

Second, teach instcombine that ashr is useless if only the
sign bit is demanded.

llvm-svn: 39880
2007-07-15 20:54:51 +00:00
Chris Lattner
06205d5567 Implement shift-simplify.ll:test3, turning:
(X << 31) <s 0  --> (X&1) != 0

This happens dozens of times in the CFE.

llvm-svn: 39879
2007-07-15 20:42:37 +00:00
Chris Lattner
b1711e8485 remove obsolete comment.
llvm-svn: 39868
2007-07-15 06:46:25 +00:00
Chris Lattner
3fc74e2468 Change SourceManager::getInstantiationLoc to take virtual locations, doing its
virtual->physical mapping explicitly.

llvm-svn: 39867
2007-07-15 06:35:27 +00:00
Steve Naroff
81569d2044 This is the final step/commit for implementing exlicit implicit casts. Unlike the
previous two checkins, which involved lot's of tedious refactoring, this checkin is nice and clean:-)

- Hacked UsualUnaryConversions, UsualArithmeticConversions, and DefaultFunctionArrayConversion
to create the AST node (using a helper function promoteExprToType).
- Added a setType method to Expr.
- Changed Expr::isIntegerConstantExpr to allow for the new node.

llvm-svn: 39866
2007-07-15 02:02:06 +00:00
Chris Lattner
598305dfbd non-apple targets should be like i386, not the mythical, bogus, linux target.
llvm-svn: 39865
2007-07-15 01:37:36 +00:00
Chris Lattner
c02c4abe5b Cache macro expander objects to avoid thrashing malloc in heavy expansion situations.
This doesn't significantly improve carbon.h, but it does speed up
INPUTS/macro_pounder_obj.c by 48%

llvm-svn: 39864
2007-07-15 00:25:26 +00:00
Chris Lattner
03928c7f9a Make parser scope cache be a member of the parser instead of a global,
which makes it multithread clean.

llvm-svn: 39863
2007-07-15 00:04:39 +00:00
Chris Lattner
564f478595 switch function-like macros from using a vector for their arguments to an
explicitly new'd array.  The array never mutates once created, so a vector
is overkill.

llvm-svn: 39862
2007-07-14 22:46:43 +00:00
Chris Lattner
819f2ef77b switch from using a vector to a smallvector for macro replacement tokens
This speeds up parsing carbon.h by 3.3% by avoiding some malloc traffic for 
small macros.

llvm-svn: 39861
2007-07-14 22:15:50 +00:00
Chris Lattner
f40fe99118 expose an iterator interface to getReplacementTokens instead of the datastructure itself.
llvm-svn: 39860
2007-07-14 22:11:41 +00:00
Chris Lattner
a3834341c5 split function-like and object-like macro body parsing to make the
code more obvious.

llvm-svn: 39859
2007-07-14 21:54:03 +00:00
Gabor Greif
e97cd7e65c add FIXME and un-XFAIL test
llvm-svn: 39858
2007-07-14 20:05:18 +00:00
Nick Lewycky
ddc2f9ba57 Clarify the language. Pointed out by Duncan Sands.
llvm-svn: 39857
2007-07-14 17:41:03 +00:00
Nick Lewycky
d20f485866 Fix the build. Patch from Holger Schurig.
llvm-svn: 39856
2007-07-14 15:11:14 +00:00
Anton Korobeynikov
383a324735 Long live the exception handling!
This patch fills the last necessary bits to enable exceptions
handling in LLVM. Currently only on x86-32/linux.

In fact, this patch adds necessary intrinsics (and their lowering) which
represent really weird target-specific gcc builtins used inside unwinder.

After corresponding llvm-gcc patch will land (easy) exceptions should be
more or less workable. However, exceptions handling support should not be 
thought as 'finished': I expect many small and not so small glitches
everywhere.

llvm-svn: 39855
2007-07-14 14:06:15 +00:00
Bill Wendling
657a203adf Add missing directory
llvm-svn: 39853
2007-07-14 09:37:10 +00:00
Nick Lewycky
39519f5c41 Use maximal intersection algorithm exclusively. Fixes miscompile bug.
llvm-svn: 39852
2007-07-14 04:28:04 +00:00
Nick Lewycky
61b4a265ee Add alternate ConstantRange intersection algorithm.
llvm-svn: 39851
2007-07-14 02:51:34 +00:00
Chris Lattner
4481b428db A significant refactoring of the type size stuff to also
compute type alignment.  This info is needed for struct layout.

llvm-svn: 39850
2007-07-14 01:29:45 +00:00
Chris Lattner
9d3b0e0001 Implement trivial integer initializers, like 'int X = 4;' for global
vars.  Approach suggested by Keith.

llvm-svn: 39849
2007-07-14 00:23:28 +00:00
Chris Lattner
6ee31f5df8 In "int X,Y;", compile both X and Y.
llvm-svn: 39848
2007-07-14 00:16:50 +00:00
Chris Lattner
027f21dd72 add a fixme
llvm-svn: 39847
2007-07-14 00:01:01 +00:00
Chris Lattner
666115c848 Improve char literal pretty printing, patch by Keith Bauer!
llvm-svn: 39846
2007-07-13 23:58:20 +00:00
Evan Cheng
07bc082891 Added test case from PR1540.
llvm-svn: 39845
2007-07-13 23:57:33 +00:00
Devang Patel
4cd1413f15 Make LCSSA a loop pass.
llvm-svn: 39844
2007-07-13 23:57:11 +00:00
Evan Cheng
1fae1cd3e1 Fix for PR1540: Specify F0, F1 are sub-registers of D0, etc.
llvm-svn: 39843
2007-07-13 23:55:50 +00:00
Gabor Greif
03a0073b36 fix type of main, use !=
llvm-svn: 39842
2007-07-13 23:40:27 +00:00
Gabor Greif
d4606aa36e implement _Complex * == and !=
llvm-svn: 39841
2007-07-13 23:33:18 +00:00
Steve Naroff
b8ea4fb8db More changes related to implementing ImplicitCastExpr.
- Fixed a recent regression discovered by Keith Bauer (thanks!). 
The fix involved adding (back) two arguments to UsualArithmeticConversions.
Without the reference arguments, no unary conversions were being passed back
to the caller. This had the effect of turning off the UsualUnaryConversions.
- Refactored CheckAssignmentConstraints into 3 functions. CheckAssignmentConstraints,
CheckSingleAssignmentConstraints, and CheckCompoundAssignmentConstraints. 
- Changed the argument type of DefaultFunctionArrayConversion from QualType->Expr*&.
- Removed a bunch of casts in routines I was working on (cleanup).
- Fixed the visitor for ImplicitCastExpr (oops).

llvm-svn: 39840
2007-07-13 23:32:42 +00:00
Owen Anderson
d975efab16 Handle GEPs with all-zero indices in the same way we handle pointer-pointer bitcasts. Also, fix a potentia infinite loop.
This brings FastDSE to parity with old DSE on 175.vpr.

llvm-svn: 39839
2007-07-13 22:50:48 +00:00
Chris Lattner
355332d3f3 Use target info to decide the sizes of basic types.
llvm-svn: 39838
2007-07-13 22:27:08 +00:00
Chris Lattner
0523dc94c8 Add missing citation.
llvm-svn: 39837
2007-07-13 22:16:13 +00:00
Gabor Greif
f7b1f667d4 a simple _Complex testcase
llvm-svn: 39836
2007-07-13 22:15:44 +00:00
Chris Lattner
983a8bbbb2 Move getSize() out of type, into ASTContext, where it has target info, and
where ASTContext can manage caches for struct layout, etc.

llvm-svn: 39835
2007-07-13 22:13:22 +00:00
Devang Patel
29ccf8ba52 Disable claims to preserve analysis until open issues are resolved.
llvm-svn: 39834
2007-07-13 21:53:42 +00:00
Chris Lattner
35ed92817a Unspecified type specs default to int. This fixes a crash
on test/Sema/implicit-int.c

llvm-svn: 39833
2007-07-13 21:02:29 +00:00
Chris Lattner
2ce5dd4c98 remove some extraneous spaces, no functionality change.
llvm-svn: 39832
2007-07-13 21:01:17 +00:00
Chris Lattner
388cf760e2 implement codegen support for implicit casts.
llvm-svn: 39831
2007-07-13 20:25:53 +00:00
Chris Lattner
5c2f76b395 eliminate extraneous type, add accessors.
llvm-svn: 39830
2007-07-13 20:25:36 +00:00
Chris Lattner
91dacfec85 Check in these testcases.
llvm-svn: 39829
2007-07-13 20:18:44 +00:00
Dan Gohman
10835d9c67 Eliminate an unused parameter.
llvm-svn: 39828
2007-07-13 20:16:50 +00:00
Dan Gohman
ff72788863 Fix the comment for LegalizeOp to more accurately reflect what it does.
llvm-svn: 39827
2007-07-13 20:14:11 +00:00
Chris Lattner
effb7a350f new testcase that crashes the cfe due to implicit conversion fun
llvm-svn: 39826
2007-07-13 20:11:01 +00:00
Chris Lattner
0946f04236 remove obsolete note
llvm-svn: 39825
2007-07-13 20:08:19 +00:00
Chris Lattner
a5ba0cb772 silence a bogus gcc warning.
llvm-svn: 39824
2007-07-13 20:07:11 +00:00
Dan Gohman
80f9f077e3 Don't call SimplifyVBinOp for non-vector operations, following earlier review
feedback. This theoretically makes the common (scalar) case more efficient.

llvm-svn: 39823
2007-07-13 20:03:40 +00:00
Chris Lattner
0a2d099792 fix some bugs in the manual
llvm-svn: 39822
2007-07-13 20:01:46 +00:00
Owen Anderson
9c9ef21432 Be more aggressive in removing dead stores, and in removing instructions trivially dead after DSE.
This drastically improves the effect of FastDSE on kimwitu++.

llvm-svn: 39819
2007-07-13 18:26:26 +00:00
Steve Naroff
b66fb7465b Removed some superfluous code. The getType() method and associated
assert is now done in UsualUnaryConversions().

llvm-svn: 39818
2007-07-13 17:39:21 +00:00
Dale Johannesen
4dc35dbd3e Modify previous patch per review comments.
llvm-svn: 39817
2007-07-13 17:31:29 +00:00
Dale Johannesen
2182f06f2d Skeleton of post-RA scheduler; doesn't do anything yet.
Change name of -sched option and DEBUG_TYPE to
pre-RA-sched; adjust testcases.

llvm-svn: 39816
2007-07-13 17:13:54 +00:00
Chris Lattner
f9aba2c2b4 remove use of alloca.
llvm-svn: 39815
2007-07-13 17:10:38 +00:00
Steve Naroff
7a5af78270 Add (explicit) AST support for implicit casts. This should simplify the
code generator. Source translation tools can simply ignore this node.

- Added a new Expr node, ImplicitCastExpr.
- Changed UsualUnaryConversions/UsualArithmeticConversions to take references 
to Expr *'s. This will allow these routines to instantiate the new AST node
and pass it back.
- Changed all clients of UsualUnary/UsualArithmetic (lot's of diff's).
- Changed some names in CheckConditionalOperands. Several variables where
only distinguished by their case (e.g. Cond, cond). Yuck (what was I thinking).
- Removed an old/crufty constructor in CastExpr (cleanup).

This check-in does not actually create the new AST node. I wanted to separate
the mechanical changes from the semantic changes. In addition, I need to 
coordinate with Chris, since the semantic change will break the code generator.

llvm-svn: 39814
2007-07-13 16:58:59 +00:00
Chris Lattner
2b4d9b684f Fix CodeGen/Generic/print-arith-fp.ll on sparc (PR1551)
llvm-svn: 39813
2007-07-13 16:24:10 +00:00
Chris Lattner
7c9c5362ef check in the basic llvm license
llvm-svn: 39812
2007-07-13 15:47:47 +00:00
Gabor Greif
42d12da712 these tests do not need a triple on Solaris. Thanks sabre!
llvm-svn: 39803
2007-07-13 10:08:18 +00:00
Reid Spencer
df523644c9 Regenerate to pick up Gabor's changes.
llvm-svn: 39802
2007-07-13 10:05:30 +00:00
Reid Spencer
8167778d87 Set the mime-type of this file to text/plain because (silly) SVN
doesn't know that application/x-sh is text.

llvm-svn: 39801
2007-07-13 10:02:45 +00:00
Gabor Greif
f307d942ec * llvm.spec.in: update blurb
* autoconf/AutoRegen.sh: use variables for autofoo versions
* autoconf/configure.ac: test for some more functions
                         that are not guaranteed on solaris

Note: the svn:mime-type of autoconf/AutoRegen.sh
      should be set to something that allows for
			text compares using svn diff
llvm-svn: 39800
2007-07-13 09:48:29 +00:00
Gabor Greif
441b3d47be Solaris needs an included header for alloca
llvm-svn: 39797
2007-07-13 08:21:39 +00:00
Chris Lattner
6e9d9b350e "Codegen for Character Literals and Conditional Operator
Both in one patch, and the test case that Chris didn't commit last
time is in there too...

I'll split the patch up if somebody wants it split."

Patch by Keith Bauer.

llvm-svn: 39796
2007-07-13 05:18:11 +00:00
Chris Lattner
d14bfa94a6 implement support for basic codegen of global variables with no initializers.
llvm-svn: 39795
2007-07-13 05:13:43 +00:00
Chris Lattner
fc7634f2ab "Someone typed "PtrToInt" where they meant "IntToPtr".
I've added a tests/CodeGen directory, and a test for this case that
used to fail and now passes."

Patch by Keith Bauer

llvm-svn: 39794
2007-07-13 03:25:53 +00:00
Chris Lattner
d2b88ab313 Implement codegen for + and - with pointers. Patch contributed by
Keith Bauer.

llvm-svn: 39793
2007-07-13 03:05:23 +00:00
Anton Korobeynikov
b6719478b9 Workaround gcc 3.4.x bug
llvm-svn: 39792
2007-07-13 00:48:55 +00:00
Steve Naroff
1c8b7d36e6 Two changes...
- Teach all the integer/float predicates on Type about Vectors.
- Disallow bitwise compliment on float vectors. For example...

typedef float __attribute__(( vector_size(16) )) float4;

float4 float4_return()
{
    float4 xx;

    return ~xx;
}

...now emits the following diagnostic...

[administrators-powerbook59:~/llvm/tools/clang] admin% ../../Debug/bin/clang bug.c
bug.c:8:12: error: invalid argument type to unary expression 'float4'
    return ~xx;
           ^
1 diagnostic generated.

llvm-svn: 39791
2007-07-12 21:46:55 +00:00
Owen Anderson
32c4a05dd4 Reimplement removing stores to allocas at the end of a function. This should be safe now.
llvm-svn: 39790
2007-07-12 21:41:30 +00:00
Owen Anderson
d4451dee1e Make the condition-checking for free with non-trivial dependencies more correct.
llvm-svn: 39789
2007-07-12 18:08:51 +00:00
Owen Anderson
5e06995b3d Remove the end-block handling code. It was unsafe, and making it safe would have resulted in falling back to the slow DSE case. I need to think some more about the right way to handle this.
llvm-svn: 39788
2007-07-12 17:52:20 +00:00
Chris Lattner
cf9be2d315 update tests
llvm-svn: 39786
2007-07-12 16:52:08 +00:00
Chris Lattner
d1c161786f -pedantic no longer defaults to on.
llvm-svn: 39785
2007-07-12 16:49:27 +00:00
Chris Lattner
1e52eee112 update test
llvm-svn: 39784
2007-07-12 16:48:52 +00:00
Chris Lattner
113d1410ce don't pick up random stuff in .svn directories.
llvm-svn: 39783
2007-07-12 16:46:07 +00:00
Dale Johannesen
85ee72f7ba ARM: make branch folder remove unconditional branches
following jump tables that it earlier inserted.  This
would be OK on other targets but is needed for correctness
only on ARM (constant islands needs to find jump tables).

llvm-svn: 39782
2007-07-12 16:45:35 +00:00
Gabor Greif
ffc337b1e1 add missing header
(needed on Solaris)

llvm-svn: 39781
2007-07-12 16:00:00 +00:00
Chris Lattner
bd4de5df77 Fix "no newline at end of file" warnings. Patch contributed by
Benoit Boissinot!

llvm-svn: 39780
2007-07-12 15:43:07 +00:00
Chris Lattner
20c4ff2845 Improve portability to compilers where <cassert> is not implicitly
included.  Patch contributed by Benoit Boissinot!

llvm-svn: 39779
2007-07-12 15:32:57 +00:00
Chris Lattner
2705b37f02 Allow this to compile on compilers where <string>
doesn't imply <cassert>.

llvm-svn: 39778
2007-07-12 15:30:49 +00:00
Anton Korobeynikov
b76cda05e7 Properly use local variable declaration inside a switch case
llvm-svn: 39777
2007-07-12 15:26:50 +00:00
Chris Lattner
10a4d43eae add missing specification for a default argument. I guess g++ 4.0 doesn't
notice this.

llvm-svn: 39776
2007-07-12 15:26:16 +00:00
Duncan Sands
0263dd1d7f The type ids making up a filter are unsigned, and
should be output as unsigned values.  Checked against
gcc.

llvm-svn: 39775
2007-07-12 13:51:39 +00:00
Gabor Greif
b8bca52c7d checked in as obvious,
thanks Benoit Boissinot!

llvm-svn: 39774
2007-07-12 13:31:38 +00:00
Gabor Greif
1ef777cbb4 fix the remaining 3 testcases that missed a target triple
llvm-svn: 39773
2007-07-12 13:21:08 +00:00
Chris Lattner
bdc69595d9 another missed SSE optimization
llvm-svn: 39772
2007-07-12 06:31:38 +00:00
Chris Lattner
07eb733ef8 Evaluate the initializer for automatic variables.
llvm-svn: 39771
2007-07-12 00:39:48 +00:00
Chris Lattner
79c57590a3 remember the initializer for a variable in the AST and teach the
pretty printer to print it.

llvm-svn: 39770
2007-07-12 00:36:32 +00:00
Owen Anderson
1e1bace52b Let MemoryDependenceAnalysis take care of updating AliasAnalysis.
llvm-svn: 39769
2007-07-12 00:06:21 +00:00
Devang Patel
52c2dd4699 New test.
llvm-svn: 39768
2007-07-11 23:54:25 +00:00
Devang Patel
fac4d1f014 Preserve analysis info.
llvm-svn: 39767
2007-07-11 23:47:28 +00:00
David Greene
b2e2be4b6d Get rid of annoying spaces.
llvm-svn: 39766
2007-07-11 23:44:08 +00:00
Chris Lattner
dcca487cfa implement codegen support for pre/post inc/dec.
llvm-svn: 39765
2007-07-11 23:43:46 +00:00
Bruno Cardoso Lopes
bcda5e20c9 Added support for Mips specific GAS directives
Fixed print immediate 
Fixed Identation on MipsISelDAGToDAG.cpp

llvm-svn: 39764
2007-07-11 23:24:41 +00:00
Bruno Cardoso Lopes
6c8c748e4d Added support for framepointer
Prologue/Epilogue support fp,ra save/restore and use the stack frame the right
way!

llvm-svn: 39763
2007-07-11 23:21:31 +00:00
Owen Anderson
aa07172340 Handle the case where an entire structure is freed, and its dependency is a store to a field within
that structure.

Also, refactor the runOnBasicBlock() function, splitting some of the special cases into separate functions.

llvm-svn: 39762
2007-07-11 23:19:17 +00:00
Bruno Cardoso Lopes
77dbdcabf2 Now that stack is represented the right way, LOA starts at 0
llvm-svn: 39761
2007-07-11 23:17:41 +00:00
Bruno Cardoso Lopes
4449e5dd7f Fixed AddLiveOut issues
FI's created the write way to represent Mips stack

llvm-svn: 39760
2007-07-11 23:16:16 +00:00
Bruno Cardoso Lopes
c5affeccbd Removed unused immediate PatLeaf, fixed lui instruction
llvm-svn: 39759
2007-07-11 22:47:02 +00:00
Bruno Cardoso Lopes
753e37027f Added MipsMachineFunction class, to hold Mips dinamic stack info when inserting Prologue/Epilog
llvm-svn: 39758
2007-07-11 22:44:21 +00:00
Chris Lattner
e399420b51 Fix a release build of clang.
llvm-svn: 39756
2007-07-11 21:50:45 +00:00
Owen Anderson
1441470be8 Add support for eliminate stores to stack-allocated memory locations at the end
of a function.

llvm-svn: 39754
2007-07-11 21:06:56 +00:00
Owen Anderson
e720144837 Handle eliminating stores that occur right before a free.
llvm-svn: 39753
2007-07-11 20:38:34 +00:00
Lauro Ramos Venancio
3d70855dd2 Handle packed structs in the CBackend.
llvm-svn: 39752
2007-07-11 19:56:53 +00:00
Anton Korobeynikov
d9625399fb Emit correct linkage. Patch by Roman Samoilov.
llvm-svn: 39751
2007-07-11 19:51:06 +00:00
Evan Cheng
ade8183fe8 Add test case for PR1545.
llvm-svn: 39749
2007-07-11 19:29:05 +00:00
Evan Cheng
6b6d1f685f Missed a couple of places where new instructions are added due to spill / restore.
llvm-svn: 39748
2007-07-11 19:17:18 +00:00
Owen Anderson
bf971aafb6 Clean up a few things based on Chris' feedback.
llvm-svn: 39747
2007-07-11 19:03:09 +00:00
Chris Lattner
49ec4b6eba update this.
llvm-svn: 39746
2007-07-11 18:58:19 +00:00
Tanya Lattner
ccecbcd779 Adding ability to demote phi to stack.
llvm-svn: 39744
2007-07-11 18:41:34 +00:00
Dale Johannesen
e59411d056 Fix hang compiling TimberWolf (allow for islands
of size other than 4).

llvm-svn: 39743
2007-07-11 18:32:38 +00:00
Chris Lattner
28404cf449 Test commit
llvm-svn: 39738
2007-07-11 17:31:59 +00:00
Lauro Ramos Venancio
09d73c0305 Assert when TLS is not implemented.
llvm-svn: 39737
2007-07-11 17:19:51 +00:00
Duncan Sands
03b274911f Exception handling has been implemented.
llvm-svn: 39732
2007-07-11 16:59:20 +00:00
Chris Lattner
63e92754d0 Convert .cvsignore files
llvm-svn: 39731
2007-07-11 06:43:45 +00:00
Steve Naroff
68b52f6df7 Bug #:
Submitted by:
Reviewed by:
Remove reference to Attr.h...

llvm-svn: 39730
2007-07-11 00:45:07 +00:00
Steve Naroff
b207d6bed7 Bug #:
Submitted by:
Reviewed by:
Removed Attr.[h,cpp]...they didn't have any useful content.

When more (GCC) attributes are added, we might want to create a file
of this ilk. For now, it's better to remove them (to eliminate any confusion).

I also update the Xcode project file...

llvm-svn: 39729
2007-07-11 00:42:37 +00:00
Steve Naroff
e728ba3504 Bug #:
Submitted by:
Reviewed by:
Two vector fixes:

- Sema::CheckAssignmentConstraints() needs to compare the canonical type.
- Expr::isLvalue() needs to disallow subscripting into a vector returned by a function. This
follows the rules for struct returns (in C, at least...C++ is another story:-)

Here is an example...

float4 float4_return()
{
    float4 xx;

    return xx;
}
void add_float4_void_return(float4 *a, float4 *b, float4 *result)
{
    float f;
    float4_return()[1] = f; // now illegal
}

llvm-svn: 39728
2007-07-10 22:20:04 +00:00
Chris Lattner
c14236b8ae implement codegen support for the "default argument promotions" (C99 6.5.2.2p6).
Not having this prevented promoting float arguments to double when passed
into printf, for example.

llvm-svn: 39727
2007-07-10 22:18:37 +00:00
Chris Lattner
11eef2eb9c remove obsolete comment.
llvm-svn: 39726
2007-07-10 22:18:03 +00:00
Chris Lattner
a779b3df28 implement codegen support for rvalue-only vector subscripts, such as:
float4 test(void);
float test2() {
  return test()[1];
}

llvm-svn: 39725
2007-07-10 21:58:36 +00:00
Chris Lattner
08c4b9ffec Add support for codegen'ing vector subscripts, at least when they are lvalues.
llvm-svn: 39724
2007-07-10 21:17:59 +00:00
Steve Naroff
b29cdd543f Bug #:
Submitted by:
Reviewed by:
Support the following...

1. Type checking and codegen support for V[i] on vectors. Hacked
Sema::ParseArraySubscriptExpr().

2. Unary bitwise complement ("~") on vectors. Hacked Sema::ParseUnaryOp().

llvm-svn: 39723
2007-07-10 18:23:31 +00:00
Chris Lattner
436806ad05 In code like this:
typedef float float4 __attribute__((vector_size (16)));
void addFloat4(float4 a, float4 b) {
    float4 temp;
}

make sure to add 'temp' to the stmt tree as a declstmt.

llvm-svn: 39722
2007-07-10 05:03:31 +00:00
Chris Lattner
50d4abd24c Add support for vector formal arguments.
llvm-svn: 39721
2007-07-10 00:28:12 +00:00
Chris Lattner
6eea886b9e implement support for llvm codegen of vectors. That was much easier than
I expected :)

llvm-svn: 39720
2007-07-10 00:23:39 +00:00
Steve Naroff
97b9e91eb7 Bug #:
Submitted by:
Reviewed by:
Added primitive support for 32-bit floating point literals.

llvm-svn: 39719
2007-07-09 23:53:58 +00:00
Chris Lattner
2ada32ed7d implement codegen support for FP literals
llvm-svn: 39718
2007-07-09 23:03:16 +00:00
Steve Naroff
84ff4b44b0 Bug #:
Submitted by:
Reviewed by:
Typechecking support for vectors...

- Added CheckVectorOperands(). Called from CheckAdditionOperands,
CheckMultiplyDivideOperands, CheckSubstractionOperands, and CheckBitwiseOperands.
- Added diagnostic for converting vector values of different size.
- Modified Type::isArithmeticType to include vectors.

Sould be ready for Chris to add code generation. I will continue testing/refining.

llvm-svn: 39717
2007-07-09 21:31:10 +00:00
Steve Naroff
4dddb6194b Bug #:
Submitted by:
Reviewed by:
Fix a bozo bug in HandleDeclAttribute...only install a new type when appropriate.
Also changed setType/setUnderlyingType to return void.

llvm-svn: 39716
2007-07-09 18:55:26 +00:00
Steve Naroff
4ae0ac6a06 Bug #:
Submitted by:
Reviewed by:
- Finished semantic analysis for vectors, added some diagnostics.
- Added AST for vectors (instantiation, installation into the decl).
- Fixed bug in ParseArraySubscriptExpr()...this crasher was introduced by me
when we added the range support.
- Turned pedantic off by default. Since vectors are gcc extensions, having
pedantic on by default was annoying. Turning it off by default is  also
consistent with gcc (but this wasn't my primary motivation).
- Tweaked some comments and diagnostics.

Note: The type checking code is still under construction (for vectors). This
will be my next check-in.

llvm-svn: 39715
2007-07-06 23:09:18 +00:00
Bill Wendling
a69300375b Submitted by: Bill Wendling
Reviewed by: Chris Lattner

- Fix for C++ casting operators failing during parsing. Deriving the C++ cast
  expressions from CastExpr was the wrong way to go. Its constructor creates
  null QualTypes in one of its constructors. This doesn't work well with how
  the C++ casting expression class wanted to do things. Derive just from Expr
  instead.

llvm-svn: 39714
2007-06-29 18:21:34 +00:00
Chris Lattner
47c247e7bf add codegen support for <<= and >>=.
llvm-svn: 39713
2007-06-29 17:26:27 +00:00
Chris Lattner
b25a94383a Implement the rest of the compound assignment operators, except shifts.
llvm-svn: 39712
2007-06-29 17:03:06 +00:00
Chris Lattner
cd215f00ee refactor some code, implement -=
llvm-svn: 39711
2007-06-29 16:52:55 +00:00
Chris Lattner
9369a563b4 Rename ArithAssignBinaryOperator -> CompoundAssignOperator, implement
codegen support for +=.

llvm-svn: 39710
2007-06-29 16:31:29 +00:00
Bill Wendling
772996ab44 Submitted by: Bill Wendling
- The && at the end was causing this to fail. Removed.

llvm-svn: 39709
2007-06-29 09:54:25 +00:00
Chris Lattner
bdf3f73eeb fix this test to work with the checker.
llvm-svn: 39708
2007-06-28 05:49:50 +00:00
Chris Lattner
11f49640ef Clients should only get read-only access to diagnostic info.
llvm-svn: 39707
2007-06-28 05:18:35 +00:00
Chris Lattner
318a9d7663 pick more logical names for routines.
llvm-svn: 39706
2007-06-28 05:17:33 +00:00
Chris Lattner
0d21046a7e Remove dead code.
llvm-svn: 39705
2007-06-28 05:10:07 +00:00
Chris Lattner
23e6353835 Eliminate almost all of the redundancy Bill introduced.
llvm-svn: 39704
2007-06-28 04:54:17 +00:00
Chris Lattner
08f0e0a001 add an accessor
llvm-svn: 39703
2007-06-28 04:53:50 +00:00
Chris Lattner
ea035b5fb8 remove diagchecker.h, add more missing files.
llvm-svn: 39702
2007-06-28 04:42:53 +00:00
Chris Lattner
af74985d71 Add a hack to fix a really subtle memory lifetime bug Bill introduced with his
recent changes.  carbon.h now preprocesses just fine.

llvm-svn: 39701
2007-06-28 04:10:04 +00:00
Chris Lattner
256c21b78a Record the intermediate computation type for compound assignments in the AST.
For example, for:

int test(short S, long L) {
  return S /= L;
}

record that the division is done as a long, even though the result type is
short.

llvm-svn: 39700
2007-06-28 03:53:10 +00:00
Bill Wendling
81217d6ff6 Submitted by: Bill Wendling
Update with -parse-ast-check.

llvm-svn: 39699
2007-06-28 00:54:14 +00:00
Bill Wendling
f476d025f8 Submitted by: Bill Wendling
Missing support for LLVM casting operators.

llvm-svn: 39698
2007-06-28 00:46:14 +00:00
Bill Wendling
5c9dde08e7 Submitted by: Bill Wendling
Small cleanup. No need to assign to a variable before returning.

llvm-svn: 39697
2007-06-28 00:45:30 +00:00
Bill Wendling
52b4b73442 Submitted by: Bill Wendling
Fixed checking to coincide with the correct lines.

llvm-svn: 39696
2007-06-27 18:18:03 +00:00
Bill Wendling
764b90ad4e Submitted by: Bill Wendling
- Revert use of -parse-ast-check.

llvm-svn: 39695
2007-06-27 18:13:04 +00:00
Chris Lattner
69e70e506a fix codegen of void return functions
llvm-svn: 39694
2007-06-27 18:10:00 +00:00
Chris Lattner
c8c3dadaa0 fix codegen of void-returning functions
llvm-svn: 39693
2007-06-27 18:08:49 +00:00
Chris Lattner
c2d8163bcd tersify output
llvm-svn: 39692
2007-06-27 17:26:23 +00:00
Chris Lattner
76148a9ded add diag checker to xcode proj
llvm-svn: 39691
2007-06-27 17:25:13 +00:00
Chris Lattner
a092b149bf rename LLVMDiagChecker.* -> DiagChecker.*
llvm-svn: 39690
2007-06-27 17:24:55 +00:00
Bill Wendling
a5b3bb11df Submitted by: Bill Wendling
- Chris noticed that if there were multiple warnings/errors expected
  throughout the file and we were checking only one of them, then it
  would go ahead and say that the whole file was okay. Fixed this by
  adding a check for the line number as well as the string.

llvm-svn: 39689
2007-06-27 07:43:27 +00:00
Bill Wendling
87e46687d9 Submitted by: Bill Wendling
Reviewed by: Chris Lattner

Split up lines to have only one expected output per line. Restored some
checks.

llvm-svn: 39688
2007-06-27 07:31:17 +00:00
Bill Wendling
fdddfc115e Submitted by: Bill Wendling
Reviewed by: Chris Lattner

- Reverted some checks because they're checking the preprocessor output.

llvm-svn: 39687
2007-06-27 07:26:41 +00:00
Bill Wendling
52b0a4e84e Submitted by: Bill Wendling
Removed unnecessary typedef.

llvm-svn: 39686
2007-06-27 07:24:11 +00:00
Chris Lattner
9b3b9a1922 add a method to get more precise arrow positioning for expressions. Rename
some ivars to more obvious names, eliminating some comments.

llvm-svn: 39685
2007-06-27 06:08:24 +00:00
Chris Lattner
a44d116835 implement the rest of Expr::hasLocalSideEffect
llvm-svn: 39684
2007-06-27 05:58:59 +00:00
Chris Lattner
c4c8e2546b New testcase for unused expression analysis
llvm-svn: 39683
2007-06-27 05:58:33 +00:00
Chris Lattner
1ec5f563c7 First cut at warning about expressions whose results are ignored. For example,
this produces:

warn.c:4:3: warning: expression result unused
  X == Y;
  ^~~~~~
warn.c:5:3: warning: expression result unused
  (void)X;
  ^~~~~~~
warn.c:11:3: warning: expression result unused
  A == foo(1, 2);
  ^~~~~~~~~~~~~~
warn.c:13:3: warning: expression result unused
  foo(1,2)+foo(4,3);
  ^~~~~~~~~~~~~~~~~

llvm-svn: 39682
2007-06-27 05:38:08 +00:00
Bill Wendling
eb2def66be Submitted by: Bill Wendling
- Converted to use the -parse-ast-check flag.

llvm-svn: 39681
2007-06-27 04:30:12 +00:00
Bill Wendling
ff1d2c81ba Submitted by: Bill Wendling
- Convert to using the -parse-ast-check method to check warnings and
  errors.

llvm-svn: 39680
2007-06-27 04:07:44 +00:00
Bill Wendling
97d4146c5a Submitted by: Bill Wendling
- Shouldn't increment the iterator but a copy of it.

llvm-svn: 39679
2007-06-27 04:06:59 +00:00
Bill Wendling
469211a295 Submitted by: Bill Wendling
Reviewed by: Chris Lattner

- Added a new diagnostic client, TextDiagnosticBuffer. It buffers all
  reported diagnostics.
- Use the new diagnostic client to check that expected diagnostics are
  actually emitted. The way this is done is to put the expected
  diagnostic in a comment on the line you expect it to be emitted for.
  Like this:

    int X = A; // expected-warning {{blah}}

- Use -parse-ast-check to use this feature.

llvm-svn: 39678
2007-06-27 03:19:45 +00:00
Chris Lattner
cd68f64551 Start bringing the exprstmt hook back.
llvm-svn: 39677
2007-06-27 01:06:29 +00:00
Bill Wendling
aec64c35f1 Submitted by: Bill Wendling
- Separate out the AST streamers from the clang.cpp file into their very
  own special files.

llvm-svn: 39676
2007-06-23 00:39:57 +00:00
Bill Wendling
26e1f8c05a Bug #:
Submitted by: Bill Wendling

- Convert std::cerr to using fprintf(stderr, ...) instead.

llvm-svn: 39675
2007-06-22 22:43:15 +00:00
Chris Lattner
54fb19efaa implement support for struct and complex returns.
llvm-svn: 39674
2007-06-22 22:02:34 +00:00
Chris Lattner
e9a6453ded add some infrastructure for codegen'ing complex numbers. implement addition
of complex.  We now produce optimal code for:

void test(_Complex float *Y) {
  *Y = *Y + *Y;
}

$ clang -emit-llvm cg.c | llvm-as | opt -std-compile-opts | llc -march=x86-64
...
_test:
        movss (%rdi), %xmm0
        addss %xmm0, %xmm0
        movss 4(%rdi), %xmm1
        movss %xmm0, (%rdi)
        addss %xmm1, %xmm1
        movss %xmm1, 4(%rdi)
        ret

llvm-svn: 39673
2007-06-22 21:44:33 +00:00
Chris Lattner
c6395936ae Split complex types out from being members of BuiltinType to being their own
types.

llvm-svn: 39672
2007-06-22 20:56:16 +00:00
Chris Lattner
f033c147c9 remove location tracking for target info
llvm-svn: 39671
2007-06-22 19:05:19 +00:00
Chris Lattner
0fb8465981 Don't forget to set this
llvm-svn: 39670
2007-06-22 18:57:44 +00:00
Chris Lattner
09153c0a8c Build enough support for aggregates to be able to compile this:
void test(int A, _Complex float Y) {
  _Complex float X;
  X = X;

}

llvm-svn: 39669
2007-06-22 18:48:09 +00:00
Chris Lattner
3e3a1e9cda implement lowering of complex types
llvm-svn: 39668
2007-06-22 18:15:26 +00:00
Chris Lattner
f39b03d98b fix naming of aggregate arguments.
llvm-svn: 39667
2007-06-22 18:15:16 +00:00
Chris Lattner
1fde0b345b implement codegen of the relational operations
One major FIXME though.

llvm-svn: 39666
2007-06-20 18:30:55 +00:00
Chris Lattner
273c63d450 Implement the equality operators for simple types
llvm-svn: 39665
2007-06-20 18:02:30 +00:00
Chris Lattner
e1e93a5e5d assert, don't crash, on int[]
llvm-svn: 39664
2007-06-20 17:12:11 +00:00
Chris Lattner
b6984c4854 Hook up global function and variable handling. We can now compile:
int X, bar(int,int,int);
short Y;

double foo() {
  return bar(X, Y, 3);
}

into:

@X = external global i32                ; <i32*> [#uses=1]
@Y = external global i16                ; <i16*> [#uses=1]

define double @foo() {
entry:
        %tmp = load i32* @X             ; <i32> [#uses=1]
        %tmp1 = load i16* @Y            ; <i16> [#uses=1]
        %promote = sext i16 %tmp1 to i32                ; <i32> [#uses=1]
        %call = tail call i32 @bar( i32 %tmp, i32 %promote, i32 3 )             ; <i32> [#uses=1]
        %conv = sitofp i32 %call to double              ; <double> [#uses=1]
        ret double %conv
}

declare i32 @bar(i32, i32, i32)

llvm-svn: 39663
2007-06-20 04:44:43 +00:00
Chris Lattner
b3fef07a30 add new files to xcode project
llvm-svn: 39662
2007-06-16 00:17:33 +00:00
Chris Lattner
2ccb73bc8b Refactor CodeGenTypes out to CodeGenModule so it can be used for functions
and globals.

llvm-svn: 39661
2007-06-16 00:16:26 +00:00
Chris Lattner
2052bc8107 Split type analysis out to its own file, now the integer constant expr evaluation
is ready.

llvm-svn: 39660
2007-06-16 00:12:05 +00:00
Chris Lattner
23b7eb677d Finally bite the bullet and make the major change: split the clang namespace
out of the llvm namespace.  This makes the clang namespace be a sibling of
llvm instead of being a child.

The good thing about this is that it makes many things unambiguous.  The
bad things is that many things in the llvm namespace (notably data structures
like smallvector) now require an llvm:: qualifier.  IMO, libsystem and libsupport
should be split out of llvm into their own namespace in the future, which will fix
this issue.

llvm-svn: 39659
2007-06-15 23:05:46 +00:00
Chris Lattner
2b228c95aa implement codegen of calls. We can now compile:
double foo( int (*FP)(int, int, int)) {
  return FP(1, 2, 3);
}

to:

define double @foo(i32 (i32, i32, i32)* %FP) {
entry:
        %call = tail call i32 %FP( i32 1, i32 2, i32 3 )
        %conv = sitofp i32 %call to double
        ret double %conv
}

llvm-svn: 39658
2007-06-15 21:34:29 +00:00
Bill Wendling
52d85bdd2b Submitted by: Bill Wendling
Reviewed by: Chris Lattner

- Refactor some code from main() and ProcessInputFile() so that it helps to
  decouple the initialization of the Preprocessor object from the
  diagnostic client.

llvm-svn: 39657
2007-06-15 21:20:00 +00:00
Chris Lattner
d760e468aa Don't generate code for prototypes
llvm-svn: 39656
2007-06-15 21:16:23 +00:00
Chris Lattner
b48238188e Fix a nasty bug which caused infinite recursion
llvm-svn: 39655
2007-06-15 21:04:38 +00:00
Steve Naroff
75c1723b3c Bug #:
Submitted by:
Reviewed by:
Fix CheckRelationalOperands/CheckEqualityOperands to deal with null pointer
constants. The new logic also deals (more) correctly for non-pointer/integer
operands.

llvm-svn: 39654
2007-06-13 21:41:08 +00:00
Chris Lattner
cf98efa73b Implement implicit conversions in return stmts.
llvm-svn: 39653
2007-06-13 20:50:31 +00:00
Chris Lattner
53621a535d Implement support for formal arguments. We can now compile this:
int test(int X, short Y, float Z) {
  return (int)(X*Y+Z);
}

to:

define i32 @test(i32 %X, i16 %Y, float %Z) {
entry:
        %promote = sext i16 %Y to i32           ; <i32> [#uses=1]
        %mul = mul i32 %promote, %X             ; <i32> [#uses=1]
        %promote3 = sitofp i32 %mul to float            ; <float> [#uses=1]
        %add = add float %promote3, %Z          ; <float> [#uses=1]
        %conv = fptosi float %add to i32                ; <i32> [#uses=1]
        ret i32 %conv
}

with:

$ clang -emit-llvm t.c | llvm-as | opt -std-compile-opts | llvm-dis

llvm-svn: 39652
2007-06-13 20:44:40 +00:00
Chris Lattner
23cff88741 Update the xcode project for bill
llvm-svn: 39651
2007-06-13 20:14:12 +00:00
Bill Wendling
478b88638f Submitted by: Bill Wendling
Reviewed by: Chris Lattner

- Created a base class (TextDiagnostics) for all text diagnostic classes.
  Moved the "IgnoreDiagnostic" method up there, and created a method that
  will format the diagnostic string, replacing %# with the appropriate
  string. This is in preparation for adding a text diagnostic checker.

llvm-svn: 39650
2007-06-13 17:45:37 +00:00
Steve Naroff
d6fbee81df Bug #:
Submitted by:
Reviewed by:
Fixed typechecking bugs wrt UsualUnaryConversions. Includes two distinct fixes:

#1: Call UsualUnaryConversions in CheckRelationalOperands/CheckEqualityOperands.
#2: UsualArithmeticConversions arguments are now output parameters. This insures
the implicit conversion is seen by clients (and fixes bugs in CheckAdditionOperands
and CheckSubtractionOperands when doing pointer arithmetic).
~

llvm-svn: 39649
2007-06-13 15:42:33 +00:00
Chris Lattner
c0a38dd38f Pretty print if/else/elseif chains nicer, like this:
void printutf8(unsigned int X) {
  if (X <= 127)
    printf("%c", (char)X);
  else if (X <= 2047)
    printf("%d %d ", 128 + 64 + (X >> 6), 128 + (X & ((1 << 6) - 1)));
  else if (X <= 65535)
    printf("%c%c%c", 128 + 64 + 32 + (X >> 12), 128 + ((X >> 6) & 63), 128 + (X & 63));
  else
    printf("UNKNOWN %d\n", X);

instead of:

  if (X <= 127)
    printf("%c", (char)X);
  else
    if (X <= 2047)
      printf("%d %d ", 128 + 64 + (X >> 6), 128 + (X & ((1 << 6) - 1)));
    else
      if (X <= 65535)
        printf("%c%c%c", 128 + 64 + 32 + (X >> 12), 128 + ((X >> 6) & 63), 128 + (X & 63));
      else
        printf("UNKNOWN %d\n", X);

llvm-svn: 39648
2007-06-11 22:26:23 +00:00
Chris Lattner
d4a20ad752 Wording fix for a diagnostic, suggested by bill
llvm-svn: 39647
2007-06-11 20:54:56 +00:00
Chris Lattner
f99b3f5ec2 Emit codegen of enum literals.
llvm-svn: 39646
2007-06-11 03:52:52 +00:00
Chris Lattner
9fba02845b Enums are integer constant exprs, return their values.
llvm-svn: 39645
2007-06-11 03:47:05 +00:00
Chris Lattner
4ef40013d7 Implement capturing of enum values and chaining of enums together.
llvm-svn: 39644
2007-06-11 01:28:17 +00:00
Steve Naroff
a8fd973aa0 Bug #:
Submitted by:
Reviewed by:
Implement semantic analysis for vector_size attribute!
We now produce the following diagnostics...

[administrators-powerbook59:~/llvm/tools/clang] admin% ../../Debug/bin/clang vector.c
vector.c:2:29: error: attribute requires precisely 1 argument
typedef int __attribute__(( vector_size )) tVecp;
                            ^
vector.c:7:32: error: attribute requires precisely 1 argument
extern int foo __attribute__(( vector_size ));
                               ^
vector.c:8:34: error: attribute requires precisely 1 argument
extern float bar __attribute__(( vector_size(16,18) ));
                                 ^
vector.c:11:34: error: vector_size requires integer constant (attribute ignored)
extern char foo2 __attribute__(( vector_size(16.2) ));
                                 ^           ~~~~
vector.c:21:47: error: invalid vector type 'struct s'
struct s { int a; } structVar __attribute__(( vector_size(16) ));

llvm-svn: 39643
2007-06-11 00:35:03 +00:00
Chris Lattner
843c592e28 GCC accepts code like this as an extension:
static int seminal(from, to)
{
}

llvm-svn: 39642
2007-06-10 23:40:34 +00:00
Bill Wendling
314ae547a1 Submitted by: Bill Wendling
Reviewed by: Chris Lattner

- Added a method "IgnoreDiagnostic" so that the diagnostic client can
  tell the diagnostic object that it doesn't want to handle a particular
  diagnostic message. In which case, it won't be counted as either a
  diagnostic or error.

llvm-svn: 39641
2007-06-10 04:13:42 +00:00
Steve Naroff
0f05a7ae7a Bug #:
Submitted by:
Reviewed by:
Changed the name of DeclSpec.AddAttribute and Declarator.AddAttribute to
AddAttributes(). Also added some (much needed) comments. While documenting,
realized I could simplify & tighten up Declarator.AddAttributes...

llvm-svn: 39640
2007-06-09 23:38:17 +00:00
Steve Naroff
5b6afadf81 Bug #:
Submitted by:
Reviewed by:
Add initialization and memory management for AttributeList.
Added a big FIXME comment for handling expressions (which are currently leaked).

llvm-svn: 39639
2007-06-09 14:13:39 +00:00
Chris Lattner
3f4b6e3623 Fix lexing octal escapes like:
void foo() {
"\0";
}

llvm-svn: 39638
2007-06-09 06:20:47 +00:00
Chris Lattner
b2dd241b15 fix a crash parsing spass
llvm-svn: 39637
2007-06-09 06:16:32 +00:00
Chris Lattner
ff591e24eb Don't warn about escaped newlines in // comments if the next line is also
a // comment, this reduces noise in the llvm testsuite.

llvm-svn: 39636
2007-06-09 06:07:22 +00:00
Chris Lattner
736ed5dfb8 accept __extension__, update todo list.
llvm-svn: 39635
2007-06-09 05:59:07 +00:00
Chris Lattner
6d9b49ae64 add another example
llvm-svn: 39634
2007-06-09 05:56:19 +00:00
Chris Lattner
0c7e82de07 Accept horrible code like this:
2005-10-18-VariableSizedElementCrash.c:5:41: warning: expected ';' at end of declaration list
  struct bar {foo f1; int f2:3; int f3:4} *p = (struct bar *) pi;
                                        ^

llvm-svn: 39633
2007-06-09 05:54:40 +00:00
Chris Lattner
36e46a219b Add support for a little extension. ISO C does not allow extra ;'s in structs,
e.g.:

struct A {
  ;
  int X;;
  const;
};

llvm-svn: 39632
2007-06-09 05:49:55 +00:00
Steve Naroff
9507c79698 Bug #:
Submitted by:
Reviewed by:
Incorporate some feedback from Chris.
Fixed a crasher, added an assert.

llvm-svn: 39631
2007-06-09 05:31:51 +00:00
Steve Naroff
6d26a892d4 Bug #:
Submitted by:
Reviewed by:
Move Attr.h to the correct group in the Xcode project file...

llvm-svn: 39630
2007-06-09 03:59:22 +00:00
Steve Naroff
06f0f8c414 Bug #:
Submitted by:
Reviewed by:
Lot's of attribute scaffolding.
Modernized ParseArraySubscriptExpr...call DefaultFunctionArrayConversion (which
simplified the logic considerably) and upgrade Diags to use the range support.

llvm-svn: 39629
2007-06-09 03:47:54 +00:00
Steve Naroff
b309644a35 Bug #:
Submitted by:
Reviewed by:
Lot's of attribute scaffolding.
Modernized ParseArraySubscriptExpr...call DefaultFunctionArrayConversion (which
simplified the logic considerably) and upgrade Diags to use the range support.

llvm-svn: 39628
2007-06-09 03:47:53 +00:00
Steve Naroff
29ca72ae02 Bug #:
Submitted by:
Reviewed by:
Add new file AttributeList.h

llvm-svn: 39627
2007-06-09 03:40:25 +00:00
Steve Naroff
b8371e1e6a Bug #:
Submitted by:
Reviewed by:
Add AttributeList.cpp (for "raw" attributes).

llvm-svn: 39626
2007-06-09 03:39:29 +00:00
Chris Lattner
45bb914249 Convert argument types over, which works for trivial scalars.
llvm-svn: 39625
2007-06-09 02:28:57 +00:00
Chris Lattner
1ad38f8fee codegen all declarators in a declstmt, allowing us to successfully codegen
stuff like:

void test() {
  int *X, Y, *Z[14];

  X[Y] = 4;
}

llvm-svn: 39624
2007-06-09 01:20:56 +00:00
Chris Lattner
776fac8703 Finally break down and chain together decls that are defined with common declspecs,
like: int X, Y, Z;

This is required for the code gen to get to all of the declarations in a
DeclStmt, and should simplify some other code.

llvm-svn: 39623
2007-06-09 00:53:06 +00:00
Chris Lattner
d9d2fb1420 Implement array subscripts for non-vla types.
llvm-svn: 39622
2007-06-08 23:31:14 +00:00
Chris Lattner
de12ae2fd7 Add support for binary literals:
http://gcc.gnu.org/onlinedocs/gcc/Binary-constants.html#Binary-constants

llvm-svn: 39621
2007-06-08 22:42:30 +00:00
Chris Lattner
8655428238 factor casts together, add a case for __extension__
llvm-svn: 39620
2007-06-08 22:32:33 +00:00
Chris Lattner
d0f76515f7 add missing case
llvm-svn: 39619
2007-06-08 22:16:53 +00:00
Chris Lattner
901ae1faf2 fix assertion on out-of-range shift
llvm-svn: 39618
2007-06-08 21:54:26 +00:00
Chris Lattner
4cd73fd380 Fix bugs in isIntegerConstantExpr handling character and enum literals
llvm-svn: 39617
2007-06-08 21:51:02 +00:00
Bill Wendling
344b92e993 Submitted by: Bill Wendling
- Say! why don't we increment the NumDiagnostics variable too?

llvm-svn: 39616
2007-06-08 19:21:50 +00:00
Bill Wendling
da0c8a9641 Submitted by: Bill Wendling
Reviewed by: Chris Lattner

- Make the counting of errors and diagnostic messages sane. Place them into the
  Diagnostic class instead of in the DiagnosticClient class.

llvm-svn: 39615
2007-06-08 19:17:38 +00:00
Chris Lattner
7cf04d1653 we correctly reject array of void now
llvm-svn: 39614
2007-06-08 18:15:09 +00:00
Chris Lattner
5a1a0250f8 this testcase has errors, we expect clang to reject it
llvm-svn: 39613
2007-06-08 18:14:27 +00:00
Chris Lattner
7a89360402 This testcase bus errors because semantics analysis of these operators isn't implemented.
llvm-svn: 39612
2007-06-08 18:13:24 +00:00
Chris Lattner
c84413e0a8 Diagnostics coming from a memory buffer (e.g. pragmas) don't have a
corresponding file buffer, don't dereference null pointers.  This
fixes a regression on test/Preprocessor/_Pragma-syshdr.c

llvm-svn: 39611
2007-06-08 18:11:33 +00:00
Chris Lattner
1abbd417be implement a fixme, fixing test/Sema/i-c-e1.c
llvm-svn: 39610
2007-06-08 17:58:43 +00:00
Chris Lattner
43312241ea new testcase
llvm-svn: 39609
2007-06-08 17:58:14 +00:00
Chris Lattner
e9a7da1d55 Make make check work again.
llvm-svn: 39608
2007-06-08 17:57:13 +00:00
Chris Lattner
e8b2724017 Fix a bug steve noticed where we warned that __attribute is an extension,
but where we didn't warn about __attribute__.

llvm-svn: 39607
2007-06-08 17:27:55 +00:00
Chris Lattner
2c1720681f add a new text file for low-prio QOI todos
llvm-svn: 39606
2007-06-08 17:15:31 +00:00
Chris Lattner
328fa5c913 Emit better diagnostics for out of range digits:
diag.c:1:9: error: invalid digit '8' in octal constant
int x = 000080;
        ^
diag.c:2:9: error: invalid digit 'A' in decimal constant
int z = 1000080ABC;
        ^

instead of:

diag.c:1:9: error: invalid suffix '80' on integer constant
int x = 000080;
        ^
diag.c:2:9: error: invalid suffix 'ABC' on integer constant
int z = 1000080ABC;
        ^

llvm-svn: 39605
2007-06-08 17:12:06 +00:00
Bill Wendling
c2b867ac4f Submitted by: Bill Wendling
- Renamed file guard.

llvm-svn: 39604
2007-06-07 18:58:07 +00:00
Bill Wendling
37b1ddecf6 Submitted by: Bill Wendling
Reviewed by: Chris Lattner

- Separated out the diagnostic client from the clang driver. This is in
  preparation for creating a diagnostic client that will be used to check
  error and warning messages.

llvm-svn: 39603
2007-06-07 09:34:54 +00:00
Steve Naroff
98d153c730 Bug #:
Submitted by:
Reviewed by:

Fixed a bug in the parser's handling of attributes on pointer declarators.

For example, the following code was producing a syntax error...

int *__attribute(()) foo;

attrib.c:10:25: error: expected identifier or '('
int *__attribute(()) foo;
                        ^
Changed Parser::ParseTypeQualifierListOpt to not consume the token following
an attribute declaration.

Also added LexerToken::getName() convenience method...useful when tracking
down errors like this.

llvm-svn: 39602
2007-06-06 23:19:11 +00:00
Steve Naroff
98cf3e95ce Bug #:
Submitted by:
Reviewed by:

The following code illustrates a bug in the semantic analysis for assignments:

int func() {
  int *P;
  char *x;
  P = x; // type of this assignment expression should be "int *", NOT "char *".
}

While the type checking/diagnostics are correct, the type of the assignment
expression is incorrect (which shows up during code gen).  With the fix,
the llvm code looks correct...

[dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang cast.c -emit-llvm
cast.c:4:5: warning: incompatible pointer types assigning 'char *' to 'int *'
  P = x; // type of assignment expression is "int *", NOT "char *".
  ~ ^ ~
; ModuleID = 'foo'

define i32 @func() {
entry:
        %P = alloca i32*                ; <i32**> [#uses=1]
        %x = alloca i8*         ; <i8**> [#uses=1]
        %allocapt = bitcast i32 undef to i32            ; <i32> [#uses=0]
        %tmp = load i8** %x             ; <i8*> [#uses=1]
        %conv = bitcast i8* %tmp to i32*                ; <i32*> [#uses=1]
        store i32* %conv, i32** %P
        ret i32 undef
}

Even though the fix was simple, I decided to rename/refactor the surrounding code
to make a clearer distinction between constraint checking and conversion.

- Renamed AssignmentConversionResult -> AssignmentCheckResult.
- Renamed UsualAssignmentConversions -> CheckAssignmentConstraints.
- Changed the return type of CheckAssignmentConstraints and CheckPointerTypesForAssignment
from QualType -> AssignmentCheckResult. These routines no longer take a reference to the result (obviously).
- Changed CheckAssignmentOperands to return the correct type (with spec annotations).

llvm-svn: 39601
2007-06-06 18:38:38 +00:00
Chris Lattner
2e550fea6a When parsing an expr in stmt context, make sure to consume the semicolon
after the expr along with the expr.  If we don't do this, the semicolon
gets parsed as a nullstmt, which makes the generated AST very strange.

llvm-svn: 39600
2007-06-06 05:26:32 +00:00
Chris Lattner
3d01e4eacb On bogus code like this:
int *P2;
  P2(1, 2, 3);

  register short X;
  X();

emit:

ds.c:10:3: error: called object is not a function or function pointer
  P2(1, 2, 3);
  ^~~~~~~~~~~
ds.c:13:3: error: called object is not a function or function pointer
  X();
  ^~~

instead of aborting.

llvm-svn: 39599
2007-06-06 05:14:05 +00:00
Chris Lattner
3343f81a25 Fix semantic analysis of calls on stuff like:
int func() {
 int (*FP)();
 FP();
 (*****FP)();
}

llvm-svn: 39598
2007-06-06 05:05:41 +00:00
Chris Lattner
4347e369b4 implement codegen of string literals.
llvm-svn: 39597
2007-06-06 04:54:52 +00:00
Chris Lattner
83b484b3be implement the real int/fp conversions
llvm-svn: 39596
2007-06-06 04:39:08 +00:00
Chris Lattner
cf106ab42a implement support for casts to/from pointers.
llvm-svn: 39595
2007-06-06 04:05:39 +00:00
Chris Lattner
6563712933 xcode randomly changed the project, who knows what this does
llvm-svn: 39594
2007-06-05 20:53:44 +00:00
Chris Lattner
8394d795c3 implement codegen of a bunch more loop constructs and most expressions
llvm-svn: 39593
2007-06-05 20:53:16 +00:00
Chris Lattner
fdc195af7e Various improvements to the tree printer, including printing decls in for stmts prettier etc
llvm-svn: 39592
2007-06-05 20:52:47 +00:00
Chris Lattner
1d411a826e add some fixme's for incorrect sema
llvm-svn: 39591
2007-06-05 20:52:21 +00:00
Chris Lattner
6d26a03d12 rename forstmt accessors, add const accessors
llvm-svn: 39590
2007-06-05 20:51:37 +00:00
Steve Naroff
6d9de3dd74 Bug #:
Submitted by:
Reviewed by:
Touch up a couple comments (one was incorrect/out-of-date).

llvm-svn: 39589
2007-06-05 19:14:28 +00:00
Chris Lattner
66cfa8ad81 add another fixme
llvm-svn: 39588
2007-06-05 06:40:31 +00:00
Chris Lattner
6046e008aa Rename Sema::isConstantArrayType -> VerifyConstantArrayType. Make sure to
check canonical types in a few places.  Tighten up VerifyConstantArrayType
to diagnose more errors, now that we can evaluate i-c-e's.  Add some fixmes
about poor diagnostics.

We now correctly typecheck this example:

void s(void) {
  typedef int a[(int) +1.0];
  static a b;    // invalid, static VLA

  static int c[(int) +1.0];  // invalid, static VLA
}

void t(void) {
  typedef int a[(int)1.0];
  static a b;    // valid, constant size
}

void u() {
  static int X[-1];
  static int Y[0];
}

producing:

static-vla.c:3:12: error: variable length array declared outside of any function
  static a b;    // invalid, static VLA
           ^
static-vla.c:5:14: error: variable length array declared outside of any function
  static int c[(int) +1.0];  // invalid, static VLA
             ^ ~~~~~~~~~~
static-vla.c:15:14: error: array size is negative
  static int X[-1];
             ^ ~~
static-vla.c:16:14: warning: zero size arrays are an extension
  static int Y[0];
             ^ ~

llvm-svn: 39587
2007-06-05 06:39:23 +00:00
Chris Lattner
3e4dabe4bf simplify Type::isConstantSizeType based on knowledge that it is only called
on complete types.

llvm-svn: 39586
2007-06-05 06:02:48 +00:00
Chris Lattner
e0da5dc8f2 Change Expr::isIntegerConstantExpr in two ways:
1. Compute and return the value of the i-c-e if the expression is one.
  2. Use this computation to correctly track whether subexprs are being
     evaluated, and use this to guide diagnostics appropriately.

This allows us to correctly handle all the cases in:

void bar() {
  int foo();
  switch (1) {
  case 1 ? 0 : foo():    // bad
  case 0 ? 0 : foo():    // bad

  case 0 ? 1/0 : 14 :  // ok
  case 1 ? 1/0 : 14 :  // bad
    ;
  }

  switch (1) {
  case 1 ? 2: (2, 3): // ok
  case 0 ? 2: (2, 3): // invalid comma.
    ;
  }
}

This code has numerous todo items.  Specifically, we need to:
  1. Pass in target info, so we know the size of the integers we are producing.
  2. Model type sizes and alignments correctly, so we can eval sizeof/alignof
  3. Handle promotions (need to talk to steve about this).
  4. Return an enum that can be used to better diagnose problems with i-c-e's.
     instead of just saying "this isn't valid" we should be able to say why.
  5. Various other miscellanea, like handling enums and character literals
     properly.

llvm-svn: 39585
2007-06-05 05:58:31 +00:00
Chris Lattner
1f4479e770 Nothing currently wants to know if something is a constantexpr. Simplify
isConstantExpr into just isIntegerConstantExpr in preparation for other
changes.

llvm-svn: 39584
2007-06-05 04:15:44 +00:00
Chris Lattner
ab0b2df469 fix two checks that should be integer-constant-exprs not just c-e's.
llvm-svn: 39583
2007-06-05 04:12:06 +00:00
Chris Lattner
946aa31f02 implement codegen of while stmts and lvalue evaluation of paren exprs :)
llvm-svn: 39582
2007-06-05 03:59:43 +00:00
Steve Naroff
71b59a9a29 Bug #:
Submitted by:
Reviewed by:
Fixed an "impurity" in the typechecking code (to more closely model the
C99 spec)...

- Added function Sema::DefaultFunctionArrayConversion(). This is called
by UsualUnaryConversions(). It is also called from several contexts that
don't call for integer promotions (logical negation for expressions, and
while/if/do/for conditions in statements). It is also used in
UsualAssignmentConversions (which is cleaner than the check I was using
before).

- Changed the name from UsualUnaryConversion->UsualUnaryConversions.

- Added comments to the header.

Since several contexts don't call for integer
promotions,

llvm-svn: 39581
2007-06-04 22:22:31 +00:00
Steve Naroff
c27f89ebb3 Bug #:
Submitted by:
Reviewed by:
Apply UsualUnaryConversion() to statement conditions that expect scalars.
UsualUnaryConversion() converts function/arrays to pointers.

This fixes the following...

int func() {
  int A[10];
  while (A) {
  }
  if (A) ;
  for (; A; ) ;
}

llvm-svn: 39580
2007-06-03 18:23:48 +00:00
Bill Wendling
cbf4709c03 Add const/volatile badness
llvm-svn: 39579
2007-06-03 09:02:28 +00:00
Chris Lattner
64453e63ea fix a predicate I just broke
llvm-svn: 39578
2007-06-03 07:27:29 +00:00
Chris Lattner
b16f455e8c Type::isSignedInteger() and isUnsignedInteger() did not properly account for
'char', which varies based on the target.

Instead of spreading target knowledge throughout the compiler, bifurcate char
into Char_S and Char_U, and have ASTContext create the right one based on the
target, when it starts up.

llvm-svn: 39577
2007-06-03 07:25:34 +00:00
Chris Lattner
cf25024828 Implement EmitUsualArithmeticConversions, so we can add shorts to floats and
ints to long long etc.  For int to longlong, we now get:

        %tmp = load i64* %F             ; <i64> [#uses=1]
        %tmp1 = load i32* %D            ; <i32> [#uses=1]
        %promote = sext i32 %tmp1 to i64                ; <i64> [#uses=1]
        %tmp2 = add i64 %tmp, %promote          ; <i64> [#uses=0]

llvm-svn: 39576
2007-06-03 02:02:44 +00:00
Chris Lattner
35e287bed1 eliminate unneeded cast
llvm-svn: 39575
2007-06-03 01:44:43 +00:00
Chris Lattner
0c46c5d55a Fix a fixme, produce diagnostics like this:
ds.c:11:16: error: case label does not reduce to an integer constant
  case 0 ? 0 : foo():
       ~~~~~~~~^~~~~

llvm-svn: 39574
2007-06-02 23:53:17 +00:00
Bill Wendling
fa0c8f945f Submitted by: Bill Wendling
- Small error fix.

llvm-svn: 39573
2007-06-02 23:36:05 +00:00
Bill Wendling
7d4562b42b Submitted by: Bill Wendling
Reviewed by: Chris Lattner

- Add a reference decl type.

llvm-svn: 39572
2007-06-02 23:34:45 +00:00
Bill Wendling
d8236f166f Submitted by: Bill Wendling
Reviewed by: Chris Lattner

- Diagnostic messages for invalid reference usage.

llvm-svn: 39571
2007-06-02 23:32:47 +00:00
Bill Wendling
a0057196cb Submitted by: Bill Wendling
Reviewed by: Chris Lattner

- Method declaration.

llvm-svn: 39570
2007-06-02 23:31:25 +00:00
Bill Wendling
8c06ef8851 Submitted by: Bill Wendling
Reviewed by: Chris Lattner

- Disallow references to references, pointers to references, or arrays of
  references.

llvm-svn: 39569
2007-06-02 23:30:50 +00:00
Bill Wendling
db4f06ed2c Submitted by: Bill Wendling
Reviewed by: Chris Lattner

- If the LHS and/or RHS is a reference, then see if they're compatible.
  If so, the type is that of the LHS.

llvm-svn: 39568
2007-06-02 23:29:59 +00:00
Bill Wendling
93efb22993 Submitted by: Bill Wendling
Reviewed by: Chris Lattner

- Update the parsing of references. We allow "restrict" but not "const"
  or "volatile".

llvm-svn: 39567
2007-06-02 23:28:54 +00:00
Bill Wendling
5d107662f0 Submitted by: Bill Wendling
Reviewed by: Chris Lattner

- Added a method to determine if two types, where at least one is a
  reference, are compatible. That is you can assign the RHS to the LHS.

llvm-svn: 39566
2007-06-02 23:27:35 +00:00
Chris Lattner
c18f9d1aed Change EmitUsualArithmeticConversions to use EmitExprWithUsualUnaryConversions.
This allows us to compile:

  register short X;
  {
    int Y;
    return 1+X+Y;

into:

        %tmp = load i16* %X             ; <i16> [#uses=1]
        %promote = sext i16 %tmp to i32         ; <i32> [#uses=1]
        %tmp1 = add i32 1, %promote             ; <i32> [#uses=1]
        %tmp2 = load i32* %Y            ; <i32> [#uses=1]
        %tmp3 = add i32 %tmp1, %tmp2            ; <i32> [#uses=1]
        ret i32 %tmp3

Look at the amazing sign extension, so much happier than an assertion failure. :)

llvm-svn: 39565
2007-06-02 22:51:30 +00:00
Chris Lattner
6db1fb845a implement a first hack at codegen'ing the usual unary conversions.
This allows us to compile:

int func() {
  int A[10];
  if (!A) {

to:

define i32 @func() {
entry:
        %A = alloca [10 x i32]          ; <[10 x i32]*> [#uses=1]
        %arraydecay = getelementptr [10 x i32]* %A, i32 0, i32 0                ; <i32*> [#uses=1]
        %tobool = icmp ne i32* %arraydecay, null                ; <i1> [#uses=1]
        %lnot = xor i1 %tobool, true            ; <i1> [#uses=1]
        br i1 %lnot, label %ifthen, label %ifend

-Chris

llvm-svn: 39564
2007-06-02 22:49:07 +00:00
Chris Lattner
226d419e21 trivial simplification
llvm-svn: 39563
2007-06-02 22:47:37 +00:00
Chris Lattner
ea3c20b9eb When a function decays into its address, ensure the result type keeps any
typedef information associated with the input.

llvm-svn: 39562
2007-06-02 22:47:04 +00:00
Chris Lattner
2b4e21ac3f Implement translation of pointer, reference and simple array types. We now
compile:

void foo() {
  int A[10];
  int *P;

into:

entry:
        %A = alloca [10 x i32]          ; <[10 x i32]*> [#uses=0]
        %P = alloca i32*                ; <i32**> [#uses=0]

llvm-svn: 39561
2007-06-02 19:52:24 +00:00
Chris Lattner
a45c5af87b Implement a trivial optimization to reduce the number of compares emitted.
For:

  register short X;
  if (!X) {

We now produce:

        %tmp = load i16* %X             ; <i16> [#uses=1]
        %tobool = icmp ne i16 %tmp, 0           ; <i1> [#uses=1]
        %lnot = xor i1 %tobool, true            ; <i1> [#uses=1]
        br i1 %lnot, label %ifthen, label %ifend

instead of:

        %tmp = load i16* %X             ; <i16> [#uses=1]
        %tobool = icmp ne i16 %tmp, 0           ; <i1> [#uses=1]
        %lnot = xor i1 %tobool, true            ; <i1> [#uses=1]
        %lnot.ext = zext i1 %lnot to i32                ; <i32> [#uses=1]
        %tobool1 = icmp ne i32 %lnot.ext, 0             ; <i1> [#uses=1]
        br i1 %tobool1, label %ifthen, label %ifend

llvm-svn: 39560
2007-06-02 19:47:04 +00:00
Chris Lattner
f0106d2578 Refactor EvaluateScalarValueToBool out of if statement emission, so it can
be shared.

Implement infrastructure for unary operator emission.

Implement basic logical not support.  We now compile:

  register short X;

  if (!X) {

into:

        %tmp = load i16* %X             ; <i16> [#uses=1]
        %tobool = icmp ne i16 %tmp, 0           ; <i1> [#uses=1]
        %lnot = xor i1 %tobool, true            ; <i1> [#uses=1]
        zext i1 %lnot to i32            ; <i32>:0 [#uses=1]
        %tobool1 = icmp ne i32 %0, 0            ; <i1> [#uses=1]
        br i1 %tobool1, label %ifthen, label %ifend

llvm-svn: 39559
2007-06-02 19:33:17 +00:00
Chris Lattner
be31ed8e88 Correct the type of logical not.
llvm-svn: 39558
2007-06-02 19:11:33 +00:00
Bill Wendling
d6de65740d Submitted by: Bill Wendling
- Added C99 reference to why "auto" and "register" cannot be used as a
  storage class specifier for file scoped variable declarations.

llvm-svn: 39557
2007-06-02 09:40:07 +00:00
Chris Lattner
b4522b4dec Pretty print storage classes for vardecls.
llvm-svn: 39556
2007-06-02 05:27:01 +00:00
Chris Lattner
d7f58867e5 Implement scaffolding for lvalues. Implement block vardecl lvalues.
This allows us to translate:

int func() {
  register int X;
  {
    int Y;
    return 1+X+Y;
  }
}

into:

define i32 @func() {
entry:
        %X = alloca i32         ; <i32*> [#uses=1]
        %Y = alloca i32         ; <i32*> [#uses=1]
        %allocapt = bitcast i32 undef to i32            ; <i32> [#uses=0]
        %tmp = load i32* %X             ; <i32> [#uses=1]
        %tmp1 = add i32 1, %tmp         ; <i32> [#uses=1]
        %tmp2 = load i32* %Y            ; <i32> [#uses=1]
        %tmp3 = add i32 %tmp1, %tmp2            ; <i32> [#uses=1]
        ret i32 %tmp3
                ; No predecessors!
        ret i32 undef
}

llvm-svn: 39555
2007-06-02 05:24:33 +00:00
Bill Wendling
44ebec5310 Submitted by: Bill Wendling
Removed #include <iostream>.

llvm-svn: 39554
2007-06-02 05:06:35 +00:00
Chris Lattner
03df12294b Add initial support for fixed-size local vardecls. This allows us to compile:
int func() {
  register int X;
  {
    int Y;

into:

define i32 @func() {
entry:
        %X = alloca i32         ; <i32*> [#uses=0]
        %Y = alloca i32         ; <i32*> [#uses=0]
        %allocapt = bitcast i32 undef to i32            ; <i32> [#uses=0]
...

llvm-svn: 39553
2007-06-02 04:53:11 +00:00
Chris Lattner
238cbc58c3 Modify Expr::isConstantExpr and friends take a pointer to a SourceLoc instead
of one by reference, making it optional.

llvm-svn: 39552
2007-06-02 04:48:48 +00:00
Chris Lattner
5e1f32a16f reorder files alphabetically
llvm-svn: 39551
2007-06-02 04:47:52 +00:00
Chris Lattner
84915fa79b Start stubbing out decl codegen.
llvm-svn: 39550
2007-06-02 04:16:21 +00:00
Chris Lattner
e0c4ae1f24 Generalize this to support printing any valuedecl, e.g. function definitions.
We now print:
  extern void blah();
as:
  void (blah)();

Strange, but ok :)

llvm-svn: 39549
2007-06-02 03:38:08 +00:00
Chris Lattner
d1c1c94663 DeclStmt can be just about any type of decl.
llvm-svn: 39548
2007-06-02 03:35:40 +00:00
Chris Lattner
3f3dbeedd3 implement codegen support for return of void and simple scalars.
llvm-svn: 39547
2007-06-02 03:19:07 +00:00
Chris Lattner
adb6372aa5 Add support for functions that return non-void.
llvm-svn: 39546
2007-06-02 03:02:07 +00:00
Chris Lattner
db91b16755 stub out codegen of binary plus. We now compile:
if (11 + 42) {

to:

        %tmp = add i32 11, 42           ; <i32> [#uses=1]
        %tobool = icmp ne i32 %tmp, 0           ; <i1> [#uses=1]
        br i1 %tobool, label %ifthen, label %ifend


but this doesn't handle any of the interesting/hard stuff yet.

llvm-svn: 39545
2007-06-02 00:16:28 +00:00
Chris Lattner
3e450f947b add new files.
llvm-svn: 39544
2007-06-02 00:01:41 +00:00
Steve Naroff
4555292b1e Bug #:
Submitted by:
Reviewed by:
After speaking with Chris, decided not to have GCC "attributes" inherit
from Decl. This will enable us to grow the attribute hierarchy over time
without effecting Decls.

llvm-svn: 39543
2007-06-01 21:56:17 +00:00
Steve Naroff
6a0675f8a4 Bug #:
Submitted by:
Reviewed by:
Add implemention file for GCC attributes

llvm-svn: 39542
2007-06-01 21:54:34 +00:00
Steve Naroff
ff12778709 Bug #:
Submitted by:
Reviewed by:
Interface file for GCC attributes.

llvm-svn: 39541
2007-06-01 21:53:25 +00:00
Chris Lattner
e47e440c42 split stmt/expr codegen into their own files.
llvm-svn: 39540
2007-06-01 18:02:12 +00:00
Steve Naroff
0f2fe17ff1 Bug #:
Submitted by:
Reviewed by:
Implement support for GCC __attribute__.

- Implement "TODO" in Parser::ParseAttributes. Changed the return type from
void to Parser::DeclTy. Changed all call sites to accept the return value.
- Added Action::ParseAttribute and Sema::ParseAttribute to return an
appropriate AST node. Added new node AttributeDecl to Decl.h.

Still to do...hook up to the Decl...

llvm-svn: 39539
2007-06-01 17:11:19 +00:00
Chris Lattner
a076fde1e3 more minor improvements to pretty printer.
llvm-svn: 39538
2007-05-31 18:21:33 +00:00
Chris Lattner
b4619481e6 add some ;'s
llvm-svn: 39537
2007-05-31 06:00:14 +00:00
Chris Lattner
1c31050d21 add fixme
llvm-svn: 39536
2007-05-31 06:00:00 +00:00
Chris Lattner
df3cafb796 fix a small printer bug, to emit:
a = b;
  {
    int c;
    c = a + b;
    int d;
    d++;
  }
  int e;

instead of:

  a = b;
  {
    int c;
    c = a + b;
    int d;
    d++;
  }  int e;

llvm-svn: 39535
2007-05-31 05:08:56 +00:00
Chris Lattner
dc6e3feade emit a return at the end of the function. Run the llvm verifier.
llvm-svn: 39534
2007-05-30 22:55:31 +00:00
Chris Lattner
5269c0377c Add support for codegen'ing paren exprs and if stmts. We can now codegen:
void test() {
  goto l;

l:
  if (11) {
    j: ;
  }
}

into:

define void @test() {
entry:
        br label %l

l:              ; preds = %entry
        icmp ne i32 11, 0               ; <i1>:0 [#uses=1]
        br i1 %0, label %ifthen, label %ifend

ifthen:         ; preds = %l
        br label %j

j:              ; preds = %ifthen
        br label %ifend

ifend:          ; preds = %j, %l
}

whoa... :)

llvm-svn: 39533
2007-05-30 21:03:58 +00:00
Chris Lattner
b2e723bed4 add accessor
llvm-svn: 39532
2007-05-30 20:59:30 +00:00
Chris Lattner
fc068c15d9 pretty print exprs in stmt contexts with a trailing semicolon.
llvm-svn: 39531
2007-05-30 17:57:36 +00:00
Chris Lattner
208ae96a8c implement codegen of integer literals.
llvm-svn: 39530
2007-05-30 17:57:17 +00:00
Chris Lattner
b5217858ee Update
llvm-svn: 39529
2007-05-30 17:01:31 +00:00
Steve Naroff
9992bbab14 Bug #:
Submitted by:
Reviewed by:
- ParseForStatement(): Put back a test/assignment. My removal of
ParseExprStmt() was a bit over zealous:-(thanks to Chris for pointing it out)
- Add assert to VisitDeclStmt().
- Removed an out-of-date FIXME
- Added some curlies for a couple multi-line calls to Diag().

llvm-svn: 39528
2007-05-30 16:27:15 +00:00
Bill Wendling
216423bbd7 Submitted by: Bill Wendling
Comment format changes.

llvm-svn: 39527
2007-05-30 06:30:29 +00:00
Steve Naroff
56faab2d4f Bug #:
Submitted by:
Reviewed by:
- Many tweaks to various diagnostics.
- Fixed some location/range issues.
- Bug fix to Sema::ParseDeclStmt() - error return code is "true", not 0.

llvm-svn: 39526
2007-05-30 04:20:12 +00:00
Bill Wendling
4447083418 Submitted by: Bill Wendling
- Conjugate "diagnostic" correctly for 1 diagnostic.

llvm-svn: 39525
2007-05-30 02:38:09 +00:00
Chris Lattner
ac24820fa5 Implement codegen support for labels and gotos. We now compile:
void test1() {
  foo:
    goto foo;
    goto foo;
    goto foo;
}

void test() {
  goto l;

l:
  ;
}
into:

define void @test1() {
entry:
        br label %foo

foo:            ; preds = %0, %foo, %entry
        br label %foo
                ; No predecessors!
        br label %foo
                ; No predecessors!
}

define void @test() {
entry:
        br label %l

l:              ; preds = %entry
}

llvm-svn: 39524
2007-05-30 00:13:02 +00:00
Steve Naroff
eb9da94d37 Bug #:
Submitted by:
Reviewed by:
Unified the diagnostics for function calls. Since we have range support,
there is no need for including the argument number. Instead, I've made
the diags more expressive by including more type info.

Also improved the indentation of many calls to Diag (which can be 2-3
lines now).

llvm-svn: 39523
2007-05-30 00:06:37 +00:00
Chris Lattner
308f431017 Add codegen support for NullStmt and CompoundStmt. {;;{};;} is now ours!
llvm-svn: 39522
2007-05-29 23:50:05 +00:00
Chris Lattner
d5322cd27e Don't print billions of spaces for a label with no indent.
llvm-svn: 39521
2007-05-29 23:49:07 +00:00
Chris Lattner
da8a4f467b add accessors.
llvm-svn: 39520
2007-05-29 23:48:32 +00:00
Chris Lattner
d1af2d2956 Implement conversion of clang ast types to LLVM types, at least for some trivial
cases.

llvm-svn: 39519
2007-05-29 23:17:50 +00:00
Steve Naroff
2a8ad18e71 Bug #:
Submitted by:
Reviewed by:
Implement some FIXME's that stand in the way of fully typechecking "for"
statements. This involved:

- Adding a DeclStmt AST node (with statement visitor). The DeclStmt
printer is preliminary.
- Added a ParseDeclStmt action, called from Parser::ParseForStatement()
and Parser::ParseStatementOrDeclaration(). DID NOT add to
Parser::ParseIdentifierStatement()...probably could have, however didn't
really understand the context of this rule (will speak with Chris).
- Removed ParseExprStmt (and it's clients)...it was vestigial.

llvm-svn: 39518
2007-05-29 22:59:26 +00:00
Steve Naroff
6f49f5df03 Bug #:
Submitted by:
Reviewed by:
- Finished Sema::ParseReturnStmt(). Still need to tweak ranges.
- Tweaked location for function arguments (they now point at the expression directly, no parens or commas).
- Added InvalidOperands helper...was sick of looking at the same 3 lines in ~9 Check functions.
- Added a few diags and moved a group of statement diags to the proper comment/category.

llvm-svn: 39517
2007-05-29 14:23:36 +00:00
Chris Lattner
e64a1b5275 Fix two bugs that fell out from a testcase steve noticed. for this testcase:
extern int pintFunc(int *, int *);

int test() {
  pintFunc(0,
           3);
}

We now print:

t3.c:4:13: warning: passing argument 2 makes pointer from integer without a cast
  pintFunc(0,
  ~~~~~~~~  ^

instead of:

t3.c:4:13: warning: passing argument 2 makes pointer from integer without a cast
  pintFunc(0,
  ~~~~~~~~

llvm-svn: 39516
2007-05-29 05:53:15 +00:00
Steve Naroff
86272ea1fe Bug #:
Submitted by:
Reviewed by:
Implement type checking for ParseDoStmt, ParseWhileStmt, ParseIfStmt, and
ParseForStmt. ParseForStmt still under construction (contains a FIXME).

llvm-svn: 39515
2007-05-29 02:14:17 +00:00
Steve Naroff
3c87a57a2c Bug #:
Submitted by:
Reviewed by:
Add range support to Sema::CheckConditionalOperands().

llvm-svn: 39514
2007-05-28 19:40:22 +00:00
Steve Naroff
8563f65042 Bug #:
Submitted by:
Reviewed by:
Refine Sema::ParseCallExpr() diags (range support, add types).

Before:

func-assign.c:27:11: warning: passing argument 1 from incompatible pointer type
  pintFunc(&FOO);
          ^
func-assign.c:28:12: error: incompatible type for argument 1
  floatFunc(&FOO);
           ^
func-assign.c:29:12: error: too many arguments to function
  floatFunc(1,2,3);
           ^
After:

func-assign.c:27:11: warning: passing incompatible pointer 'struct foo *' to function expecting 'int *'
  pintFunc(&FOO);
  ~~~~~~~~^~~~~
func-assign.c:28:12: error: passing incompatible type 'struct foo *' to function expecting 'float'
  floatFunc(&FOO);
  ~~~~~~~~~^~~~~
func-assign.c:29:12: error: too many arguments to function
  floatFunc(1,2,3);
  ~~~~~~~~~^  ~

llvm-svn: 39513
2007-05-28 19:25:56 +00:00
Steve Naroff
758ada12f4 Bug #:
Submitted by:
Reviewed by:
- Implement FIXME in Sema::CheckIndirectionOperand().
- Added "const" to FunctionDecl::getResultType().

llvm-svn: 39512
2007-05-28 16:15:57 +00:00
Chris Lattner
010015a11e Add a note about an unimplemented gnu extension.
llvm-svn: 39511
2007-05-28 07:23:54 +00:00
Chris Lattner
eefa10e78a implement full sema support for the GCC address-of-label extension.
llvm-svn: 39510
2007-05-28 06:56:27 +00:00
Chris Lattner
e2473068d4 Change GotoStmt's to have a pointer to the LabelStmt instead of a pointer to
the label identifier.  Handle fwd references etc.  This allows us to detect
uses of undefined labels and label redefinitions, such as:

t.c:2:12: error: redefinition of label 'abc'
  abc: ;   abc:
           ^
t.c:2:3: error: previous definition is here
  abc: ;   abc:
  ^
t.c:12:12: error: use of undeclared label 'hijl'
      goto hijl;
           ^

llvm-svn: 39509
2007-05-28 06:28:18 +00:00
Chris Lattner
ac4471c963 Improve the parsers resilience to sematic errors. This allows us to turn:
void foo() {
  if (0) break;
  abc:
  def:
  hij:
    break;

into:

void foo() {
  if ((0)')
    ;
abc:
def:
hij:
  ;

instead of dropping the if and labels (due to break not being in a loop).

llvm-svn: 39508
2007-05-28 05:38:24 +00:00
Chris Lattner
2f6ac263ef Null pointers in the ast are no longer considered to be the null stmt.
llvm-svn: 39507
2007-05-28 01:47:47 +00:00
Chris Lattner
0f203a7c1c add action for null stmt, create ast node.
llvm-svn: 39506
2007-05-28 01:45:28 +00:00
Chris Lattner
012a6cf1de add a NullStmt ast node.
llvm-svn: 39505
2007-05-28 01:41:58 +00:00
Chris Lattner
bed314465a Reorganize codegen files.
llvm-svn: 39504
2007-05-28 01:07:47 +00:00
Chris Lattner
7a50aa98f0 Stop generating code after the first error is emitted.
llvm-svn: 39503
2007-05-28 00:47:06 +00:00
Chris Lattner
c49b9051f4 track whether an error has been emitted.
llvm-svn: 39502
2007-05-28 00:46:44 +00:00
Steve Naroff
9358c715da Bug #:
Submitted by:
Reviewed by:
- Added type checking to Sema::ParseReturnStmt (still under construction).
- Improved Expr::isLvalue() and Expr::isModifiableLvalue() to return more
info. Used the info in Sema::CheckAssignmentOperands() to produce more
descriptive diagnostics. Added FIXME to other clients of isLvalue()/etc.
- Added a SourceLocation slot to MemberExpr...changed the implementation
of getSourceRange().
- Added getResultType() helper to FunctionDecl.
- Changed many Diag calls to use the SourceRange support (now that it's
a big hit...we better milk it:-).

llvm-svn: 39501
2007-05-27 23:58:33 +00:00
Bill Wendling
c5fc5f197d Bug #:
Submitted by: Bill Wendling
Reviewed by:

- Can do just a 'cast<>()' because we're checking that it's Tagged.

llvm-svn: 39500
2007-05-27 23:36:18 +00:00
Bill Wendling
229f243f5f Bug #:
Submitted by: Bill Wendling
Reviewed by: Steve Naroff

- Steve suggested avoiding the dyn_cast by using the "Tagged" type class
  and having the "default" just return false.

llvm-svn: 39499
2007-05-27 23:31:02 +00:00
Bill Wendling
21862c3fbd Bug #:
Submitted by: Bill Wendling
Reviewed by: Chris Lattner

- Rework the isDerivedType method so that if a language doesn't support
  references, it won't have to pay the price for them. This inlines the
  checks for derived types and turns it into a switch statement instead.

llvm-svn: 39498
2007-05-27 22:46:14 +00:00
Bill Wendling
6811c0b5f3 Bug #:
Submitted by: Bill Wendling
Reviewed by:

C++ references testcase.

llvm-svn: 39497
2007-05-27 10:16:12 +00:00
Bill Wendling
3708c18559 Bug #:
Submitted by: Bill Wendling
Reviewed by: Chris Lattner

- Initial support for C++ references. Adding to the AST and Parser.
  Skeletal support added in the semantic analysis portion. Full semantic
  analysis is to be done soon.

llvm-svn: 39496
2007-05-27 10:15:43 +00:00
Chris Lattner
f97fe38cb5 Initial scaffolding for an -emit-llvm mode. This requires the LLVM VMCore
library to be built for the driver to link.

llvm-svn: 39495
2007-05-24 06:29:05 +00:00
Chris Lattner
6d4024ae6b fit in 80 cols
llvm-svn: 39494
2007-05-24 06:28:11 +00:00
Chris Lattner
7eef919d82 Accept parenthesized expressions like ((void*)0) and (void*)(0) as null pointer
constants.

llvm-svn: 39493
2007-05-24 01:23:49 +00:00
Chris Lattner
a5490953d1 correct printout, enums are separate.
llvm-svn: 39492
2007-05-24 01:09:39 +00:00
Chris Lattner
c31f4545d1 add ParseExprCXX.cpp to project.
llvm-svn: 39491
2007-05-24 01:09:15 +00:00
Chris Lattner
81312e7835 Remove unused #include that breaks layering
llvm-svn: 39490
2007-05-24 01:08:56 +00:00
Chris Lattner
f95211394a implement printer support for C++ bool literals
llvm-svn: 39489
2007-05-24 00:50:25 +00:00
Chris Lattner
24e0d6cf40 Implement a fixme
llvm-svn: 39488
2007-05-24 00:47:01 +00:00
Chris Lattner
fc234de388 silence a bunch of warnings, fix some funky indentation.
llvm-svn: 39487
2007-05-24 00:40:54 +00:00
Chris Lattner
6ba4ef5325 fix description
llvm-svn: 39486
2007-05-23 23:56:42 +00:00
Steve Naroff
f84d11f9d7 Bug #:
Submitted by:
Reviewed by:
Added "global" statistics gathering for Decls/Stmts/Exprs.
Very useful for working with a single file. When we start compiling
multiple files, will need to enhance this to collect stats on a per-module
basis.

llvm-svn: 39485
2007-05-23 21:48:04 +00:00
Bill Wendling
5a85f9104d Bug #:
Submitted by: Bill Wendling
Reviewed by: Chris Lattner

- Removed unneeded <iostream> header.

llvm-svn: 39484
2007-05-23 08:05:58 +00:00
Bill Wendling
48fbdd0302 Bug #:
Submitted by: Bill Wendling
Reviewed by: Chris Lattner

- Changed "std::cerr" to "OS" stream to be consistent with the other
  outputs in the method.

llvm-svn: 39483
2007-05-23 08:04:21 +00:00
Bill Wendling
f06487034e Bug #:
Submitted by: Bill Wendling
Reviewed by: Chris Lattner

- Comment fix.

llvm-svn: 39482
2007-05-23 08:03:10 +00:00
Steve Naroff
7fd6893333 Bug #:
Submitted by:
Reviewed by:
One bug compiling "Carbon.h" on Leopard, one diagnostic tweak.
- CheckIndirectionOperand wasn't operating on the canonical type (so it
was complaining about typedef names).
- The diagnostic was less than great. Here's what is was:

[dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang t.c
t.c:4:3: error: invalid argument type to unary expression 'int'
 *p;
 ^~

And here's what I changed it to...

snaroff:clang naroff$ ../../Debug/bin/clang bug.c
bug.c:5:3: error: indirection requires a pointer ('int' operand invalid)
  *p;
  ^~

llvm-svn: 39481
2007-05-22 18:27:41 +00:00
Steve Naroff
21d5e87a97 Bug #:
Submitted by:
Reviewed by:
Add Makefile

llvm-svn: 39480
2007-05-22 17:43:50 +00:00
Chris Lattner
245368ee0f clarify library organization, document libast/libsema
llvm-svn: 39479
2007-05-21 17:47:42 +00:00
Chris Lattner
a8a2c82f55 Move ASTStreamer.h into "clang/Sema/ASTStreamer.h"
llvm-svn: 39478
2007-05-21 17:38:36 +00:00
Chris Lattner
d1654ef0ed Split the AST library into two libraries: libast and libsema.
llvm-svn: 39477
2007-05-21 17:34:19 +00:00
Chris Lattner
e6b0f626bb minor simplification
llvm-svn: 39476
2007-05-21 05:58:35 +00:00
Chris Lattner
0643041f6c In the yet-another-crazy-idea department, we now print the actual *value* of
integer constants, whoa! :)

llvm-svn: 39475
2007-05-21 05:45:03 +00:00
Chris Lattner
de5a472e02 Fix a problem where a semantic error confused error recovery to the point
where the parser emitted bogus diagnostics.  Before, when compiling:

  struct A { int X; } someA;

  int func(int, struct A);

  int test1(void *P, int C) {
    return func(((C*40) + *P) / 42+P, someA);
  }

we emitted:

bug3.c:7:25: error: invalid operands to binary expression ('int' and 'void')
    return func(((C*40) + *P) / 42+P, someA);
                 ~~~~~~ ^ ~~
bug3.c:7:31: error: expected ')'
    return func(((C*40) + *P) / 42+P, someA);
                              ^
bug3.c:7:16: error: to match this '('
    return func(((C*40) + *P) / 42+P, someA);
               ^

now we only emit the first.

llvm-svn: 39474
2007-05-21 05:27:47 +00:00
Chris Lattner
67ca9252f8 Implement Sema::ParseNumericConstant for integer constants in terms of APInt
and correctly in terms of C99 6.4.4.1p5.

llvm-svn: 39473
2007-05-21 01:08:44 +00:00
Chris Lattner
4dc8a6f1e7 add ASTContext::getIntegerBitwidth method.
llvm-svn: 39472
2007-05-20 23:50:58 +00:00
Chris Lattner
f59d75c35e add getIntegerBitwidth method.
llvm-svn: 39471
2007-05-20 23:50:29 +00:00
Chris Lattner
dae7f8ddf4 add interfaces to get sizes of target integer types.
llvm-svn: 39470
2007-05-20 23:50:03 +00:00
Chris Lattner
073926e39a pretty print switch/if stmts whose bodies are compound stmts.
llvm-svn: 39469
2007-05-20 23:04:55 +00:00
Chris Lattner
b9eb5a1cec Pretty print labels and case stmts better. This leads to output like this:
void foo() {
abc:
def:
hij:
case 1:
case 1:
  goto abc
baz:
  goto def
}

instead of:

void foo() {
  abc:
    def:
      hij:
        case 1:
          case 1:
            goto abc
  baz:
    goto def
}

llvm-svn: 39468
2007-05-20 22:52:15 +00:00
Chris Lattner
3bbe7bed39 Don't "optimize" empty or unit compound exprs away.
llvm-svn: 39467
2007-05-20 22:47:04 +00:00
Steve Naroff
30d1fbc803 Bug #:
Submitted by:
Reviewed by:
Bozo bug in last checkin. Needed to move the check for null pointers
up (and out of the pointer/pointer clause).

llvm-svn: 39466
2007-05-20 19:46:53 +00:00
Chris Lattner
5ab15f154d Steve pointed out that testcases like this (with a macro expansion):
#define friendlystruct fs

  struct A { int X; };

  void test2(struct A friendlystruct, int C) {
    return friendlystruct + (C     *40);
  }

were getting diagnosed like this:

t.c:7:27: error: invalid operands to binary expression ('struct A' and 'int')
    return friendlystruct + (C     *40);
           ~~             ^ ~~~~~~~~~~~

The problem is that getCharacterData returns a pointer to the macro expansion,
not to the macro instantiation.  Instead, use getLogicalLoc to get a pointer
to the instatiation location, so we relex the macro id.  We now get:

t.c:7:27: error: invalid operands to binary expression ('struct A' and 'int')
    return friendlystruct + (C     *40);
           ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~

oooh ahh. :)

llvm-svn: 39465
2007-05-20 18:08:36 +00:00
Steve Naroff
ada7d4298b Bug #:
Submitted by:
Reviewed by:
Fix two bugs...

- Sema::CheckConditionalOperands(). Needed to move the check for
null pointer constants up to the clause dealing with two pointers types.
The previous code would never get executed.
- Expr::isNullPointerConstant(). This predicate was much too naive...it
should have had a FIXME (my bad). It now deals with "void *" cast expressions.
It still has one major bug...it needs to evaluate the expression to correctly
determine if it is a null pointer constant (e.g. 7-7 should pass).

llvm-svn: 39464
2007-05-20 17:54:12 +00:00
Chris Lattner
812eda8259 implement octal escape sequences.
llvm-svn: 39463
2007-05-20 05:17:04 +00:00
Chris Lattner
c10adde406 Implement hex escape sequences in string and character literals, e.g. L"\x12345"
llvm-svn: 39462
2007-05-20 05:00:58 +00:00
Chris Lattner
db5ac601e7 eliminate an extraneous space when printing qualified types in some cases.
llvm-svn: 39461
2007-05-20 04:21:51 +00:00
Chris Lattner
beeb9bc51d improve const correctness
llvm-svn: 39460
2007-05-19 08:07:42 +00:00
Chris Lattner
ebd1b33477 Use the new source ranges tracking feature to highlight the important pieces
of a subexpression when emitting a diagnostic.  Consider this example:

struct A { int X; };

void test1(void *P, int C) {
  return ((C*40) + *P) / 42+P;
}

void test2(struct A friendlystruct, int C) {
  return (C     *40) + friendlystruct;
}

void test3(struct A friendlystruct, int C) {
  return friendlystruct + test2(friendlystruct
                               , C);
}


clang now produces this output:

t.c:4:18: error: invalid operands to binary expression ('int' and 'void')
  return ((C*40) + *P) / 42+P;
          ~~~~~~ ^ ~~

This shows the important pieces of a nested (and potentially very complex)
expression.


t.c:8:18: error: invalid operands to binary expression ('int' and 'struct A')
  return (C     *40) + friendlystruct;
         ~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~

This shows that tabs in source files (after the 'C') and multichar tokens
(friendlystruct) are handled correctly.



t.c:12:25: error: invalid operands to binary expression ('struct A' and 'void')
  return friendlystruct + test2(friendlystruct
         ~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~~~~~

This shows how multiline ranges are printed.  Any part of the range that is
not on the same line as the carat is just ignored.  This also shows that
trailing spaces on the line aren't highlighted.

llvm-svn: 39459
2007-05-19 08:06:14 +00:00
Chris Lattner
f8d3197831 Change the structure of the code that emits the ^ marker in a diagnostic,
but there is no functionality change yet.

llvm-svn: 39458
2007-05-19 07:25:55 +00:00
Chris Lattner
84e160a7a8 fix some indentation funkiness
llvm-svn: 39457
2007-05-19 07:03:17 +00:00
Steve Naroff
71ce2e061d Bug #:
Submitted by:
Reviewed by:
An important, but truly mind numbing change.

Added 6 flavors of Sema::Diag() that take 1 or two SourceRanges. Considered
adding 3 flavors (using default args), however this wasn't as clear.

Removed 2 flavors of Sema::Diag() that took LexerToken's (they weren't used).

Changed all the typechecking routines to pass the appropriate range(s).

Hacked the diagnostic machinery and driver to acccommodate the new data.

What's left? A FIXME in clang.c to use the ranges. Chris offered to do the
honors:-) Which includes taking us to the end of an identifier:-)

llvm-svn: 39456
2007-05-18 22:53:50 +00:00
Steve Naroff
e845e272ba Bug #:
Submitted by:
Reviewed by:
More tweaks to error diagnostics (adding types, using the new hooks on expr).
Still more to do...

llvm-svn: 39455
2007-05-18 01:06:45 +00:00
Steve Naroff
72cada0ad9 Bug #:
Submitted by:
Reviewed by:
Extended Expr's constant expression predicates to return a source location
if the predicate returns false. This enables us to position the cursor
exactly were the error occurred (simple pleasures:-).

constant.c:9:9: error: enumerator value for 'E2' is not an integer constant
  E2 = (aconst + 1), // illegal
        ^
constant.c:10:8: error: enumerator value for 'E3' is not an integer constant
  E3 = "abc",
       ^
constant.c:12:12: error: enumerator value for 'E5' is not an integer constant
  E5 = 0?7:printf("xx"), // illegal
           ^
constant.c:13:12: error: enumerator value for 'E6' is not an integer constant
  E6 = 1?7:printf("xx"), // legal
           ^
constant.c:16:14: error: enumerator value for 'E9' is not an integer constant
  E9 = E0 || a, // illegal
             ^
constant.c:21:6: error: array has incomplete element type 'void'
void ary[7];
     ^
constant.c:22:28: error: variable length array declared outside of any function
struct { int a; } ary2[1?7:printf("xx")],
                           ^
constant.c:23:34: error: variable length array declared outside of any function
                  aryIllegal[0?7:printf("yy")];
                                 ^
constant.c:25:10: error: variable length array declared outside of any function
int ary3[a]; // illegal
         ^
constant.c:26:17: error: size of array has non-integer type 'float'
typedef int vla[2.0]; // illegal
                ^
constant.c:30:22: error: size of array has non-integer type 'float'
int nonIntegerArray2[1+2.0];
                     ^

llvm-svn: 39454
2007-05-18 00:18:52 +00:00
Steve Naroff
53f07dc54d Bug #:
Submitted by:
Reviewed by:
Refinements to the SourceRange/SourceLocation work.

- Renamed Expr::getSourceLocation() helper function to getLocStart(). Added
Expr::getLocEnd(). Converted all the getSourceRange() methods to use the new helpers.
- Removed many getSourceLocation() accessors. The Expr::getLocStart() helper
is the "right" way to get a source location. If we want to add class specific
getters (for location), then the names should be reflective of the specific class.
For examaple, UnaryOperator::getOpLocation(). For now, I see no reason to have these.
- Fixed StringLiteral.
- Start actually instantiating ParenExpr()!

llvm-svn: 39453
2007-05-17 21:49:33 +00:00
Steve Naroff
509fe025aa Bug #:
Submitted by:
Reviewed by:
- Added a getSourceRange() method to all subclasses of Expr.
- Changed all the constructors and instantiators.
- Only added SourceLocations's when necessary. For example, binary
expression *don't* carry the operator location...it isn't
necessary to implement getSourceRange(). On the other hand, unary
expressions *do* carry the operator location.
- Added trivial SourceRange value class to SourceLocation.

Note: need to talk to Chris about the FIXME for StringLiteral...
llvm-svn: 39452
2007-05-17 01:16:00 +00:00
Steve Naroff
a78fe7e3ed Bug #:
Submitted by:
Reviewed by:
- Implement type checking for Sema::CheckConditionalOperands.
- Fixed crasher in Sema::UsualUnaryConversion (incorrect use of cast<>).
- Added a few diagnostics and started passing 2 args! (Thanks Chris!).

Here's some diagnostic output that is much nicer than gcc...

[dylan:~/llvm/tools/clang] admin% ../../Debug/bin/clang cond.c
cond.c:12:14: error: used type 'struct foo' where arithmetic or pointer type is required
  result = s ? 1 : 2;
             ^
cond.c:13:14: error: incompatible operand types ('struct foo' and 'struct bar')
  result = a ? s : s2;
             ^
cond.c:14:14: warning: pointer type mismatch ('struct foo *' and 'struct bar *')
  result = a ? ps : ps2;
             ^
cond.c:14:10: warning: assignment makes integer from pointer without a cast
  result = a ? ps : ps2;
         ^
cond.c:15:14: error: incompatible operand types ('struct foo *' and 'struct foo')
  result = a ? ps : s;
             ^
cond.c:16:14: warning: pointer type mismatch ('void (*)(int)' and 'void (*)(int, int)')
  result = a ? func : func2;
             ^
cond.c:16:10: warning: assignment makes integer from pointer without a cast
  result = a ? func : func2;
         ^
7 diagnostics generated.
[dylan:~/llvm/tools/clang] admin% cc -c cond.c
cond.c: In function 'main':
cond.c:12: error: used struct type value where scalar is required
cond.c:13: error: type mismatch in conditional expression
cond.c:14: warning: pointer type mismatch in conditional expression
cond.c:14: warning: assignment makes integer from pointer without a cast
cond.c:15: error: type mismatch in conditional expression
cond.c:16: warning: pointer type mismatch in conditional expression
cond.c:16: warning: assignment makes integer from pointer without a cast

llvm-svn: 39451
2007-05-16 19:47:19 +00:00
Chris Lattner
c04bd6ae32 Remove the Sema::Diag helper that takes a type. Convert clients to use
the version that takes a string.

llvm-svn: 39450
2007-05-16 18:09:54 +00:00
Chris Lattner
3dc3d775fb Rename type::getAsString to getAsStringInternal. Add a new
QualType::getAsString() that returns a string, which is much easier
for clients to use.  Convert clients to use it.

llvm-svn: 39449
2007-05-16 18:07:12 +00:00
Chris Lattner
d6647d3d60 Add helper to emit two strings for a diagnostic.
llvm-svn: 39448
2007-05-16 17:56:50 +00:00
Chris Lattner
36982e4367 Add support for inserting up to 10 strings in a diagnostic, with %0, %1, %2,
etc.

llvm-svn: 39447
2007-05-16 17:49:37 +00:00
Steve Naroff
f8a28c5379 Bug #:
Submitted by:
Reviewed by:
- Unified isConstantExpr/isIntegerConstantExpr by creating a private function
named isConstantExpr (that takes a bool to indicate the flavor). isConstantExpr
and isIntegerConstantExpr are now inline wrapper/helper functions.
- Fixed bug in expression based sizeof (it needed to make sure the type is constant).
- Added Sema::CheckConditionalOperands() stub. Will add contraints in my next commit.

llvm-svn: 39446
2007-05-15 20:29:32 +00:00
Steve Naroff
043d45da72 Bug #:
Submitted by:
Reviewed by:
- Completed Expr::isConstantExpr() and Expr::isIntegerConstantExpr().
- Completed Sema::ParseUnaryOp(), it lacked support for sizeof/alignof.
- Added Sema::CheckSizeOfAlignOfOperand(), used by ParseUnaryOp/ParseSizeOfAlignOfTypeExpr.
- Fixed a couple bugs in CheckRelationalOperands/CheckEqualityOperands (make sure extensions aren't treated as errors).
- Changed a bunch of predicates (in BinaryOperator/UnaryOperator) to member functions (the static members weren't being used).
- Added UnaryOperator::isIncrementDecrementOp/isSizeOfAlignOfOp.

llvm-svn: 39445
2007-05-15 02:32:35 +00:00
Steve Naroff
5dd642eb4a Bug #:
Submitted by:
Reviewed by:
Some minor cleanup (comments, spec refs, simplied some expressions).

llvm-svn: 39444
2007-05-14 18:14:51 +00:00
Steve Naroff
475cca0d1a Bug #:
Submitted by:
Reviewed by:
Fixed a bug in Sema::CheckAddressOfOperand(). It was (incorrectly) using
isModifiableLvalue() instead of isLvalue(). This motivated me to (finally)
cleanup methods surrounding lsLvalue/isModifiableLvalue. Cleanup involved:
- adding Expr::isLvalue().
- modified Expr::isModifiableLvalue() to use Expr::isLvalue().
- removed Type::isLvalue(), Type::isModifiableLvalue(), and
QualType::isModifiableLvalue(). They were confusing...the respective logic
is now a part of the Expr member functions...
- also added some comments and spec references, since these methods are
so central to expressions working properly.

llvm-svn: 39443
2007-05-14 17:19:29 +00:00
Steve Naroff
094046fdfc Bug #:
Submitted by:
Reviewed by:
Two bug fixes to CheckIncrementDecrementOperand:
- removed "constantOne" usage and simply use Context.IntTy.
- fix the last constraint check...the lvalue test needs to be on the
expression, not the type! (duh).

llvm-svn: 39442
2007-05-13 03:21:25 +00:00
Steve Naroff
29d386c8c6 Bug #:
Submitted by:
Reviewed by:
Removed a couple superflous checks from typesAreCompatible. Moved the
spec references up to a comment.

llvm-svn: 39441
2007-05-12 15:17:11 +00:00
Steve Naroff
3f59729549 Bug #:
Submitted by:
Reviewed by:
This check-in should finally "nail" complex pointer assignments (involving
qualifiers, etc.).
- Replaced pointerTypeQualifiersAlign() with CheckPointerTypesForAssignment()
This also simplified UsualAssignmentConversions().
- Fixed Type::pointerTypesAreCompatible() and Type::typesAreCompatible()
to closely reflect the spec. They were (unfortunately) compensating for some of the
missing logic in the assignment checking code.

llvm-svn: 39440
2007-05-11 22:18:03 +00:00
Steve Naroff
1f4d72724e Bug #:
Submitted by:
Reviewed by:
- Enhanced UsualAssignmentConversions() to properly handle type qualifiers on
pointers.
- Added helper function Sema::pointerTypeQualifiersAlign().
- Noticed several errors improperly named "ext_" (fixed).
- Combined structureTypesAreCompatible/unionTypesAreCompatible into
tagTypesAreCompatible.
- Renamed Type::getCanonicalType() to Type::getCanonicalTypeInternal(). It
will never confuse/bite me again:-)
- Added a couple extension diagnostics for discarded type qualifiers.

llvm-svn: 39439
2007-05-11 04:00:31 +00:00
Steve Naroff
b8c289df7a Bug #:
Submitted by:
Reviewed by:
Fix a couple bugs in ParseCallExpr().
- check isVariadic().
- make sure an AST isn't created if the number of args don't match but the
types do!
- rename "n" to something more descriptive:-)

llvm-svn: 39438
2007-05-08 22:18:00 +00:00
Steve Naroff
8eeeb1345f Bug #:
Submitted by:
Reviewed by:
- Added Sema::isConstantArrayType() and Type::isConstantSizeType().
- Implemented type checking for "variably modified" types (i.e. VLA's).
Added checking for file scope variables, static variables, member variables,
and typedefs.
- Changed Expr::isIntegerConstantExpr() to non-virtual implementation.
Fixed bug with sizeof/alignof. Looking at the diff, I may need to
add a check to exclude alignof.
- Added Expr::isConstantExpr()...non-virtual, like above.
- Added typechecking for case statements (found a bug with actions/parsing...).
- Added several diagnostics.
- Fixed several comments.
Started implemented constant expression checking for arrays.

llvm-svn: 39437
2007-05-08 21:09:37 +00:00
Steve Naroff
6396921550 Bug #:
Submitted by:
Reviewed by:
Start work on typechecking constant expressions.

- Added isIntegerConstantExpr() predicate to all exprs.
- Use the predicate to implement checking for enum constant initializers.
- Added diagnostic.
- Added Init slot to EnumConstantDecl class/constructor.

llvm-svn: 39436
2007-05-07 21:22:42 +00:00
Steve Naroff
35d8515be7 Bug #:
Submitted by:
Reviewed by:
- Unified CheckSimpleAssignmentOperands/CheckCompoundAssignmentOperands
into one function, named CheckAssignmentOperands. One less function to maintain.
- Converted the unary check functions (ParseUnaryOp and friends) to have
the same API as their binary counterparts.
- Implemented CheckIndirectionOperand (was stubbed). While testing, noticed
that Expr::isModifiableLvalue was incomplete (fixed and referenced draft).
- Added constantOne instance variable to Sema.
- Removed CheckArithmeticOperand (the code was so simple that it is now
part of ParseUnaryOp). The name wasn't great anyway:-)

llvm-svn: 39435
2007-05-07 00:24:15 +00:00
Chris Lattner
776050e9a5 Adjust to change in MemoryBuffer interface
llvm-svn: 39434
2007-05-06 23:34:12 +00:00
Steve Naroff
218bc2b32d Bug #:
Submitted by:
Reviewed by:
Implemented type checking for compound assignments (*=, /=, etc.).

This encouraged me to do a fairly dramatic refactoring of the Check* functions.
(since I wanted to reuse the existing work, rather than duplicate the logic).

For example, I changed all the Check* functions to return a QualType (instead
of returning an Expr). This had a very nice side benefit...there is now
only one instantiation point for BinaryOperator()! (A property I've always
wanted...separating type checking from AST building is *much* nicer). Another
change is to remove "code" from all the Check* functions (this allowed
me to remove the weird comment about enums/unsigned:-). Removing the
code forced me to add a few functions, however. For example,

<   ExprResult CheckAdditiveOperands( // C99 6.5.6
<     Expr *lex, Expr *rex, SourceLocation OpLoc, unsigned OpCode);

>   inline QualType CheckAdditionOperands( // C99 6.5.6
>     Expr *lex, Expr *rex, SourceLocation OpLoc);
>   inline QualType CheckSubtractionOperands( // C99 6.5.6
>     Expr *lex, Expr *rex, SourceLocation OpLoc);

While this isn't as terse, it more closely reflects the differences in
the typechecking logic. For example, I disliked having to check the code again
in CheckMultiplicativeOperands/CheckAdditiveOperands.

Created the following helper functions:
- Expr::isNullPointerConstant().
- SemaExpr.cpp: static inline BinaryOperator::Opcode ConvertTokenKindToBinaryOpcode().
This was purely asethetic, since ParseBinOp() is now larger. I didn't feel
like looking at 2 huge switch statements. ParseBinOp() now avoids using
any of the BinaryOperator predicates (since I switched to a switch statement:-)

Only one regret (minor). I couldn't figure out how to avoid having two assign functions,
CheckCompoundAssignmentOperands, CheckSimpleAssignmentOperands. Conceptually,
the two functions make sense. Unfortunately, their implementation contains a lot of
duplication (thought they aren't that be in the first place).

llvm-svn: 39433
2007-05-04 21:54:46 +00:00
Steve Naroff
17f76e04d2 Bug #:
Submitted by:
Reviewed by:
Work on finishing up typechecking for simple assignments (=) and function
calls. Here is an overview:
- implemented type checking for function calls (in Sema::ParseCallExpr).
- refactored UsualAssignmentConversions to return the result of the conversion.
This enum will allow all clients to emit different diagnostics based on context.
- fixed bug in Expr::isLvalue()...it wasn't handling arrays properly. Also
changed the name to isModifiableLvalue, which is consistent with the function on QualType.
- Added 6 diagnostics (3 errors, 3 extensions).

llvm-svn: 39432
2007-05-03 21:03:48 +00:00
Steve Naroff
b891de392c Bug #:
Submitted by:
Reviewed by:
More refinements to UsualAssignmentConversions(). Added a call
to do the UsualUnaryConversion for arrays/functions. I believe this is
correct (but subtle). This enabled me to remove code for dealing with
arrays/functions explictly (which more closely reflects the spec).

llvm-svn: 39431
2007-05-02 23:51:10 +00:00
Chris Lattner
c24278d9a0 Do not invoke objc parser actions when a top level +/- is seen, unless objc
is enabled.

llvm-svn: 39430
2007-05-02 23:45:06 +00:00
Steve Naroff
9eb2465aeb Bug #:
Submitted by:
Reviewed by:
Refactored assignment conversion code.

- added Sema::UsualAssignmentConversions(). It will service simple
assignment, argument passing, initialization, and return.
- simplified Sema::CheckAssignmentOperands() using the previous function.

llvm-svn: 39429
2007-05-02 21:58:15 +00:00
Steve Naroff
38a9dae33f Bug #:
Submitted by:
Reviewed by:
- implement Type::functionTypesAreCompatible().
- fix bug in Sema::CheckAssignmentOperands(). Spec allows any pointer type
to be assigned to _Bool.

llvm-svn: 39428
2007-05-02 19:22:16 +00:00
Steve Naroff
dd92b932e0 Bug #:
Submitted by:
Reviewed by:
Implement CheckAssignmentOperands(). This includes...

- Adding 6 static member predicates to Type.
- Adding 2 error diagnostics and 3 GCC extensions.
- Adding a "getValue" accessor to IntegerLiteral.

Still more work to do (including implement compound assignments).

llvm-svn: 39427
2007-05-02 02:47:33 +00:00
Chris Lattner
739e739b81 Remove the clang::SourceBuffer class, switch to the llvm::MemoryBuffer class.
llvm-svn: 39426
2007-04-29 07:12:06 +00:00
Chris Lattner
e92976d8ee Refactor the SourceBuffer code so that it is safe to move to the LLVM
support library, where it can be used by other LLVM clients.  There are
some ugly fixme's in the short-term.

llvm-svn: 39425
2007-04-29 06:44:41 +00:00
Chris Lattner
35f9985817 minor cleanups
llvm-svn: 39424
2007-04-29 06:08:57 +00:00
Chris Lattner
ae7fdad1c5 Teach the driver to filter out warnings and notes that come from system headers.
Switch -pedantic back on by default.

llvm-svn: 39423
2007-04-28 07:23:46 +00:00
Steve Naroff
85d23e3ed5 Bug #:
Submitted by:
Reviewed by:
Minor change to assert logic.

llvm-svn: 39422
2007-04-27 22:11:59 +00:00
Steve Naroff
0af9120905 Bug #:
Submitted by:
Reviewed by:
- Disabled -pedantic for now (until it ignores system headers).
- Removed convertSignedWithGreaterRankThanUnsigned() and convertFloatingRankToComplexType().
The logic is now inlined in maxIntegerType and maxComplexType().
- Removed getIntegerRank/getFloatingRank from the private interface. These
are now really private helpers:-)
- Declare maxIntegerType/maxFloatingType static. maxComplexType const.
- Added an enum for the floating ranks.
- Several fixed to getIntegerRank: add Bool, Char, and a clause for enums.

llvm-svn: 39421
2007-04-27 21:51:21 +00:00
Chris Lattner
da6c2ce655 Fix an error recovery bug, we were would issue:
enum {
        CSSM_FALSE = 0,
        CSSM_TRUE = !&CSSM_FALSE
};

t.c:4:15: error: invalid lvalue in address expression
        CSSM_TRUE = !&CSSM_FALSE
                     ^
t.c:6:2: error: expected '}'
};
 ^
t.c:2:6: error: to match this '{'
enum {
     ^
3 diagnostics generated.



We now issue:
t.c:4:15: error: invalid lvalue in address expression
        CSSM_TRUE = !&CSSM_FALSE
                     ^
1 diagnostics generated.

llvm-svn: 39420
2007-04-27 19:13:15 +00:00
Chris Lattner
83b94e0967 Generalize the skipping logic to allow skipping until any one of a set of
tokens is found.

llvm-svn: 39419
2007-04-27 19:12:15 +00:00
Steve Naroff
e471889d53 Bug #:
Submitted by:
Reviewed by:
More typechecking, refactoring...
- Implemented the following routines...CheckAdditiveOperands,
CheckCommaOperands, CheckLogicalOperands.
- Added maxComplexType, maxFloatingType, & maxIntegerType to ASTContext.
Ranking helper functions moved to ASTContext as well (they are private:-)
- Simplified UsualArithmeticConversions using the new ASTContext hooks.
- Fixed isAssignmentOp()...is was preventing comma exprs from ever being created:-(
- Changed a GCC compat extension to truly be an extension (and turned extensions
on by default). This now produces a warning by default.

llvm-svn: 39418
2007-04-27 18:30:00 +00:00
Steve Naroff
1cbdf71d2e Bug #:
Submitted by:
Reviewed by:
Carbon.h now compiles without error!

All 14 errors were the result of two Type predicates (isArithmeticType
and isScalarType) not allowing enums. Note: this could have been avoided by rigorously using
isIntegerType. For efficiency, I decided not to have predicates use predicates.

Still more work to do, however this is a nice milestone considering how much "work" is being done...

llvm-svn: 39417
2007-04-26 21:44:56 +00:00
Steve Naroff
ae4143ea90 Bug #:
Submitted by:
Reviewed by:
Misc. changes driven by getting "carbon.h" to compile...

- Added ParseCharacterConstant() hook to Action, Sema, etc.
- Added CheckAssignmentOperands() & CheckCommaOperands() to Sema.
- Added CharacterLiteral AST node.
- Fixed CallExpr instantiation - install the correct type.
- Install a bunch of temp types and annotate with FIXME's.

llvm-svn: 39416
2007-04-26 20:39:23 +00:00
Steve Naroff
82ceca595e Bug #:
Submitted by:
Reviewed by:
Implement FIXME's for signed/unsigned operands in UsualArithmeticConversions()...
- Added GetIntegerRank() and used it in the appropriate places.
- Added ConvertSignedWithGreaterRankThanUnsigned(), with a FIXME.
Misc...converted a bunch of static_cast usage to dyn_cast (in Type.cpp)

A and handled signed/unsigned combos.

llvm-svn: 39415
2007-04-25 21:10:52 +00:00
Steve Naroff
f633d0914a Bug #:
Submitted by:
Reviewed by:
A bunch of "small" changes...
- Fixed a bug in ConvertFloatingRankToComplexType() that rendered it useless.
ASTContext was being copied by default (as the result of declaring the argument
incorrectly). Chris gave me the magic potion to disallow this in ASTContext.
- Removed a tab:-)
- Added some much needed comments to the float/complex promotion madness.
- Improved some aesthetics (based on code review w/Chris).

llvm-svn: 39414
2007-04-25 19:01:39 +00:00
Steve Naroff
b01bbe3ecb Bug #:
Submitted by:
Reviewed by:
Refactored code that deals with float/complex conversions (the previous commit).

- Removed 6 predicates that identify the built-in float/complex types.
- Added two helper functions GetFloatingRank() & ConvertFloatingRankToComplexType().
At present, these are static functions in SemaExpr.cpp. Conceptually, they would be nice
to move to Type, however there are layering problems with that (i.e. no ASTContext).
Another possibility is to move them to ASTContext?
- Simplified the logic in UsualArithmeticConversions() considerably.

llvm-svn: 39413
2007-04-25 01:22:31 +00:00
Steve Naroff
bf223ba1fa Bug #:
Submitted by:
Reviewed by:
-Lot's of detail work in UsualArithmeticConversion(). Needed to expand
the code for dealing with floating types. This code still has a couple
of FIXME's and could be refactored a bit.
-Added a bunch of Type predicates to simplify the float conversions.
Used the opportunity to convert a bunch of predicates to dyn_cast (it's cleaner
when just dealing with Builtin types).

llvm-svn: 39412
2007-04-24 20:56:26 +00:00
Steve Naroff
1926c836bb Bug #:
Submitted by:
Reviewed by:
Lot's of changes related to type checking binary expressions.
- Changed the name/proto of ImplicitConversion. It is now named UsualUnaryConversion - it takes a
type and returns a type. This allowed me to remove the explicit node creation for array/function->pointer conversions.
- Added function UsualArithmeticConversions().
- Changed all the "Check" functions for binary ops. They use the new "Usual" functions above.
- new predicates on Type, isSignedIntegerType()/isUnsignedIntegerType().
- moved getDecl() out of the Sema class. It is now a static helper function in SemaExpr.cpp. It was also renamed getPrimaryDeclaration().
- Added CheckArithmeticOperand() for consistency with the other unary "Check" functions.

Should finish up the binary expressions tomorrow...with a small number of "FIXME's"

llvm-svn: 39411
2007-04-24 00:23:05 +00:00
Steve Naroff
5c10d4bac1 Bug #:
Submitted by:
Reviewed by:
Start hacking on binary ops...
Important bug fix...was ignoring the return value from ImplicitConversion.
This didn't bother the type checking logic, however the AST was malformed.

llvm-svn: 39410
2007-04-20 23:42:24 +00:00
Steve Naroff
4b7ce03f55 Bug #:
Submitted by:
Reviewed by:
- Added Type::isPromotableIntegerType().
- The unary operators are now largely complete (Sema::ParseUnaryOp and friends).
- Implemented ImplicitConversion hook (was a stub).

llvm-svn: 39409
2007-04-20 22:26:17 +00:00
Steve Naroff
4750051ebb Bug #:
Submitted by:
Reviewed by:
Continue working on type checking for unary operators. Added:

- Two 3 private functions to Sema: CheckAddressOfOperand(), CheckIndirectionOperand(),
and getDecl().
- Added Expr::isLvalue() - it was needed for CheckAddressOfOperand(). It will
also be needed for ++/-- and the assignment operators.
- Added a couple diagnostics for invalid lvalues (for & of).

llvm-svn: 39408
2007-04-19 23:00:49 +00:00
Chris Lattner
89399da91a fixme done!
llvm-svn: 39407
2007-04-11 04:16:36 +00:00
Chris Lattner
99ca091b9c Warn when performing 'usual' conversions that require a sign change. This
implements test/Preprocessor/expr_usual_conversions.c, which produces this
output:

expr_usual_conversions.c:5:10: warning: left side of operator converted from negative value to unsigned: -42 to 18446744073709551574
#if (-42 + 0U) / -2
         ^
expr_usual_conversions.c:5:16: warning: right side of operator converted from negative value to unsigned: -2 to 18446744073709551614
#if (-42 + 0U) / -2
               ^

llvm-svn: 39406
2007-04-11 04:14:45 +00:00
Chris Lattner
8ec9355a48 Overflow detection for multiply and divide. Fix a bug handling 'usual
arithmetic conversions'.

llvm-svn: 39405
2007-04-11 04:04:29 +00:00
Chris Lattner
7e61ac5a3c Catch overflow of negate. This allows us to emit:
t.c:2:17: warning: integer overflow in preprocessor expression
#if -(INTMAX_MAX+1)
                ^
t.c:2:5: warning: integer overflow in preprocessor expression
#if -(INTMAX_MAX+1)
    ^

GCC has some seriously confused source locations in this case:
t.c:2:19: warning: integer overflow in preprocessor expression
t.c:2:20: warning: integer overflow in preprocessor expression

column 19/20 are off the end of the line.

llvm-svn: 39404
2007-04-11 03:42:36 +00:00
Chris Lattner
028c7decef Overflow detection for +/-
llvm-svn: 39403
2007-04-11 03:34:29 +00:00
Chris Lattner
9cc755d535 Evaluate result into an explicit destination. No functionality change.
llvm-svn: 39402
2007-04-10 07:07:11 +00:00
Chris Lattner
9e2fcccc33 Fix run line
llvm-svn: 39401
2007-04-10 07:06:36 +00:00
Chris Lattner
5a0f164a52 Track overflow of shift amounts, allowing diagnostics like:
t.c:6:7: warning: integer overflow in preprocessor expression
#if 1 << 63
      ^
t.c:8:7: warning: integer overflow in preprocessor expression
#if 4 << 62
      ^
t.c:10:7: warning: integer overflow in preprocessor expression
#if 4 << 66
      ^

but no diagnostic on:
#if 1U << 63

llvm-svn: 39400
2007-04-10 06:54:33 +00:00
Chris Lattner
a7fa1b247c 'true' in a CPP expression evaluates to 1 when in C++ mode. This implements
test/Preprocessor/cxx_true.cpp

llvm-svn: 39399
2007-04-10 06:16:30 +00:00
Chris Lattner
7c718bd5a4 Include the filename being looked up in an error message. This gives us stuff
like this:
t3.c:5:10: error: 'vers2.h' file not found
#include xstr(INCFILE(2).h)
         ^

instead of:

t3.c:5:10: error: file not found
#include xstr(INCFILE(2).h)
         ^

which is useful if the #include name is generated through macro expansion.

llvm-svn: 39398
2007-04-10 06:02:46 +00:00
Chris Lattner
86054a9634 Diagnostics relating to computation of values should only be produced if an
expression is live.  For example:
#if 0 ? 124/0 : 42

should cause no error.

This implements test/Preprocessor/expr_liveness.c

llvm-svn: 39397
2007-04-10 05:26:38 +00:00
Chris Lattner
6acf759735 new testcase
llvm-svn: 39396
2007-04-10 05:25:39 +00:00
Steve Naroff
e5aa9be0a0 Bug #:
Submitted by:
Reviewed by:
-Changed the name of TypeRef to QualType. Many diffs.
-Changed the QualType constructor to require Quals be passed. This makes the code a bit
more verbose, however will make the code easier to work on. Given the complexity
of types, this should help spot bogosities.
-Changed the Expr constructor to require a QualType. Same motivation.

llvm-svn: 39395
2007-04-05 22:36:20 +00:00
Steve Naroff
d50c88e489 Bug #:
Submitted by:
Reviewed by:
Fix "FIXME: does this lose qualifiers from the typedef??" in ASTContext::getTypedefType().

This change was fairly pervasive...nevertheless, here are the highlights:
- Change the type of Type::CanonicalType to TypeRef (was "Type *").
- Change the implementation of TypeRef::getCanonicalType() to work for typedefs.
- Make the implementation of Type::getCanonicalType private (only TypeRef should access). This
will force clients to use TypeRef::getCanonicalType (the correct version of the function). Since
TypeRef overloads "->", it was very easy to fall into this bug...
- Changed many references of "Type *" to "TypeRef"...when the raw type pointer is required, use t.getTypePtr().
- Changed all the *Type classes to take a TypeRef.
- Made the Type constructor protected (cleanup).
- Removed function Expr::getType().
- Convert functions in SemaExpr to use the above support. This fixed the "const" bug I was originally investigating.

I will follow this check-in up with a rename of TypeRef->QualType. I will also make sure the constructor does not default to 0 (which can lead to broken code...).

llvm-svn: 39394
2007-04-05 21:15:20 +00:00
Chris Lattner
f8a0b0fa50 Add support for character constants in PP expressions, like:
#if 'a'

llvm-svn: 39393
2007-04-05 06:58:56 +00:00
Chris Lattner
380048807e Implement support for semantic analysis of character constants.
llvm-svn: 39392
2007-04-05 06:58:19 +00:00
Chris Lattner
d5a828b6bb wchar_t width is now expressed in terms of bits for uniformity.
llvm-svn: 39391
2007-04-05 06:57:57 +00:00
Chris Lattner
2f5add6272 Implement support for performing semantic analysis of character literals.
llvm-svn: 39390
2007-04-05 06:57:15 +00:00
Chris Lattner
d2f5ec4e55 add some more dummy target hooks
llvm-svn: 39389
2007-04-05 06:40:47 +00:00
Chris Lattner
a9eac7ff44 Correctly represent and propagate signedness information in preprocessor
constant expressions.  This allows us to emit this diagnostic:

t.c:5:5: warning: integer constant is so large that it is unsigned
#if 12345678901234567890
    ^

And makes constant evaluation fully correct, but we do not yet detect and
warn about integer overflow.

This patch requires cvs up'ing the main llvm tree to get the APSInt class,
but no libraries need to be rebuilt there.

llvm-svn: 39388
2007-04-05 05:24:00 +00:00
Chris Lattner
6df7975ae6 minor cleanups. The major missing piece is tracking:
* signedness of values
 * overflow of intermediate computations.

llvm-svn: 39387
2007-04-04 06:54:19 +00:00
Chris Lattner
531efa43d8 Ah, this is already correctly rejected!
llvm-svn: 39386
2007-04-04 06:49:26 +00:00
Chris Lattner
ce5dc8a6b4 Switch PPExpression parsing to be in terms of APInt's whose widths are properly
sized to the target's intmax_t.  This also allows us to emit diagnostic like:

t.c:11:5: warning: integer constant is too large for its type
#if 18446744073709551616  // 2^64
    ^
t.c:15:5: warning: integer constant is too large for its type
#if 18446744073709551617  // 2^64-1
    ^

llvm-svn: 39385
2007-04-04 06:46:55 +00:00
Chris Lattner
ef8743b4f6 Move LiteralSupport files to their alphabetic position.
llvm-svn: 39384
2007-04-04 06:45:50 +00:00
Chris Lattner
525bafbd59 Stub out a method.
llvm-svn: 39383
2007-04-04 06:45:12 +00:00
Chris Lattner
871b4e101c Minor enhancements to GetIntegerValue(APInt):
* Detect overflow correctly.  When it occurs, return the truncated value.
  * Add fixme for radix analysis.

llvm-svn: 39382
2007-04-04 06:36:34 +00:00
Chris Lattner
5b743d3801 Add some really simplistic code for turning a ppnumber into an APInt. Much
improvement is needed!

llvm-svn: 39381
2007-04-04 05:52:58 +00:00
Steve Naroff
6f65421eab Bug #:
Submitted by:
Reviewed by:
Minor bug/typo in classof.

llvm-svn: 39380
2007-04-03 23:26:02 +00:00
Steve Naroff
46ba1ebaeb Bug #:
Submitted by:
Reviewed by:
- Typechecking for ++/-- not operating on canonical type (fixed).
- Many changes to Decl.h...
-- Changed ObjectDecl->ValueDecl.
-- ValueDecl doesn't define a storage class. The storage class is now
defined by VarDecl/FunctionDecl. EnumConstant decls don't need a storage class.
-- FieldDecl now inherits directly from Decl (it is not a value).
- Changed SemaExpr to use the new Decl.h. Also added a couple diagnostics for
bogus storage class usage. For example:
z.c:6:10: error: illegal storage class on function
auto int func();
         ^
z.c:7:14: error: illegal storage class on file-scoped variable
register int b;
             ^

llvm-svn: 39379
2007-04-03 23:13:13 +00:00
Chris Lattner
23d890337b Specify an initial size for StringMap.
llvm-svn: 39378
2007-04-03 22:14:25 +00:00
Chris Lattner
442f380edd Specify an initial size for StringMap's
llvm-svn: 39377
2007-04-03 22:13:57 +00:00
Steve Naroff
0f6256d0fa Bug #:
Submitted by:
Reviewed by:
declare getSizeType() const and fix typo in comment...

llvm-svn: 39376
2007-04-02 23:01:44 +00:00
Steve Naroff
7840336c91 Bug #:
Submitted by:
Reviewed by:
Avoid including "clang/AST/Expr.h" in Sema.h just to access
UnaryOperator::Opcode. While the inclusion wasn't objectionable in terms
of layering, it is nice to keep the inclusions as modest as possible.

llvm-svn: 39375
2007-04-02 22:55:05 +00:00
Steve Naroff
92e30f8cc7 Bug #:
Submitted by:
Reviewed by:
Incorporate code review feedback from Chris...
- minor restructure of ParseMemberReferenceExpr logic. The last statement
is now the instantiation of the AST node (which I like a lot and will conform
to throughout Sema).
- declare StmtClassNameTable const.
- reword an error diagnostic.
- install the correct type for ParseSizeOfAlignOfTypeExpr. Added hook in
ASTContext. For now, simply return Context.UnsignedLongTy. Added a FIXME
to revisit (i.e. compute using TargetInfo).

llvm-svn: 39374
2007-04-02 22:35:25 +00:00
Steve Naroff
ef2ab6a572 Bug #:
Submitted by:
Reviewed by:
Add three new classes to Decl.h: BlockVarDecl, FileVarDecl, and ParmVarDecl.

Made the constructor to VarDecl protected, to indicate it is "abstract".

Reorganized the Decl::Kind enum to allow us to add ObjectDecls/TypeDecls with
minimal breakage.  In the process, realized the isa support for ObjectDecl was already broken (so
the reorg paid for itself already:-) The range check should also be more efficient...

llvm-svn: 39373
2007-04-02 20:50:54 +00:00
Steve Naroff
fc49d67add Bug #:
Submitted by:
Reviewed by:
- Finished up incomplete type analysis for varibles (in Sema::ParseDeclarator()).
- Added many spec refs, since this area is confusing (for top level decls
in particular).
- Added a FIXME to MergeVarDecl()...it needs to be taught about tentative
definitions. As a result, we currently issue some bogus diagnostics.

llvm-svn: 39372
2007-04-01 21:27:45 +00:00
Steve Naroff
ca8f71287f Bug #:
Submitted by:
Reviewed by:
- ParseMemberReferenceExpr wasn't operating on the canonical type. From
now on, I will make sure the prologue to each Parse/Check function has
both the qualified type and the canonical type.
- More refinements to ParseDeclarator. It was allowing variable declarations
to incomplete types (e.g. void, struct foo, where foo wasn't defined).

llvm-svn: 39371
2007-04-01 01:41:35 +00:00
Steve Naroff
95af013c77 Bug #:
Submitted by:
Reviewed by:
Incorporate feedback from Chris (on the last check-in).
- added a shared hook for pre/post ++/-- CheckIncrementDecrementOperand().
- handle invalid arithmetic on incomplete types (void *, struct foo *, where the
body isn't in scope). Added a diagnostic for this case.
- added some comments and C99 annotations.
- Sema.h now includes Expr.h. I'd prefer not to, however it doesn't break
any layering.

llvm-svn: 39370
2007-03-30 23:47:58 +00:00
Steve Naroff
bc2f0993c0 Bug #:
Submitted by:
Reviewed by:
Implement ++/-- typechecking for pre/post unary expressions. This includes:

- added isLvalue, isModifiableLvalue (on TypeRef, Type, and RecordType).
- added isRealType, isRealFloatingType, isComplexType.
- hacked Diag to take a TypeRef (I was sick of writing the 2 line "setup":-)
In addition, this will likely lead to less bugs...I already had written code
that was doing a getAsString on "Type" (which is wrong...since it doesn't include
any qualifiers).
- Changed UnaryOperator to take a TypeRef...pass it the right stuff.
- Removed redundant ternary expressions in several predicates.
- A couple diagnostics.

llvm-svn: 39369
2007-03-30 20:09:34 +00:00
Steve Naroff
c1aadb172f Bug #:
Submitted by:
Reviewed by:
Finish up Sema::ParseArraySubscriptExpr. This involved:
- adding a couple predicates to Type.h (isObjectType, isDerivedType).
- added a diagnostic for subscripting non-object types (e.g. void (*)()).
- pass the correct result type...a minor detail:-)
- added some spec references to Type.h

llvm-svn: 39368
2007-03-28 21:49:40 +00:00
Steve Naroff
d9e7bd46dd Bug #:
Submitted by:
Reviewed by:
Make an error diagnosic a bit more expression (in Sema::GetTypeForDeclarator)

llvm-svn: 39367
2007-03-27 21:47:23 +00:00
Steve Naroff
bc57d0fe19 Bug #:
Submitted by:
Reviewed by:
Finish up fixes to Sema::GetTypeForDeclarator(). The typechecking should
now conform to the standard.

llvm-svn: 39366
2007-03-27 21:40:41 +00:00
Steve Naroff
06deba91d1 Bug #:
Submitted by:
Reviewed by:
Fix a couple bugs in Sema::GetTypeForDeclarator(). Need to disallow:
- void arrayOfFunctions[3]()
- void arrayOfVoids[3]
Need to talk to Chris about the return value...

llvm-svn: 39365
2007-03-27 18:04:48 +00:00
Steve Naroff
cc3214299b Bug #:
Submitted by:
Reviewed by:
Finish up Sema::ParseMemberReferenceExpr. This involved:
- added a getMember() function to RecordDecl.
- added stronger typing for "Members" (from Decl->FieldDecl).
- added a dignostic for members not found.
- changed MemberExpr to install the correct TypeRef.
- In general, simplified and cleaned up the routing.

llvm-svn: 39364
2007-03-26 23:09:51 +00:00
Chris Lattner
cceab1a8b7 Unnest assignment to make the code more clear
llvm-svn: 39363
2007-03-26 20:16:44 +00:00
Chris Lattner
0e13faa8ce Fix comment.
llvm-svn: 39362
2007-03-26 20:15:47 +00:00
Steve Naroff
f1e53698a4 Bug #:
Submitted by:
Reviewed by:

Type Checking...round 2. This checkin "breaks" parsing carbon.h. I imagine
that this will be true for the next week or so. Nevertheless, this round of
changes includes the following:

- Hacked various Expr classes to pass the appropriate TypeRef. Still have
a few more classes to touch.
- Implement type checking for ParseArraySubscriptExpr and ParseMemberReferenceExpr.
- Added a debug hook to derive the class name for Stmt/Expr nodes. Currently a
linear search...could easily optimize if important.
- Changed the name of TaggedType->TagType. Now we have TagType and TagDecl (which
are easier to remember).
- Fixed a bug in StringLiteral conversion I did a couple weeks ago. hadError was
not initialized (oops).
- changed Sema::Diag to return true. This streamlines the type checking code
considerably.
- Added many diagnositics.

This should be it!

llvm-svn: 39361
2007-03-23 22:27:02 +00:00
Steve Naroff
26c8ea5fab Bug #:
Submitted by:
Reviewed by:
Implement type checking. First round of changes are:
- Added predicates to Type.
- Added predicates to BinExpr.
- Added Check hooks that model the categories for Binary ops.
- Added TypeRef to Expr. Will lazily eval subclasses...
- Misc bug fixes/cleanups.

llvm-svn: 39360
2007-03-21 21:08:52 +00:00
Chris Lattner
bb73acd560 Support both tiger and leopard. Yes, this code is a hack :)
llvm-svn: 39359
2007-03-19 19:06:33 +00:00
Steve Naroff
97035855e3 Bug #:
Submitted by:
Reviewed by:
Down to 0 warning/errors for Carbon.h. Also made a couple trivial name
changes...

llvm-svn: 39358
2007-03-16 01:36:44 +00:00
Steve Naroff
6fbf0dcb6e Bug #:
Submitted by:
Reviewed by:
carbon.h looking good! Only 1 warning left...no parse errors!

This fixes 3 bugs...
- A couple tricky bugs with type canonicalization. Nested typedef's  weren't being
handled properly. For example, the following didn't work:

typdef int __darwin_pid_t;
typedef __darwin_pid_t pid_t;

int getpgid(pid_t);
int getpgid(int);

- The storage class wasn't being preserved. As a result, Sema was complaining
about the  following:

extern char *foo;
char *foo;

- various built-ins weren't registered...resulting in spurious warnings.

llvm-svn: 39357
2007-03-16 00:33:25 +00:00
Steve Naroff
3273c22863 Bug #:
Submitted by:
Reviewed by:
This is a "small" checkin.  #include_next wasn't working properly on
Leopard. This is because the driver has some hard coded paths that
don't work on Leopard. The real fix is to derive them, however I don't
think we need to solve this now. At this point, anyone working on clang
should be able to use Leopard. This fix removed 11 errors processing
"carbon.h". The bug that bubbles up to the top is in MergeFunctionDecl().
As part of digging into this part of Sema, I rearranged some methods
(and changed the visibility).

llvm-svn: 39356
2007-03-14 21:52:03 +00:00
Steve Naroff
b7d4924eb1 Bug #:
Submitted by:
Reviewed by:
Added size expression to ArrayType. This was needed to implement
Type::isIncompleteType(). At the moment, there is no support for
determining if we have a constant expression (which won't be too
difficult now that we have support for literal parsing/ast's).
Nevertheless, the parser will allow "struct foo { int a[b]; }"
(which is illegal). There is still significant work to fully analyze
array types. The good news is "carbon.h" goes from 288 bogus errors
down to 26!

llvm-svn: 39355
2007-03-14 19:55:17 +00:00
Steve Naroff
4f88b3113e Bug #:
Submitted by:
Reviewed by:
Move string literal parsing from Sema=>LiteralSupport. This consolidates
all the quirky parsing code within the Lexer subsystem (yeah!). This
simplifies Sema and (more importantly) allows future parsers
(i.e. subclasses of Action) to benefit from this code.

llvm-svn: 39354
2007-03-13 22:37:02 +00:00
Steve Naroff
f2fb89e759 Bug #:
Submitted by:
Reviewed by:
Misc. cleanup/polish of NumericLiteralParser and it's two clients, the
C preprocessor and AST builder...

llvm-svn: 39353
2007-03-13 20:29:44 +00:00
Steve Naroff
451d8f1626 Bug #:
Submitted by:
Reviewed by:
-Converted the preprocessor to use NumericLiteralParser.
-Several minor changes to LiteralSupport interface/implementation.
-Added an error diagnostic for floating point usage in pp expr's.

llvm-svn: 39352
2007-03-12 23:22:38 +00:00
Steve Naroff
09ef474197 Bug #:
Submitted by:
Reviewed by:
Moved numeric literal support from SemaExpr.cpp to LiteralSupport.[h,cpp]
in Lex. This will allow it to be used by both Sema and Preprocessor (and
should be the last major refactoring of this sub-system).. Over
time, it will be reused by anyone implementing an actions module (i.e.
any subclass of llvm::clang::Action. Minor changes to IntegerLiteral in Expr.h.
More to come...

llvm-svn: 39351
2007-03-09 23:16:33 +00:00
Steve Naroff
cf30755a41 Bug #:
Submitted by:
Reviewed by:
Refactored ParseNumericConstant using SkipDigits and friends. This
cleaned up the code and removed many "breaks". In the process, I found
several bugs that needed to be fixed (proof that this refactoring had
real value, not simply aesthetics). Also simplified error handling logic
and removed an unused error condition from Diagnostics.def.

llvm-svn: 39350
2007-03-07 01:21:37 +00:00
Steve Naroff
8160ea2072 Bug #:
Submitted by:
Reviewed by:
More code to parse numeric constants. This checkin includes:
- Feedback from Chris.
- Support for parsing floating point constants.
- Moved the code to "Sema". Changed API in Action.
- More/better error diagnostics.

At this point, the parsing support should be largely complete. Next step
is to work on filling in sensible values (in IntegerLiteral/FloatLiteral).

llvm-svn: 39349
2007-03-06 01:09:46 +00:00
Steve Naroff
1fb30c5e99 Bug #:
Submitted by:
Reviewed by:
First phase of parsing IntegerConstants. At the moment, all processing
is done in the Parser, not Sema. If necessary, this is easy to move.
Next steps:
- Convert well for strings to actual values (need to look @ APInt.h)
- Design the API between the Parser and Sema. Sema shouldn't have to be
concerned with any parsing issues...

llvm-svn: 39348
2007-03-03 00:02:57 +00:00
Chris Lattner
4eeeabbc28 test commit
llvm-svn: 39347
2007-03-02 23:14:38 +00:00
Steve Naroff
2c055d2b2b Go back to having the clang driver create ASTContext explicitly, passing
it to Sema/ASTStreamer (separating the lifetime of ASTContext from
the lifetime of Sema). One day it might be useful to consider creating
a context object implicitly if one isn't provided (using default arguments in
Sema's constructor). At this point, adding this convenience isn't necessary.

llvm-svn: 39346
2007-02-28 19:32:13 +00:00
Steve Naroff
38d31b47b0 Make Sema's use of the preprocessor explicit (rather than assume
the prerocessor will be available via ASTContext).
- Removed the public data member "PP" in ASTContext.
- Changed ASTContext's contructor to take TargetInfo/IdentifierTable explicitly.
- Implicitly create an ASTContext in Sema's constructor. This simplifies
the clients job (and makes ASTContext more private).
--As a side effect, added a "PrintStats" hook to Sema.

To support this level of encapsulation, ASTContext is always dynamically
allocated (by Sema). Previously, ASTContext was being allocated on the
stack. I don't believe this should be a performance issue (since ASTContext
is fairly course grain and tied to the lifetime of Sema currently).

llvm-svn: 39345
2007-02-28 01:22:02 +00:00
Steve Naroff
7f890eb790 More changes to complete the dynamic type support for Stmt/Expr.
This set of changes includes:
- convert ExprCXX.h and add to the Xcode project file.
-- required adding CXXBoolLiteralExpr to StmtNodes.def.
-- required adding visitor support (decl/defn).
- make the class codes in StmtNodes.def explicit (to enable range checking).
-- this required changing all clients of the STMT macro.
- declare the instance data const.

llvm-svn: 39344
2007-02-27 02:53:10 +00:00
Steve Naroff
408451b1af Added isa<> support for Statements and Expressions. This involved:
- adding enum constants &  instance data to Stmt.
- adding classof() functions to all Stmt's.
- modifying contructors to pass the appropriate enum as an arg.
Also tightened up a couple "void *" declarations/casts for arrays.

llvm-svn: 39343
2007-02-26 22:17:12 +00:00
Steve Naroff
df7855bb17 Batch search/replace snafu (inadvertantly changed IntegerConstant->StringLiteral).
clang still compiled/linked/ran properly...simply a confusing name regression.
From now on I'll make sure I run "cvs diff" before committing any changes!

llvm-svn: 39342
2007-02-21 23:46:25 +00:00
Steve Naroff
ab62488ae3 rename IntegerConstant->IntegerLiteral
rename FloatingConstant->FloatingLiteral
rename StringExpr->StringLiteral

llvm-svn: 39341
2007-02-21 22:05:47 +00:00
Bill Wendling
bf313b0bb2 Removed tabs.
llvm-svn: 39340
2007-02-13 20:09:46 +00:00
Bill Wendling
82487e1ac3 Testcase for bool types.
llvm-svn: 39339
2007-02-13 01:52:09 +00:00
Bill Wendling
4073ed5daa C++: Added support for bool types.
llvm-svn: 39338
2007-02-13 01:51:42 +00:00
Chris Lattner
b5f661a255 typo
llvm-svn: 39337
2007-02-11 19:20:42 +00:00
Chris Lattner
b055f2ddfc switch to using iterators instead of stringmap visitors.
llvm-svn: 39336
2007-02-11 08:19:57 +00:00
Chris Lattner
125c9f8e2a update readme.
llvm-svn: 39335
2007-02-11 08:19:36 +00:00
Chris Lattner
54d032bb76 CStringMap -> StringMap.
llvm-svn: 39334
2007-02-08 19:24:25 +00:00
Chris Lattner
34d1f5a8de adjust to CStringMap interface change.
llvm-svn: 39333
2007-02-08 19:08:49 +00:00
Chris Lattner
1036ee6c36 move a method out of line
llvm-svn: 39332
2007-01-31 05:05:57 +00:00
Chris Lattner
720f576f8d Optimize #define analysis for the common case of a single target.
llvm-svn: 39331
2007-01-30 06:01:31 +00:00
Chris Lattner
f82a33b487 add 3 apple-local intrinsics.
llvm-svn: 39330
2007-01-30 05:47:29 +00:00
Chris Lattner
83f1881702 Stub out the i386 SSE builtins, this eliminates nearly 300 warnings parsing
carbon.h on intel, bringing the total to 257.

llvm-svn: 39329
2007-01-30 05:34:20 +00:00
Chris Lattner
10a5b387cc Add support for target-specific builtins, including detecting nonportability
of source code.  For example:

$ clang INPUTS/carbon_h.c -arch i386 -arch ppc
prints:
...
/usr/lib/gcc/i686-apple-darwin8/4.0.1/include/mmintrin.h:51:3: note: use of a target-specific builtin function, source is not 'portable'
  __builtin_ia32_emms ();
  ^

because carbon.h pulls in xmmintrin.h, and __builtin_ia32_emms isn't a builtin on ppc.

Though clang now supports target-specific builtins, the full table isn't implemented yet.

llvm-svn: 39328
2007-01-29 05:24:35 +00:00
Chris Lattner
9561a0b3e7 Add support for target-independent builtin functions (like __builtin_abs),
whose decl objects are lazily created the first time they are referenced.
Builtin functions are described by the clang/AST/Builtins.def file, which
makes it easy to add new ones.

This is missing two important pieces:
1. Support for the rest of the gcc builtins.
2. Support for target-specific builtins (e.g. __builtin_ia32_emms).

Just adding this builtins reduces the number of implicit function definitions
by 6, reducing the # diagnostics from 550 to 544 when parsing carbon.h.

I need to add all the i386-specific ones to eliminate several hundred more.
ugh.

llvm-svn: 39327
2007-01-28 08:20:04 +00:00
Chris Lattner
b6738ec361 make LookupScopedDecl a method instead of a static function
llvm-svn: 39326
2007-01-28 00:38:24 +00:00
Chris Lattner
62d2e662ac When injecting a definition for implicitly defined functions, do so at
translation-unit scope, so we only warn about each implicitly defined
function once.  This cuts the number of errors parsing carbon.h from 616 to 550.

llvm-svn: 39325
2007-01-28 00:21:37 +00:00
Chris Lattner
efe4aea064 Start doing trivial merging of function prototypes. If we have a function
proto, then a function body, and they have the same type, don't emit an error.
This reduces #errors from 654->616

llvm-svn: 39324
2007-01-27 19:35:39 +00:00
Chris Lattner
c511efbcfc Add some better diagnostics for things like:
int foo;
int foo();

llvm-svn: 39323
2007-01-27 19:32:14 +00:00
Chris Lattner
01564d9697 Refactor conflict handling code, no functionality change.
llvm-svn: 39322
2007-01-27 19:27:06 +00:00
Chris Lattner
49252eb303 Implement a FIXME: when a typedef is seen at statement scope, make sure to
actually add it into the declspec for the type being parsed.  This allows us
to do correct semantic analysis on:

typedef int bar;
int foo() {
  bar a;
  return a;
}

This reduces # errors parsing carbon.h from 731 to 654.

llvm-svn: 39321
2007-01-27 19:04:39 +00:00
Chris Lattner
47955dee04 Eliminate the last of the slow lookups, by making non-prototyped function types
use the folding set.  This eliminates 359 slow lookups from carbon.h (the
rest) but doesn't substantially speed up parse.

llvm-svn: 39320
2007-01-27 08:37:20 +00:00
Chris Lattner
36f8e65eef Switch arraytypes over to using a FoldingSet instead of a stupid linear
search.  This reduces 'dumb' lookups from 1225 to 359, speeding up parse
of carbon.h from 0.173 to 0.156s (10%).

llvm-svn: 39319
2007-01-27 08:31:04 +00:00
Chris Lattner
25fe86af2b minor cleanup
llvm-svn: 39318
2007-01-27 08:29:39 +00:00
Chris Lattner
80c114ae7e Switch scopes from keeping decls in SmallSet to keeping them in the new
SmallPtrSet data structure.  This datastructure handles the 'nonsmall' case
quite gracefully, with an efficient exponentially probed hashtable.  This is
important for handling global scope, which gets many thousands of decls (e.g.
every function and enum value).  Of course the typical inner scopes are still
as efficient as ever.

On my mac pro, this speeds up parsing carbon.h from 0.59s to 0.168s (3.5x),
and there is still low hanging fruit :).

For reference, GCC on the same system takes 0.33s for -fsyntax-only.

llvm-svn: 39317
2007-01-27 07:16:01 +00:00
Chris Lattner
38047f9e23 Fix test/Parser/argument_qualified.c
llvm-svn: 39316
2007-01-27 06:24:01 +00:00
Chris Lattner
a4792c1e64 new testcase that crashed clang
llvm-svn: 39315
2007-01-27 06:23:34 +00:00
Chris Lattner
739fa67f19 Revert accidental commit
llvm-svn: 39314
2007-01-27 02:20:41 +00:00
Chris Lattner
baf33665fb adjust to change in SmallSet interface
llvm-svn: 39313
2007-01-27 02:14:08 +00:00
Chris Lattner
67521df9a8 Switch pointers over to using a FoldingSet to unique them instead of
"obviously braindead" linear searches.  reduces the number of slow
type lookups from 10K to 883 on carbon.h, speeding up parsing from 3.5 to
1.26s.

llvm-svn: 39312
2007-01-27 01:29:36 +00:00
Chris Lattner
fd4de79d2b Eliminate "obviously braindead" canonicalization of function types, using
a foldingset instead.  This reduces the number of slow type lookups from
32K to 10K, which speeds up parsing of carbon.h from 11s to 3.5s.

llvm-svn: 39311
2007-01-27 01:15:32 +00:00
Chris Lattner
4f6a75809c fix printing of unprototyped function decls.
llvm-svn: 39310
2007-01-26 21:19:14 +00:00
Chris Lattner
0659f48467 add a new TypeDecl class, which shares commonality between TypedefDecl and TagDecl instances.
llvm-svn: 39309
2007-01-26 02:12:16 +00:00
Chris Lattner
6668fc60be Use a cache in TypedefDecl to make ASTContext::getTypedefType trivial.
This speeds up parsing carbon.h from 16.0s to 11.3s, reducing slow
lookups from 63K to 32K.

llvm-svn: 39308
2007-01-26 02:07:07 +00:00
Chris Lattner
32d920b8dc rename some classes, no functionality changes.
llvm-svn: 39307
2007-01-26 02:01:53 +00:00
Chris Lattner
733067d20a TagDecl now holds a cache for the type corresponding to it. This speeds up
ASTContext::getTagDeclType by not having to do a linear search.  With this,
parse time for carbon.h drops from 21.8s to 16.0s and # slow lookups drop from
83K to 63K.

llvm-svn: 39306
2007-01-26 01:42:24 +00:00
Chris Lattner
4eb445d2a1 start gather stats on types processed. carbon.h currently yields:
*** AST Context Stats:
  30594 types total.
    19 builtin types
    3929 pointer types
    308 array types
    18883 function types with proto
    8 function types with no proto
    2988 typename (typedef) types
    4459 tagged types
      1476 struct types
      80 union types
      0 class types
      2903 enum types
  83298 slow type lookups

Next up, making type canonicalization not trivially silly.

llvm-svn: 39305
2007-01-26 01:27:23 +00:00
Chris Lattner
01a7c5364f Don't crash if GetTypeForDeclarator can't grok a type.
llvm-svn: 39304
2007-01-25 23:09:03 +00:00
Chris Lattner
e5a6656b62 Reject:
struct q { int a, a; };

with:

t.c:3:19: error: duplicate member 'a'
struct q { int a, a; };
                  ^
t.c:3:16: error: previous definition is here
struct q { int a, a; };
               ^

llvm-svn: 39303
2007-01-25 22:48:42 +00:00
Chris Lattner
8116d1b5e4 Register enumconstantdecls in their appropriate scope and check for conflicts.
This emits these diagnostics:

t.c:4:14: error: redefinition of 'a'
enum foo22 { a, b };
             ^
t.c:3:5: error: previous definition is here
int a;
    ^
t.c:8:17: error: redefinition of enumerator 'b'
enum foo23 { c, b };
                ^
t.c:4:17: error: previous definition is here
enum foo22 { a, b };
                ^
4 diagnostics generated.


for:

int a;
enum foo22 { a, b };
enum foo23 { c, b };

llvm-svn: 39302
2007-01-25 22:38:29 +00:00
Chris Lattner
41175f40a3 random testcase
llvm-svn: 39301
2007-01-25 07:42:11 +00:00
Chris Lattner
c1915e2052 Create EnumConstantDecl objects for each enum value, and fill them into
the EnumDecl when the enum type is complete.  This allows us to detect
redefinitions of enums.

llvm-svn: 39300
2007-01-25 07:29:02 +00:00
Chris Lattner
5f521506aa Add EnumDecl, warn about forward references to enums:
t.c:2:6: warning: ISO C forbids forward references to 'enum' types
enum foo22* X;
     ^

llvm-svn: 39299
2007-01-25 06:27:24 +00:00
Chris Lattner
ffbc271023 refactor tag processing into a new ParseTag method. Share this between
structs and enums.

llvm-svn: 39298
2007-01-25 06:05:38 +00:00
Chris Lattner
4194315681 Save the member list of a struct/union in the RecordDecl for the struct.
llvm-svn: 39297
2007-01-25 04:52:46 +00:00
Chris Lattner
720a054994 Enforce the rest of C99 6.7.2.1p2, emitting diagnostics like:
t.c:10:15: warning: 'bonk' may not be nested in a struct due to flexible array member
  struct bink bonk;
              ^
t.c:13:14: error: 'struct bink' may not be used as an array element due to flexible array member
struct bink A[123];
             ^
for:

struct bink {
  struct bink *a;
  int X[];  // ok.
};

struct foo {
  int A;
  struct bink bonk;
};

struct bink A[123];

llvm-svn: 39296
2007-01-25 00:44:24 +00:00
Chris Lattner
8262560b8b Compile:
struct bork {
  int X[];
};

struct bink {
  struct bink a;
  int X[];  // ok.
};

to:
t.c:3:7: error: flexible array 'X' not allowed in otherwise empty struct
  int X[];
      ^
t.c:7:15: error: field 'a' has incomplete type
  struct bink a;
              ^

llvm-svn: 39295
2007-01-24 02:26:21 +00:00
Chris Lattner
bdf8b8d251 Enforce C99 6.7.2.1p2:
t.c:5:8: error: field 'foo' declared as a function
  void foo();
       ^

llvm-svn: 39294
2007-01-24 02:11:17 +00:00
Chris Lattner
ce3a702f4b implement classof for FieldDecl
llvm-svn: 39293
2007-01-24 02:10:37 +00:00
Chris Lattner
1300fb9603 create field decl objects for the members of a struct/union. Diagnose code
like:
struct S { struct S {} X; };

with:
t.c:2:19: error: nested redefinition of 'struct'
struct S { struct S {} X; };
                  ^
t.c:2:1: error: previous definition is here
struct S { struct S {} X; };
^

llvm-svn: 39292
2007-01-23 23:42:53 +00:00
Chris Lattner
6531c1075c Diagnose invalid sizeof/alignof operands.
llvm-svn: 39291
2007-01-23 22:29:49 +00:00
Chris Lattner
367b019f79 add callback for fields.
llvm-svn: 39290
2007-01-23 22:29:13 +00:00
Chris Lattner
c0cb43e518 Add Type::isIncompleteType, which implements the algorithm described in
C99 6.2.5.

llvm-svn: 39289
2007-01-23 21:58:16 +00:00
Chris Lattner
d68e129e87 structure bodies can't get scopes.
llvm-svn: 39288
2007-01-23 21:57:45 +00:00
Chris Lattner
8eaca54d76 new testcase
llvm-svn: 39287
2007-01-23 20:16:22 +00:00
Chris Lattner
7b9ace672b simplify structure body parsing code. Reorganize how tags are processed.
Diagnose redefintion of tag types, e.g.:

t.c:7:8: error: redefinition of 'blah'
struct blah {};
       ^
t.c:1:8: error: previous definition is here
struct blah {
       ^
2 diagnostics generated.

llvm-svn: 39286
2007-01-23 20:11:08 +00:00
Chris Lattner
3e30f7c70f add a testcase for c++ casting operators, by Bill
llvm-svn: 39285
2007-01-23 06:12:15 +00:00
Chris Lattner
fb072463e5 Add TaggedType, which represents tagged decls as types. Create these when
converting a declspec with TST = struct/union.  Pretty print as well.

llvm-svn: 39284
2007-01-23 05:45:31 +00:00
Chris Lattner
c284e9b905 fix some incorrect assertions
llvm-svn: 39283
2007-01-23 05:14:32 +00:00
Chris Lattner
b9d572a0a8 Generalize DeclSpec::TypedefRep to allow it to hold any type representation.
Use it to hold the declaration object for a struct/union.

llvm-svn: 39282
2007-01-23 04:58:34 +00:00
Chris Lattner
90a26b0758 split the code for parsing a struct/union body out into its own method.
llvm-svn: 39281
2007-01-23 04:38:16 +00:00
Chris Lattner
7bd11febba make file-static function be a static declspec method.
llvm-svn: 39280
2007-01-23 04:35:33 +00:00
Chris Lattner
69680eabc0 Make some file-static functions be static methods in the DeclSpec class.
llvm-svn: 39279
2007-01-23 04:34:43 +00:00
Chris Lattner
bf0b798b87 There is no need for the Action::TagType enum, use DeclSpec::TST instead.
llvm-svn: 39278
2007-01-23 04:27:41 +00:00
Chris Lattner
f34c4da0c3 Finish tag processing. Since it can be shared with C++ Classes and enums,
rename it to ParseTag.

llvm-svn: 39277
2007-01-23 04:08:05 +00:00
Chris Lattner
5f7f4e43fb clean up scope iteration support
llvm-svn: 39276
2007-01-23 03:43:34 +00:00
Chris Lattner
7e783a1a08 Diagnose mixing of tags. For example, for:
struct blah * P;
union blah *P2;

we now emit:

t.c:2:1: error: redefinition of 'blah' with tag that does not match previous use
union blah *P2;
^
t.c:1:8: error: previous use is here
struct blah * P;
       ^

llvm-svn: 39275
2007-01-23 02:05:42 +00:00
Chris Lattner
8799cf202c When parsing a struct/union tag, we need to know whether the tag is a use
or a definition/declaration of a tag.  This is required to handle
C99 6.7.2.3p11 properly.

llvm-svn: 39274
2007-01-23 01:57:16 +00:00
Chris Lattner
3e29d0efd5 Switch Scope to use a SmallSet instead of a SmallVector to make isDeclScope
queries more natural.

llvm-svn: 39273
2007-01-23 01:35:19 +00:00
Chris Lattner
ff65b6bc85 Unstack identifiers more carefully when poping scope. Add assertion to catch the bad
case and handle identifiers in the same namespace correctly.  This implements
test/Parser/c-namespace.c

llvm-svn: 39272
2007-01-23 01:33:16 +00:00
Chris Lattner
23f2e9e687 new testcase
llvm-svn: 39271
2007-01-23 01:32:33 +00:00
Chris Lattner
ad9ac94d08 LLVM now has SmallSet, use it.
llvm-svn: 39270
2007-01-23 01:14:52 +00:00
Chris Lattner
371f154c4f adjust to api change
llvm-svn: 39269
2007-01-22 07:41:51 +00:00
Chris Lattner
8c6519a6e4 invoke a new callback when starting to parse a struct/union tag
llvm-svn: 39268
2007-01-22 07:41:36 +00:00
Chris Lattner
28743e219b - Add struct/union/class/enum kinds.
- Add support for getting the namespace of a decl.
 - Move type down the inheritance hierarchy, it doesn't make sense for a struct
   to have a type, and typedef's use types in different ways than variables do.
 - Add initial TagDecl/RecordDecl classes.

llvm-svn: 39267
2007-01-22 07:41:08 +00:00
Chris Lattner
d0ee402a43 Make name lookup properly obey C namespaces, simplify decl construction byeliminating the 'next' pointer from the ctor, and add initial support forparsing struct/union tags.
llvm-svn: 39266
2007-01-22 07:39:30 +00:00
Chris Lattner
18b196282f Make name lookup properly obey C namespaces, simplify decl construction by
eliminating the 'next' pointer from the ctor, and add initial support for
parsing struct/union tags.

llvm-svn: 39265
2007-01-22 07:39:13 +00:00
Chris Lattner
c1618c452f add an action for parsing struct/union tags
llvm-svn: 39264
2007-01-22 07:37:38 +00:00
Chris Lattner
20ae9f6622 pretty print ... as well
llvm-svn: 39263
2007-01-21 23:48:06 +00:00
Chris Lattner
7f24b2abb8 Pretty print function prototypes as well.
llvm-svn: 39262
2007-01-21 23:46:27 +00:00
Chris Lattner
ef1387808f Pretty print the function prototype. For example, print:
void (*signal(int arga, void (*argb)(double Y)))(void* Z) {}

as:

void (*signal(int arga, void (*argb)(double)))(void *) {
}

go C :)

llvm-svn: 39261
2007-01-21 23:11:09 +00:00
Chris Lattner
ec040b1d89 make Decl::getName() not crash if the decl is unnamed (e.g. an unnamed argument)
llvm-svn: 39260
2007-01-21 23:09:50 +00:00
Chris Lattner
2e89ebbcc8 add accessor
llvm-svn: 39259
2007-01-21 23:09:17 +00:00
Chris Lattner
3a386e2fa8 Implement llvm::simplify_type, allowing dyn_cast<FunctionType>(typeref).
llvm-svn: 39258
2007-01-21 22:52:48 +00:00
Chris Lattner
99d3177103 Change scopes to maintain decls, not identifiers.
Detect and emit errors when names are redefined in the same scope, e.g.
test/Parser/argument_redef.c, which now emits:

argument_redef.c:4:22: error: redefinition of 'A'
int foo(int A) { int A; }
                     ^
argument_redef.c:4:13: error: previous definition is here
int foo(int A) { int A; }
            ^

llvm-svn: 39257
2007-01-21 22:37:37 +00:00
Chris Lattner
f61c8a805d Handle C99 6.7.5.3p10, fixing test/Parser/attributes.c
llvm-svn: 39256
2007-01-21 19:04:43 +00:00
Chris Lattner
8f5bf2f233 avoid allocating memory for empty arg lists
llvm-svn: 39255
2007-01-21 19:04:10 +00:00
Chris Lattner
30b4b5cad8 default to -fsyntax-only
llvm-svn: 39254
2007-01-21 19:03:55 +00:00
Chris Lattner
c5cdf4d092 Next big step in function parsing: create decl objects for parameters,
inserting them into the function body scope and registering them with the
corresponding FunctionDecl.

llvm-svn: 39253
2007-01-21 07:42:07 +00:00
Chris Lattner
7f58c3dfe4 Do not use ParseCompoundStatement to parse the body of a function. This causes
an extra scope stack to be pushed between the function body and arguments, which
causes the parser to incorrectly accept stuff like 'int foo(int A) { int A; }',
which is test/Parser/argument_redef.c.

llvm-svn: 39252
2007-01-21 06:56:16 +00:00
Chris Lattner
ac71608b17 new testcase
llvm-svn: 39251
2007-01-21 06:56:08 +00:00
Chris Lattner
3bdee8c053 cleanup code to make it more obvious and extensible
llvm-svn: 39250
2007-01-21 06:52:45 +00:00
Chris Lattner
f297880ff9 Split code out of ParseCompoundStatement into ParseCompoundStatementBody.
This fixes a bug where a missing } could cause the scope stacks to get
unbalanced and will be used for function body parsing.

llvm-svn: 39249
2007-01-21 06:52:16 +00:00
Chris Lattner
79ff0d4cc1 Make the clean target tidier by cleaning the test directory.
llvm-svn: 39248
2007-01-15 02:06:47 +00:00
Chris Lattner
29375654b6 Add support for parsing and pretty printing const_cast, dynamic_cast,
reinterpret_cast, and static_cast.  Patch by Bill!

llvm-svn: 39247
2006-12-04 18:06:35 +00:00
Chris Lattner
1b65aaef2b improve this test to also check -fno-operator-keywords.
llvm-svn: 39246
2006-12-04 18:00:36 +00:00
Chris Lattner
3e7592ea78 Add support for -fno-operator-names, patch by Bill.
llvm-svn: 39245
2006-12-04 07:48:37 +00:00
Chris Lattner
3034f66584 add option for C++ operator names, patch by Bill.
llvm-svn: 39244
2006-12-04 07:46:15 +00:00
Chris Lattner
69c7ee2d51 allow getTokenName to work for keywords.
llvm-svn: 39243
2006-12-04 07:45:05 +00:00
Chris Lattner
2114d5e948 add some comments
llvm-svn: 39242
2006-12-04 07:40:24 +00:00
Chris Lattner
5c5fbccc96 Scrutinize K&R parameter declarations. This implements C99 6.9.1p6, correctly
diagnosing malformed K&R function definitions.

llvm-svn: 39241
2006-12-03 08:41:30 +00:00
Chris Lattner
0d89d5a638 Enforce C99 6.7.5.3p3, rejecting code like:
void foo(void (*q)(a,b,c)) {}

llvm-svn: 39240
2006-12-03 07:14:39 +00:00
Chris Lattner
969ca15b41 Diagnose errors like:
void bar(int X, int X);

void blah(X, Y, X) int X, Y; {}

llvm-svn: 39239
2006-12-03 06:29:03 +00:00
Chris Lattner
53e776c1e4 reject int(const void).
llvm-svn: 39238
2006-12-03 03:07:05 +00:00
Chris Lattner
726f97b435 implement a fixme: make BuiltinType have an enum, specifying which type it is,
instead of having a string.

llvm-svn: 39237
2006-12-03 02:57:32 +00:00
Chris Lattner
c81f079d7e move void argument checking from the parser to the semantic analysis stage.
This allows us to handle typedefs of void correctly.  This implements
clang/test/Sema/void_arg.c

llvm-svn: 39236
2006-12-03 02:43:54 +00:00
Chris Lattner
d2e97c1f80 Handle void correctly in the argument list for a function. For:
X = sizeof(int (void a));
  X = sizeof(int (int, void));
  X = sizeof(int (void, ...));

We now emit:

t.c:6:24: error: void argument may not have a name
  X = sizeof(int (void a));
                       ^
t.c:7:24: error: 'void' must be the first and only parameter if specified
  X = sizeof(int (int, void));
                       ^
t.c:8:19: error: 'void' must be the first and only parameter if specified
  X = sizeof(int (void, ...));
                  ^


And we pretty print this correctly (even though void isn't stored in the
arg list of the function type):
  X = sizeof(int (void));


However, this approach will have to change to handle typedefs of void.

llvm-svn: 39235
2006-12-03 02:03:33 +00:00
Chris Lattner
a606ac0fe3 finesse the interface to Declarator for function declarators so that the
declarator interface handles all alloc/dealloc issues related to the argument
list.  Before the client had to alloc and Declarator did the dealloc.

llvm-svn: 39234
2006-12-02 08:05:17 +00:00
Chris Lattner
784b168c92 new testcase
llvm-svn: 39233
2006-12-02 07:59:33 +00:00
Chris Lattner
c6ad8131dd implement AST representation for function types with and without a prototype.
This lets us pretty print stuff like this:

void foo() {
  int X;
  X = sizeof(void (*(*)())());
  X = sizeof(int(*)(int, float, ...));
  X = sizeof(void (*(int arga, void (*argb)(double Y)))(void* Z));

as:

  X = sizeof(void (*(*)())())
  X = sizeof(int (*)(int, float, ...))
  X = sizeof(void (*(int, void (*)(double)))(void *))

Ah the wonders of 'modern' C syntax!

llvm-svn: 39232
2006-12-02 07:52:18 +00:00
Chris Lattner
216d8654fd implement ParseParamDeclaratorType in the ast builder
llvm-svn: 39231
2006-12-02 06:47:41 +00:00
Chris Lattner
cbc426d4f7 Next step of retaining information about function prototypes: actually retain
the info.  Also, call Actions.ParseParamDeclaratorType instead of
Actions.ParseDeclarator for parameter type lists: we don't want declaration
objects created when parsing a function declarator, we just want type info.

llvm-svn: 39230
2006-12-02 06:43:02 +00:00
Chris Lattner
edc9e39d88 First step towards accurately retaining information about function
parameters: build an array of ParamInfo structures and pass it to the
declarator for safe keeping (it owns the list).

Next step: actually populate the arg array with useful stuff.

llvm-svn: 39229
2006-12-02 06:21:46 +00:00
Chris Lattner
cd3ea0cf35 doing this makes the diagnostics too verbose for no useful gain.
llvm-svn: 39228
2006-11-28 05:36:12 +00:00
Chris Lattner
b20e89449f capture sourcelocation info for type specifiers. This improves diagnostics
for things like 'short _Complex'.

llvm-svn: 39227
2006-11-28 05:30:29 +00:00
Chris Lattner
60809f5aaf record location info for const/volatile/restrict
llvm-svn: 39226
2006-11-28 05:18:46 +00:00
Chris Lattner
1b22eed03c add loc info for the inline specifier, fix some fixme's by using it.
llvm-svn: 39225
2006-11-28 05:12:07 +00:00
Chris Lattner
4d8f873b5b record accurate sourceloc info for storage class specs, so we can report
things like:

t.c:4:10: error: invalid storage class specifier in function declarator
int foo2(auto int Aaslfkasdflkj, register B);
         ^

instead of:

t.c:4:19: error: invalid storage class specifier in function declarator
int foo2(auto int Aaslfkasdflkj, register B);
                  ^

llvm-svn: 39224
2006-11-28 05:05:08 +00:00
Chris Lattner
353f5740b1 Finish converting DeclSpec to use accessors.
llvm-svn: 39223
2006-11-28 04:50:12 +00:00
Chris Lattner
a925dc66e4 Convert more code to use DeclSpec accessors
llvm-svn: 39222
2006-11-28 04:33:46 +00:00
Chris Lattner
f055d43211 add accessors to DeclSpec, start moving clients over to use them.
llvm-svn: 39221
2006-11-28 04:28:12 +00:00
Chris Lattner
0d0111b8e4 Group declspec ivars together.
llvm-svn: 39220
2006-11-28 04:10:07 +00:00
Chris Lattner
43e956c3b7 verify C99 6.7.5.3p2
llvm-svn: 39219
2006-11-28 04:05:37 +00:00
Chris Lattner
652c16924e Produce a nice error message for '#define and' in C++. Patch by Bill!
llvm-svn: 39218
2006-11-21 23:47:30 +00:00
Chris Lattner
bb233fe3aa add some comments.
llvm-svn: 39217
2006-11-21 23:13:27 +00:00
Chris Lattner
2bb8a95389 eliminate string compares when checking for the 'defined' token.
llvm-svn: 39216
2006-11-21 22:24:17 +00:00
Chris Lattner
c5b966f893 check minutia of the standard.
llvm-svn: 39215
2006-11-21 17:31:32 +00:00
Chris Lattner
5b9f4891d7 Add support for C++ operator keywords. Patch by Bill Wendling.
llvm-svn: 39214
2006-11-21 17:23:33 +00:00
Chris Lattner
058b4b6b41 run .cpp files as tests
llvm-svn: 39213
2006-11-21 17:22:28 +00:00
Chris Lattner
d6775fa217 add note in the output
llvm-svn: 39212
2006-11-21 06:36:58 +00:00
Chris Lattner
00348acace clear file info after processing one file, it shouldn't carry over to the
next.

llvm-svn: 39211
2006-11-21 06:34:57 +00:00
Chris Lattner
2ea9dd7fc0 ProcessInputFile no longer mutates LangInfo.
llvm-svn: 39210
2006-11-21 06:18:11 +00:00
Chris Lattner
b352e3edb5 Change KeepComments/KeepMacroComments modes to be facets of the preprocessor
state, not aspects of the language standard being parsed.

llvm-svn: 39209
2006-11-21 06:17:10 +00:00
Chris Lattner
ad7cdd37b3 simplify the Preprocessor ctor.
llvm-svn: 39208
2006-11-21 06:08:20 +00:00
Chris Lattner
96327eaa52 first step refactoring driver so that it can process multiple input files
at once.

llvm-svn: 39207
2006-11-21 05:52:55 +00:00
Chris Lattner
a92809b1ab add an accessor
llvm-svn: 39206
2006-11-21 05:52:33 +00:00
Chris Lattner
87f267ef4e eliminate global variables now that PPCallbacks can have state
llvm-svn: 39205
2006-11-21 05:02:33 +00:00
Chris Lattner
09d5804683 Make it easier to run tests from the top level with a helper target
llvm-svn: 39204
2006-11-21 05:01:56 +00:00
Chris Lattner
b8d6d5a81d Formalize preprocessor callbacks together into a PPCallbacks structure, instead
of having a loose collection of function pointers.  This also allows clients to
maintain state, and reduces the size of the Preprocessor.h interface.

llvm-svn: 39203
2006-11-21 04:09:30 +00:00
Chris Lattner
38495cb2e7 -fsyntax-only is synonym for -parse-ast for now.
llvm-svn: 39202
2006-11-21 04:07:21 +00:00
Chris Lattner
017865fb62 adjust test
llvm-svn: 39201
2006-11-21 04:06:06 +00:00
Chris Lattner
b0e7a06e53 Add some standard include paths for C++.
llvm-svn: 39200
2006-11-21 03:40:37 +00:00
Chris Lattner
d8702cd845 Implement a TODO: properly invoke actions for the * in things like:
where P is a pointer.

  int A[*P];

llvm-svn: 39199
2006-11-21 03:12:15 +00:00
Chris Lattner
a966bf6ebf fix a variable shadowing issue that caused us to misparse:
void B() {
  memcpy (3, 2, 1);
}

where memcpy is undeclared.

llvm-svn: 39198
2006-11-21 01:40:01 +00:00
Chris Lattner
740b2f30c7 When a decl is popped from its current scope, link it to the decl chain for
the containing function.  This avoids leaking decls.

llvm-svn: 39197
2006-11-21 01:32:20 +00:00
Chris Lattner
229ce60fc9 split the ParseFunctionDefinition action into two actions, one which is
called before and one which is called after function definition parsing.

llvm-svn: 39196
2006-11-21 01:21:07 +00:00
Chris Lattner
eda517e456 new testcase
llvm-svn: 39195
2006-11-20 07:03:41 +00:00
Chris Lattner
ac18be9ad2 Add support for C90 implicitly defined functions, e.g.:
int A() {
  return X();
}

llvm-svn: 39194
2006-11-20 06:49:47 +00:00
Chris Lattner
5efbb33a6b remember referenced decls in our AST's
llvm-svn: 39193
2006-11-20 05:01:40 +00:00
Chris Lattner
17ed487947 parse identifier expressions properly. This allows us diagnose this:
typedef int X;

int A() {
  return X;
}

int B() {
  return Y;
}

as:

/Users/sabre/test.c:5:10: error: unexpected type name 'X': expected expression
return X;
       ^
/Users/sabre/test.c:9:10: error: use of undeclared 'Y' value
return Y;
       ^

llvm-svn: 39192
2006-11-20 04:58:19 +00:00
Chris Lattner
0d8b1a1eff remember and pretty-print cast types
llvm-svn: 39191
2006-11-20 04:34:45 +00:00
Chris Lattner
f0a40e7ef4 correctly handle stuff like:
typedef int G;
  X = sizeof(const G);
  X = sizeof(restrict G);

llvm-svn: 39190
2006-11-20 04:17:27 +00:00
Chris Lattner
d0342e5989 Create a new TypeNameType class, which represents typedefs as types. This
allows us to handle stuff like:

typedef int G;
 ..
  X = sizeof(G);

llvm-svn: 39189
2006-11-20 04:02:15 +00:00
Chris Lattner
2ebe4bb64d when a typedef name is parsed as part of declspecs, remember the decl for the
typedef.

llvm-svn: 39188
2006-11-20 01:29:42 +00:00
Chris Lattner
5ca17df626 decls should all have types
llvm-svn: 39187
2006-11-19 23:32:49 +00:00
Chris Lattner
591a675b1c remove #include of clang/Parse/DeclSpec.h from clang/AST/Decl.h
llvm-svn: 39186
2006-11-19 23:16:18 +00:00
Chris Lattner
da8aa7b3a8 implement RTTI for Decl objects, eliminate some hokey virtual methods.
llvm-svn: 39185
2006-11-19 23:12:30 +00:00
Chris Lattner
200bdc3b90 add an action method for declspecs without declarators, like "struct foo;".
llvm-svn: 39184
2006-11-19 02:43:37 +00:00
Chris Lattner
94c22cd5b9 rename ParsedClassDeclaration -> ParsedObjcClassDeclaration.
llvm-svn: 39183
2006-11-19 02:35:21 +00:00
Chris Lattner
302b4be4c2 build TypedefDecl objects when parsing typedefs.
Add a parsing fastpath for when we see typedef at the top-level.

llvm-svn: 39182
2006-11-19 02:31:38 +00:00
Chris Lattner
33e8a55ed0 Parse and remember types enough that we can pretty print:
void foo(int X) {
  X = __alignof(int);
  X = sizeof(const int** restrict ** volatile*);
}

as:

x = __alignof(int)
x = sizeof(int const **restrict **volatile *)

llvm-svn: 39181
2006-11-19 01:48:02 +00:00
Chris Lattner
558cb292da add an action for parsing type names.
llvm-svn: 39180
2006-11-19 01:31:06 +00:00
Chris Lattner
52f3dc1ee3 add a note
llvm-svn: 39179
2006-11-19 01:17:45 +00:00
Chris Lattner
9dfdb3c70d rearrange the type printing code so that we can do the horrible C "inside out"
thing properly.  This allows us to print types like:
int (*A)[restrict static 4][6];

properly, in addition to representing them properly. :)

llvm-svn: 39178
2006-11-13 07:38:09 +00:00
Chris Lattner
d235d162d0 change print methods to render into a string, which is more useful for diagnostics
and for handling precedence of types more accurately

llvm-svn: 39177
2006-11-13 06:22:30 +00:00
Chris Lattner
7ccecb90d4 Implement parsing, printing and AST'ing of array types (except for the bounds).
This allows us to handle:

int (*A)[restrict static 4][6];

for example.

llvm-svn: 39176
2006-11-12 08:50:50 +00:00
Chris Lattner
47814666e1 Implement and use isa/dyncast/cast etc for Type classes.
llvm-svn: 39175
2006-11-12 00:56:20 +00:00
Chris Lattner
d5973ebbe2 Teach ASTContext to delete all created types in its dtor.
Teach getPointerType to (stupidly) memoize all created pointers.
Give types an enum so we can implement classof.

llvm-svn: 39174
2006-11-12 00:53:46 +00:00
Chris Lattner
970e54e3ac Build ASTs for the pointer qualifiers on declarators. This allows us to
parse (and print) things like:

int* const* restrict* const volatile***

etc.

llvm-svn: 39173
2006-11-12 00:37:36 +00:00
Chris Lattner
aecbefa519 We can now parse and remember the distinction between:
'unsigned char' and 'unsigned char const'.

-Chris

llvm-svn: 39172
2006-11-12 00:05:06 +00:00
Chris Lattner
8ddf65053e DeclSpec::TQ and TypeRef::TQ should stay in sync
llvm-svn: 39171
2006-11-11 23:59:23 +00:00
Chris Lattner
b571a5cbdc implement conversion of simple declspec base types, and implement TypeRef::dump
llvm-svn: 39170
2006-11-11 23:56:48 +00:00
Chris Lattner
5983de06cd add note about eliminating DeclSpec.
Add TypeRef::dump method.

llvm-svn: 39169
2006-11-11 23:56:01 +00:00
Chris Lattner
96bff30868 fix comment
llvm-svn: 39168
2006-11-11 23:55:28 +00:00
Chris Lattner
288e86ff15 Rename SemaDeclSpec.{h|cpp} back to DeclSpec.{h|cpp} now that the distinction
between sema and parse is clear.

llvm-svn: 39167
2006-11-11 23:03:42 +00:00
Chris Lattner
f84a79c4e9 restructure code to build the framework for creating types from declarators.
llvm-svn: 39166
2006-11-11 22:59:23 +00:00
Chris Lattner
f391a3ba70 Expand TypeRef itf
llvm-svn: 39165
2006-11-10 07:21:44 +00:00
Chris Lattner
ef51c20065 add the builtin types
llvm-svn: 39164
2006-11-10 07:17:23 +00:00
Chris Lattner
3522b20265 Tweak Type.h to compile.
llvm-svn: 39163
2006-11-10 06:49:39 +00:00
Chris Lattner
ddc135e593 Let ASTContext hold target info, since it's useful
llvm-svn: 39162
2006-11-10 06:34:16 +00:00
Chris Lattner
cb6a382b67 introduce a new ASTContext class to hold long-lived ast nodes.
llvm-svn: 39161
2006-11-10 06:20:45 +00:00
Chris Lattner
88724336e9 with xcode bugs worked around, I can actually add files to the project, woo
llvm-svn: 39160
2006-11-10 05:33:04 +00:00
Chris Lattner
e168f76c2d move the rest of the expr sema to SemaExpr.cpp and the decl processing stuff
to SemaDecl.cpp

llvm-svn: 39159
2006-11-10 05:29:30 +00:00
Chris Lattner
bd638926e2 remove diag helper that implicitly reports the diagnostic at the current
token: it is better for the code to be explicit.

llvm-svn: 39158
2006-11-10 05:19:25 +00:00
Chris Lattner
eaafe122b6 move semantic analysis of break/continue out of the parser into the sema class.
llvm-svn: 39157
2006-11-10 05:17:58 +00:00
Chris Lattner
af8d581230 move semantic analysis of statements to it's own file.
llvm-svn: 39156
2006-11-10 05:07:45 +00:00
Chris Lattner
5b183d882b split semantic analysis of expressions out to its own file
llvm-svn: 39155
2006-11-10 05:03:26 +00:00
Chris Lattner
ddd6fc84cf move ASTBuilder.h/cpp to be a private Sema.h/cpp files, not part of the
interface exported by libast.

llvm-svn: 39154
2006-11-10 04:58:55 +00:00
Chris Lattner
cc67ec1743 rename ASTBuilder to Sema
llvm-svn: 39153
2006-11-09 06:54:47 +00:00
Chris Lattner
ce76529a56 move Type.h to libAST
llvm-svn: 39152
2006-11-09 06:37:20 +00:00
Chris Lattner
08f2791bdc update comment
llvm-svn: 39151
2006-11-09 06:34:47 +00:00
Chris Lattner
697e5d692b Change courses on how we do semantic analysis. Semantic analysis
fundamentally requires having an AST around, so move all sema to the
AST library.  This is the first step, later steps will be needed to
clean up libast.

llvm-svn: 39150
2006-11-09 06:32:27 +00:00
Chris Lattner
289ab7bb1d rename SemaDecl.cpp/h to SemaDeclSpec.cpp/h
llvm-svn: 39149
2006-11-08 06:54:53 +00:00
Chris Lattner
b26b665742 rename these methods so that they read correctly.
llvm-svn: 39148
2006-11-08 06:10:32 +00:00
Chris Lattner
3503cefbba split ParseStringExpr into semantic/minimal actions
llvm-svn: 39147
2006-11-08 06:03:59 +00:00
Chris Lattner
87ca807e15 add Type.h to the project
llvm-svn: 39146
2006-11-08 06:03:37 +00:00
Chris Lattner
257aae5b47 add a note
llvm-svn: 39145
2006-11-08 06:03:16 +00:00
Chris Lattner
bacf0bfe45 add a note
llvm-svn: 39144
2006-11-08 05:53:27 +00:00
Chris Lattner
e030db6901 Structure for the type representation.
llvm-svn: 39143
2006-11-08 05:45:01 +00:00
Chris Lattner
6e544a9cca Fix an oversight: for modules with no other identifying target info,
the sparc backend should be preferred when running on sparcs.

llvm-svn: 39142
2007-07-11 16:32:10 +00:00
Chris Lattner
f89b50c38d init std::string with it's default ctor instead of "".
llvm-svn: 39141
2006-11-06 06:37:47 +00:00
Chris Lattner
034a18c3d2 use default ctor
llvm-svn: 39140
2006-11-06 06:33:29 +00:00
Chris Lattner
168f349036 this is not a converting ctor
llvm-svn: 39139
2006-11-06 06:31:59 +00:00
Chris Lattner
b6a0e1781f implement trivial scope caching. This reduces malloc traffic in the common
case, speeding up parsing of this contrived example:

#define A {{}}
#define B A A A A A A A A A A
#define C B B B B B B B B B B
#define D C C C C C C C C C C
#define E D D D D D D D D D D
#define F E E E E E E E E E E
#define G F F F F F F F F F F
#define H G G G G G G G G G G

void foo() {
  H
}

from 7.478s to 4.321s.  GCC requires 8.2s.

llvm-svn: 39138
2006-11-06 00:22:42 +00:00
Chris Lattner
1576870356 pretty print postfix ++/-- nicer
llvm-svn: 39137
2006-11-05 23:54:51 +00:00
Chris Lattner
33ad2cacc9 Make Scope keep track of the kind of scope it is. Properly scope loop and
switch statements.  Make break/continue check that they are inside of an
appropriate control-flow construct.  This implements Parser/bad-control.c.

llvm-svn: 39136
2006-11-05 23:47:55 +00:00
Chris Lattner
c19ddcd6dd rename EmptyAction.cpp -> MinimalAction.cpp
llvm-svn: 39135
2006-11-05 18:46:16 +00:00
Chris Lattner
c62b6c232f eliminate EmptyAction, merging it into MinimalAction instead.
llvm-svn: 39134
2006-11-05 18:44:26 +00:00
Chris Lattner
0663d2afd9 start factoring actions into two flavors: minimal and semantic actions.
llvm-svn: 39133
2006-11-05 18:39:59 +00:00
Chris Lattner
a6198b4e33 typographical tweaks
llvm-svn: 39132
2006-11-05 18:05:21 +00:00
Chris Lattner
ca96b89772 rename some options
llvm-svn: 39131
2006-11-05 18:00:10 +00:00
Chris Lattner
f78e6035da move some content around to make README more focused
llvm-svn: 39130
2006-11-05 17:54:43 +00:00
Chris Lattner
9fe24d75d2 for now -fsyntax-only builds all the AST's but doesn't print them.
llvm-svn: 39129
2006-11-05 07:59:55 +00:00
Chris Lattner
c95c8f2356 Fix a bug
llvm-svn: 39128
2006-11-05 07:59:22 +00:00
Chris Lattner
cf6bc66421 silence some warnings when asserts are disabled.
llvm-svn: 39127
2006-11-05 07:59:08 +00:00
Chris Lattner
7ad0fbe1f2 rename a bunch of files for better consistency
llvm-svn: 39126
2006-11-05 07:46:30 +00:00
Chris Lattner
7014fb8f07 need to add scope for arguments, but now is not the right time.
llvm-svn: 39125
2006-11-05 07:36:23 +00:00
Chris Lattner
da59c2f161 Move objc productions to their own .cpp file.
llvm-svn: 39124
2006-11-05 02:08:13 +00:00
Chris Lattner
40f16b5d26 improve objc comments
llvm-svn: 39123
2006-11-05 02:05:37 +00:00
Chris Lattner
36ad123dea print indirect goto correctly
llvm-svn: 39122
2006-11-05 01:51:06 +00:00
Chris Lattner
16976d3e83 build ast nodes and print goto/goto*/break/continue.
llvm-svn: 39121
2006-11-05 01:46:01 +00:00
Chris Lattner
6c0ff13761 Add ast node support for case/default/label stmts.
llvm-svn: 39120
2006-11-05 00:19:50 +00:00
Chris Lattner
f2174b633b implement AST node for switch stmt
llvm-svn: 39119
2006-11-04 20:59:27 +00:00
Chris Lattner
76af84462c use the StmtNodes.def database to eliminate redundant code.
llvm-svn: 39118
2006-11-04 20:54:18 +00:00
Chris Lattner
6fef2fb277 Add a new StmtNodes.def file as a catalog of all the Stmt's. This helps
eliminate repetitive code.

llvm-svn: 39117
2006-11-04 20:49:30 +00:00
Chris Lattner
85ed873bdc implement ast nodes for while and do loops
llvm-svn: 39116
2006-11-04 20:40:44 +00:00
Chris Lattner
301cd76b8c silence warning
llvm-svn: 39115
2006-11-04 20:32:01 +00:00
Chris Lattner
5d8f494c00 pretty print strings more nicely
llvm-svn: 39114
2006-11-04 20:29:31 +00:00
Chris Lattner
71e23ce2e1 Add AST node, AST building, actions, and printing for 'for' stmts.
llvm-svn: 39113
2006-11-04 20:18:38 +00:00
Chris Lattner
eb2feefb46 implement some todo's: invoke the actions module for identifiers leading
expressions in stmt contexts.

llvm-svn: 39112
2006-11-04 19:14:32 +00:00
Chris Lattner
882f788ef4 Implement the rest of the printer, restoring parity of functionality.
llvm-svn: 39111
2006-11-04 18:52:07 +00:00
Chris Lattner
9277aeb5c1 add accessors to ast nodes, remove VisitNull method from the visitor which is dead
llvm-svn: 39110
2006-11-04 18:51:16 +00:00
Chris Lattner
a3bcb7a104 start converting dumper to be a simple visitor
llvm-svn: 39109
2006-11-04 07:16:25 +00:00
Chris Lattner
9ea960a220 make visit methods take a reference to a visitor instead of a pointer.
Remove all dump_impl methods from Stmt subclasses

llvm-svn: 39108
2006-11-04 07:16:04 +00:00
Chris Lattner
72b7d39d78 remove full locinfo AST nodes for now. They just clutter the implementation
and should be implemented with an ASTBuilder subclass anyway.

llvm-svn: 39107
2006-11-04 06:37:16 +00:00
Chris Lattner
2ebe646f00 new file
llvm-svn: 39106
2006-11-04 06:33:06 +00:00
Chris Lattner
469d357425 implement visitor chaining.
llvm-svn: 39105
2006-11-04 06:32:52 +00:00
Chris Lattner
5e9a878126 add a new StmtVisitor class for traversing Stmt/Expr nodes.
llvm-svn: 39104
2006-11-04 06:21:51 +00:00
Chris Lattner
834618de6f replace some ugly alloca/malloc code with a couple of SmallString's.
llvm-svn: 39103
2006-11-03 07:48:41 +00:00
Chris Lattner
57dd8360f6 implement FIXME: replace use of alloca with use of SmallVector.
llvm-svn: 39102
2006-11-03 07:45:04 +00:00
Chris Lattner
64b09ee57a improve comment, fit to 80 cols
llvm-svn: 39101
2006-11-03 07:35:12 +00:00
Chris Lattner
70058dda70 Emit:
test.m:2:14: error: expected ';' after @class
@ class foo  int x;
             ^

instead of silently accepting the malformed input.

llvm-svn: 39100
2006-11-03 07:32:21 +00:00
Chris Lattner
aacc5af2c0 Fix case stmts to not fall through, rename methods, assert on unimplemented
pieces, emit a diagnostic like this:

test.m:4:1: error: unexpected '@' in program
@ foo;
^

llvm-svn: 39099
2006-11-03 07:21:07 +00:00
Chris Lattner
18d65c9b86 add a diagnostic
llvm-svn: 39098
2006-11-03 07:19:43 +00:00
Chris Lattner
8fb548fefd fit in 80 cols, rename some methods.
llvm-svn: 39097
2006-11-03 07:19:18 +00:00
Chris Lattner
569ce145d8 rename Builder.cpp -> ASTBuilder.cpp
llvm-svn: 39096
2006-11-03 06:45:47 +00:00
Chris Lattner
7cee11f078 Export the ASTBuilder class from the AST module.
llvm-svn: 39095
2006-11-03 06:42:29 +00:00
Chris Lattner
db9c7f284a minor updates
llvm-svn: 39094
2006-10-31 00:54:25 +00:00
Chris Lattner
9f6604fa60 Add altivec version of block comment skipping code.
llvm-svn: 39093
2006-10-30 20:01:22 +00:00
Chris Lattner
c07ba1fe2f Refactor the paths used for checking and getting the spelling of #include
filenames (and also '#pragma GCC dependency' of course).  Now, assuming
no cleaning is needed, we can go all the way from lexing the filename to
doing filename lookups with no mallocs.  This speeds up user PP time from
0.077 to 0.075s for Cocoa.h (2.6%).

llvm-svn: 39092
2006-10-30 05:58:32 +00:00
Chris Lattner
b8b94f1e9b Make Preprocessor::LookupFile take a character range instead of a string.
This avoids some copying in its clients.

llvm-svn: 39091
2006-10-30 05:38:06 +00:00
Chris Lattner
7cdbad945d Push strings out of the HeaderSearch interface, it now deals solely with
character ranges.

llvm-svn: 39090
2006-10-30 05:33:15 +00:00
Chris Lattner
ee7bf89cd6 Change framework cache map from map to CStringMap. This speeds up PP user
time on Cocoa.h from 0.078 to 0.077s.

llvm-svn: 39089
2006-10-30 05:19:23 +00:00
Chris Lattner
b201d9b13d Eliminate string use in DoFrameworkLookup. This speeds up pp of Cocoa.h
marginally from 0.079 to 0.078s.

llvm-svn: 39088
2006-10-30 05:09:49 +00:00
Chris Lattner
cf8ddac4bc Use SmallString instead of string in HeaderSearch::LookupFile. This avoids
malloc traffic, speeding up user time preprocessing Carbon.h 5% (0.083s to
0.079s).

llvm-svn: 39087
2006-10-30 04:42:33 +00:00
Chris Lattner
9c59bdace4 simplify logic, eliminate a copy of string data.
llvm-svn: 39086
2006-10-30 04:34:28 +00:00
Chris Lattner
2f4a89a5e8 Switch the FileManager::FileEntries map over to using a CStringMap. This
speeds up preprocessing Cocoa.h 16% (from 0.99 to 0.85s).

llvm-svn: 39085
2006-10-30 03:55:17 +00:00
Chris Lattner
43fd42e4d9 Wean LookupSubframeworkHeader off std::strings, use the new SmallString
class instead.  SmallString allows to code to avoid hitting malloc in
the normal case (or will, when some other stuff is converted over).

llvm-svn: 39084
2006-10-30 03:40:58 +00:00
Chris Lattner
a85cbe28a0 Avoid storing a directory name in both the DirEntries map keys and in the
UniqueDirs value.  Instead, just have the UniqueDirs value contain a pointer
to the key in the DirEntries map.

llvm-svn: 39083
2006-10-30 03:11:40 +00:00
Chris Lattner
af65375944 Switch DirEntries over to using a CStringMap. This speeds it up
'clang -Eonly INPUTS/Cocoa_h.m' by about 4%.

llvm-svn: 39082
2006-10-30 03:06:54 +00:00
Chris Lattner
8b1e848a04 Avoid some mallocs, and avoid leaking some memory, by making the
UniqueDirs/UniqueFiles maps own the memory for the FileEntry and DirEntries.

llvm-svn: 39081
2006-10-30 02:45:16 +00:00
Chris Lattner
da933aac0c remove some temporary testing code
llvm-svn: 39080
2006-10-29 23:49:15 +00:00
Chris Lattner
2b9e19be87 Pull the string hashtable out of the IdentifierTable, moving into LLVM's
libsupport.  Now it can be used for other things besides identifier hashing.

llvm-svn: 39079
2006-10-29 23:43:13 +00:00
Chris Lattner
ec659fce46 move memory allocation abstraction stuff out into LLVM's libsupport
llvm-svn: 39078
2006-10-29 22:09:44 +00:00
Chris Lattner
cf163aa407 no need for these classes to be so friendly anymore.
llvm-svn: 39077
2006-10-29 21:37:52 +00:00
Chris Lattner
3bc804ed3d genericize IdentifierInfo interface to make it work more naturally.
llvm-svn: 39076
2006-10-28 23:46:24 +00:00
Chris Lattner
2abeb12df6 Fix building after the pure virtual function name changed.
llvm-svn: 39075
2006-10-28 19:51:26 +00:00
Steve Naroff
b419d3a80e - Added basic structure for parsing top level Objective-C forms.
- Extended the typedef mechanism for classes, improved performance of the common case.
- Implemented @class in the parser.

llvm-svn: 39074
2006-10-27 23:18:49 +00:00
Chris Lattner
21b691d573 add some of the smaller test inputs I use.
llvm-svn: 39073
2006-10-27 18:15:56 +00:00
Chris Lattner
00a6be6f7b test again
llvm-svn: 39072
2006-10-27 18:09:32 +00:00
Chris Lattner
a0ed5fe382 test
llvm-svn: 39071
2006-10-27 18:03:57 +00:00
Chris Lattner
91e911ad75 test
llvm-svn: 39070
2006-10-27 18:00:23 +00:00
Chris Lattner
bcb416bbd5 Implement test/Preprocessor/comment_save_if.c
llvm-svn: 39069
2006-10-27 05:43:50 +00:00
Chris Lattner
ce999c490a new testcase
llvm-svn: 39068
2006-10-27 05:43:33 +00:00
Chris Lattner
9916c5ca7e Remove GNU C++ min/max operator extension support, they have been removed
from gcc mainline.

llvm-svn: 39067
2006-10-27 05:24:37 +00:00
Chris Lattner
ffda89611f Change DirectoryEntry::getName() to return a const char *
llvm-svn: 39066
2006-10-27 05:15:55 +00:00
Chris Lattner
480434865d change FileEntry::getName to return a const char*.
llvm-svn: 39065
2006-10-27 05:12:36 +00:00
Chris Lattner
1eb290b2e9 remove namelen field, it is now dead
llvm-svn: 39064
2006-10-27 05:07:16 +00:00
Chris Lattner
56bdb9a9a1 Remove identifier length field from IdentifierInfo, it is now dead.
llvm-svn: 39063
2006-10-27 05:06:38 +00:00
Chris Lattner
a883116ece fix bug reprobing.
llvm-svn: 39062
2006-10-27 04:54:47 +00:00
Chris Lattner
089e51923e remove todo
llvm-svn: 39061
2006-10-27 04:53:38 +00:00
Chris Lattner
aded4a977d Implement an sse2 version of the block comment scanner.
llvm-svn: 39060
2006-10-27 04:42:31 +00:00
Chris Lattner
6cc3e36cd7 Speed up block comment skipping by 35%.
llvm-svn: 39059
2006-10-27 04:12:35 +00:00
Chris Lattner
f2e3ac3b54 reimplement identifier hash table in terms of a probed table instead of a chained
table.  This is about 25% faster for identifier lookup.  This also implements
resizing of the hash table.

llvm-svn: 39058
2006-10-27 03:59:10 +00:00
Chris Lattner
341fd06d3c Use the full hash as a filter to reduce # strcmps
llvm-svn: 39057
2006-10-26 05:18:38 +00:00
Chris Lattner
893f272c39 Track the full (not mod the hash table size) hash value for each token.
This lets us find interesting properties of the hash distribution.

llvm-svn: 39056
2006-10-26 05:12:31 +00:00
Chris Lattner
05646c7f0e Fix these to allow clang to be in any dir.
llvm-svn: 39055
2006-10-26 04:56:55 +00:00
Chris Lattner
a32cda40b5 make this harder
llvm-svn: 39054
2006-10-25 06:21:19 +00:00
Chris Lattner
1178cbd941 new testcase
llvm-svn: 39053
2006-10-25 06:18:35 +00:00
Chris Lattner
ece49761a3 update comment
llvm-svn: 39052
2006-10-25 05:55:51 +00:00
Chris Lattner
5f84a0648d add ast node for ifstmt
llvm-svn: 39051
2006-10-25 05:55:20 +00:00
Chris Lattner
c52b118676 Handle __extension__ as a unary operator if requested.
llvm-svn: 39050
2006-10-25 05:45:55 +00:00
Chris Lattner
0535ebb3bd only add to LastInGroupList if at the top-level.
llvm-svn: 39049
2006-10-25 05:28:22 +00:00
Chris Lattner
6d9a685d75 Make the driver print function bodies at -parse-print-ast
llvm-svn: 39048
2006-10-25 05:11:20 +00:00
Chris Lattner
b19f796e97 llvm has no EH by default, no need for these flags.
llvm-svn: 39047
2006-10-25 05:09:05 +00:00
Chris Lattner
e5cca06829 Make AST nodes for ReturnStmt's and CompoundStmts
llvm-svn: 39046
2006-10-25 04:29:46 +00:00
Chris Lattner
f42cce7a8e Add new Stmt class
llvm-svn: 39045
2006-10-25 04:09:21 +00:00
Chris Lattner
ae31969ad2 Finish removing LexerToken from actions interface
llvm-svn: 39044
2006-10-25 03:49:28 +00:00
Chris Lattner
0ba3dc4ec3 Start removing LexerToken from the actions interface.
llvm-svn: 39043
2006-10-25 03:38:23 +00:00
Chris Lattner
64408c7107 Compoundstmts imply a scope, track it. This implements
test/Parser/CompoundStmtScope.c

llvm-svn: 39042
2006-10-25 03:15:33 +00:00
Chris Lattner
911d0fef03 Return an error code if an error occurs.
llvm-svn: 39041
2006-10-25 03:15:08 +00:00
Chris Lattner
19f4440f5b new testcase
llvm-svn: 39040
2006-10-25 03:14:54 +00:00
Chris Lattner
b1072a3df5 remove empty file
llvm-svn: 39039
2006-10-25 03:07:01 +00:00
Chris Lattner
3c98fd3af3 Switch to using a bitwise and instead of modulus.
llvm-svn: 39038
2006-10-22 17:48:27 +00:00
Chris Lattner
13175483d5 framework searching more efficient now
llvm-svn: 39037
2006-10-22 07:35:33 +00:00
Chris Lattner
ca1a1ed4cb Add -F option
llvm-svn: 39036
2006-10-22 07:34:56 +00:00
Chris Lattner
5c3ac11bf5 Reduce amount #included
llvm-svn: 39035
2006-10-22 07:29:01 +00:00
Chris Lattner
07b019a1bc add #include
llvm-svn: 39034
2006-10-22 07:28:56 +00:00
Chris Lattner
25246dfeb0 Split the DirectoryLookup class out to its own header.
llvm-svn: 39033
2006-10-22 07:26:52 +00:00
Chris Lattner
8120bc7e4a add new DirectoryLookup.h file
llvm-svn: 39032
2006-10-22 07:26:43 +00:00
Chris Lattner
5ed76da296 Implement framework filesystem caching.
llvm-svn: 39031
2006-10-22 07:24:13 +00:00
Chris Lattner
6cd618c3e8 update
llvm-svn: 39030
2006-10-22 06:34:13 +00:00
Chris Lattner
762d21b254 increase number of file ID's so we can preprocess carbon.h
llvm-svn: 39029
2006-10-22 06:34:00 +00:00
Chris Lattner
2a904d0aba Add assertions for out-of-fileid error case
llvm-svn: 39028
2006-10-22 06:33:42 +00:00
Chris Lattner
0b9bdd9a74 Use read to open small files so we don't run out of file descriptors as easily.
llvm-svn: 39027
2006-10-20 06:53:51 +00:00
Chris Lattner
641a0be31b count # framework lookups
llvm-svn: 39026
2006-10-20 06:23:14 +00:00
Chris Lattner
7949310b49 Enable these keywords as extensions in c90
llvm-svn: 39025
2006-10-20 06:13:36 +00:00
Chris Lattner
a4271e4a51 rename
llvm-svn: 39024
2006-10-20 06:13:26 +00:00
Chris Lattner
b84f986f45 gnu90 is default again
llvm-svn: 39023
2006-10-20 06:13:18 +00:00
Chris Lattner
5c683b2b4b Fix a regression introduced when adding subframework support
llvm-svn: 39022
2006-10-20 05:12:14 +00:00
Chris Lattner
62aa0d4c9f Implement test/Preprocessor/macro_arg_keyword.c
llvm-svn: 39021
2006-10-20 05:08:24 +00:00
Chris Lattner
2bda2df3dc new testcase
llvm-svn: 39020
2006-10-20 05:08:12 +00:00
Chris Lattner
2f9888e2ca switch to gnu99 by default
llvm-svn: 39019
2006-10-20 05:03:55 +00:00
Chris Lattner
4daa077a5c accept the __extension__ prefix expr
llvm-svn: 39018
2006-10-20 05:03:44 +00:00
Chris Lattner
577377e847 Speed up [sub]framework searching
llvm-svn: 39017
2006-10-20 04:55:45 +00:00
Chris Lattner
38681d7d81 Add intel include path
llvm-svn: 39016
2006-10-20 04:55:39 +00:00
Chris Lattner
63dd32b656 Implement subframework lookup
llvm-svn: 39015
2006-10-20 04:42:40 +00:00
Chris Lattner
25e0d54a0e Move keyword setup from the preprocessor into the IdentifierTable class.
llvm-svn: 39014
2006-10-18 06:07:05 +00:00
Chris Lattner
9f547a4fdd Fix regression in my last commit
llvm-svn: 39013
2006-10-18 06:06:41 +00:00
Chris Lattner
59a9ebdb17 refactor header searching stuff out of the main Preprocessor object into
it's own HeaderSearch object.  This makes Preprocessor simpler and easier
to understand.

llvm-svn: 39012
2006-10-18 05:34:33 +00:00
Chris Lattner
ff777c38dc silence warning, add hacky patch for framework lookup
llvm-svn: 39011
2006-10-18 04:03:13 +00:00
Chris Lattner
1ff0ed1d24 update
llvm-svn: 39010
2006-10-18 04:02:58 +00:00
Chris Lattner
8fd6ee1f2f silence warning
llvm-svn: 39009
2006-10-18 04:02:50 +00:00
Chris Lattner
964202dac0 add note
llvm-svn: 39008
2006-10-18 04:02:41 +00:00
Chris Lattner
1f496804d5 silence a warning
llvm-svn: 39007
2006-10-18 04:02:28 +00:00
Chris Lattner
04d1f3f75f track whether DirectoryLookup dirs are framework dirs.
llvm-svn: 39006
2006-10-17 06:20:32 +00:00
Chris Lattner
110da6979e add a note
llvm-svn: 39005
2006-10-17 05:20:30 +00:00
Chris Lattner
ff43821d53 Implement -std, -x, -ObjC and -ObjC++ options.
llvm-svn: 39004
2006-10-17 05:16:26 +00:00
Chris Lattner
720f2700b1 Make the identifier table track objc keywords
llvm-svn: 39003
2006-10-17 04:03:44 +00:00
Chris Lattner
87d3bec423 Make preprocessor keywords like 'define' first class citizens in the
IdentifierTable, instead of making them resort to strcmp'ing.

llvm-svn: 39002
2006-10-17 03:44:32 +00:00
Chris Lattner
b95cca0d33 fix test/Parser/attributes.c
llvm-svn: 39001
2006-10-17 03:01:08 +00:00
Chris Lattner
43ec2ce473 new testcase
llvm-svn: 39000
2006-10-17 03:00:45 +00:00
Chris Lattner
ae986d5ac7 Remove temporary code
llvm-svn: 38999
2006-10-17 02:54:07 +00:00
Chris Lattner
dd0b7cbf0b Oversight: fixes test/Lexer/number.c
llvm-svn: 38998
2006-10-17 02:53:51 +00:00
Chris Lattner
6e5b2a084e ignore '#line' and '# 123' for now.
llvm-svn: 38997
2006-10-17 02:53:32 +00:00
Chris Lattner
dee9b26fb8 new testcase
llvm-svn: 38996
2006-10-17 02:53:13 +00:00
Chris Lattner
04132371bb Make ConsumeFoo methods return the location of the consumed token.
llvm-svn: 38995
2006-10-16 06:12:55 +00:00
Chris Lattner
af63531ac3 Make ConsumeToken return the loc of the consumed token to simplify clients
llvm-svn: 38994
2006-10-16 06:06:51 +00:00
Chris Lattner
30f910e88e implement action callbacks for almost all the stmts.
llvm-svn: 38993
2006-10-16 05:52:41 +00:00
Chris Lattner
2dacc3ff2e Changes through out the parser and actions/ast interface to return top-level
declarations through the asm streamer.  For a testcase like:

int G;
int H, I, *J;
int func() {}

'clang -parse-print-ast' prints:

Read top-level decl: G
Read top-level decl: H
Read top-level decl: I
Read top-level decl: J
Read top-level decl: func

llvm-svn: 38992
2006-10-16 00:33:54 +00:00
Chris Lattner
a11999d83a start creating proper ast nodes for variables and functions
llvm-svn: 38991
2006-10-15 22:34:45 +00:00
Chris Lattner
4856a42489 add notes
llvm-svn: 38990
2006-10-15 22:34:29 +00:00
Chris Lattner
14a1b64418 create an ast node for &&label
llvm-svn: 38989
2006-10-15 22:33:58 +00:00
Chris Lattner
dad3c45adc update portability notes
llvm-svn: 38988
2006-10-15 01:13:14 +00:00
Chris Lattner
9c837537ad Sink target-specific #define info into the target descriptions. Add x86-32/64 and ppc64.
llvm-svn: 38987
2006-10-15 01:05:46 +00:00
Chris Lattner
2ddda73d40 add some notes.
llvm-svn: 38986
2006-10-15 01:05:06 +00:00
Chris Lattner
2ba425ea95 Get target-specific #defines from TargetInfo.
llvm-svn: 38985
2006-10-14 19:54:37 +00:00
Chris Lattner
063400e46e Implement the #define_other_target directive.
llvm-svn: 38984
2006-10-14 19:54:15 +00:00
Chris Lattner
58360339bd define extensions
llvm-svn: 38983
2006-10-14 19:53:48 +00:00
Chris Lattner
02846975da new testcase
llvm-svn: 38982
2006-10-14 19:53:37 +00:00
Chris Lattner
3e8b4d2854 new testcase for #define_target.
llvm-svn: 38981
2006-10-14 19:09:13 +00:00
Chris Lattner
81278c6356 Implement the #define_target preprocessor directive.
llvm-svn: 38980
2006-10-14 19:03:49 +00:00
Chris Lattner
2194ddc83d Add new TargetInfo hooks for getting the set of target-specific #defines.
llvm-svn: 38979
2006-10-14 18:32:26 +00:00
Chris Lattner
1f5ad11409 Implement TargetInfo hooks for #defines
llvm-svn: 38978
2006-10-14 18:32:12 +00:00
Chris Lattner
bfe9860bec add some notes about the portability model
llvm-svn: 38977
2006-10-14 17:39:56 +00:00
Chris Lattner
aecc057c64 new testcase
llvm-svn: 38976
2006-10-14 07:54:12 +00:00
Chris Lattner
02dffbda3b Write up TargetInfo so that use of wchar_t strings results in a warning if
used in a target set where the size is not identical.

llvm-svn: 38975
2006-10-14 07:50:21 +00:00
Chris Lattner
bc525438f7 Mark stuff const.
llvm-svn: 38974
2006-10-14 07:39:48 +00:00
Chris Lattner
2cbe715b79 Add Targets.cpp.
llvm-svn: 38973
2006-10-14 07:39:38 +00:00
Chris Lattner
5ba61f0e10 Add Targets.cpp, which implements the -arch command line option in terms of
TargetInfo.

llvm-svn: 38972
2006-10-14 07:39:34 +00:00
Chris Lattner
1e27fe165c Add new TargetInfo class to clang.
llvm-svn: 38971
2006-10-14 07:06:20 +00:00
Chris Lattner
509d3c00ed Rename LexerToken methods to be more consistent
llvm-svn: 38970
2006-10-14 05:19:39 +00:00
Chris Lattner
8c2048710d Rename LexerToken methods to be more consistent.
llvm-svn: 38969
2006-10-14 05:19:21 +00:00
Chris Lattner
56c7a5549c Minor edits
llvm-svn: 38968
2006-10-14 05:19:00 +00:00
Chris Lattner
d504f7d6c2 add notes
llvm-svn: 38967
2006-10-06 05:56:14 +00:00
Chris Lattner
8c76f87810 change default mode
llvm-svn: 38966
2006-10-06 05:56:09 +00:00
Chris Lattner
94b4ce3eae don't abort
llvm-svn: 38965
2006-10-06 05:51:35 +00:00
Chris Lattner
ea2f706262 add notes
llvm-svn: 38964
2006-10-06 05:40:42 +00:00
Chris Lattner
65de4b6a6d make this a bit nicer
llvm-svn: 38963
2006-10-06 05:40:30 +00:00
Chris Lattner
6f433fd2d3 add accessor
llvm-svn: 38962
2006-10-06 05:40:22 +00:00
Chris Lattner
b5600a6aa8 Parse ?:'s right
llvm-svn: 38961
2006-10-06 05:40:05 +00:00
Chris Lattner
d3e9895b9a Initial support for semantic analysis and AST building for StringExpr nodes.
llvm-svn: 38960
2006-10-06 05:22:26 +00:00
Chris Lattner
19acaadc2b more notes
llvm-svn: 38959
2006-10-06 05:20:10 +00:00
Chris Lattner
e1f4e21756 mention clang
llvm-svn: 38958
2006-10-06 04:16:41 +00:00
Chris Lattner
940edd4cff Move clang driver into Driver subdir
llvm-svn: 38957
2006-10-06 04:16:30 +00:00
Chris Lattner
50f4f07ce5 move driver to new subdir
llvm-svn: 38956
2006-10-06 04:15:14 +00:00
Chris Lattner
a81fb94997 build in a new dir
llvm-svn: 38955
2006-10-06 04:15:06 +00:00
Chris Lattner
87d229a3ce Significant extensions, write intro
llvm-svn: 38954
2006-10-06 04:10:25 +00:00
Chris Lattner
8f46a38503 new testcase
llvm-svn: 38953
2006-10-06 02:59:40 +00:00
Chris Lattner
051df7bfc4 Make this work with llvm cvs
llvm-svn: 38952
2006-08-27 07:12:21 +00:00
Chris Lattner
26da7302ce Build AST's for sizeof/alignof with type operands.
llvm-svn: 38951
2006-08-24 06:49:19 +00:00
Chris Lattner
e550a4ea12 Build CastExpr AST nodes
llvm-svn: 38950
2006-08-24 06:37:51 +00:00
Chris Lattner
26115acb1c Build AST's for sizeof/alignof an expr.
llvm-svn: 38949
2006-08-24 06:10:04 +00:00
Chris Lattner
6f3a117f81 switch MemberExpr to holding a field decl instead of a raw identifier.
llvm-svn: 38948
2006-08-24 05:19:28 +00:00
Chris Lattner
98286a4551 Allow expression actions to fail
llvm-svn: 38947
2006-08-24 05:02:11 +00:00
Chris Lattner
e1598f0184 Move the ExprResult struct from the Parser to the Actions.
llvm-svn: 38946
2006-08-24 04:56:36 +00:00
Chris Lattner
0eedafed1d more comments.
llvm-svn: 38945
2006-08-24 04:56:27 +00:00
Chris Lattner
879b9ad083 Add initial support for simple-primary exprs, including DeclExprs.
llvm-svn: 38944
2006-08-24 04:53:44 +00:00
Chris Lattner
e165d944c2 Add AST nodes for array, call, . and ->.
llvm-svn: 38943
2006-08-24 04:40:38 +00:00
Chris Lattner
6d28d9b428 Invoke actions for postfix exprs
llvm-svn: 38942
2006-08-24 03:51:22 +00:00
Chris Lattner
de648186eb Add actions for postfix exprs
llvm-svn: 38941
2006-08-24 03:51:14 +00:00
Chris Lattner
1b92649857 Add AST nodes and actions for paren exprs and simple unary ops.
llvm-svn: 38940
2006-08-23 06:42:10 +00:00
Chris Lattner
9b6d4cb90e Add (basic) expression AST representation capabilities for int/fp/binops/condexpr.
Add callbacks for same.
Add "full locinfo" mode.

llvm-svn: 38939
2006-08-23 05:17:46 +00:00
Chris Lattner
c11438cee1 Implement first cut of ASTBuilder class.
llvm-svn: 38938
2006-08-18 05:17:52 +00:00
Chris Lattner
01b0f1be80 xcode 2.4
llvm-svn: 38937
2006-08-18 03:44:41 +00:00
Chris Lattner
38ba3363ef Hook up more of the ASTStreamer
llvm-svn: 38936
2006-08-17 07:04:37 +00:00
Chris Lattner
73709eda2b Stub out the ASTStreamer
llvm-svn: 38935
2006-08-17 06:28:25 +00:00
Chris Lattner
769044337a add ast library
llvm-svn: 38934
2006-08-17 05:55:28 +00:00
Chris Lattner
3e7bd4ed44 Start adding support for printing out parser callbacks and adding ast building
llvm-svn: 38933
2006-08-17 05:51:27 +00:00
Chris Lattner
eb401b1bc7 updates
llvm-svn: 38932
2006-08-17 05:20:50 +00:00
Chris Lattner
d0745a08b6 New file
llvm-svn: 38931
2006-08-17 05:18:35 +00:00
Chris Lattner
3242dfdd55 move to AST
llvm-svn: 38930
2006-08-17 05:18:27 +00:00
Chris Lattner
0116c478e6 Implement asm statement parsing.
llvm-svn: 38929
2006-08-15 06:03:28 +00:00
Chris Lattner
5646b3e21c Fix test/Parser/types.c
llvm-svn: 38928
2006-08-15 05:12:01 +00:00
Chris Lattner
3ca67ba67f new testcase
llvm-svn: 38927
2006-08-15 05:11:49 +00:00
Chris Lattner
04f8019616 Make MatchRHSPunctuation smarter, allowing its clients to be simpler.
llvm-svn: 38926
2006-08-15 04:55:54 +00:00
Chris Lattner
e37e2336b4 Parse attributes in all places allowed.
llvm-svn: 38925
2006-08-15 04:50:22 +00:00
Chris Lattner
b8cd5c2260 Parse (and ignore) attributes on global decls.
llvm-svn: 38924
2006-08-15 04:10:46 +00:00
Chris Lattner
15a00da679 Allow ExpectAndConsume to be used with any token.
llvm-svn: 38923
2006-08-15 04:10:31 +00:00
Chris Lattner
6d7e634399 Parse asm specifiers on init declarators. Add __builtin_va_list to the
symbol table at startup time.

llvm-svn: 38922
2006-08-15 03:41:14 +00:00
Chris Lattner
8a3e918e33 Correctly implement the check for a typedef name
llvm-svn: 38921
2006-08-14 15:44:00 +00:00
Chris Lattner
0fb8b36808 "enum x" really is a type specifier
llvm-svn: 38920
2006-08-14 01:30:12 +00:00
Chris Lattner
ffe65b3ffd Implement scope tracking for empty-action.
llvm-svn: 38919
2006-08-14 01:28:29 +00:00
Chris Lattner
68ca25f8a9 Add accessor for the DeclSpec object.
llvm-svn: 38918
2006-08-14 00:57:25 +00:00
Chris Lattner
9a9d7ec822 Add accessors for scope info.
llvm-svn: 38917
2006-08-14 00:57:12 +00:00
Chris Lattner
bd78161d95 Add DeclTy typedef.
llvm-svn: 38916
2006-08-14 00:57:06 +00:00
Chris Lattner
3b4fdda3d8 Fix the last remaining FIXME's in the parser by asking the actions module
whether or not an identifier is a typedef name.

llvm-svn: 38915
2006-08-14 00:45:39 +00:00
Chris Lattner
a5534f96dc Stub out the EmptyAction class.
llvm-svn: 38914
2006-08-14 00:38:06 +00:00
Chris Lattner
685ed1e9ee Rename Parse/ParserActions.h -> Parse/Action.h
llvm-svn: 38913
2006-08-14 00:22:04 +00:00
Chris Lattner
4bb61de36c Remove Actions.cpp, it is and always will be empty.
llvm-svn: 38912
2006-08-14 00:15:57 +00:00
Chris Lattner
c1a8937d8f Make ParseTranslationUnit prime the lexer lookahead
llvm-svn: 38911
2006-08-14 00:15:40 +00:00
Chris Lattner
f0f3baa12e Inform actions about parsed declarators.
llvm-svn: 38910
2006-08-14 00:15:20 +00:00
Chris Lattner
e4e38595b0 Add methods for scope manipulation.
llvm-svn: 38909
2006-08-14 00:15:05 +00:00
Chris Lattner
78b917603c Add some methods, add significant documentation.
llvm-svn: 38908
2006-08-14 00:14:19 +00:00
Chris Lattner
8c88b5a981 add accessor method for parent.
llvm-svn: 38907
2006-08-14 00:13:44 +00:00
Chris Lattner
f96a166300 clean up
llvm-svn: 38906
2006-08-14 00:13:31 +00:00
Chris Lattner
203ed032e2 Count the number of diagnostics emitted.
llvm-svn: 38905
2006-08-13 22:25:42 +00:00
Chris Lattner
b8bbad7fd1 Set TypeSpecType on 'struct x' with no body.
llvm-svn: 38904
2006-08-13 22:21:02 +00:00
Chris Lattner
da72c82e8e Recognize struct/union/enum as TypeSpecType's
llvm-svn: 38903
2006-08-13 22:16:42 +00:00
Chris Lattner
476c3adb69 implement the GNU case-range extension. Add todo's for other missing gnu extensions.
llvm-svn: 38902
2006-08-13 22:09:58 +00:00
Chris Lattner
e7dab44cab improve comment.
llvm-svn: 38901
2006-08-13 21:54:51 +00:00
Chris Lattner
8693a519d4 Implement initializer parsering.
llvm-svn: 38900
2006-08-13 21:54:02 +00:00
Chris Lattner
7bddb3fc61 add bare struct tag decls.
llvm-svn: 38899
2006-08-13 19:59:13 +00:00
Chris Lattner
0e89462b08 Parse things like 'struct X;'
llvm-svn: 38898
2006-08-13 19:58:17 +00:00
Chris Lattner
1890ac8b03 Parse struct/union specifiers.
llvm-svn: 38897
2006-08-13 01:16:23 +00:00
Chris Lattner
3b561a3b39 Implement parsing of enum-specifiers.
llvm-svn: 38896
2006-08-13 00:12:11 +00:00
Chris Lattner
0be454e182 Use ExpectAndConsume more
llvm-svn: 38895
2006-08-12 19:30:51 +00:00
Chris Lattner
dbb2a46915 Add a new ExpectAndConsume method to make parsing easier, and add a new
ConsumeAnyToken method.

llvm-svn: 38894
2006-08-12 19:26:13 +00:00
Chris Lattner
1112435558 Parse the GNU builtin expressions. This implements Parser/expressions.c:test_offsetof
llvm-svn: 38893
2006-08-12 19:16:08 +00:00
Chris Lattner
5b6032ab3c new offsetof testcase
llvm-svn: 38892
2006-08-12 19:15:40 +00:00
Chris Lattner
3ba544ef0a add notes
llvm-svn: 38891
2006-08-12 18:43:54 +00:00
Chris Lattner
6259172911 Implement parsing of array declarators like:
int Array[*(int*)P+A];

llvm-svn: 38890
2006-08-12 18:40:58 +00:00
Chris Lattner
3b51ddf438 new testcase
llvm-svn: 38889
2006-08-12 18:40:31 +00:00
Chris Lattner
9fab3b9486 Implement parsing of 'int A[X];' by tying into the expression parsing code.
Turn a bunch of fixme's into todo's.

llvm-svn: 38888
2006-08-12 18:25:42 +00:00
Chris Lattner
0c6c034c48 Two fixes:
1. Allow argument list of a call to be empty.
2. Handle expressions in a statement context that start with an identifier.
   These are nasty to handle due to the 'label:' production which requires
   having two tokens of look-ahead, or by having tricky code (which we
   choose to do).

llvm-svn: 38887
2006-08-12 18:12:45 +00:00
Chris Lattner
2c5c421203 add test4
llvm-svn: 38886
2006-08-12 18:11:24 +00:00
Chris Lattner
20c6a45a3c Split postfix-expression suffix handling out into ParsePostfixExpressionSuffix
for future use.

llvm-svn: 38885
2006-08-12 17:40:43 +00:00
Chris Lattner
ce7e21da7a Implement ParseAssignmentExpression correctly
llvm-svn: 38884
2006-08-12 17:22:40 +00:00
Chris Lattner
3af6b8b9dc remove bogus fixme
llvm-svn: 38883
2006-08-12 17:21:27 +00:00
Chris Lattner
e66218bf49 Split the expression tests out of statements.c into expressions.c
llvm-svn: 38882
2006-08-12 17:19:28 +00:00
Chris Lattner
89d53752f5 Fix parsing of assignment expressions and handling of right-associative
things.

llvm-svn: 38881
2006-08-12 17:18:19 +00:00
Chris Lattner
96c3deb53d Simplify handling of the ternary operator even more. Now it just looks like
any average right-associative operator to most of the code.

llvm-svn: 38880
2006-08-12 17:13:08 +00:00
Chris Lattner
d35c34f44d Fix incorrect parsing of the ?: middle term, which is supposed to be
parsed as 'expression'.  This implements test/Parser/statements.c

llvm-svn: 38879
2006-08-12 17:04:50 +00:00
Chris Lattner
eb17652f5f Check that ?: parses its RHS as 'expression'.
llvm-svn: 38878
2006-08-12 17:04:23 +00:00
Chris Lattner
a0927cecb5 Improve diagnostics on cases like:
return a ? `  a;

After the expression is diagnosed, skip to the ';', so that the lack of
semicolon is not also diagnosed.

llvm-svn: 38877
2006-08-12 16:59:03 +00:00
Chris Lattner
6c3f05d1d2 Diagnose use of compound literals in C90 code
llvm-svn: 38876
2006-08-12 16:54:25 +00:00
Chris Lattner
b7f1fc95d3 cleanups, better comments.
llvm-svn: 38875
2006-08-12 16:45:01 +00:00
Chris Lattner
cde626ae9b Implement a first cut at binary expression parsing using a simple operator
precedence-based parser.

llvm-svn: 38874
2006-08-12 08:13:25 +00:00
Chris Lattner
89c50c65af Return information about whether expression parsing was successful
llvm-svn: 38873
2006-08-11 06:41:18 +00:00
Chris Lattner
5bd57e0c73 Significant improvements to error recovery
llvm-svn: 38872
2006-08-11 06:40:25 +00:00
Chris Lattner
81b576ee0d Merge ParsePostfixExpression into ParseCastExpression. This allows us to
implement support for compound literals followed by postfix-expr suffixes,
such as:
(struct{ int a;}){ 1}.a

llvm-svn: 38871
2006-08-11 02:13:20 +00:00
Chris Lattner
3401781548 Add another testcase
llvm-svn: 38870
2006-08-11 02:12:35 +00:00
Chris Lattner
eaf06598ea Merge ParseUnaryExpression and ParseCastExpression.
llvm-svn: 38869
2006-08-11 02:02:23 +00:00
Chris Lattner
a092cd1f1b Implement parsing of casts, implementing Parser/statements.c:test6
llvm-svn: 38868
2006-08-11 01:38:28 +00:00
Chris Lattner
eddbcb2b12 Add sizeof/cast/compound_expr tests.
llvm-svn: 38867
2006-08-11 01:38:08 +00:00
Chris Lattner
4add4e6c12 Simplify paren parsing, finish parsing of sizeof expressions and other cases.
llvm-svn: 38866
2006-08-11 01:33:00 +00:00
Chris Lattner
f5fbd7963d Implement type-name parsing, and simple compound initializer parsing.
llvm-svn: 38865
2006-08-10 23:56:11 +00:00
Chris Lattner
4564bc1123 Factor some code into the new Parser::MatchRHSPunctuation method.
llvm-svn: 38864
2006-08-10 23:14:52 +00:00
Chris Lattner
b33dd875fe add note
llvm-svn: 38863
2006-08-10 23:01:28 +00:00
Chris Lattner
c2dd85ac9e Implement most of unary-expression parsing.
llvm-svn: 38862
2006-08-10 22:57:16 +00:00
Chris Lattner
f833977a8a implement postfix-expression parsing.
llvm-svn: 38861
2006-08-10 22:01:51 +00:00
Chris Lattner
52a99e5cee Parse primary expressions, handle string concatenation
llvm-svn: 38860
2006-08-10 20:56:00 +00:00
Chris Lattner
36a48b10be add notes
llvm-svn: 38859
2006-08-10 20:00:01 +00:00
Chris Lattner
c5e0d4a6ae stub out some entry points for the expr parsing code.
llvm-svn: 38858
2006-08-10 19:06:03 +00:00
Chris Lattner
ee2cdfdd2d Move files around
llvm-svn: 38857
2006-08-10 19:05:43 +00:00
Chris Lattner
2b18b7faa7 Add some notes
llvm-svn: 38856
2006-08-10 18:48:21 +00:00
Chris Lattner
eb8a28f7b7 Rename some files
llvm-svn: 38855
2006-08-10 18:43:39 +00:00
Chris Lattner
2f9980ef14 Implement Parser/statements.c:test5: parsing decls that start with identifiers
in blocks.

llvm-svn: 38854
2006-08-10 18:39:24 +00:00
Chris Lattner
6dfd97806e Add support for simple labels.
llvm-svn: 38853
2006-08-10 18:31:37 +00:00
Chris Lattner
f8afb62ef9 Add support for parsing declarations in blocks. This implements
Parser/statements.c:test4

llvm-svn: 38852
2006-08-10 18:26:31 +00:00
Chris Lattner
d2685cf6bb Parse case/default labeled-statements.
llvm-svn: 38851
2006-08-10 05:59:48 +00:00
Chris Lattner
97353f2327 add test3
llvm-svn: 38850
2006-08-10 05:59:30 +00:00
Chris Lattner
503fadc90f Parse jump-statement: goto, continue, break, return.
llvm-svn: 38849
2006-08-10 05:45:44 +00:00
Chris Lattner
ab180365ac Add a warning
llvm-svn: 38848
2006-08-10 05:22:36 +00:00
Chris Lattner
53361ac130 Refactor init-declarator-list parsing code to allow for-statements to have
initializers in them.

llvm-svn: 38847
2006-08-10 05:19:57 +00:00
Chris Lattner
9075bd7727 implement switch/while/do/for statement parsing, implementing Parser/statements.c:test2
llvm-svn: 38846
2006-08-10 04:59:57 +00:00
Chris Lattner
905caf37a0 add test2
llvm-svn: 38845
2006-08-10 04:59:23 +00:00
Chris Lattner
c951dae2a4 Parse if statements
llvm-svn: 38844
2006-08-10 04:23:57 +00:00
Chris Lattner
4dfe4b9da1 new testcase
llvm-svn: 38843
2006-08-09 05:47:56 +00:00
Chris Lattner
0ccd51ebe2 Start parsing statements and function bodies. This implements
Parser/statements.c:test1.

llvm-svn: 38842
2006-08-09 05:47:47 +00:00
Chris Lattner
fff824fe14 Simplify and fill out parsing of function bodies.
llvm-svn: 38841
2006-08-07 06:31:38 +00:00
Chris Lattner
2534b877b4 add some accessor methods.
llvm-svn: 38840
2006-08-07 05:50:47 +00:00
Chris Lattner
bf320c84a5 better comments, infrastructure for parsing function bodies.
llvm-svn: 38839
2006-08-07 05:05:30 +00:00
Chris Lattner
d5d0a6c2b5 Capture function information, provide a place to validate Declarator information.
llvm-svn: 38838
2006-08-07 00:58:14 +00:00
Chris Lattner
a350722189 comment cleanup
llvm-svn: 38837
2006-08-07 00:33:37 +00:00
Chris Lattner
6c7416c382 Start capturing pointer and array declarator info.
llvm-svn: 38836
2006-08-07 00:19:33 +00:00
Chris Lattner
14776b9501 Implement some more error recovery
llvm-svn: 38835
2006-08-06 22:27:40 +00:00
Chris Lattner
0ef405cdb9 MAke the default be to stop at ;'s
llvm-svn: 38834
2006-08-06 22:00:57 +00:00
Chris Lattner
eec40f9990 Start implementing error recovery, this implements test/Parser/recovery-1.c
llvm-svn: 38833
2006-08-06 21:55:29 +00:00
Chris Lattner
944bde95ef new testcase
llvm-svn: 38832
2006-08-06 21:55:13 +00:00
Chris Lattner
1906f8087d Improve handling of [*]
llvm-svn: 38831
2006-08-06 19:14:46 +00:00
Chris Lattner
8a39edc931 Warn for c99-specific array use
llvm-svn: 38830
2006-08-06 18:33:32 +00:00
Chris Lattner
cc211add25 Make this testcase pass the right arg.
llvm-svn: 38829
2006-08-06 18:31:20 +00:00
Chris Lattner
e8074e65dd Parse array declarators, tested by Parser/declarators.c
llvm-svn: 38828
2006-08-06 18:30:15 +00:00
Chris Lattner
eecc5b53ae Add a -fsyntax-only argument
llvm-svn: 38827
2006-08-06 18:29:56 +00:00
Chris Lattner
c697e028c6 Run tests in a specific order
llvm-svn: 38826
2006-08-06 18:29:35 +00:00
Chris Lattner
df89dd42d7 new testcase
llvm-svn: 38825
2006-08-06 18:22:00 +00:00
Chris Lattner
acd58a3c33 Parse parenthesized and function declarators now, allowing us to parse things
like: "void (*signal(int, void (*)(int)))(int);"

llvm-svn: 38824
2006-08-06 17:24:14 +00:00
Chris Lattner
15356a7065 Start capturing declarator information in a new Declarator object.
llvm-svn: 38823
2006-08-06 00:02:28 +00:00
Chris Lattner
2df305abfa New file
llvm-svn: 38822
2006-08-05 23:08:14 +00:00
Chris Lattner
971c6b681a Add scaffolding for scopes.
llvm-svn: 38821
2006-08-05 22:46:42 +00:00
Chris Lattner
2d4f2c3ebe Update comment
llvm-svn: 38820
2006-08-05 22:09:17 +00:00
Chris Lattner
d286488c5f Make error recovery "better"
llvm-svn: 38819
2006-08-05 08:09:44 +00:00
Chris Lattner
d9c3c59fc0 Continue work on declspecs and declarations
llvm-svn: 38818
2006-08-05 06:26:47 +00:00
Chris Lattner
8e90ef6ccc add some notes
llvm-svn: 38817
2006-08-05 03:30:45 +00:00
Chris Lattner
f63f89acc2 Handle __thread and storage-class-specifiers
llvm-svn: 38816
2006-08-05 03:28:50 +00:00
Chris Lattner
fe533e3ecd make error message more useful
llvm-svn: 38815
2006-08-05 02:54:06 +00:00
Chris Lattner
158ede8e44 Add a citation
llvm-svn: 38814
2006-08-04 06:42:38 +00:00
Chris Lattner
1ae23294fb C99 requires at least one type specifier.
llvm-svn: 38813
2006-08-04 06:42:31 +00:00
Chris Lattner
fef9d2bba7 Diagnose specifiers with invalid _Complex/_Imaginary components.
llvm-svn: 38812
2006-08-04 06:36:52 +00:00
Chris Lattner
839713c085 Emit diagnostics for things like 'signed _Bool' and 'short float'
llvm-svn: 38811
2006-08-04 06:15:52 +00:00
Chris Lattner
494f27a0b8 Enable _Bool as an extension in C++
llvm-svn: 38810
2006-08-04 06:12:13 +00:00
Chris Lattner
6d998556de Fix precedence problem
llvm-svn: 38809
2006-08-04 06:11:48 +00:00
Chris Lattner
deb42f5a96 Add some missing assignments.
llvm-svn: 38808
2006-08-04 05:26:52 +00:00
Chris Lattner
da48a8e66b Parse and validate cvr type-qualifiers
llvm-svn: 38807
2006-08-04 05:25:55 +00:00
Chris Lattner
22dc378630 Split LangOptions out into its own header
llvm-svn: 38806
2006-08-04 04:44:06 +00:00
Chris Lattner
b9093cd1d0 Add an initial cut at a datastructure for holding declspec's.
llvm-svn: 38805
2006-08-04 04:39:53 +00:00
Chris Lattner
c0acd3d621 Split declaration parsing out into Declarations.cpp
llvm-svn: 38804
2006-07-31 05:13:43 +00:00
Chris Lattner
70f32b7d68 Add initial very-incomplete support for parsing declarations. We just manage
to be able to parse "int x;" now.

llvm-svn: 38803
2006-07-31 05:09:04 +00:00
Chris Lattner
0bb5f835e4 initial support for parsing, right now just ;'s at the top level, but this
adds most simple scaffolding.

llvm-svn: 38802
2006-07-31 01:59:18 +00:00
Chris Lattner
34dfaee634 Misc cleanups
llvm-svn: 38801
2006-07-31 01:57:54 +00:00
Chris Lattner
95a06b34f7 Simplify implementation of varargs macros by adding the __VA_ARGS__ token
to the formal argument list of a C99 varargs macro.

llvm-svn: 38800
2006-07-30 08:40:43 +00:00
Chris Lattner
b10969b9b2 new testcase
llvm-svn: 38799
2006-07-30 07:33:49 +00:00
Chris Lattner
022b62e941 new testcase
llvm-svn: 38798
2006-07-30 07:20:09 +00:00
Chris Lattner
a5722f5a56 add a note
llvm-svn: 38797
2006-07-29 17:59:42 +00:00
Chris Lattner
4beb0381ed Trigraphs are not enabled in -fpreprocessed mode.
llvm-svn: 38796
2006-07-29 17:50:10 +00:00
Chris Lattner
273ddd5c57 The optimized case has to treat __VA_ARGS__ as an argument. This fixes
test/Preprocessor/macro_rescan_varargs.c

llvm-svn: 38795
2006-07-29 07:33:01 +00:00
Chris Lattner
8d31b5d1aa new testcase
llvm-svn: 38794
2006-07-29 07:32:40 +00:00
Chris Lattner
07560ed0cf Fix precedence bug
llvm-svn: 38793
2006-07-29 07:26:48 +00:00
Chris Lattner
2641bd549c new testcase
llvm-svn: 38792
2006-07-29 07:19:41 +00:00
Chris Lattner
f76e62ecad Implement support for #__VA_ARGS__
llvm-svn: 38791
2006-07-29 07:14:41 +00:00
Chris Lattner
5b123fde96 new testcase
llvm-svn: 38790
2006-07-29 07:08:39 +00:00
Chris Lattner
b631d7ce6c new testcase
llvm-svn: 38789
2006-07-29 06:59:47 +00:00
Chris Lattner
232daf6834 testcase from the c99 standard
llvm-svn: 38788
2006-07-29 06:48:55 +00:00
Chris Lattner
d97d2e780c Fix a crash on Preprocessor/macro_paste_none.c
llvm-svn: 38787
2006-07-29 06:44:29 +00:00
Chris Lattner
15d6b28f09 new testcase
llvm-svn: 38786
2006-07-29 06:44:19 +00:00
Chris Lattner
f35d327a99 Testcases for comment saving modes, -C and -CC.
llvm-svn: 38785
2006-07-29 06:41:10 +00:00
Chris Lattner
cd028fc1f6 Fix -E mode to enter the main file *after* -E mode configures the preprocessor.
llvm-svn: 38784
2006-07-29 06:35:08 +00:00
Chris Lattner
457fc15bc5 Implement comment saving mode: the -C and -CC options.
llvm-svn: 38783
2006-07-29 06:30:25 +00:00
Chris Lattner
2be4115465 add another missing feature
llvm-svn: 38782
2006-07-29 06:29:39 +00:00
Chris Lattner
24691eee6c this item done
llvm-svn: 38781
2006-07-29 04:40:17 +00:00
Chris Lattner
775d832110 Implement the GNU comma swallowing extension. This implements
test/Preprocessor/macro_fn_comma_swallow.c

llvm-svn: 38780
2006-07-29 04:39:41 +00:00
Chris Lattner
d480b9c0ed new testcase for the GNU comma swallow extension.
llvm-svn: 38779
2006-07-29 04:39:12 +00:00
Chris Lattner
479b0af31d Improve placemarker handling, implementing Preprocessor/macro_fn_placemarker.c
llvm-svn: 38778
2006-07-29 04:16:20 +00:00
Chris Lattner
63081842a7 new testcase for placemarker handling.
llvm-svn: 38777
2006-07-29 04:09:49 +00:00
Chris Lattner
21c8b8f71e Implement support for __VA_ARGS__, allowing test/Preprocessor/macro_fn_varargs_iso.c
to pass.

llvm-svn: 38776
2006-07-29 04:04:22 +00:00
Chris Lattner
2bc48570b7 new testcase for __VA_ARGS__
llvm-svn: 38775
2006-07-29 04:03:59 +00:00
Chris Lattner
02f1f4f28b Fix a bug in previous commit
llvm-svn: 38774
2006-07-29 03:52:46 +00:00
Chris Lattner
6d9f8ed3b6 No need for explicit underscore anymore.
llvm-svn: 38773
2006-07-29 03:52:06 +00:00
Chris Lattner
f9771166ed add method to unpoison something for __VA_ARGS__.
llvm-svn: 38772
2006-07-29 03:47:18 +00:00
Chris Lattner
3ce273025e Remove __VA_ARGS__ "keyword".
llvm-svn: 38771
2006-07-29 03:47:08 +00:00
Chris Lattner
7e37483f14 Poison and unpoison __VA_ARGS__ when appropriate
llvm-svn: 38770
2006-07-29 03:46:57 +00:00
Chris Lattner
e7a5130dff If the varargs token is missing, add an empty argument to represent it. This
fixes Preprocessor/macro_fn_varargs_named.c

llvm-svn: 38769
2006-07-29 01:25:12 +00:00
Chris Lattner
f30dcbe07e new testcase
llvm-svn: 38768
2006-07-29 01:24:46 +00:00
Chris Lattner
331ad778b0 Implement paste avoidance, implementing Preprocessor/output_paste_avoid.c
llvm-svn: 38767
2006-07-28 06:56:01 +00:00
Chris Lattner
3961e60991 Tweak expected results do to paste avoidance.
llvm-svn: 38766
2006-07-28 06:55:35 +00:00
Chris Lattner
341c9a1615 new testcase for paste avoidance
llvm-svn: 38765
2006-07-28 06:54:07 +00:00
Chris Lattner
24fad1a82f update notes. Function-style macros are largely done.
llvm-svn: 38764
2006-07-28 05:25:01 +00:00
Chris Lattner
b1d2594456 Add test for pasting empty formals
llvm-svn: 38763
2006-07-28 05:13:36 +00:00
Chris Lattner
f3f1c709cf Use a continue to avoid indentation of a bunch of code
llvm-svn: 38762
2006-07-28 05:10:36 +00:00
Chris Lattner
a9dc597fca Implement pasting of arguments that expand to no tokens. This handles the
C99 "placemarker" concept.

llvm-svn: 38761
2006-07-28 05:07:04 +00:00
Chris Lattner
6e4bf523e6 Implement C99 6.10.3.4p2, testcase here: Preprocessor/macro_disable3.c.
llvm-svn: 38760
2006-07-27 06:59:25 +00:00
Chris Lattner
fdc0abe619 new testcase
llvm-svn: 38759
2006-07-27 06:17:55 +00:00
Chris Lattner
b57aa46e41 Switch ExpandFunctionArguments to use a smallvector instead of a vector,
speeding up my macro expansion torture test from .75s to .5s (33%!)

llvm-svn: 38758
2006-07-27 03:42:15 +00:00
Chris Lattner
7a4af3b73d Change Preprocessor::ReadFunctionLikeMacroArgs to use a SmallVector to lex
argument tokens into instead of a real vector.  This avoids some malloc
traffic in common cases.  In an "abusive macro expansion" testcase, this
reduced -Eonly time by 25%.

llvm-svn: 38757
2006-07-26 06:26:52 +00:00
Chris Lattner
c1410dc1e6 Change MacroArgs to allocate space for the unexpanded tokens immediately after
the MacroArgs object itself.  This is a bit more efficient and will be even more
so shortly.

llvm-svn: 38756
2006-07-26 05:22:49 +00:00
Chris Lattner
6fc08bc77d Add a new getArgLength method and refactor some code to use it
llvm-svn: 38755
2006-07-26 04:55:32 +00:00
Chris Lattner
7021657a0f Implement a FIXME: don't copy token array into a token vector, instead, macroexpander should expand from an array directly.
llvm-svn: 38754
2006-07-26 03:50:40 +00:00
Chris Lattner
36b6e8134e speed up a brutal macro-expansion torture test by about 30% (1.5 -> 1.0s)
by turning vectors of vectors into a single vector, reducing pressure on
malloc.  This can still be improved.

llvm-svn: 38753
2006-07-21 06:38:30 +00:00
Chris Lattner
7fa8c889e2 Add a single-entry cache for macro instantation locations. This significantly
reduces the number of FileID's made and tracked.

llvm-svn: 38752
2006-07-20 06:48:52 +00:00
Chris Lattner
a5f4c882e2 disable malformed string/character errors when in raw mode. This fixes
test/Lexer/badstring_in_if0.c

llvm-svn: 38751
2006-07-20 06:08:47 +00:00
Chris Lattner
032e6170af new testcase
llvm-svn: 38750
2006-07-20 06:06:55 +00:00
Chris Lattner
5a78a02ea2 If an invalid string or character is read, return the invalid part as a tok::unknown token.
llvm-svn: 38749
2006-07-20 06:02:19 +00:00
Chris Lattner
08ba4c015f fix obvious bug that caused Preprocessor/macro_paste_bad.c to fail.
llvm-svn: 38748
2006-07-20 04:52:59 +00:00
Chris Lattner
510ab61fd3 Add optimization for identifier##identifier -> identifier, the most common case of token pasting.
llvm-svn: 38747
2006-07-20 04:47:30 +00:00
Chris Lattner
538d7f3c27 Simplify "raw lexing mode" even further. Now the preprocessor is only called
into when a hard error is found.  This simplifies logic and eliminates the need
for the preprocessor to know about raw mode.

llvm-svn: 38746
2006-07-20 04:31:52 +00:00
Chris Lattner
22549fe6a5 With recent simplifications, this check can be removed from a fastpath.
llvm-svn: 38745
2006-07-20 04:20:02 +00:00
Chris Lattner
0f1f50517b Simplify identifier lookup in raw mode, implementing Preprocessor/macro_fn_lparen_scan2.c.
llvm-svn: 38744
2006-07-20 04:16:23 +00:00
Chris Lattner
9100cff701 new testcase
llvm-svn: 38743
2006-07-19 08:13:21 +00:00
Chris Lattner
ae637cd2a9 new testcase from c99 rationale
llvm-svn: 38742
2006-07-19 08:04:22 +00:00
Chris Lattner
e11dd370ec new testcase
llvm-svn: 38741
2006-07-19 08:01:28 +00:00
Chris Lattner
4505e89d0f Make diagnostic message better
llvm-svn: 38740
2006-07-19 06:41:46 +00:00
Chris Lattner
85c0e4d780 new testcase
llvm-svn: 38739
2006-07-19 06:40:07 +00:00
Chris Lattner
b563379d78 Make this testcase more interesting, actually add a RUN line.
llvm-svn: 38738
2006-07-19 06:34:41 +00:00
Chris Lattner
a7e2e74cef Avoid testing / ## * in the lexer. This will cause an unhelpful error message
to be emitted from the lexer.  This fixes macro_paste_c_block_comment.c

llvm-svn: 38737
2006-07-19 06:32:35 +00:00
Chris Lattner
30a2fa14ae Move LexingRawMode handling of file EOF out of the preprocessor into the
lexer.  This makes more logical sense and also unbreaks the case when the
lexer hasn't been pushed onto the PP include stack.  This is the case when
pasting identifiers.  This patch implements macro_paste_bcpl_comment.c.

llvm-svn: 38736
2006-07-19 06:31:49 +00:00
Chris Lattner
ab30c0360d Make this testcase more interesting, actually add run lines :)
llvm-svn: 38735
2006-07-19 05:48:15 +00:00
Chris Lattner
e8dcfef324 Fix test/Preprocessor/macro_paste_spacing.c
llvm-svn: 38734
2006-07-19 05:45:55 +00:00
Chris Lattner
01ecf835c2 Implement basic token pasting (## operator). This implements
test/Preprocessor/macro_paste_simple.c and macro_paste_bad.c.  There are
several known bugs still.

llvm-svn: 38733
2006-07-19 05:42:48 +00:00
Chris Lattner
a0d9bf4e83 Fix message in assert to be more accurate.
llvm-svn: 38732
2006-07-19 05:42:09 +00:00
Chris Lattner
f918bf71ef update comment
llvm-svn: 38731
2006-07-19 05:01:18 +00:00
Chris Lattner
da63bcdc03 Simplify this by using a higher-level method.
llvm-svn: 38730
2006-07-19 04:36:03 +00:00
Chris Lattner
7e2e669080 Handle really simple expansion of ## formals. Do not handle the empty case
yet though.

llvm-svn: 38729
2006-07-19 03:51:26 +00:00
Chris Lattner
81500bc3ae cleanups, add some code for instrumenting stat
llvm-svn: 38728
2006-07-19 03:40:07 +00:00
Chris Lattner
c5cd2d6556 Add some notes
llvm-svn: 38727
2006-07-19 03:39:58 +00:00
Chris Lattner
2183a6e8f4 Make end-of-file handling much less recursive. This reduces the worst case
stack depth sampled by shark from ~34 to ~17 frames when preprocessing <iostream>.

llvm-svn: 38726
2006-07-18 06:36:12 +00:00
Chris Lattner
d945fc80d7 update
llvm-svn: 38725
2006-07-16 18:44:57 +00:00
Chris Lattner
7667d0d942 Implement support for lexing from a pre-constructed token stream.
Use this support to implement function-like macro argument preexpansion.

This implements test/Preprocessor/macro_fn_preexpand.c

llvm-svn: 38724
2006-07-16 18:16:58 +00:00
Chris Lattner
1e17abb2fd new testcase
llvm-svn: 38723
2006-07-16 18:15:05 +00:00
Chris Lattner
351050bcf5 Add a check that the physloc for a macro instantiation is not another macro.
llvm-svn: 38722
2006-07-16 18:05:08 +00:00
Chris Lattner
e1954ac1a3 Fix comment
llvm-svn: 38721
2006-07-15 23:40:13 +00:00
Chris Lattner
203b4568e2 Implement basic argument substitution. This implements
test/Preprocessor/macro_fn_disable_expand.c

llvm-svn: 38720
2006-07-15 21:07:40 +00:00
Chris Lattner
1b9f17bc6e new testcase
llvm-svn: 38719
2006-07-15 21:06:48 +00:00
Chris Lattner
7c58149107 Clarify assertion
llvm-svn: 38718
2006-07-15 07:56:31 +00:00
Chris Lattner
2ada5d3890 More changes from formals -> actuals.
llvm-svn: 38717
2006-07-15 07:51:24 +00:00
Chris Lattner
ee8760b21b Rename macroformalargs -> MacroArgs, as it represents the actual arguments,
not the formal arguments, to a macro.

llvm-svn: 38716
2006-07-15 07:42:55 +00:00
Chris Lattner
c653246bfb Eliminate the IdentifierInfo::IsMacroArg flag.
llvm-svn: 38715
2006-07-15 06:55:18 +00:00
Chris Lattner
6ae37dfba3 new testcase
llvm-svn: 38714
2006-07-15 06:53:24 +00:00
Chris Lattner
6016169cb8 The leading space flag of a stringized string matches that of the # operator.
llvm-svn: 38713
2006-07-15 06:48:02 +00:00
Chris Lattner
c783d1dff9 Implement the microsoft charize extension #@
llvm-svn: 38712
2006-07-15 06:11:25 +00:00
Chris Lattner
2b271db205 Lex the microsoft 'charize' extension.
llvm-svn: 38711
2006-07-15 05:41:09 +00:00
Chris Lattner
f2781509f9 Add a comment giving an example of the error
llvm-svn: 38710
2006-07-15 05:27:44 +00:00
Chris Lattner
0707bd3042 Implement stringification.
llvm-svn: 38709
2006-07-15 05:23:58 +00:00
Chris Lattner
ecc39e9325 Change Lexer::Stringify to not add ""'s around the string.
llvm-svn: 38708
2006-07-15 05:23:31 +00:00
Chris Lattner
b935d8cd90 Set up infrastructure for function-like macro expansion with preexpansion
stringizing, etc.

llvm-svn: 38707
2006-07-14 06:54:44 +00:00
Chris Lattner
b94ec7b668 Add an API so that external clients can create strings in the scratch buffer.
llvm-svn: 38706
2006-07-14 06:54:10 +00:00
Chris Lattner
12a8178393 add a note
llvm-svn: 38705
2006-07-14 05:26:56 +00:00
Chris Lattner
f69f835398 new testcase
llvm-svn: 38704
2006-07-11 05:53:01 +00:00
Chris Lattner
041bef8b32 The lexer should not warn about stray characters, it should just return
tok::unknown tokens.  This fixes test/Lexer/unknown-char.c

llvm-svn: 38703
2006-07-11 05:52:53 +00:00
Chris Lattner
678c880a69 Move Preprocessor::isNextPPTokenLParen to Lexer::isNextPPTokenLParen, where
it more rightly belongs.

llvm-svn: 38702
2006-07-11 05:46:12 +00:00
Chris Lattner
3ebcf4e2cd Change Preprocessor::SkippingContents into Lexer::LexingRawMode. Raw mode
is an intra-lexer property, not a inter-lexer property, so it makes sense
for it to be define here.  It also makes no sense for macros, and allows us
to define it more carefully in the header.

While I'm at it, improve comments and structuring in Lexer.h

llvm-svn: 38701
2006-07-11 05:39:23 +00:00
Chris Lattner
69f88b883d Fix a regression on Preprocessor/hash_space.c
llvm-svn: 38700
2006-07-11 05:07:29 +00:00
Chris Lattner
d8aee0e81b Implement "lparen scanning" for lexer buffers, by making "skipping lexing"
completely reversible.  This implements tests 3/4 of
test/Preprocessor/macro_fn_lparen_scan.c

llvm-svn: 38699
2006-07-11 05:04:55 +00:00
Chris Lattner
b63d9de243 new tests
llvm-svn: 38698
2006-07-11 05:03:43 +00:00
Chris Lattner
a12dd15b56 ext-warn on empty macro arguments if in pre-c99 mode
llvm-svn: 38697
2006-07-11 04:09:02 +00:00
Chris Lattner
370c135dce improve comment
llvm-svn: 38696
2006-07-11 04:03:32 +00:00
Chris Lattner
2acdac4200 Implement scanning-for-( more correctly. This implements
test/Preprocessor/macro_fn_lparen_scan.c, but is not yet complete.

llvm-svn: 38695
2006-07-11 04:02:48 +00:00
Chris Lattner
afe603fa7d Implement scanning-for-( more correctly. This implements
test/Preprocessor/macro_fn_lparen_scan.c, but is not yet complete.

Add some FIXME's about missing diagnostics on empty macro args.  Improve some
comments.

llvm-svn: 38694
2006-07-11 04:02:46 +00:00
Chris Lattner
53ede2a826 new testcase
llvm-svn: 38693
2006-07-11 04:00:23 +00:00
Chris Lattner
db878cde8e Add an interesting observation :)
llvm-svn: 38692
2006-07-10 06:34:50 +00:00
Chris Lattner
eb54b5973e Add simple optimization: check for (and skip) spaces and tabs immediately
before lexing a token.  This speeds the common case where tokens are
separated by small amount of whitespace.  This makes a slight but
reproducible positive effect lexing a preprocessed carbon.h.

llvm-svn: 38691
2006-07-10 06:34:27 +00:00
Chris Lattner
03f83485bd Only do an expensive walk over the entire identifier table if the diagnostic
that needs it is enabled.

llvm-svn: 38690
2006-07-10 06:16:26 +00:00
Chris Lattner
d0a96ba38a Add a simple but useful optimization for identifier lookup. Each time we
query the hash table, when we look up an identifier that isn't at the head
of it's bucket's list, move it there.  This reduces the number of list
traversals in the common case where identifiers are used in bursts.

llvm-svn: 38689
2006-07-10 06:10:51 +00:00
Chris Lattner
9e220173e6 add some notes about MS extensions
llvm-svn: 38688
2006-07-10 02:49:22 +00:00
Chris Lattner
3ce1d1aac9 Trivially expand macros like:
#define ENOMEMORYFORYOU ENOMEMORYFORYOU

llvm-svn: 38687
2006-07-09 01:00:18 +00:00
Chris Lattner
c239583433 Make trivial expansion detection more aggressive. Trivially expand macros
like:  #define IS_BLAH() 1

llvm-svn: 38686
2006-07-09 00:57:04 +00:00
Chris Lattner
7818605f83 Read, remember, and validate the arguments provided the a function-style
macro invocation.

llvm-svn: 38685
2006-07-09 00:45:31 +00:00
Chris Lattner
8eede3e6c0 Remove pointless comments.
llvm-svn: 38684
2006-07-08 23:24:05 +00:00
Chris Lattner
815a1f97f6 Diagnose C99 6.10.3.2p1
llvm-svn: 38683
2006-07-08 20:48:04 +00:00
Chris Lattner
6e0d42c6f8 Add identifiers for macro arguments to MacroInfo, check for duplicates,
enhance macro equality testing to verify argument lists match.

llvm-svn: 38682
2006-07-08 20:32:52 +00:00
Chris Lattner
cefc768f5b Start reading/validating the argument list for a function-like macro.
llvm-svn: 38681
2006-07-08 08:28:12 +00:00
Chris Lattner
21284dfdd1 Implement checking for macro equality, C99 6.10.3.2
llvm-svn: 38680
2006-07-08 07:16:08 +00:00
Chris Lattner
e8eef3207b add infrastructure for warning if redef'd macro bodies differ, but don't
fully implement it.

Fix warning on #define __LINE__ to warn about redefinition, not #undef.

llvm-svn: 38679
2006-07-08 07:01:00 +00:00
Chris Lattner
8ff7199e4b Warn about __VA_ARGS__ when used outside of a macro expansion
llvm-svn: 38678
2006-07-06 05:17:39 +00:00
Chris Lattner
bff18d5649 Diagnose erroneous macro definitions where a ## operator is at the start/end of the macro
llvm-svn: 38677
2006-07-06 04:49:18 +00:00
Chris Lattner
ae41157ee5 Implement support for arbitrarily mapping non-error diagnostics to be either
ignored, warned about, or error'd.  Use this to implement the -Wunused_macros
command line option.

llvm-svn: 38676
2006-07-05 00:55:08 +00:00
Chris Lattner
ecbf7b4bb0 add newline to end of file
llvm-svn: 38675
2006-07-05 00:08:00 +00:00
Chris Lattner
27746e476a Fix Preprocessor/macro_space.c, which failed because the ! token had
identifier info incorrectly set.

llvm-svn: 38674
2006-07-05 00:07:54 +00:00
Chris Lattner
67c3848e4e Cleanup some obsolete comments.
llvm-svn: 38673
2006-07-04 23:24:26 +00:00
Chris Lattner
d3a15f7f4e Add a fast-path in getSpelling for identifiers.
llvm-svn: 38672
2006-07-04 23:01:03 +00:00
Chris Lattner
ef9eae1c44 Change the Preprocessor::getSpelling interface to let it be zero-copy in
the common case.

llvm-svn: 38671
2006-07-04 22:33:12 +00:00
Chris Lattner
a3f827e0a6 add a comment explaining why this is written funny
llvm-svn: 38670
2006-07-04 22:22:45 +00:00
Chris Lattner
f46be6cb02 Switch to using unix "write" when available, instead of stdio. This speeds up
-E -P mode by 10% (i.e. takes away almost all i/o time).

llvm-svn: 38669
2006-07-04 22:19:33 +00:00
Chris Lattner
728b4dc26a improve comments
llvm-svn: 38668
2006-07-04 21:28:37 +00:00
Chris Lattner
ff3f5f4b77 fix compile error
llvm-svn: 38667
2006-07-04 21:25:59 +00:00
Chris Lattner
03cbe1fc02 Minor code cleanup
llvm-svn: 38666
2006-07-04 21:24:33 +00:00
Chris Lattner
3338ba87d5 Make -P mode faster and closer to GCC output by not emitting newlines at all.
This allows the SourceManager to not compute line number information for each buffer.

llvm-svn: 38665
2006-07-04 21:19:39 +00:00
Chris Lattner
d5da3ea58d This matters for -E.
llvm-svn: 38664
2006-07-04 21:11:41 +00:00
Chris Lattner
73b6a2f62d Match GCC behavior better in -P mode.
llvm-svn: 38663
2006-07-04 19:40:52 +00:00
Chris Lattner
3451f7da35 initial checkin of xcode project that I've been using for a while
llvm-svn: 38662
2006-07-04 19:30:23 +00:00
Chris Lattner
ecc6fc583f add a place for random notes.
llvm-svn: 38661
2006-07-04 19:29:50 +00:00
Chris Lattner
deb3701c23 Switch from using iostreams to using stdio for -E mode output. This speeds
up clang -E iostream by 30%.

llvm-svn: 38660
2006-07-04 19:24:06 +00:00
Chris Lattner
5de858cbdd minor cleanup
llvm-svn: 38659
2006-07-04 19:04:44 +00:00
Chris Lattner
09e3cdf9ef Split the -E mode printer out to a separate .cpp file.
llvm-svn: 38658
2006-07-04 19:04:05 +00:00
Chris Lattner
5f084fd5fc Add newline at end of file
llvm-svn: 38657
2006-07-04 19:03:36 +00:00
Chris Lattner
08e0035668 ignore cruft
llvm-svn: 38656
2006-07-04 19:03:05 +00:00
Chris Lattner
0e1cf1f588 Fix indentation
llvm-svn: 38655
2006-07-04 18:53:52 +00:00
Chris Lattner
b9d90f709e Detect expressions semantically equivalent to !defined(X) for the multiple-include
optimization.

llvm-svn: 38654
2006-07-04 18:32:03 +00:00
Chris Lattner
3153ed6bc4 This is implemented.
llvm-svn: 38653
2006-07-04 18:31:48 +00:00
Chris Lattner
e3519cc948 Change EvaluateValue/EvaluateDirectiveSubExpr to be static functions in
PPExpressions.cpp instead of methods.

llvm-svn: 38652
2006-07-04 18:11:39 +00:00
Chris Lattner
8096542744 refactor code a little, no functionality change
llvm-svn: 38651
2006-07-04 18:03:19 +00:00
Chris Lattner
c79f6fb108 Rename IdentifierTokenInfo -> IdentifierInfo.
llvm-svn: 38650
2006-07-04 17:53:21 +00:00
Chris Lattner
a8654ca2cf Eliminate MultipleIncludeOpt::ReadDirective and all calls to it. Any directives
that are lexed are made up of tokens, so the calls are just ugly and redundant.

Hook up the MIOpt for the #if case.  PPCExpressions doesn't currently implement
the hook though, so we still don't handle #if !defined(X) with the MIOpt.

llvm-svn: 38649
2006-07-04 17:42:08 +00:00
Chris Lattner
1f62777508 update
llvm-svn: 38648
2006-07-04 17:34:01 +00:00
Chris Lattner
3665f161ca Implement the multiple-include file optimization.
llvm-svn: 38647
2006-07-04 07:26:10 +00:00
Chris Lattner
371ac8a9b7 Implement the automaton for recognizing files with controlling macros.
llvm-svn: 38646
2006-07-04 07:11:10 +00:00
Chris Lattner
d7dfa57efd cleanup fixme's
llvm-svn: 38645
2006-07-04 04:50:35 +00:00
Chris Lattner
062a0d620b stub out built-in macros.
llvm-svn: 38644
2006-07-04 04:50:29 +00:00
Chris Lattner
01d66cc891 Implement #ident and #sccs
llvm-svn: 38643
2006-07-03 22:16:27 +00:00
Chris Lattner
3ae68307ac Print tokens using the logical location. This implements
test/Preprocessor/_Pragma-dependency.c

llvm-svn: 38642
2006-07-03 06:28:56 +00:00
Chris Lattner
1c9c0d0749 new testcase
llvm-svn: 38641
2006-07-03 06:28:30 +00:00
Chris Lattner
b085f937a0 The location of a _Pragma expanded token is the location of the string, not the
_Pragma token

llvm-svn: 38640
2006-07-03 06:10:36 +00:00
Chris Lattner
d7de629c32 Move a method inline
llvm-svn: 38639
2006-07-03 06:05:41 +00:00
Chris Lattner
a78a97e82f #ifdef X, #ifndef X, and #if defined(X) all mark X as used.
llvm-svn: 38638
2006-07-03 05:42:18 +00:00
Chris Lattner
bd07659488 Move a PragmaNamespace method out of line, add class comment for PragmaNamespace.
llvm-svn: 38637
2006-07-03 05:34:49 +00:00
Chris Lattner
2e1553070e Move a PragmaNamespace method out of line.
llvm-svn: 38636
2006-07-03 05:34:41 +00:00
Chris Lattner
83913dde23 remove dead var
llvm-svn: 38635
2006-07-03 05:31:31 +00:00
Chris Lattner
f88c53a02f Fix test/Preprocessor/_Pragma-syshdr2.c.
llvm-svn: 38634
2006-07-03 05:26:05 +00:00
Chris Lattner
45197e935c new testcase
llvm-svn: 38633
2006-07-03 05:25:52 +00:00
Chris Lattner
13044d942d Implement -Wunused-macros functionality.
llvm-svn: 38632
2006-07-03 05:16:44 +00:00
Chris Lattner
cbd6d3e0ed Implement -Wunused-macros functionality, currently always enabled.
llvm-svn: 38631
2006-07-03 05:16:39 +00:00
Chris Lattner
4ec473f871 Add support to track the real top-level file.
llvm-svn: 38630
2006-07-03 05:16:05 +00:00
Chris Lattner
040a4ab71e Compile without rtti or exceptions.
llvm-svn: 38629
2006-07-03 05:01:42 +00:00
Chris Lattner
91cbf11c10 Add a new IdentifierVisitor class and a new IdentifierTable::VisitIdentifiers
method to support iteration over all identifiers.

llvm-svn: 38628
2006-07-03 04:28:52 +00:00
Chris Lattner
44f8a66bcc Fix test/Preprocessor/macro_defined.c, factor some code.
llvm-svn: 38627
2006-07-03 01:27:27 +00:00
Chris Lattner
d94adee36d new testcase
llvm-svn: 38626
2006-07-03 01:26:39 +00:00
Chris Lattner
aaf09115c4 Implement a FIXME: reject '#define defined'.
llvm-svn: 38625
2006-07-03 01:17:59 +00:00
Chris Lattner
e3e81ea8aa Refactor some code into a new Lexer::Stringify method.
llvm-svn: 38624
2006-07-03 01:13:26 +00:00
Chris Lattner
d1236047a9 Correctly stringify emitted #line directives in -E mode.
llvm-svn: 38623
2006-07-03 01:12:52 +00:00
Chris Lattner
0766e592ce Implement a FIXME: correctly stringify filenames generated by __LINE__.
llvm-svn: 38622
2006-07-03 01:07:01 +00:00
Chris Lattner
4d5e1a72f4 Classify fixme's
llvm-svn: 38621
2006-07-03 01:01:29 +00:00
Chris Lattner
505c547b8e Cleanup fixme comments
llvm-svn: 38620
2006-07-03 00:55:48 +00:00
Chris Lattner
98a5312478 Give tokens expanded from _Pragma directives correct source locations.
This implements test/Preprocessor/_Pragma-location.c

llvm-svn: 38619
2006-07-02 23:00:20 +00:00
Chris Lattner
e55e11ad04 new testcase
llvm-svn: 38618
2006-07-02 22:59:48 +00:00
Chris Lattner
a37664b3fb Move a virtual method out-of-line
llvm-svn: 38617
2006-07-02 22:45:51 +00:00
Chris Lattner
b694ba7b40 Move some Pragma-related methods from Preprocessor.cpp to Pragma.cpp
llvm-svn: 38616
2006-07-02 22:41:36 +00:00
Chris Lattner
1840e491dc Remove Lexer::BufferStart, an unneeded instance var.
llvm-svn: 38615
2006-07-02 22:30:01 +00:00
Chris Lattner
8bbfe46475 Fix Preprocessor/_Pragma-physloc.c, by making sure that the returned location
of the token is relative to the start of the buffer, not relative to the start
position of the lexer.

llvm-svn: 38614
2006-07-02 22:27:49 +00:00
Chris Lattner
20fc36c416 new testcase
llvm-svn: 38613
2006-07-02 22:27:09 +00:00
Chris Lattner
5599d5f6b8 Fix test/Preprocessor/pragma_unknown.c
llvm-svn: 38612
2006-07-02 21:50:38 +00:00
Chris Lattner
a7e7e2b92d new testcase
llvm-svn: 38611
2006-07-02 21:50:31 +00:00
Chris Lattner
e4af3ac6b4 Fix some minor issues with _Pragma
llvm-svn: 38610
2006-07-02 21:32:47 +00:00
Chris Lattner
ecfeafe3ba Fix some minor bugs handling _Pragma, including
test/Preprocessor/_Pragma_syshdr.c

llvm-svn: 38609
2006-07-02 21:26:45 +00:00
Chris Lattner
d6178a6870 new testcase
llvm-svn: 38608
2006-07-02 21:23:03 +00:00
Chris Lattner
ef0dbae5ab remove dead ivar
llvm-svn: 38607
2006-07-02 21:17:13 +00:00
Chris Lattner
69772b026e Implement the _Pragma-style of pragma handling, implementing
test/Preprocessor/_Pragma-poison.c.

This unifies the MacroStack and IncludeStack together into IncludeMacroStack.

llvm-svn: 38606
2006-07-02 20:34:39 +00:00
Chris Lattner
0acd4fee90 new testcase
llvm-svn: 38605
2006-07-02 20:31:44 +00:00
Chris Lattner
a85a9d2db3 Tolerate conditions where there is no line #
llvm-svn: 38604
2006-07-02 20:07:52 +00:00
Chris Lattner
4cca5ba7da Allow the buffer start/end positions to be optionally specified. Make sure
to use them instead of the current buffer start/end when computing diagnostics.

llvm-svn: 38603
2006-07-02 20:05:54 +00:00
Chris Lattner
847e0e4552 Implement __TIMESTAMP__
llvm-svn: 38602
2006-07-01 23:49:16 +00:00
Chris Lattner
c1283b90a0 Implement __INCLUDE_LEVEL__ and __BASE_FILE__
llvm-svn: 38601
2006-07-01 23:16:30 +00:00
Chris Lattner
630b33c39e Implement __FILE__
llvm-svn: 38600
2006-07-01 22:46:53 +00:00
Chris Lattner
4c37a8c353 Eliminate SourceManager::createFileIDForMacroExp, inlining it into its single use.
llvm-svn: 38599
2006-06-30 06:15:08 +00:00
Chris Lattner
7d1b0062d2 Use a new helper to do this much more simply.
llvm-svn: 38598
2006-06-30 06:14:45 +00:00
Chris Lattner
c673f905d8 Implement the __TIME__ and __DATE__ builtin macros.
llvm-svn: 38597
2006-06-30 06:10:41 +00:00
Chris Lattner
7d6a4f6746 Expose a useful helper method.
llvm-svn: 38596
2006-06-30 06:10:08 +00:00
Chris Lattner
098dfc5e7e Expose a new form of the getToken method.
llvm-svn: 38595
2006-06-30 06:09:36 +00:00
Chris Lattner
2dffd2b445 Factor logical line lookup better.
llvm-svn: 38594
2006-06-29 16:44:08 +00:00
Chris Lattner
f378f9a08f Fix the predicate to be more strict
llvm-svn: 38593
2006-06-29 16:43:46 +00:00
Chris Lattner
677e3a202c new testcase
llvm-svn: 38592
2006-06-29 16:25:13 +00:00
Chris Lattner
4fb517bea8 Give tokens from the scratch buffer correct source locations.
llvm-svn: 38591
2006-06-29 06:34:53 +00:00
Chris Lattner
dc9f9bf80e Due to generated tokens expanded by macros, there can be multiple MacroExpansion fileid's, loop over them until we get to something real.
llvm-svn: 38590
2006-06-29 06:33:42 +00:00
Chris Lattner
0b8cfc2e69 Implement the __LINE__ builtin macro.
llvm-svn: 38589
2006-06-28 06:49:17 +00:00
Chris Lattner
3690f1513a Initial implementation of the ScratchBuffer class.
llvm-svn: 38588
2006-06-28 06:48:36 +00:00
Chris Lattner
ec43eaf07a Add a new SourceBuffer::getNewMemBuffer method.
llvm-svn: 38587
2006-06-28 06:35:31 +00:00
Chris Lattner
677757a2c0 Remove dead variables.
Add initial support for builtin macros, including warning if they are defined or undefined.
Register __LINE__ as a builtin macro.

llvm-svn: 38586
2006-06-28 05:26:32 +00:00
Chris Lattner
274690ce76 Reindent comments.
llvm-svn: 38585
2006-06-28 05:25:35 +00:00
Chris Lattner
78d6734b34 Remove dead variable.
llvm-svn: 38584
2006-06-28 05:02:28 +00:00
Chris Lattner
f373a4af56 Refactor HandleIdentifier to pull macro expansion into its own method.
llvm-svn: 38583
2006-06-26 06:16:29 +00:00
Chris Lattner
e9a5e18e47 remove some obsolete comments
llvm-svn: 38582
2006-06-26 06:08:38 +00:00
Chris Lattner
f4449e5da3 Allow expansion to single token identifiers if they are not macros
llvm-svn: 38581
2006-06-26 04:55:25 +00:00
Chris Lattner
67b07cb6fe Implement Preprocessor/macro_expandloc.c by giving the optimized macro
expansion case a correct source location.

llvm-svn: 38580
2006-06-26 02:03:42 +00:00
Chris Lattner
f6fd68add5 Fix Preprocessor/macro_expandloc2.c
llvm-svn: 38579
2006-06-26 01:48:23 +00:00
Chris Lattner
236ed5200b Add a note
llvm-svn: 38578
2006-06-26 01:36:29 +00:00
Chris Lattner
685730f964 To not treat macro invocation locations as part of the include stack
when reporting a diagnostic.

llvm-svn: 38577
2006-06-26 01:36:22 +00:00
Chris Lattner
64f7bd0e6e New testcase
llvm-svn: 38576
2006-06-26 01:26:26 +00:00
Chris Lattner
0a401cca91 new testcase
llvm-svn: 38575
2006-06-26 01:25:11 +00:00
Chris Lattner
269c232e67 implement #pragma GCC dependency
llvm-svn: 38574
2006-06-25 06:23:00 +00:00
Chris Lattner
ba6df9122f Fix Preprocessor/poison_expansion.c
llvm-svn: 38573
2006-06-25 05:41:00 +00:00
Chris Lattner
36f0003d16 New testcases
llvm-svn: 38572
2006-06-25 05:40:49 +00:00
Chris Lattner
2a92f7ec2d Implement -P mode.
llvm-svn: 38571
2006-06-25 04:40:07 +00:00
Chris Lattner
5c683767ff Print out unknown pragmas in -E mode.
llvm-svn: 38570
2006-06-25 04:36:50 +00:00
Chris Lattner
55a60954f9 Implement #pragma GCC system_header
llvm-svn: 38569
2006-06-25 04:20:34 +00:00
Chris Lattner
1786217e0b Finish implementation of #pragma once. Implement #pragma GCC poison.
llvm-svn: 38568
2006-06-24 22:12:56 +00:00
Chris Lattner
d2b9b89b92 Remove some inadvertently commited stuff
llvm-svn: 38567
2006-06-24 21:33:04 +00:00
Chris Lattner
b876183219 implement the pragma handling infrastructure. The only pragma so far is
#pragma once, and it is not completely implemented.

llvm-svn: 38566
2006-06-24 21:31:03 +00:00
Chris Lattner
4da3a353b6 Fix off-by-two error printing diagnostics
llvm-svn: 38565
2006-06-24 21:29:50 +00:00
Chris Lattner
e60165fdb5 increase the performance of skipping (#if 0) by optimizing lookup of directive names.
llvm-svn: 38564
2006-06-22 06:36:29 +00:00
Chris Lattner
40931927af Speed up directive matching by not using getSpelling(), and not copying std::strings
around.

llvm-svn: 38563
2006-06-22 06:14:04 +00:00
Chris Lattner
c899718274 Track which headers are system and non-C++-clean-system headers. Use this
information to print the 3/4 flags correctly on #line directives emitted
in -E mode.

llvm-svn: 38562
2006-06-22 05:52:16 +00:00
Chris Lattner
0c885f5581 Improve #line emission in -E mode to include file entry/exits. This is
still pretty hacky because it doesn't compute the 3/4 markers correctly.

llvm-svn: 38561
2006-06-21 06:50:18 +00:00
Chris Lattner
9a13bde643 Implement a new SourceManager::getSourceName method
llvm-svn: 38560
2006-06-21 04:57:09 +00:00
Chris Lattner
d12ad77e40 Add really early support for emitting # line directives, and emitting the
right number of newlines between tokens when needed.  This reduces the
delta of the gcc -E output from 12198 differences to 6764.  It still needs
to emit filenames on #line directives, track filename switches, and track
entry/exit of include files.

llvm-svn: 38559
2006-06-21 03:49:01 +00:00
Chris Lattner
bb893c3d67 Update SourceManager::getLineNumber to return the correct line # for macro
instantiations.

llvm-svn: 38558
2006-06-21 03:27:29 +00:00
Chris Lattner
30709b038d Implement a new type of FileID: FileIDInfo::MacroExpansion. For tokens that
came from a macro expansion, this allows us to keep track of both where the
character data came from and where the logical position of the token is (at
the expansion site).  This implements Preprocessor/indent_macro.c, and
reduces the number of cpp iostream -E diffs vs GCC from 2589 to 2297.

llvm-svn: 38557
2006-06-21 03:01:55 +00:00
Chris Lattner
5f4b1ff9fd Modify SourceManager to make way for future macro locations and #line support
no functionality change yet

llvm-svn: 38556
2006-06-20 05:02:40 +00:00
Chris Lattner
c5a00067ac Simplify some code
llvm-svn: 38555
2006-06-18 16:41:01 +00:00
Chris Lattner
8bb4edb236 remove an extraneous method
llvm-svn: 38554
2006-06-18 16:37:30 +00:00
Chris Lattner
50b497e072 Rename LexerToken::getSourceLocation -> getLocation
llvm-svn: 38553
2006-06-18 16:32:35 +00:00
Chris Lattner
5b4876807a Move the LexerToken definition out to LexerToken.h
llvm-svn: 38552
2006-06-18 16:28:59 +00:00
Chris Lattner
d01e291332 Make a fundamental change to the way we represent the location of LexerToken's.
Now, instead of keeping a pointer to the start of the token in memory, we keep the
start of the token as a SourceLocation node.  This means that each LexerToken knows
the full include stack it was created with, and means that the LexerToken isn't
reliant on a "CurLexer" member to be around (lexer tokens would previously go out of
scope when their lexers were deallocated).

This simplifies several things, and forces good cleanup elsewhere.  Now the
Preprocessor is the one that knows how to dump tokens/macros and is the one that
knows how to get the spelling of a token (it has all the context).

llvm-svn: 38551
2006-06-18 16:22:51 +00:00
Chris Lattner
de0b7f6a31 Add a bunch more forward looking notes
llvm-svn: 38550
2006-06-18 14:03:39 +00:00
Chris Lattner
7e0dd2b11f Fix a fixme by passing language options into LexerToken::dump, instead of
relying on TheLexer.

llvm-svn: 38549
2006-06-18 07:44:41 +00:00
Chris Lattner
33ce7283ee Change the token representation to take a Start and Length instead of a
Start/End pointer.

llvm-svn: 38548
2006-06-18 07:35:33 +00:00
Chris Lattner
504f2ebb8b Add missing return
llvm-svn: 38547
2006-06-18 07:19:54 +00:00
Chris Lattner
6d45fe842e utility file
llvm-svn: 38546
2006-06-18 07:18:04 +00:00
Chris Lattner
4322e2201b new testcase
llvm-svn: 38545
2006-06-18 07:16:30 +00:00
Chris Lattner
1500881bd9 new testcase
llvm-svn: 38544
2006-06-18 07:00:07 +00:00
Chris Lattner
1f5830546a Make a method a static function
llvm-svn: 38543
2006-06-18 06:53:56 +00:00
Chris Lattner
e33e16cbaa -E output mostly implemented
llvm-svn: 38542
2006-06-18 06:53:45 +00:00
Chris Lattner
7966aafd9b Simplify an API
llvm-svn: 38541
2006-06-18 06:50:36 +00:00
Chris Lattner
cb28334ea4 Remove manual conditional error handling code.
llvm-svn: 38540
2006-06-18 06:48:37 +00:00
Chris Lattner
22eb972f38 Initial checkin of c-language parser
llvm-svn: 38539
2006-06-18 05:43:12 +00:00
Chris Lattner
31eef321bf Initial checkin of testsuite
llvm-svn: 38538
2006-06-18 05:42:02 +00:00
CVS to SVN Conversion
7555fcb87e New repository initialized by cvs2svn.
llvm-svn: 38537
2006-06-18 05:42:02 +00:00
Duncan Sands
d5ea194b6c If assertions are not enabled, we should return False here.
llvm-svn: 38535
2007-07-11 08:47:55 +00:00
Evan Cheng
74a541024f No longer need to track last def / use.
llvm-svn: 38534
2007-07-11 08:47:44 +00:00
Reid Spencer
147d7d9d7d Add a comment to indicate what this file is for.
llvm-svn: 38533
2007-07-11 08:00:56 +00:00
Reid Spencer
51dddfe824 Add ModuleInfo.txt for the cfe module.
llvm-svn: 38532
2007-07-11 07:46:26 +00:00
Reid Spencer
0e549866f3 Create initial directory structure for the C Front End.
llvm-svn: 38531
2007-07-11 07:42:41 +00:00
Evan Cheng
bec7a20c5e Fix for PR1545: Revamp code that update kill information due to register reuse.
llvm-svn: 38525
2007-07-11 05:28:39 +00:00
Reid Spencer
ef1eeb3c93 Adjust this per the changes to the configuration script in the llvm-top module.
llvm-svn: 38521
2007-07-11 03:00:11 +00:00
Reid Spencer
c587229558 Adjust this file per the new requirements of the configure scripts in llvm-top
llvm-svn: 38520
2007-07-11 02:59:25 +00:00
Owen Anderson
5e72db3f7f Add FastDSE, a new algorithm for doing dead store elimination. This algorithm is not as accurate
as the current DSE, but it only a linear scan over each block, rather than quadratic.  Eventually
(once it has been improved somewhat), this will replace the current DSE.

NOTE: This has not yet been extensively tested.
llvm-svn: 38517
2007-07-11 00:46:18 +00:00
David Greene
d9034f717a Make this work with GLIBCXX_DEBUG.
llvm-svn: 38516
2007-07-10 22:00:30 +00:00
Evan Cheng
94579dbd2e Didn't mean the last commit. Revert.
llvm-svn: 38515
2007-07-10 22:00:16 +00:00
Dale Johannesen
68471d263f Fix fp_constant_op failure.
llvm-svn: 38514
2007-07-10 21:53:30 +00:00
Evan Cheng
effa7467b6 Update.
llvm-svn: 38513
2007-07-10 21:49:47 +00:00
Dale Johannesen
23f631d87c fix 80 columnn violations, increasing the world's
pedantic satisfaction level.

llvm-svn: 38512
2007-07-10 20:53:41 +00:00
Owen Anderson
c432490b4c Calculate the size of a array allocation correctly.
llvm-svn: 38511
2007-07-10 20:48:38 +00:00
Owen Anderson
faf9e42479 Fix a crasher when finding the dependency of a call.
llvm-svn: 38510
2007-07-10 20:39:07 +00:00
Owen Anderson
1279eaf776 Make this pass registration static as well.
llvm-svn: 38509
2007-07-10 20:21:08 +00:00
Owen Anderson
084d3c2e2f Make the pass registration static.
llvm-svn: 38508
2007-07-10 20:20:19 +00:00
Chris Lattner
f51bd666d9 add a note
llvm-svn: 38507
2007-07-10 20:03:50 +00:00
Rafael Espindola
9521a564fb check for correct usage of the byval attribute
llvm-svn: 38506
2007-07-10 19:28:12 +00:00
Anton Korobeynikov
76547349c1 During module cloning copy aliases too. This fixes PR1544
llvm-svn: 38505
2007-07-10 19:07:35 +00:00
Owen Anderson
1fa6132e85 Handle vaarg instructions correctly.
llvm-svn: 38504
2007-07-10 18:43:15 +00:00
Dan Gohman
60d6f96da3 Change the peep for EXTRACT_VECTOR_ELT of BUILD_PAIR to look for
the new CONCAT_VECTORS node type instead, as that's what legalize
uses now. And add a peep for EXTRACT_VECTOR_ELT of INSERT_VECTOR_ELT.

llvm-svn: 38503
2007-07-10 18:20:44 +00:00
Owen Anderson
94a21dd1e0 Volatile loads and stores depend on each other.
llvm-svn: 38502
2007-07-10 18:11:42 +00:00
Evan Cheng
9d41b311fb Remove clobbersPred. Add an OptionalDefOperand to instructions which have the 's' bit.
llvm-svn: 38501
2007-07-10 18:08:01 +00:00
Evan Cheng
0867337075 Remove clobbersPred.
llvm-svn: 38500
2007-07-10 18:07:08 +00:00
Evan Cheng
ff025e4fc9 Add OptionalDefOperand. Remove clobbersPred. Also add DefinesPredicate to be used by if-converter.
llvm-svn: 38499
2007-07-10 18:06:29 +00:00
Evan Cheng
6e3c705d74 Try committing again. Add OptionalDefOperand. Remove clobbersPred.
llvm-svn: 38498
2007-07-10 18:05:01 +00:00
Owen Anderson
9c88457abe Add support for finding the dependencies of call and invoke instructions.
llvm-svn: 38497
2007-07-10 17:59:22 +00:00
Evan Cheng
5e9084207f If the operand is marked M_OPTIONAL_DEF_OPERAND, then it's a def.
llvm-svn: 38496
2007-07-10 17:52:20 +00:00
Evan Cheng
fbc73099dc Somehow this wasn't committed last time. M_CLOBBERS_PRED is gone.
llvm-svn: 38495
2007-07-10 17:50:43 +00:00
Owen Anderson
2552a12e65 Fix the build, and fix the handling of pointer sizes.
llvm-svn: 38494
2007-07-10 17:25:03 +00:00
Owen Anderson
47352db672 Fix a bunch of things from Chris' feedback
llvm-svn: 38493
2007-07-10 17:08:11 +00:00
Dan Gohman
4bd45b3d53 Add a regression test for folding spill code into scalar min and max.
llvm-svn: 38492
2007-07-10 15:34:29 +00:00
Dan Gohman
adb3d37c07 Fix a bug in the folding of binary operators to undef.
Thanks to Lauro for spotting this!

llvm-svn: 38491
2007-07-10 15:19:29 +00:00
Reid Spencer
bca0811462 Make sure to keep symbols for profile build.
Patch by Benoit Boissinot. Thanks, Benoit!

llvm-svn: 38490
2007-07-10 14:52:01 +00:00
Dan Gohman
fa91282dbf Fix the folding of undef in several binary operators to recognize
undef in either the left or right operand.

llvm-svn: 38489
2007-07-10 14:20:37 +00:00
Reid Spencer
0818f7dbf9 Simplify the handling of the --*flags options. The makefile already gets it
right so there is no need to duplicate logic, just use the values the makefile
provides. 

Eliminate some redundnt -D options from the output.

Fix the help output so it fits on 80 cols.

llvm-svn: 38488
2007-07-10 07:48:09 +00:00
Reid Spencer
1da59dd6dd Makesure the -cppflags also uses the CPP.BaseFlags as the CPP.Defines only
contains some of the defines but not all CPP flags.

llvm-svn: 38487
2007-07-10 07:21:34 +00:00
Reid Spencer
fd8e641c1e Make sure that preprocessor symbols like _DEBUG, NDEBUG, and _GLIBC_DEBUG are
put into the CPP.Defines variable. Seems the convention was corrupted with
various changes made. It is important to get command line parameters into the
right variable because things like llvm-config and sub-makefiles depend on it.

llvm-svn: 38486
2007-07-10 07:19:53 +00:00
Evan Cheng
ff6f279adf When a node value is only used by a CopyToReg, use the user's dest. This should not be restricted to nodes that produce only a single value.
llvm-svn: 38485
2007-07-10 07:08:32 +00:00
Evan Cheng
32aad49b24 Move DenseMapKeyInfo<SDOperand> from LegalizeDAG.cpp to SelectionDAGNodes.h
llvm-svn: 38484
2007-07-10 06:59:55 +00:00
Nick Lewycky
e635cc43c6 Update the ValueRanges interface to use value numbers instead of Value*s.
llvm-svn: 38483
2007-07-10 03:28:21 +00:00
Owen Anderson
7ff09810a8 Evidently my earlier fix did not go far enough. When resizing a zero-sized
BitVector, make sure to set or clear ALL of the bits.

llvm-svn: 38481
2007-07-10 02:01:16 +00:00
Owen Anderson
4c4b238448 Move some key maps from std::map to DenseMap. This improves the time to optimize Anton's testcase from 17.5s
to 15.7s.

llvm-svn: 38480
2007-07-10 00:27:22 +00:00
Owen Anderson
41c2cab873 Use a cheaper test, delaying calling find_leader() until we know that it's necessary. This improves
the time to optimize Anton's testcase from 21.1s to 17.6s.

llvm-svn: 38479
2007-07-10 00:09:25 +00:00
Dan Gohman
57111e7a60 Define non-intrinsic instructions for vector min, max, sqrt, rsqrt, and rcp,
in addition to the intrinsic forms. Add spill-folding entries for these new
instructions, and for the scalar min and max instrinsic instructions which
were missing. And add some preliminary ISelLowering code for using the new
non-intrinsic vector sqrt instruction, and fneg and fabs.

llvm-svn: 38478
2007-07-10 00:05:58 +00:00
Owen Anderson
7ee197ecf2 Add an assertion if find_leader fails.
llvm-svn: 38477
2007-07-09 23:57:18 +00:00
Owen Anderson
c3bd1db42d When resizing a BitVector with size 0, be sure to clear the low word before using it.
llvm-svn: 38476
2007-07-09 23:39:39 +00:00
Owen Anderson
effc7a7d16 Take advantage of the new fast SmallPtrSet assignment operator when propagating AVAIL_OUT sets.
This reduces the time to optimize Anton's testcase from 31.2s to 21.s!

llvm-svn: 38475
2007-07-09 22:29:50 +00:00
Owen Anderson
e33356b18e Make the assignment operator for SmallPtrSet much faster for normal cases.
llvm-svn: 38474
2007-07-09 22:27:20 +00:00
Dan Gohman
2af3063337 Preserve volatililty and alignment information when lowering or
simplifying loads and stores.

llvm-svn: 38473
2007-07-09 22:18:38 +00:00
Devang Patel
e8ec7661ea Expose struct size threhold to allow users to tweak their own setting.
llvm-svn: 38472
2007-07-09 21:19:23 +00:00
Dan Gohman
f8f531bf69 Change getCopyToParts and getCopyFromParts to always use target-endian
register ordering, for both physical and virtual registers. Update the PPC
target lowering for calls to expect registers for the call result to
already be in target order.

llvm-svn: 38471
2007-07-09 20:59:04 +00:00
Owen Anderson
3364abbb36 Make the assignment operator for SmallPtrSet return a reference, and fix a long-standing bug in the copy
ctor while I'm at it.

Thanks to Chris Lattner for help with this patch.

llvm-svn: 38470
2007-07-09 20:59:01 +00:00
Devang Patel
94d0fbe1a6 Fix memory leak.
llvm-svn: 38469
2007-07-09 20:52:39 +00:00
Dan Gohman
6decfbf133 Initialize the IndexedModeActions array with memset before
updating it with calls to setIndexedLoadAction/setIndexedStoreAction,
which only update a few bits at a time. This avoids ostensible
undefined behavior of operationg on values which may be
trap-representations, and as a practical matter fixes errors from
valgrind, which doesn't track uninitialized memory with bit
granularity.

llvm-svn: 38468
2007-07-09 20:49:44 +00:00
Owen Anderson
aee901745d Fix an error in the assignment operator that was causing an infinite loop in GVNPRE.cpp.
Patch by Chis Lattner.

llvm-svn: 38467
2007-07-09 18:51:15 +00:00
Chris Lattner
318ff8dd94 force a cpu without SSE
llvm-svn: 38466
2007-07-09 17:35:18 +00:00
Chris Lattner
0937478073 allow this to work on ppc-darwin
llvm-svn: 38465
2007-07-09 17:32:28 +00:00
Chris Lattner
0e623de40d remove this bogus t-t
llvm-svn: 38464
2007-07-09 17:31:07 +00:00
Chris Lattner
517290ae52 The various "getModuleMatchQuality" implementations should return
zero if they see a target triple they don't understand.

llvm-svn: 38463
2007-07-09 17:25:29 +00:00
Chris Lattner
6fec9a91b7 add target triple to fix PR1546
llvm-svn: 38462
2007-07-09 17:14:58 +00:00
Chris Lattner
a11b2c74f2 work around an aparent gcc name resolution bug by
detemplatizing this.

llvm-svn: 38461
2007-07-09 17:11:53 +00:00
Chris Lattner
85049a470e implement operator= for smallptrset
llvm-svn: 38460
2007-07-09 16:54:03 +00:00
Owen Anderson
56b01eb3d9 Fix a comment.
llvm-svn: 38459
2007-07-09 16:43:55 +00:00
Chris Lattner
6caf8fdd04 Fix this warning:
DAGCombiner.cpp: In member function 'llvm::SDOperand<unnamed>::DAGCombiner::visitOR(llvm::SDNode*)':
DAGCombiner.cpp:1608: warning: passing negative value '-0x00000000000000001' for argument 1 to 'llvm::SDOperand llvm::SelectionDAG::getConstant(uint64_t, llvm::MVT::ValueType, bool)'

oiy.

llvm-svn: 38458
2007-07-09 16:16:34 +00:00
Dan Gohman
0a76e7f678 Move the APInt form of SCEVUnknown::getIntegerSCEV to SCEVConstant::get, and
use SCEVConstant::get instead of SCEVUnknown::get when constructing a SCEV
for a ConstantInt.

llvm-svn: 38457
2007-07-09 15:25:17 +00:00
Dan Gohman
8e0b6099b9 Fix a typo in a comment.
llvm-svn: 38456
2007-07-09 15:15:24 +00:00
Dan Gohman
5740239998 Add explicit triples to these tests so that llc behaves as expected on
non-Apple hosts.

llvm-svn: 38455
2007-07-09 13:42:32 +00:00
Gabor Greif
949ac3a930 missed this one
llvm-svn: 38454
2007-07-09 12:20:30 +00:00
Gabor Greif
ef3d8362a3 fix typos
llvm-svn: 38453
2007-07-09 12:00:59 +00:00
Gabor Greif
6c0bda829e eliminated all references to 'bytecode' from .pod files
llvm-svn: 38452
2007-07-09 11:24:05 +00:00
Reid Spencer
7671b99aa0 Update the svn:ignore property to eliminate all files
that start with svn-commit. because there can be several of them.

llvm-svn: 38451
2007-07-09 08:49:26 +00:00
Reid Spencer
b7d27ae301 Add more svn:ignore property values.
llvm-svn: 38450
2007-07-09 08:47:45 +00:00
Reid Spencer
61392f566f More svn:ignore property restorations.
llvm-svn: 38449
2007-07-09 08:46:01 +00:00
Reid Spencer
21b8662ce7 Restore properties I accidentally deleted with the last commit.
llvm-svn: 38448
2007-07-09 08:44:12 +00:00
Reid Spencer
4c25a1791e Set the svn:ignore property to ignore the Debug, Release, and
Release-Asserts sub-directories in all directories that build code.

llvm-svn: 38447
2007-07-09 08:34:37 +00:00
Reid Spencer
617f5fbf74 Remove the cvsupdate script. Its no longer useful in the face of
tools such as svn info and svn status.

llvm-svn: 38446
2007-07-09 08:31:14 +00:00
Reid Spencer
5613721c96 Regenerate.
llvm-svn: 38444
2007-07-09 08:10:07 +00:00
Reid Spencer
e18131afd4 cvs -> svn
llvm-svn: 38443
2007-07-09 08:09:21 +00:00
Reid Spencer
c7f87f202e Subversionify the documentation.
llvm-svn: 38442
2007-07-09 08:04:31 +00:00
Owen Anderson
267ba45249 Improve a hotspot that was making build_sets() slower by calling lookup() too
often.  This improves Anton's testcase from 36s to 32s.

llvm-svn: 38441
2007-07-09 07:56:55 +00:00
Reid Spencer
b936bc2067 Subversionify the script.
llvm-svn: 38440
2007-07-09 07:41:11 +00:00
Owen Anderson
1c83b5d999 Start using a set representation that remembers the set of value numbers represented
in the set.  For the moment, this results in a slight performance decrease, but
it lays the groundwork for future improvements.

llvm-svn: 38439
2007-07-09 06:50:06 +00:00
Reid Spencer
74119e0e7e Bytecode -> Bitcode
llvm-svn: 38438
2007-07-09 06:45:18 +00:00
Reid Spencer
75efe6cc57 Minor language change upgrader -> upgrade tool
llvm-svn: 38437
2007-07-09 06:42:22 +00:00
Reid Spencer
e14b7339e6 This dir does not appear under /docs anymore but under /cmds so use an
absolute path to the llvm.css file.

llvm-svn: 38436
2007-07-09 06:32:55 +00:00
Reid Spencer
bb7dc1ed8b Links for commands are now generated into /cmds/ URL.
llvm-svn: 38435
2007-07-09 06:31:51 +00:00
Reid Spencer
15053aaed6 Fix some minor typos.
llvm-svn: 38434
2007-07-09 06:14:11 +00:00
Reid Spencer
69c94d2da4 Fix some typos.
llvm-svn: 38433
2007-07-09 06:06:45 +00:00
Reid Spencer
b66b30577e Fix a typo.
llvm-svn: 38432
2007-07-09 06:01:20 +00:00
Reid Spencer
af548d0ed2 Fix a typo.
llvm-svn: 38431
2007-07-09 05:58:08 +00:00
Reid Spencer
2cf6fe9ea2 Fix some minor typos, again to test the auto-update of the web site.
llvm-svn: 38430
2007-07-09 05:52:49 +00:00
Reid Spencer
dfa6ee7ca7 Remove an unneeded space, mostly to verify that auto-update of the
documentation is working.

llvm-svn: 38429
2007-07-09 05:33:45 +00:00
Reid Spencer
64a2622682 Install things needed by llvm-top to allow successful building
of llvm from that level.

llvm-svn: 38423
2007-07-08 03:50:22 +00:00
Reid Spencer
bbe14ea99f LLVM needs ModuleInfo.txt as well.
llvm-svn: 38422
2007-07-08 00:59:00 +00:00
Owen Anderson
8b99e0ab20 Fix an error where ANTIC_OUT was ending up with more than one expression of
the same value number.  This fixes an infinite loop on 444.namd.

llvm-svn: 37967
2007-07-07 20:13:57 +00:00
Nick Lewycky
9b2252c6f0 Back out Devang's fix for PR1320 because it causes PR1542.
llvm-svn: 37966
2007-07-07 16:23:34 +00:00
Evan Cheng
881248c4e1 No need for ccop anymore.
llvm-svn: 37965
2007-07-06 23:34:09 +00:00
Evan Cheng
96c1457bff Teach if-conversion about instructions that were already predicated, e.g. conditional move.
llvm-svn: 37964
2007-07-06 23:24:39 +00:00
Evan Cheng
9835db562f ImmutablePredicateOperand is no more.
llvm-svn: 37963
2007-07-06 23:23:38 +00:00
Evan Cheng
3650b2c278 Incorrect check.
llvm-svn: 37962
2007-07-06 23:23:19 +00:00
Evan Cheng
76a97c5f8a Do away with ImmutablePredicateOperand.
llvm-svn: 37961
2007-07-06 23:22:46 +00:00
Evan Cheng
d771e05121 isUnpredicatedTerminator should treat conditional branches as unpredicated terminator.
llvm-svn: 37960
2007-07-06 23:22:03 +00:00
Evan Cheng
b039c60889 Do away with ImmutablePredicateOperand.
llvm-svn: 37959
2007-07-06 23:21:02 +00:00
Owen Anderson
c0daf5fe53 A first stab at memory dependence analysis. This is an interface on top of
alias analysis, adding caching and lazy computation of queries.  This will
be used in planned improvements to memory access optimizations.

llvm-svn: 37958
2007-07-06 23:14:35 +00:00
Owen Anderson
81f07478b4 Add some accessors to improve consistency.
llvm-svn: 37957
2007-07-06 23:13:31 +00:00
Gabor Greif
a54634adef first pass of nomenclature changes in .html files
llvm-svn: 37956
2007-07-06 22:07:22 +00:00
Devang Patel
12358b4827 These rountines are now available as part of basic block utilities.
llvm-svn: 37955
2007-07-06 22:03:47 +00:00
Devang Patel
86d0ea973d Request DominanceFrontiner in advance.
llvm-svn: 37954
2007-07-06 21:43:22 +00:00
Devang Patel
3ee408264b Preserve various analysis info.
llvm-svn: 37953
2007-07-06 21:40:13 +00:00
Devang Patel
d7767cc2a7 Add SplitEdge and SplitBlock utility routines.
llvm-svn: 37952
2007-07-06 21:39:20 +00:00
Owen Anderson
7d4bbc1c0c Be more aggressive in the heuristic. This mostly exposes more opportunities
for the GVN part of GVNPRE to apply.

llvm-svn: 37951
2007-07-06 20:29:43 +00:00
Gabor Greif
24027b584f finishing touches of bytecode -> bitcode changes. also unbreak Windows
llvm-svn: 37950
2007-07-06 20:28:40 +00:00
Owen Anderson
3c3dd902ec Achieve what the incorrect test was trying to do by simply requiring that all
critical edges be split before we begin.

llvm-svn: 37949
2007-07-06 18:12:36 +00:00
Owen Anderson
bcdd7ec4c9 Remove an incorrect check.
llvm-svn: 37948
2007-07-06 16:52:47 +00:00
Duncan Sands
9d97420473 The exception handling intrinsics return values,
so must be lowered to a value, not nothing at all.
Subtle point: I made eh_selector return 0 and
eh_typeid_for return 1.  This means that only
cleanups (destructors) will be run as the exception
unwinds [if eh_typeid_for returned 0 then it would
be as if the first catch always matched, and the
corresponding handler would be run], which is
probably want you want in the CBE.

llvm-svn: 37947
2007-07-06 14:46:23 +00:00
Dan Gohman
71ed4aaa31 Remove redundant declarations.
llvm-svn: 37946
2007-07-06 13:59:28 +00:00
Gabor Greif
3d3fc3296e eliminate residual cruft related to recognizing bytecode
files.
bitcode files are the only LLVM format left.

llvm-svn: 37945
2007-07-06 13:38:17 +00:00
Dan Gohman
fd404813e8 Fix a comment so that the element numbering match the actual element
operand numbering.

llvm-svn: 37944
2007-07-06 13:27:33 +00:00
Dan Gohman
bab5355ff4 Add an explicit triple to the big-endian tests so that the assembly
output format is always consistent with what the greps are looking for.

llvm-svn: 37943
2007-07-06 13:15:51 +00:00
Duncan Sands
c5b1984f57 Indexes into the list of filter ids cannot be output
directly: they need to be turned into byte offsets
(often the same, but may not be if there are many
type infos).

llvm-svn: 37942
2007-07-06 12:46:24 +00:00
Duncan Sands
6ddf75174a Test that byte offsets are used to index into the list
of filter ids, and not simply the id index.  Testing
this requires at least 128 type infos!

llvm-svn: 37941
2007-07-06 12:38:27 +00:00
Rafael Espindola
b567e3ffb0 Add the byval attribute
llvm-svn: 37940
2007-07-06 10:57:03 +00:00
Gabor Greif
0e21980704 Solaris 2.x does not have RLIMIT_RSS, check for this symbol (analog NetBSD below), should subsume Cygwin
llvm-svn: 37939
2007-07-06 10:31:27 +00:00
Duncan Sands
003c0b1f90 Remove propagateEHRegister in favour of a more limited
fix, that is adequate while PR1508 remains unresolved.

llvm-svn: 37938
2007-07-06 09:18:59 +00:00
Duncan Sands
81df18a50a Remove ExtractGlobalVariable - use StripPointerCasts
instead.

llvm-svn: 37937
2007-07-06 09:10:03 +00:00
Zhou Sheng
1ee941dac4 Correct a typo.
llvm-svn: 37936
2007-07-06 06:01:16 +00:00
Evan Cheng
fc7010d962 Workaround of getCopyToRegs and getCopyFromRegs bugs for big-endian machines.
llvm-svn: 37935
2007-07-06 01:47:35 +00:00
Evan Cheng
642be16bbf Change CalculateHeights and CalculateDepths to be non-recursive.
llvm-svn: 37934
2007-07-06 01:37:28 +00:00
Evan Cheng
a7d41aad4f Refactor code to add initial support for OptionalDefOperand.
llvm-svn: 37933
2007-07-06 01:05:26 +00:00
Evan Cheng
0a42fdf346 Print the s bit if the instruction is toggled to its CPSR setting form.
llvm-svn: 37932
2007-07-06 01:01:34 +00:00
Evan Cheng
5c66888580 PredicateDefOperand -> OptionalDefOperand.
llvm-svn: 37931
2007-07-06 01:00:49 +00:00
Evan Cheng
eaa82198c4 Add OptionalDefOperand to stand for optionally defined result.
llvm-svn: 37930
2007-07-06 01:00:16 +00:00
Owen Anderson
02e9698293 Fix a bunch of issues found in a testcase from 400.perlbench.
llvm-svn: 37929
2007-07-05 23:11:26 +00:00
Evan Cheng
da784693c3 Fix test.
llvm-svn: 37928
2007-07-05 23:00:50 +00:00
Chris Lattner
feba62c719 avoid ambiguity in target selection
llvm-svn: 37927
2007-07-05 22:16:19 +00:00
Evan Cheng
9546a5c7de Initial ARM JIT support by Raul Fernandes Herbster.
llvm-svn: 37926
2007-07-05 21:15:40 +00:00
Dan Gohman
929624f461 Add explicit keywords.
llvm-svn: 37925
2007-07-05 20:40:15 +00:00
Dan Gohman
83b095df36 Make MachineFunctionPass::runOnFunction non-virtual. Subclasses override
the virtual function runOnMachineFunction instead. And add access specifiers.

llvm-svn: 37924
2007-07-05 20:39:35 +00:00
Anton Korobeynikov
de9c825859 Proper flag __alloca call
llvm-svn: 37923
2007-07-05 20:36:08 +00:00
Dan Gohman
a282694acf Make the debug string for ISD::MERGE_VALUES consistent with the others.
llvm-svn: 37922
2007-07-05 20:15:43 +00:00
Dan Gohman
d258e80583 Add a parameter to getCopyToParts and getCopyFromParts to specify whether
endian swapping should be done, and update the code to use it. This fixes
some register ordering issues on big-endian systems, such as PowerPC,
introduced by the recent illegal by-val arguments changes.

llvm-svn: 37921
2007-07-05 20:12:34 +00:00
Chris Lattner
fb0b269032 This enum is dead
llvm-svn: 37920
2007-07-05 17:28:01 +00:00
Chris Lattner
622178dfc1 update the .cvs files.
llvm-svn: 37919
2007-07-05 17:27:31 +00:00
Chris Lattner
f997e37fbb update the .cvs files
llvm-svn: 37918
2007-07-05 17:26:49 +00:00
Evan Cheng
cee44d3d1d Doh
llvm-svn: 37917
2007-07-05 17:21:33 +00:00
Chris Lattner
de8c7b6981 remove a dead case
llvm-svn: 37916
2007-07-05 17:18:32 +00:00
Evan Cheng
a6246f4346 Unbreak the build.
llvm-svn: 37915
2007-07-05 17:13:56 +00:00
Evan Cheng
085314b455 Unbreak the build.
llvm-svn: 37914
2007-07-05 17:13:19 +00:00
Gabor Greif
e16561cd5d Here is the bulk of the sanitizing.
Almost all occurrences of "bytecode" in the sources have been eliminated.

llvm-svn: 37913
2007-07-05 17:07:56 +00:00
Dale Johannesen
5892cfd263 Record my recent work.
llvm-svn: 37912
2007-07-05 16:56:24 +00:00
Chris Lattner
6d1cf76c97 the arm backend is not building, temporarily disable it.
llvm-svn: 37911
2007-07-05 16:11:52 +00:00
Devang Patel
f5a15dd9da Fix PR1539. Add LoopPassPrinter.
llvm-svn: 37909
2007-07-05 15:32:03 +00:00
Duncan Sands
4836e3a6f8 Make sure only one copy of a filter is placed in the
exception handling table if we encounter it multiple
times.  Filters could be folded harder than this, but
that would mean a lot more work for not much gain.

llvm-svn: 37908
2007-07-05 15:15:01 +00:00
Duncan Sands
ed4f3743c2 Test commit.
llvm-svn: 37907
2007-07-05 10:32:33 +00:00
Reid Spencer
a9c32e6b49 Add a note about llvm2cpp's dubious future.
llvm-svn: 37906
2007-07-05 10:12:19 +00:00
Reid Spencer
98f56b50d1 Get the version number right, finally.
llvm-svn: 37905
2007-07-05 10:00:19 +00:00
Evan Cheng
ffabff11c0 Teach DAGISelEmitter about zero_reg.
llvm-svn: 37900
2007-07-05 07:19:45 +00:00
Evan Cheng
e32e7fb40d Instructions with ImmutablePredicateOperand aren't really predicable since their predicates are fixed at isel time.
llvm-svn: 37899
2007-07-05 07:19:29 +00:00
Evan Cheng
94f04c6fc9 Reflects the chanegs made to PredicateOperand.
llvm-svn: 37898
2007-07-05 07:18:20 +00:00
Evan Cheng
a7f77599a4 Added ARM::CPSR to represent ARM CPSR status register.
llvm-svn: 37897
2007-07-05 07:17:13 +00:00
Evan Cheng
7e90b11550 Unfortunately we now require C++ code to isel Bcc, conditional moves, etc.
llvm-svn: 37896
2007-07-05 07:15:27 +00:00
Evan Cheng
aa3b8014bd Each ARM use predicate operand is now made up of two components. The new component is the CPSR register.
llvm-svn: 37895
2007-07-05 07:13:32 +00:00
Evan Cheng
49ffa1e488 Added ARM::CPSR to represent ARM CPSR status register.
llvm-svn: 37894
2007-07-05 07:11:03 +00:00
Evan Cheng
ea4a82bcfb PPC conditional branch predicate does not change after isel.
llvm-svn: 37893
2007-07-05 07:09:50 +00:00
Evan Cheng
756d15ac6f - Added zero_reg def to stand for register 0.
- Added two variants of PredicateOperand: ImmutablePredicateOperand, whose predicate does not change after isel; PredicateDefOperand, which represent a predicate defintion operand.

llvm-svn: 37892
2007-07-05 07:09:09 +00:00
Evan Cheng
0721084327 Do not check isPredicated() on non-predicable instructions.
llvm-svn: 37891
2007-07-05 07:06:46 +00:00
Evan Cheng
bb6ecf0067 Better assertion messages.
llvm-svn: 37890
2007-07-05 07:05:38 +00:00
Chris Lattner
5e78bdc4a8 stacker depends on llvm
llvm-svn: 37883
2007-07-05 05:38:55 +00:00
Nick Lewycky
73dd692173 Break "variable canonicalization" out of InequalityGraph and into its own class
"ValueNumbering".

llvm-svn: 37881
2007-07-05 03:15:00 +00:00
Owen Anderson
ca1a184fd8 Fix another bug, this time in PREing select instructions.
llvm-svn: 37878
2007-07-04 22:33:23 +00:00
Gabor Greif
0e535c3c8e Pretty straightforward replacement of "bytecode" by "bitcode"
performed on tools/ first, in order not to cause lethal damage

llvm-svn: 37877
2007-07-04 21:55:50 +00:00
Dale Johannesen
3d7008cd49 Refactor X87 instructions. As a side effect, all
their names are changed.

llvm-svn: 37876
2007-07-04 21:07:47 +00:00
Duncan Sands
fe80638417 Extend eh.selector to support both catches and filters.
Drop the eh.filter intrinsic.

llvm-svn: 37875
2007-07-04 20:52:51 +00:00
Duncan Sands
fda68e7b10 Nested try-catch-filter testcase.
llvm-svn: 37874
2007-07-04 20:48:48 +00:00
Chris Lattner
98c09a07ca Make the GSG actually work.
llvm-svn: 37872
2007-07-04 18:42:47 +00:00
Owen Anderson
cd94fc982a Fix a typo that was killing GVNPRE of select instructions.
llvm-svn: 37871
2007-07-04 18:26:18 +00:00
Owen Anderson
664e260a9c Fix an error in phi translation of GEPs that was causing failures.
llvm-svn: 37868
2007-07-04 04:51:16 +00:00
Reid Spencer
540aa864ba Ignore the .svn directories so countloc.sh and llvmgrep won't traverse them.
llvm-svn: 37867
2007-07-04 01:35:32 +00:00
Bill Wendling
8590f920c7 Support generation of GR64 to MMX code in the JIT.
llvm-svn: 37866
2007-07-04 01:29:22 +00:00
Devang Patel
24f9e2cf98 Remove unused method - getIDomBlock().
llvm-svn: 37865
2007-07-04 01:11:19 +00:00
Devang Patel
67c27ceac7 Fix typo in assertion check.
llvm-svn: 37864
2007-07-04 01:05:22 +00:00
Bill Wendling
3053244b27 Allow a GR64 to be moved into an MMX register via the "movd" instruction.
Still need to have JIT generate this code.

llvm-svn: 37863
2007-07-04 00:19:54 +00:00
Owen Anderson
2e4b6feac2 Add support for performing GVNPRE on GEP instructions.
llvm-svn: 37862
2007-07-03 23:51:19 +00:00
Bill Wendling
9d1ff65719 Change the place where man pages are installed to ${prefix}/share/man1. This
puts them in a more standardized place.

llvm-svn: 37861
2007-07-03 23:04:11 +00:00
Owen Anderson
b9a494aea3 Add functionality to value number GEP instructions. This also provides the infrastructure that will
be used for function calls.  NOTE: This does not yet do any transformation of GEPs or function calls.

llvm-svn: 37860
2007-07-03 22:50:56 +00:00
Anton Korobeynikov
12e21dc312 Test modified svn mailer
llvm-svn: 37859
2007-07-03 21:57:50 +00:00
Owen Anderson
fc56043844 Remove BFtoLLVM. It was old, and a poor example because it didn't use best practices for making
a LLVM frontend in C++.  Maybe someday it will be rewritten..

llvm-svn: 37858
2007-07-03 21:36:47 +00:00
Owen Anderson
6b958c72bd Make the unary operator case a bit faster, since casts are the only kind of unary operation.
llvm-svn: 37857
2007-07-03 19:01:42 +00:00
Owen Anderson
59bd053fc5 Add support for performing GVNPRE on cast instructions, and add a testcase for this.
llvm-svn: 37856
2007-07-03 18:37:08 +00:00
Tanya Lattner
11f9d1b7ee We really should not have this version number in SO many makefiles. This should also probably change to svn instead of cvs, but leaving it for now.
llvm-svn: 37855
2007-07-03 18:11:20 +00:00
Anton Korobeynikov
510dfdaa0d Revert last change until issue reported by Owen, won't be fixed.
llvm-svn: 37854
2007-07-03 17:16:46 +00:00
Dale Johannesen
c2a6089b8b Some spacing fixes. Cosmetic.
llvm-svn: 37853
2007-07-03 17:07:33 +00:00
Anton Korobeynikov
76f70dc838 Rename llvm-test => test-suite. By Dave Greene.
llvm-svn: 37852
2007-07-03 17:01:58 +00:00
Dan Gohman
06563a8702 Fix several over-aggressive folds for undef nodes in dagcombine, to
follow the rules for undef used in instcombine.

llvm-svn: 37851
2007-07-03 14:03:57 +00:00
Chris Lattner
4b32528ba9 note where to get steens-aa and ds-aa
llvm-svn: 37850
2007-07-03 04:41:50 +00:00
Owen Anderson
00e7e32abf Test commit.
llvm-svn: 37849
2007-07-03 02:28:17 +00:00
Dale Johannesen
a8bf39ee31 New testcases for rev 37847 (PR's 1489 and 1505).
llvm-svn: 37848
2007-07-03 00:58:37 +00:00
Dale Johannesen
a2b3c175db Fix for PR 1505 (and 1489). Rewrite X87 register
model to include f32 variants.  Some factoring
improvments forthcoming.

llvm-svn: 37847
2007-07-03 00:53:03 +00:00
Tanya Lattner
5518345f25 Testing commit.
llvm-svn: 37846
2007-07-02 18:10:52 +00:00
Dan Gohman
9ff9908413 Add a basic test-case for passing and returning <4 x double> and
<8 x float> values on X86.

llvm-svn: 37845
2007-07-02 16:23:47 +00:00
Dan Gohman
f9ae1c6001 Vector results may be returned in XMM0 and XMM1, not just XMM0. With
the recent lowering changes, this allows types like <4 x double> to
be returned, using two vector registers.

llvm-svn: 37844
2007-07-02 16:21:53 +00:00
Dan Gohman
533dd16a7f Replace ExpandScalarFormalArgs and ExpandScalarCallArgs with the newly
refactored getCopyFromParts and getCopyToParts, which are more general.
This effectively adds support for lowering illegal by-val vector call
arguments.

llvm-svn: 37843
2007-07-02 16:18:06 +00:00
Dan Gohman
9a70823375 Teach GetNegatedExpression to negate 0-B to B in UnsafeFPMath mode, and
visitFSUB to fold 0-B to -B in UnsafeFPMath mode. Also change visitFNEG
to use isNegatibleForFree/GetNegatedExpression instead of doing a subset
of the same thing manually.

This fixes test/CodeGen/X86/negative-sin.ll.

llvm-svn: 37842
2007-07-02 15:48:56 +00:00
Dan Gohman
11a4008a59 New test case. DAGCombiner should be able to fold -sin(-x)
in -enable-unsafe-fp-math mode.

llvm-svn: 37841
2007-07-02 15:43:20 +00:00
Dan Gohman
32c3c19bed Remove declarations for code no longer in the tree, to avoid confusion.
llvm-svn: 37840
2007-07-02 15:06:26 +00:00
Dan Gohman
1eb8ed47f5 Add explicit keywords.
llvm-svn: 37839
2007-07-02 14:53:37 +00:00
Zhou Sheng
bf61346b1c Test case for recent patch for IndVarSimplify.cpp
llvm-svn: 37838
2007-07-02 08:02:14 +00:00
Reid Spencer
df2e2037bd Remove the last vestiges of -usesvn.
Implement -usecvs just in case we need to go back to cvs for some reason.

llvm-svn: 37837
2007-07-02 06:19:57 +00:00
Reid Spencer
4bc337631c We want the Subversion checkout to succeed even if we don't specify
the -verbose option! Doh!

llvm-svn: 37836
2007-07-02 06:16:32 +00:00
Reid Spencer
0b67f66b45 Terminate the document with the right end tags.
llvm-svn: 37835
2007-07-01 17:02:22 +00:00
Nick Lewycky
5105adfcd1 Fix undefined behaviour reported by the new --enable-expensive-checks option.
llvm-svn: 37829
2007-07-01 03:06:30 +00:00
Duraid Madina
097bb1b72e take blame for bigblock RA (test SVN commit)
llvm-svn: 37828
2007-06-30 15:47:36 +00:00
Reid Spencer
6dfece9281 Be slightly more explanatory about the work I've done on LLVM.
llvm-svn: 37827
2007-06-30 06:56:50 +00:00
Chris Lattner
6fef7a228e test commit
llvm-svn: 37826
2007-06-30 06:53:56 +00:00
Evan Cheng
a1a3cc130d (For Chris): Fix failure where we rejected compiling stubs when lazy compilation is disabled.
llvm-svn: 37825
2007-06-30 00:10:37 +00:00
Anton Korobeynikov
09ca62d5c5 Remove labels again
llvm-svn: 37824
2007-06-30 00:00:57 +00:00
Evan Cheng
d21e3ab873 New test.
llvm-svn: 37823
2007-06-29 23:17:15 +00:00
Devang Patel
88197332e7 Add loop info verification mechanism.
llvm-svn: 37822
2007-06-29 23:13:42 +00:00
Anton Korobeynikov
eaa836bbf5 Change CVS-style 'labels' to SVN 'tags' directory.
llvm-svn: 37821
2007-06-29 23:13:42 +00:00
Devang Patel
0975c6d7f9 Preserve DominanceFrontier.
llvm-svn: 37820
2007-06-29 23:11:49 +00:00
Dan Gohman
2e5e277cb3 Add an explicit keyword. Thanks Chris!
llvm-svn: 37819
2007-06-29 22:16:25 +00:00
Evan Cheng
fa68d069ad Only do FNEG xform when the vector type is a floating point type.
llvm-svn: 37818
2007-06-29 21:44:35 +00:00
Anton Korobeynikov
cae5d345fb Another typo
llvm-svn: 37817
2007-06-29 21:44:14 +00:00
David Greene
cf2a51e8db Remove unused variables.
llvm-svn: 37816
2007-06-29 21:42:03 +00:00
Evan Cheng
62acd01275 New test.
llvm-svn: 37815
2007-06-29 21:40:30 +00:00
Evan Cheng
9458e6a551 Fix a vector FP constant CSE bug.
llvm-svn: 37814
2007-06-29 21:36:04 +00:00
Anton Korobeynikov
4c04a9333a Fix a typo
llvm-svn: 37813
2007-06-29 20:56:49 +00:00
John Criswell
98674c1a7c Applied Reid's patch. Long live Subversion!
llvm-svn: 37812
2007-06-29 19:12:50 +00:00
John Criswell
5859485a95 Applied Reid's patch. Long live Subversion!
llvm-svn: 37811
2007-06-29 19:12:31 +00:00
John Criswell
1e0b9cbd6d Updated my entry as a test commit.
Removed QMTest (it is long gone).
Acknowledge the fleeting'ness of my original autoconf work.
Mention that I fixed some bugs.

llvm-svn: 37807
2007-06-29 18:24:05 +00:00
John Criswell
da389b554f Convert .cvsignore files
llvm-svn: 37803
2007-06-29 16:35:36 +00:00
John Criswell
2660cef6d7 Convert .cvsignore files
llvm-svn: 37801
2007-06-29 16:35:07 +00:00
Reid Spencer
7214cfdf66 Add a missing .
llvm-svn: 37800
2007-06-29 14:02:07 +00:00
David Greene
4c1e6f3804 Remove unnecessary attributions in comments.
llvm-svn: 37799
2007-06-29 03:42:23 +00:00
David Greene
869e4b5dac Clean up comments to be consistent with code.
llvm-svn: 37798
2007-06-29 03:36:21 +00:00
Reid Spencer
943cc0c553 Fix problems with the checkout and cd directories for SVN checkout.
llvm-svn: 37797
2007-06-29 03:12:42 +00:00
David Greene
1e2a12019f Fix reference to iterator invalidated by an erase operation. Uncovered
by _GLIBCXX_DEBUG.

llvm-svn: 37796
2007-06-29 02:53:16 +00:00
David Greene
9468bfd932 Fix reference to cached end iterator invalidated by an erase operation.
Uncovered by _GLIBCXX_DEBUG.

llvm-svn: 37795
2007-06-29 02:49:11 +00:00
David Greene
5b6f755575 Remove the "special tie breaker" because it resulted in inconsistent
ordering and thus violated the strict weak ordering requirement of
priority_queue.  Uncovered by _GLIBCXX_DEBUG.

llvm-svn: 37794
2007-06-29 02:48:09 +00:00
David Greene
451d1a6ecd Fix misue of iterator pointing to erased object. Uncovered by
_GLIBCXX_DEBUG.

llvm-svn: 37793
2007-06-29 02:45:24 +00:00
Devang Patel
9feb7f5846 Do not filter loop if candidate branch is in loop header.
llvm-svn: 37792
2007-06-29 01:39:53 +00:00
Evan Cheng
d880f90c2b New test.
llvm-svn: 37791
2007-06-29 01:36:33 +00:00
Evan Cheng
58d1eacd80 Prevent PPC::BCC first operand, the PRED number, from being isel'd into a LI instruction.
llvm-svn: 37790
2007-06-29 01:25:06 +00:00
Owen Anderson
67799d4ffb Add support for value numbering (but not actually optimizing) cast instructions.
llvm-svn: 37789
2007-06-29 00:51:03 +00:00
Owen Anderson
c738f7ca42 Add a type field to expressions in preparation for performing GVNPRE on casts.
llvm-svn: 37788
2007-06-29 00:40:05 +00:00
Evan Cheng
b99f152f29 New tests.
llvm-svn: 37787
2007-06-29 00:27:18 +00:00
Evan Cheng
444d3ca53d No vector fneg.
llvm-svn: 37786
2007-06-29 00:18:15 +00:00
Dan Gohman
0de7694de6 Fix an assertion failure in legalizing bitcast operators on targets where
vectors are split down to single elements as part of legalization.

llvm-svn: 37785
2007-06-29 00:09:08 +00:00
Evan Cheng
3bd318e298 Type of vector extract / insert index operand should be iPTR.
llvm-svn: 37784
2007-06-29 00:01:20 +00:00
Owen Anderson
8a9fa5d081 Add support for performing GVNPRE on select instructions. This fixes test/Transforms/GVNPRE/select.ll.
llvm-svn: 37783
2007-06-28 23:51:21 +00:00
Owen Anderson
d630147c44 Add a test for performing GVNPRE on select instructions.
llvm-svn: 37782
2007-06-28 23:50:31 +00:00
Dan Gohman
7867793aff Add new TargetLowering code to provide the final register type that an
illegal value type will be transformed to, for code that needs the
register type after all transformations instead of just after the first
transformation.

Factor out the code that uses this information to do copy-from-regs and
copy-to-regs for various purposes into separate functions so that they
are done consistently.

llvm-svn: 37781
2007-06-28 23:29:44 +00:00
Devang Patel
9a259a20b3 Fix PR 1526.
llvm-svn: 37780
2007-06-28 23:09:25 +00:00
Dan Gohman
5f1a2052cd Add a default parameter to a SmallVector constructor to allow it to
be called with just an initial length value, just like in std::vector.

llvm-svn: 37779
2007-06-28 20:27:24 +00:00
Lauro Ramos Venancio
b2c3a67015 Fix a bug in my previous patch.
llvm-svn: 37778
2007-06-28 20:06:38 +00:00
David Greene
cbc8ddf81a Add support for building with _GLIBCXX_DEBUG. New configure option
--enable-expensive-checks allows the developer to enable runtime
checking that can greatly increase compile time.  Currently it only
turns on _GLIBCXX_DEBUG.  Other expensive debugging checks added later
should be controlled by this configure option.

This patch also updates llvm-config with a --cppflags option to inform
llvm-gcc how to build itself so that it is compatible with an llvm that
was built with _GLIBCXX_DEBUG.

llvm-svn: 37777
2007-06-28 19:36:08 +00:00
Lauro Ramos Venancio
b00c9c0d50 When linking two modules, we should copy the alias.
llvm-svn: 37776
2007-06-28 19:02:54 +00:00
Devang Patel
4857576f75 Remove unnecessary comments.
llvm-svn: 37774
2007-06-28 02:11:54 +00:00
Devang Patel
7d4520f8ad Handle the case when block dominates itself.
llvm-svn: 37773
2007-06-28 02:07:08 +00:00
Devang Patel
6ba5ad482f - Undo previous check and allow loop switch for condtion that is not inside
loop.
- Avoid loop unswich for loop header branch.
- While cloning dominators fix typo and handle self dominating blocks.

llvm-svn: 37772
2007-06-28 02:05:46 +00:00
Devang Patel
3304e469f7 Update LoopUnswitch pass to preserve DomiantorTree.
llvm-svn: 37771
2007-06-28 00:49:00 +00:00
Devang Patel
3c723c8db7 If a condition is not inside a loop then the condition is suitable
to loop unswitch candidate for the loop.

llvm-svn: 37770
2007-06-28 00:44:10 +00:00
Owen Anderson
e02da55cc8 Make many sets a much more reasonable size. This decreases the time to optimize
Anton's testcase from 35.5s to 34.7s.

llvm-svn: 37769
2007-06-28 00:34:34 +00:00
Bill Wendling
f413419a72 Set implied features based upon the CPU's feature list.
llvm-svn: 37768
2007-06-27 23:34:06 +00:00
Devang Patel
279e501be4 Update. Now, -etforest is an invalid option.
llvm-svn: 37767
2007-06-27 22:58:12 +00:00
Lauro Ramos Venancio
ed95f7fcb3 llvm-nm must print the alias symbols.
llvm-svn: 37766
2007-06-27 22:08:09 +00:00
Devang Patel
c445982764 Remove ETForest.
llvm-svn: 37765
2007-06-27 20:53:52 +00:00
Evan Cheng
df0c705d7d If a livein is not used in the block. It's live through.
llvm-svn: 37764
2007-06-27 18:47:28 +00:00
Evan Cheng
77f541ddfd Partial fix for PR1502: If a EH register is needed in a successor of landing pad, add it as livein to all the blocks in the paths between the landing pad and the specified block.
llvm-svn: 37763
2007-06-27 18:45:32 +00:00
Owen Anderson
7dae8efcf2 Use cached information that has already been computed to make clean() simpler and faster. This is a small speedup on most cases.
llvm-svn: 37761
2007-06-27 17:38:29 +00:00
Evan Cheng
59e5e118ac One additional field in TargetRegisterDesc.
llvm-svn: 37760
2007-06-27 17:09:34 +00:00
Owen Anderson
0eb265729a Fold a lot of code into two cases: binary instructions and ternary instructions.
This saves many lines of code duplication.  No functionality change.

llvm-svn: 37759
2007-06-27 17:03:03 +00:00
Dan Gohman
3b62d7265d Rename ("shrinkify") MVT::isExtendedValueType to MVT::isExtendedVT.
llvm-svn: 37758
2007-06-27 16:08:04 +00:00
Dan Gohman
5179f91ef0 Document the encoding of MVT::ValueType.
llvm-svn: 37757
2007-06-27 15:28:26 +00:00
Dan Gohman
1cbdcac409 Remove a redundant newline in the asm output for ELF .rodata sections.
llvm-svn: 37756
2007-06-27 15:09:47 +00:00
Dan Gohman
7139a48057 Use getVectorTypeBreakdown in FunctionLoweringInfo::CreateRegForValue
to compute the number and type of registers needed for vector values
instead of computing it manually. This fixes PR1529.

llvm-svn: 37755
2007-06-27 14:34:07 +00:00
Dan Gohman
cab6dd8ef2 Allow DOUT to be used outside of the llvm namespace.
llvm-svn: 37753
2007-06-27 14:09:38 +00:00
Dan Gohman
f4e86da3a6 Make the comment for ScalarizeVectorOp mention that it is only for use
with single-element vectors.

llvm-svn: 37752
2007-06-27 14:06:22 +00:00
Zhou Sheng
8d438858c8 Fix a bug.
llvm-svn: 37751
2007-06-27 09:50:26 +00:00
Duraid Madina
95759c0e78 ok, this is something of a dirty hack, but it seems to work. (fixes e.g.
the SPASS miscompilation)

llvm-svn: 37750
2007-06-27 09:01:14 +00:00
Duraid Madina
89183dcc14 ok, this much doesn't seem to bork anything
llvm-svn: 37749
2007-06-27 08:31:07 +00:00
Duraid Madina
a415dcaa2a revert evan's fixes (and my doofusness) since they had a huge code
quality hit. will look at this soon.

llvm-svn: 37748
2007-06-27 08:11:59 +00:00
Duraid Madina
540d329542 pull evan's fixes - should help the nightly tester (but there are still
some issues)

llvm-svn: 37747
2007-06-27 07:07:13 +00:00
Evan Cheng
e66f822ecc Replace std::set with SmallPtrSet.
llvm-svn: 37746
2007-06-27 05:23:00 +00:00
Owen Anderson
b6a39fcb21 Add support for performing GVNPRE on the three vector-specific operations.
llvm-svn: 37745
2007-06-27 04:10:46 +00:00
Owen Anderson
43790570ad Add tests for performing GVNPRE on the three vector-specific instructions.
llvm-svn: 37744
2007-06-27 04:06:32 +00:00
Evan Cheng
6cf1371456 Fix an obvious bug. Old code only worked for the entry block.
llvm-svn: 37743
2007-06-27 01:16:36 +00:00
Owen Anderson
5477c54aa0 1. Correct some comments and clean up some dead code.
2. When calculating ANTIC_IN, only iterate the changed blocks.  For most average
inputs this is a small speedup, but for cases with unusual CFGs, this can be a significant win.

llvm-svn: 37742
2007-06-26 23:29:41 +00:00
Evan Cheng
2d345badea Add comment.
llvm-svn: 37741
2007-06-26 21:19:07 +00:00
Evan Cheng
4bf87f1f44 Correctly handle implcit def / use operands.
llvm-svn: 37740
2007-06-26 21:05:13 +00:00
Evan Cheng
d8417d9199 Properly handle kills of a physical register which has sub-registers that are read by later instructions.
llvm-svn: 37739
2007-06-26 21:03:35 +00:00
Evan Cheng
2e887c0b84 Add immediate sub-registers.
llvm-svn: 37738
2007-06-26 20:59:16 +00:00
Evan Cheng
335c65e9a4 Silence a warning.
llvm-svn: 37737
2007-06-26 18:31:22 +00:00
Reid Spencer
ab13721e83 Update for Subversion conversion:
1. Fix comments for -usesvn and -svnurl options.
2. Fix default URL for SVN access.
3. Fix paths to accommodate "trunk" when checking out from SVN.

llvm-svn: 37736
2007-06-26 17:08:16 +00:00
Dan Gohman
0dccdef768 Replace ?: with if statements, for clarity.
llvm-svn: 37735
2007-06-26 16:19:08 +00:00
Dan Gohman
d80e8e97dc Simplify the expression for MVT::isExtendedValueType.
llvm-svn: 37733
2007-06-26 15:20:04 +00:00
Dan Gohman
e36ede145c Simplify the expression for TargetLowering::isTypeLegal.
llvm-svn: 37732
2007-06-26 15:16:27 +00:00
Dan Gohman
3176887a73 Use utostr from StringExtras.h instead of ostringstream from <sstream>.
llvm-svn: 37731
2007-06-26 15:14:48 +00:00
Dan Gohman
03d2e3d735 Renumber the SimpleValueType values to fill in the hole left by
removing MVT::Vector.

llvm-svn: 37730
2007-06-26 14:28:59 +00:00
Dan Gohman
e8c1e428f2 Revert the earlier change that removed the M_REMATERIALIZABLE machine
instruction flag, and use the flag along with a virtual member function
hook for targets to override if there are instructions that are only
trivially rematerializable with specific operands (i.e. constant pool
loads).

llvm-svn: 37728
2007-06-26 00:48:07 +00:00
Dan Gohman
02d1a7844a Fix a typo in a comment.
llvm-svn: 37727
2007-06-26 00:43:18 +00:00
Dan Gohman
729f3cf27a Add a convenince member function for appending strings to a module's
module-level asm string data.

llvm-svn: 37726
2007-06-26 00:38:49 +00:00
Duraid Madina
f4dc5b26e2 tidy this file up a bit
llvm-svn: 37725
2007-06-26 00:21:58 +00:00
Duraid Madina
77416383e8 A bunch of fixes to the BigBlock allocator improve compile-time by ~20%
and code quality by ~2% on my tests.

A big thank you to Roman Levenstein for this patch! See
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070618/050717.html
for more details.

llvm-svn: 37724
2007-06-25 23:46:54 +00:00
Chris Lattner
ea5c4bd51c fix Transforms/Inline/2007-06-25-WeakInline.ll by not inlining functions
with weak linkage.

llvm-svn: 37723
2007-06-25 21:50:09 +00:00
Chris Lattner
b2a9048dc4 new testcase, the inliner shouldn't inline this.
llvm-svn: 37722
2007-06-25 21:49:53 +00:00
Owen Anderson
43ca4b48f1 Use the built-in postorder iterators rather than computing a postorder walk by hand.
llvm-svn: 37721
2007-06-25 18:25:31 +00:00
Reid Spencer
36d4c07500 Fix PR1525:
Use a better determinator for identifying constant array initializers that
are or are not zero terminated and generate code appropriately.

llvm-svn: 37720
2007-06-25 16:45:54 +00:00
Dan Gohman
a866514528 Generalize MVT::ValueType and associated functions to be able to represent
extended vector types. Remove the special SDNode opcodes used for pre-legalize
vector operations, and the special MVT::Vector type used with them. Adjust
lowering and legalize to work with the normal SDNode kinds instead, and to
use the normal MVT functions to work with vector types instead of using the
two special operands that the pre-legalize nodes held.

This allows pre-legalize and post-legalize DAGs, and the code that operates
on them, to be more consistent. Pre-legalize vector operators can be handled
more consistently with scalar operators. And, -view-dag-combine1-dags and
-view-legalize-dags now look prettier for vector code.

llvm-svn: 37719
2007-06-25 16:23:39 +00:00
Dan Gohman
2e84e3f7b7 Make minor adjustments to whitespace and comments to reduce differences
between SSE1 instructions and their respective SSE2 analogues.

llvm-svn: 37718
2007-06-25 15:44:19 +00:00
Dan Gohman
33209bd6b8 Fix loadv2i32 to be loadv4i32, though it isn't actually used anywhere yet.
llvm-svn: 37717
2007-06-25 15:19:03 +00:00
Dan Gohman
e33c4b739b Say AT&T instead of Intel in the comments for AT&T support.
llvm-svn: 37716
2007-06-25 15:11:25 +00:00
Anton Korobeynikov
ec9038bc69 Provide hook for alloca on VCPP. Patch by Scott Graham
llvm-svn: 37715
2007-06-25 07:12:14 +00:00
Owen Anderson
191eb06352 1) Fix an issue with non-deterministic iteration order in phi_translate
2) Remove some maximal-set computing code that is no longer used.
3) Use a post-order CFG traversal to compute ANTIC_IN instead of a postdom traversal.
This causes the ANTIC_IN calculation to converge much faster.  Thanks to Daniel Berlin for suggesting this.

With this patch, the time to optimize 403.gcc decreased from 17.5s to 7.5s, and Anton's huge
testcase decreased from 62 minutes to 38 seconds.

llvm-svn: 37714
2007-06-25 05:41:12 +00:00
Nick Lewycky
8735f44104 Fix value ranges.
llvm-svn: 37713
2007-06-24 20:14:22 +00:00
Owen Anderson
7fb6da8e4d Fix a silly mistake that was causing failures.
llvm-svn: 37712
2007-06-24 08:42:24 +00:00
Owen Anderson
bfd1673366 Rename variables to expose the fact that this test is failing.
llvm-svn: 37711
2007-06-24 08:17:41 +00:00
Nick Lewycky
0f986fdbfa Remove tabs.
llvm-svn: 37710
2007-06-24 04:40:16 +00:00
Nick Lewycky
26e25d340e Remove use of ETForest. Also cleaned up issues around unreachable basic
blocks, and optimizing within one basic block.

llvm-svn: 37709
2007-06-24 04:36:20 +00:00
Owen Anderson
49409f6501 Rework topo_sort so eliminate some behavior that scaled terribly. This reduces the time to optimize 403.gcc from 18.2s to 17.5s,
and has an even larger effect on larger testcases.

llvm-svn: 37708
2007-06-22 21:31:16 +00:00
Owen Anderson
21a1131565 Perform fewer set insertions while calculating ANTIC_IN. This reduces the amount of time to optimize 403.gcc from 21.9s to 18.2s.
llvm-svn: 37707
2007-06-22 18:27:04 +00:00
Owen Anderson
92c7b22e1a Remove some code that I was using for collecting performance information that should not have been committed.
llvm-svn: 37706
2007-06-22 17:04:40 +00:00
Owen Anderson
0c550df9d2 Fix the build.
llvm-svn: 37705
2007-06-22 16:59:54 +00:00
Dan Gohman
309d3d51b3 Move ComputeMaskedBits, MaskedValueIsZero, and ComputeNumSignBits from
TargetLowering to SelectionDAG so that they have more convenient
access to the current DAG, in preparation for the ValueType routines
being changed from standalone functions to members of SelectionDAG for
the pre-legalize vector type changes.

llvm-svn: 37704
2007-06-22 14:59:07 +00:00
Duraid Madina
81a752aa95 check in the BigBlock local register allocator
llvm-svn: 37703
2007-06-22 08:27:12 +00:00
Owen Anderson
f6e21871ad Avoid excessive calls to find_leader when calculating AVAIL_OUT. This reduces the time to optimize 403.gcc from 23.5s to 21.9s.
llvm-svn: 37702
2007-06-22 03:14:03 +00:00
Evan Cheng
e3c4419953 std::set is really really terrible. Switch to SmallPtrSet to reduce compile time. For Duraid's example. The overall isel time is reduced from 0.6255 sec to 0.1876 sec.
llvm-svn: 37701
2007-06-22 01:35:51 +00:00
Dale Johannesen
485531ea9b Quote complex names for Darwin X86 and ARM.
llvm-svn: 37700
2007-06-22 00:54:56 +00:00
Owen Anderson
d50a29d613 Reserve space in vectors before topologically sorting into them. This improves the time to optimize 403.gcc from 28s to 23.5s.
llvm-svn: 37699
2007-06-22 00:43:22 +00:00
Owen Anderson
28a2d449fa Make a bunch of optimizations for compile time to GVNPRE, including smarter set unions, deferring blocks rather than computing maximal sets, and smarter use of sets. With these enhancements, the time to optimize 273.perlbmk goes from 5.3s to 2.7s.
llvm-svn: 37698
2007-06-22 00:20:30 +00:00
Owen Anderson
6d7b6f1ab8 Fix a bug in SmallPtrSet that was causing GVNPRE to enter an infinite loop.
llvm-svn: 37697
2007-06-22 00:11:18 +00:00
Chris Lattner
836e8f3f39 Two changes:
1. Make SmallPtrSet::erase faster in the small case by replacing a memmove
    with a pointer copy.
 2. Fix a bug where the null terminator at the end of the array in the small
    case was not copied

llvm-svn: 37696
2007-06-21 23:23:32 +00:00
Devang Patel
703de8fea8 CallGraphSCCPass manager may require other passes.
Use schedulePass() to accomodate these requirement instead of directly
assigning a manager to new CallGraph PassManager.

llvm-svn: 37695
2007-06-21 22:29:02 +00:00
Owen Anderson
7c3a5513f7 Have internal df_iterator's use SmallPtrSet instead of std::set. This provides compile time speedups to any pass using df_iterator.
llvm-svn: 37694
2007-06-21 21:25:36 +00:00
Evan Cheng
e15ea75168 Fix tests.
llvm-svn: 37693
2007-06-21 18:22:42 +00:00
Chris Lattner
fb032b176b Significantly improve the documentation of the instcombine divide/compare
transformation.  Also, keep track of which end of the integer interval overflows
occur on.  This fixes Transforms/InstCombine/2007-06-21-DivCompareMiscomp.ll
and rdar://5278853, a miscompilation of perl.

llvm-svn: 37692
2007-06-21 18:11:19 +00:00
Chris Lattner
181ebd6f88 new testcase miscompiled by instcombine, reduced from perl
llvm-svn: 37691
2007-06-21 18:09:25 +00:00
Owen Anderson
2ff912bf33 Change lots of sets from std::set to SmallPtrSet. This reduces the time required to optimize 253.perlbmk from 10.9s to 5.3s.
llvm-svn: 37690
2007-06-21 17:57:53 +00:00
Devang Patel
d5258a23a5 Move code to update dominator information after basic block is split
from LoopSimplify.cpp to Dominator.cpp

llvm-svn: 37689
2007-06-21 17:23:45 +00:00
Dan Gohman
8e8d34b220 Tidy up ValueType names in comments.
llvm-svn: 37688
2007-06-21 14:48:26 +00:00
Dan Gohman
04deef3a49 Rename TargetLowering::getNumElements and friends to
TargetLowering::getNumRegisters and similar, to avoid confusion with
the actual number of elements for vector types.

llvm-svn: 37687
2007-06-21 14:42:22 +00:00
Evan Cheng
5fcb5a5c74 New tests.
llvm-svn: 37686
2007-06-21 07:40:00 +00:00
Evan Cheng
aa5f5d960d Xforms:
(add (select cc, 0, c), x) -> (select cc, x, (add, x, c))
(sub x, (select cc, 0, c)) -> (select cc, x, (sub, x, c))

llvm-svn: 37685
2007-06-21 07:39:16 +00:00
Owen Anderson
27876a3ff9 Eliminate a redundant check. This speeds up optimization of 253.perlbmk from 13.5 seconds to 10.9 seconds.
llvm-svn: 37683
2007-06-21 01:59:05 +00:00
Owen Anderson
fd5683ad7a Comment-ize the functions in GVNPRE.
llvm-svn: 37681
2007-06-21 00:19:05 +00:00
Chris Lattner
3bbec59e8b refactor a bunch of code out of visitICmpInstWithInstAndIntCst into its own
routine.

llvm-svn: 37679
2007-06-20 23:46:26 +00:00
Owen Anderson
06c1e585c9 Split runOnFunction into many smaller functions. This make it easier to get accurate performance analysis of GVNPRE.
llvm-svn: 37678
2007-06-20 22:10:02 +00:00
Tanya Lattner
872bf1bdc3 Modify deleting global variable with an even easier way.
llvm-svn: 37676
2007-06-20 20:46:37 +00:00
Devang Patel
eeff910244 Update AnalysisGroup documentation to document restriction that allows
only one ImmutablePass in a group.

llvm-svn: 37675
2007-06-20 18:51:14 +00:00
Tanya Lattner
1a08cf311e Add blurb on deleting global variables.
llvm-svn: 37674
2007-06-20 18:33:15 +00:00
Owen Anderson
b0714bb7bb Make GVNPRE accurate report whether it modified the function or not.
llvm-svn: 37673
2007-06-20 18:30:20 +00:00
Evan Cheng
85010166a6 Added some if-conversion tests.
llvm-svn: 37672
2007-06-20 18:26:15 +00:00
Owen Anderson
7b0fb44ca9 Get rid of an unneeded helper function.
llvm-svn: 37670
2007-06-20 00:43:33 +00:00
Evan Cheng
77d61e6f6d Be more conservative of duplicating blocks.
llvm-svn: 37669
2007-06-19 23:55:02 +00:00
Owen Anderson
1ad2c10215 Use a DenseMap instead of an std::map for the value numbering. This reduces the time to optimize lencod on a PPC Debug build from ~300s to ~140s.
llvm-svn: 37668
2007-06-19 23:23:54 +00:00
Owen Anderson
2320d430bd Make dependsOnInvoke much more specific in what it tests, which in turn make it much faster to run. This reduces the time to optimize lencondwith a debug build on PPC from ~450s to ~300s.
llvm-svn: 37667
2007-06-19 23:07:16 +00:00
Tanya Lattner
c655839d71 Moved Inliner.h to include/llvm/Transforms/IPO/InlinerPass.h
llvm-svn: 37666
2007-06-19 22:31:52 +00:00
Tanya Lattner
ab11b1c702 Inliner pass header file was moved.
llvm-svn: 37665
2007-06-19 22:29:50 +00:00
Tanya Lattner
39be2d896d Move inliner pass header file.
llvm-svn: 37664
2007-06-19 22:29:02 +00:00
Evan Cheng
a955c02c9b Avoid if-converting simple block that ends with unconditional branch or fallthrough unless it branches / falls to the 'false' block. Not profitable, may end up increasing code size.
llvm-svn: 37660
2007-06-19 21:45:13 +00:00
Evan Cheng
c3c949b473 Allow predicated immediate ARM to ARM calls.
llvm-svn: 37659
2007-06-19 21:05:09 +00:00
Chris Lattner
cd74c3ea7c Fix pr1448
llvm-svn: 37658
2007-06-19 16:46:48 +00:00
Dan Gohman
32f53bbd85 Rename ScalarEvolution::deleteInstructionFromRecords to
deleteValueFromRecords and loosen the types to all it to accept
Value* instead of just Instruction*, since this is what
ScalarEvolution uses internally anyway. This allows more flexibility
for future uses.

llvm-svn: 37657
2007-06-19 14:28:31 +00:00
Dan Gohman
a7644dd9b9 Pass a SelectionDAG into SDNode::dump everywhere it's used, in prepration
for needing the DAG node to print pre-legalize extended value types, and
to get better debug messages with target-specific nodes.

llvm-svn: 37656
2007-06-19 14:13:56 +00:00
Owen Anderson
1370faf889 Handle constants in phi nodes properly. This fixes test/Transforms/GVNPRE/2007-06-18-ConstantInPhi.ll
llvm-svn: 37655
2007-06-19 07:35:36 +00:00
Chris Lattner
b4777f087a silence warning when assertions are disabled.
llvm-svn: 37654
2007-06-19 06:40:46 +00:00
Owen Anderson
0b7c12be82 Testcase for instances where a constant only occurs as an operand to a phi node.
llvm-svn: 37653
2007-06-19 05:55:01 +00:00
Chris Lattner
5551482f16 don't use binutils 2.17
llvm-svn: 37652
2007-06-19 05:52:36 +00:00
Chris Lattner
37228f6ce5 document and hide two options.
llvm-svn: 37651
2007-06-19 05:47:49 +00:00
Chris Lattner
7936d91f70 describe an argument, hide it.
llvm-svn: 37650
2007-06-19 05:46:06 +00:00
Chris Lattner
09a33a4f64 silence a bogus warning Duraid ran into.
llvm-svn: 37649
2007-06-19 05:43:49 +00:00
Owen Anderson
3552c9e845 Add a new testcase for memory corruption issues.
llvm-svn: 37648
2007-06-19 05:41:22 +00:00
Owen Anderson
91c54950b3 Be careful to erase values from all of the appropriate sets when they're not needed anymore. This fixes a few more memory-related issues.
llvm-svn: 37647
2007-06-19 05:37:32 +00:00
Owen Anderson
b9cbaed623 Remember to clear the maximal sets between functions.
Thanks to Nicholas for valgrinding this.

llvm-svn: 37646
2007-06-19 04:32:55 +00:00
Owen Anderson
b56fba0c5a Refactor GVNPRE to use a much smart method of uniquing value sets, and centralize a lot of the value numbering information. No functionality change.
llvm-svn: 37645
2007-06-19 03:31:41 +00:00
Dan Gohman
9e82064924 Replace M_REMATERIALIZIBLE and the newly-added isOtherReMaterializableLoad
with a general target hook to identify rematerializable instructions. Some
instructions are only rematerializable with specific operands, such as loads
from constant pools, while others are always rematerializable. This hook
allows both to be identified as being rematerializable with the same
mechanism.

llvm-svn: 37644
2007-06-19 01:48:05 +00:00
Evan Cheng
a7ca624028 Replace TargetInstrInfo::CanBeDuplicated() with a M_NOT_DUPLICABLE bit.
llvm-svn: 37643
2007-06-19 01:26:51 +00:00
Evan Cheng
7d5696860b Replace CanBeDuplicated() with a M_NOT_DUPLICABLE bit.
llvm-svn: 37642
2007-06-19 01:21:41 +00:00
Chris Lattner
944200be45 If a function is vararg, never pass inreg arguments in registers. Thanks to
Anton for half of this patch.

llvm-svn: 37641
2007-06-19 00:13:10 +00:00
Chris Lattner
26be02febf add isVarArg to CCState
llvm-svn: 37640
2007-06-19 00:11:09 +00:00
Chris Lattner
f401b2b4c3 add isvararg tracking to CCState
llvm-svn: 37639
2007-06-19 00:10:25 +00:00
Chris Lattner
f2b72bf921 testcase for PR1513
llvm-svn: 37638
2007-06-19 00:08:42 +00:00
Evan Cheng
6ba3e8b27d New test case: identity operation of RHS / LHS of a VECTOR_SHUFFLE.
llvm-svn: 37637
2007-06-19 00:06:08 +00:00
Evan Cheng
cea02ffd05 Look for VECTOR_SHUFFLE that's identity operation on either LHS or RHS. This can happen before DAGCombiner catches it.
llvm-svn: 37636
2007-06-19 00:02:56 +00:00
Tanya Lattner
bed1d4d877 Update docs for llvm.var.annotation intrinsic.
llvm-svn: 37635
2007-06-18 23:42:37 +00:00
Evan Cheng
0598b2d5eb Fix some fragile code wrt CFG edge updating.
llvm-svn: 37634
2007-06-18 22:44:57 +00:00
Evan Cheng
2afd702c20 Move CorrectExtraCFGEdges() from BranchFolding.cpp to a MachineBasicBlock method.
llvm-svn: 37633
2007-06-18 22:43:58 +00:00
Tanya Lattner
aab2200844 Modify annotate intrinsic to take 2 additional args: file and line number.
Fix up Annotate attribute test case.
Fix DebugFilename.c test case to look for right file name.

llvm-svn: 37632
2007-06-18 22:23:39 +00:00
Chris Lattner
b4f2d8a056 add helper
llvm-svn: 37631
2007-06-18 21:50:49 +00:00
Devang Patel
d56e4919df Fix quotes in debug messages.
llvm-svn: 37630
2007-06-18 21:32:29 +00:00
Chris Lattner
e31adc8ab9 make ComputeTopDownOrdering significantly faster and use less stack space
by making it non-recursive

llvm-svn: 37629
2007-06-18 21:28:10 +00:00
Dan Gohman
eed125f315 In SCEVAddExpr::get, skip over any cast operands before looking for nested
add operands after constant operands. The recent change to recognize
sign-extend expressions caused this to be exposed more often.

llvm-svn: 37628
2007-06-18 19:30:09 +00:00
Anton Korobeynikov
02b0997b28 Make BasicAliasAnalysis correctly register itself. Patch by Devang
llvm-svn: 37627
2007-06-18 17:13:29 +00:00
Dan Gohman
8c7333266c Make chain dependencies blue, in addition to being dashed.
llvm-svn: 37626
2007-06-18 15:30:16 +00:00
Dan Gohman
c98815ba32 Define the pushq instruction for x86-64.
llvm-svn: 37625
2007-06-18 14:12:56 +00:00
Dan Gohman
03a7e5368a Add keyword explicit.
llvm-svn: 37624
2007-06-18 14:11:31 +00:00
Evan Cheng
51eb2c3bbe Properly remove duplicate instructions as result of diamond if-conversion. Other bug fixes.
llvm-svn: 37623
2007-06-18 08:37:25 +00:00
Owen Anderson
dd998e1913 Cache the results of dependsOnInvoke()
llvm-svn: 37622
2007-06-18 04:42:29 +00:00
Owen Anderson
f1c04e1ddb Fix indentation.
llvm-svn: 37621
2007-06-18 04:31:21 +00:00
Owen Anderson
b364b413af Don't perform an expensive check if it's not necessary.
llvm-svn: 37620
2007-06-18 04:30:44 +00:00
Chris Lattner
5f232faf8c ensure we don't regress on these tests. We generate aweful code in x86-32 for
these though.

llvm-svn: 37619
2007-06-17 23:29:57 +00:00
Bill Wendling
ec6be07c22 XFAILing until I can fix properly.
llvm-svn: 37618
2007-06-16 23:57:51 +00:00
Bill Wendling
094a4e813a Revert patch. It regresses:
define double @test2(i64 %A) {
   %B = bitcast i64 %A to double
   ret double %B
}

$ llvm-as < t.ll | llc -march=x86-64

before:

         .align  4
         .globl  _test2
_test2:
         movd %rdi, %xmm0
         ret

after:

_test2:
         subq $8, %rsp
         movq %rdi, (%rsp)
         movsd (%rsp), %xmm0
         addq $8, %rsp
         ret

llvm-svn: 37617
2007-06-16 23:57:15 +00:00
Reid Spencer
1aae9e8e12 Fix PR1517:
Use SmallPtrSet instead of std::vector to eliminate duplicate uses in a
function generated with -gen-function. This prevents the output from having
multiple duplicate declarations of constants and gvals.

llvm-svn: 37616
2007-06-16 20:48:27 +00:00
Reid Spencer
83c15f8a1b Fix PR1516:
When printing the uses of a function (-gen-function only), make sure to
include the constants referenced by intializers of global variables.

llvm-svn: 37615
2007-06-16 20:33:24 +00:00
Nick Lewycky
7aa84fe7c5 Call the correct function name. Patch from Stephane Letz.
llvm-svn: 37614
2007-06-16 16:17:35 +00:00
Evan Cheng
3a51c854d0 Really turn if-converter loose:
1. Consider all possible ifcvt cases at once. No longer restricted to bottom
   up iterative approach.
2. Sort all possible cases based on a cost function. Perform the most profitable
   ones first invalidate others that target the same blocks.
3. Fixed a number of bugs related to block duplication.

llvm-svn: 37613
2007-06-16 09:34:52 +00:00
Bill Wendling
c8f293b4f9 Testcase for MMX int to MMX register failure.
llvm-svn: 37612
2007-06-16 06:31:47 +00:00
Bill Wendling
cd9673e565 Fix a failure to bit_convert from integer GPR to MMX register.
llvm-svn: 37611
2007-06-16 06:17:31 +00:00
Owen Anderson
658f2c4881 Fix test/Transforms/GVNPRE/2007-06-15-InvokeInst.ll by ignoring all instructions that depend on invokes.
llvm-svn: 37610
2007-06-16 00:26:54 +00:00
Owen Anderson
d2028a549f Testcase where GVNPRE was getting confused by invoke instructions.
llvm-svn: 37609
2007-06-16 00:25:10 +00:00
Tanya Lattner
e199f97fa8 Codegen support (stripped out) for the annotate attribute.
llvm-svn: 37608
2007-06-15 22:26:58 +00:00
Evan Cheng
23402fcaef Not every predicable block can be safely duplicated.
llvm-svn: 37607
2007-06-15 21:18:05 +00:00
Evan Cheng
36b1f5476e Instructions with unique labels or embedded jumptables cannot be duplicated during ifcvt.
llvm-svn: 37606
2007-06-15 21:15:00 +00:00
Evan Cheng
297d43be00 Added CanBeDuplicated(). It returns true if an instruction can be safely duplicated (e.g. during ifcvt).
llvm-svn: 37605
2007-06-15 21:13:54 +00:00
Tanya Lattner
a575a7dfda test case for annotate attribute
llvm-svn: 37604
2007-06-15 20:52:47 +00:00
Tanya Lattner
cb1b96047d Add local var annotation intrinsic.
llvm-svn: 37603
2007-06-15 20:50:54 +00:00
Dan Gohman
00cb117b07 Fold a binary operator with constant operands when expanding code for a SCEV.
llvm-svn: 37602
2007-06-15 19:21:55 +00:00
Chris Lattner
f852e339b6 Fix CodeGen/X86/inline-asm-x-scalar.ll:test4, by retaining regclass info
for tied register constraints.

llvm-svn: 37601
2007-06-15 19:11:01 +00:00
Chris Lattner
2d7f447a7a make this test harder, include a tied register.
llvm-svn: 37600
2007-06-15 19:09:53 +00:00
Evan Cheng
234a90e83e MachineInstr::isPredicable() is no longer needed.
llvm-svn: 37599
2007-06-15 19:06:07 +00:00
Evan Cheng
32312ad370 No longer needed.
llvm-svn: 37598
2007-06-15 19:05:13 +00:00
Duncan Sands
92bf2c628c Workaround for PR1508.
llvm-svn: 37597
2007-06-15 19:04:19 +00:00
Dan Gohman
203a035251 Use SCEVConstant::get instead of SCEVUnknown::get to create an
integer constant SCEV.

llvm-svn: 37596
2007-06-15 18:00:55 +00:00
Owen Anderson
acaed06827 Fix test/Transforms/GVNPRE/2007-06-15-Looping.ll
llvm-svn: 37595
2007-06-15 17:55:15 +00:00
Owen Anderson
ad9743225e Add a testcase where GVNPRE what getting confused by a loop.
llvm-svn: 37594
2007-06-15 17:54:05 +00:00
Evan Cheng
cd5f5e3ecd Extra edges are deleted later if needed.
llvm-svn: 37593
2007-06-15 17:34:48 +00:00
Duncan Sands
8e21e69efb Use "ignore" rather than grep tricks.
llvm-svn: 37592
2007-06-15 17:13:53 +00:00
Dan Gohman
cb9e09ad57 Add a SCEV class and supporting code for sign-extend expressions.
This created an ambiguity for expandInTy to decide when to use
sign-extension or zero-extension, but it turns out that most of its callers
don't actually need a type conversion, now that LLVM types don't have
explicit signedness. Drop expandInTy in favor of plain expand, and change
the few places that actually need a type conversion to do it themselves.

llvm-svn: 37591
2007-06-15 14:38:12 +00:00
Evan Cheng
92fb5453c3 Allow small blocks to be duplicated to enable if-conversion.
llvm-svn: 37590
2007-06-15 07:36:12 +00:00
Chris Lattner
373389260f Generalize many transforms to work on ~ of vectors in addition to ~ of
integer ops.  This implements Transforms/InstCombine/and-or-not.ll
test3/test4, and finishes off PR1510

llvm-svn: 37589
2007-06-15 06:23:19 +00:00
Chris Lattner
9923af42cf add vector versions of this test
llvm-svn: 37588
2007-06-15 06:22:32 +00:00
Chris Lattner
ce4d2dd644 m_not should match vector not
llvm-svn: 37587
2007-06-15 06:13:47 +00:00
Chris Lattner
72e3958003 add a Constant::getAllOnesValue helper function, which works on integers
AND vectors.

llvm-svn: 37586
2007-06-15 06:10:53 +00:00
Chris Lattner
1edec381a5 Enhance BinaryOperator::isNot to support vector not.
llvm-svn: 37585
2007-06-15 06:04:24 +00:00
Chris Lattner
481e28b1f5 Implement two xforms:
1. ~(~X | Y) === (X & ~Y)
2. (A|B) & ~(A&B) -> A^B

This allows us to transform  ~(~(a|b) | (a&b)) -> a^b.

This implements PR1510 for scalar values.

llvm-svn: 37584
2007-06-15 05:58:24 +00:00
Chris Lattner
a8de4cccd9 testcase for PR1510
llvm-svn: 37583
2007-06-15 05:57:20 +00:00
Chris Lattner
f14e5175ed delete some obviously dead vector operations, which deletes a few thousand
operations from Duraids example.

llvm-svn: 37582
2007-06-15 05:26:55 +00:00
Evan Cheng
add977670f No really, clear predcessors states.
llvm-svn: 37581
2007-06-14 23:34:09 +00:00
Evan Cheng
9fc56c079d If BB is predicated, invalidate its predecessor(s) which would if-convert it. It needs to be re-analyzed.
llvm-svn: 37580
2007-06-14 23:13:19 +00:00
Dan Gohman
5c4413120f Rename MVT::getVectorBaseType to MVT::getVectorElementType.
llvm-svn: 37579
2007-06-14 22:58:02 +00:00
Dale Johannesen
616627b002 Do not treat FP_REG_KILL as terminator in branch analysis (X86).
llvm-svn: 37578
2007-06-14 22:03:45 +00:00
Evan Cheng
e08f0eefa6 Fix typo.
llvm-svn: 37577
2007-06-14 21:26:08 +00:00
Dan Gohman
4a4a8eb00e Add a target hook to allow loads from constant pools to be rematerialized, and an
implementation for x86.

llvm-svn: 37576
2007-06-14 20:50:44 +00:00
Evan Cheng
1e6f08b2a2 Fix some stupid bugs that have effectively disabled if-conversion.
llvm-svn: 37575
2007-06-14 20:28:52 +00:00
Dan Gohman
3a8e2a8b2f Eliminate some redundant newlines in asm output.
llvm-svn: 37574
2007-06-14 15:00:27 +00:00
Duncan Sands
40f775bf67 Fix typos.
llvm-svn: 37573
2007-06-14 11:27:07 +00:00
Christopher Lamb
f274efef9f Add support to tablegen for specifying subregister classes on a per register class basis.
llvm-svn: 37572
2007-06-13 22:20:15 +00:00
Dale Johannesen
c68554683d Handle blocks with 2 unconditional branches in AnalyzeBranch.
llvm-svn: 37571
2007-06-13 17:59:52 +00:00
Duncan Sands
7413736a7e Only correctly lower exception handing intrinsics if exception handling is
turned on.  Likewise for scanning of invokes to mark landing pads.

llvm-svn: 37570
2007-06-13 16:53:21 +00:00
Dan Gohman
26455c4ae0 Introduce new SelectionDAG node opcodes VEXTRACT_SUBVECTOR and
VCONCAT_VECTORS. Use these for CopyToReg and CopyFromReg legalizing in
the case that the full register is to be split into subvectors instead
of scalars. This replaces uses of VBIT_CONVERT to present values as
vector-of-vector types in order to make whole subvectors accessible via
BUILD_VECTOR and EXTRACT_VECTOR_ELT.

This is in preparation for adding extended ValueType values, where
having vector-of-vector types is undesirable.

llvm-svn: 37569
2007-06-13 15:12:02 +00:00
Dan Gohman
cbd51c8b60 When creating CopyFromReg nodes, always use legal types. And use the
correct types for the result vector, even though it is currently bitcasted
to a different type immediately.

llvm-svn: 37568
2007-06-13 14:55:16 +00:00
Duncan Sands
97f7236e70 The fix that was applied for PR1224 stops the compiler
crashing but breaks exception handling.  The problem
described in PR1224 is that invoke is a terminator that
can produce a value.  The value may be needed in other
blocks.  The code that writes to registers values needed
in other blocks runs before terminators are lowered (in
this case invoke) so asserted because the value was not
yet available.  The fix that was applied was to do invoke
lowering earlier, before writing values to registers.

The problem this causes is that the code to copy values
to registers can be output after the invoke call.  If
an exception is raised and control is passed to the
landing pad then this copy-code will never execute.  If
the value is needed in some code path reached via the
landing pad then that code will get something bogus.

So revert the original fix and simply skip invoke values
in the general copying to registers code.  Instead copy
the invoke value to a register in the invoke lowering code.

llvm-svn: 37567
2007-06-13 05:51:31 +00:00
Evan Cheng
cbaaff58bf Typo
llvm-svn: 37566
2007-06-13 00:04:00 +00:00
Evan Cheng
9acfa7b063 Now if-converting all 4 variants of triangles.
llvm-svn: 37565
2007-06-12 23:54:05 +00:00
Owen Anderson
4036ad485f Fix test/Transforms/GVNPRE/2007-06-12-PhiTranslate.ll
llvm-svn: 37564
2007-06-12 22:43:57 +00:00
Owen Anderson
b1c82db828 Add a test where phi translation was producing a null result.
llvm-svn: 37563
2007-06-12 22:42:35 +00:00
Devang Patel
149a7616dc isReachableFromEntry() is not suitable for post dominator.
llvm-svn: 37562
2007-06-12 17:50:25 +00:00
Devang Patel
47419ee142 Remove redundant check.
llvm-svn: 37561
2007-06-12 17:35:20 +00:00
Devang Patel
2f9d2bcb19 Protect updateDFSNumbers()
llvm-svn: 37560
2007-06-12 17:30:56 +00:00
Devang Patel
dcf0c03ff7 Check A dominates B and vise versa first while searching for nearest
common dominator.

llvm-svn: 37559
2007-06-12 17:17:57 +00:00
Chris Lattner
2150cde0e4 one final bugfix
llvm-svn: 37558
2007-06-12 17:01:15 +00:00
Chris Lattner
2b0bf4fc3b modernize example
llvm-svn: 37557
2007-06-12 17:00:26 +00:00
Owen Anderson
4276984012 Refactor some code, and fix test/Transforms/GVNPRE/2007-06-12-NoExit.ll by being more careful when using
post-dominator information.

llvm-svn: 37556
2007-06-12 16:57:50 +00:00
Owen Anderson
6d1df658c0 Testcase where GVNPRE crashes on functions with no exit nodes.
llvm-svn: 37555
2007-06-12 16:56:00 +00:00
Dale Johannesen
edfec0b515 Sink CmpInst's to their uses to reduce register pressure.
llvm-svn: 37554
2007-06-12 16:50:17 +00:00
Devang Patel
e87776a7cb Make DFS number manipulation methods private.
llvm-svn: 37553
2007-06-12 05:49:31 +00:00
Owen Anderson
3c0c1376ea Make the run line for this test correct. Thanks to Chris for spotting it.
llvm-svn: 37552
2007-06-12 04:40:48 +00:00
Devang Patel
a6ff5bf9ba Break DominatorTree from ETNode.
Remove unused PostETForest.

llvm-svn: 37551
2007-06-12 00:54:38 +00:00
Owen Anderson
a75dd4dc56 Fix a few more bugs, including an instance of walking in reverse topological rather than topological order. This
fixes a testcase extracted from llvm-test.

llvm-svn: 37550
2007-06-12 00:50:47 +00:00
Owen Anderson
ee35eab57f Add a GVN-PRE basic regression test.
llvm-svn: 37549
2007-06-12 00:49:33 +00:00
Devang Patel
d324360352 Use SmallPtrSet instaed of std::set
llvm-svn: 37548
2007-06-12 00:40:51 +00:00
Devang Patel
9576fac800 Check immediate dominators first while searching for nearset common dominator.
Fix 80 col violations.

llvm-svn: 37547
2007-06-12 00:35:38 +00:00
Devang Patel
88ea2dbc68 Maintain DFS number in DomTreeNode itself.
This means now ETNodes are not useful anymore.

llvm-svn: 37546
2007-06-12 00:14:41 +00:00
Devang Patel
78b9c68164 Add and use DominatorTreeBase::findNearestCommonDominator().
llvm-svn: 37545
2007-06-11 23:31:22 +00:00
Lauro Ramos Venancio
4c2f003971 Fix a typo in bswap lowering.
llvm-svn: 37544
2007-06-11 23:16:16 +00:00
Evan Cheng
4dd31a7b1b Restructure code to reduce ifcvt compile time cost.
llvm-svn: 37543
2007-06-11 22:26:22 +00:00
Devang Patel
536ac4dca7 Simplify.
llvm-svn: 37542
2007-06-11 21:45:31 +00:00
Devang Patel
d18054afcf simplify
llvm-svn: 37541
2007-06-11 21:25:31 +00:00
Devang Patel
ab2eee89a4 Simplify. Dominator Tree is required so always available.
llvm-svn: 37540
2007-06-11 21:18:00 +00:00
Owen Anderson
d184c18074 Handle functions with multiple exit blocks properly.
llvm-svn: 37539
2007-06-11 16:25:17 +00:00
Devang Patel
c43f32b935 Use DominatorTree instead of ETForest.
llvm-svn: 37538
2007-06-11 15:40:48 +00:00
Reid Spencer
14b62a553e Fix the build.
llvm-svn: 37537
2007-06-10 00:19:17 +00:00
Owen Anderson
223718c40e Perform PRE of comparison operators.
llvm-svn: 37536
2007-06-09 18:35:31 +00:00
Chris Lattner
e359887116 rename C files to end with .c
llvm-svn: 37535
2007-06-09 06:10:47 +00:00
Chris Lattner
75372ad603 fix x86-64 mmx calling convention for real, which passes in integer gprs.
llvm-svn: 37534
2007-06-09 05:08:10 +00:00
Chris Lattner
a4a49e37ab fix mmx handling bug
llvm-svn: 37533
2007-06-09 05:01:50 +00:00
Nick Lewycky
d18b16034a Fix edge case.
llvm-svn: 37532
2007-06-09 04:20:33 +00:00
Evan Cheng
2117d1f20e Don't change CFG during analysis stage. Do so during ifcvt and invalidate predecessors accordingly.
llvm-svn: 37531
2007-06-09 01:03:43 +00:00
Owen Anderson
7d76b2a774 Collect statistics from GVN-PRE.
llvm-svn: 37530
2007-06-08 22:02:36 +00:00
Evan Cheng
288f1545a6 Carefully remove extraneous CFG edges after each ifcvt.
llvm-svn: 37529
2007-06-08 22:01:07 +00:00
Evan Cheng
5514bbef46 Add a utility routine to check for unpredicated terminator instruction.
llvm-svn: 37528
2007-06-08 21:59:56 +00:00
Lauro Ramos Venancio
c7ebbaa10e Define AsmTransCBE for ARM.
llvm-svn: 37527
2007-06-08 21:06:23 +00:00
Owen Anderson
b232efaf48 Fix typo in a comment.
llvm-svn: 37526
2007-06-08 20:57:08 +00:00
Owen Anderson
55994f2453 Fix a bug that was causing the elimination phase not to replace values when it should be.
With this patch, GVN-PRE now correctly optimizes the example from the thesis.

Many thanks to Daniel Berlin for helping me find errors in this.

llvm-svn: 37525
2007-06-08 20:44:02 +00:00
Evan Cheng
df1a42935b Correct transfer predicate information.
llvm-svn: 37524
2007-06-08 19:17:12 +00:00
Evan Cheng
e93ccc013f Hidden options to help debugging ifcvt issues.
llvm-svn: 37523
2007-06-08 19:10:51 +00:00
Devang Patel
082c6ae383 Fix spelling.
llvm-svn: 37522
2007-06-08 17:59:02 +00:00
David Greene
a0bb97c848 Add entry to CREDITS.
llvm-svn: 37521
2007-06-08 17:20:08 +00:00
David Greene
02f6e9b621 Factor live variable analysis so it does not do register coalescing
simultaneously.  Move that pass to SimpleRegisterCoalescing.

This makes it easier to implement alternative register allocation and
coalescing strategies while maintaining reuse of the existing live
interval analysis.

llvm-svn: 37520
2007-06-08 17:18:56 +00:00
Chris Lattner
a59fb10de8 wording fix noticed by Ivan Novick
llvm-svn: 37519
2007-06-08 16:52:14 +00:00
Evan Cheng
7783f82e21 Allow more cmp / bcc to be predicated; clean up triangle ifcvt checking code.
llvm-svn: 37518
2007-06-08 09:36:04 +00:00
Evan Cheng
6740da9407 Fix ARM condition code subsumission check.
llvm-svn: 37517
2007-06-08 09:14:47 +00:00
Evan Cheng
f62a5afb98 tBcc is not a barrier.
llvm-svn: 37516
2007-06-08 09:13:23 +00:00
Duncan Sands
dc8fc1550e Use more realistically sized vectors. Reserve capacity if we know in advance
how much will be used.

llvm-svn: 37515
2007-06-08 08:59:11 +00:00
Owen Anderson
2e5efc30c2 Small bugfix, and const-ify some methods (Thanks, Bill).
llvm-svn: 37513
2007-06-08 01:52:45 +00:00
Devang Patel
becc466451 Update LoopSimplify to require and preserve DominatorTree only.
Now LoopSimplify does not require nor preserve ETForest.

llvm-svn: 37512
2007-06-08 01:50:32 +00:00
Dale Johannesen
86798e5e11 Make throttle a hidden parameter, per review.
llvm-svn: 37511
2007-06-08 01:08:52 +00:00
Owen Anderson
be80240b29 Add partial redundancy elimination.
llvm-svn: 37510
2007-06-08 01:03:01 +00:00
Dale Johannesen
52fcf022f7 Throttle tail merging; handling blocks with large numbers of predecessors
is too slow.

llvm-svn: 37509
2007-06-08 00:34:27 +00:00
Devang Patel
bc3b9a1c8a Add new method - nearestCommonDominator().
llvm-svn: 37508
2007-06-08 00:21:17 +00:00
Devang Patel
aee309e353 Use DominatorTree instead of ETForest.
llvm-svn: 37507
2007-06-08 00:17:13 +00:00
Devang Patel
8ecffa996a Do not preserve ETForest.
llvm-svn: 37506
2007-06-08 00:02:08 +00:00
Devang Patel
31257adce9 Use DominatorTree instead of ETForest.
llvm-svn: 37505
2007-06-07 23:53:38 +00:00
Devang Patel
46d92cae96 Add instruction level dominates(A,B) interface.
llvm-svn: 37504
2007-06-07 23:52:40 +00:00
Evan Cheng
1236ef7bcc Only remove the edge from entry to false if false block is merged.
llvm-svn: 37503
2007-06-07 22:31:28 +00:00
Devang Patel
3f4c6fe7e8 Do not require ETForest. Now it is unused by LICM.
llvm-svn: 37502
2007-06-07 22:21:15 +00:00
Devang Patel
cf470e5255 Do not use ETForest as well as DomiantorTree. DominatorTree is sufficient.
llvm-svn: 37501
2007-06-07 22:17:16 +00:00
Devang Patel
fc7fdef7d2 Use DominatorTree instead of ETForest.
This allows faster immediate domiantor walk.

llvm-svn: 37500
2007-06-07 21:57:03 +00:00
Devang Patel
df6355ccf8 Use DominatorTree instead of ETForest.
llvm-svn: 37499
2007-06-07 21:42:15 +00:00
Devang Patel
fb582f8dda Use DominatorTree instead of ETForest.
llvm-svn: 37498
2007-06-07 21:35:27 +00:00
Devang Patel
895ab0c570 Add basic block level properlyDominates(A,B) interface.
llvm-svn: 37497
2007-06-07 21:34:22 +00:00
Dale Johannesen
9a4d987a5f Do not change the size of function arguments. PR 1489.
llvm-svn: 37496
2007-06-07 21:07:15 +00:00
Devang Patel
5b8a5516e4 Use DominatorTree instead of ETForest.
llvm-svn: 37495
2007-06-07 18:45:06 +00:00
Devang Patel
593e766fb5 Use DominatorTree instead of ETForest.
llvm-svn: 37494
2007-06-07 18:40:55 +00:00
Devang Patel
171bbf61ed Add BasicBlock level dominates(A,B) interface.
llvm-svn: 37493
2007-06-07 18:39:40 +00:00
Devang Patel
af41e4a192 Maintain ETNode as part of DomTreeNode.
This adds redundancy for now.

llvm-svn: 37492
2007-06-07 17:47:21 +00:00
Tanya Lattner
5801c23e05 Formating fixes.
llvm-svn: 37491
2007-06-07 17:12:16 +00:00
Tanya Lattner
a1d8eeb7da Correct typo. Should be "not allowed"
llvm-svn: 37490
2007-06-07 16:44:52 +00:00
Duncan Sands
c3a9cd4c70 Make the struct bigger, in an attempt to get a "struct return" on more
platforms.

llvm-svn: 37489
2007-06-07 09:35:33 +00:00
Duncan Sands
3f35c524b9 Make this test pass if llvm-g++ was built without exception handling support.
llvm-svn: 37488
2007-06-07 09:00:48 +00:00
Evan Cheng
d3f3f0adad ifcvt a triangle: don't merge ifcvt block with rejoin block if it can fall through to it. If merged, the resulting block is not a candidate for iterative ifcvting since it contains both predicated and non-predicated code.
llvm-svn: 37487
2007-06-07 08:13:00 +00:00
Zhou Sheng
0ae22e99c8 Add assert to check if the attributes ZExt/SExt, NoAlias are apply to the
correct type of parameters.

llvm-svn: 37486
2007-06-07 06:12:03 +00:00
Evan Cheng
be9859eea2 Lots of bug fixes. Now finally in a reasonable state.
llvm-svn: 37485
2007-06-07 02:12:15 +00:00
Evan Cheng
842be09d86 Stupid cut-n-paste bug caused me soooo much grief. Why wasn't there a compilation warning? I blame it on the FE folks.
llvm-svn: 37484
2007-06-07 01:37:54 +00:00
Lauro Ramos Venancio
f04823af30 Fix bugpoint to run -llc-safe with -Xlinker.
llvm-svn: 37483
2007-06-06 23:10:56 +00:00
Lauro Ramos Venancio
85703e3796 Propagate alignment, section name and visibility when linking "appending
global values".
Fix noinline linkage.

llvm-svn: 37482
2007-06-06 22:01:12 +00:00
Tanya Lattner
cb90f1d881 Instruct the inliner to obey the noinline attribute. Add test case.
llvm-svn: 37481
2007-06-06 21:59:26 +00:00
Tanya Lattner
c7c8b5a3d8 Really use attribute.
llvm-svn: 37480
2007-06-06 21:00:46 +00:00
Tanya Lattner
65cdd36e54 Test case for noinline attribute.
llvm-svn: 37479
2007-06-06 20:52:16 +00:00
Chris Lattner
34404e3247 simplify this code and fix PR1493, now that llvm-gcc3 is dead.
llvm-svn: 37478
2007-06-06 20:51:41 +00:00
Chris Lattner
e7a1a4c889 if internalize is disabled, don't run the pass at all!
llvm-svn: 37477
2007-06-06 20:51:14 +00:00
Tanya Lattner
e50637d987 Revert changes for noinline.
llvm-svn: 37476
2007-06-06 20:46:40 +00:00
Devang Patel
def2d9790a Add new dominator tree node into dominator tree node map.
llvm-svn: 37475
2007-06-06 20:08:11 +00:00
Chris Lattner
00538a1931 update to match latest changes
llvm-svn: 37474
2007-06-06 18:28:13 +00:00
Lauro Ramos Venancio
be59acbfcc Add a test for PR1499.
llvm-svn: 37473
2007-06-06 17:10:02 +00:00
Lauro Ramos Venancio
368e8872db Fix PR1499.
llvm-svn: 37472
2007-06-06 17:08:48 +00:00
Owen Anderson
cfb6f40424 Quick patch to fix the build, based on what it appears Evan meant to write.
Evan, please check that this is in fact correct.

llvm-svn: 37471
2007-06-06 16:22:00 +00:00
Duncan Sands
29d1dc6f1a Fold the exception actions table harder: if two typeid lists start the
same, only output one copy of the common part.

llvm-svn: 37470
2007-06-06 15:37:31 +00:00
Nick Lewycky
df543f4b84 Optimize this test. Firstly, only Instructions may use other Instructions.
Secondly, checking whether removal succeeded tells you whether it was in
the map to begin with.

llvm-svn: 37469
2007-06-06 11:26:20 +00:00
Evan Cheng
e8c3cbf971 Mark these instructions clobbersPred. They modify the condition code register.
llvm-svn: 37468
2007-06-06 10:17:05 +00:00
Evan Cheng
9030b98aca Lots of bug fixes.
llvm-svn: 37467
2007-06-06 10:16:17 +00:00
Evan Cheng
d04409154f Added clobbersPred.
llvm-svn: 37466
2007-06-06 10:15:28 +00:00
Evan Cheng
452a818c6a Add clobbersPred - instruction that clobbers condition code / register which are used to predicate instructions.
llvm-svn: 37465
2007-06-06 10:14:55 +00:00
Evan Cheng
fcde8e52b3 Add a machine instruction flag indicating the instruction can clobber condition code / register(s) used to predicate instructions.
llvm-svn: 37464
2007-06-06 10:13:55 +00:00
Duncan Sands
61166501a1 Additional fix for PR1422: make sure the landing pad label is placed in the
correct machine basic block - do not rely on the eh.exception intrinsic
being in the landing pad: the loop optimizers can move it out.

llvm-svn: 37463
2007-06-06 10:05:18 +00:00
Duncan Sands
fe940d8d74 "Simplified" testcase for PR1422.
llvm-svn: 37462
2007-06-06 09:59:53 +00:00
Bruno Cardoso Lopes
35e43c49b0 Initial Mips support, here we go! =)
- Modifications from the last patch included
  (issues pointed by Evan Cheng are now fixed).
- Added more MipsI instructions.
- Added more patterns to match branch instructions.

llvm-svn: 37461
2007-06-06 07:42:06 +00:00
Tanya Lattner
277bbbc1be Ignore llvm.noinline
llvm-svn: 37460
2007-06-06 05:53:50 +00:00
Nick Lewycky
3e84212897 Fix PR1487 and Transforms/IndVar/2007-06-06-DeleteDanglesPtr.ll
llvm-svn: 37459
2007-06-06 04:12:20 +00:00
Nick Lewycky
3b70bb2778 new testcase for PR1487
llvm-svn: 37458
2007-06-06 04:11:21 +00:00
Nick Lewycky
91ed6efc24 Inform ScalarEvolutions that we're deleting Values.
This is the obviously correct part of the fix for PR1487.

llvm-svn: 37457
2007-06-06 03:51:56 +00:00
Evan Cheng
e4ec918be0 If a unconditional branch is added to branch to the false path during ifcvt, the predicated block cannot be iteratively ifcvted.
llvm-svn: 37456
2007-06-06 02:08:52 +00:00
Owen Anderson
634a063c1d Add simple full redundancy elimination.
llvm-svn: 37455
2007-06-06 01:27:49 +00:00
Chris Lattner
1b7b6e76ec Fix PR1495 and CodeGen/X86/2007-06-05-LSR-Dominator.ll
llvm-svn: 37454
2007-06-06 01:23:55 +00:00
Chris Lattner
6b79636532 add accessor
llvm-svn: 37453
2007-06-06 01:22:09 +00:00
Chris Lattner
af56be7f2c new testcase for PR1495
llvm-svn: 37452
2007-06-06 01:21:46 +00:00
Evan Cheng
b30a89457c Minor statistics counting bug.
llvm-svn: 37451
2007-06-06 01:12:44 +00:00
Devang Patel
5aced6a54a Break friendship.
llvm-svn: 37450
2007-06-06 00:59:48 +00:00
Evan Cheng
30565998bb Fix a couple of typos and be smarter about order of blocks when ifcvt a diamond.
llvm-svn: 37449
2007-06-06 00:57:55 +00:00
Devang Patel
3c6ab49051 Rename.
llvm-svn: 37448
2007-06-06 00:49:02 +00:00
Devang Patel
d7d3d71c7a Simplify class hierarchy.
llvm-svn: 37447
2007-06-06 00:46:36 +00:00
Devang Patel
506310d3dd Avoid non-trivial loop unswitching while optimizing for size.
llvm-svn: 37446
2007-06-06 00:21:03 +00:00
Chris Lattner
31f82dff21 Fix a user-reported error building with GCC 3.4.4 on Cygwin.
llvm-svn: 37445
2007-06-05 23:49:06 +00:00
Evan Cheng
7948422b78 Fix diamond shape ifcvt bugs.
llvm-svn: 37444
2007-06-05 23:46:14 +00:00
Owen Anderson
ddbe430732 Fix a misunderstanding of the algorithm. Really, we should be tracking values
and expression separately.  We can get around this, however, by only keeping
opaque values in TMP_GEN.

llvm-svn: 37443
2007-06-05 23:46:12 +00:00
Owen Anderson
c84720913a Don't leak memory.
llvm-svn: 37442
2007-06-05 22:11:49 +00:00
Evan Cheng
c1a0b8ce1d ReplaceUsesOfBlockWith() can modify the predecessors list.
llvm-svn: 37441
2007-06-05 22:03:53 +00:00
Evan Cheng
3e5bf0827c Do not ifcvt if either true / false path is a backedge. Not profitable in almost all cases.
llvm-svn: 37440
2007-06-05 20:38:42 +00:00
Devang Patel
3e6519e9fa Fix PR 1497
Use separate pass id for CFGOnlyPrinter.

llvm-svn: 37439
2007-06-05 20:24:36 +00:00
Devang Patel
753b63cb5b New test.
llvm-svn: 37438
2007-06-05 20:23:20 +00:00
Evan Cheng
5c48958a61 Print predicate of the second instruction of the two-piece constant MI.
llvm-svn: 37437
2007-06-05 18:55:18 +00:00
Owen Anderson
9b89e4b561 Fix a small bug, some 80 cols violations, and add some more debugging output.
llvm-svn: 37436
2007-06-05 17:31:23 +00:00
Dan Gohman
151169df1e Allow insertelement, extractelement, and shufflevector to be hoisted/sunk
by LICM.

llvm-svn: 37435
2007-06-05 16:05:55 +00:00
Evan Cheng
252695f0f6 PIC label asm printing cosmetic changes.
llvm-svn: 37434
2007-06-05 07:36:38 +00:00
Evan Cheng
2c1acd6d9e I had a senior moment.
llvm-svn: 37433
2007-06-05 07:05:25 +00:00
Zhou Sheng
2444a9adeb Commit first round work of PR1373. "noalias" is now fully supported in
VMCore, BitCode, and Assembly. Documentation and test case paramattrs.ll
updated also.

llvm-svn: 37432
2007-06-05 05:28:26 +00:00
Evan Cheng
59754300a8 New test.
llvm-svn: 37431
2007-06-05 01:45:08 +00:00
Evan Cheng
6e4babe8cc If the predicated block requires an early exit, end the block there and add a unconditional branch to false block. AnalyzeBranch() does not understand early exits.
llvm-svn: 37430
2007-06-05 01:31:40 +00:00
Evan Cheng
17aad8164e Fix some subtle bugs: bug during succeessor copying; incorrectly updating states of ifcvted blocks.
llvm-svn: 37429
2007-06-05 00:07:37 +00:00
Bill Wendling
6357bf20fa Patches by Chuck Rose to unbreak V Studio builds.
Thanks Chuck!

llvm-svn: 37428
2007-06-04 23:52:59 +00:00
Dale Johannesen
0558dda319 Tail merging wasn't working for predecessors of landing pads. PR 1496.
llvm-svn: 37427
2007-06-04 23:52:54 +00:00
Devang Patel
b3adb9876a s/ETNode::getChildren/ETNode::getETNodeChildren/g
llvm-svn: 37426
2007-06-04 23:45:02 +00:00
Owen Anderson
3c9d8eef21 Don't use std::set_difference when the two sets are sorted differently. Compute
the difference manually instead.

This allows GVNPRE to produce correct analysis for the example in the GVNPRE
paper.

llvm-svn: 37425
2007-06-04 23:34:56 +00:00
Owen Anderson
3df5299f94 Fix a bunch of small bugs, and improve the debugging output significantly.
llvm-svn: 37424
2007-06-04 23:28:33 +00:00
Chris Lattner
d7897d40b6 When rebuilding constant structs, make sure to honor the isPacked bit.
This fixes PR1491 and GlobalOpt/2007-06-04-PackedStruct.ll

llvm-svn: 37423
2007-06-04 22:23:42 +00:00
Chris Lattner
084c20fcc0 new testcase for PR1491
llvm-svn: 37422
2007-06-04 22:23:17 +00:00
Evan Cheng
53ce7de03b Global ctors / dtors alignment shouldn't be hard-coded at 4. e.g. It could be 8 for 64-bit targets.
llvm-svn: 37421
2007-06-04 20:39:18 +00:00
Evan Cheng
91233153bf Forgot to check for if iterator reached the end.
llvm-svn: 37420
2007-06-04 20:33:36 +00:00
Evan Cheng
59ca6a846f Misuse of hasExternalLinkage(), should be checking isDeclaration().
llvm-svn: 37419
2007-06-04 18:54:57 +00:00
Owen Anderson
38b6b22a41 Make phi_translate correct.
llvm-svn: 37418
2007-06-04 18:05:26 +00:00
Devang Patel
4a7c2830d4 Add FIXMEs.
llvm-svn: 37417
2007-06-04 17:38:00 +00:00
Devang Patel
f7a4aad658 Remove unused method.
llvm-svn: 37416
2007-06-04 16:49:36 +00:00
Devang Patel
ebc5b96735 s/DominatorTree::createNewNode/DominatorTree::addNewBlock/g
llvm-svn: 37415
2007-06-04 16:43:25 +00:00
Devang Patel
a89566aefd Add basic block level interface to change immediate dominator
and create new node.

llvm-svn: 37414
2007-06-04 16:22:33 +00:00
Dan Gohman
b4c2690446 Pass the DAG to SDNode::dump to let it do more detailed dumps in some cases.
llvm-svn: 37413
2007-06-04 16:17:33 +00:00
Dan Gohman
a23ef8a8f2 Remove the operator<< for MVT::ValueType in preparation for MVT::ValueType
being changed from an enum to an integer type, which can't have a custom
operator<< overload.

llvm-svn: 37412
2007-06-04 16:11:03 +00:00
Dan Gohman
92a7f3a65e Resolve implicit alignment before computing the FoldingSet information so
that the CSE map always contains explicit alignment information. This allows
more loads to be CSE'd when there is a mix of explicit-alignment loads and
implicit-alignment loads.

Also, in SelectionDAG::FindModifiedNodeSlot, add the operands to the
FoldingSetNodeID before the load/store information instead of after, so
that it matches what is done elsewhere.

llvm-svn: 37411
2007-06-04 15:49:41 +00:00
Devang Patel
d609374ab3 Fix LLVM build on NetBSD. Patch by Neil Booth.
llvm-svn: 37410
2007-06-04 15:28:57 +00:00
Evan Cheng
312b723af2 Let IfConverter loose. Allow more aggressive subsumptions; reorder basic blocks to expose more ifcvt opportunities; code clean up and fixes.
llvm-svn: 37409
2007-06-04 06:47:22 +00:00
Evan Cheng
df75785594 Move ReplaceUsesOfBlockWith() out of BranchFolding into a MachineBasicBlock general facility.
llvm-svn: 37408
2007-06-04 06:44:01 +00:00
Devang Patel
bdd1aaef10 s/llvm::DominatorTreeBase::DomTreeNode/llvm::DomTreeNode/g
llvm-svn: 37407
2007-06-04 00:32:22 +00:00
Owen Anderson
0eca9aad10 Don't use the custom comparator where it's not necessary.
llvm-svn: 37406
2007-06-03 22:02:14 +00:00
Anton Korobeynikov
b781886de7 Add comments to fallsthrough cases. Also, this fixes PR1492
llvm-svn: 37405
2007-06-03 19:20:49 +00:00
Anton Korobeynikov
8c32c1114f Check arguments & return types of main(). Abort in case of no match.
llvm-svn: 37404
2007-06-03 19:17:35 +00:00
Devang Patel
0e8aa7b69a s/DominatorTreeBase::Node/DominatorTreeBase:DomTreeNode/g
llvm-svn: 37403
2007-06-03 06:26:14 +00:00
Owen Anderson
46499645db Remove an unused method.
llvm-svn: 37402
2007-06-03 05:58:25 +00:00
Owen Anderson
0b68cda302 There's no need to have an Expression class... Value works just as well! This simplifies a lot of code.
llvm-svn: 37401
2007-06-03 05:55:58 +00:00
Chris Lattner
446548d2a3 update this entry, now that Anton implemented shift/and lowering for
switches.  There is one really easy isel thing here with tst we are not
getting.

llvm-svn: 37400
2007-06-02 18:45:14 +00:00
Duncan Sands
f708f73a1b The semantics of invoke require that we always jump to the unwind block
(landing pad) when an exception unwinds through the call.  This doesn't
quite match the way the dwarf unwinder works: by default it only jumps to
the landing pad if the catch or filter specification matches, and otherwise
it keeps on unwinding.  There are two ways of specifying to the unwinder
that it should "always" (more on why there are quotes here later) jump to
the landing pad: follow the specification by a 0 typeid, or follow it by
the typeid for the NULL typeinfo.  GCC does the first, and this patch makes
LLVM do the same as gcc.  However there is a problem: the unwinder performs
optimizations based on C++ semantics (it only expects destructors to be
run if the 0 typeid fires - known as "cleanups"), meaning it assumes that no
exceptions will be raised and that the raised exception will be reraised
at the end of the cleanup code.  So if someone writes their own LLVM code
using the exception intrinsics they will get a nasty surprise if they don't
follow these rules.  The other possibility of using the typeid corresponding
to NULL (catch-all) causes the unwinder to make no assumptions, so this is
probably what we should use in the long-run.  However since we are still
having trouble getting exception handling working properly, for the moment
it seems best to closely imitate GCC.

llvm-svn: 37399
2007-06-02 17:16:06 +00:00
Duncan Sands
c063f5f362 Integrate exception filter support and exception catch support. This
simplifies the code in DwarfWriter, allows for multiple filters and
makes it trivial to specify filters accompanied by cleanups or catch-all
specifications (see next patch).  What a deal!  Patch blessed by Anton.

llvm-svn: 37398
2007-06-02 16:53:42 +00:00
Zhou Sheng
0a0ae932ca Make LowerCTPOP() support arbitrary bitwidth integer type.
llvm-svn: 37397
2007-06-02 04:10:33 +00:00
Dale Johannesen
6e7cdce773 Fix CorrectExtraCFGEdges to allow for multiple LandingPad targets.
llvm-svn: 37394
2007-06-02 00:08:15 +00:00
Dale Johannesen
9746e3a22b Fancier algorithm in tail-merge comment implemented, so remove comment.
llvm-svn: 37393
2007-06-01 23:04:28 +00:00
Dale Johannesen
3c0a13762d Implement smarter algorithm for choosing which blocks to tail-merge.
See test/CodeGen/X86/test-pic-jtbl.ll for a case where it works well;
shaves another 10K off our favorite benchmark.  I was hesitant about
this because of compile speed, but seems to do OK on a bootstrap.

llvm-svn: 37392
2007-06-01 23:02:45 +00:00
Reid Spencer
ff38cf8880 For PR1486:
Avoid overwriting the APInt instance with 0 bytes which causes the bitwidth
to be set to 0 (illegal) producing a subsequent assert.

llvm-svn: 37391
2007-06-01 22:23:29 +00:00
Devang Patel
ac54a62fd2 Insert new instructions in AliasSet.
llvm-svn: 37390
2007-06-01 22:15:31 +00:00
Owen Anderson
48e93f2ce9 clean() needs to process things in topological order.
llvm-svn: 37389
2007-06-01 22:00:37 +00:00
Evan Cheng
9aa5fc8577 Opcode modifier s comes after condition code. e.g. addlts, not addslt.
llvm-svn: 37388
2007-06-01 20:51:29 +00:00
Evan Cheng
4dcf1e8582 Correctly mark early-exit on the false path.
llvm-svn: 37387
2007-06-01 20:29:21 +00:00
Owen Anderson
4c89142466 Fix Expression comparison, which in turn fixes a value numbering error.
llvm-svn: 37386
2007-06-01 17:34:47 +00:00
Evan Cheng
256144de4a Set ARM ifcvt duplication limit to 3 for now.
llvm-svn: 37385
2007-06-01 08:28:59 +00:00
Evan Cheng
b964b9c025 Target specific ifcvt code duplication limit.
llvm-svn: 37384
2007-06-01 08:25:24 +00:00
Duncan Sands
706421e712 Since TypeInfos are passed as i8 pointers, a NULL TypeInfo should be passed
as a null i8 pointer not as a 0 i32.

llvm-svn: 37383
2007-06-01 08:18:30 +00:00
Evan Cheng
6a2cf070cc Ifcvt triangle: don't ifcvt 'true' BB if it has other predecessors; don't merge 'false' BB if it has other predecessors.
llvm-svn: 37382
2007-06-01 07:41:07 +00:00
Evan Cheng
a2ab4e5feb Make jumptable non-predicable for now.
llvm-svn: 37381
2007-06-01 00:56:15 +00:00
Evan Cheng
95c7917d92 Remove a bogus check. Even terminators in a ifcvt need to be predicated. Unconditional branches can usually be converted to conditional ones.
llvm-svn: 37380
2007-06-01 00:55:26 +00:00
Evan Cheng
20e05997f5 Allow multiple ifcvt candidates to share children blocks; add some debugging code.
llvm-svn: 37379
2007-06-01 00:12:12 +00:00
Owen Anderson
331bf6a959 Add a topological sort function.
llvm-svn: 37376
2007-05-31 22:44:11 +00:00
Dale Johannesen
1a401e68a8 Arrange for only 1 of multiple branches to landing pad to be kept.
Do not remove empty landing pads (EH table needs to be updated)

llvm-svn: 37375
2007-05-31 21:54:00 +00:00
Evan Cheng
e6ccb6c5ed Fix a typo.
llvm-svn: 37374
2007-05-31 20:53:33 +00:00
Chris Lattner
3e3ff30aa2 Fix the asmprinter so that a globalvalue can specify an explicit alignment
smaller than the preferred alignment, but so that the target can actually
specify a minimum alignment if needed.  This fixes some objc protocol
failures Devang tracked down.

llvm-svn: 37373
2007-05-31 18:57:45 +00:00
Lauro Ramos Venancio
5a3e6fe365 Add a test for PR1424.
llvm-svn: 37372
2007-05-31 18:36:07 +00:00
Lauro Ramos Venancio
5b0757a401 Fix PR1424.
When a function has FP, the register scavenging spill slot offset already
was calculated.

llvm-svn: 37371
2007-05-31 18:27:58 +00:00
Bill Wendling
96114686ae Alphabetize Bruno's entry.
llvm-svn: 37368
2007-05-31 04:14:28 +00:00
Bruno Cardoso Lopes
0a2eee18b1 New contributor added!
llvm-svn: 37367
2007-05-31 03:25:10 +00:00
Owen Anderson
81d156e16f Attempt to fix up phi_translate.
llvm-svn: 37366
2007-05-31 00:42:15 +00:00
Evan Cheng
905a8f4940 Change traversal order to bottom up in preparation for more aggressive if-conversion.
llvm-svn: 37365
2007-05-30 19:49:19 +00:00
Chris Lattner
397c4d9ef6 Fix CodeGen/PowerPC/2007-05-30-dagcombine-miscomp.ll, and PR1473.
llvm-svn: 37362
2007-05-30 16:30:06 +00:00
Chris Lattner
4217aa376a new testcase for PR1473
llvm-svn: 37361
2007-05-30 16:29:20 +00:00
Devang Patel
9b3b35d14f Fix typo.
llvm-svn: 37360
2007-05-30 15:29:37 +00:00
Duncan Sands
d9e3786d2f Testcase for
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070528/050047.html

llvm-svn: 37359
2007-05-30 10:16:19 +00:00
Chris Lattner
8767920f20 Fix Transforms/ScalarRepl/2007-05-29-MemcpyPreserve.ll and the second
half of PR1421, by not decimating structs with holes that are the source and
destination of a memcpy.

llvm-svn: 37358
2007-05-30 06:11:23 +00:00
Chris Lattner
ed24b3b2fa Testcase for PR1421
llvm-svn: 37357
2007-05-30 06:10:46 +00:00
Chris Lattner
b6506a636b new testcase for PR1421
llvm-svn: 37356
2007-05-30 05:37:18 +00:00
Dale Johannesen
d14ad078c6 Changed per review comment.
llvm-svn: 37355
2007-05-30 00:32:01 +00:00
Dale Johannesen
a69ebdbebc Make stable_sort in tail merging actually be stable (it never was, but didn't
matter until my last change).  Reenable tail merging by default.

llvm-svn: 37354
2007-05-29 23:47:50 +00:00
Evan Cheng
20f7d30f92 Don't merge in tail block of a diamond if it has more than one predecessors after if-conversion.
llvm-svn: 37353
2007-05-29 23:37:20 +00:00
Owen Anderson
9429cd1a61 Put GVN-PRE in all the right places.
llvm-svn: 37352
2007-05-29 23:36:32 +00:00
Evan Cheng
19eeee41ca For VFP2 fldm, fstm instructions, the condition code is printed after the address mode and size specifier. e.g. fstmiaseq, not fstmeqias.
llvm-svn: 37351
2007-05-29 23:34:19 +00:00
Owen Anderson
4b0c1859fd Fix a typo
llvm-svn: 37350
2007-05-29 23:34:14 +00:00
Evan Cheng
a6e9a4ce07 For ldrb, strh, etc., the condition code is before the width specifier. e.g. streqh, not strheq.
llvm-svn: 37349
2007-05-29 23:32:06 +00:00
Owen Anderson
0c4230724c Re-fix a bug, where I was now being too aggressive.
llvm-svn: 37348
2007-05-29 23:26:30 +00:00
Owen Anderson
4a6ec8fb57 Use proper debugging facilities so other people don't have to look at my commented-out
debugging lines.

llvm-svn: 37347
2007-05-29 23:15:21 +00:00
Owen Anderson
f11bdc7637 Comment debug code out that I accidentally uncommented last time.
llvm-svn: 37346
2007-05-29 22:43:03 +00:00
Owen Anderson
ac83a3e4ff Add a place where I missed using the maximal set. Note that using the maximal
set this way is _SLOW_.  Somewhere down the line, I'll look at speeding it up.

llvm-svn: 37345
2007-05-29 22:35:41 +00:00
Evan Cheng
c2237ce217 If there is an empty block between a source and its successor block, it still requires a unconditional branch.
llvm-svn: 37344
2007-05-29 22:31:16 +00:00
Owen Anderson
5fba6c19b2 Very first part of a GVN-PRE implementation. It currently performs a bunch of analysis, and nothing more. It is also quite slow for the moment. However,
it should give a sense of what's going on.

llvm-svn: 37343
2007-05-29 21:53:49 +00:00
Evan Cheng
2d91a4fd6a Add missing const qualifiers.
llvm-svn: 37342
2007-05-29 18:42:18 +00:00
Evan Cheng
5983bdbb2c Add missing const qualifiers.
llvm-svn: 37341
2007-05-29 18:35:22 +00:00
Nicolas Geoffray
cff3e122b0 Implementation of compilation callback in PPC ELF32
llvm-svn: 37340
2007-05-29 16:33:18 +00:00
Chris Lattner
a446f1b46b more fixes to C code.
llvm-svn: 37339
2007-05-29 15:43:56 +00:00
Bill Wendling
2d8b9a8834 Fixed some formatting.
llvm-svn: 37338
2007-05-29 09:42:13 +00:00
Bill Wendling
0a303eb474 Added "llvmc" to the FAQ.
llvm-svn: 37337
2007-05-29 09:35:34 +00:00
Bill Wendling
2c22fcb11c Added "doc_class" div tags to code segments.
llvm-svn: 37336
2007-05-29 09:24:33 +00:00
Bill Wendling
3716c5df29 Fix for PR1452. Removed "define" keyword from the C code. Added "<div
class="doc_code">" to code examples.

llvm-svn: 37335
2007-05-29 09:04:49 +00:00
Chris Lattner
8deaba7622 Add a new LLVMBuilder class, which makes it simpler and more uniform to
create large amounts of instructions by separating the insertion point
logic from the logic of what to create.

llvm-svn: 37332
2007-05-27 15:09:34 +00:00
Zhou Sheng
d7dc1ed64c Correct the logic in LowerPartSet which cleared the bits from 0 to low-1.
llvm-svn: 37331
2007-05-26 03:43:13 +00:00
Chris Lattner
4698083b96 tighten up recursion depth again
llvm-svn: 37330
2007-05-25 02:19:06 +00:00
Devang Patel
1b63e7a4b8 Disable Tail Merging for now.
llvm-svn: 37329
2007-05-25 01:00:24 +00:00
Evan Cheng
13f5f7df95 Silly boog.
llvm-svn: 37328
2007-05-25 00:59:01 +00:00
Chris Lattner
c87f3dff51 remove contradiction owen noticed
llvm-svn: 37327
2007-05-24 19:13:27 +00:00
Chris Lattner
80c94a4a04 Fix PR1446 by not scalarrepl'ing giant structures.
llvm-svn: 37326
2007-05-24 18:43:04 +00:00
Chris Lattner
49a34fcca7 testcase for PR1446
llvm-svn: 37325
2007-05-24 18:42:47 +00:00
Dale Johannesen
1409b6a59b Blocks that cond-br and uncond-br/fallthrough to same block should have
only one successor.

llvm-svn: 37324
2007-05-24 18:31:55 +00:00
Dale Johannesen
1af8c870c7 Fix for PR1444: do not create two successors to the same block.
Temporarily, this breaks CodeGen/Generic/2006-02-12-InsertLibraryCall.ll
by exposing an unrelated latent problem; working on that.

llvm-svn: 37323
2007-05-24 17:39:32 +00:00
Zhou Sheng
8ff9ff7975 Compute the correct word number.
llvm-svn: 37322
2007-05-24 15:03:18 +00:00
Dan Gohman
30978078bf Minor comment cleanups.
llvm-svn: 37321
2007-05-24 14:36:04 +00:00
Dan Gohman
703e0f8608 Add explicit qualification for namespace MVT members.
llvm-svn: 37320
2007-05-24 14:33:05 +00:00
Dan Gohman
5d4bb4f230 Add cases for v2f32.
llvm-svn: 37319
2007-05-24 14:29:12 +00:00
Evan Cheng
a4d187b8ce Fix a typo that caused combiner to create mal-formed pre-indexed store where value store is the same as the base pointer.
llvm-svn: 37318
2007-05-24 02:35:39 +00:00
Evan Cheng
b58bf97603 Add a new test case.
llvm-svn: 37317
2007-05-24 02:31:15 +00:00
Dale Johannesen
d750b46f8b tail merging shrinks this code a bit. Could do more in future.
llvm-svn: 37316
2007-05-23 21:09:26 +00:00
Dale Johannesen
f4a77d2481 Two tail merging improvements:
When considering blocks with more than 2 predecessors, merge the block with
the largest number of matching insns, rather than the first block found.
Considering that 1 matching insn is enough to show a win for candidates that
already end with a branch.

llvm-svn: 37315
2007-05-23 21:07:20 +00:00
Devang Patel
d50859e87b Add dump() routines for debugging assistance.
llvm-svn: 37314
2007-05-23 19:55:36 +00:00
Anton Korobeynikov
3b327826db Mark all calls as "could throw", when exceptions are enabled. Emit necessary LP info too. This fixes PR1439
llvm-svn: 37311
2007-05-23 11:08:31 +00:00
Chris Lattner
6509c0673f prevent exponential recursion in isNegatibleForFree
llvm-svn: 37310
2007-05-23 07:35:22 +00:00
Evan Cheng
d0e669199b Preliminary iterative if-conversion support.
llvm-svn: 37309
2007-05-23 07:23:16 +00:00
Evan Cheng
1d764eca98 Hooks for predication support.
llvm-svn: 37308
2007-05-23 07:22:05 +00:00
Evan Cheng
c972de8c8b Rename a parameter.
llvm-svn: 37307
2007-05-23 07:21:11 +00:00
Evan Cheng
1e25f56508 Add a couple of target hooks for predication.
llvm-svn: 37306
2007-05-23 07:19:12 +00:00
Chris Lattner
688b2807df when merging two alias sets together, be sure to propagate the volatility of
the inner set.  This fixes PR1435 and Transforms/LICM/2007-05-22-VolatileSink.ll

llvm-svn: 37305
2007-05-23 06:36:35 +00:00
Chris Lattner
e44b6a6aaf new testcase for PR1435
llvm-svn: 37304
2007-05-23 06:35:52 +00:00
Chris Lattner
c7e60517ed make these accessors private.
llvm-svn: 37302
2007-05-23 05:46:04 +00:00
Devang Patel
4d01a7b1b5 If user wants to run instcombine twice, do not block it.
llvm-svn: 37301
2007-05-23 05:08:52 +00:00
Chris Lattner
bee7b32ef8 final updates
llvm-svn: 37299
2007-05-23 04:39:32 +00:00
Chris Lattner
f79577d314 fix a miscompilation when passing a float through varargs
llvm-svn: 37297
2007-05-23 01:17:04 +00:00
Reid Spencer
c23c9fce34 The Intrinsic::getDeclaration function's Tys parameter only contains the
types of the iAny types involved in the overloaded intrinsic. Thus, we
can't use the argument number as the index but have to count them separately
in order to index Tys correctly. This patch rectifies this situation.

llvm-svn: 37296
2007-05-22 19:30:31 +00:00
Reid Spencer
bdf03b4174 Reinstate the patch for escaping non-printing characters and allow for
\\ to escape \. All these cases are now handled by the AsmParser.

llvm-svn: 37295
2007-05-22 19:27:35 +00:00
Reid Spencer
c5cec2a4e8 Regenerate.
llvm-svn: 37294
2007-05-22 19:08:16 +00:00
Reid Spencer
0f656c39e1 Don't allow the UnEscape code to read or write beyond the end of yytext.
Make sure we convert \\ into \.

llvm-svn: 37293
2007-05-22 19:07:45 +00:00
Reid Spencer
acfe667eab Regenerate.
llvm-svn: 37292
2007-05-22 18:52:55 +00:00
Reid Spencer
3b208cca84 Implement full unescaping of escaped hex characters in all quoted identifiers
and strings.

llvm-svn: 37291
2007-05-22 18:52:21 +00:00
Dale Johannesen
10c5ccc68f Document boolOrDefault and its parser.
llvm-svn: 37290
2007-05-22 18:32:34 +00:00
Dale Johannesen
f9cbdc676c name change requested by review of previous patch
llvm-svn: 37289
2007-05-22 18:31:04 +00:00
Owen Anderson
0ae7eb5e7c Silence a warning.
llvm-svn: 37288
2007-05-22 18:13:40 +00:00
Dale Johannesen
a7120dde08 new testcases for -enable-tail-merge default handling
llvm-svn: 37287
2007-05-22 17:19:23 +00:00
Dale Johannesen
80fae16a06 Test assumes tail merging is off; this must now be explicit.
llvm-svn: 37286
2007-05-22 17:18:05 +00:00
Dale Johannesen
82810c8a13 Make tail merging the default, except on powerPC. There was no prior art
for a target-dependent default with a command-line override; this way
should be generally usable.

llvm-svn: 37285
2007-05-22 17:14:46 +00:00
Chris Lattner
83d7dd419a temporarily revert reid's asmwriter patch, it is missing the asmparser piece
that decodes the escape sequences, thus breaking all cases that use them.

This fixes test/Assembler/2007-05-21-Escape.ll

llvm-svn: 37284
2007-05-22 07:00:50 +00:00
Chris Lattner
9a0ff5961b new testcase for a recent regression
llvm-svn: 37283
2007-05-22 07:00:38 +00:00
Chris Lattner
77119f43af update comment
llvm-svn: 37282
2007-05-22 06:56:32 +00:00
Chris Lattner
31ab0ed37f regenerate
llvm-svn: 37281
2007-05-22 06:47:55 +00:00
Chris Lattner
9111cd6b8a simplify code
llvm-svn: 37280
2007-05-22 06:47:11 +00:00
Tanya Lattner
3e85207fef NightlyTest.pl does not exist.
llvm-svn: 37278
2007-05-22 06:12:51 +00:00
Tanya Lattner
e94a09e357 Adding 2.0 release
llvm-svn: 37277
2007-05-22 06:06:22 +00:00
Bill Wendling
3fb7fdfded We only need to specify the most-implied feature for an architecture.
llvm-svn: 37275
2007-05-22 05:15:37 +00:00
Evan Cheng
1933bbc735 Consistency.
llvm-svn: 37274
2007-05-22 01:21:58 +00:00
Evan Cheng
204af78b96 Add test for PR1259.
llvm-svn: 37273
2007-05-21 23:30:33 +00:00
Evan Cheng
8c8afb27d7 Fix some -march=thumb regressions. tBR_JTr is not predicable.
llvm-svn: 37272
2007-05-21 23:17:32 +00:00
Dale Johannesen
d1de276c16 Use AXI3 not AXI2 for appropriate PIC PC-relative loads and stores. Cosmetic.
llvm-svn: 37271
2007-05-21 22:42:04 +00:00
Evan Cheng
e26c0916a3 If-convert early exit blocks (returns, etc.); bug fixes, etc.
llvm-svn: 37270
2007-05-21 22:22:58 +00:00
Dale Johannesen
7d55f3733e Add some patterns for PIC PC-relative loads and stores.
llvm-svn: 37269
2007-05-21 22:14:33 +00:00
Evan Cheng
147b334b6a BlockHasNoFallThrough() now returns true if block ends with a return instruction; AnalyzeBranch() should ignore predicated instructionsd.
llvm-svn: 37268
2007-05-21 18:56:31 +00:00
Duncan Sands
34e82a4508 Only emit one entry in the exception action table for each action, even if
it occurs for multiple landing pads.

llvm-svn: 37267
2007-05-21 18:50:28 +00:00
Evan Cheng
fc94eb66d2 BlockHasNoFallThrough() now returns true if block ends with a return instruction.
llvm-svn: 37266
2007-05-21 18:44:17 +00:00
Bill Wendling
ee854630e4 Update
llvm-svn: 37265
2007-05-20 19:56:24 +00:00
Reid Spencer
e44b45e757 Get the order of the hext digits right!
llvm-svn: 37261
2007-05-19 14:44:42 +00:00
Reid Spencer
6473fb7916 Adjust how LLVM names are produced:
1. Always use % for local and @ for global.
2. Replace NameNeedsQuotes with QuoteNameIfNeeded so that any adjustments
   to the name can be done in one pass.
3. Implement generation of hex escapes so we don't get "wonky" characters
   in the output.

llvm-svn: 37260
2007-05-19 07:25:21 +00:00
Reid Spencer
be9b3fce8a Make sure we can round-trip an escaped value in a name.
llvm-svn: 37259
2007-05-19 07:22:24 +00:00
Reid Spencer
21526d6b56 Regenerate
llvm-svn: 37258
2007-05-19 07:22:10 +00:00
Reid Spencer
aba0cc7173 Make the %"..." syntax legal for local name. This just makes it symmetric
with global names which can already be @"..."

llvm-svn: 37257
2007-05-19 07:21:26 +00:00
Chris Lattner
a655a157a0 Fix Transforms/InstCombine/2007-05-18-CastFoldBug.ll, a bug that devastates
objc code due to the way the FE lowers objc message sends.

llvm-svn: 37256
2007-05-19 06:51:32 +00:00
Chris Lattner
faa31904e4 new testcase
llvm-svn: 37255
2007-05-19 06:50:37 +00:00
Reid Spencer
80fcb754d9 On Linux platforms and at optimization levels -O1 and above, llvm-gcc can
turn "putchar" calls into _IO_putc calls which is a lower-level interface.
This patch allows these calls to be executed by lli in interpreter mode.

llvm-svn: 37254
2007-05-19 01:36:17 +00:00
Chris Lattner
0306944992 add source
llvm-svn: 37253
2007-05-19 01:22:52 +00:00
Chris Lattner
e8bd53c36a Handle negative strides much more optimally. This compiles X86/lsr-negative-stride.ll
into:

_t:
        movl 8(%esp), %ecx
        movl 4(%esp), %eax
        cmpl %ecx, %eax
        je LBB1_3       #bb17
LBB1_1: #bb
        cmpl %ecx, %eax
        jg LBB1_4       #cond_true
LBB1_2: #cond_false
        subl %eax, %ecx
        cmpl %ecx, %eax
        jne LBB1_1      #bb
LBB1_3: #bb17
        ret
LBB1_4: #cond_true
        subl %ecx, %eax
        cmpl %ecx, %eax
        jne LBB1_1      #bb
        jmp LBB1_3      #bb17

instead of:

_t:
        subl $4, %esp
        movl %esi, (%esp)
        movl 12(%esp), %ecx
        movl 8(%esp), %eax
        cmpl %ecx, %eax
        je LBB1_4       #bb17
LBB1_1: #bb.outer
        movl %ecx, %edx
        negl %edx
LBB1_2: #bb
        cmpl %ecx, %eax
        jle LBB1_5      #cond_false
LBB1_3: #cond_true
        addl %edx, %eax
        cmpl %ecx, %eax
        jne LBB1_2      #bb
LBB1_4: #bb17
        movl (%esp), %esi
        addl $4, %esp
        ret
LBB1_5: #cond_false
        movl %ecx, %edx
        subl %eax, %edx
        movl %eax, %esi
        addl %esi, %esi
        cmpl %ecx, %esi
        je LBB1_4       #bb17
LBB1_6: #cond_false.bb.outer_crit_edge
        movl %edx, %ecx
        jmp LBB1_1      #bb.outer

llvm-svn: 37252
2007-05-19 01:22:21 +00:00
Chris Lattner
afa90dc355 new testcase
llvm-svn: 37251
2007-05-19 01:21:39 +00:00
Chris Lattner
1fa8276e70 same patch as the previous one, but the symmetric case
llvm-svn: 37249
2007-05-19 00:46:51 +00:00
Chris Lattner
b08cbbd737 Disable the (A == (B-A)) -> 2*A == B xform when the sub has multiple uses (in
this case, the xform introduces an extra operation).  This compiles
PowerPC/compare-duplicate.ll into:

_test:
        subf r2, r3, r4
        cmplw cr0, r2, r3
        bne cr0, LBB1_2 ;F

instead of:

_test:
        slwi r2, r3, 1
        subf r3, r3, r4
        cmplw cr0, r4, r2
        bne cr0, LBB1_2 ;F

This is target independent of course.

llvm-svn: 37246
2007-05-19 00:43:44 +00:00
Chris Lattner
bde968823a new testcase
llvm-svn: 37245
2007-05-19 00:41:40 +00:00
Reid Spencer
b6af1aae35 Fix an assertion introduced by my last change to the toString method. We
can't use getZExtValue() to extract the low order bits for each digit.
Instead, we need to access the low order word directly.

llvm-svn: 37242
2007-05-19 00:29:55 +00:00
Dan Gohman
c12dd5207d Apply this patch:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070514/049845.html

llvm-svn: 37240
2007-05-18 23:21:46 +00:00
Chris Lattner
7ea2df6e2a add a note
llvm-svn: 37239
2007-05-18 20:18:14 +00:00
Dan Gohman
6164a1b279 Add a testcase for unrolling loops with unknown tripcounts.
llvm-svn: 37238
2007-05-18 19:59:23 +00:00
Evan Cheng
018cffbca4 Clean up.
llvm-svn: 37237
2007-05-18 19:32:08 +00:00
Evan Cheng
faaf716540 Change to depth-first traversal.
llvm-svn: 37236
2007-05-18 19:26:33 +00:00
Dale Johannesen
dafda82755 Document an inefficiency in tail merging.
llvm-svn: 37235
2007-05-18 18:46:40 +00:00
Dan Gohman
eefa83e67b Use MVT::FIRST_VECTOR_VALUETYPE and MVT::LAST_VECTOR_VALUETYPE.
llvm-svn: 37234
2007-05-18 18:44:07 +00:00
Dan Gohman
b539df3389 Qualify calls to getTypeForValueType with MVT:: too.
llvm-svn: 37233
2007-05-18 18:41:29 +00:00
Evan Cheng
2e82cefd24 Some restructuring in preparation for most aggressive if-conversion.
llvm-svn: 37231
2007-05-18 18:14:37 +00:00
Dan Gohman
1796f1f8e9 Qualify several calls to functions in the MVT namespace, for consistency.
llvm-svn: 37230
2007-05-18 17:52:13 +00:00
Evan Cheng
f25d3a5d73 Watch out for blocks that end with a return.
llvm-svn: 37227
2007-05-18 17:06:53 +00:00
Duncan Sands
76256a069c Fix typo.
llvm-svn: 37224
2007-05-18 12:13:34 +00:00
Duncan Sands
ea7a326468 Fix typo.
llvm-svn: 37223
2007-05-18 09:04:20 +00:00
Chris Lattner
3d1937591d better portability for intptr_t.
llvm-svn: 37221
2007-05-18 07:07:05 +00:00
Chris Lattner
feadc1ebdc finished the first draft
llvm-svn: 37219
2007-05-18 06:38:51 +00:00
Chris Lattner
727c3740e4 crank out notes
llvm-svn: 37218
2007-05-18 06:33:02 +00:00
Reid Spencer
ac1c2d93f1 Regenerate.
llvm-svn: 37207
2007-05-18 05:48:07 +00:00
Chris Lattner
6d84cdcfee validation fix
llvm-svn: 37206
2007-05-18 05:38:44 +00:00
Chris Lattner
5538349a7c validation fixes
llvm-svn: 37205
2007-05-18 05:36:14 +00:00
Chris Lattner
9eeada9470 Fix PR1434 and test/Linker/link-archive.ll, this is a regression from 1.9.
llvm-svn: 37204
2007-05-18 04:02:46 +00:00
Reid Spencer
7aed8fccfd Add a test case for PR1434
llvm-svn: 37203
2007-05-18 03:46:50 +00:00
Reid Spencer
d266c18c0e Avoid an infinite loop when TestRunner.sh is run outside of the test dir.
llvm-svn: 37201
2007-05-18 02:06:03 +00:00
Evan Cheng
478b805956 If true / false blocks fallthrough before ifcvt, add unconditional branches to ifcvt'd block.
llvm-svn: 37200
2007-05-18 01:55:58 +00:00
Evan Cheng
4ae1840d21 Mark calls non-predicable for now. Need to ensure it's the last instruction in the if-converted block or make sure it preserve condition code.
llvm-svn: 37199
2007-05-18 01:53:54 +00:00
Dale Johannesen
f8956178af Remove some unneeded branches. (spotted by Evan, thanks)
llvm-svn: 37198
2007-05-18 01:28:58 +00:00
Evan Cheng
ea623560f8 Silence some compilation warnings.
llvm-svn: 37197
2007-05-18 01:19:57 +00:00
Chris Lattner
e0c1df4919 tweak
llvm-svn: 37196
2007-05-18 00:44:29 +00:00
Evan Cheng
0f745da4fe Make use of target specific block size limits; bug fixes.
llvm-svn: 37195
2007-05-18 00:20:58 +00:00
Evan Cheng
6addd65914 Set ARM if-conversion block size threshold to 10 instructions for now.
llvm-svn: 37194
2007-05-18 00:19:34 +00:00
Evan Cheng
e20dd92792 RemoveBranch() and InsertBranch() now returns number of instructions deleted / inserted.
llvm-svn: 37193
2007-05-18 00:18:17 +00:00
Evan Cheng
99be49dd9b RemoveBranch() and InsertBranch() now returns number of instructions deleted / inserted.
llvm-svn: 37192
2007-05-18 00:05:48 +00:00
Evan Cheng
c0dc382fb7 Fix comment.
llvm-svn: 37191
2007-05-18 00:00:30 +00:00
Evan Cheng
a92b2b38ff Move isSuccessor() offline, change it to use std::find.
llvm-svn: 37190
2007-05-17 23:58:53 +00:00
Reid Spencer
07aa66887c Fix a problem with building .y files when BISON is not present.
Merged from the release_20 branch.

llvm-svn: 37188
2007-05-17 22:51:35 +00:00
Devang Patel
2c30a37a5c Fix PR1431
Test case at Transformations/SCCP/2007-05-16-InvokeCrash.ll

llvm-svn: 37185
2007-05-17 22:10:15 +00:00
Devang Patel
f9ed308aba New test.
llvm-svn: 37184
2007-05-17 22:05:20 +00:00
Chris Lattner
6fd9b5e816 validation fixes
llvm-svn: 37183
2007-05-17 22:03:43 +00:00
Chris Lattner
2f131fe30d llvm-gcc now supports almost all gcc extensions. The key missing one is
builtin_apply.

llvm-svn: 37182
2007-05-17 22:02:24 +00:00
Chris Lattner
8ce1ba466f add a section about API changes.
llvm-svn: 37181
2007-05-17 21:41:31 +00:00
Dale Johannesen
58698d2534 More effective breakdown of memcpy into repeated load/store. These are now
in the order lod;lod;lod;sto;sto;sto which means the load-store optimizer
has a better chance of producing ldm/stm.  Ideally you would get cooperation
from the RA as well but this is not there yet.

llvm-svn: 37179
2007-05-17 21:31:21 +00:00
Dan Gohman
99ec2d88fb Correct a name in a comment.
llvm-svn: 37178
2007-05-17 21:30:39 +00:00
Chris Lattner
e1047b2cfe silence some "comparison between signed and unsigned integer expressions"
warnings

llvm-svn: 37177
2007-05-17 20:01:40 +00:00
Chris Lattner
70c2175ed2 minor tweak
llvm-svn: 37176
2007-05-17 19:58:57 +00:00
Reid Spencer
5c138133b7 Get rid of leading zeros in the output of toString.
llvm-svn: 37175
2007-05-17 19:23:02 +00:00
Evan Cheng
0465aca5d2 New test case.
llvm-svn: 37174
2007-05-17 18:49:50 +00:00
Evan Cheng
afa1cb6da3 Fix a bogus check that prevented folding VECTOR_SHUFFLE to UNDEF; add an optimization to fold VECTOR_SHUFFLE to a zero vector.
llvm-svn: 37173
2007-05-17 18:45:50 +00:00
Evan Cheng
632c3f01ed Added missing patterns for UNPCKH* and PUNPCKH*.
llvm-svn: 37172
2007-05-17 18:44:37 +00:00
Dan Gohman
26b4ef76d9 Fix some sporadic segfaults that are triggered when SmallVector's heap
storage lands near the end of the available address space. In the expression
Begin+N > Capacity, the Begin+N was overflowing. Fix this by replacing it
by with an expression that doesn't involve computation of an address
beyond the end of allocated memory.

llvm-svn: 37171
2007-05-17 18:29:01 +00:00
Chris Lattner
7bee9ad4f7 add testcase for 128-bit add/sub
llvm-svn: 37170
2007-05-17 18:22:37 +00:00
Chris Lattner
0184f88deb disable MaskedValueIsZero, ComputeMaskedBits, and SimplifyDemandedBits for
i128 integers.  The 64-bit masks are not wide enough to represent the results.
These should be converted to APInt someday.

llvm-svn: 37169
2007-05-17 18:19:23 +00:00
Chris Lattner
2135bc08d6 add expand support for ADDC/SUBC/ADDE/SUBE so we can codegen 128-bit add/sub on 32-bit (or less) targets
llvm-svn: 37168
2007-05-17 18:15:41 +00:00
Reid Spencer
184a2c5a67 Regenerate.
llvm-svn: 37166
2007-05-17 18:11:03 +00:00
Reid Spencer
ce90cbb5e1 Make Perl a required dependency and cause configure script to fail if it
is not found.

llvm-svn: 37164
2007-05-17 18:06:19 +00:00
Chris Lattner
dade607f19 This is the correct fix for PR1427. This fixes mmx-shuffle.ll and doesn't
cause other regressions.

llvm-svn: 37160
2007-05-17 17:13:13 +00:00
Anton Korobeynikov
1ad4618715 Revert patch for PR1427. It breaks almost all vector tests.
llvm-svn: 37159
2007-05-17 07:50:14 +00:00
Chris Lattner
3e549e9d5f add support for 128-bit add/sub on ppc64
llvm-svn: 37158
2007-05-17 06:52:46 +00:00
Reid Spencer
07ae5465cd Print integer values as both decimal and hexadecimal for convenience
of verifying result values when debugging.

llvm-svn: 37156
2007-05-17 06:47:54 +00:00
Chris Lattner
13f4bf5c5e add support for 128-bit integer add/sub
llvm-svn: 37154
2007-05-17 06:35:11 +00:00
Reid Spencer
fffdf10566 For lshr by 0 bits, just return *this as a short cut. This also prevents
undefined behavior when the width > 64 bits.

llvm-svn: 37153
2007-05-17 06:26:29 +00:00
Devang Patel
2648effb23 New test.
llvm-svn: 37151
2007-05-17 06:22:12 +00:00
Chris Lattner
6a5a46322f Fix PR1427 and test/CodeGen/X86/mmx-shuffle.ll
llvm-svn: 37141
2007-05-17 03:29:42 +00:00
Chris Lattner
5de4944f70 testcase for PR1427
llvm-svn: 37140
2007-05-17 03:29:17 +00:00
Evan Cheng
2db22024cf Remove. Not needed.
llvm-svn: 37139
2007-05-17 00:11:35 +00:00
Evan Cheng
733b4bd8ae Default implementation of TargetInstrInfo::getBlockSize().
llvm-svn: 37138
2007-05-16 23:53:44 +00:00
Evan Cheng
429178d727 Add target hook to specify block size limit for if-conversion.
llvm-svn: 37134
2007-05-16 23:45:53 +00:00
Tanya Lattner
6ee68ca990 Merged in both release announcement guts.
llvm-svn: 37131
2007-05-16 23:25:46 +00:00
Dale Johannesen
7a6c175e7a Don't fold bitconvert(load) for preinc/postdec loads. Likewise stores.
llvm-svn: 37130
2007-05-16 22:45:30 +00:00
Evan Cheng
af71610429 isBlockPredicable() always ignore terminal instructions; add comments.
llvm-svn: 37126
2007-05-16 21:54:37 +00:00
Evan Cheng
1634e7186b ARM::tB is also predicable.
llvm-svn: 37125
2007-05-16 21:53:43 +00:00
Evan Cheng
dcff2eb0e8 PredicateInstruction returns true if the operation was successful.
llvm-svn: 37124
2007-05-16 21:53:07 +00:00
Evan Cheng
973c3739b0 Add default implementation of PredicateInstruction().
llvm-svn: 37123
2007-05-16 21:20:37 +00:00
Evan Cheng
5ea933a009 Rename M_PREDICATED to M_PREDICABLE; Moved isPredicable() to MachineInstr.
llvm-svn: 37121
2007-05-16 20:56:08 +00:00
Evan Cheng
4423687831 Move if-conversion after all passes that may use register scavenger.
llvm-svn: 37120
2007-05-16 20:52:46 +00:00
Evan Cheng
e2762c3d68 Removed isPredicable().
llvm-svn: 37119
2007-05-16 20:50:23 +00:00
Evan Cheng
dcd6cdf896 Make ARM::B isPredicable; Make Bcc and MOVCC condition option a normal operand so they are not predicable.
llvm-svn: 37118
2007-05-16 20:50:01 +00:00
Evan Cheng
cc33218607 Added isPredicable bit to class Instruction.
llvm-svn: 37117
2007-05-16 20:47:01 +00:00
Evan Cheng
b99726d7a0 Rename M_PREDICATED to M_PREDICABLE; opcode can be specified isPredicable without having a PredicateOperand.
llvm-svn: 37116
2007-05-16 20:45:24 +00:00
Evan Cheng
b862b46aac Rename M_PREDICATED to M_PREDICABLE; Move TargetInstrInfo::isPredicatable() to MachineInstr::isPredicable().
llvm-svn: 37115
2007-05-16 20:43:42 +00:00
Reid Spencer
a93c981f66 Fix a bug in the "fromString" method where radix 2,8 and 16 values were
not being generated correctly because the shl operator does not mutate its
object but returns a new value. Also, make the distinction between radix
16 and the others more clear.

llvm-svn: 37111
2007-05-16 19:18:22 +00:00
Reid Spencer
138249b8ca Update for arbitrary precision integer types.
llvm-svn: 37109
2007-05-16 18:44:01 +00:00
Reid Spencer
99e813eee9 Fix PR1355: Only compute the SUBPATH and TESTDIR once.
llvm-svn: 37108
2007-05-16 17:56:56 +00:00
Devang Patel
95e2b7b59e Fix PR number.
llvm-svn: 37107
2007-05-16 16:51:31 +00:00
Devang Patel
7d6b9e057c New test for PR1417
llvm-svn: 37106
2007-05-16 16:50:32 +00:00
Reid Spencer
1925c537f2 Avoid a "loss of precision" error in gcc 4.1.3.
llvm-svn: 37105
2007-05-16 16:39:29 +00:00
Duncan Sands
59ae77486c Output exception call-sites in address order, as required by the unwinding
runtime.

llvm-svn: 37104
2007-05-16 12:12:23 +00:00
Evan Cheng
01a4227ed1 Conditional branch is not a barrier.
llvm-svn: 37103
2007-05-16 07:45:54 +00:00
Chris Lattner
48fb92f75d Use a ptr set instead of a linear search to unique TokenFactor operands.
This fixes PR1423

llvm-svn: 37102
2007-05-16 06:37:59 +00:00
Chris Lattner
1087473e51 testcase for maskmovq
llvm-svn: 37101
2007-05-16 06:14:10 +00:00
Chris Lattner
888653cdba implement the missing maskmovq mmx intrinsic that akor hit.
llvm-svn: 37100
2007-05-16 06:08:17 +00:00
Chris Lattner
bf7366e908 add missing mmx intrinsic
llvm-svn: 37099
2007-05-16 06:03:49 +00:00
Evan Cheng
c95f95b6da Fix comment.
llvm-svn: 37098
2007-05-16 05:14:06 +00:00
Evan Cheng
35fc2119b0 Devang points out that we need an assertion here.
llvm-svn: 37097
2007-05-16 05:11:10 +00:00
Evan Cheng
c4f5ac8383 Fix comments.
llvm-svn: 37096
2007-05-16 05:09:34 +00:00
Reid Spencer
65ba7501fc Implement printing of instruction result values when debug info is turned
on. This helps to speed up the debugging time by showing computational
results as the program executes.

llvm-svn: 37095
2007-05-16 02:05:13 +00:00
Evan Cheng
288f133c71 Bug fix: should check ABI alignment, not pref. alignment.
llvm-svn: 37094
2007-05-16 02:04:50 +00:00
Evan Cheng
ad3aac71ce Hooks for predication support.
llvm-svn: 37093
2007-05-16 02:01:49 +00:00
Evan Cheng
f5e53a58db Initial commit of (very basic) if converter.
llvm-svn: 37092
2007-05-16 02:00:57 +00:00
Evan Cheng
eb3176552e Add TargetInstrInfo predication hooks.
llvm-svn: 37091
2007-05-16 01:58:56 +00:00
Devang Patel
431b6a5d4a New test.
llvm-svn: 37090
2007-05-15 23:44:27 +00:00
Dale Johannesen
420a85d0cf Remove extra CFG edges before doing these passes; it makes them happier.
llvm-svn: 37089
2007-05-15 21:19:17 +00:00
Chris Lattner
9b7e57315e add PR number and testcase from the PR.
llvm-svn: 37088
2007-05-15 20:40:25 +00:00
Chris Lattner
df341b48a3 new testcase
llvm-svn: 37087
2007-05-15 20:29:56 +00:00
Lauro Ramos Venancio
3f142cbca2 Fix an infinite recursion in GetNegatedExpression.
llvm-svn: 37086
2007-05-15 17:05:43 +00:00
Reid Spencer
13612b1491 Don't put test cases into regression test suite before the bug is fixed.
llvm-svn: 37085
2007-05-15 15:46:41 +00:00
Duncan Sands
750e8c5d4d The index into the actions table is a ULEB128 not a SLEB128.
llvm-svn: 37084
2007-05-15 13:54:14 +00:00
Nicolas Geoffray
77d99504cb Note on current implementation of ELF32/PPC ABI.
llvm-svn: 37083
2007-05-15 09:21:28 +00:00
Reid Spencer
1582c0548f Add a test case for PR1420
llvm-svn: 37082
2007-05-15 06:52:15 +00:00
Chris Lattner
66ad6fac2f selects can also reach here
llvm-svn: 37081
2007-05-15 06:42:04 +00:00
Chris Lattner
a6f88ced8b implement the ModuleProvider::dematerializeFunction hook
llvm-svn: 37080
2007-05-15 06:29:44 +00:00
Reid Spencer
daed139420 Un-brain-dead-ify the lowering of part set for the reverse case.
llvm-svn: 37071
2007-05-15 02:26:52 +00:00
Chris Lattner
2b5badc0e1 Fix CodeGen/PowerPC/2007-05-14-InlineAsmSelectCrash.ll, the other recent
patches are also needed.

llvm-svn: 37070
2007-05-15 01:36:44 +00:00
Chris Lattner
c7596efdad Fix some subtle issues handling immediate values. This fixes
test/CodeGen/ARM/2007-05-14-InlineAsmCstCrash.ll

llvm-svn: 37069
2007-05-15 01:33:58 +00:00
Chris Lattner
a7a37a107e new testcase that crashes llc
llvm-svn: 37068
2007-05-15 01:33:12 +00:00
Chris Lattner
0b7472da6f fix some subtle inline asm selection issues
llvm-svn: 37067
2007-05-15 01:31:05 +00:00
Evan Cheng
0f7cbe8370 Add PredicateOperand to all ARM instructions that have the condition field.
llvm-svn: 37066
2007-05-15 01:29:07 +00:00
Chris Lattner
c8798d085c fix subtle bugs in inline asm operand selection
llvm-svn: 37065
2007-05-15 01:28:08 +00:00
Evan Cheng
4d728b0419 Added getNumExplicitOperands and findFirstPredOperand.
llvm-svn: 37064
2007-05-15 01:26:09 +00:00
Evan Cheng
a32dee205f Added \!con(a,b) syntax to concatnate two dag fragments.
llvm-svn: 37063
2007-05-15 01:23:24 +00:00
Evan Cheng
785276fcda All operands that made up of the predicate operands are maked M_PREDICATE_OPERAND.
llvm-svn: 37062
2007-05-15 01:21:27 +00:00
Evan Cheng
c0fb94596a Mark all (not just the first) predicate operand M_PREDICATE_OPERAND.
llvm-svn: 37061
2007-05-15 01:20:36 +00:00
Evan Cheng
b0925c0e49 PredicateOperand related bug fix.
llvm-svn: 37060
2007-05-15 01:19:51 +00:00
Chris Lattner
c5900bd25b testcase that crashes llc
llvm-svn: 37059
2007-05-15 01:13:42 +00:00
Dan Gohman
eca3b67199 Correct a comment.
llvm-svn: 37058
2007-05-15 00:20:13 +00:00
Chris Lattner
234f96daa8 Fix Transforms/InstCombine/2007-05-14-Crash.ll
llvm-svn: 37057
2007-05-15 00:16:00 +00:00
Chris Lattner
120548e508 New testcase that crashes instcombine
llvm-svn: 37056
2007-05-15 00:15:49 +00:00
Lauro Ramos Venancio
1b8d46ab21 Fix previous patch. GOTOFF can be used only when the symbol has internal
linkage or hidden visibility.

llvm-svn: 37055
2007-05-14 23:20:21 +00:00
Chris Lattner
e49c974a7c implement a simple fneg optimization/propagation thing. This compiles:
CodeGen/PowerPC/fneg.ll into:

_t4:
        fmul f0, f3, f4
        fmadd f1, f1, f2, f0
        blr

instead of:

_t4:
        fneg f0, f3
        fmul f0, f0, f4
        fmsub f1, f1, f2, f0
        blr

llvm-svn: 37054
2007-05-14 22:04:50 +00:00
Chris Lattner
d1e6255141 new testcase
llvm-svn: 37053
2007-05-14 22:04:16 +00:00
Evan Cheng
e1595b6859 Only worry about intervening kill if there are more than one live ranges in the interval.
llvm-svn: 37052
2007-05-14 21:23:51 +00:00
Evan Cheng
4c28ec187e Test for PR1406.
llvm-svn: 37051
2007-05-14 21:12:43 +00:00
Evan Cheng
c690cba7d9 Fix for PR1406:
v1 =
r2 = move v1
   = op r2<kill>
...
r2 = move v1
   = op r2<kill>

Clear the first r2 kill if v1 and r2 are joined.

llvm-svn: 37050
2007-05-14 21:10:05 +00:00
Evan Cheng
03c64ec842 New test.
llvm-svn: 37048
2007-05-14 20:47:21 +00:00
Evan Cheng
5c7ce4561f Doh. .cpp -> .ll
llvm-svn: 37047
2007-05-14 20:43:28 +00:00
Evan Cheng
fc2377d4ed When marking a register as being implicitly defined, make sure to clear its partial use info as well.
llvm-svn: 37046
2007-05-14 20:39:18 +00:00
Lauro Ramos Venancio
d705f5d51d Optimize PIC implementation. GOTOFF can be used when the symbol is defined
and used in the same module.

llvm-svn: 37044
2007-05-14 18:46:23 +00:00
Lauro Ramos Venancio
3551928a2b Enable aliases on arm-linux.
llvm-svn: 37042
2007-05-14 18:32:56 +00:00
Evan Cheng
bc5c15276b Remove duplicated line.
llvm-svn: 37040
2007-05-14 18:03:45 +00:00
Reid Spencer
9cdab38520 Reverse last patch .. premature. Depends on uncommitted CBE patch.
llvm-svn: 37039
2007-05-14 17:58:52 +00:00
Reid Spencer
9c6a4d64aa Update this test to match the (corrected) output from the CBE.
llvm-svn: 37038
2007-05-14 17:56:39 +00:00
Reid Spencer
764ae2a21b Give names to the final result values of the part_set computations. This
just aids in readability and debugability of the output. No functional change.

llvm-svn: 37037
2007-05-14 17:21:17 +00:00
Reid Spencer
146281ce1a The wrapping behavior of part_set is not desirable. Adjust the
documentation to describe the desired behavior.

llvm-svn: 37036
2007-05-14 16:50:20 +00:00
Reid Spencer
70845c05e4 Revise definition of part_select. The wrapping behavior is not useful so
in the reverse case the only difference is that the bits are returned in
reverse order.

llvm-svn: 37035
2007-05-14 16:14:57 +00:00
Dan Gohman
8d40e4d965 Correct a few comments.
llvm-svn: 37034
2007-05-14 14:31:17 +00:00
Dan Gohman
90d97ac1e6 Add passes -view-cfg and -view-cfg-only that are like -print-cfg and
-print-cfg-only except they use the ViewCFG function, which displays the
CFG rendered with graphviz with gv.

llvm-svn: 37033
2007-05-14 14:25:08 +00:00
Dan Gohman
86110bdf06 Use templates for the GraphType for DefaultDOTGraphTraits' members instead
of just using void*. This allows it to be used with graph adapters like
Inverse.

llvm-svn: 37032
2007-05-14 14:23:27 +00:00
Dan Gohman
619bfa47e3 Add a addRequiredTransitiveID member function, which is to
addRequiredTransitive as addRequiredID is to addRequired.

llvm-svn: 37031
2007-05-14 14:21:46 +00:00
Chris Lattner
97beb5147f Add a skeleton for future contents
llvm-svn: 37028
2007-05-14 06:56:09 +00:00
Chris Lattner
ba12a9d1fb update comments
llvm-svn: 37027
2007-05-14 01:54:16 +00:00
Reid Spencer
98ed7db7ab Make the results for the rotate functions correct when rotateAmt == 0.
llvm-svn: 37026
2007-05-14 00:15:28 +00:00
Reid Spencer
4c50b52f63 Add some things needed by the llvm-gcc version supporting bit accurate integer
types:
1. Functions to compute div/rem at the same time.
2. Further assurance that an APInt with 0 bitwidth cannot be constructed.
3. Left and right rotate operations.
4. An exactLogBase2 function which requires an exact power of two or it
   returns -1.

llvm-svn: 37025
2007-05-13 23:44:59 +00:00
Chris Lattner
79c2c38ed5 add a link
llvm-svn: 37024
2007-05-13 23:38:44 +00:00
Chris Lattner
1904e45d0c Fix PR1413
llvm-svn: 37023
2007-05-13 22:19:27 +00:00
Chris Lattner
3b4ae44057 this crashes globalopt
llvm-svn: 37021
2007-05-13 21:28:25 +00:00
Chris Lattner
cea37beb52 Fix Transforms/GlobalOpt/2007-05-13-Crash.ll
llvm-svn: 37020
2007-05-13 21:28:07 +00:00
Anton Korobeynikov
1ee0c8d563 Emit function debug frames in one atom. This will prevent us from generating incorrect assembler in case of both
debug information & exception information presented.

llvm-svn: 37019
2007-05-13 17:30:11 +00:00
Anton Korobeynikov
bbaf55448b Emit multiple common EH frames for multiple (including blank) personality
functions. This partly fixes PR1414: now we're restricted only to one
personality function per eh frame, not per module. Further work on
"multiple personalities" topic needs representative example.

llvm-svn: 37018
2007-05-13 15:42:26 +00:00
Chris Lattner
8176a2f24e add initial description of llvm top-level stuff.
llvm-svn: 37017
2007-05-13 01:39:44 +00:00
Chris Lattner
d72bb414b6 finish the description of the bitstream format.
llvm-svn: 37016
2007-05-13 00:59:52 +00:00
Anton Korobeynikov
13da17843c More DWARF-related things cleanup:
1. Fix PR1380
2. Apply Duncan's patch from PR1410
3. Insert workaround for "one personality function per module" as noted in PR1414
4. Emit correct debug frames for x86/linux. This partly fixes DebugInfo/2006-11-06-StackTrace.cpp: stack trace is
shown correctly, but arguments for function on top of stack are displayed incorrectly.

llvm-svn: 37015
2007-05-12 22:36:25 +00:00
Reid Spencer
81ee020f64 Fix shl to produce the correct result when the bitwidth is > 64 and the
shift amount is 0. Previously this code would do a lshr by the bit width
which can lead to incorrect results.

llvm-svn: 37010
2007-05-12 18:01:57 +00:00
Reid Spencer
5d22b630af Add a test case for shl of APInt integers > 64 bits by 0 shift amount.
llvm-svn: 37009
2007-05-12 17:59:55 +00:00
Reid Spencer
bf283708f7 Get the size of auto arrays right, regardless of its changing size.
llvm-svn: 37006
2007-05-12 11:07:40 +00:00
Reid Spencer
ece86af259 Fix a grammaro.
llvm-svn: 37005
2007-05-12 08:01:52 +00:00
Chris Lattner
c0490b7c20 fix typo
llvm-svn: 37004
2007-05-12 07:50:14 +00:00
Chris Lattner
9ae5b57033 continued description
llvm-svn: 37003
2007-05-12 07:49:15 +00:00
Chris Lattner
73387daf33 add a bunch of content.
llvm-svn: 37002
2007-05-12 05:37:42 +00:00
Chris Lattner
22a641d43a first step
llvm-svn: 37001
2007-05-12 03:23:40 +00:00
Lauro Ramos Venancio
997a010c63 Add a known QEMU problem.
llvm-svn: 37000
2007-05-12 02:36:41 +00:00
Chris Lattner
a26153143e allow partially materialized modules to be written out, which just strips out
the functions which haven't been read.

llvm-svn: 36999
2007-05-11 23:51:59 +00:00
Devang Patel
79a71ec3ad Fix http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070507/049516.html
llvm-svn: 36998
2007-05-11 23:14:43 +00:00
Devang Patel
1b9349d190 New test.
llvm-svn: 36997
2007-05-11 23:13:19 +00:00
Chris Lattner
1480e16596 significantly improve debug output of lsr
llvm-svn: 36996
2007-05-11 22:40:34 +00:00
Dan Gohman
fead7979f7 Update comments to say "vector" instead of "packed".
llvm-svn: 36995
2007-05-11 21:43:24 +00:00
Dan Gohman
b5650ebd6a Fix typos.
llvm-svn: 36994
2007-05-11 21:10:54 +00:00
Dan Gohman
daff5ec052 Remove forward-declarations for classes that don't exist.
llvm-svn: 36993
2007-05-11 21:05:57 +00:00
Dan Gohman
fbb784e6af Add explicit keywords to several constructors that now have one argument.
llvm-svn: 36992
2007-05-11 21:04:48 +00:00
Dan Gohman
c272746f44 Simplify BranchInst::getSuccessor, avoiding a conditional operator.
llvm-svn: 36991
2007-05-11 20:59:29 +00:00
Dan Gohman
2980d9da45 This patch extends the LoopUnroll pass to be able to unroll loops
with unknown trip counts. This is left off by default, and a
command-line option enables it. It also begins to separate loop
unrolling into a utility routine; eventually it might be made usable
from other passes.

It currently works by inserting conditional branches between each
unrolled iteration, unless it proves that the trip count is a
multiple of a constant integer > 1, which it currently only does in
the rare case that the trip count expression is a Mul operator with
a ConstantInt operand. Eventually this information might be provided
by other sources, for example by a pass that peels/splits the loop
for this purpose.

llvm-svn: 36990
2007-05-11 20:53:41 +00:00
Chris Lattner
600db3eb96 fix regressions from my previous checking, including
Transforms/InstCombine/2006-12-08-ICmp-Combining.ll

llvm-svn: 36989
2007-05-11 16:58:45 +00:00
Anton Korobeynikov
67286b1266 Perform correct actions numbers/sizes computation
llvm-svn: 36988
2007-05-11 08:47:35 +00:00
Anton Korobeynikov
00d02442b0 Fix action No calculation in multiple-invoke-one-LP mode
llvm-svn: 36987
2007-05-11 08:23:57 +00:00
Reid Spencer
c014687788 For PR1411:
Don't try to use {} bracketing when setting a variable in site.exp

llvm-svn: 36985
2007-05-11 06:47:16 +00:00
Chris Lattner
fe2b44de9f fix Transforms/InstCombine/2007-05-10-icmp-or.ll
llvm-svn: 36984
2007-05-11 05:55:56 +00:00
Chris Lattner
b6d85ad1e1 new testcase that crashes instcombine
llvm-svn: 36983
2007-05-11 05:55:38 +00:00
Devang Patel
d385e3970f Drop ModuleID from comment.
llvm-svn: 36982
2007-05-11 00:45:58 +00:00
Chris Lattner
436370bac8 fix a memory leak
llvm-svn: 36981
2007-05-11 00:43:26 +00:00
Chris Lattner
fd96905f12 Fix a bug where the bcreader could crash on .bc files that were an exact
multiple of the page size, due to a bug in MappedFile

llvm-svn: 36980
2007-05-11 00:00:27 +00:00
Dale Johannesen
cc8f571bc8 Do not generate branches to entry block. This fixes several test suite
failures on PPC (can happen only when prologue code is null)

llvm-svn: 36979
2007-05-10 23:59:23 +00:00
Anton Korobeynikov
ee02c7d2fb Ooops. Some debugging stuff :)
llvm-svn: 36978
2007-05-10 22:38:46 +00:00
Anton Korobeynikov
96142de3f0 Allow multiple invokes per landing pad. This (probably) fixes PR1410.
llvm-svn: 36977
2007-05-10 22:34:59 +00:00
Duncan Sands
b43fe52136 Later computations assume we are aligned at this point.
llvm-svn: 36975
2007-05-10 18:40:24 +00:00
Anton Korobeynikov
ed5dad4306 TypeIds are indexed by j, not i
llvm-svn: 36974
2007-05-10 15:10:34 +00:00
Anton Korobeynikov
c52614ba88 These attributes are supported!
llvm-svn: 36973
2007-05-10 08:26:24 +00:00
Chris Lattner
3d82dcf1c4 gar. GCC 3.4.2 also miscompiles llvm at -O3. :(
llvm-svn: 36972
2007-05-10 06:42:21 +00:00
Chris Lattner
455563bb96 another version of gcc that miscompiles llvm.
llvm-svn: 36971
2007-05-10 05:37:14 +00:00
Dale Johannesen
b42c11265c Another test for tail mergeing
llvm-svn: 36967
2007-05-10 01:04:28 +00:00
Dale Johannesen
6e16d09252 Make tail merging handle many more cases (all it can, I think).
llvm-svn: 36966
2007-05-10 01:01:49 +00:00
Chris Lattner
623c738fe9 add some notes
llvm-svn: 36965
2007-05-10 00:08:04 +00:00
Evan Cheng
db214c77b4 Can't fold bit_convert into truncating store.
llvm-svn: 36963
2007-05-09 21:54:34 +00:00
Evan Cheng
f325c2a65e Can't fold the bit_convert is the store is a truncating store.
llvm-svn: 36962
2007-05-09 21:49:47 +00:00
Anton Korobeynikov
192d09c2d9 Do not assert, when case range split metric is zero and JTs are not allowed: just emit binary tree in this case. This
fixes PR1403.

llvm-svn: 36959
2007-05-09 20:07:08 +00:00
Lauro Ramos Venancio
bbe26581d9 Add two ARM known problems.
llvm-svn: 36958
2007-05-09 19:31:58 +00:00
Evan Cheng
bf67a327c7 PR1399 test case.
llvm-svn: 36957
2007-05-09 19:20:37 +00:00
Duncan Sands
dd75c1a255 Testcase for
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070507/049387.html

llvm-svn: 36956
2007-05-09 08:41:26 +00:00
Devang Patel
9557247412 Fix PR1333
Testcases :
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070507/049451.html
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070507/049452.html

llvm-svn: 36955
2007-05-09 08:24:12 +00:00
Devang Patel
00a08d129e New test.
llvm-svn: 36954
2007-05-09 08:19:24 +00:00
Devang Patel
519f2997cc New test.
llvm-svn: 36953
2007-05-09 08:08:46 +00:00
Chris Lattner
c97579318b arm no longer experimental, c++ eh support is?
llvm-svn: 36952
2007-05-09 06:23:58 +00:00
Chris Lattner
2d47f92f07 add a meta-blurb about the 2.0 release
llvm-svn: 36951
2007-05-09 05:27:05 +00:00
Chris Lattner
98a334980a strip the llvm 1.9 info out of the release notes
llvm-svn: 36950
2007-05-09 04:58:11 +00:00
Evan Cheng
9c031c0ddf Switch BCC, MOVCCr, etc. to PredicateOperand.
llvm-svn: 36948
2007-05-08 21:08:43 +00:00
Evan Cheng
d194a8603d PredicateOperand can be used as a normal operand for isel.
llvm-svn: 36947
2007-05-08 21:06:08 +00:00
Evan Cheng
5162f584c7 If a PredicateOperand has an empty ExecuteAlways field, treat it as if a normal operand for isel.
llvm-svn: 36946
2007-05-08 21:04:07 +00:00
Chris Lattner
75d56499c6 add the & back. I'm not sure why bill removed it.
llvm-svn: 36945
2007-05-08 20:08:06 +00:00
Bill Wendling
31fd60ba0c Change names from RA to something unique to get rid of naming conflicts with
certain linkers...

llvm-svn: 36944
2007-05-08 19:02:46 +00:00
Evan Cheng
9e17872c1d Eliminate MarkVirtRegAliveInBlock recursion.
llvm-svn: 36943
2007-05-08 19:00:00 +00:00
Evan Cheng
6c6cea91fc Add MachineBasicBlock preds / succs reverse iterators.
llvm-svn: 36942
2007-05-08 18:55:03 +00:00
Devang Patel
95cd89f25b New test for PR1400
llvm-svn: 36941
2007-05-08 18:08:20 +00:00
Dale Johannesen
882a6019af testcase for CodeGenPrepare bug fixed yesterday
llvm-svn: 36940
2007-05-08 17:44:36 +00:00
Evan Cheng
f50ba31ec6 R0 is a sub-register of X0, etc.
llvm-svn: 36939
2007-05-08 17:03:51 +00:00
Reid Spencer
1c153dd152 Regenerate.
llvm-svn: 36938
2007-05-08 15:23:37 +00:00
Reid Spencer
c82f324ba7 CHanges for autconf 2.60
llvm-svn: 36937
2007-05-08 15:22:59 +00:00
Dan Gohman
2e1f804764 Fix various whitespace inconsistencies.
llvm-svn: 36936
2007-05-08 15:19:19 +00:00
Dan Gohman
49d08a57f5 Correct the comment for ApproximateLoopSize to reflect what it actually does.
llvm-svn: 36935
2007-05-08 15:14:19 +00:00
Reid Spencer
96e48c26fe Adjust stkrc for change from Bytecode to Bitcode.
llvm-svn: 36934
2007-05-08 14:41:21 +00:00
Bill Wendling
0c976b8762 Spare '&' in the RUN line.
llvm-svn: 36933
2007-05-08 07:49:07 +00:00
Devang Patel
91041718f7 New test.
llvm-svn: 36930
2007-05-08 06:10:12 +00:00
Chris Lattner
aba457b30b update comments, no functionality change
llvm-svn: 36929
2007-05-08 05:38:32 +00:00
Chris Lattner
4c0a6d660e Make a preemptive bitcode format change to support PR1146. This lets us do
pr1146 in llvm 2.1 without ugly code to emulate old behavior.  This should
be merged into the 2.0 release branch.

llvm-svn: 36928
2007-05-08 05:38:01 +00:00
Tanya Lattner
2357362805 Bumping cvs version number
llvm-svn: 36922
2007-05-08 04:32:07 +00:00
Tanya Lattner
dbe7487618 Bump version number in cvs
llvm-svn: 36920
2007-05-08 04:22:59 +00:00
2366 changed files with 178666 additions and 108345 deletions

View File

@@ -1,10 +0,0 @@
mklib
Makefile.config
config.log
config.status
cvs.out
autom4te.cache
configure.out
LLVM-*
_distcheckdir
llvm.spec

View File

@@ -15,7 +15,8 @@ D: The Sparc64 backend, provider of much wisdom, and motivator for LLVM
N: Owen Anderson
E: resistor@mac.com
D: LCSSA pass and related LoopUnswitch work, TargetData refactoring, random improvements
D: LCSSA pass and related LoopUnswitch work
D: GVNPRE pass, TargetData refactoring, random improvements
N: Henrik Bach
D: MingW Win32 API portability layer
@@ -28,6 +29,11 @@ D: Target-independent code generator and analysis improvements
N: Daniel Berlin
E: dberlin@dberlin.org
D: ET-Forest implementation.
D: Sparse bitmap
N: Neil Booth
E: neil@daikokuya.co.uk
D: APFloat implementation.
N: Misha Brukman
E: brukman+llvm@uiuc.edu
@@ -62,7 +68,7 @@ D: Native Win32 API portability layer
N: John T. Criswell
E: criswell@uiuc.edu
D: Autoconf support, QMTest database, documentation improvements
D: Original Autoconf support, documentation improvements, bug fixes
N: Rafael Avila de Espindola
E: rafael.espindola@gmail.com
@@ -95,6 +101,21 @@ N: Dan Gohman
E: djg@cray.com
D: Miscellaneous bug fixes
N: David Greene
E: greened@obbligato.org
D: Miscellaneous bug fixes
D: Register allocation refactoring
N: Gordon Henriksen
E: gordonhenriksen@mac.com
D: Pluggable GC support
D: C interface
D: Ocaml bindings
N: Raul Fernandes Herbster
E: raul@dsc.ufcg.edu.br
D: JIT support for ARM
N: Paolo Invernizzi
E: arathorn@fastwebnet.it
D: Visual C++ compatibility fixes
@@ -110,6 +131,10 @@ D: Support for packed types
N: Dale Johannesen
E: dalej@apple.com
D: ARM constant islands improvements
D: Tail merging improvements
D: Rewrite X87 back end
D: Use APFloat for floating point constants widely throughout compiler
D: Implement X87 long double
N: Eric Kidd
W: http://randomhacks.net/
@@ -127,7 +152,9 @@ D: Author of the original C backend
N: Christopher Lamb
E: christopher.lamb@gmail.com
D: aligned load/store support
D: aligned load/store support, parts of noalias and restrict support
D: vreg subreg infrastructure, X86 codegen improvements based on subregs
D: address spaces
N: Jim Laskey
E: jlaskey@apple.com
@@ -141,7 +168,7 @@ E: sabre@nondot.org
W: http://nondot.org/~sabre/
D: Primary architect of LLVM
N: Tanya Lattner (formerly Tanya Brethour)
N: Tanya Lattner (Tanya Brethour)
E: tonic@nondot.org
W: http://nondot.org/~tonic/
D: The initial llvm-ar tool, converted regression testsuite to dejagnu
@@ -158,10 +185,15 @@ N: Nick Lewycky
E: nicholas@mxc.ca
D: PredicateSimplifier pass
N: Bruno Cardoso Lopes
E: bruno.cardoso@gmail.com
W: http://www.brunocardoso.org
D: The Mips backend
N: Duraid Madina
E: duraid@octopus.com.au
W: http://kinoko.c.u-tokyo.ac.jp/~duraid/
D: IA64 backend
D: IA64 backend, BigBlock register allocator
N: Michael McCracken
E: michael.mccracken@gmail.com
@@ -171,6 +203,10 @@ N: Vladimir Merzliakov
E: wanderer@rsu.ru
D: Test suite fixes for FreeBSD
N: Scott Michel
E: scottm@aero.org
D: Added STI Cell SPU backend.
N: Morten Ofstad
E: morten@hue.no
D: Visual C++ compatibility fixes
@@ -179,7 +215,7 @@ N: Devang Patel
E: dpatel@apple.com
D: LTO tool, PassManager rewrite, Loop Pass Manager, Loop Rotate
D: GCC PCH Integration (llvm-gcc), llvm-gcc improvements
D: Optimizer improvements
D: Optimizer improvements, Loop Index Split
N: Vladimir Prus
W: http://vladimir_prus.blogspot.com
@@ -192,12 +228,16 @@ D: MSIL backend
N: Duncan Sands
E: baldrick@free.fr
D: Ada front-end
D: Ada front-end, exception handling improvements
N: Ruchira Sasanka
E: sasanka@uiuc.edu
D: Graph coloring register allocator for the Sparc64 backend
N: Arnold Schwaighofer
E: arnold.schwaighofer@gmail.com
D: Tail call optimization for the x86 backend
N: Anand Shukla
E: ashukla@cs.uiuc.edu
D: The `paths' pass
@@ -205,7 +245,7 @@ D: The `paths' pass
N: Reid Spencer
E: rspencer@reidspencer.com
W: http://reidspencer.com/
D: http://wiki.llvm.org/index.php/User:Reid
D: Lots of stuff, see: http://wiki.llvm.org/index.php/User:Reid
N: Adam Treat
E: manyoso@yahoo.com
@@ -219,4 +259,6 @@ D: Thread Local Storage implementation
N: Bill Wendling
E: isanbard@gmail.com
W: http://web.mac.com/bwendling/
D: The `Lower Setjmp/Longjmp' pass, improvements to the -lowerswitch pass.
D: Darwin exception handling
D: MMX & SSSE3 instructions
D: SPEC2006 support

View File

@@ -4,7 +4,7 @@ LLVM Release License
University of Illinois/NCSA
Open Source License
Copyright (c) 2003-2007 University of Illinois at Urbana-Champaign.
Copyright (c) 2003-2008 University of Illinois at Urbana-Champaign.
All rights reserved.
Developed by:
@@ -66,4 +66,7 @@ Compiler Driver llvm/tools/llvmc
Autoconf llvm/autoconf
llvm/projects/ModuleMaker/autoconf
llvm/projects/sample/autoconf
GNU Libc llvm/runtime/GCCLibraries/libc
Boost C++ Libraries llvm/include : docs/BOOST_LICENSE_1_0.txt
CellSPU backend llvm/lib/Target/CellSPU/README.txt

View File

@@ -2,8 +2,8 @@
#
# The LLVM Compiler Infrastructure
#
# This file was developed by the LLVM research group and is distributed under
# the University of Illinois Open Source License. See LICENSE.TXT for details.
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
#===------------------------------------------------------------------------===#
@@ -19,8 +19,8 @@ LEVEL := .
#
DIRS := lib/System lib/Support utils lib/VMCore lib tools/llvm-config \
tools runtime docs
OPTIONAL_DIRS := examples projects
OPTIONAL_DIRS := examples projects bindings
EXTRA_DIST := test llvm.spec include win32 Xcode
include $(LEVEL)/Makefile.config
@@ -37,6 +37,11 @@ ifeq ($(MAKECMDGOALS),libs-only)
OPTIONAL_DIRS :=
endif
ifeq ($(MAKECMDGOALS),install-libs)
DIRS := $(filter-out tools runtime docs, $(DIRS))
OPTIONAL_DIRS := $(filter bindings, $(OPTIONAL_DIRS))
endif
ifeq ($(MAKECMDGOALS),tools-only)
DIRS := $(filter-out runtime docs, $(DIRS))
OPTIONAL_DIRS :=
@@ -46,7 +51,7 @@ endif
# build LLVM.
ifeq ($(MAKECMDGOALS),install)
DIRS := $(filter-out utils, $(DIRS))
OPTIONAL_DIRS :=
OPTIONAL_DIRS := $(filter bindings, $(OPTIONAL_DIRS))
endif
# Include the main makefile machinery.
@@ -81,6 +86,7 @@ dist-hook::
tools-only: all
libs-only: all
install-libs: install
#------------------------------------------------------------------------
# Make sure the generated headers are up-to-date. This must be kept in
@@ -128,4 +134,12 @@ show-footprint:
$(Verb) du -sk $(ExmplDir)
$(Verb) du -sk $(ObjDir)
build-for-llvm-top:
$(Verb) if test ! -f ./config.status ; then \
./configure --prefix="$(LLVM_TOP)/install" \
--with-llvm-gcc="$(LLVM_TOP)/llvm-gcc" ; \
fi
$(Verb) $(MAKE) tools-only
.PHONY: srpm rpm

View File

@@ -2,8 +2,8 @@
#
# The LLVM Compiler Infrastructure
#
# This file was developed by the LLVM research group and is distributed under
# the University of Illinois Open Source License. See LICENSE.TXT for details.
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
#===------------------------------------------------------------------------===#
#

View File

@@ -2,8 +2,8 @@
#
# The LLVM Compiler Infrastructure
#
# This file was developed by the LLVM research group and is distributed under
# the University of Illinois Open Source License. See LICENSE.TXT for details.
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
#===------------------------------------------------------------------------===#
#
@@ -83,7 +83,7 @@ PROJ_docsdir := $(DESTDIR)$(PROJ_prefix)/docs/llvm
PROJ_etcdir := $(DESTDIR)$(PROJ_prefix)/etc/llvm
PROJ_includedir := $(DESTDIR)$(PROJ_prefix)/include
PROJ_infodir := $(DESTDIR)$(PROJ_prefix)/info
PROJ_mandir := $(DESTDIR)$(PROJ_prefix)/man
PROJ_mandir := $(DESTDIR)$(PROJ_prefix)/share/man
# Determine if we're on a unix type operating system
LLVM_ON_UNIX:=@LLVM_ON_UNIX@
@@ -105,9 +105,6 @@ BUILD_EXEEXT=@BUILD_EXEEXT@
# Target triple (cpu-vendor-os) for which we should generate code
TARGET_TRIPLE=@target@
# Targets that we should build
TARGETS_TO_BUILD=@TARGETS_TO_BUILD@
# Extra options to compile LLVM with
EXTRA_OPTIONS=@EXTRA_OPTIONS@
@@ -152,10 +149,11 @@ PERL := @PERL@
BZIP2 := @BZIP2@
DOT := @DOT@
DOXYGEN := @DOXYGEN@
ETAGS := @ETAGS@
ETAGSFLAGS := @ETAGSFLAGS@
GROFF := @GROFF@
GZIP := @GZIP@
OCAMLC := @OCAMLC@
OCAMLOPT := @OCAMLOPT@
OCAMLDEP := @OCAMLDEP@
POD2HTML := @POD2HTML@
POD2MAN := @POD2MAN@
RUNTEST := @RUNTEST@
@@ -167,6 +165,9 @@ HAVE_PTHREAD := @HAVE_PTHREAD@
LIBS := @LIBS@
# Targets that we should build
TARGETS_TO_BUILD=@TARGETS_TO_BUILD@
# Path to location for LLVM C/C++ front-end. You can modify this if you
# want to override the value set by configure.
LLVMGCCDIR := @LLVMGCCDIR@
@@ -209,6 +210,11 @@ OBJ_ROOT := .
#DISABLE_ASSERTIONS = 1
@DISABLE_ASSERTIONS@
# When ENABLE_EXPENSIVE_CHECKS is enabled, builds of all of the LLVM
# code will include expensive checks, otherwise they are excluded.
#ENABLE_EXPENSIVE_CHECKS = 0
@ENABLE_EXPENSIVE_CHECKS@
# When DEBUG_RUNTIME is enabled, the runtime libraries will retain debug
# symbols.
#DEBUG_RUNTIME = 1
@@ -253,3 +259,17 @@ NOLINKALL := @NOLINKALL@
# Get the value of HUGE_VAL_SANITY which will be either "yes" or "no" depending
# on the check.
HUGE_VAL_SANITY = @HUGE_VAL_SANITY@
# Bindings that we should build
BINDINGS_TO_BUILD := @BINDINGS_TO_BUILD@
ALL_BINDINGS := @ALL_BINDINGS@
OCAML_LIBDIR := @OCAML_LIBDIR@
# When compiling under Mingw/Cygwin, executables such as tblgen
# expect Windows paths, whereas the build system uses Unix paths.
# The function SYSPATH transforms Unix paths into Windows paths.
ifneq (,$(findstring -mno-cygwin, $(CXX)))
SYSPATH = $(shell echo $(1) | cygpath -m -f -)
else
SYSPATH = $(1)
endif

View File

@@ -2,8 +2,8 @@
#
# The LLVM Compiler Infrastructure
#
# This file was developed by the LLVM research group and is distributed under
# the University of Illinois Open Source License. See LICENSE.TXT for details.
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
#===------------------------------------------------------------------------===#
#
@@ -23,7 +23,7 @@ RecursiveTargets := all clean clean-all install uninstall install-bytecode
LocalTargets := all-local clean-local clean-all-local check-local \
install-local printvars uninstall-local \
install-bytecode-local
TopLevelTargets := check dist dist-check dist-clean tags dist-gzip dist-bzip2 \
TopLevelTargets := check dist dist-check dist-clean dist-gzip dist-bzip2 \
dist-zip
UserTargets := $(RecursiveTargets) $(LocalTargets) $(TopLevelTargets)
InternalTargets := preconditions distdir dist-hook
@@ -38,7 +38,7 @@ InternalTargets := preconditions distdir dist-hook
VPATH=$(PROJ_SRC_DIR)
#--------------------------------------------------------------------
# Reset the list of suffixes we know how to build
# Reset the list of suffixes we know how to build.
#--------------------------------------------------------------------
.SUFFIXES:
.SUFFIXES: .c .cpp .cc .h .hpp .y .l .lo .o .a .bc .td .ps .dot .ll
@@ -199,6 +199,7 @@ install-bytecode:: install-bytecode-local
# Variables derived from configuration we are building
#--------------------------------------------------------------------
CPP.Defines :=
# OPTIMIZE_OPTION - The optimization level option we want to build LLVM with
# this can be overridden on the make command line.
ifneq ($(OS),MingW)
@@ -209,9 +210,10 @@ endif
ifdef ENABLE_PROFILING
BuildMode := Profile
CXX.Flags := $(OPTIMIZE_OPTION) -pg -g
C.Flags := $(OPTIMIZE_OPTION) -pg -g
LD.Flags := $(OPTIMIZE_OPTION) -pg -g
CXX.Flags += $(OPTIMIZE_OPTION) -pg -g
C.Flags += $(OPTIMIZE_OPTION) -pg -g
LD.Flags += $(OPTIMIZE_OPTION) -pg -g
KEEP_SYMBOLS := 1
else
ifeq ($(ENABLE_OPTIMIZED),1)
BuildMode := Release
@@ -227,14 +229,14 @@ else
EXTRA_OPTIONS += -fstrict-aliasing
endif
CXX.Flags := $(OPTIMIZE_OPTION) $(OmitFramePointer)
C.Flags := $(OPTIMIZE_OPTION) $(OmitFramePointer)
LD.Flags := $(OPTIMIZE_OPTION)
CXX.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer)
C.Flags += $(OPTIMIZE_OPTION) $(OmitFramePointer)
LD.Flags += $(OPTIMIZE_OPTION)
else
BuildMode := Debug
CXX.Flags := -g
C.Flags := -g
LD.Flags := -g
CXX.Flags += -g
C.Flags += -g
LD.Flags += -g
KEEP_SYMBOLS := 1
endif
endif
@@ -253,11 +255,17 @@ endif
# then disable assertions by defining the appropriate preprocessor symbols.
ifdef DISABLE_ASSERTIONS
BuildMode := $(BuildMode)-Asserts
CXX.Flags += -DNDEBUG
C.Flags += -DNDEBUG
CPP.Defines += -DNDEBUG
else
CXX.Flags += -D_DEBUG
C.Flags += -D_DEBUG
CPP.Defines += -D_DEBUG
endif
# If ENABLE_EXPENSIVE_CHECKS=1 is specified (make command line or
# configured), then enable expensive checks by defining the
# appropriate preprocessor symbols.
ifdef ENABLE_EXPENSIVE_CHECKS
BuildMode := $(BuildMode)+Checks
CPP.Defines += -D_GLIBCXX_DEBUG
endif
ifeq ($(ENABLE_PIC),1)
@@ -267,7 +275,8 @@ endif
CXX.Flags += $(CXXFLAGS) -Woverloaded-virtual
C.Flags += $(CFLAGS)
CPP.BaseFlags += $(CPPFLAGS)
CPP.Defines += $(CPPFLAGS)
CPP.BaseFlags += $(CPP.Defines)
LD.Flags += $(LDFLAGS)
AR.Flags := cru
LibTool.Flags := --tag=CXX
@@ -474,8 +483,14 @@ LTInstall = $(LIBTOOL) $(LibTool.Flags) --mode=install $(INSTALL) \
ProgInstall = $(INSTALL) $(Install.StripFlag) -m 0755
ScriptInstall = $(INSTALL) -m 0755
DataInstall = $(INSTALL) -m 0644
TableGen = $(TBLGEN) -I $(PROJ_SRC_DIR) -I$(PROJ_SRC_ROOT)/include \
-I $(PROJ_SRC_ROOT)/lib/Target
# When compiling under Mingw/Cygwin, the tblgen tool expects Windows
# paths. In this case, the SYSPATH function (defined in
# Makefile.config) transforms Unix paths into Windows paths.
TableGen = $(TBLGEN) -I $(call SYSPATH, $(PROJ_SRC_DIR)) \
-I $(call SYSPATH, $(PROJ_SRC_ROOT)/include) \
-I $(call SYSPATH, $(PROJ_SRC_ROOT)/lib/Target)
Archive = $(AR) $(AR.Flags)
LArchive = $(LLVMToolDir)/llvm-ar rcsf
ifdef RANLIB
@@ -1070,23 +1085,28 @@ ifndef DISABLE_AUTO_DEPENDENCIES
# Create .lo files in the ObjDir directory from the .cpp and .c files...
#---------------------------------------------------------
DEPEND_OPTIONS = -MMD -MP -MF "$(ObjDir)/$*.d.tmp" \
-MT "$(ObjDir)/$*.lo" -MT "$(ObjDir)/$*.o" -MT "$(ObjDir)/$*.d"
# If the build succeeded, move the dependency file over. If it failed, put an
# empty file there.
DEPEND_MOVEFILE = then $(MV) -f "$(ObjDir)/$*.d.tmp" "$(ObjDir)/$*.d"; \
else $(RM) "$(ObjDir)/$*.d.tmp"; exit 1; fi
$(ObjDir)/%.lo $(ObjDir)/%.o: %.cpp $(ObjDir)/.dir $(BUILT_SOURCES)
$(Echo) "Compiling $*.cpp for $(BuildMode) build " $(PIC_FLAG)
$(Verb) if $(MAYBE_PIC_Compile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACXXd $< -o $@ ;\
then $(MV) -f "$(ObjDir)/$*.LACXXd" "$(ObjDir)/$*.d"; \
else $(RM) -f "$(ObjDir)/$*.LACXXd"; exit 1; fi
$(Verb) if $(MAYBE_PIC_Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
$(DEPEND_MOVEFILE)
$(ObjDir)/%.lo $(ObjDir)/%.o: %.cc $(ObjDir)/.dir $(BUILT_SOURCES)
$(Echo) "Compiling $*.cc for $(BuildMode) build" $(PIC_FLAG)
$(Verb) if $(MAYBE_PIC_Compile.CXX) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACXXd $< -o $@ ;\
then $(MV) -f "$(ObjDir)/$*.LACXXd" "$(ObjDir)/$*.d"; \
else $(RM) -f "$(ObjDir)/$*.LACXXd"; exit 1; fi
$(Verb) if $(MAYBE_PIC_Compile.CXX) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
$(DEPEND_MOVEFILE)
$(ObjDir)/%.lo $(ObjDir)/%.o: %.c $(ObjDir)/.dir $(BUILT_SOURCES)
$(Echo) "Compiling $*.c for $(BuildMode) build" $(PIC_FLAG)
$(Verb) if $(MAYBE_PIC_Compile.C) -MD -MT $@ -MP -MF $(ObjDir)/$*.LACd $< -o $@ ; \
then $(MV) -f "$(ObjDir)/$*.LACd" "$(ObjDir)/$*.d"; \
else $(RM) -f "$(ObjDir)/$*.LACd"; exit 1; fi
$(Verb) if $(MAYBE_PIC_Compile.C) $(DEPEND_OPTIONS) $< -o $(ObjDir)/$*.o ; \
$(DEPEND_MOVEFILE)
#---------------------------------------------------------
# Create .bc files in the ObjDir directory from .cpp .cc and .c files...
@@ -1234,57 +1254,57 @@ $(INCFiles) : %.inc : $(ObjDir)/%.inc.tmp
$(TARGET:%=$(ObjDir)/%GenRegisterNames.inc.tmp): \
$(ObjDir)/%GenRegisterNames.inc.tmp : %.td $(ObjDir)/.dir
$(Echo) "Building $(<F) register names with tblgen"
$(Verb) $(TableGen) -gen-register-enums -o $@ $<
$(Verb) $(TableGen) -gen-register-enums -o $(call SYSPATH, $@) $<
$(TARGET:%=$(ObjDir)/%GenRegisterInfo.h.inc.tmp): \
$(ObjDir)/%GenRegisterInfo.h.inc.tmp : %.td $(ObjDir)/.dir
$(Echo) "Building $(<F) register information header with tblgen"
$(Verb) $(TableGen) -gen-register-desc-header -o $@ $<
$(Verb) $(TableGen) -gen-register-desc-header -o $(call SYSPATH, $@) $<
$(TARGET:%=$(ObjDir)/%GenRegisterInfo.inc.tmp): \
$(ObjDir)/%GenRegisterInfo.inc.tmp : %.td $(ObjDir)/.dir
$(Echo) "Building $(<F) register info implementation with tblgen"
$(Verb) $(TableGen) -gen-register-desc -o $@ $<
$(Verb) $(TableGen) -gen-register-desc -o $(call SYSPATH, $@) $<
$(TARGET:%=$(ObjDir)/%GenInstrNames.inc.tmp): \
$(ObjDir)/%GenInstrNames.inc.tmp : %.td $(ObjDir)/.dir
$(Echo) "Building $(<F) instruction names with tblgen"
$(Verb) $(TableGen) -gen-instr-enums -o $@ $<
$(Verb) $(TableGen) -gen-instr-enums -o $(call SYSPATH, $@) $<
$(TARGET:%=$(ObjDir)/%GenInstrInfo.inc.tmp): \
$(ObjDir)/%GenInstrInfo.inc.tmp : %.td $(ObjDir)/.dir
$(Echo) "Building $(<F) instruction information with tblgen"
$(Verb) $(TableGen) -gen-instr-desc -o $@ $<
$(Verb) $(TableGen) -gen-instr-desc -o $(call SYSPATH, $@) $<
$(TARGET:%=$(ObjDir)/%GenAsmWriter.inc.tmp): \
$(ObjDir)/%GenAsmWriter.inc.tmp : %.td $(ObjDir)/.dir
$(Echo) "Building $(<F) assembly writer with tblgen"
$(Verb) $(TableGen) -gen-asm-writer -o $@ $<
$(Verb) $(TableGen) -gen-asm-writer -o $(call SYSPATH, $@) $<
$(TARGET:%=$(ObjDir)/%GenAsmWriter1.inc.tmp): \
$(ObjDir)/%GenAsmWriter1.inc.tmp : %.td $(ObjDir)/.dir
$(Echo) "Building $(<F) assembly writer #1 with tblgen"
$(Verb) $(TableGen) -gen-asm-writer -asmwriternum=1 -o $@ $<
$(Verb) $(TableGen) -gen-asm-writer -asmwriternum=1 -o $(call SYSPATH, $@) $<
$(TARGET:%=$(ObjDir)/%GenCodeEmitter.inc.tmp): \
$(ObjDir)/%GenCodeEmitter.inc.tmp: %.td $(ObjDir)/.dir
$(Echo) "Building $(<F) code emitter with tblgen"
$(Verb) $(TableGen) -gen-emitter -o $@ $<
$(Verb) $(TableGen) -gen-emitter -o $(call SYSPATH, $@) $<
$(TARGET:%=$(ObjDir)/%GenDAGISel.inc.tmp): \
$(ObjDir)/%GenDAGISel.inc.tmp : %.td $(ObjDir)/.dir
$(Echo) "Building $(<F) instruction selector implementation with tblgen"
$(Verb) $(TableGen) -gen-dag-isel -o $@ $<
$(Verb) $(TableGen) -gen-dag-isel -o $(call SYSPATH, $@) $<
$(TARGET:%=$(ObjDir)/%GenSubtarget.inc.tmp): \
$(ObjDir)/%GenSubtarget.inc.tmp : %.td $(ObjDir)/.dir
$(Echo) "Building $(<F) subtarget information with tblgen"
$(Verb) $(TableGen) -gen-subtarget -o $@ $<
$(Verb) $(TableGen) -gen-subtarget -o $(call SYSPATH, $@) $<
$(TARGET:%=$(ObjDir)/%GenCallingConv.inc.tmp): \
$(ObjDir)/%GenCallingConv.inc.tmp : %.td $(ObjDir)/.dir
$(Echo) "Building $(<F) calling convention information with tblgen"
$(Verb) $(TableGen) -gen-callingconv -o $@ $<
$(Verb) $(TableGen) -gen-callingconv -o $(call SYSPATH, $@) $<
clean-local::
-$(Verb) $(RM) -f $(INCFiles)
@@ -1359,15 +1379,12 @@ all:: $(YaccFiles:%.y=$(PROJ_SRC_DIR)/%.cpp.cvs)
%.h: %.y
# Rule for building the bison based parsers...
$(PROJ_SRC_DIR)/%.cpp $(PROJ_SRC_DIR)/%.h : $(PROJ_SRC_DIR)/%.y
ifneq ($(BISON),)
$(PROJ_SRC_DIR)/%.cpp $(PROJ_SRC_DIR)/%.h : $(PROJ_SRC_DIR)/%.y
$(Echo) "Bisoning $*.y"
$(Verb) $(BISON) -v -d -p $(<F:%Parser.y=%) -o $*.tab.c $<
$(Verb) $(MV) -f $*.tab.c $(PROJ_SRC_DIR)/$*.cpp
$(Verb) $(MV) -f $*.tab.h $(PROJ_SRC_DIR)/$*.h
else
$(Echo) "Bison of $*.y SKIPPED -- bison not found"
endif
# IFF the .y file has changed since it was last checked into CVS, copy the .y
# file to .y.cvs and the generated .cpp/.h file to .cpp.cvs/.h.cvs. We use this
@@ -1380,6 +1397,16 @@ $(PROJ_SRC_DIR)/%.cpp.cvs: $(PROJ_SRC_DIR)/%.cpp
$(CP) $(PROJ_SRC_DIR)/$*.y $(PROJ_SRC_DIR)/$*.y.cvs; \
$(CP) $(PROJ_SRC_DIR)/$*.h $(PROJ_SRC_DIR)/$*.h.cvs)
else
$(PROJ_SRC_DIR)/%.cpp : $(PROJ_SRC_DIR)/%.cpp.cvs
$(Echo) "Bison of $*.y SKIPPED, bison not found -- copying .cpp.cvs"
$(Verb)$(CP) $(PROJ_SRC_DIR)/$*.cpp.cvs $(PROJ_SRC_DIR)/$*.cpp
$(PROJ_SRC_DIR)/%.h : $(PROJ_SRC_DIR)/%.h.cvs
$(Echo) "Bison of $*.y SKIPPED, bison not found -- copying .h.cvs"
$(Verb)$(CP) $(PROJ_SRC_DIR)/$*.h.cvs $(PROJ_SRC_DIR)/$*.h
endif
$(YaccFiles:%.y=$(ObjDir)/%.o): $(ObjDir)/%.o : $(PROJ_SRC_DIR)/%.cpp
@@ -1423,25 +1450,6 @@ endif
clean-all-local::
-$(Verb) $(RM) -rf Debug Release Profile
# Build tags database for Emacs/Xemacs:
tags:: TAGS CTAGS
TAGS:
find $(PROJ_SRC_ROOT)/include $(PROJ_SRC_ROOT)/lib \
$(PROJ_SRC_ROOT)/tools $(PROJ_SRC_ROOT)/examples \
$(PROJ_OBJ_ROOT)/include $(PROJ_OBJ_ROOT)/lib \
$(PROJ_OBJ_ROOT)/tools $(PROJ_OBJ_ROOT)/examples \
-name '*.cpp' -o -name '*.h' | \
$(ETAGS) $(ETAGSFLAGS) -
CTAGS:
find $(PROJ_SRC_ROOT)/include $(PROJ_SRC_ROOT)/lib \
$(PROJ_SRC_ROOT)/tools $(PROJ_SRC_ROOT)/examples \
$(PROJ_OBJ_ROOT)/include $(PROJ_OBJ_ROOT)/lib \
$(PROJ_OBJ_ROOT)/tools $(PROJ_OBJ_ROOT)/examples \
\( -name '*.cpp' -o -name '*.h' \) -print | \
ctags -ImtT -o $(PROJ_OBJ_ROOT)/CTAGS -L -
###############################################################################
# DEPENDENCIES: Include the dependency files if we should
@@ -1449,13 +1457,13 @@ CTAGS:
ifndef DISABLE_AUTO_DEPENDENCIES
# If its not one of the cleaning targets
ifneq ($(strip $(filter-out clean clean-local dist-clean,$(MAKECMDGOALS)))),)
ifneq ($(strip $(filter-out clean clean-local dist-clean,$(MAKECMDGOALS))),)
# Get the list of dependency files
DependFiles := $(basename $(filter %.cpp %.c %.cc, $(Sources)))
DependFiles := $(DependFiles:%=$(PROJ_OBJ_DIR)/$(BuildMode)/%.d)
-include /dev/null $(DependFiles)
-include $(DependFiles) ""
endif

4
llvm/ModuleInfo.txt Normal file
View File

@@ -0,0 +1,4 @@
DepModule:
BuildCmd: ./build-for-llvm-top.sh
CleanCmd: make clean
InstallCmd: make install

File diff suppressed because it is too large Load Diff

View File

@@ -1,2 +0,0 @@
aclocal.m4
autom4te.cache

View File

@@ -3,16 +3,29 @@ die () {
echo "$@" 1>&2
exit 1
}
### NOTE: ############################################################"
### The below two variables specify the auto* versions
### periods should be escaped with backslash, for use by grep
want_autoconf_version='2\.60'
want_autoheader_version=$want_autoconf_version
### END NOTE #########################################################"
outfile=configure
configfile=configure.ac
want_autoconf_version_clean=`echo $want_autoconf_version | sed -e 's/\\\\//g'`
want_autoheader_version_clean=`echo $want_autoheader_version | sed -e 's/\\\\//g'`
test -d autoconf && test -f autoconf/$configfile && cd autoconf
test -f $configfile || die "Can't find 'autoconf' dir; please cd into it first"
autoconf --version | grep '2\.60' > /dev/null
test $? -eq 0 || die "Your autoconf was not detected as being 2.60"
autoconf --version | grep $want_autoconf_version > /dev/null
test $? -eq 0 || die "Your autoconf was not detected as being $want_autoconf_version_clean"
aclocal --version | grep '^aclocal.*1\.9\.6' > /dev/null
test $? -eq 0 || die "Your aclocal was not detected as being 1.9.6"
autoheader --version | grep '^autoheader.*2\.60' > /dev/null
test $? -eq 0 || die "Your autoheader was not detected as being 2.60"
autoheader --version | grep '^autoheader.*'$want_autoheader_version > /dev/null
test $? -eq 0 || die "Your autoheader was not detected as being $want_autoheader_version_clean"
libtool --version | grep '1\.5\.22' > /dev/null
test $? -eq 0 || die "Your libtool was not detected as being 1.5.22"
echo ""
@@ -27,9 +40,9 @@ echo ""
echo "Regenerating aclocal.m4 with aclocal 1.9.6"
cwd=`pwd`
aclocal --force -I $cwd/m4 || die "aclocal failed"
echo "Regenerating configure with autoconf 2.60"
echo "Regenerating configure with autoconf $want_autoconf_version_clean"
autoconf --force --warnings=all -o ../$outfile $configfile || die "autoconf failed"
cd ..
echo "Regenerating config.h.in with autoheader 2.60"
echo "Regenerating config.h.in with autoheader $want_autoheader_version_clean"
autoheader --warnings=all -I autoconf -I autoconf/m4 autoconf/$configfile || die "autoheader failed"
exit 0

View File

@@ -1,12 +1,12 @@
dnl === configure.ac --------------------------------------------------------===
dnl The LLVM Compiler Infrastructure
dnl
dnl This file was developed by the LLVM research group and is distributed under
dnl the University of Illinois Open Source License. See LICENSE.TXT for details.
dnl
dnl This file is distributed under the University of Illinois Open Source
dnl License. See LICENSE.TXT for details.
dnl
dnl===-----------------------------------------------------------------------===
dnl This is the LLVM configuration script. It is processed by the autoconf
dnl program to produce a script named configure. This script contains the
dnl program to produce a script named configure. This script contains the
dnl configuration checks that LLVM needs in order to support multiple platforms.
dnl This file is composed of 10 sections per the recommended organization of
dnl autoconf input defined in the autoconf documentation. As this file evolves,
@@ -31,12 +31,12 @@ dnl===
dnl===-----------------------------------------------------------------------===
dnl Initialize autoconf and define the package name, version number and
dnl email address for reporting bugs.
AC_INIT([[llvm]],[[2.0cvs]],[llvmbugs@cs.uiuc.edu])
AC_INIT([[llvm]],[[2.2]],[llvmbugs@cs.uiuc.edu])
dnl Provide a copyright substitution and ensure the copyright notice is included
dnl in the output of --version option of the generated configure script.
AC_SUBST(LLVM_COPYRIGHT,["Copyright (c) 2003-2007 University of Illinois at Urbana-Champaign."])
AC_COPYRIGHT([Copyright (c) 2003-2007 University of Illinois at Urbana-Champaign.])
AC_SUBST(LLVM_COPYRIGHT,["Copyright (c) 2003-2008 University of Illinois at Urbana-Champaign."])
AC_COPYRIGHT([Copyright (c) 2003-2008 University of Illinois at Urbana-Champaign.])
dnl Indicate that we require autoconf 2.59 or later. Ths is needed because we
dnl use some autoconf macros only available in 2.59.
@@ -46,8 +46,8 @@ dnl Verify that the source directory is valid. This makes sure that we are
dnl configuring LLVM and not some other package (it validates --srcdir argument)
AC_CONFIG_SRCDIR([lib/VMCore/Module.cpp])
dnl Place all of the extra autoconf files into the config subdirectory. Tell
dnl various tools where the m4 autoconf macros are.
dnl Place all of the extra autoconf files into the config subdirectory. Tell
dnl various tools where the m4 autoconf macros are.
AC_CONFIG_AUX_DIR([autoconf])
dnl Quit if the source directory has already been configured.
@@ -76,8 +76,9 @@ do
llvm-java) AC_CONFIG_SUBDIRS([projects/llvm-java]) ;;
llvm-tv) AC_CONFIG_SUBDIRS([projects/llvm-tv]) ;;
llvm-poolalloc) AC_CONFIG_SUBDIRS([projects/llvm-poolalloc]) ;;
poolalloc) AC_CONFIG_SUBDIRS([projects/poolalloc]) ;;
llvm-kernel) AC_CONFIG_SUBDIRS([projects/llvm-kernel]) ;;
*)
*)
AC_MSG_WARN([Unknown project (${i}) won't be configured automatically])
;;
esac
@@ -91,8 +92,8 @@ dnl===
dnl===-----------------------------------------------------------------------===
dnl Check the target for which we're compiling and the host that will do the
dnl compilations. This will tell us which LLVM compiler will be used for
dnl compiling SSA into object code. This needs to be done early because
dnl compilations. This will tell us which LLVM compiler will be used for
dnl compiling SSA into object code. This needs to be done early because
dnl following tests depend on it.
AC_CANONICAL_TARGET
@@ -101,75 +102,75 @@ dnl the System library to the correct build platform.
AC_CACHE_CHECK([type of operating system we're going to host on],
[llvm_cv_os_type],
[case $host in
*-*-aix*)
*-*-aix*)
llvm_cv_link_all_option="-Wl,--whole-archive"
llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
llvm_cv_os_type="AIX"
llvm_cv_os_type="AIX"
llvm_cv_platform_type="Unix" ;;
*-*-irix*)
*-*-irix*)
llvm_cv_link_all_option="-Wl,--whole-archive"
llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
llvm_cv_os_type="IRIX"
llvm_cv_os_type="IRIX"
llvm_cv_platform_type="Unix" ;;
*-*-cygwin*)
*-*-cygwin*)
llvm_cv_link_all_option="-Wl,--whole-archive"
llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
llvm_cv_os_type="Cygwin"
llvm_cv_os_type="Cygwin"
llvm_cv_platform_type="Unix" ;;
*-*-darwin*)
*-*-darwin*)
llvm_cv_link_all_option="-Wl,-all_load"
llvm_cv_link_all_option="-Wl,-noall_load"
llvm_cv_os_type="Darwin"
llvm_cv_platform_type="Unix" ;;
*-*-freebsd*)
*-*-freebsd*)
llvm_cv_link_all_option="-Wl,--whole-archive"
llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
llvm_cv_os_type="FreeBSD"
llvm_cv_os_type="FreeBSD"
llvm_cv_platform_type="Unix" ;;
*-*-openbsd*)
*-*-openbsd*)
llvm_cv_link_all_option="-Wl,--whole-archive"
llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
llvm_cv_os_type="OpenBSD"
llvm_cv_os_type="OpenBSD"
llvm_cv_platform_type="Unix" ;;
*-*-netbsd*)
*-*-netbsd*)
llvm_cv_link_all_option="-Wl,--whole-archive"
llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
llvm_cv_os_type="NetBSD"
llvm_cv_os_type="NetBSD"
llvm_cv_platform_type="Unix" ;;
*-*-hpux*)
*-*-hpux*)
llvm_cv_link_all_option="-Wl,--whole-archive"
llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
llvm_cv_os_type="HP-UX"
llvm_cv_os_type="HP-UX"
llvm_cv_platform_type="Unix" ;;
*-*-interix*)
*-*-interix*)
llvm_cv_link_all_option="-Wl,--whole-archive"
llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
llvm_cv_os_type="Interix"
llvm_cv_platform_type="Unix" ;;
*-*-linux*)
*-*-linux*)
llvm_cv_link_all_option="-Wl,--whole-archive"
llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
llvm_cv_os_type="Linux"
llvm_cv_platform_type="Unix" ;;
*-*-solaris*)
*-*-solaris*)
llvm_cv_link_all_option="-Wl,-z,allextract"
llvm_cv_no_link_all_option="-Wl,-z,defaultextract"
llvm_cv_os_type="SunOS"
llvm_cv_platform_type="Unix" ;;
*-*-win32*)
*-*-win32*)
llvm_cv_link_all_option="-Wl,--whole-archive"
llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
llvm_cv_os_type="Win32"
llvm_cv_platform_type="Win32" ;;
*-*-mingw*)
*-*-mingw*)
llvm_cv_link_all_option="-Wl,--whole-archive"
llvm_cv_no_link_all_option="-Wl,--no-whole-archive"
llvm_cv_os_type="MingW"
llvm_cv_os_type="MingW"
llvm_cv_platform_type="Win32" ;;
*)
llvm_cv_link_all_option=""
*)
llvm_cv_link_all_option=""
llvm_cv_no_link_all_option=""
llvm_cv_os_type="Unknown"
llvm_cv_os_type="Unknown"
llvm_cv_platform_type="Unknown" ;;
esac])
@@ -190,13 +191,13 @@ dnl Set the "LLVM_ON_*" variables based on llvm_cvs_platform_type
dnl This is used by lib/System to determine the basic kind of implementation
dnl to use.
case $llvm_cv_platform_type in
Unix)
AC_DEFINE([LLVM_ON_UNIX],[1],[Define if this is Unixish platform])
Unix)
AC_DEFINE([LLVM_ON_UNIX],[1],[Define if this is Unixish platform])
AC_SUBST(LLVM_ON_UNIX,[1])
AC_SUBST(LLVM_ON_WIN32,[0])
;;
Win32)
AC_DEFINE([LLVM_ON_WIN32],[1],[Define if this is Win32ish platform])
Win32)
AC_DEFINE([LLVM_ON_WIN32],[1],[Define if this is Win32ish platform])
AC_SUBST(LLVM_ON_UNIX,[0])
AC_SUBST(LLVM_ON_WIN32,[1])
;;
@@ -214,6 +215,7 @@ AC_CACHE_CHECK([target architecture],[llvm_cv_target_arch],
alpha*-*) llvm_cv_target_arch="Alpha" ;;
ia64-*) llvm_cv_target_arch="IA64" ;;
arm-*) llvm_cv_target_arch="ARM" ;;
mips-*) llvm_cv_target_arch="Mips" ;;
*) llvm_cv_target_arch="Unknown" ;;
esac])
@@ -229,15 +231,15 @@ AC_C_BIGENDIAN(AC_SUBST([ENDIAN],[big]),AC_SUBST([ENDIAN],[little]))
dnl Check for build platform executable suffix if we're crosscompiling
if test "$cross_compiling" = yes; then
AC_SUBST(LLVM_CROSS_COMPILING, [1])
AC_SUBST(LLVM_CROSS_COMPILING, [1])
AC_BUILD_EXEEXT
else
AC_SUBST(LLVM_CROSS_COMPILING, [0])
fi
dnl Check to see if there's a "CVS" (or .svn) directory indicating that this
dnl Check to see if there's a "CVS" (or .svn) directory indicating that this
dnl build is being done from a checkout. This sets up several defaults for the
dnl command line switches. When we build with a CVS directory, we get a
dnl command line switches. When we build with a CVS directory, we get a
dnl debug with assertions turned on. Without, we assume a source release and we
dnl get an optimized build without assertions. See --enable-optimized and
dnl --enable-assertions below
@@ -274,6 +276,17 @@ else
AC_SUBST(DISABLE_ASSERTIONS,[[DISABLE_ASSERTIONS=1]])
fi
dnl --enable-expensive-checks : check whether they want to turn on expensive debug checks:
AC_ARG_ENABLE(expensive-checks,AS_HELP_STRING(
[--enable-expensive-checks,Compile with expensive debug checks enabled (default is NO)]),, enableval="no")
if test ${enableval} = "yes" ; then
AC_SUBST(ENABLE_EXPENSIVE_CHECKS,[[ENABLE_EXPENSIVE_CHECKS=1]])
AC_SUBST(EXPENSIVE_CHECKS,[[yes]])
else
AC_SUBST(ENABLE_EXPENSIVE_CHECKS,[[]])
AC_SUBST(EXPENSIVE_CHECKS,[[no]])
fi
dnl --enable-debug-runtime : should runtime libraries have debug symbols?
AC_ARG_ENABLE(debug-runtime,
AS_HELP_STRING([--enable-debug-runtime,Build runtime libs with debug symbols (default is NO)]),,enableval=no)
@@ -300,6 +313,7 @@ else
Alpha) AC_SUBST(TARGET_HAS_JIT,1) ;;
IA64) AC_SUBST(TARGET_HAS_JIT,0) ;;
ARM) AC_SUBST(TARGET_HAS_JIT,0) ;;
Mips) AC_SUBST(TARGET_HAS_JIT,0) ;;
*) AC_SUBST(TARGET_HAS_JIT,0) ;;
esac
fi
@@ -349,7 +363,7 @@ AC_ARG_ENABLE([targets],AS_HELP_STRING([--enable-targets],
[Build specific host targets: all,host-only,{target-name} (default=all)]),,
enableval=all)
case "$enableval" in
all) TARGETS_TO_BUILD="X86 Sparc PowerPC Alpha IA64 ARM" ;;
all) TARGETS_TO_BUILD="X86 Sparc PowerPC Alpha IA64 ARM Mips CellSPU CBackend MSIL" ;;
host-only)
case "$llvm_cv_target_arch" in
x86) TARGETS_TO_BUILD="X86" ;;
@@ -359,8 +373,10 @@ case "$enableval" in
Alpha) TARGETS_TO_BUILD="Alpha" ;;
IA64) TARGETS_TO_BUILD="IA64" ;;
ARM) TARGETS_TO_BUILD="ARM" ;;
Mips) TARGETS_TO_BUILD="Mips" ;;
CellSPU|SPU) TARGETS_TO_BUILD="CellSPU" ;;
*) AC_MSG_ERROR([Can not set target to build]) ;;
esac
esac
;;
*)for a_target in `echo $enableval|sed -e 's/,/ /g' ` ; do
case "$a_target" in
@@ -371,12 +387,15 @@ case "$enableval" in
alpha) TARGETS_TO_BUILD="Alpha $TARGETS_TO_BUILD" ;;
ia64) TARGETS_TO_BUILD="IA64 $TARGETS_TO_BUILD" ;;
arm) TARGETS_TO_BUILD="ARM $TARGETS_TO_BUILD" ;;
mips) TARGETS_TO_BUILD="Mips $TARGETS_TO_BUILD" ;;
spu) TARGETS_TO_BUILD="CellSPU $TARGETS_TO_BUILD" ;;
cbe) TARGETS_TO_BUILD="CBackend $TARGETS_TO_BUILD" ;;
msil) TARGETS_TO_BUILD="MSIL $TARGETS_TO_BUILD" ;;
*) AC_MSG_ERROR([Unrecognized target $a_target]) ;;
esac
done
done
;;
esac
TARGETS_TO_BUILD="CBackend MSIL $TARGETS_TO_BUILD"
AC_SUBST(TARGETS_TO_BUILD,$TARGETS_TO_BUILD)
dnl Prevent the CBackend from using printf("%a") for floating point so older
@@ -405,6 +424,28 @@ case "$withval" in
*) AC_MSG_ERROR([Invalid path for --with-llvmgccdir. Provide full path]) ;;
esac
dnl Allow a specific llvm-gcc compiler to be used with this LLVM config.
AC_ARG_WITH(llvmgcc,
AS_HELP_STRING([--with-llvmgcc],
[Specify location of llvm-gcc driver (default searches PATH)]),
LLVMGCC=$with_llvmgcc
WITH_LLVMGCCDIR="",)
dnl Allow a specific llvm-g++ compiler to be used with this LLVM config.
AC_ARG_WITH(llvmgxx,
AS_HELP_STRING([--with-llvmgxx],
[Specify location of llvm-g++ driver (default searches PATH)]),
LLVMGXX=$with_llvmgxx
WITH_LLVMGCCDIR="",)
if test -n "$LLVMGCC" && test -z "$LLVMGXX"; then
AC_MSG_ERROR([Invalid llvm-g++. Use --with-llvmgxx when --with-llvmgcc is used]);
fi
if test -n "$LLVMGXX" && test -z "$LLVMGCC"; then
AC_MSG_ERROR([Invalid llvm-gcc. Use --with-llvmgcc when --with-llvmgxx is used]);
fi
dnl Specify extra build options
AC_ARG_WITH(extra-options,
AS_HELP_STRING([--with-extra-options],
@@ -416,6 +457,38 @@ case "$withval" in
esac
AC_SUBST(EXTRA_OPTIONS,$EXTRA_OPTIONS)
dnl Allow specific bindings to be specified for building (or not)
AC_ARG_ENABLE([bindings],AS_HELP_STRING([--enable-bindings],
[Build specific language bindings: all,auto,none,{binding-name} (default=auto)]),,
enableval=default)
BINDINGS_TO_BUILD=""
case "$enableval" in
yes | default | auto) BINDINGS_TO_BUILD="auto" ;;
all ) BINDINGS_TO_BUILD="ocaml" ;;
none | no) BINDINGS_TO_BUILD="" ;;
*)for a_binding in `echo $enableval|sed -e 's/,/ /g' ` ; do
case "$a_binding" in
ocaml) BINDINGS_TO_BUILD="ocaml $BINDINGS_TO_BUILD" ;;
*) AC_MSG_ERROR([Unrecognized binding $a_binding]) ;;
esac
done
;;
esac
dnl Allow the ocaml libdir to be overridden. This could go in a configure
dnl script for bindings/ocaml/configure, except that its auto value depends on
dnl OCAMLC, which is found here to support tests.
AC_ARG_WITH([ocaml-libdir],
[AS_HELP_STRING([--with-ocaml-libdir],
[Specify install location for ocaml bindings (default is stdlib)])],
[],
[withval=auto])
case "$withval" in
auto) with_ocaml_libdir="$withval" ;;
/* | [[A-Za-z]]:[[\\/]]*) with_ocaml_libdir="$withval" ;;
*) AC_MSG_ERROR([Invalid path for --with-ocaml-libdir. Provide full path]) ;;
esac
dnl===-----------------------------------------------------------------------===
dnl===
dnl=== SECTION 4: Check for programs we need and that they are the right version
@@ -495,6 +568,7 @@ LLVM_PROG_PERL([5.006])
AC_SUBST(PERL)
if test x"$PERL" = xnone; then
AC_SUBST(HAVE_PERL,0)
AC_MSG_ERROR([perl is required but was not found, please install it])
else
AC_SUBST(HAVE_PERL,1)
fi
@@ -504,8 +578,8 @@ AC_PROG_INSTALL
dnl Checks for documentation and testing tools that we can do without. If these
dnl are not found then they are set to "true" which always succeeds but does
dnl nothing. This just lets the build output show that we could have done
dnl something if the tool was available.
dnl nothing. This just lets the build output show that we could have done
dnl something if the tool was available.
AC_PATH_PROG(BZIP2,[bzip2],[echo "Skipped: bzip2 not found"])
AC_PATH_PROG(DOXYGEN,[doxygen],[echo "Skipped: doxygen not found"])
AC_PATH_PROG(GROFF,[groff],[echo "Skipped: groff not found"])
@@ -515,6 +589,9 @@ AC_PATH_PROG(POD2MAN,[pod2man],[echo "Skipped: pod2man not found"])
AC_PATH_PROG(RUNTEST,[runtest],[echo "Skipped: runtest not found"])
DJ_AC_PATH_TCLSH
AC_PATH_PROG(ZIP,[zip],[echo "Skipped: zip not found"])
AC_PATH_PROG(OCAMLC,[ocamlc],[echo "Skipped: ocamlc not found"])
AC_PATH_PROG(OCAMLOPT,[ocamlopt],[echo "Skipped: ocamlopt not found"])
AC_PATH_PROG(OCAMLDEP,[ocamldep],[echo "Skipped: ocamldep not found"])
dnl Determine if the linker supports the -R option.
AC_LINK_USE_R
@@ -531,27 +608,22 @@ if test "$lt_cv_dlopen_self" = "yes" ; then
[Define if dlopen(0) will open the symbols of the program])
fi
dnl Check if we know how to tell etags we are using C++:
etags_version=`$ETAGS --version 2>&1`
case "$etags_version" in
*[Ee]xuberant*) ETAGSFLAGS="--language-force=c++" ;;
*GNU\ Emacs*) ETAGSFLAGS="-l c++" ;;
*) ETAGSFLAGS="" ;;
esac
AC_SUBST(ETAGSFLAGS,$ETAGSFLAGS)
if test "$WITH_LLVMGCCDIR" = "default" ; then
LLVMGCC="llvm-gcc${EXEEXT}"
LLVMGXX="llvm-g++${EXEEXT}"
AC_PATH_PROG(LLVMGCC, $LLVMGCC, [])
AC_PATH_PROG(LLVMGXX, $LLVMGXX, [])
else
LLVMGCC="$WITH_LLVMGCCDIR/bin/llvm-gcc${EXEEXT}"
LLVMGXX="$WITH_LLVMGCCDIR/bin/llvm-g++${EXEEXT}"
if test -z "$LLVMGCC"; then
LLVMGCC="$WITH_LLVMGCCDIR/bin/llvm-gcc${EXEEXT}"
fi
if test -z "$LLVMGXX"; then
LLVMGXX="$WITH_LLVMGCCDIR/bin/llvm-g++${EXEEXT}"
fi
AC_SUBST(LLVMGCC,$LLVMGCC)
AC_SUBST(LLVMGXX,$LLVMGXX)
fi
AC_MSG_CHECKING([tool compatibility])
dnl Ensure that compilation tools are GCC or a GNU compatible compiler such as
@@ -562,7 +634,7 @@ dnl "icc -no-gcc" emits no gcc signature BUT is still compatible
ICC=no
IXX=no
case $CC in
icc*|icpc*)
icc*|icpc*)
ICC=yes
IXX=yes
;;
@@ -584,7 +656,7 @@ fi
dnl Verify that GCC is version 3.0 or higher
if test "$GCC" = "yes"
then
gccmajor=`$CC --version | head -n 1 | sed 's/[[^0-9]]*\([[0-9.]]\).*/\1/'`
gccmajor=`$CC --version | head -n 1 | sed 's/[[^0-9]]*\([[0-9.]]\).*/\1/'`
if test "$gccmajor" -lt "3"
then
AC_MSG_ERROR([gcc 3.x required, but you have a lower version])
@@ -617,7 +689,7 @@ fi
dnl lt_dlopen may be required for plugin support.
AC_SEARCH_LIBS(lt_dlopen,ltdl,AC_DEFINE([HAVE_LT_DLOPEN],[1],
[Define if lt_dlopen() is available on this platform]),
AC_MSG_WARN([lt_dlopen() not found - plugin support might
AC_MSG_WARN([lt_dlopen() not found - plugin support might
not be available]))
dnl dlopen() is required for plugin support.
@@ -676,10 +748,11 @@ AC_HEADER_TIME
AC_CHECK_HEADERS([dlfcn.h execinfo.h fcntl.h inttypes.h limits.h link.h])
AC_CHECK_HEADERS([malloc.h setjmp.h signal.h stdint.h unistd.h utime.h])
AC_CHECK_HEADERS([windows.h sys/mman.h sys/param.h sys/resource.h sys/time.h])
AC_CHECK_HEADERS([windows.h])
AC_CHECK_HEADERS([sys/mman.h sys/param.h sys/resource.h sys/time.h])
AC_CHECK_HEADERS([sys/types.h malloc/malloc.h mach/mach.h])
if test "$ENABLE_THREADS" -eq 1 ; then
AC_CHECK_HEADER(pthread.h,
AC_CHECK_HEADERS(pthread.h,
AC_SUBST(HAVE_PTHREAD, 1),
AC_SUBST(HAVE_PTHREAD, 0))
else
@@ -709,7 +782,8 @@ dnl===
dnl===-----------------------------------------------------------------------===
AC_CHECK_FUNCS([backtrace ceilf floorf roundf rintf nearbyintf getcwd ])
AC_CHECK_FUNCS([getpagesize getrusage getrlimit setrlimit gettimeofday])
AC_CHECK_FUNCS([powf fmodf strtof round ])
AC_CHECK_FUNCS([getpagesize getrusage getrlimit setrlimit gettimeofday ])
AC_CHECK_FUNCS([isatty mkdtemp mkstemp ])
AC_CHECK_FUNCS([mktemp realpath sbrk setrlimit strdup strerror strerror_r ])
AC_CHECK_FUNCS([strtoll strtoq sysconf malloc_zone_statistics ])
@@ -728,11 +802,11 @@ AC_CXX_HAVE_FWD_ITERATOR
AC_FUNC_ISNAN
AC_FUNC_ISINF
dnl Check for mmap support.We also need to know if /dev/zero is required to
dnl be opened for allocating RWX memory.
dnl Check for mmap support.We also need to know if /dev/zero is required to
dnl be opened for allocating RWX memory.
dnl Make sure we aren't attempting to configure for an unknown system
if test "$llvm_cv_platform_type" = "Unix" ; then
AC_FUNC_MMAP
AC_FUNC_MMAP
AC_FUNC_MMAP_FILE
AC_NEED_DEV_ZERO_FOR_MMAP
@@ -752,6 +826,9 @@ dnl=== SECTION 9: Additional checks, variables, etc.
dnl===
dnl===-----------------------------------------------------------------------===
dnl Check, whether __dso_handle is present
AC_CHECK_FUNCS([__dso_handle])
dnl See if the llvm-gcc executable can compile to LLVM assembly
AC_CACHE_CHECK([whether llvm-gcc is sane],[llvm_cv_llvmgcc_sanity],
[llvm_cv_llvmgcc_sanity="no"
@@ -765,7 +842,7 @@ if test -x "$LLVMGCC" ; then
rm conftest.c
fi])
dnl Since we have a sane llvm-gcc, identify it and its sub-tools
dnl Since we have a sane llvm-gcc, identify it and its sub-tools
if test "$llvm_cv_llvmgcc_sanity" = "yes" ; then
AC_MSG_CHECKING([llvm-gcc component support])
llvmcc1path=`"$LLVMGCC" --print-prog-name=cc1`
@@ -785,12 +862,12 @@ if test "$llvm_cv_llvmgcc_sanity" = "yes" ; then
AC_MSG_RESULT([ok])
fi
dnl Propagate the shared library extension that the libltdl checks did to
dnl Propagate the shared library extension that the libltdl checks did to
dnl the Makefiles so we can use it there too
AC_SUBST(SHLIBEXT,$libltdl_cv_shlibext)
# Translate the various configuration directories and other basic
# information into substitutions that will end up in Makefile.config.in
# information into substitutions that will end up in Makefile.config.in
# that these configured values can be used by the makefiles
if test "${prefix}" = "NONE" ; then
prefix="/usr/local"
@@ -818,26 +895,79 @@ AC_SUBST(LLVM_CONFIGTIME)
# Place the various directores into the config.h file as #defines so that we
# can know about the installation paths within LLVM.
AC_DEFINE_UNQUOTED(LLVM_PREFIX,"$LLVM_PREFIX",
AC_DEFINE_UNQUOTED(LLVM_PREFIX,"$LLVM_PREFIX",
[Installation prefix directory])
AC_DEFINE_UNQUOTED(LLVM_BINDIR, "$LLVM_BINDIR",
AC_DEFINE_UNQUOTED(LLVM_BINDIR, "$LLVM_BINDIR",
[Installation directory for binary executables])
AC_DEFINE_UNQUOTED(LLVM_LIBDIR, "$LLVM_LIBDIR",
AC_DEFINE_UNQUOTED(LLVM_LIBDIR, "$LLVM_LIBDIR",
[Installation directory for libraries])
AC_DEFINE_UNQUOTED(LLVM_DATADIR, "$LLVM_DATADIR",
AC_DEFINE_UNQUOTED(LLVM_DATADIR, "$LLVM_DATADIR",
[Installation directory for data files])
AC_DEFINE_UNQUOTED(LLVM_DATADIR, "$LLVM_DOCSDIR",
AC_DEFINE_UNQUOTED(LLVM_DOCSDIR, "$LLVM_DOCSDIR",
[Installation directory for documentation])
AC_DEFINE_UNQUOTED(LLVM_ETCDIR, "$LLVM_ETCDIR",
AC_DEFINE_UNQUOTED(LLVM_ETCDIR, "$LLVM_ETCDIR",
[Installation directory for config files])
AC_DEFINE_UNQUOTED(LLVM_INCLUDEDIR, "$LLVM_INCLUDEDIR",
AC_DEFINE_UNQUOTED(LLVM_INCLUDEDIR, "$LLVM_INCLUDEDIR",
[Installation directory for include files])
AC_DEFINE_UNQUOTED(LLVM_INFODIR, "$LLVM_INFODIR",
AC_DEFINE_UNQUOTED(LLVM_INFODIR, "$LLVM_INFODIR",
[Installation directory for .info files])
AC_DEFINE_UNQUOTED(LLVM_MANDIR, "$LLVM_MANDIR",
AC_DEFINE_UNQUOTED(LLVM_MANDIR, "$LLVM_MANDIR",
[Installation directory for man pages])
AC_DEFINE_UNQUOTED(LLVM_CONFIGTIME, "$LLVM_CONFIGTIME",
AC_DEFINE_UNQUOTED(LLVM_CONFIGTIME, "$LLVM_CONFIGTIME",
[Time at which LLVM was configured])
AC_DEFINE_UNQUOTED(LLVM_HOSTTRIPLE, "$host",
[Host triple we were built on])
# Determine which bindings to build.
if test "$BINDINGS_TO_BUILD" = auto ; then
BINDINGS_TO_BUILD=""
if test "x$OCAMLC" != x -a "x$OCAMLDEP" != x ; then
BINDINGS_TO_BUILD="ocaml $BINDINGS_TO_BUILD"
fi
fi
AC_SUBST(BINDINGS_TO_BUILD,$BINDINGS_TO_BUILD)
# This isn't really configurey, but it avoids having to repeat the list in
# other files.
AC_SUBST(ALL_BINDINGS,ocaml)
# Do any work necessary to ensure that bindings have what they need.
binding_prereqs_failed=0
for a_binding in $BINDINGS_TO_BUILD ; do
case "$a_binding" in
ocaml)
if test "x$OCAMLC" = x ; then
AC_MSG_WARN([--enable-bindings=ocaml specified, but ocamlc not found. Try configure OCAMLC=/path/to/ocamlc])
binding_prereqs_failed=1
fi
if test "x$OCAMLDEP" = x ; then
AC_MSG_WARN([--enable-bindings=ocaml specified, but ocamldep not found. Try configure OCAMLDEP=/path/to/ocamldep])
binding_prereqs_failed=1
fi
if test "x$OCAMLOPT" = x ; then
AC_MSG_WARN([--enable-bindings=ocaml specified, but ocamlopt not found. Try configure OCAMLOPT=/path/to/ocamlopt])
dnl ocamlopt is optional!
fi
if test "x$with_ocaml_libdir" != xauto ; then
AC_SUBST(OCAML_LIBDIR,$with_ocaml_libdir)
else
ocaml_stdlib="`"$OCAMLC" -where`"
if test "$LLVM_PREFIX" '<' "$ocaml_stdlib" -a "$ocaml_stdlib" '<' "$LLVM_PREFIX~"
then
# ocaml stdlib is beneath our prefix; use stdlib
AC_SUBST(OCAML_LIBDIR,$ocaml_stdlib)
else
# ocaml stdlib is outside our prefix; use libdir/ocaml
AC_SUBST(OCAML_LIBDIR,$LLVM_LIBDIR/ocaml)
fi
fi
;;
esac
done
if test "$binding_prereqs_failed" = 1 ; then
AC_MSG_ERROR([Prequisites for bindings not satisfied. Fix them or use configure --disable-bindings.])
fi
dnl===-----------------------------------------------------------------------===
dnl===
@@ -880,7 +1010,8 @@ AC_CONFIG_MAKEFILE(test/Makefile.tests)
AC_CONFIG_MAKEFILE(tools/Makefile)
AC_CONFIG_MAKEFILE(utils/Makefile)
AC_CONFIG_MAKEFILE(projects/Makefile)
AC_CONFIG_MAKEFILE(bindings/Makefile)
AC_CONFIG_MAKEFILE(bindings/ocaml/Makefile.ocaml)
dnl Finally, crank out the output
AC_OUTPUT

View File

@@ -1905,7 +1905,7 @@ AC_DEFUN([AC_LIBTOOL_WIN32_DLL],
AC_DEFUN([AC_ENABLE_SHARED],
[define([enable_shared_default], ifelse($1, no, no, yes))dnl
AC_ARG_ENABLE([shared],
[AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],[build shared libraries @<:@default=enable_shared_default@:>@])],
AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],[build shared libraries @<:@default=enable_shared_default@:>@]),
[p=${PACKAGE-default}
case $enableval in
yes) enable_shared=yes ;;
@@ -1943,7 +1943,7 @@ AC_ENABLE_SHARED(no)
AC_DEFUN([AC_ENABLE_STATIC],
[define([enable_static_default], ifelse($1, no, no, yes))dnl
AC_ARG_ENABLE([static],
[AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],[build static libraries @<:@default=enable_static_default@:>@])],
AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],[build static libraries @<:@default=enable_static_default@:>@]),
[p=${PACKAGE-default}
case $enableval in
yes) enable_static=yes ;;
@@ -1981,7 +1981,7 @@ AC_ENABLE_STATIC(no)
AC_DEFUN([AC_ENABLE_FAST_INSTALL],
[define([enable_Fast_install_default], ifelse($1, no, no, yes))dnl
AC_ARG_ENABLE([fast-install],
[AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],[optimize for fast installation @<:@default=enable_Fast_install_default@:>@])],
AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],[optimize for fast installation @<:@default=enable_Fast_install_default@:>@]),
[p=${PACKAGE-default}
case $enableval in
yes) enable_fast_install=yes ;;

16
llvm/bindings/Makefile Normal file
View File

@@ -0,0 +1,16 @@
##===- bindings/Makefile -----------------------------------*- Makefile -*-===##
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
##===----------------------------------------------------------------------===##
LEVEL := ..
include $(LEVEL)/Makefile.config
PARALLEL_DIRS = $(BINDINGS_TO_BUILD)
include $(LEVEL)/Makefile.common

3
llvm/bindings/README.txt Normal file
View File

@@ -0,0 +1,3 @@
This directory contains bindings for the LLVM compiler infrastructure to allow
programs written in languages other than C or C++ to take advantage of the LLVM
infrastructure--for instance, a self-hosted compiler front-end.

View File

@@ -0,0 +1,13 @@
##===- bindings/ocaml/Makefile -----------------------------*- Makefile -*-===##
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
##===----------------------------------------------------------------------===##
LEVEL := ../..
DIRS = llvm bitreader bitwriter analysis executionengine
include $(LEVEL)/Makefile.common

View File

@@ -0,0 +1,323 @@
##===- tools/ml/Makefile -----------------------------------*- Makefile -*-===##
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
##===----------------------------------------------------------------------===##
#
# An ocaml library is a unique project type in the context of LLVM, so rules are
# here rather than in Makefile.rules.
#
# Reference materials on installing ocaml libraries:
#
# https://fedoraproject.org/wiki/Packaging/OCaml
# http://pkg-ocaml-maint.alioth.debian.org/ocaml_packaging_policy.txt
#
##===----------------------------------------------------------------------===##
include $(LEVEL)/Makefile.config
# CFLAGS needs to be set before Makefile.rules is included.
CXX.Flags += -I"$(shell $(OCAMLC) -where)"
C.Flags += -I"$(shell $(OCAMLC) -where)"
include $(LEVEL)/Makefile.common
# Intentionally ignore PROJ_prefix here. We want the ocaml stdlib. However, the
# user can override this with OCAML_LIBDIR or configure --with-ocaml-libdir=.
PROJ_libocamldir := $(DESTDIR)$(OCAML_LIBDIR)
OcamlDir := $(LibDir)/ocaml
# Info from llvm-config and similar
ifdef UsedComponents
UsedLibs = $(shell $(LLVM_CONFIG) --libs $(UsedComponents))
UsedLibNames = $(shell $(LLVM_CONFIG) --libnames $(UsedComponents))
endif
# Tools
OCAMLCFLAGS += -I $(OcamlDir) -I $(ObjDir)
OCAMLAFLAGS += $(patsubst %,-cclib %, \
$(filter-out -L$(LibDir),-l$(LIBRARYNAME) \
$(shell $(LLVM_CONFIG) --ldflags)) \
$(UsedLibs))
# -g was introduced in 3.10.0.
#ifneq ($(ENABLE_OPTIMIZED),1)
# OCAMLDEBUGFLAG := -g
#endif
Compile.CMI := $(strip $(OCAMLC) -c $(OCAMLCFLAGS) $(OCAMLDEBUGFLAG) -o)
Compile.CMO := $(strip $(OCAMLC) -c $(OCAMLCFLAGS) $(OCAMLDEBUGFLAG) -o)
Archive.CMA := $(strip $(OCAMLC) -a -custom $(OCAMLAFLAGS) $(OCAMLDEBUGFLAG) \
-o)
Compile.CMX := $(strip $(OCAMLOPT) -c $(OCAMLCFLAGS) $(OCAMLDEBUGFLAG) -o)
Archive.CMXA := $(strip $(OCAMLOPT) -a $(OCAMLAFLAGS) $(OCAMLDEBUGFLAG) -o)
# Source files
OcamlSources1 := $(sort $(wildcard $(PROJ_SRC_DIR)/*.ml))
OcamlHeaders1 := $(OcamlSources1:.ml=.mli)
OcamlSources := $(OcamlSources1:$(PROJ_SRC_DIR)/%=$(ObjDir)/%)
OcamlHeaders := $(OcamlHeaders1:$(PROJ_SRC_DIR)/%=$(ObjDir)/%)
# Intermediate files
LibraryCMA := $(ObjDir)/$(LIBRARYNAME).cma
LibraryCMXA := $(ObjDir)/$(LIBRARYNAME).cmxa
ObjectsCMI := $(OcamlSources:%.ml=%.cmi)
ObjectsCMO := $(OcamlSources:%.ml=%.cmo)
ObjectsCMX := $(OcamlSources:%.ml=%.cmx)
# Output files
# The .cmo files are the only intermediates; all others are to be installed.
LibraryA := $(OcamlDir)/lib$(LIBRARYNAME).a
OutputCMA := $(LibraryCMA:$(ObjDir)/%.cma=$(OcamlDir)/%.cma)
OutputCMXA := $(LibraryCMXA:$(ObjDir)/%.cmxa=$(OcamlDir)/%.cmxa)
OutputsCMI := $(ObjectsCMI:$(ObjDir)/%.cmi=$(OcamlDir)/%.cmi)
OutputsCMX := $(ObjectsCMX:$(ObjDir)/%.cmx=$(OcamlDir)/%.cmx)
OutputLibs := $(UsedLibNames:%=$(OcamlDir)/%)
# Installation targets
DestA := $(PROJ_libocamldir)/lib$(LIBRARYNAME).a
DestCMA := $(PROJ_libocamldir)/$(LIBRARYNAME).cma
DestCMXA := $(PROJ_libocamldir)/$(LIBRARYNAME).cmxa
DestLibs := $(UsedLibNames:%=$(PROJ_libocamldir)/%)
##===- Dependencies -------------------------------------------------------===##
# Copy the sources into the intermediate directory because older ocamlc doesn't
# support -o except when linking (outputs are placed next to inputs).
$(ObjDir)/%.mli: $(PROJ_SRC_DIR)/%.mli $(ObjDir)/.dir
$(Verb) $(CP) -f $< $@
$(ObjDir)/%.ml: $(PROJ_SRC_DIR)/%.ml $(ObjDir)/.dir
$(Verb) $(CP) -f $< $@
$(ObjDir)/$(LIBRARYNAME).ocamldep: $(OcamlSources) $(OcamlHeaders) \
$(OcamlDir)/.dir $(ObjDir)/.dir
$(Verb) $(OCAMLDEP) $(OCAMLCFLAGS) $(OcamlSources) $(OcamlHeader) > $@
$(ObjectsCMI): $(UsedOcamlInterfaces:%=$(OcamlDir)/%.cmi)
-include $(ObjDir)/$(LIBRARYNAME).ocamldep
##===- Build static library from C sources --------------------------------===##
all-local:: $(LibraryA)
clean-local:: clean-a
install-local:: install-a
uninstall-local:: uninstall-a
$(LibraryA): $(ObjectsO) $(OcamlDir)/.dir
$(Echo) "Building $(BuildMode) $(notdir $@)"
-$(Verb) $(RM) -f $@
$(Verb) $(Archive) $@ $(ObjectsO)
$(Verb) $(Ranlib) $@
clean-a::
-$(Verb) $(RM) -f $(LibraryA)
install-a:: $(LibraryA)
$(Echo) "Installing $(BuildMode) $(DestA)"
$(Verb) $(MKDIR) $(PROJ_libocamldir)
$(Verb) $(LTInstall) $(LibraryA) $(DestA)
$(Verb)
uninstall-a::
$(Echo) "Uninstalling $(DestA)"
-$(Verb) $(RM) -f $(DestA)
##===- Deposit dependent libraries adjacent to Ocaml libs -----------------===##
all-local:: build-deplibs
clean-local:: clean-deplibs
install-local:: install-deplibs
uninstall-local:: uninstall-deplibs
build-deplibs: $(OutputLibs)
$(OcamlDir)/%.a: $(LibDir)/%.a
$(Verb) ln -sf $< $@
$(OcamlDir)/%.o: $(LibDir)/%.o
$(Verb) ln -sf $< $@
clean-deplibs:
$(Verb) rm -f $(OutputLibs)
install-deplibs:
$(Verb) for i in $(DestLibs:$(PROJ_libocamldir)/%=%); do \
ln -sf "$(PROJ_libdir)/$$i" "$(PROJ_libocamldir)/$$i"; \
done
uninstall-deplibs:
$(Verb) rm -f $(DestLibs)
##===- Build ocaml interfaces (.mli's -> .cmi's) --------------------------===##
all-local:: build-cmis
clean-local:: clean-cmis
install-local:: install-cmis
uninstall-local:: uninstall-cmis
build-cmis: $(OutputsCMI)
$(OcamlDir)/%.cmi: $(ObjDir)/%.cmi $(OcamlDir)/.dir
$(Verb) $(CP) -f $< $@
$(ObjDir)/%.cmi: $(ObjDir)/%.mli $(ObjDir)/.dir
$(Echo) "Compiling $(notdir $<) for $(BuildMode) build"
$(Verb) $(Compile.CMI) $@ $<
clean-cmis::
-$(Verb) $(RM) -f $(OutputsCMI)
# Also install the .mli's (headers) as documentation.
install-cmis: $(OutputsCMI) $(OcamlHeaders)
$(Verb) $(MKDIR) $(PROJ_libocamldir)
$(Verb) for i in $(OutputsCMI:$(OcamlDir)/%=%); do \
$(EchoCmd) "Installing $(BuildMode) $(PROJ_libocamldir)/$$i"; \
$(DataInstall) $(OcamlDir)/$$i "$(PROJ_libocamldir)/$$i"; \
done
$(Verb) for i in $(OcamlHeaders:$(ObjDir)/%=%); do \
$(EchoCmd) "Installing $(BuildMode) $(PROJ_libocamldir)/$$i"; \
$(DataInstall) $(ObjDir)/$$i "$(PROJ_libocamldir)/$$i"; \
done
uninstall-cmis::
$(Verb) for i in $(OutputsCMI:$(OcamlDir)/%=%); do \
$(EchoCmd) "Uninstalling $(PROJ_libocamldir)/$$i"; \
$(RM) -f "$(PROJ_libocamldir)/$$i"; \
done
$(Verb) for i in $(OcamlHeaders:$(ObjDir)/%=%); do \
$(EchoCmd) "Uninstalling $(PROJ_libocamldir)/$$i"; \
$(RM) -f "$(PROJ_libocamldir)/$$i"; \
done
##===- Build ocaml bytecode archive (.ml's -> .cmo's -> .cma) -------------===##
all-local:: $(OutputCMA)
clean-local:: clean-cma
install-local:: install-cma
uninstall-local:: uninstall-cma
$(OutputCMA): $(LibraryCMA) $(OcamlDir)/.dir
$(Verb) $(CP) -f $< $@
$(LibraryCMA): $(ObjectsCMO) $(OcamlDir)/.dir
$(Echo) "Archiving $(notdir $@) for $(BuildMode) build"
$(Verb) $(Archive.CMA) $@ $(ObjectsCMO)
$(ObjDir)/%.cmo: $(ObjDir)/%.ml
$(Echo) "Compiling $(notdir $<) for $(BuildMode) build"
$(Verb) $(Compile.CMO) $@ $<
clean-cma::
$(Verb) $(RM) -f $(OutputCMA) $(UsedLibNames:%=$(OcamlDir)/%)
install-cma:: $(OutputCMA)
$(Echo) "Installing $(BuildMode) $(DestCMA)"
$(Verb) $(MKDIR) $(PROJ_libocamldir)
$(Verb) $(DataInstall) $(OutputCMA) "$(DestCMA)"
uninstall-cma::
$(Echo) "Uninstalling $(DestCMA)"
-$(Verb) $(RM) -f $(DestCMA)
##===- Build optimized ocaml archive (.ml's -> .cmx's -> .cmxa, .a) -------===##
# The ocamlopt compiler is supported on a set of targets disjoint from LLVM's.
# If unavailable, 'configure' will not define OCAMLOPT in Makefile.config.
ifdef OCAMLOPT
all-local:: $(OutputCMXA) $(OutputsCMX)
clean-local:: clean-cmxa
install-local:: install-cmxa
uninstall-local:: uninstall-cmxa
$(OutputCMXA): $(LibraryCMXA)
$(Verb) $(CP) -f $< $@
$(Verb) $(CP) -f $(<:.cmxa=.a) $(@:.cmxa=.a)
$(OcamlDir)/%.cmx: $(ObjDir)/%.cmx
$(Verb) $(CP) -f $< $@
$(LibraryCMXA): $(ObjectsCMX)
$(Echo) "Archiving $(notdir $@) for $(BuildMode) build"
$(Verb) $(Archive.CMXA) $@ $(ObjectsCMX)
$(Verb) $(RM) -f $(@:.cmxa=.o)
$(ObjDir)/%.cmx: $(ObjDir)/%.ml
$(Echo) "Compiling optimized $(notdir $<) for $(BuildMode) build"
$(Verb) $(Compile.CMX) $@ $<
clean-cmxa::
$(Verb) $(RM) -f $(OutputCMXA) $(OutputCMXA:.cmxa=.o) $(OutputsCMX)
install-cmxa:: $(OutputCMXA) $(OutputsCMX)
$(Verb) $(MKDIR) $(PROJ_libocamldir)
$(Echo) "Installing $(BuildMode) $(DestCMXA)"
$(Verb) $(DataInstall) $(OutputCMXA) $(DestCMXA)
$(Echo) "Installing $(BuildMode) $(DestCMXA:.cmxa=.a)"
$(Verb) $(DataInstall) $(OutputCMXA:.cmxa=.a) $(DestCMXA:.cmxa=.a)
$(Verb) for i in $(OutputsCMX:$(OcamlDir)/%=%); do \
$(EchoCmd) "Installing $(BuildMode) $(PROJ_libocamldir)/$$i"; \
$(DataInstall) $(OcamlDir)/$$i "$(PROJ_libocamldir)/$$i"; \
done
uninstall-cmxa::
$(Echo) "Uninstalling $(DestCMXA)"
$(Verb) $(RM) -f $(DestCMXA)
$(Echo) "Uninstalling $(DestCMXA:.cmxa=.a)"
$(Verb) $(RM) -f $(DestCMXA:.cmxa=.a)
$(Verb) for i in $(OutputsCMX:$(OcamlDir)/%=%); do \
$(EchoCmd) "Uninstalling $(PROJ_libocamldir)/$$i"; \
$(RM) -f $(PROJ_libocamldir)/$$i; \
done
endif
##===- Debugging gunk -----------------------------------------------------===##
printvars:: printcamlvars
printcamlvars::
$(Echo) "LLVM_CONFIG : " '$(LLVM_CONFIG)'
$(Echo) "OCAMLCFLAGS : " '$(OCAMLCFLAGS)'
$(Echo) "OCAMLAFLAGS : " '$(OCAMLAFLAGS)'
$(Echo) "OCAMLC : " '$(OCAMLC)'
$(Echo) "OCAMLOPT : " '$(OCAMLOPT)'
$(Echo) "OCAMLDEP : " '$(OCAMLDEP)'
$(Echo) "Compile.CMI : " '$(Compile.CMI)'
$(Echo) "Compile.CMO : " '$(Compile.CMO)'
$(Echo) "Archive.CMA : " '$(Archive.CMA)'
$(Echo) "Compile.CMX : " '$(Compile.CMX)'
$(Echo) "Archive.CMXA : " '$(Archive.CMXA)'
$(Echo) "CAML_LIBDIR : " '$(CAML_LIBDIR)'
$(Echo) "LibraryCMA : " '$(LibraryCMA)'
$(Echo) "LibraryCMXA : " '$(LibraryCMXA)'
$(Echo) "OcamlSources1: " '$(OcamlSources1)'
$(Echo) "OcamlSources : " '$(OcamlSources)'
$(Echo) "OcamlHeaders : " '$(OcamlHeaders)'
$(Echo) "ObjectsCMI : " '$(ObjectsCMI)'
$(Echo) "ObjectsCMO : " '$(ObjectsCMO)'
$(Echo) "ObjectsCMX : " '$(ObjectsCMX)'
$(Echo) "OCAML_LIBDIR : " '$(OCAML_LIBDIR)'
$(Echo) "DestA : " '$(DestA)'
$(Echo) "DestCMA : " '$(DestCMA)'
$(Echo) "DestCMXA : " '$(DestCMXA)'
$(Echo) "UsedLibs : " '$(UsedLibs)'
$(Echo) "UsedLibNames : " '$(UsedLibNames)'
.PHONY: printcamlvars build-cmis \
clean-a clean-cmis clean-cma clean-cmxa \
install-a install-cmis install-cma install-cmxa \
uninstall-a uninstall-cmis uninstall-cma uninstall-cmxa

View File

@@ -0,0 +1,20 @@
##===- bindings/ocaml/analysis/Makefile --------------------*- Makefile -*-===##
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
##===----------------------------------------------------------------------===##
#
# This is the makefile for the Objective Caml Llvm_analysis interface.
#
##===----------------------------------------------------------------------===##
LEVEL := ../../..
LIBRARYNAME := llvm_analysis
DONT_BUILD_RELINKED := 1
UsedComponents := analysis
UsedOcamlInterfaces := llvm
include ../Makefile.ocaml

View File

@@ -0,0 +1,60 @@
/*===-- analysis_ocaml.c - LLVM Ocaml Glue ----------------------*- C++ -*-===*\
|* *|
|* The LLVM Compiler Infrastructure *|
|* *|
|* This file is distributed under the University of Illinois Open Source *|
|* License. See LICENSE.TXT for details. *|
|* *|
|*===----------------------------------------------------------------------===*|
|* *|
|* This file glues LLVM's ocaml interface to its C interface. These functions *|
|* are by and large transparent wrappers to the corresponding C functions. *|
|* *|
|* Note that these functions intentionally take liberties with the CAMLparamX *|
|* macros, since most of the parameters are not GC heap objects. *|
|* *|
\*===----------------------------------------------------------------------===*/
#include "llvm-c/Analysis.h"
#include "caml/alloc.h"
#include "caml/mlvalues.h"
#include "caml/memory.h"
/* Llvm.llmodule -> string option */
CAMLprim value llvm_verify_module(LLVMModuleRef M) {
CAMLparam0();
CAMLlocal2(String, Option);
char *Message;
int Result = LLVMVerifyModule(M, LLVMReturnStatusAction, &Message);
if (0 == Result) {
Option = Val_int(0);
} else {
Option = alloc(1, 0);
String = copy_string(Message);
Store_field(Option, 0, String);
}
LLVMDisposeMessage(Message);
CAMLreturn(Option);
}
/* Llvm.llvalue -> bool */
CAMLprim value llvm_verify_function(LLVMValueRef Fn) {
return Val_bool(LLVMVerifyFunction(Fn, LLVMReturnStatusAction) == 0);
}
/* Llvm.llmodule -> unit */
CAMLprim value llvm_assert_valid_module(LLVMModuleRef M) {
LLVMVerifyModule(M, LLVMAbortProcessAction, 0);
return Val_unit;
}
/* Llvm.llvalue -> unit */
CAMLprim value llvm_assert_valid_function(LLVMValueRef Fn) {
LLVMVerifyFunction(Fn, LLVMAbortProcessAction);
return Val_unit;
}

View File

@@ -0,0 +1,19 @@
(*===-- llvm_analysis.ml - LLVM Ocaml Interface -----------------*- C++ -*-===*
*
* The LLVM Compiler Infrastructure
*
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
*
*===----------------------------------------------------------------------===*)
external verify_module : Llvm.llmodule -> string option = "llvm_verify_module"
external verify_function : Llvm.llvalue -> bool = "llvm_verify_function"
external assert_valid_module : Llvm.llmodule -> unit
= "llvm_assert_valid_module"
external assert_valid_function : Llvm.llvalue -> unit
= "llvm_assert_valid_function"

View File

@@ -0,0 +1,36 @@
(*===-- llvm_analysis.mli - LLVM Ocaml Interface ----------------*- C++ -*-===*
*
* The LLVM Compiler Infrastructure
*
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
*
*===----------------------------------------------------------------------===
*
* This interface provides an ocaml API for LLVM IR analyses, the classes in
* the Analysis library.
*
*===----------------------------------------------------------------------===*)
(** [verify_module m] returns [None] if the module [m] is valid, and
[Some reason] if it is invalid. [reason] is a string containing a
human-readable validation report. See [llvm::verifyModule]. **)
external verify_module : Llvm.llmodule -> string option = "llvm_verify_module"
(** [verify_function f] returns [None] if the function [f] is valid, and
[Some reason] if it is invalid. [reason] is a string containing a
human-readable validation report. See [llvm::verifyFunction]. **)
external verify_function : Llvm.llvalue -> bool = "llvm_verify_function"
(** [verify_module m] returns if the module [m] is valid, but prints a
validation report to [stderr] and aborts the program if it is invalid. See
[llvm::verifyModule]. **)
external assert_valid_module : Llvm.llmodule -> unit
= "llvm_assert_valid_module"
(** [verify_function f] returns if the function [f] is valid, but prints a
validation report to [stderr] and aborts the program if it is invalid. See
[llvm::verifyFunction]. **)
external assert_valid_function : Llvm.llvalue -> unit
= "llvm_assert_valid_function"

View File

@@ -0,0 +1,20 @@
##===- bindings/ocaml/bitreader/Makefile -------------------*- Makefile -*-===##
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
##===----------------------------------------------------------------------===##
#
# This is the makefile for the Objective Caml Llvm_bitreader interface.
#
##===----------------------------------------------------------------------===##
LEVEL := ../../..
LIBRARYNAME := llvm_bitreader
DONT_BUILD_RELINKED := 1
UsedComponents := bitreader
UsedOcamlInterfaces := llvm
include ../Makefile.ocaml

View File

@@ -0,0 +1,72 @@
/*===-- bitwriter_ocaml.c - LLVM Ocaml Glue ---------------------*- C++ -*-===*\
|* *|
|* The LLVM Compiler Infrastructure *|
|* *|
|* This file is distributed under the University of Illinois Open Source *|
|* License. See LICENSE.TXT for details. *|
|* *|
|*===----------------------------------------------------------------------===*|
|* *|
|* This file glues LLVM's ocaml interface to its C interface. These functions *|
|* are by and large transparent wrappers to the corresponding C functions. *|
|* *|
\*===----------------------------------------------------------------------===*/
#include "llvm-c/BitReader.h"
#include "caml/alloc.h"
#include "caml/fail.h"
#include "caml/memory.h"
/* Can't use the recommended caml_named_value mechanism for backwards
compatibility reasons. This is largely equivalent. */
static value llvm_bitreader_error_exn;
CAMLprim value llvm_register_bitreader_exns(value Error) {
llvm_bitreader_error_exn = Field(Error, 0);
register_global_root(&llvm_bitreader_error_exn);
return Val_unit;
}
static void llvm_raise(value Prototype, char *Message) {
CAMLparam1(Prototype);
CAMLlocal1(CamlMessage);
CamlMessage = copy_string(Message);
LLVMDisposeMessage(Message);
raise_with_arg(Prototype, CamlMessage);
abort(); /* NOTREACHED */
#ifdef CAMLnoreturn
CAMLnoreturn; /* Silences warnings, but is missing in some versions. */
#endif
}
/*===-- Modules -----------------------------------------------------------===*/
/* Llvm.llmemorybuffer -> Llvm.module */
CAMLprim value llvm_get_module_provider(LLVMMemoryBufferRef MemBuf) {
CAMLparam0();
CAMLlocal2(Variant, MessageVal);
char *Message;
LLVMModuleProviderRef MP;
if (LLVMGetBitcodeModuleProvider(MemBuf, &MP, &Message))
llvm_raise(llvm_bitreader_error_exn, Message);
CAMLreturn((value) MemBuf);
}
/* Llvm.llmemorybuffer -> Llvm.llmodule */
CAMLprim value llvm_parse_bitcode(LLVMMemoryBufferRef MemBuf) {
CAMLparam0();
CAMLlocal2(Variant, MessageVal);
LLVMModuleRef M;
char *Message;
if (LLVMParseBitcode(MemBuf, &M, &Message))
llvm_raise(llvm_bitreader_error_exn, Message);
CAMLreturn((value) M);
}

View File

@@ -0,0 +1,19 @@
(*===-- llvm_bitreader.ml - LLVM Ocaml Interface ----------------*- C++ -*-===*
*
* The LLVM Compiler Infrastructure
*
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
*
*===----------------------------------------------------------------------===*)
exception Error of string
external register_exns : exn -> unit = "llvm_register_bitreader_exns"
let _ = register_exns (Error "")
external get_module_provider : Llvm.llmemorybuffer -> Llvm.llmoduleprovider
= "llvm_get_module_provider"
external parse_bitcode : Llvm.llmemorybuffer -> Llvm.llmodule
= "llvm_parse_bitcode"

View File

@@ -0,0 +1,30 @@
(*===-- llvm_bitreader.mli - LLVM Ocaml Interface ---------------*- C++ -*-===*
*
* The LLVM Compiler Infrastructure
*
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
*
*===----------------------------------------------------------------------===
*
* This interface provides an ocaml API for the LLVM bitcode reader, the
* classes in the Bitreader library.
*
*===----------------------------------------------------------------------===*)
exception Error of string
(** [read_bitcode_file path] reads the bitcode for a new module [m] from the
file at [path]. Returns [Success m] if successful, and [Failure msg]
otherwise, where [msg] is a description of the error encountered.
See the function [llvm::getBitcodeModuleProvider]. **)
external get_module_provider : Llvm.llmemorybuffer -> Llvm.llmoduleprovider
= "llvm_get_module_provider"
(** [parse_bitcode mb] parses the bitcode for a new module [m] from the memory
buffer [mb]. Returns [Success m] if successful, and [Failure msg] otherwise,
where [msg] is a description of the error encountered.
See the function [llvm::ParseBitcodeFile]. **)
external parse_bitcode : Llvm.llmemorybuffer -> Llvm.llmodule
= "llvm_parse_bitcode"

View File

@@ -0,0 +1,20 @@
##===- bindings/ocaml/bitwriter/Makefile -------------------*- Makefile -*-===##
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
##===----------------------------------------------------------------------===##
#
# This is the makefile for the Objective Caml Llvm_bitwriter interface.
#
##===----------------------------------------------------------------------===##
LEVEL := ../../..
LIBRARYNAME := llvm_bitwriter
DONT_BUILD_RELINKED := 1
UsedComponents := bitwriter
UsedOcamlInterfaces := llvm
include ../Makefile.ocaml

View File

@@ -0,0 +1,30 @@
/*===-- bitwriter_ocaml.c - LLVM Ocaml Glue ---------------------*- C++ -*-===*\
|* *|
|* The LLVM Compiler Infrastructure *|
|* *|
|* This file is distributed under the University of Illinois Open Source *|
|* License. See LICENSE.TXT for details. *|
|* *|
|*===----------------------------------------------------------------------===*|
|* *|
|* This file glues LLVM's ocaml interface to its C interface. These functions *|
|* are by and large transparent wrappers to the corresponding C functions. *|
|* *|
|* Note that these functions intentionally take liberties with the CAMLparamX *|
|* macros, since most of the parameters are not GC heap objects. *|
|* *|
\*===----------------------------------------------------------------------===*/
#include "llvm-c/BitWriter.h"
#include "llvm-c/Core.h"
#include "caml/alloc.h"
#include "caml/mlvalues.h"
#include "caml/memory.h"
/*===-- Modules -----------------------------------------------------------===*/
/* Llvm.llmodule -> string -> bool */
CAMLprim value llvm_write_bitcode_file(value M, value Path) {
int res = LLVMWriteBitcodeToFile((LLVMModuleRef) M, String_val(Path));
return Val_bool(res == 0);
}

View File

@@ -0,0 +1,18 @@
(*===-- llvm_bitwriter.ml - LLVM Ocaml Interface ----------------*- C++ -*-===*
*
* The LLVM Compiler Infrastructure
*
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
*
*===----------------------------------------------------------------------===
*
* This interface provides an ocaml API for the LLVM intermediate
* representation, the classes in the VMCore library.
*
*===----------------------------------------------------------------------===*)
(* Writes the bitcode for module the given path. Returns true if successful. *)
external write_bitcode_file : Llvm.llmodule -> string -> bool
= "llvm_write_bitcode_file"

View File

@@ -0,0 +1,19 @@
(*===-- llvm_bitwriter.mli - LLVM Ocaml Interface ---------------*- C++ -*-===*
*
* The LLVM Compiler Infrastructure
*
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
*
*===----------------------------------------------------------------------===
*
* This interface provides an ocaml API for the LLVM bitcode writer, the
* classes in the Bitwriter library.
*
*===----------------------------------------------------------------------===*)
(** [write_bitcode_file m path] writes the bitcode for module [m] to the file at
[path]. Returns [true] if successful, [false] otherwise. **)
external write_bitcode_file : Llvm.llmodule -> string -> bool
= "llvm_write_bitcode_file"

View File

@@ -0,0 +1,20 @@
##===- bindings/ocaml/executionengine/Makefile --------------*- Makefile -*-===##
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
##===----------------------------------------------------------------------===##
#
# This is the makefile for the Objective Caml Llvm_executionengine interface.
#
##===----------------------------------------------------------------------===##
LEVEL := ../../..
LIBRARYNAME := llvm_executionengine
DONT_BUILD_RELINKED := 1
UsedComponents := executionengine jit interpreter native
UsedOcamlInterfaces := llvm
include ../Makefile.ocaml

View File

@@ -0,0 +1,313 @@
/*===-- analysis_ocaml.c - LLVM Ocaml Glue ----------------------*- C++ -*-===*\
|* *|
|* The LLVM Compiler Infrastructure *|
|* *|
|* This file is distributed under the University of Illinois Open Source *|
|* License. See LICENSE.TXT for details. *|
|* *|
|*===----------------------------------------------------------------------===*|
|* *|
|* This file glues LLVM's ocaml interface to its C interface. These functions *|
|* are by and large transparent wrappers to the corresponding C functions. *|
|* *|
|* Note that these functions intentionally take liberties with the CAMLparamX *|
|* macros, since most of the parameters are not GC heap objects. *|
|* *|
\*===----------------------------------------------------------------------===*/
#include "llvm-c/ExecutionEngine.h"
#include "caml/alloc.h"
#include "caml/custom.h"
#include "caml/fail.h"
#include "caml/memory.h"
#include <string.h>
#include <assert.h>
/* Can't use the recommended caml_named_value mechanism for backwards
compatibility reasons. This is largely equivalent. */
static value llvm_ee_error_exn;
CAMLprim value llvm_register_ee_exns(value Error) {
llvm_ee_error_exn = Field(Error, 0);
register_global_root(&llvm_ee_error_exn);
return Val_unit;
}
static void llvm_raise(value Prototype, char *Message) {
CAMLparam1(Prototype);
CAMLlocal1(CamlMessage);
CamlMessage = copy_string(Message);
LLVMDisposeMessage(Message);
raise_with_arg(Prototype, CamlMessage);
abort(); /* NOTREACHED */
#ifdef CAMLnoreturn
CAMLnoreturn; /* Silences warnings, but is missing in some versions. */
#endif
}
/*--... Operations on generic values .......................................--*/
#define Genericvalue_val(v) (*(LLVMGenericValueRef *)(Data_custom_val(v)))
static void llvm_finalize_generic_value(value GenVal) {
LLVMDisposeGenericValue(Genericvalue_val(GenVal));
}
static struct custom_operations generic_value_ops = {
(char *) "LLVMGenericValue",
llvm_finalize_generic_value,
custom_compare_default,
custom_hash_default,
custom_serialize_default,
custom_deserialize_default
};
static value alloc_generic_value(LLVMGenericValueRef Ref) {
value Val = alloc_custom(&generic_value_ops, sizeof(LLVMGenericValueRef), 0, 1);
Genericvalue_val(Val) = Ref;
return Val;
}
/* Llvm.lltype -> float -> t */
CAMLprim value llvm_genericvalue_of_float(LLVMTypeRef Ty, value N) {
CAMLparam1(N);
CAMLreturn(alloc_generic_value(
LLVMCreateGenericValueOfFloat(Ty, Double_val(N))));
}
/* 'a -> t */
CAMLprim value llvm_genericvalue_of_value(value V) {
CAMLparam1(V);
CAMLreturn(alloc_generic_value(LLVMCreateGenericValueOfPointer(Op_val(V))));
}
/* Llvm.lltype -> int -> t */
CAMLprim value llvm_genericvalue_of_int(LLVMTypeRef Ty, value Int) {
return alloc_generic_value(LLVMCreateGenericValueOfInt(Ty, Int_val(Int), 1));
}
/* Llvm.lltype -> int32 -> t */
CAMLprim value llvm_genericvalue_of_int32(LLVMTypeRef Ty, value Int32) {
CAMLparam1(Int32);
CAMLreturn(alloc_generic_value(
LLVMCreateGenericValueOfInt(Ty, Int32_val(Int32), 1)));
}
/* Llvm.lltype -> nativeint -> t */
CAMLprim value llvm_genericvalue_of_nativeint(LLVMTypeRef Ty, value NatInt) {
CAMLparam1(NatInt);
CAMLreturn(alloc_generic_value(
LLVMCreateGenericValueOfInt(Ty, Nativeint_val(NatInt), 1)));
}
/* Llvm.lltype -> int64 -> t */
CAMLprim value llvm_genericvalue_of_int64(LLVMTypeRef Ty, value Int64) {
CAMLparam1(Int64);
CAMLreturn(alloc_generic_value(
LLVMCreateGenericValueOfInt(Ty, Int64_val(Int64), 1)));
}
/* Llvm.lltype -> t -> float */
CAMLprim value llvm_genericvalue_as_float(LLVMTypeRef Ty, value GenVal) {
CAMLparam1(GenVal);
CAMLreturn(copy_double(
LLVMGenericValueToFloat(Ty, Genericvalue_val(GenVal))));
}
/* t -> 'a */
CAMLprim value llvm_genericvalue_as_value(value GenVal) {
return Val_op(LLVMGenericValueToPointer(Genericvalue_val(GenVal)));
}
/* t -> int */
CAMLprim value llvm_genericvalue_as_int(value GenVal) {
assert(LLVMGenericValueIntWidth(Genericvalue_val(GenVal)) <= 8 * sizeof(value)
&& "Generic value too wide to treat as an int!");
return Val_int(LLVMGenericValueToInt(Genericvalue_val(GenVal), 1));
}
/* t -> int32 */
CAMLprim value llvm_genericvalue_as_int32(value GenVal) {
CAMLparam1(GenVal);
assert(LLVMGenericValueIntWidth(Genericvalue_val(GenVal)) <= 32
&& "Generic value too wide to treat as an int32!");
CAMLreturn(copy_int32(LLVMGenericValueToInt(Genericvalue_val(GenVal), 1)));
}
/* t -> int64 */
CAMLprim value llvm_genericvalue_as_int64(value GenVal) {
CAMLparam1(GenVal);
assert(LLVMGenericValueIntWidth(Genericvalue_val(GenVal)) <= 64
&& "Generic value too wide to treat as an int64!");
CAMLreturn(copy_int64(LLVMGenericValueToInt(Genericvalue_val(GenVal), 1)));
}
/* t -> nativeint */
CAMLprim value llvm_genericvalue_as_nativeint(value GenVal) {
CAMLparam1(GenVal);
assert(LLVMGenericValueIntWidth(Genericvalue_val(GenVal)) <= 8 * sizeof(value)
&& "Generic value too wide to treat as a nativeint!");
CAMLreturn(copy_nativeint(LLVMGenericValueToInt(Genericvalue_val(GenVal),1)));
}
/*--... Operations on execution engines ....................................--*/
/* llmoduleprovider -> ExecutionEngine.t */
CAMLprim LLVMExecutionEngineRef llvm_ee_create(LLVMModuleProviderRef MP) {
LLVMExecutionEngineRef Interp;
char *Error;
if (LLVMCreateExecutionEngine(&Interp, MP, &Error))
llvm_raise(llvm_ee_error_exn, Error);
return Interp;
}
/* llmoduleprovider -> ExecutionEngine.t */
CAMLprim LLVMExecutionEngineRef
llvm_ee_create_interpreter(LLVMModuleProviderRef MP) {
LLVMExecutionEngineRef Interp;
char *Error;
if (LLVMCreateInterpreter(&Interp, MP, &Error))
llvm_raise(llvm_ee_error_exn, Error);
return Interp;
}
/* llmoduleprovider -> ExecutionEngine.t */
CAMLprim LLVMExecutionEngineRef
llvm_ee_create_jit(LLVMModuleProviderRef MP) {
LLVMExecutionEngineRef JIT;
char *Error;
if (LLVMCreateJITCompiler(&JIT, MP, &Error))
llvm_raise(llvm_ee_error_exn, Error);
return JIT;
}
/* ExecutionEngine.t -> unit */
CAMLprim value llvm_ee_dispose(LLVMExecutionEngineRef EE) {
LLVMDisposeExecutionEngine(EE);
return Val_unit;
}
/* llmoduleprovider -> ExecutionEngine.t -> unit */
CAMLprim value llvm_ee_add_mp(LLVMModuleProviderRef MP,
LLVMExecutionEngineRef EE) {
LLVMAddModuleProvider(EE, MP);
return Val_unit;
}
/* llmoduleprovider -> ExecutionEngine.t -> llmodule */
CAMLprim LLVMModuleRef llvm_ee_remove_mp(LLVMModuleProviderRef MP,
LLVMExecutionEngineRef EE) {
LLVMModuleRef RemovedModule;
char *Error;
if (LLVMRemoveModuleProvider(EE, MP, &RemovedModule, &Error))
llvm_raise(llvm_ee_error_exn, Error);
return RemovedModule;
}
/* string -> ExecutionEngine.t -> llvalue option */
CAMLprim value llvm_ee_find_function(value Name, LLVMExecutionEngineRef EE) {
CAMLparam1(Name);
CAMLlocal1(Option);
LLVMValueRef Found;
if (LLVMFindFunction(EE, String_val(Name), &Found))
CAMLreturn(Val_unit);
Option = alloc(1, 1);
Field(Option, 0) = Val_op(Found);
CAMLreturn(Option);
}
/* llvalue -> GenericValue.t array -> ExecutionEngine.t -> GenericValue.t */
CAMLprim value llvm_ee_run_function(LLVMValueRef F, value Args,
LLVMExecutionEngineRef EE) {
unsigned NumArgs;
LLVMGenericValueRef Result, *GVArgs;
unsigned I;
NumArgs = Wosize_val(Args);
GVArgs = (LLVMGenericValueRef*) malloc(NumArgs * sizeof(LLVMGenericValueRef));
for (I = 0; I != NumArgs; ++I)
GVArgs[I] = Genericvalue_val(Field(Args, I));
Result = LLVMRunFunction(EE, F, NumArgs, GVArgs);
free(GVArgs);
return alloc_generic_value(Result);
}
/* ExecutionEngine.t -> unit */
CAMLprim value llvm_ee_run_static_ctors(LLVMExecutionEngineRef EE) {
LLVMRunStaticConstructors(EE);
return Val_unit;
}
/* ExecutionEngine.t -> unit */
CAMLprim value llvm_ee_run_static_dtors(LLVMExecutionEngineRef EE) {
LLVMRunStaticDestructors(EE);
return Val_unit;
}
/* llvalue -> string array -> (string * string) array -> ExecutionEngine.t ->
int */
CAMLprim value llvm_ee_run_function_as_main(LLVMValueRef F,
value Args, value Env,
LLVMExecutionEngineRef EE) {
CAMLparam2(Args, Env);
int I, NumArgs, NumEnv, EnvSize, Result;
const char **CArgs, **CEnv;
char *CEnvBuf, *Pos;
NumArgs = Wosize_val(Args);
NumEnv = Wosize_val(Env);
/* Build the environment. */
CArgs = (const char **) malloc(NumArgs * sizeof(char*));
for (I = 0; I != NumArgs; ++I)
CArgs[I] = String_val(Field(Args, I));
/* Compute the size of the environment string buffer. */
for (I = 0, EnvSize = 0; I != NumEnv; ++I) {
EnvSize += strlen(String_val(Field(Field(Env, I), 0))) + 1;
EnvSize += strlen(String_val(Field(Field(Env, I), 1))) + 1;
}
/* Build the environment. */
CEnv = (const char **) malloc((NumEnv + 1) * sizeof(char*));
CEnvBuf = (char*) malloc(EnvSize);
Pos = CEnvBuf;
for (I = 0; I != NumEnv; ++I) {
char *Name = String_val(Field(Field(Env, I), 0)),
*Value = String_val(Field(Field(Env, I), 1));
int NameLen = strlen(Name),
ValueLen = strlen(Value);
CEnv[I] = Pos;
memcpy(Pos, Name, NameLen);
Pos += NameLen;
*Pos++ = '=';
memcpy(Pos, Value, ValueLen);
Pos += ValueLen;
*Pos++ = '\0';
}
CEnv[NumEnv] = NULL;
Result = LLVMRunFunctionAsMain(EE, F, NumArgs, CArgs, CEnv);
free(CArgs);
free(CEnv);
free(CEnvBuf);
CAMLreturn(Val_int(Result));
}
/* llvalue -> ExecutionEngine.t -> unit */
CAMLprim value llvm_ee_free_machine_code(LLVMValueRef F,
LLVMExecutionEngineRef EE) {
LLVMFreeMachineCodeForFunction(EE, F);
return Val_unit;
}

View File

@@ -0,0 +1,106 @@
(*===-- llvm_executionengine.ml - LLVM Ocaml Interface ----------*- C++ -*-===*
*
* The LLVM Compiler Infrastructure
*
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
*
*===----------------------------------------------------------------------===*)
exception Error of string
external register_exns: exn -> unit
= "llvm_register_ee_exns"
module GenericValue = struct
type t
external of_float: Llvm.lltype -> float -> t
= "llvm_genericvalue_of_float"
external of_pointer: 'a -> t
= "llvm_genericvalue_of_value"
external of_int32: Llvm.lltype -> int32 -> t
= "llvm_genericvalue_of_int32"
external of_int: Llvm.lltype -> int -> t
= "llvm_genericvalue_of_int"
external of_nativeint: Llvm.lltype -> nativeint -> t
= "llvm_genericvalue_of_nativeint"
external of_int64: Llvm.lltype -> int64 -> t
= "llvm_genericvalue_of_int64"
external as_float: Llvm.lltype -> t -> float
= "llvm_genericvalue_as_float"
external as_pointer: t -> 'a
= "llvm_genericvalue_as_value"
external as_int32: t -> int32
= "llvm_genericvalue_as_int32"
external as_int: t -> int
= "llvm_genericvalue_as_int"
external as_nativeint: t -> nativeint
= "llvm_genericvalue_as_nativeint"
external as_int64: t -> int64
= "llvm_genericvalue_as_int64"
end
module ExecutionEngine = struct
type t
(* FIXME: Ocaml is not running this setup code unless we use 'val' in the
interface, which causes the emission of a stub for each function;
using 'external' in the module allows direct calls into
ocaml_executionengine.c. This is hardly fatal, but it is unnecessary
overhead on top of the two stubs that are already invoked for each
call into LLVM. *)
let _ = register_exns (Error "")
external create: Llvm.llmoduleprovider -> t
= "llvm_ee_create"
external create_interpreter: Llvm.llmoduleprovider -> t
= "llvm_ee_create_interpreter"
external create_jit: Llvm.llmoduleprovider -> t
= "llvm_ee_create_jit"
external dispose: t -> unit
= "llvm_ee_dispose"
external add_module_provider: Llvm.llmoduleprovider -> t -> unit
= "llvm_ee_add_mp"
external remove_module_provider: Llvm.llmoduleprovider -> t -> Llvm.llmodule
= "llvm_ee_remove_mp"
external find_function: string -> t -> Llvm.llvalue option
= "llvm_ee_find_function"
external run_function: Llvm.llvalue -> GenericValue.t array -> t ->
GenericValue.t
= "llvm_ee_run_function"
external run_static_ctors: t -> unit
= "llvm_ee_run_static_ctors"
external run_static_dtors: t -> unit
= "llvm_ee_run_static_dtors"
external run_function_as_main: Llvm.llvalue -> string array ->
(string * string) array -> t -> int
= "llvm_ee_run_function_as_main"
external free_machine_code: Llvm.llvalue -> t -> unit
= "llvm_ee_free_machine_code"
(* The following are not bound. Patches are welcome.
get_target_data: t -> lltargetdata
add_global_mapping: llvalue -> llgenericvalue -> t -> unit
clear_all_global_mappings: t -> unit
update_global_mapping: llvalue -> llgenericvalue -> t -> unit
get_pointer_to_global_if_available: llvalue -> t -> llgenericvalue
get_pointer_to_global: llvalue -> t -> llgenericvalue
get_pointer_to_function: llvalue -> t -> llgenericvalue
get_pointer_to_function_or_stub: llvalue -> t -> llgenericvalue
get_global_value_at_address: llgenericvalue -> t -> llvalue option
store_value_to_memory: llgenericvalue -> llgenericvalue -> lltype -> unit
initialize_memory: llvalue -> llgenericvalue -> t -> unit
recompile_and_relink_function: llvalue -> t -> llgenericvalue
get_or_emit_global_variable: llvalue -> t -> llgenericvalue
disable_lazy_compilation: t -> unit
lazy_compilation_enabled: t -> bool
install_lazy_function_creator: (string -> llgenericvalue) -> t -> unit
*)
end

View File

@@ -0,0 +1,152 @@
(*===-- llvm_executionengine.mli - LLVM Ocaml Interface ---------*- C++ -*-===*
*
* The LLVM Compiler Infrastructure
*
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
*
*===----------------------------------------------------------------------===
*
* This interface provides an ocaml API for LLVM execution engine (JIT/
* interpreter), the classes in the ExecutionEngine library.
*
*===----------------------------------------------------------------------===*)
exception Error of string
module GenericValue: sig
(** [GenericValue.t] is a boxed union type used to portably pass arguments to
and receive values from the execution engine. It supports only a limited
selection of types; for more complex argument types, it is necessary to
generate a stub function by hand or to pass parameters by reference.
See the struct [llvm::GenericValue]. **)
type t
(** [of_float fpty n] boxes the float [n] in a float-valued generic value
according to the floating point type [fpty]. See the fields
[llvm::GenericValue::DoubleVal] and [llvm::GenericValue::FloatVal]. **)
val of_float: Llvm.lltype -> float -> t
(** [of_pointer v] boxes the pointer value [v] in a generic value. See the
field [llvm::GenericValue::PointerVal]. **)
val of_pointer: 'a -> t
(** [of_int32 n w] boxes the int32 [i] in a generic value with the bitwidth
[w]. See the field [llvm::GenericValue::IntVal]. **)
val of_int32: Llvm.lltype -> int32 -> t
(** [of_int n w] boxes the int [i] in a generic value with the bitwidth
[w]. See the field [llvm::GenericValue::IntVal]. **)
val of_int: Llvm.lltype -> int -> t
(** [of_natint n w] boxes the native int [i] in a generic value with the
bitwidth [w]. See the field [llvm::GenericValue::IntVal]. **)
val of_nativeint: Llvm.lltype -> nativeint -> t
(** [of_int64 n w] boxes the int64 [i] in a generic value with the bitwidth
[w]. See the field [llvm::GenericValue::IntVal]. **)
val of_int64: Llvm.lltype -> int64 -> t
(** [as_float fpty gv] unboxes the floating point-valued generic value [gv] of
floating point type [fpty]. See the fields [llvm::GenericValue::DoubleVal]
and [llvm::GenericValue::FloatVal]. **)
val as_float: Llvm.lltype -> t -> float
(** [as_pointer gv] unboxes the pointer-valued generic value [gv]. See the
field [llvm::GenericValue::PointerVal]. **)
val as_pointer: t -> 'a
(** [as_int32 gv] unboxes the integer-valued generic value [gv] as an [int32].
Is invalid if [gv] has a bitwidth greater than 32 bits. See the field
[llvm::GenericValue::IntVal]. **)
val as_int32: t -> int32
(** [as_int gv] unboxes the integer-valued generic value [gv] as an [int].
Is invalid if [gv] has a bitwidth greater than the host bit width (but the
most significant bit may be lost). See the field
[llvm::GenericValue::IntVal]. **)
val as_int: t -> int
(** [as_natint gv] unboxes the integer-valued generic value [gv] as a
[nativeint]. Is invalid if [gv] has a bitwidth greater than
[nativeint]. See the field [llvm::GenericValue::IntVal]. **)
val as_nativeint: t -> nativeint
(** [as_int64 gv] returns the integer-valued generic value [gv] as an [int64].
Is invalid if [gv] has a bitwidth greater than [int64]. See the field
[llvm::GenericValue::IntVal]. **)
val as_int64: t -> int64
end
module ExecutionEngine: sig
(** An execution engine is either a JIT compiler or an interpreter, capable of
directly loading an LLVM module and executing its functions without first
invoking a static compiler and generating a native executable. **)
type t
(** [create mp] creates a new execution engine, taking ownership of the
module provider [mp] if successful. Creates a JIT if possible, else falls
back to an interpreter. Raises [Error msg] if an error occurrs. The
execution engine is not garbage collected and must be destroyed with
[dispose ee]. See the function [llvm::ExecutionEngine::create]. **)
val create: Llvm.llmoduleprovider -> t
(** [create_interpreter mp] creates a new interpreter, taking ownership of the
module provider [mp] if successful. Raises [Error msg] if an error
occurrs. The execution engine is not garbage collected and must be
destroyed with [dispose ee].
See the function [llvm::ExecutionEngine::create]. **)
val create_interpreter: Llvm.llmoduleprovider -> t
(** [create_jit mp] creates a new JIT (just-in-time compiler), taking
ownership of the module provider [mp] if successful. Raises [Error msg] if
an error occurrs. The execution engine is not garbage collected and must
be destroyed with [dispose ee].
See the function [llvm::ExecutionEngine::create]. **)
val create_jit: Llvm.llmoduleprovider -> t
(** [dispose ee] releases the memory used by the execution engine and must be
invoked to avoid memory leaks. **)
val dispose: t -> unit
(** [add_module_provider mp ee] adds the module provider [mp] to the execution
engine [ee]. **)
val add_module_provider: Llvm.llmoduleprovider -> t -> unit
(** [remove_module_provider mp ee] removes the module provider [mp] from the
execution engine [ee], disposing of [mp] and the module referenced by
[mp]. Raises [Error msg] if an error occurs. **)
val remove_module_provider: Llvm.llmoduleprovider -> t -> Llvm.llmodule
(** [find_function n ee] finds the function named [n] defined in any of the
modules owned by the execution engine [ee]. Returns [None] if the function
is not found and [Some f] otherwise. **)
val find_function: string -> t -> Llvm.llvalue option
(** [run_function f args ee] synchronously executes the function [f] with the
arguments [args], which must be compatible with the parameter types. **)
val run_function: Llvm.llvalue -> GenericValue.t array -> t ->
GenericValue.t
(** [run_static_ctors ee] executes the static constructors of each module in
the execution engine [ee]. **)
val run_static_ctors: t -> unit
(** [run_static_dtors ee] executes the static destructors of each module in
the execution engine [ee]. **)
val run_static_dtors: t -> unit
(** [run_function_as_main f args env ee] executes the function [f] as a main
function, passing it [argv] and [argc] according to the string array
[args], and [envp] as specified by the array [env]. Returns the integer
return value of the function. **)
val run_function_as_main: Llvm.llvalue -> string array ->
(string * string) array -> t -> int
(** [free_machine_code f ee] releases the memory in the execution engine [ee]
used to store the machine code for the function [f]. **)
val free_machine_code: Llvm.llvalue -> t -> unit
end

View File

@@ -0,0 +1,20 @@
##===- bindings/ocaml/bitwriter/Makefile -------------------*- Makefile -*-===##
#
# The LLVM Compiler Infrastructure
#
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
##===----------------------------------------------------------------------===##
#
# This is the makefile for the Objective Caml Llvm interface.
#
##===----------------------------------------------------------------------===##
LEVEL := ../../..
LIBRARYNAME := llvm
DONT_BUILD_RELINKED := 1
UsedComponents := core
UsedOcamLibs := llvm
include ../Makefile.ocaml

View File

@@ -0,0 +1,526 @@
(*===-- tools/ml/llvm.ml - LLVM Ocaml Interface ---------------------------===*
*
* The LLVM Compiler Infrastructure
*
* This file is distributed under the University of Illinois Open Source
* License. See LICENSE.TXT for details.
*
*===----------------------------------------------------------------------===*)
type llmodule
type lltype
type lltypehandle
type llvalue
type llbasicblock
type llbuilder
type llmoduleprovider
type llmemorybuffer
module TypeKind = struct
type t =
| Void
| Float
| Double
| X86fp80
| Fp128
| Ppc_fp128
| Label
| Integer
| Function
| Struct
| Array
| Pointer
| Opaque
| Vector
end
module Linkage = struct
type t =
| External
| Link_once
| Weak
| Appending
| Internal
| Dllimport
| Dllexport
| External_weak
| Ghost
end
module Visibility = struct
type t =
| Default
| Hidden
| Protected
end
module CallConv = struct
let c = 0
let fast = 8
let cold = 9
let x86_stdcall = 64
let x86_fastcall = 65
end
module Icmp = struct
type t =
| Eq
| Ne
| Ugt
| Uge
| Ult
| Ule
| Sgt
| Sge
| Slt
| Sle
end
module Fcmp = struct
type t =
| False
| Oeq
| Ogt
| Oge
| Olt
| Ole
| One
| Ord
| Uno
| Ueq
| Ugt
| Uge
| Ult
| Ule
| Une
| True
end
exception IoError of string
external register_exns : exn -> unit = "llvm_register_core_exns"
let _ = register_exns (IoError "")
(*===-- Modules -----------------------------------------------------------===*)
external create_module : string -> llmodule = "llvm_create_module"
external dispose_module : llmodule -> unit = "llvm_dispose_module"
external target_triple: llmodule -> string
= "llvm_target_triple"
external set_target_triple: string -> llmodule -> unit
= "llvm_set_target_triple"
external data_layout: llmodule -> string
= "llvm_data_layout"
external set_data_layout: string -> llmodule -> unit
= "llvm_set_data_layout"
external define_type_name : string -> lltype -> llmodule -> bool
= "llvm_add_type_name"
external delete_type_name : string -> llmodule -> unit
= "llvm_delete_type_name"
(*===-- Types -------------------------------------------------------------===*)
external classify_type : lltype -> TypeKind.t = "llvm_classify_type"
(*--... Operations on integer types ........................................--*)
external _i1_type : unit -> lltype = "llvm_i1_type"
external _i8_type : unit -> lltype = "llvm_i8_type"
external _i16_type : unit -> lltype = "llvm_i16_type"
external _i32_type : unit -> lltype = "llvm_i32_type"
external _i64_type : unit -> lltype = "llvm_i64_type"
let i1_type = _i1_type ()
let i8_type = _i8_type ()
let i16_type = _i16_type ()
let i32_type = _i32_type ()
let i64_type = _i64_type ()
external integer_type : int -> lltype = "llvm_integer_type"
external integer_bitwidth : lltype -> int = "llvm_integer_bitwidth"
(*--... Operations on real types ...........................................--*)
external _float_type : unit -> lltype = "llvm_float_type"
external _double_type : unit -> lltype = "llvm_double_type"
external _x86fp80_type : unit -> lltype = "llvm_x86fp80_type"
external _fp128_type : unit -> lltype = "llvm_fp128_type"
external _ppc_fp128_type : unit -> lltype = "llvm_ppc_fp128_type"
let float_type = _float_type ()
let double_type = _double_type ()
let x86fp80_type = _x86fp80_type ()
let fp128_type = _fp128_type ()
let ppc_fp128_type = _ppc_fp128_type ()
(*--... Operations on function types .......................................--*)
external function_type : lltype -> lltype array -> lltype = "llvm_function_type"
external var_arg_function_type : lltype -> lltype array -> lltype
= "llvm_var_arg_function_type"
external is_var_arg : lltype -> bool = "llvm_is_var_arg"
external return_type : lltype -> lltype = "LLVMGetReturnType"
external param_types : lltype -> lltype array = "llvm_param_types"
(*--... Operations on struct types .........................................--*)
external struct_type : lltype array -> lltype = "llvm_struct_type"
external packed_struct_type : lltype array -> lltype = "llvm_packed_struct_type"
external element_types : lltype -> lltype array = "llvm_element_types"
external is_packed : lltype -> bool = "llvm_is_packed"
(*--... Operations on pointer, vector, and array types .....................--*)
external array_type : lltype -> int -> lltype = "llvm_array_type"
external pointer_type : lltype -> lltype = "llvm_pointer_type"
external qualified_pointer_type : lltype -> int -> lltype
= "llvm_qualified_pointer_type"
external vector_type : lltype -> int -> lltype = "llvm_vector_type"
external element_type : lltype -> lltype = "LLVMGetElementType"
external array_length : lltype -> int = "llvm_array_length"
external address_space : lltype -> int = "llvm_address_space"
external vector_size : lltype -> int = "llvm_vector_size"
(*--... Operations on other types ..........................................--*)
external opaque_type : unit -> lltype = "llvm_opaque_type"
external _void_type : unit -> lltype = "llvm_void_type"
external _label_type : unit -> lltype = "llvm_label_type"
let void_type = _void_type ()
let label_type = _label_type ()
(*--... Operations on type handles .........................................--*)
external handle_to_type : lltype -> lltypehandle = "llvm_handle_to_type"
external type_of_handle : lltypehandle -> lltype = "llvm_type_of_handle"
external refine_type : lltype -> lltype -> unit = "llvm_refine_type"
(*===-- Values ------------------------------------------------------------===*)
external type_of : llvalue -> lltype = "llvm_type_of"
external value_name : llvalue -> string = "llvm_value_name"
external set_value_name : string -> llvalue -> unit = "llvm_set_value_name"
external dump_value : llvalue -> unit = "llvm_dump_value"
(*--... Operations on constants of (mostly) any type .......................--*)
external is_constant : llvalue -> bool = "llvm_is_constant"
external const_null : lltype -> llvalue = "LLVMConstNull"
external const_all_ones : (*int|vec*)lltype -> llvalue = "LLVMConstAllOnes"
external undef : lltype -> llvalue = "LLVMGetUndef"
external is_null : llvalue -> bool = "llvm_is_null"
external is_undef : llvalue -> bool = "llvm_is_undef"
(*--... Operations on scalar constants .....................................--*)
external const_int : lltype -> int -> llvalue = "llvm_const_int"
external const_of_int64 : lltype -> Int64.t -> bool -> llvalue
= "llvm_const_of_int64"
external const_float : lltype -> float -> llvalue = "llvm_const_float"
(*--... Operations on composite constants ..................................--*)
external const_string : string -> llvalue = "llvm_const_string"
external const_stringz : string -> llvalue = "llvm_const_stringz"
external const_array : lltype -> llvalue array -> llvalue = "llvm_const_array"
external const_struct : llvalue array -> llvalue = "llvm_const_struct"
external const_packed_struct : llvalue array -> llvalue
= "llvm_const_packed_struct"
external const_vector : llvalue array -> llvalue = "llvm_const_vector"
(*--... Constant expressions ...............................................--*)
external size_of : lltype -> llvalue = "LLVMSizeOf"
external const_neg : llvalue -> llvalue = "LLVMConstNeg"
external const_not : llvalue -> llvalue = "LLVMConstNot"
external const_add : llvalue -> llvalue -> llvalue = "LLVMConstAdd"
external const_sub : llvalue -> llvalue -> llvalue = "LLVMConstSub"
external const_mul : llvalue -> llvalue -> llvalue = "LLVMConstMul"
external const_udiv : llvalue -> llvalue -> llvalue = "LLVMConstUDiv"
external const_sdiv : llvalue -> llvalue -> llvalue = "LLVMConstSDiv"
external const_fdiv : llvalue -> llvalue -> llvalue = "LLVMConstFDiv"
external const_urem : llvalue -> llvalue -> llvalue = "LLVMConstURem"
external const_srem : llvalue -> llvalue -> llvalue = "LLVMConstSRem"
external const_frem : llvalue -> llvalue -> llvalue = "LLVMConstFRem"
external const_and : llvalue -> llvalue -> llvalue = "LLVMConstAnd"
external const_or : llvalue -> llvalue -> llvalue = "LLVMConstOr"
external const_xor : llvalue -> llvalue -> llvalue = "LLVMConstXor"
external const_icmp : Icmp.t -> llvalue -> llvalue -> llvalue
= "llvm_const_icmp"
external const_fcmp : Fcmp.t -> llvalue -> llvalue -> llvalue
= "llvm_const_fcmp"
external const_shl : llvalue -> llvalue -> llvalue = "LLVMConstShl"
external const_lshr : llvalue -> llvalue -> llvalue = "LLVMConstLShr"
external const_ashr : llvalue -> llvalue -> llvalue = "LLVMConstAShr"
external const_gep : llvalue -> llvalue array -> llvalue = "llvm_const_gep"
external const_trunc : llvalue -> lltype -> llvalue = "LLVMConstTrunc"
external const_sext : llvalue -> lltype -> llvalue = "LLVMConstSExt"
external const_zext : llvalue -> lltype -> llvalue = "LLVMConstZExt"
external const_fptrunc : llvalue -> lltype -> llvalue = "LLVMConstFPTrunc"
external const_fpext : llvalue -> lltype -> llvalue = "LLVMConstFPExt"
external const_uitofp : llvalue -> lltype -> llvalue = "LLVMConstUIToFP"
external const_sitofp : llvalue -> lltype -> llvalue = "LLVMConstSIToFP"
external const_fptoui : llvalue -> lltype -> llvalue = "LLVMConstFPToUI"
external const_fptosi : llvalue -> lltype -> llvalue = "LLVMConstFPToSI"
external const_ptrtoint : llvalue -> lltype -> llvalue = "LLVMConstPtrToInt"
external const_inttoptr : llvalue -> lltype -> llvalue = "LLVMConstIntToPtr"
external const_bitcast : llvalue -> lltype -> llvalue = "LLVMConstBitCast"
external const_select : llvalue -> llvalue -> llvalue -> llvalue
= "LLVMConstSelect"
external const_extractelement : llvalue -> llvalue -> llvalue
= "LLVMConstExtractElement"
external const_insertelement : llvalue -> llvalue -> llvalue -> llvalue
= "LLVMConstInsertElement"
external const_shufflevector : llvalue -> llvalue -> llvalue -> llvalue
= "LLVMConstShuffleVector"
(*--... Operations on global variables, functions, and aliases (globals) ...--*)
external is_declaration : llvalue -> bool = "llvm_is_declaration"
external linkage : llvalue -> Linkage.t = "llvm_linkage"
external set_linkage : Linkage.t -> llvalue -> unit = "llvm_set_linkage"
external section : llvalue -> string = "llvm_section"
external set_section : string -> llvalue -> unit = "llvm_set_section"
external visibility : llvalue -> Visibility.t = "llvm_visibility"
external set_visibility : Visibility.t -> llvalue -> unit = "llvm_set_visibility"
external alignment : llvalue -> int = "llvm_alignment"
external set_alignment : int -> llvalue -> unit = "llvm_set_alignment"
external is_global_constant : llvalue -> bool = "llvm_is_global_constant"
external set_global_constant : bool -> llvalue -> unit
= "llvm_set_global_constant"
(*--... Operations on global variables .....................................--*)
external declare_global : lltype -> string -> llmodule -> llvalue
= "llvm_declare_global"
external define_global : string -> llvalue -> llmodule -> llvalue
= "llvm_define_global"
external lookup_global : string -> llmodule -> llvalue option
= "llvm_lookup_global"
external delete_global : llvalue -> unit = "llvm_delete_global"
external has_initializer : llvalue -> bool = "llvm_has_initializer"
external global_initializer : llvalue -> llvalue = "LLVMGetInitializer"
external set_initializer : llvalue -> llvalue -> unit = "llvm_set_initializer"
external remove_initializer : llvalue -> unit = "llvm_remove_initializer"
external is_thread_local : llvalue -> bool = "llvm_is_thread_local"
external set_thread_local : bool -> llvalue -> unit = "llvm_set_thread_local"
(*--... Operations on functions ............................................--*)
external declare_function : string -> lltype -> llmodule -> llvalue
= "llvm_declare_function"
external define_function : string -> lltype -> llmodule -> llvalue
= "llvm_define_function"
external lookup_function : string -> llmodule -> llvalue option
= "llvm_lookup_function"
external delete_function : llvalue -> unit = "llvm_delete_function"
external params : llvalue -> llvalue array = "llvm_params"
external param : llvalue -> int -> llvalue = "llvm_param"
external is_intrinsic : llvalue -> bool = "llvm_is_intrinsic"
external function_call_conv : llvalue -> int = "llvm_function_call_conv"
external set_function_call_conv : int -> llvalue -> unit
= "llvm_set_function_call_conv"
external collector : llvalue -> string option = "llvm_collector"
external set_collector : string option -> llvalue -> unit = "llvm_set_collector"
(* TODO: param attrs *)
(*--... Operations on basic blocks .........................................--*)
external basic_blocks : llvalue -> llbasicblock array = "llvm_basic_blocks"
external entry_block : llvalue -> llbasicblock = "LLVMGetEntryBasicBlock"
external delete_block : llbasicblock -> unit = "llvm_delete_block"
external append_block : string -> llvalue -> llbasicblock = "llvm_append_block"
external insert_block : string -> llbasicblock -> llbasicblock
= "llvm_insert_block"
external value_of_block : llbasicblock -> llvalue = "LLVMBasicBlockAsValue"
external value_is_block : llvalue -> bool = "llvm_value_is_block"
external block_of_value : llvalue -> llbasicblock = "LLVMValueAsBasicBlock"
(*--... Operations on call sites ...........................................--*)
external instruction_call_conv: llvalue -> int
= "llvm_instruction_call_conv"
external set_instruction_call_conv: int -> llvalue -> unit
= "llvm_set_instruction_call_conv"
(*--... Operations on phi nodes ............................................--*)
external add_incoming : (llvalue * llbasicblock) -> llvalue -> unit
= "llvm_add_incoming"
external incoming : llvalue -> (llvalue * llbasicblock) list = "llvm_incoming"
(*===-- Instruction builders ----------------------------------------------===*)
external builder: unit-> llbuilder
= "llvm_builder"
external builder_before : llvalue -> llbuilder = "llvm_builder_before"
external builder_at_end : llbasicblock -> llbuilder = "llvm_builder_at_end"
external position_before : llvalue -> llbuilder -> unit = "llvm_position_before"
external position_at_end : llbasicblock -> llbuilder -> unit
= "llvm_position_at_end"
(*--... Terminators ........................................................--*)
external build_ret_void : llbuilder -> llvalue = "llvm_build_ret_void"
external build_ret : llvalue -> llbuilder -> llvalue = "llvm_build_ret"
external build_br : llbasicblock -> llbuilder -> llvalue = "llvm_build_br"
external build_cond_br : llvalue -> llbasicblock -> llbasicblock -> llbuilder ->
llvalue = "llvm_build_cond_br"
external build_switch : llvalue -> llbasicblock -> int -> llbuilder -> llvalue
= "llvm_build_switch"
external build_invoke : llvalue -> llvalue array -> llbasicblock ->
llbasicblock -> string -> llbuilder -> llvalue
= "llvm_build_invoke_bc" "llvm_build_invoke_nat"
external build_unwind : llbuilder -> llvalue = "llvm_build_unwind"
external build_unreachable : llbuilder -> llvalue = "llvm_build_unreachable"
(*--... Arithmetic .........................................................--*)
external build_add : llvalue -> llvalue -> string -> llbuilder -> llvalue
= "llvm_build_add"
external build_sub : llvalue -> llvalue -> string -> llbuilder -> llvalue
= "llvm_build_sub"
external build_mul : llvalue -> llvalue -> string -> llbuilder -> llvalue
= "llvm_build_mul"
external build_udiv : llvalue -> llvalue -> string -> llbuilder -> llvalue
= "llvm_build_udiv"
external build_sdiv : llvalue -> llvalue -> string -> llbuilder -> llvalue
= "llvm_build_sdiv"
external build_fdiv : llvalue -> llvalue -> string -> llbuilder -> llvalue
= "llvm_build_fdiv"
external build_urem : llvalue -> llvalue -> string -> llbuilder -> llvalue
= "llvm_build_urem"
external build_srem : llvalue -> llvalue -> string -> llbuilder -> llvalue
= "llvm_build_srem"
external build_frem : llvalue -> llvalue -> string -> llbuilder -> llvalue
= "llvm_build_frem"
external build_shl : llvalue -> llvalue -> string -> llbuilder -> llvalue
= "llvm_build_shl"
external build_lshr : llvalue -> llvalue -> string -> llbuilder -> llvalue
= "llvm_build_lshr"
external build_ashr : llvalue -> llvalue -> string -> llbuilder -> llvalue
= "llvm_build_ashr"
external build_and : llvalue -> llvalue -> string -> llbuilder -> llvalue
= "llvm_build_and"
external build_or : llvalue -> llvalue -> string -> llbuilder -> llvalue
= "llvm_build_or"
external build_xor : llvalue -> llvalue -> string -> llbuilder -> llvalue
= "llvm_build_xor"
external build_neg : llvalue -> string -> llbuilder -> llvalue
= "llvm_build_neg"
external build_not : llvalue -> string -> llbuilder -> llvalue
= "llvm_build_not"
(*--... Memory .............................................................--*)
external build_malloc : lltype -> string -> llbuilder -> llvalue
= "llvm_build_malloc"
external build_array_malloc : lltype -> llvalue -> string -> llbuilder ->
llvalue = "llvm_build_array_malloc"
external build_alloca : lltype -> string -> llbuilder -> llvalue
= "llvm_build_alloca"
external build_array_alloca : lltype -> llvalue -> string -> llbuilder ->
llvalue = "llvm_build_array_alloca"
external build_free : llvalue -> llbuilder -> llvalue = "llvm_build_free"
external build_load : llvalue -> string -> llbuilder -> llvalue
= "llvm_build_load"
external build_store : llvalue -> llvalue -> llbuilder -> llvalue
= "llvm_build_store"
external build_gep : llvalue -> llvalue array -> string -> llbuilder -> llvalue
= "llvm_build_gep"
(*--... Casts ..............................................................--*)
external build_trunc : llvalue -> lltype -> string -> llbuilder -> llvalue
= "llvm_build_trunc"
external build_zext : llvalue -> lltype -> string -> llbuilder -> llvalue
= "llvm_build_zext"
external build_sext : llvalue -> lltype -> string -> llbuilder -> llvalue
= "llvm_build_sext"
external build_fptoui : llvalue -> lltype -> string -> llbuilder -> llvalue
= "llvm_build_fptoui"
external build_fptosi : llvalue -> lltype -> string -> llbuilder -> llvalue
= "llvm_build_fptosi"
external build_uitofp : llvalue -> lltype -> string -> llbuilder -> llvalue
= "llvm_build_uitofp"
external build_sitofp : llvalue -> lltype -> string -> llbuilder -> llvalue
= "llvm_build_sitofp"
external build_fptrunc : llvalue -> lltype -> string -> llbuilder -> llvalue
= "llvm_build_fptrunc"
external build_fpext : llvalue -> lltype -> string -> llbuilder -> llvalue
= "llvm_build_fpext"
external build_ptrtoint : llvalue -> lltype -> string -> llbuilder -> llvalue
= "llvm_build_prttoint"
external build_inttoptr : llvalue -> lltype -> string -> llbuilder -> llvalue
= "llvm_build_inttoptr"
external build_bitcast : llvalue -> lltype -> string -> llbuilder -> llvalue
= "llvm_build_bitcast"
(*--... Comparisons ........................................................--*)
external build_icmp : Icmp.t -> llvalue -> llvalue -> string ->
llbuilder -> llvalue = "llvm_build_icmp"
external build_fcmp : Fcmp.t -> llvalue -> llvalue -> string ->
llbuilder -> llvalue = "llvm_build_fcmp"
(*--... Miscellaneous instructions .........................................--*)
external build_phi : (llvalue * llbasicblock) list -> string -> llbuilder ->
llvalue = "llvm_build_phi"
external build_call : llvalue -> llvalue array -> string -> llbuilder -> llvalue
= "llvm_build_call"
external build_select : llvalue -> llvalue -> llvalue -> string -> llbuilder ->
llvalue = "llvm_build_select"
external build_va_arg : llvalue -> lltype -> string -> llbuilder -> llvalue
= "llvm_build_va_arg"
external build_extractelement : llvalue -> llvalue -> string -> llbuilder ->
llvalue = "llvm_build_extractelement"
external build_insertelement : llvalue -> llvalue -> llvalue -> string ->
llbuilder -> llvalue = "llvm_build_insertelement"
external build_shufflevector : llvalue -> llvalue -> llvalue -> string ->
llbuilder -> llvalue = "llvm_build_shufflevector"
(*===-- Module providers --------------------------------------------------===*)
module ModuleProvider = struct
external create : llmodule -> llmoduleprovider
= "LLVMCreateModuleProviderForExistingModule"
external dispose : llmoduleprovider -> unit = "llvm_dispose_module_provider"
end
(*===-- Memory buffers ----------------------------------------------------===*)
module MemoryBuffer = struct
external of_file : string -> llmemorybuffer = "llvm_memorybuffer_of_file"
external of_stdin : unit -> llmemorybuffer = "llvm_memorybuffer_of_stdin"
external dispose : llmemorybuffer -> unit = "llvm_memorybuffer_dispose"
end
(*===-- Non-Externs -------------------------------------------------------===*)
(* These functions are built using the externals, so must be declared late. *)
let concat2 sep arr =
let s = ref "" in
if 0 < Array.length arr then begin
s := !s ^ arr.(0);
for i = 1 to (Array.length arr) - 1 do
s := !s ^ sep ^ arr.(i)
done
end;
!s
let rec string_of_lltype ty =
(* FIXME: stop infinite recursion! :) *)
match classify_type ty with
TypeKind.Integer -> "i" ^ string_of_int (integer_bitwidth ty)
| TypeKind.Pointer -> (string_of_lltype (element_type ty)) ^ "*"
| TypeKind.Struct ->
let s = "{ " ^ (concat2 ", " (
Array.map string_of_lltype (element_types ty)
)) ^ " }" in
if is_packed ty
then "<" ^ s ^ ">"
else s
| TypeKind.Array -> "[" ^ (string_of_int (array_length ty)) ^
" x " ^ (string_of_lltype (element_type ty)) ^ "]"
| TypeKind.Vector -> "<" ^ (string_of_int (vector_size ty)) ^
" x " ^ (string_of_lltype (element_type ty)) ^ ">"
| TypeKind.Opaque -> "opaque"
| TypeKind.Function -> string_of_lltype (return_type ty) ^
" (" ^ (concat2 ", " (
Array.map string_of_lltype (param_types ty)
)) ^ ")"
| TypeKind.Label -> "label"
| TypeKind.Ppc_fp128 -> "ppc_fp128"
| TypeKind.Fp128 -> "fp128"
| TypeKind.X86fp80 -> "x86_fp80"
| TypeKind.Double -> "double"
| TypeKind.Float -> "float"
| TypeKind.Void -> "void"

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

58
llvm/build-for-llvm-top.sh Executable file
View File

@@ -0,0 +1,58 @@
#!/bin/sh
# This includes the Bourne shell library from llvm-top. Since this file is
# generally only used when building from llvm-top, it is safe to assume that
# llvm is checked out into llvm-top in which case .. just works.
. ../library.sh
# Process the options passed in to us by the build script into standard
# variables.
process_arguments "$@"
# See if we have previously been configured by sensing the presence
# of the config.status scripts
if test ! -x "config.status" ; then
# We must configure so build a list of configure options
config_options="--prefix=$PREFIX --with-llvmgccdir=$PREFIX"
if test "$OPTIMIZED" -eq 1 ; then
config_options="$config_options --enable-optimized"
else
config_options="$config_options --disable-optimized"
fi
if test "$DEBUG" -eq 1 ; then
config_options="$config_options --enable-debug"
else
config_options="$config_options --disable-debug"
fi
if test "$ASSERTIONS" -eq 1 ; then
config_options="$config_options --enable-assertions"
else
config_options="$config_options --disable-assertions"
fi
if test "$CHECKING" -eq 1 ; then
config_options="$config_options --enable-expensive-checks"
else
config_options="$config_options --disable-expensive-checks"
fi
if test "$DOXYGEN" -eq 1 ; then
config_options="$config_options --enable-doxygen"
else
config_options="$config_options --disable-doxygen"
fi
if test "$THREADS" -eq 1 ; then
config_options="$config_options --enable-threads"
else
config_options="$config_options --disable-threads"
fi
config_options="$config_options $OPTIONS_DASH $OPTIONS_DASH_DASH"
msg 0 Configuring $module with:
msg 0 " ./configure" $config_options
$LLVM_TOP/llvm/configure $config_options || \
die $? "Configuring llvm module failed"
else
msg 0 Module $module already configured, ignoring configure options.
fi
msg 0 Building $module with:
msg 0 " make" $OPTIONS_ASSIGN tools-only
make $OPTIONS_ASSIGN tools-only

912
llvm/configure vendored

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +0,0 @@
doxygen.cfg
doxygen
doxygen.out
*.tar.gz

View File

@@ -50,6 +50,7 @@
implementations</a></li>
</ul>
</li>
<li><a href="#memdep">Memory Dependence Analysis</a></li>
</ol>
<div class="doc_author">
@@ -755,6 +756,9 @@ field-<b>sensitive</b>" version of Steensgaard's algorithm using the Data
Structure Analysis framework. This gives it substantially more precision than
the standard algorithm while maintaining excellent analysis scalability.</p>
<p>Note that <tt>-steens-aa</tt> is available in the optional "poolalloc"
module, it is not part of the LLVM core.</p>
</div>
<!-- _______________________________________________________________________ -->
@@ -775,6 +779,9 @@ queries, and can provide context-sensitive mod/ref information as well. The
only major facility not implemented so far is support for must-alias
information.</p>
<p>Note that <tt>-ds-aa</tt> is available in the optional "poolalloc"
module, it is not part of the LLVM core.</p>
</div>
@@ -941,6 +948,24 @@ algorithm will have a lower number of may aliases).</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="memdep">Memory Dependence Analysis</a>
</div>
<!-- *********************************************************************** -->
<div class="doc_text">
<p>If you're just looking to be a client of alias analysis information, consider
using the Memory Dependence Analysis interface instead. MemDep is a lazy,
caching layer on top of alias analysis that is able to answer the question of
what preceding memory operations a given instruction depends on, either at an
intra- or inter-block level. Because of its laziness and caching
policy, using MemDep can be a significant performance win over accessing alias
analysis directly.</p>
</div>
<!-- *********************************************************************** -->
<hr>

View File

@@ -0,0 +1,23 @@
Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

View File

@@ -1,59 +1,651 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>LLVM Bitcode File Format</title>
<link rel="stylesheet" href="llvm.css" type="text/css">
<style type="text/css">
TR, TD { border: 2px solid gray; padding-left: 4pt; padding-right: 4pt;
padding-top: 2pt; padding-bottom: 2pt; }
TH { border: 2px solid gray; font-weight: bold; font-size: 105%; }
TABLE { text-align: center; border: 2px solid black;
border-collapse: collapse; margin-top: 1em; margin-left: 1em;
margin-right: 1em; margin-bottom: 1em; }
.td_left { border: 2px solid gray; text-align: left; }
</style>
</head>
<body>
<div class="doc_title"> LLVM Bitcode File Format </div>
<ol>
<li><a href="#abstract">Abstract</a></li>
<li><a href="#concepts">Concepts</a></li>
<li><a href="#overview">Overview</a></li>
<li><a href="#bitstream">Bitstream Format</a>
<ol>
<li><a href="#magic">Magic Numbers</a></li>
<li><a href="#primitives">Primitives</a></li>
<li><a href="#abbrevid">Abbreviation IDs</a></li>
<li><a href="#blocks">Blocks</a></li>
<li><a href="#datarecord">Data Records</a></li>
<li><a href="#abbreviations">Abbreviations</a></li>
<li><a href="#stdblocks">Standard Blocks</a></li>
</ol>
</li>
<li><a href="#llvmir">LLVM IR Encoding</a>
<ol>
<li><a href="#basics">Basics</a></li>
</ol>
</li>
</ol>
<div class="doc_author">
<p>Written by <a href="mailto:rspencer@x10sys.com">Reid Spencer</a> and
<a href="mailto:sabre@nondot.org">Chris Lattner</a>.
<p>Written by <a href="mailto:sabre@nondot.org">Chris Lattner</a>
and <a href="http://www.reverberate.org">Joshua Haberman</a>.
</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"> <a name="abstract">Abstract </a></div>
<div class="doc_section"> <a name="abstract">Abstract</a></div>
<!-- *********************************************************************** -->
<div class="doc_text">
<p>This document describes the LLVM bitcode file format. It specifies
the binary encoding rules of the bitcode file format so that
equivalent systems can encode bitcode files correctly. The LLVM
bitcode representation is used to store the intermediate
representation on disk in a compacted form.</p>
<p>This document supercedes the LLVM bytecode file format for the 2.0
release.</p>
<p>This document describes the LLVM bitstream file format and the encoding of
the LLVM IR into it.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"> <a name="concepts">Concepts</a> </div>
<div class="doc_section"> <a name="overview">Overview</a></div>
<!-- *********************************************************************** -->
<div class="doc_text">
<p>This section describes the general concepts of the bitcode file
format without getting into specific layout details. It is recommended
that you read this section thoroughly before interpreting the detailed
descriptions.</p>
<p>
What is commonly known as the LLVM bitcode file format (also, sometimes
anachronistically known as bytecode) is actually two things: a <a
href="#bitstream">bitstream container format</a>
and an <a href="#llvmir">encoding of LLVM IR</a> into the container format.</p>
<p>
The bitstream format is an abstract encoding of structured data, very
similar to XML in some ways. Like XML, bitstream files contain tags, and nested
structures, and you can parse the file without having to understand the tags.
Unlike XML, the bitstream format is a binary encoding, and unlike XML it
provides a mechanism for the file to self-describe "abbreviations", which are
effectively size optimizations for the content.</p>
<p>This document first describes the LLVM bitstream format, then describes the
record structure used by LLVM IR files.
</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"> <a name="bitstream">Bitstream Format</a></div>
<!-- *********************************************************************** -->
<div class="doc_text">
<p>
The bitstream format is literally a stream of bits, with a very simple
structure. This structure consists of the following concepts:
</p>
<ul>
<li>A "<a href="#magic">magic number</a>" that identifies the contents of
the stream.</li>
<li>Encoding <a href="#primitives">primitives</a> like variable bit-rate
integers.</li>
<li><a href="#blocks">Blocks</a>, which define nested content.</li>
<li><a href="#datarecord">Data Records</a>, which describe entities within the
file.</li>
<li>Abbreviations, which specify compression optimizations for the file.</li>
</ul>
<p>Note that the <a
href="CommandGuide/html/llvm-bcanalyzer.html">llvm-bcanalyzer</a> tool can be
used to dump and inspect arbitrary bitstreams, which is very useful for
understanding the encoding.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="magic">Magic Numbers</a>
</div>
<div class="doc_text">
<p>The first two bytes of a bitcode file are 'BC' (0x42, 0x43).
The second two bytes are an application-specific magic number. Generic
bitcode tools can look at only the first two bytes to verify the file is
bitcode, while application-specific programs will want to look at all four.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="primitives">Primitives</a>
</div>
<div class="doc_text">
<p>
A bitstream literally consists of a stream of bits, which are read in order
starting with the least significant bit of each byte. The stream is made up of a
number of primitive values that encode a stream of unsigned integer values.
These
integers are are encoded in two ways: either as <a href="#fixedwidth">Fixed
Width Integers</a> or as <a href="#variablewidth">Variable Width
Integers</a>.
</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"> <a name="fixedwidth">Fixed Width Integers</a>
</div>
<div class="doc_text">
<p>Fixed-width integer values have their low bits emitted directly to the file.
For example, a 3-bit integer value encodes 1 as 001. Fixed width integers
are used when there are a well-known number of options for a field. For
example, boolean values are usually encoded with a 1-bit wide integer.
</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"> <a name="variablewidth">Variable Width
Integers</a></div>
<div class="doc_text">
<p>Variable-width integer (VBR) values encode values of arbitrary size,
optimizing for the case where the values are small. Given a 4-bit VBR field,
any 3-bit value (0 through 7) is encoded directly, with the high bit set to
zero. Values larger than N-1 bits emit their bits in a series of N-1 bit
chunks, where all but the last set the high bit.</p>
<p>For example, the value 27 (0x1B) is encoded as 1011 0011 when emitted as a
vbr4 value. The first set of four bits indicates the value 3 (011) with a
continuation piece (indicated by a high bit of 1). The next word indicates a
value of 24 (011 << 3) with no continuation. The sum (3+24) yields the value
27.
</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"> <a name="char6">6-bit characters</a></div>
<div class="doc_text">
<p>6-bit characters encode common characters into a fixed 6-bit field. They
represent the following characters with the following 6-bit values:</p>
<ul>
<li>'a' .. 'z' - 0 .. 25</li>
<li>'A' .. 'Z' - 26 .. 51</li>
<li>'0' .. '9' - 52 .. 61</li>
<li>'.' - 62</li>
<li>'_' - 63</li>
</ul>
<p>This encoding is only suitable for encoding characters and strings that
consist only of the above characters. It is completely incapable of encoding
characters not in the set.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"> <a name="wordalign">Word Alignment</a></div>
<div class="doc_text">
<p>Occasionally, it is useful to emit zero bits until the bitstream is a
multiple of 32 bits. This ensures that the bit position in the stream can be
represented as a multiple of 32-bit words.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="abbrevid">Abbreviation IDs</a>
</div>
<div class="doc_text">
<p>
A bitstream is a sequential series of <a href="#blocks">Blocks</a> and
<a href="#datarecord">Data Records</a>. Both of these start with an
abbreviation ID encoded as a fixed-bitwidth field. The width is specified by
the current block, as described below. The value of the abbreviation ID
specifies either a builtin ID (which have special meanings, defined below) or
one of the abbreviation IDs defined by the stream itself.
</p>
<p>
The set of builtin abbrev IDs is:
</p>
<ul>
<li>0 - <a href="#END_BLOCK">END_BLOCK</a> - This abbrev ID marks the end of the
current block.</li>
<li>1 - <a href="#ENTER_SUBBLOCK">ENTER_SUBBLOCK</a> - This abbrev ID marks the
beginning of a new block.</li>
<li>2 - <a href="#DEFINE_ABBREV">DEFINE_ABBREV</a> - This defines a new
abbreviation.</li>
<li>3 - <a href="#UNABBREV_RECORD">UNABBREV_RECORD</a> - This ID specifies the
definition of an unabbreviated record.</li>
</ul>
<p>Abbreviation IDs 4 and above are defined by the stream itself, and specify
an <a href="#abbrev_records">abbreviated record encoding</a>.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="blocks">Blocks</a>
</div>
<div class="doc_text">
<p>
Blocks in a bitstream denote nested regions of the stream, and are identified by
a content-specific id number (for example, LLVM IR uses an ID of 12 to represent
function bodies). Block IDs 0-7 are reserved for <a href="#stdblocks">standard blocks</a>
whose meaning is defined by Bitcode; block IDs 8 and greater are
application specific. Nested blocks capture the hierachical structure of the data
encoded in it, and various properties are associated with blocks as the file is
parsed. Block definitions allow the reader to efficiently skip blocks
in constant time if the reader wants a summary of blocks, or if it wants to
efficiently skip data they do not understand. The LLVM IR reader uses this
mechanism to skip function bodies, lazily reading them on demand.
</p>
<p>
When reading and encoding the stream, several properties are maintained for the
block. In particular, each block maintains:
</p>
<ol>
<li>A current abbrev id width. This value starts at 2, and is set every time a
block record is entered. The block entry specifies the abbrev id width for
the body of the block.</li>
<li>A set of abbreviations. Abbreviations may be defined within a block, in
which case they are only defined in that block (neither subblocks nor
enclosing blocks see the abbreviation). Abbreviations can also be defined
inside a <a href="#BLOCKINFO">BLOCKINFO</a> block, in which case they are
defined in all blocks that match the ID that the BLOCKINFO block is describing.
</li>
</ol>
<p>As sub blocks are entered, these properties are saved and the new sub-block
has its own set of abbreviations, and its own abbrev id width. When a sub-block
is popped, the saved values are restored.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"> <a name="ENTER_SUBBLOCK">ENTER_SUBBLOCK
Encoding</a></div>
<div class="doc_text">
<p><tt>[ENTER_SUBBLOCK, blockid<sub>vbr8</sub>, newabbrevlen<sub>vbr4</sub>,
&lt;align32bits&gt;, blocklen<sub>32</sub>]</tt></p>
<p>
The ENTER_SUBBLOCK abbreviation ID specifies the start of a new block record.
The <tt>blockid</tt> value is encoded as a 8-bit VBR identifier, and indicates
the type of block being entered (which can be a <a href="#stdblocks">standard
block</a> or an application-specific block). The
<tt>newabbrevlen</tt> value is a 4-bit VBR which specifies the
abbrev id width for the sub-block. The <tt>blocklen</tt> is a 32-bit aligned
value that specifies the size of the subblock, in 32-bit words. This value
allows the reader to skip over the entire block in one jump.
</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"> <a name="END_BLOCK">END_BLOCK
Encoding</a></div>
<div class="doc_text">
<p><tt>[END_BLOCK, &lt;align32bits&gt;]</tt></p>
<p>
The END_BLOCK abbreviation ID specifies the end of the current block record.
Its end is aligned to 32-bits to ensure that the size of the block is an even
multiple of 32-bits.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="datarecord">Data Records</a>
</div>
<div class="doc_text">
<p>
Data records consist of a record code and a number of (up to) 64-bit integer
values. The interpretation of the code and values is application specific and
there are multiple different ways to encode a record (with an unabbrev record
or with an abbreviation). In the LLVM IR format, for example, there is a record
which encodes the target triple of a module. The code is MODULE_CODE_TRIPLE,
and the values of the record are the ascii codes for the characters in the
string.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"> <a name="UNABBREV_RECORD">UNABBREV_RECORD
Encoding</a></div>
<div class="doc_text">
<p><tt>[UNABBREV_RECORD, code<sub>vbr6</sub>, numops<sub>vbr6</sub>,
op0<sub>vbr6</sub>, op1<sub>vbr6</sub>, ...]</tt></p>
<p>An UNABBREV_RECORD provides a default fallback encoding, which is both
completely general and also extremely inefficient. It can describe an arbitrary
record, by emitting the code and operands as vbrs.</p>
<p>For example, emitting an LLVM IR target triple as an unabbreviated record
requires emitting the UNABBREV_RECORD abbrevid, a vbr6 for the
MODULE_CODE_TRIPLE code, a vbr6 for the length of the string (which is equal to
the number of operands), and a vbr6 for each character. Since there are no
letters with value less than 32, each letter would need to be emitted as at
least a two-part VBR, which means that each letter would require at least 12
bits. This is not an efficient encoding, but it is fully general.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"> <a name="abbrev_records">Abbreviated Record
Encoding</a></div>
<div class="doc_text">
<p><tt>[&lt;abbrevid&gt;, fields...]</tt></p>
<p>An abbreviated record is a abbreviation id followed by a set of fields that
are encoded according to the <a href="#abbreviations">abbreviation
definition</a>. This allows records to be encoded significantly more densely
than records encoded with the <a href="#UNABBREV_RECORD">UNABBREV_RECORD</a>
type, and allows the abbreviation types to be specified in the stream itself,
which allows the files to be completely self describing. The actual encoding
of abbreviations is defined below.
</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="abbreviations">Abbreviations</a>
</div>
<div class="doc_text">
<p>
Abbreviations are an important form of compression for bitstreams. The idea is
to specify a dense encoding for a class of records once, then use that encoding
to emit many records. It takes space to emit the encoding into the file, but
the space is recouped (hopefully plus some) when the records that use it are
emitted.
</p>
<p>
Abbreviations can be determined dynamically per client, per file. Since the
abbreviations are stored in the bitstream itself, different streams of the same
format can contain different sets of abbreviations if the specific stream does
not need it. As a concrete example, LLVM IR files usually emit an abbreviation
for binary operators. If a specific LLVM module contained no or few binary
operators, the abbreviation does not need to be emitted.
</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"><a name="DEFINE_ABBREV">DEFINE_ABBREV
Encoding</a></div>
<div class="doc_text">
<p><tt>[DEFINE_ABBREV, numabbrevops<sub>vbr5</sub>, abbrevop0, abbrevop1,
...]</tt></p>
<p>A DEFINE_ABBREV record adds an abbreviation to the list of currently
defined abbreviations in the scope of this block. This definition only
exists inside this immediate block -- it is not visible in subblocks or
enclosing blocks.
Abbreviations are implicitly assigned IDs
sequentially starting from 4 (the first application-defined abbreviation ID).
Any abbreviations defined in a BLOCKINFO record receive IDs first, in order,
followed by any abbreviations defined within the block itself.
Abbreviated data records reference this ID to indicate what abbreviation
they are invoking.</p>
<p>An abbreviation definition consists of the DEFINE_ABBREV abbrevid followed
by a VBR that specifies the number of abbrev operands, then the abbrev
operands themselves. Abbreviation operands come in three forms. They all start
with a single bit that indicates whether the abbrev operand is a literal operand
(when the bit is 1) or an encoding operand (when the bit is 0).</p>
<ol>
<li>Literal operands - <tt>[1<sub>1</sub>, litvalue<sub>vbr8</sub>]</tt> -
Literal operands specify that the value in the result
is always a single specific value. This specific value is emitted as a vbr8
after the bit indicating that it is a literal operand.</li>
<li>Encoding info without data - <tt>[0<sub>1</sub>, encoding<sub>3</sub>]</tt>
- Operand encodings that do not have extra data are just emitted as their code.
</li>
<li>Encoding info with data - <tt>[0<sub>1</sub>, encoding<sub>3</sub>,
value<sub>vbr5</sub>]</tt> - Operand encodings that do have extra data are
emitted as their code, followed by the extra data.
</li>
</ol>
<p>The possible operand encodings are:</p>
<ul>
<li>1 - Fixed - The field should be emitted as a <a
href="#fixedwidth">fixed-width value</a>, whose width
is specified by the operand's extra data.</li>
<li>2 - VBR - The field should be emitted as a <a
href="#variablewidth">variable-width value</a>, whose width
is specified by the operand's extra data.</li>
<li>3 - Array - This field is an array of values. The array operand has no
extra data, but expects another operand to follow it which indicates the
element type of the array. When reading an array in an abbreviated record,
the first integer is a vbr6 that indicates the array length, followed by
the encoded elements of the array. An array may only occur as the last
operand of an abbreviation (except for the one final operand that gives
the array's type).</li>
<li>4 - Char6 - This field should be emitted as a <a href="#char6">char6-encoded
value</a>. This operand type takes no extra data.</li>
</ul>
<p>For example, target triples in LLVM modules are encoded as a record of the
form <tt>[TRIPLE, 'a', 'b', 'c', 'd']</tt>. Consider if the bitstream emitted
the following abbrev entry:</p>
<ul>
<li><tt>[0, Fixed, 4]</tt></li>
<li><tt>[0, Array]</tt></li>
<li><tt>[0, Char6]</tt></li>
</ul>
<p>When emitting a record with this abbreviation, the above entry would be
emitted as:</p>
<p><tt>[4<sub>abbrevwidth</sub>, 2<sub>4</sub>, 4<sub>vbr6</sub>,
0<sub>6</sub>, 1<sub>6</sub>, 2<sub>6</sub>, 3<sub>6</sub>]</tt></p>
<p>These values are:</p>
<ol>
<li>The first value, 4, is the abbreviation ID for this abbreviation.</li>
<li>The second value, 2, is the code for TRIPLE in LLVM IR files.</li>
<li>The third value, 4, is the length of the array.</li>
<li>The rest of the values are the char6 encoded values for "abcd".</li>
</ol>
<p>With this abbreviation, the triple is emitted with only 37 bits (assuming a
abbrev id width of 3). Without the abbreviation, significantly more space would
be required to emit the target triple. Also, since the TRIPLE value is not
emitted as a literal in the abbreviation, the abbreviation can also be used for
any other string value.
</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="stdblocks">Standard Blocks</a>
</div>
<div class="doc_text">
<p>
In addition to the basic block structure and record encodings, the bitstream
also defines specific builtin block types. These block types specify how the
stream is to be decoded or other metadata. In the future, new standard blocks
may be added. Block IDs 0-7 are reserved for standard blocks.
</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"><a name="BLOCKINFO">#0 - BLOCKINFO
Block</a></div>
<div class="doc_text">
<p>The BLOCKINFO block allows the description of metadata for other blocks. The
currently specified records are:</p>
<ul>
<li><tt>[SETBID (#1), blockid]</tt></li>
<li><tt>[DEFINE_ABBREV, ...]</tt></li>
</ul>
<p>
The SETBID record indicates which block ID is being described. SETBID
records can occur multiple times throughout the block to change which
block ID is being described. There must be a SETBID record prior to
any other records.
</p>
<p>
Standard DEFINE_ABBREV records can occur inside BLOCKINFO blocks, but unlike
their occurrence in normal blocks, the abbreviation is defined for blocks
matching the block ID we are describing, <i>not</i> the BLOCKINFO block itself.
The abbreviations defined in BLOCKINFO blocks receive abbreviation ids
as described in <a href="#DEFINE_ABBREV">DEFINE_ABBREV</a>.
</p>
<p>
Note that although the data in BLOCKINFO blocks is described as "metadata," the
abbreviations they contain are essential for parsing records from the
corresponding blocks. It is not safe to skip them.
</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"> <a name="llvmir">LLVM IR Encoding</a></div>
<!-- *********************************************************************** -->
<div class="doc_text">
<p>LLVM IR is encoded into a bitstream by defining blocks and records. It uses
blocks for things like constant pools, functions, symbol tables, etc. It uses
records for things like instructions, global variable descriptors, type
descriptions, etc. This document does not describe the set of abbreviations
that the writer uses, as these are fully self-described in the file, and the
reader is not allowed to build in any knowledge of this.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="basics">Basics</a>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"><a name="ir_magic">LLVM IR Magic Number</a></div>
<div class="doc_text">
<p>
The magic number for LLVM IR files is:
</p>
<p><tt>[0x0<sub>4</sub>, 0xC<sub>4</sub>, 0xE<sub>4</sub>, 0xD<sub>4</sub>]</tt></p>
<p>When combined with the bitcode magic number and viewed as bytes, this is "BC 0xC0DE".</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"><a name="ir_signed_vbr">Signed VBRs</a></div>
<div class="doc_text">
<p>
<a href="#variablewidth">Variable Width Integers</a> are an efficient way to
encode arbitrary sized unsigned values, but is an extremely inefficient way to
encode signed values (as signed values are otherwise treated as maximally large
unsigned values).</p>
<p>As such, signed vbr values of a specific width are emitted as follows:</p>
<ul>
<li>Positive values are emitted as vbrs of the specified width, but with their
value shifted left by one.</li>
<li>Negative values are emitted as vbrs of the specified width, but the negated
value is shifted left by one, and the low bit is set.</li>
</ul>
<p>With this encoding, small positive and small negative values can both be
emitted efficiently.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection"><a name="ir_blocks">LLVM IR Blocks</a></div>
<div class="doc_text">
<p>
LLVM IR is defined with the following blocks:
</p>
<ul>
<li>8 - MODULE_BLOCK - This is the top-level block that contains the
entire module, and describes a variety of per-module information.</li>
<li>9 - PARAMATTR_BLOCK - This enumerates the parameter attributes.</li>
<li>10 - TYPE_BLOCK - This describes all of the types in the module.</li>
<li>11 - CONSTANTS_BLOCK - This describes constants for a module or
function.</li>
<li>12 - FUNCTION_BLOCK - This describes a function body.</li>
<li>13 - TYPE_SYMTAB_BLOCK - This describes the type symbol table.</li>
<li>14 - VALUE_SYMTAB_BLOCK - This describes a value symbol table.</li>
</ul>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="MODULE_BLOCK">MODULE_BLOCK Contents</a>
</div>
<div class="doc_text">
<p>
</p>
</div>
<!-- *********************************************************************** -->
<hr>
<address> <a href="http://jigsaw.w3.org/css-validator/check/referer"><img
src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a>
<a href="http://validator.w3.org/check/referer"><img
src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a>
<a href="mailto:rspencer@x10sys.com">Reid Spencer</a> and <a
href="mailto:sabre@nondot.org">Chris Lattner</a><br>
<a href="mailto:sabre@nondot.org">Chris Lattner</a><br>
<a href="http://llvm.org">The LLVM Compiler Infrastructure</a><br>
Last modified: $Date$
</address>

View File

@@ -123,7 +123,7 @@ functions has been reduced, it attempts to delete various edges in the control
flow graph, to reduce the size of the function as much as possible. Finally,
<tt>bugpoint</tt> deletes any individual LLVM instructions whose absence does
not eliminate the failure. At the end, <tt>bugpoint</tt> should tell you what
passes crash, give you a bytecode file, and give you instructions on how to
passes crash, give you a bitcode file, and give you instructions on how to
reproduce the failure with <tt>opt</tt> or <tt>llc</tt>.</p>
</div>
@@ -141,7 +141,7 @@ test program and partitions it into two pieces: one piece which it compiles
with the C backend (into a shared object), and one piece which it runs with
either the JIT or the static LLC compiler. It uses several techniques to
reduce the amount of code pushed through the LLVM code generator, to reduce the
potential scope of the problem. After it is finished, it emits two bytecode
potential scope of the problem. After it is finished, it emits two bitcode
files (called "test" [to be compiled with the code generator] and "safe" [to be
compiled with the C backend], respectively), and instructions for reproducing
the problem. The code generator debugger assumes that the C backend produces

View File

@@ -45,7 +45,7 @@ the past.</p>
<div class="doc_code">
<pre>
svn co svn://anonsvn.opensource.apple.com/svn/llvm/trunk <i>dst-directory</i>
svn co http://llvm.org/svn/llvm-project/llvm-gcc-4.0/trunk <i>dst-directory</i>
</pre>
</div>

View File

@@ -719,8 +719,7 @@ comes from.</p>
corresponds one-to-one with the LLVM function input to the instruction selector.
In addition to a list of basic blocks, the <tt>MachineFunction</tt> contains a
a <tt>MachineConstantPool</tt>, a <tt>MachineFrameInfo</tt>, a
<tt>MachineFunctionInfo</tt>, a <tt>SSARegMap</tt>, and a set of live in and
live out registers for the function. See
<tt>MachineFunctionInfo</tt>, and a <tt>MachineRegisterInfo</tt>. See
<tt>include/llvm/CodeGen/MachineFunction.h</tt> for more information.</p>
</div>
@@ -748,16 +747,14 @@ explains how they work and some of the rationale behind their design.</p>
<p>
Instruction Selection is the process of translating LLVM code presented to the
code generator into target-specific machine instructions. There are several
well-known ways to do this in the literature. In LLVM there are two main forms:
the SelectionDAG based instruction selector framework and an old-style 'simple'
instruction selector, which effectively peephole selects each LLVM instruction
into a series of machine instructions. We recommend that all targets use the
SelectionDAG infrastructure.
well-known ways to do this in the literature. LLVM uses a SelectionDAG based
instruction selector.
</p>
<p>Portions of the DAG instruction selector are generated from the target
description (<tt>*.td</tt>) files. Our goal is for the entire instruction
selector to be generated from these <tt>.td</tt> files.</p>
selector to be generated from these <tt>.td</tt> files, though currently
there are still things that require custom C++ code.</p>
</div>
<!-- _______________________________________________________________________ -->
@@ -865,7 +862,11 @@ of the code compiled (if you only get errors printed to the console while using
this, you probably <a href="ProgrammersManual.html#ViewGraph">need to configure
your system</a> to add support for it). The <tt>-view-sched-dags</tt> option
views the SelectionDAG output from the Select phase and input to the Scheduler
phase.</p>
phase. The <tt>-view-sunit-dags</tt> option views the ScheduleDAG, which is
based on the final SelectionDAG, with nodes that must be scheduled as a unit
bundled together into a single node, and with immediate operands and other
nodes that aren't relevent for scheduling omitted.
</p>
</div>
@@ -1111,7 +1112,8 @@ primarily because it is a work in progress and is not yet finished:</p>
<li>There is no great way to support matching complex addressing modes yet. In
the future, we will extend pattern fragments to allow them to define
multiple values (e.g. the four operands of the <a href="#x86_memory">X86
addressing mode</a>). In addition, we'll extend fragments so that a
addressing mode</a>, which are currently matched with custom C++ code).
In addition, we'll extend fragments so that a
fragment can match multiple different patterns.</li>
<li>We don't automatically infer flags like isStore/isLoad yet.</li>
<li>We don't automatically generate the set of supported registers and
@@ -1310,8 +1312,8 @@ bool RegMapping_Fer::compatible_class(MachineFunction &amp;mf,
unsigned p_reg) {
assert(MRegisterInfo::isPhysicalRegister(p_reg) &amp;&amp;
"Target register must be physical");
const TargetRegisterClass *trc = mf.getSSARegMap()->getRegClass(v_reg);
return trc->contains(p_reg);
const TargetRegisterClass *trc = mf.getRegInfo().getRegClass(v_reg);
return trc-&gt;contains(p_reg);
}
</pre>
</div>
@@ -1340,7 +1342,7 @@ register. Whereas physical registers are statically defined in a
<tt>TargetRegisterInfo.td</tt> file and cannot be created by the
application developer, that is not the case with virtual registers.
In order to create new virtual registers, use the method
<tt>SSARegMap::createVirtualRegister()</tt>. This method will return a
<tt>MachineRegisterInfo::createVirtualRegister()</tt>. This method will return a
virtual register with the highest code.
</p>
@@ -1357,7 +1359,7 @@ if that register is being used by the instruction. The method
<tt>MachineOperand::isDef()</tt> informs if that registers is being
defined.</p>
<p>We will call physical registers present in the LLVM bytecode before
<p>We will call physical registers present in the LLVM bitcode before
register allocation <i>pre-colored registers</i>. Pre-colored
registers are used in many different situations, for instance, to pass
parameters of functions calls, and to store results of particular
@@ -1628,11 +1630,9 @@ are specific to the code generator for a particular target.</p>
<div class="doc_text">
<p>The X86 code generator lives in the <tt>lib/Target/X86</tt> directory. This
code generator currently targets a generic P6-like processor. As such, it
produces a few P6-and-above instructions (like conditional moves), but it does
not make use of newer features like MMX or SSE. In the future, the X86 backend
will have sub-target support added for specific processor families and
implementations.</p>
code generator is capable of targeting a variety of x86-32 and x86-64
processors, and includes support for ISA extensions such as MMX and SSE.
</p>
</div>

View File

@@ -122,9 +122,9 @@ documentation is very useful:</p>
<b>File Headers</b>
<p>Every source file should have a header on it that
describes the basic purpose of the file. If a file does not have a header, it
should not be checked into CVS. Most source trees will probably have a standard
<p>Every source file should have a header on it that describes the basic
purpose of the file. If a file does not have a header, it should not be
checked into Subversion. Most source trees will probably have a standard
file header format. The standard format for the LLVM source tree looks like
this:</p>
@@ -134,8 +134,8 @@ this:</p>
//
// The LLVM Compiler Infrastructure
//
// This file was developed by &lt;whoever started the file&gt; and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
@@ -146,9 +146,7 @@ this:</p>
</pre>
</div>
<p>A few things to note about this particular format: The 'developed by' line
should be the name of the person or organization who initially contributed the
file. The "<tt>-*- C++
<p>A few things to note about this particular format: The "<tt>-*- C++
-*-</tt>" string on the first line is there to tell Emacs that the source file
is a C++ file, not a C file (Emacs assumes .h files are C files by default).
Note that this tag is not necessary in .cpp files. The name of the file is also
@@ -156,9 +154,9 @@ on the first line, along with a very short description of the purpose of the
file. This is important when printing out code and flipping though lots of
pages.</p>
<p>The next section in the file is a concise note that defines the license that
the file is released under. This makes it perfectly clear what terms the source
code can be distributed under.</p>
<p>The next section in the file is a concise note that defines the license
that the file is released under. This makes it perfectly clear what terms the
source code can be distributed under and should not be modified in any way.</p>
<p>The main body of the description does not have to be very long in most cases.
Here it's only two lines. If an algorithm is being implemented or something
@@ -505,14 +503,15 @@ library. There are two problems with this:</p>
<ol>
<li>The time to run the static c'tors impacts startup time of
applications&mdash;a critical time for gui apps.</li>
applications&mdash;a critical time for GUI apps.</li>
<li>The static c'tors cause the app to pull many extra pages of memory off the
disk: both the code for the static c'tors in each .o file and the small
amount of data that gets touched. In addition, touched/dirty pages put
more pressure on the VM system on low-memory machines.</li>
disk: both the code for the static c'tors in each <tt>.o</tt> file and the
small amount of data that gets touched. In addition, touched/dirty pages
put more pressure on the VM system on low-memory machines.</li>
</ol>
<table align="center">
<div align="center">
<table>
<tbody>
<tr>
<th>Old Way</th>
@@ -526,7 +525,7 @@ library. There are two problems with this:</p>
<td align="left"><pre>DEBUG(std::cerr &lt;&lt; ...);
DEBUG(dump(std::cerr));</pre></td>
<td align="left"><pre>DOUT &lt;&lt; ...;
dump(DOUT);</pre></td>
DEBUG(dump(DOUT));</pre></td>
</tr>
<tr>
<td align="left"><pre>std::cerr &lt;&lt; "Hello world\n";</pre></td>
@@ -553,19 +552,21 @@ dump(DOUT);</pre></td>
<td align="left"><pre>llvm::StringStream</pre></td>
</tr>
<tr>
<td align="left"><pre>void print(std::ostream &Out);
<td align="left"><pre>void print(std::ostream &amp;Out);
// ...
print(std::cerr);</pre></td>
<td align="left"><pre>void print(std::ostream &Out);
void print(std::ostream *Out) { if (Out) print(*Out) }
<td align="left"><pre>void print(llvm::OStream Out);<sup>1</sup>
// ...
print(llvm::cerr);</pre>
<ul><i>N.B.</i> The second <tt>print</tt> method is called by the <tt>print</tt>
expression. It prevents the execution of the first <tt>print</tt> method if the
stream is <tt>cnull</tt>.</ul></td>
</tbody>
</table>
</td> </tbody> </table>
</div>
<div class="doc_text">
<p><sup>1</sup><tt>llvm::OStream</tt> is a light-weight class so it should never
be passed by reference. This is important because in some configurations,
<tt>DOUT</tt> is an rvalue.</p>
</div>
</div>
@@ -734,15 +735,12 @@ sources. Two particularly important books for our work are:</p>
<ol>
<li><a href="http://www.aw-bc.com/catalog/academic/product/0,1144,0201310155,00.html">Effective
C++</a> by Scott Meyers. There is an online version of the book (only some
chapters though) <a
href="http://www.awlonline.com/cseng/meyerscddemo/">available as well</a>. Also
<li><a href="http://www.amazon.com/Effective-Specific-Addison-Wesley-Professional-Computing/dp/0321334876">Effective
C++</a> by Scott Meyers. Also
interesting and useful are "More Effective C++" and "Effective STL" by the same
author.</li>
<li><a href="http://cseng.aw.com/book/0,3828,0201633620,00.html">Large-Scale C++
Software Design</a> by John Lakos</li>
<li>Large-Scale C++ Software Design by John Lakos</li>
</ol>

View File

@@ -1,4 +0,0 @@
pod2htm?.tmp
*.html
*.1
*.ps

View File

@@ -2,8 +2,8 @@
#
# The LLVM Compiler Infrastructure
#
# This file was developed by the LLVM research group and is distributed under
# the University of Illinois Open Source License. See LICENSE.TXT for details.
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
##===----------------------------------------------------------------------===##

View File

@@ -64,6 +64,12 @@ program. By default, B<bugpoint> uses these passes internally when attempting to
reduce test programs. If you're trying to find a bug in one of these passes,
B<bugpoint> may crash.
=item B<--enable-valgrind>
Use valgrind to find faults in the optimization phase. This will allow
bugpoint to find otherwise asymptomatic problems caused by memory
mis-management.
=item B<-find-bugs>
Continually randomize the specified passes and run them on the test program
@@ -87,6 +93,11 @@ optimizations, use the B<--help> and B<--load> options together; for example:
bugpoint --load myNewPass.so --help
=item B<--mlimit> F<megabytes>
Specifies an upper limit on memory usage of the optimization and codegen. Set
to zero to disable the limit.
=item B<--output> F<filename>
Whenever the test program produces output on its standard output stream, it
@@ -105,12 +116,6 @@ using the specified code generator. These options allow you to choose the
interpreter, the JIT compiler, the static native code compiler, or the C
backend, respectively.
=item B<--enable-valgrind>
Use valgrind to find faults in the optimization phase. This will allow
bugpoint to find otherwise asymptomatic problems caused by memory
mis-management.
=back
=head1 EXIT STATUS

View File

@@ -1,2 +0,0 @@
*html
.dir

View File

@@ -3,7 +3,7 @@
<html>
<head>
<title>LLVM Command Guide</title>
<link rel="stylesheet" href="../llvm.css" type="text/css">
<link rel="stylesheet" href="/docs/llvm.css" type="text/css">
</head>
<body>
@@ -32,50 +32,50 @@ options) arguments to the tool you are interested in.</p>
<ul>
<li><a href="html/llvm-as.html"><b>llvm-as</b></a> -
<li><a href="/cmds/llvm-as.html"><b>llvm-as</b></a> -
assemble a human-readable .ll file into bytecode</li>
<li><a href="html/llvm-dis.html"><b>llvm-dis</b></a> -
<li><a href="/cmds/llvm-dis.html"><b>llvm-dis</b></a> -
disassemble a bytecode file into a human-readable .ll file</li>
<li><a href="html/llvm-upgrade.html"><b>llvm-upgrade</b></a> -
<li><a href="/cmds/llvm-upgrade.html"><b>llvm-upgrade</b></a> -
upgrade LLVM assembly from previous version</li>
<li><a href="html/opt.html"><b>opt</b></a> -
<li><a href="/cmds/opt.html"><b>opt</b></a> -
run a series of LLVM-to-LLVM optimizations on a bytecode file</li>
<li><a href="html/llc.html"><b>llc</b></a> -
<li><a href="/cmds/llc.html"><b>llc</b></a> -
generate native machine code for a bytecode file</li>
<li><a href="html/lli.html"><b>lli</b></a> -
<li><a href="/cmds/lli.html"><b>lli</b></a> -
directly run a program compiled to bytecode using a JIT compiler or
interpreter</li>
<li><a href="html/llvm-link.html"><b>llvm-link</b></a> -
<li><a href="/cmds/llvm-link.html"><b>llvm-link</b></a> -
link several bytecode files into one</li>
<li><a href="html/llvm-ar.html"><b>llvm-ar</b></a> -
<li><a href="/cmds/llvm-ar.html"><b>llvm-ar</b></a> -
archive bytecode files</li>
<li><a href="html/llvm-ranlib.html"><b>llvm-ranlib</b></a> -
<li><a href="/cmds/llvm-ranlib.html"><b>llvm-ranlib</b></a> -
create an index for archives made with llvm-ar</li>
<li><a href="html/llvm-nm.html"><b>llvm-nm</b></a> -
<li><a href="/cmds/llvm-nm.html"><b>llvm-nm</b></a> -
print out the names and types of symbols in a bytecode file</li>
<li><a href="html/llvm-prof.html"><b>llvm-prof</b></a> -
<li><a href="/cmds/llvm-prof.html"><b>llvm-prof</b></a> -
format raw `<tt>llvmprof.out</tt>' data into a human-readable report</li>
<li><a href="html/llvmc.html"><b>llvmc</b></a> -
<li><a href="/cmds/llvmc.html"><b>llvmc</b></a> -
generic and configurable compiler driver</li>
<li><a href="html/llvm-ld.html"><b>llvm-ld</b></a> -
<li><a href="/cmds/llvm-ld.html"><b>llvm-ld</b></a> -
general purpose linker with loadable runtime optimization support</li>
<li><a href="html/llvm-config.html"><b>llvm-config</b></a> -
<li><a href="/cmds/llvm-config.html"><b>llvm-config</b></a> -
print out LLVM compilation options, libraries, etc. as configured.</li>
<li><a href="html/llvm2cpp.html"><b>llvm2cpp</b></a> - convert LLVM assembly
<li><a href="/cmds/llvm2cpp.html"><b>llvm2cpp</b></a> - convert LLVM assembly
into the corresponding LLVM C++ API calls to produce it</li>
</ul>
@@ -90,13 +90,13 @@ options) arguments to the tool you are interested in.</p>
<div class="doc_text">
<ul>
<li><a href="html/llvmgcc.html"><b>llvmgcc</b></a> -
<li><a href="/cmds/llvmgcc.html"><b>llvmgcc</b></a> -
GCC-based C front-end for LLVM
<li><a href="html/llvmgxx.html"><b>llvmg++</b></a> -
<li><a href="/cmds/llvmgxx.html"><b>llvmg++</b></a> -
GCC-based C++ front-end for LLVM</li>
<li><a href="html/stkrc.html"><b>stkrc</b></a> -
<li><a href="/cmds/stkrc.html"><b>stkrc</b></a> -
front-end compiler for the <a href="../Stacker.html">Stacker</a>
language</li>
@@ -115,13 +115,13 @@ options) arguments to the tool you are interested in.</p>
<ul>
<li><a href="html/bugpoint.html"><b>bugpoint</b></a> -
<li><a href="/cmds/bugpoint.html"><b>bugpoint</b></a> -
automatic test-case reducer</li>
<li><a href="html/llvm-extract.html"><b>llvm-extract</b></a> -
<li><a href="/cmds/llvm-extract.html"><b>llvm-extract</b></a> -
extract a function from an LLVM bytecode file</li>
<li><a href="html/llvm-bcanalyzer.html"><b>llvm-bcanalyzer</b></a> -
<li><a href="/cmds/llvm-bcanalyzer.html"><b>llvm-bcanalyzer</b></a> -
bytecode analyzer (analyzes the binary encoding itself, not the program it
represents)</li>
@@ -137,7 +137,7 @@ options) arguments to the tool you are interested in.</p>
<div class="doc_text">
<ul>
<li><a href="html/tblgen.html"><b>tblgen</b></a> -
<li><a href="/cmds/tblgen.html"><b>tblgen</b></a> -
target description reader and generator</li>
</ul>

View File

@@ -10,18 +10,18 @@ B<llc> [I<options>] [I<filename>]
=head1 DESCRIPTION
The B<llc> command compiles LLVM bytecode into assembly language for a
The B<llc> command compiles LLVM bitcode into assembly language for a
specified architecture. The assembly language output can then be passed through
a native assembler and linker to generate a native executable.
The choice of architecture for the output assembly code is automatically
determined from the input bytecode file, unless the B<-march> option is used to
determined from the input bitcode file, unless the B<-march> option is used to
override the default.
=head1 OPTIONS
If I<filename> is - or omitted, B<llc> reads LLVM bytecode from standard input.
Otherwise, it will read LLVM bytecode from I<filename>.
If I<filename> is - or omitted, B<llc> reads LLVM bitcode from standard input.
Otherwise, it will read LLVM bitcode from I<filename>.
If the B<-o> option is omitted, then B<llc> will send its output to standard
output if the input is from standard input. If the B<-o> option specifies -,
@@ -48,13 +48,13 @@ an output file which already exists.
=item B<-mtriple>=I<target triple>
Override the target triple specified in the input bytecode file with the
Override the target triple specified in the input bitcode file with the
specified string.
=item B<-march>=I<arch>
Specify the architecture for which to generate assembly, overriding the target
encoded in the bytecode file. See the output of B<llc --help> for a list of
encoded in the bitcode file. See the output of B<llc --help> for a list of
valid architectures. By default this is inferred from the target triple or
autodetected to the current architecture.

View File

@@ -2,7 +2,7 @@
=head1 NAME
lli - directly execute programs from LLVM bytecode
lli - directly execute programs from LLVM bitcode
=head1 SYNOPSIS
@@ -10,26 +10,40 @@ B<lli> [I<options>] [I<filename>] [I<program args>]
=head1 DESCRIPTION
B<lli> directly executes programs in LLVM bytecode format. It takes a program
in LLVM bytecode format and executes it using a just-in-time compiler, if one is
B<lli> directly executes programs in LLVM bitcode format. It takes a program
in LLVM bitcode format and executes it using a just-in-time compiler, if one is
available for the current architecture, or an interpreter. B<lli> takes all of
the same code generator options as L<llc|llc>, but they are only effective when
B<lli> is using the just-in-time compiler.
If I<filename> is not specified, then B<lli> reads the LLVM bytecode for the
If I<filename> is not specified, then B<lli> reads the LLVM bitcode for the
program from standard input.
The optional I<args> specified on the command line are passed to the program as
arguments.
=head1 OPTIONS
=head1 GENERAL OPTIONS
=over
=item B<-fake-argv0>=I<executable>
Override the C<argv[0]> value passed into the executing program.
=item B<-force-interpreter>=I<{false,true}>
If set to true, use the interpreter even if a just-in-time compiler is available
for this architecture. Defaults to false.
=item B<-help>
Print a summary of command line options.
=item B<-load>=I<puginfilename>
Causes B<lli> to load the plugin (shared object) named I<pluginfilename> and use
it for optimization.
=item B<-stats>
Print statistics from the code-generation passes. This is only meaningful for
@@ -40,16 +54,26 @@ the just-in-time compiler, at present.
Record the amount of time needed for each code-generation pass and print it to
standard error.
=item B<-version>
Print out the version of B<lli> and exit without doing anything else.
=back
=head1 TARGET OPTIONS
=over
=item B<-mtriple>=I<target triple>
Override the target triple specified in the input bytecode file with the
Override the target triple specified in the input bitcode file with the
specified string. This may result in a crash if you pick an
architecture which is not compatible with the current system.
=item B<-march>=I<arch>
Specify the architecture for which to generate assembly, overriding the target
encoded in the bytecode file. See the output of B<llc --help> for a list of
encoded in the bitcode file. See the output of B<llc --help> for a list of
valid architectures. By default this is inferred from the target triple or
autodetected to the current architecture.
@@ -67,17 +91,112 @@ operations are enabled or not. The default set of attributes is set by the
current CPU. For a list of available attributes, use:
B<llvm-as E<lt> /dev/null | llc -march=xyz -mattr=help>
=item B<-force-interpreter>=I<{false,true}>
=back
If set to true, use the interpreter even if a just-in-time compiler is available
for this architecture. Defaults to false.
=item B<-f>=I<name>
=head1 FLOATING POINT OPTIONS
Call the function named I<name> to start the program. Note: The
function is assumed to have the C signature C<int> I<name> C<(int,
char **, char **)>. If you try to use this option to call a function of
incompatible type, undefined behavior may result. Defaults to C<main>.
=over
=item B<-disable-excess-fp-precision>
Disable optimizations that may increase floating point precision.
=item B<-enable-finite-only-fp-math>
Enable optimizations that assumes only finite floating point math. That is,
there is no NAN or Inf values.
=item B<-enable-unsafe-fp-math>
Causes B<lli> to enable optimizations that may decrease floating point
precision.
=item B<-soft-float>
Causes B<lli> to generate software floating point library calls instead of
equivalent hardware instructions.
=back
=head1 CODE GENERATION OPTIONS
=over
=item B<-code-model>=I<model>
Choose the code model from:
default: Target default code model
small: Small code model
kernel: Kernel code model
medium: Medium code model
large: Large code model
=item B<-disable-post-RA-scheduler>
Disable scheduling after register allocation.
=item B<-disable-spill-fusing>
Disable fusing of spill code into instructions.
=item B<-enable-correct-eh-support>
Make the -lowerinvoke pass insert expensive, but correct, EH code.
=item B<-enable-eh>
Exception handling should be emitted.
=item B<-join-liveintervals>
Coalesce copies (default=true).
=item B<-nozero-initialized-in-bss>
Don't place zero-initialized symbols into the BSS section.
=item B<-pre-RA-sched>=I<scheduler>
Instruction schedulers available (before register allocation):
=default: Best scheduler for the target
=none: No scheduling: breadth first sequencing
=simple: Simple two pass scheduling: minimize critical path and maximize processor utilization
=simple-noitin: Simple two pass scheduling: Same as simple except using generic latency
=list-burr: Bottom-up register reduction list scheduling
=list-tdrr: Top-down register reduction list scheduling
=list-td: Top-down list scheduler -print-machineinstrs - Print generated machine code
=item B<-regalloc>=I<allocator>
Register allocator to use: (default = linearscan)
=bigblock: Big-block register allocator
=linearscan: linear scan register allocator =local - local register allocator
=simple: simple register allocator
=item B<-relocation-model>=I<model>
Choose relocation model from:
=default: Target default relocation model
=static: Non-relocatable code =pic - Fully relocatable, position independent code
=dynamic-no-pic: Relocatable external references, non-relocatable code
=item B<-spiller>
Spiller to use: (default: local)
=simple: simple spiller
=local: local spiller
=item B<-x86-asm-syntax>=I<syntax>
Choose style of code to emit from X86 backend:
=att: Emit AT&T-style assembly
=intel: Emit Intel-style assembly
=back

View File

@@ -13,7 +13,7 @@ B<llvm-ar> [-]{dmpqrtx}[Rabfikouz] [relpos] [count] <archive> [files...]
The B<llvm-ar> command is similar to the common Unix utility, C<ar>. It
archives several files together into a single file. The intent for this is
to produce archive libraries by LLVM bytecode that can be linked into an
to produce archive libraries by LLVM bitcode that can be linked into an
LLVM program. However, the archive can contain any kind of file. By default,
B<llvm-ar> generates a symbol table that makes linking faster because
only the symbol table needs to be consulted, not each individual file member
@@ -44,7 +44,7 @@ Here's where B<llvm-ar> departs from previous C<ar> implementations:
=item I<Symbol Table>
Since B<llvm-ar> is intended to archive bytecode files, the symbol table
Since B<llvm-ar> is intended to archive bitcode files, the symbol table
won't make much sense to anything but LLVM. Consequently, the symbol table's
format has been simplified. It consists simply of a sequence of pairs
of a file member index number as an LSB 4byte integer and a null-terminated
@@ -78,7 +78,7 @@ add all the files under a directory, if requested.
When B<llvm-ar> prints out the verbose table of contents (C<tv> option), it
precedes the usual output with a character indicating the basic kind of
content in the file. A blank means the file is a regular file. A 'Z' means
the file is compressed. A 'B' means the file is an LLVM bytecode file. An
the file is compressed. A 'B' means the file is an LLVM bitcode file. An
'S' means the file is the symbol table.
=back
@@ -123,7 +123,7 @@ archive is not modified.
Print files to the standard output. The F<k> modifier applies to this
operation. This operation simply prints the F<files> indicated to the
standard output. If no F<files> are specified, the entire archive is printed.
Printing bytecode files is ill-advised as they might confuse your terminal
Printing bitcode files is ill-advised as they might confuse your terminal
settings. The F<p> operation never modifies the archive.
=item q[Rfz]
@@ -146,7 +146,7 @@ F<files> are specified, the archive is not modified.
Print the table of contents. Without any modifiers, this operation just prints
the names of the members to the standard output. With the F<v> modifier,
B<llvm-ar> also prints out the file type (B=bytecode, Z=compressed, S=symbol
B<llvm-ar> also prints out the file type (B=bitcode, Z=compressed, S=symbol
table, blank=regular file), the permission mode, the owner and group, the
size, and the date. If any F<files> are specified, the listing is only for
those files. If no F<files> are specified, the table of contents for the
@@ -196,9 +196,9 @@ A synonym for the F<b> option.
=item [k]
Normally, B<llvm-ar> will not print the contents of bytecode files when the
Normally, B<llvm-ar> will not print the contents of bitcode files when the
F<p> operation is used. This modifier defeats the default and allows the
bytecode members to be printed.
bitcode members to be printed.
=item [N]
@@ -230,8 +230,8 @@ a time stamp than the time stamp of the member in the archive.
When inserting or replacing any file in the archive, compress the file first.
This
modifier is safe to use when (previously) compressed bytecode files are added to
the archive; the compressed bytecode files will not be doubly compressed.
modifier is safe to use when (previously) compressed bitcode files are added to
the archive; the compressed bitcode files will not be doubly compressed.
=back
@@ -252,7 +252,7 @@ archive is being created. Using this modifier turns off that warning.
This modifier requests that an archive index (or symbol table) be added to the
archive. This is the default mode of operation. The symbol table will contain
all the externally visible functions and global variables defined by all the
bytecode files in the archive. Using this modifier is more efficient that using
bitcode files in the archive. Using this modifier is more efficient that using
L<llvm-ranlib|llvm-ranlib> which also creates the symbol table.
=item [S]
@@ -363,7 +363,7 @@ the details on each of these items:
=item offset - vbr encoded 32-bit integer
The offset item provides the offset into the archive file where the bytecode
The offset item provides the offset into the archive file where the bitcode
member is stored that is associated with the symbol. The offset value is 0
based at the start of the first "normal" file member. To derive the actual
file offset of the member, you must add the number of bytes occupied by the file

View File

@@ -11,7 +11,7 @@ B<llvm-as> [I<options>] [I<filename>]
=head1 DESCRIPTION
B<llvm-as> is the LLVM assembler. It reads a file containing human-readable
LLVM assembly language, translates it to LLVM bytecode, and writes the result
LLVM assembly language, translates it to LLVM bitcode, and writes the result
into a file or to standard output.
If F<filename> is omitted or is C<->, then B<llvm-as> reads its input from
@@ -48,7 +48,7 @@ suffix is appended.
Force overwrite. Normally, B<llvm-as> will refuse to overwrite an
output file that already exists. With this option, B<llvm-as>
will overwrite the output file and replace it with new bytecode.
will overwrite the output file and replace it with new bitcode.
=item B<--help>

View File

@@ -2,7 +2,7 @@
=head1 NAME
llvm-bcanalyzer - LLVM bytecode analyzer
llvm-bcanalyzer - LLVM bitcode analyzer
=head1 SYNOPSIS
@@ -10,12 +10,12 @@ B<llvm-bcanalyzer> [I<options>] [F<filename>]
=head1 DESCRIPTION
The B<llvm-bcanalyzer> command is a small utility for analyzing bytecode files.
The tool reads a bytecode file (such as generated with the B<llvm-as> tool) and
produces a statistical report on the contents of the byteocde file. The tool
can also dump a low level but human readable version of the bytecode file.
The B<llvm-bcanalyzer> command is a small utility for analyzing bitcode files.
The tool reads a bitcode file (such as generated with the B<llvm-as> tool) and
produces a statistical report on the contents of the bitcode file. The tool
can also dump a low level but human readable version of the bitcode file.
This tool is probably not of much interest or utility except for those working
directly with the bytecode file format. Most LLVM users can just ignore
directly with the bitcode file format. Most LLVM users can just ignore
this tool.
If F<filename> is omitted or is C<->, then B<llvm-bcanalyzer> reads its input
@@ -33,14 +33,14 @@ level summary. The details for individual functions are not displayed.
=item B<-dump>
Causes B<llvm-bcanalyzer> to dump the bytecode in a human readable format. This
Causes B<llvm-bcanalyzer> to dump the bitcode in a human readable format. This
format is significantly different from LLVM assembly and provides details about
the encoding of the bytecode file.
the encoding of the bitcode file.
=item B<-verify>
Causes B<llvm-bcanalyzer> to verify the module produced by reading the
bytecode. This ensures that the statistics generated are based on a consistent
bitcode. This ensures that the statistics generated are based on a consistent
module.
=item B<--help>
@@ -61,18 +61,18 @@ summary output.
=over
=item B<Bytecode Analysis Of Module>
=item B<Bitcode Analysis Of Module>
This just provides the name of the module for which bytecode analysis is being
This just provides the name of the module for which bitcode analysis is being
generated.
=item B<Bytecode Version Number>
=item B<Bitcode Version Number>
The bytecode version (not LLVM version) of the file read by the analyzer.
The bitcode version (not LLVM version) of the file read by the analyzer.
=item B<File Size>
The size, in bytes, of the entire bytecode file.
The size, in bytes, of the entire bitcode file.
=item B<Module Bytes>
@@ -86,7 +86,7 @@ Size.
=item B<Global Types Bytes>
The size, in bytes, of the Global Types Pool. Percentage is relative to File
Size. This is the size of the definitions of all types in the bytecode file.
Size. This is the size of the definitions of all types in the bitcode file.
=item B<Constant Pool Bytes>
@@ -122,13 +122,13 @@ The size, in bytes, of the list of dependent libraries in the module. Percentage
is relative to File Size. Note that this value is also included in the Module
Global Bytes.
=item B<Number Of Bytecode Blocks>
=item B<Number Of Bitcode Blocks>
The total number of blocks of any kind in the bytecode file.
The total number of blocks of any kind in the bitcode file.
=item B<Number Of Functions>
The total number of function definitions in the bytecode file.
The total number of function definitions in the bitcode file.
=item B<Number Of Types>
@@ -140,42 +140,42 @@ The total number of constants (of any type) defined in the Constant Pool.
=item B<Number Of Basic Blocks>
The total number of basic blocks defined in all functions in the bytecode file.
The total number of basic blocks defined in all functions in the bitcode file.
=item B<Number Of Instructions>
The total number of instructions defined in all functions in the bytecode file.
The total number of instructions defined in all functions in the bitcode file.
=item B<Number Of Long Instructions>
The total number of long instructions defined in all functions in the bytecode
The total number of long instructions defined in all functions in the bitcode
file. Long instructions are those taking greater than 4 bytes. Typically long
instructions are GetElementPtr with several indices, PHI nodes, and calls to
functions with large numbers of arguments.
=item B<Number Of Operands>
The total number of operands used in all instructions in the bytecode file.
The total number of operands used in all instructions in the bitcode file.
=item B<Number Of Compaction Tables>
The total number of compaction tables in all functions in the bytecode file.
The total number of compaction tables in all functions in the bitcode file.
=item B<Number Of Symbol Tables>
The total number of symbol tables in all functions in the bytecode file.
The total number of symbol tables in all functions in the bitcode file.
=item B<Number Of Dependent Libs>
The total number of dependent libraries found in the bytecode file.
The total number of dependent libraries found in the bitcode file.
=item B<Total Instruction Size>
The total size of the instructions in all functions in the bytecode file.
The total size of the instructions in all functions in the bitcode file.
=item B<Average Instruction Size>
The average number of bytes per instruction across all functions in the bytecode
The average number of bytes per instruction across all functions in the bitcode
file. This value is computed by dividing Total Instruction Size by Number Of
Instructions.
@@ -306,7 +306,7 @@ Rate encoding scheme. The percentage is relative to # of VBR Expanded Bytes.
=head1 SEE ALSO
L<llvm-dis|llvm-dis>, L<http://llvm.org/docs/BytecodeFormat.html>
L<llvm-dis|llvm-dis>, L<http://llvm.org/docs/BitcodeFormat.html>
=head1 AUTHORS

View File

@@ -115,7 +115,7 @@ Includes either a native backend or the C backend.
=item B<engine>
Includes either a native JIT or the bytecode interpreter.
Includes either a native JIT or the bitcode interpreter.
=back

View File

@@ -11,7 +11,7 @@ B<llvm-dis> [I<options>] [I<filename>]
=head1 DESCRIPTION
The B<llvm-dis> command is the LLVM disassembler. It takes an LLVM
bytecode file and converts it into human-readable LLVM assembly language.
bitcode file and converts it into human-readable LLVM assembly language.
If filename is omitted or specified as C<->, B<llvm-dis> reads its
input from standard input.

View File

@@ -11,10 +11,10 @@ B<llvm-extract> [I<options>] B<--func> I<function-name> [I<filename>]
=head1 DESCRIPTION
The B<llvm-extract> command takes the name of a function and extracts it from
the specified LLVM bytecode file. It is primarily used as a debugging tool to
the specified LLVM bitcode file. It is primarily used as a debugging tool to
reduce test cases from larger programs that are triggering a bug.
In addition to extracting the bytecode of the specified function,
In addition to extracting the bitcode of the specified function,
B<llvm-extract> will also remove unreachable global variables, prototypes, and
unused types.
@@ -30,11 +30,11 @@ unless the B<-o> option is specified (see below).
Force overwrite. Normally, B<llvm-extract> will refuse to overwrite an
output file that already exists. With this option, B<llvm-extract>
will overwrite the output file and replace it with new bytecode.
will overwrite the output file and replace it with new bitcode.
=item B<--func> I<function-name>
Extract the function named I<function-name> from the LLVM bytecode.
Extract the function named I<function-name> from the LLVM bitcode.
=item B<--help>

View File

@@ -10,16 +10,16 @@ B<llvm-ld> <options> <files>
=head1 DESCRIPTION
The B<llvm-ld> tool takes a set of LLVM bytecode files and links them
together into a single LLVM bytecode file. The output bytecode file can be
another bytecode file or an executable bytecode program. Using additional
The B<llvm-ld> tool takes a set of LLVM bitcode files and links them
together into a single LLVM bitcode file. The output bitcode file can be
another bitcode file or an executable bitcode program. Using additional
options, B<llvm-ld> is able to produce native code executables.
The B<llvm-ld> tool is the main linker for LLVM. It is used to link together
the output of LLVM front-end compilers and run "link time" optimizations (mostly
the inter-procedural kind).
The B<llvm-ld> tools attemps to mimic the interface provided by the default
The B<llvm-ld> tools attempts to mimic the interface provided by the default
system linker so that it can act as a I<drop-in> replacement.
=head2 Search Order
@@ -47,13 +47,13 @@ and is applied to all libraries, preceding or succeeding, in the command line.
=head2 Link order
All object and bytecode files are linked first in the order they were
All object and bitcode files are linked first in the order they were
specified on the command line. All library files are linked next.
Some libraries may not be linked into the object program; see below.
=head2 Library Linkage
Object files and static bytecode objects are always linked into the output
Object files and static bitcode objects are always linked into the output
file. Library archives (.a files) load only the objects within the archive
that define symbols needed by the output file. Hence, libraries should be
listed after the object files and libraries which need them; otherwise, the
@@ -64,7 +64,7 @@ undefined symbols defined.
The B<llvm-ld> program has limited support for native code generation, when
using the B<-native> or B<-native-cbe> options. Native code generation is
perfomed by converting the linked bytecode into native assembly (.s) or C code
performed by converting the linked bitcode into native assembly (.s) or C code
and running the system compiler (typically gcc) on the result.
=head1 OPTIONS
@@ -121,7 +121,7 @@ will not search the paths given by the B<-L> options following it.
=item B<-link-as-library>
Link the bytecode files together as a library, not an executable. In this mode,
Link the bitcode files together as a library, not an executable. In this mode,
undefined symbols will be permitted.
=item B<-r>
@@ -136,14 +136,14 @@ Specifies the kind of machine for which code or assembly should be generated.
Generate a native machine code executable.
When generating native executables, B<llvm-ld> first checks for a bytecode
When generating native executables, B<llvm-ld> first checks for a bitcode
version of the library and links it in, if necessary. If the library is
missing, B<llvm-ld> skips it. Then, B<llvm-ld> links in the same
libraries as native code.
In this way, B<llvm-ld> should be able to link in optimized bytecode
In this way, B<llvm-ld> should be able to link in optimized bitcode
subsets of common libraries and then link in any part of the library that
hasn't been converted to bytecode.
hasn't been converted to bitcode.
=item B<-native-cbe>
@@ -236,7 +236,7 @@ run. This feature allows the optimization passes of B<llvm-ld> to be extended.
=item B<-post-link-opt>F<Path>
Run post-link optimization program. After linking is completed a bytecode file
Run post-link optimization program. After linking is completed a bitcode file
will be generated. It will be passed to the program specified by F<Path> as the
first argument. The second argument to the program will be the name of a
temporary file into which the program should place its optimized output. For
@@ -254,7 +254,7 @@ it will exit with a non-zero return code.
=head1 ENVIRONMENT
The C<LLVM_LIB_SEARCH_PATH> environment variable is used to find bytecode
The C<LLVM_LIB_SEARCH_PATH> environment variable is used to find bitcode
libraries. Any paths specified in this variable will be searched after the C<-L>
options.

View File

@@ -10,8 +10,8 @@ B<llvm-link> [I<options>] I<filename ...>
=head1 DESCRIPTION
B<llvm-link> takes several LLVM bytecode files and links them together into a
single LLVM bytecode file. It writes the output file to standard output, unless
B<llvm-link> takes several LLVM bitcode files and links them together into a
single LLVM bitcode file. It writes the output file to standard output, unless
the B<-o> option is used to specify a filename.
B<llvm-link> attempts to load the input files from the current directory. If
@@ -27,14 +27,14 @@ in the order they were specified on the command line.
=item B<-L> F<directory>
Add the specified F<directory> to the library search path. When looking for
libraries, B<llvm-link> will look in pathname for libraries. This option can be
libraries, B<llvm-link> will look in path name for libraries. This option can be
specified multiple times; B<llvm-link> will search inside these directories in
the order in which they were specified on the command line.
=item B<-f>
Overwrite output files. By default, B<llvm-link> will not overwrite an output
file if it alreadys exists.
file if it already exists.
=item B<-o> F<filename>
@@ -44,7 +44,7 @@ write its output to standard output.
=item B<-d>
If specified, B<llvm-link> prints a human-readable version of the output
bytecode file to standard error.
bitcode file to standard error.
=item B<--help>
@@ -53,7 +53,7 @@ Print a summary of command line options.
=item B<-v>
Verbose mode. Print information about what B<llvm-link> is doing. This
typically includes a message for each bytecode file linked in and for each
typically includes a message for each bitcode file linked in and for each
library found.
=back

View File

@@ -2,7 +2,7 @@
=head1 NAME
llvm-nm - list LLVM bytecode file's symbol table
llvm-nm - list LLVM bitcode file's symbol table
=head1 SYNOPSIS
@@ -10,11 +10,11 @@ B<llvm-nm> [I<options>] [I<filenames...>]
=head1 DESCRIPTION
The B<llvm-nm> utility lists the names of symbols from the LLVM bytecode files,
or B<ar> archives containing LLVM bytecode files, named on the command line.
The B<llvm-nm> utility lists the names of symbols from the LLVM bitcode files,
or B<ar> archives containing LLVM bitcode files, named on the command line.
Each symbol is listed along with some simple information about its provenance.
If no filename is specified, or I<-> is used as a filename, B<llvm-nm> will
process a bytecode file on its standard input stream.
If no file name is specified, or I<-> is used as a file name, B<llvm-nm> will
process a bitcode file on its standard input stream.
B<llvm-nm>'s default output format is the traditional BSD B<nm> output format.
Each such output record consists of an (optional) 8-digit hexadecimal address,
@@ -28,15 +28,15 @@ Type code characters currently supported, and their meanings, are as follows:
=item U
Named object is referenced but undefined in this bytecode file
Named object is referenced but undefined in this bitcode file
=item C
Common (multiple defs link together into one def)
Common (multiple definitions link together into one def)
=item W
Weak reference (multiple defs link together into zero or one defs)
Weak reference (multiple definitions link together into zero or one definitions)
=item t
@@ -60,10 +60,10 @@ Something unrecognizable
=back
Because LLVM bytecode files typically contain objects that are not considered to
Because LLVM bitcode files typically contain objects that are not considered to
have addresses until they are linked into an executable image or dynamically
compiled "just-in-time", B<llvm-nm> does not print an address for any symbol,
even symbols which are defined in the bytecode file.
even symbols which are defined in the bitcode file.
=head1 OPTIONS
@@ -83,18 +83,18 @@ Print a summary of command-line options and their meanings.
=item B<--defined-only>
Print only symbols defined in this bytecode file (as opposed to
Print only symbols defined in this bitcode file (as opposed to
symbols which may be referenced by objects in this file, but not
defined in this file.)
=item B<--extern-only>, B<-g>
Print only symbols whose definitions are external; that is, accessible
from other bytecode files.
from other bitcode files.
=item B<--undefined-only>, B<-u>
Print only symbols referenced but not defined in this bytecode file.
Print only symbols referenced but not defined in this bitcode file.
=item B<--format=>I<fmt>, B<-f>

View File

@@ -6,12 +6,12 @@ llvm-prof - print execution profile of LLVM program
=head1 SYNOPSIS
B<llvm-prof> [I<options>] [I<bytecode file>] [I<llvmprof.out>]
B<llvm-prof> [I<options>] [I<bitcode file>] [I<llvmprof.out>]
=head1 DESCRIPTION
The B<llvm-prof> tool reads in an F<llvmprof.out> file (which can
optionally use a specific file with the third program argument), a bytecode file
optionally use a specific file with the third program argument), a bitcode file
for the program, and produces a human readable report, suitable for determining
where the program hotspots are.
@@ -47,7 +47,7 @@ error.
=head1 EXIT STATUS
B<llvm-prof> returns 1 if it cannot load the bytecode file or the profile
B<llvm-prof> returns 1 if it cannot load the bitcode file or the profile
information. Otherwise, it exits with zero.
=head1 AUTHOR

View File

@@ -14,7 +14,7 @@ The B<llvm-ranlib> command is similar to the common Unix utility, C<ranlib>. It
adds or updates the symbol table in an LLVM archive file. Note that using the
B<llvm-ar> modifier F<s> is usually more efficient than running B<llvm-ranlib>
which is only provided only for completness and compatibility. Unlike other
implementations of C<ranlib>, B<llvm-ranlib> indexes LLVM bytecode files, not
implementations of C<ranlib>, B<llvm-ranlib> indexes LLVM bitcode files, not
native object modules. You can list the contents of the symbol table with the
C<llvm-nm -s> command.

View File

@@ -2,7 +2,7 @@
=head1 NAME
llvm-upgrade - LLVM assembly upgrader
llvm-upgrade - LLVM assembly upgrade tool
=head1 SYNOPSIS
@@ -10,7 +10,7 @@ B<llvm-upgrade> [I<options>] [I<filename>]
=head1 DESCRIPTION
B<llvm-upgrade> is the LLVM assembly upgrader. It reads a file containing
B<llvm-upgrade> is the LLVM assembly upgrade tool. It reads a file containing
human-readable LLVM assembly language, and upgrades that assembly to the current
version of LLVM. If the input is in the form currently accepted by LLVM, then
no upgrades are performed.

View File

@@ -2,7 +2,7 @@
=head1 NAME
llvm2xpp - LLVM bytecode to LLVM C++ IR translator
llvm2xpp - LLVM bitcode to LLVM C++ IR translator
=head1 SYNOPSIS
@@ -10,7 +10,7 @@ B<llvm2cpp> [I<options>] [I<filename>]
=head1 DESCRIPTION
B<llvm2cpp> translates from LLVM bytecode (.bc files) to a
B<llvm2cpp> translates from LLVM bitcode (.bc files) to a
corresponding C++ source file that will make calls against the LLVM C++ API to
build the same module as the input. By default, the C++ output is a complete
program that builds the module, verifies it and then emits the module as
@@ -193,6 +193,7 @@ Show the version number of this program.
=back
=head1 EXIT STATUS
If B<llvm2cpp> succeeds, it will exit with 0. Otherwise, if an error
@@ -202,6 +203,13 @@ occurs, it will exit with a non-zero value.
L<llvm-as|llvm-as> L<tblgen|tblgen>
=head1 NOTES
This tool may be removed from a future version of LLVM. Instead, its
functionality may be incorporated into the llc tool. It would then act similarly
to other targets except its output would be C++ source that could be compiled to
construct the input program.
=head1 AUTHORS
Written by Reid Spencer (L<http://hlvm.org>).

View File

@@ -69,13 +69,13 @@ into a set of basic actions to be done:
=item * Pre-processing: gathering/filtering compiler input (optional).
=item * Translation: source language to bytecode conversion.
=item * Translation: source language to bitcode conversion.
=item * Assembly: bytecode to native code conversion.
=item * Assembly: bitcode to native code conversion.
=item * Optimization: conversion of bytecode to something that runs faster.
=item * Optimization: conversion of bitcode to something that runs faster.
=item * Linking: combining multiple bytecodes to produce executable program.
=item * Linking: combining multiple bitcode files to produce executable program.
=back
@@ -99,7 +99,7 @@ following control options are defined:
This option specifies that the linking phase is not to be run. All
previous phases, if applicable will run. This is generally how a given
bytecode file is compiled and optimized for a source language module.
bitcode file is compiled and optimized for a source language module.
=item B<-k> or B<--link> or default
@@ -145,7 +145,7 @@ this is the default level of optimization.
This level of optimization specifies a balance between generating good code
that will execute reasonably quickly and not spending too much time optimizing
the code to get there. For example, this level of optimization may include
things like global common subexpression elimination, aggressive dead code
things like global common sub-expression elimination, aggressive dead code
elimination, and scalar replication.
=item B<-O3> (aggressive optimization)
@@ -173,7 +173,7 @@ aggressive inter-procedural optimization.
This is the same as B<-O5> except that it employs profile-guided
re-optimization of the program after it has executed. Note that this implies
a single level of re-optimization based on runtime profile analysis. Once
a single level of re-optimization based on run time profile analysis. Once
the re-optimization has completed, the profiling instrumentation is
removed and final optimizations are employed.
@@ -220,7 +220,7 @@ of the option names the back end to use.
=item B<--native>
Normally, B<llvmc> produces bytecode files at most stages of compilation.
Normally, B<llvmc> produces bitcode files at most stages of compilation.
With this option, B<llvmc> will arrange for native object files to be
generated with the B<-c> option, native assembly files to be generated
with the B<-S> option, and native executables to be generated with the

View File

@@ -12,10 +12,10 @@ B<llvm-gcc> [I<options>] I<filename>
The B<llvm-gcc> command is the LLVM C front end. It is a modified
version of gcc that compiles C/ObjC programs into native objects, LLVM
bytecode or LLVM assembly language, depending upon the options.
bitcode or LLVM assembly language, depending upon the options.
By default, B<llvm-gcc> compiles to native objects just like GCC does. If the
B<-emit-llvm> option is given then it will generate LLVM bytecode files instead.
B<-emit-llvm> option is given then it will generate LLVM bitcode files instead.
If B<-S> (assembly) is also given, then it will generate LLVM assembly.
Being derived from the GNU Compiler Collection, B<llvm-gcc> has many
@@ -32,14 +32,14 @@ Print a summary of command line options.
=item B<-S>
Do not generate an LLVM bytecode file. Rather, compile the source
Do not generate an LLVM bitcode file. Rather, compile the source
file into an LLVM assembly language file.
=item B<-c>
Do not generate a linked executable. Rather, compile the source
file into an LLVM bytecode file. This bytecode file can then be
linked with other bytecode files later on to generate a full LLVM
file into an LLVM bitcode file. This bitcode file can then be
linked with other bitcode files later on to generate a full LLVM
executable.
=item B<-o> I<filename>
@@ -59,11 +59,11 @@ repeated.
=item B<-l>I<name>
Link in the library libI<name>.[bc | a | so]. This library should
be a bytecode library.
be a bitcode library.
=item B<-emit-llvm>
Make the output be LLVM bytecode (or assembly) instead of native object (or
Make the output be LLVM bitcode (or assembly) instead of native object (or
assembly).
=back

View File

@@ -12,10 +12,10 @@ B<llvm-g++> [I<options>] I<filename>
The B<llvm-g++> command is the LLVM C++ front end. It is a modified
version of g++ that compiles C++/ObjC++ programs into native code,
LLVM bytecode or assembly language, depending upon the options.
LLVM bitcode or assembly language, depending upon the options.
By default, B<llvm-g++> compiles to native objects just like GCC does. If the
B<-emit-llvm> option is given then it will generate LLVM bytecode files instead.
B<-emit-llvm> option is given then it will generate LLVM bitcode files instead.
If B<-S> (assembly) is also given, then it will generate LLVM assembly.
Being derived from the GNU Compiler Collection, B<llvm-g++> has many
@@ -32,14 +32,14 @@ Print a summary of command line options.
=item B<-S>
Do not generate an LLVM bytecode file. Rather, compile the source
Do not generate an LLVM bitcode file. Rather, compile the source
file into an LLVM assembly language file.
=item B<-c>
Do not generate a linked executable. Rather, compile the source
file into an LLVM bytecode file. This bytecode file can then be
linked with other bytecode files later on to generate a full LLVM
file into an LLVM bitcode file. This bitcode file can then be
linked with other bitcode files later on to generate a full LLVM
executable.
=item B<-o> I<filename>
@@ -59,11 +59,11 @@ repeated.
=item B<-l>I<name>
Link in the library libI<name>.[bc | a | so]. This library should
be a bytecode library.
be a bitcode library.
=item B<-emit-llvm>
Make the output be LLVM bytecode (or assembly) instead of native object (or
Make the output be LLVM bitcode (or assembly) instead of native object (or
assembly).
=back

View File

@@ -1 +0,0 @@
.dir

View File

@@ -1,2 +0,0 @@
*.1
.dir

View File

@@ -13,7 +13,7 @@ h1, a { color: #336699; }
.mmenuon {
font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
color: #ff6600; font-size: 10pt;
}
}
.mmenuoff {
font-family: Arial,Helvetica; font-weight: bold; text-decoration: none;
color: #ffffff; font-size: 10pt;

View File

@@ -11,24 +11,24 @@ B<opt> [I<options>] [I<filename>]
=head1 DESCRIPTION
The B<opt> command is the modular LLVM optimizer and analyzer. It takes LLVM
bytecode as input, runs the specified optimizations or analyses on it, and then
outputs the optimized LLVM bytecode or the analysis results. The function of
bitcode as input, runs the specified optimizations or analyses on it, and then
outputs the optimized LLVM bitcode or the analysis results. The function of
B<opt> depends on whether the B<-analyze> option is given.
When B<-analyze> is specified, B<opt> performs various analyses of LLVM
bytecode. It will usually print the results on standard output, but in a few
bitcode. It will usually print the results on standard output, but in a few
cases, it will print output to standard error or generate a file with the
analysis output, which is usually done when the output is meant for another
program.
While B<-analyze> is I<not> given, B<opt> attempts to produce an optimized
bytecode file. The optimizations available via B<opt> depend upon what
bitcode file. The optimizations available via B<opt> depend upon what
libraries were linked into it as well as any additional libraries that have
been loaded with the B<-load> option. Use the B<-help> option to determine
what optimizations you can use.
If I<filename> is omitted from the command line or is I<->, B<opt> reads its
input from standard input. The input must be an LLVM bytecode file.
input from standard input. The input must be an LLVM bitcode file.
If an output filename is not specified with the B<-o> option, B<opt>
writes its output to the standard output.
@@ -41,7 +41,7 @@ writes its output to the standard output.
Force overwrite. Normally, B<opt> will refuse to overwrite an
output file that already exists. With this option, B<opt> will
overwrite the output file and replace it with new bytecode.
overwrite the output file and replace it with new bitcode.
=item B<-help>

View File

@@ -1,2 +0,0 @@
*ps
.dir

View File

@@ -14,8 +14,8 @@ The B<stkrc> command is the compiler for the Stacker language. Stacker is a
simple stack based, Forth-like language that was written as a demonstration
language for LLVM. For details on the language, please see
L<http://llvm.org/docs/Stacker.html> . The B<stkrc> compiler is fairly
minimal. It compiles to bytecode only and doesn't perform any optimizations.
The output of stkrc (a bytecode file) can be piped through other LLVM tools
minimal. It compiles to bitcode only and doesn't perform any optimizations.
The output of stkrc (a bitcode file) can be piped through other LLVM tools
for optimization and linking.
If F<filename> is omitted or is C<->, then B<stkrc> reads its input
@@ -65,7 +65,7 @@ error.
=item B<-f>
Force the output to be written. Normally, B<stkrc> won't overwrite an existing
bytecode file. This option overrides that behavior.
bitcode file. This option overrides that behavior.
=item B<-s> F<stacksize>

View File

@@ -60,7 +60,7 @@
<tt>cl::ParseCommandLineOptions</tt> function</a></li>
<li><a href="#cl::ParseEnvironmentOptions">The
<tt>cl::ParseEnvironmentOptions</tt> function</a></li>
<li><a href="#cl::SetVersionPrinter">The cl::SetVersionPrinter
<li><a href="#cl::SetVersionPrinter">The <tt>cl::SetVersionPrinter</tt>
function</a></li>
<li><a href="#cl::opt">The <tt>cl::opt</tt> class</a></li>
<li><a href="#cl::list">The <tt>cl::list</tt> class</a></li>
@@ -75,6 +75,8 @@
parser</a></li>
<li><a href="#boolparser">The <tt>parser&lt;bool&gt;</tt>
specialization</a></li>
<li><a href="#boolOrDefaultparser">The <tt>parser&lt;boolOrDefault&gt;</tt>
specialization</a></li>
<li><a href="#stringparser">The <tt>parser&lt;string&gt;</tt>
specialization</a></li>
<li><a href="#intparser">The <tt>parser&lt;int&gt;</tt>
@@ -136,7 +138,7 @@ code.</li>
<li>Globally accessible: Libraries can specify command line arguments that are
automatically enabled in any tool that links to the library. This is possible
because the application doesn't have to keep a "list" of arguments to pass to
because the application doesn't have to keep a list of arguments to pass to
the parser. This also makes supporting <a href="#dynamicopts">dynamically
loaded options</a> trivial.</li>
@@ -214,12 +216,12 @@ int main(int argc, char **argv) {
declarations.</p>
<p>Now that you are ready to support command line arguments, we need to tell the
system which ones we want, and what type of argument they are. The CommandLine
system which ones we want, and what type of arguments they are. The CommandLine
library uses a declarative syntax to model command line arguments with the
global variable declarations that capture the parsed values. This means that
for every command line option that you would like to support, there should be a
global variable declaration to capture the result. For example, in a compiler,
we would like to support the unix standard '<tt>-o &lt;filename&gt;</tt>' option
we would like to support the Unix-standard '<tt>-o &lt;filename&gt;</tt>' option
to specify where to put the output. With the CommandLine library, this is
represented like this:</p>
@@ -381,7 +383,7 @@ OPTIONS:
-help - display available options (--help-hidden for more)
</pre></div>
<p>and "<tt>opt --help-hidden</tt>" prints this:</p>
<p>and "<tt>compiler --help-hidden</tt>" prints this:</p>
<div class="doc_code"><pre>
USAGE: compiler [options] &lt;input file&gt;
@@ -430,7 +432,7 @@ a value itself:</p>
</pre></div>
<p>The third line (which is the only one we modified from above) defines a
"<tt>-q</tt> alias that updates the "<tt>Quiet</tt>" variable (as specified by
"<tt>-q</tt>" alias that updates the "<tt>Quiet</tt>" variable (as specified by
the <tt><a href="#cl::aliasopt">cl::aliasopt</a></tt> modifier) whenever it is
specified. Because aliases do not hold state, the only thing the program has to
query is the <tt>Quiet</tt> variable now. Another nice feature of aliases is
@@ -460,24 +462,24 @@ uses.</p>
<div class="doc_text">
<p>So far, we have seen how the CommandLine library handles builtin types like
<p>So far we have seen how the CommandLine library handles builtin types like
<tt>std::string</tt>, <tt>bool</tt> and <tt>int</tt>, but how does it handle
things it doesn't know about, like enums or '<tt>int*</tt>'s?</p>
<p>The answer is that it uses a table driven generic parser (unless you specify
<p>The answer is that it uses a table-driven generic parser (unless you specify
your own parser, as described in the <a href="#extensionguide">Extension
Guide</a>). This parser maps literal strings to whatever type is required, and
requires you to tell it what this mapping should be.</p>
<p>Lets say that we would like to add four optimization levels to our
<p>Let's say that we would like to add four optimization levels to our
optimizer, using the standard flags "<tt>-g</tt>", "<tt>-O0</tt>",
"<tt>-O1</tt>", and "<tt>-O2</tt>". We could easily implement this with boolean
options like above, but there are several problems with this strategy:</p>
<ol>
<li>A user could specify more than one of the options at a time, for example,
"<tt>opt -O3 -O2</tt>". The CommandLine library would not be able to catch this
erroneous input for us.</li>
"<tt>compiler -O3 -O2</tt>". The CommandLine library would not be able to
catch this erroneous input for us.</li>
<li>We would have to test 4 different variables to see which ones are set.</li>
@@ -632,7 +634,7 @@ that you can choose the form most appropriate for your application.</p>
<div class="doc_text">
<p>Now that we have the standard run of the mill argument types out of the way,
<p>Now that we have the standard run-of-the-mill argument types out of the way,
lets get a little wild and crazy. Lets say that we want our optimizer to accept
a <b>list</b> of optimizations to perform, allowing duplicates. For example, we
might want to run: "<tt>compiler -dce -constprop -inline -dce -strip</tt>". In
@@ -748,7 +750,7 @@ the first are discarded.</p>
<p>Finally, if external storage is used, then the location specified must be of
<b>type</b> <tt>unsigned</tt>. In all other ways a <a
href="#bits"><tt>cl::bits</tt></a> option is morally equivalent to a <a
href="#bits"><tt>cl::bits</tt></a> option is equivalent to a <a
href="#list"> <tt>cl::list</tt></a> option.</p>
</div>
@@ -914,7 +916,7 @@ can use it like this:</p>
<div class="doc_code"><pre>
static cl::list&lt;std::string&gt; Files(cl::Positional, cl::OneOrMore);
static cl::listlt;std::string&gt; Libraries("l", cl::ZeroOrMore);
static cl::list&lt;std::string&gt; Libraries("l", cl::ZeroOrMore);
int main(int argc, char**argv) {
// ...
@@ -967,7 +969,7 @@ interpreted by the command line argument.</p>
standard Unix Bourne shell (<tt>/bin/sh</tt>). To run <tt>/bin/sh</tt>, first
you specify options to the shell itself (like <tt>-x</tt> which turns on trace
output), then you specify the name of the script to run, then you specify
arguments to the script. These arguments to the script are parsed by the bourne
arguments to the script. These arguments to the script are parsed by the Bourne
shell command line option processor, but are not interpreted as options to the
shell itself. Using the CommandLine library, we would specify this as:</p>
@@ -1040,10 +1042,7 @@ extern bool DebugFlag;
<i>// DEBUG macro - This macro should be used by code to emit debug information.
// In the '-debug' option is specified on the command line, and if this is a
// debug build, then the code specified as the option to the macro will be
// executed. Otherwise it will not be. Example:
//
// DOUT &lt;&lt; "Bitset contains: " &lt;&lt; Bitset &lt;&lt; "\n";
//</i>
// executed. Otherwise it will not be.</i>
<span class="doc_hilite">#ifdef NDEBUG
#define DEBUG(X)
#else
@@ -1055,7 +1054,7 @@ extern bool DebugFlag;
<p>This allows clients to blissfully use the <tt>DEBUG()</tt> macro, or the
<tt>DebugFlag</tt> explicitly if they want to. Now we just need to be able to
set the <tt>DebugFlag</tt> boolean when the option is set. To do this, we pass
an additial argument to our command line argument processor, and we specify
an additional argument to our command line argument processor, and we specify
where to fill in with the <a href="#cl::location">cl::location</a>
attribute:</p>
@@ -1204,15 +1203,15 @@ compiled program:</p>
<li><a name="cl::NotHidden">The <b><tt>cl::NotHidden</tt></b></a> modifier
(which is the default for <tt><a href="#cl::opt">cl::opt</a></tt> and <tt><a
href="#cl::list">cl::list</a></tt> options), indicates the option is to appear
href="#cl::list">cl::list</a></tt> options) indicates the option is to appear
in both help listings.</li>
<li><a name="cl::Hidden">The <b><tt>cl::Hidden</tt></b></a> modifier (which is the
default for <tt><a href="#cl::alias">cl::alias</a></tt> options), indicates that
default for <tt><a href="#cl::alias">cl::alias</a></tt> options) indicates that
the option should not appear in the <tt>--help</tt> output, but should appear in
the <tt>--help-hidden</tt> output.</li>
<li><a name="cl::ReallyHidden">The <b><tt>cl::ReallyHidden</tt></b></a> modifier,
<li><a name="cl::ReallyHidden">The <b><tt>cl::ReallyHidden</tt></b></a> modifier
indicates that the option should not appear in any help output.</li>
</ul>
@@ -1253,7 +1252,7 @@ indicates that the specified option must be specified exactly one time.</li>
indicates that the option must be specified at least one time.</li>
<li>The <b><tt>cl::ConsumeAfter</tt></b> modifier is described in the <a
href="#positional">Positional arguments section</a></li>
href="#positional">Positional arguments section</a>.</li>
</ul>
@@ -1326,7 +1325,7 @@ when <a href="#extensionguide">extending the library</a>.</p>
<p>The formatting option group is used to specify that the command line option
has special abilities and is otherwise different from other command line
arguments. As usual, you can only specify at most one of these arguments.</p>
arguments. As usual, you can only specify one of these arguments at most.</p>
<ul>
@@ -1335,7 +1334,7 @@ modifier (which is the default all options) specifies that this option is
"normal".</li>
<li><a name="cl::Positional">The <b><tt>cl::Positional</tt></b></a> modifier
specifies that this is a positional argument, that does not have a command line
specifies that this is a positional argument that does not have a command line
option associated with it. See the <a href="#positional">Positional
Arguments</a> section for more information.</li>
@@ -1356,7 +1355,7 @@ modifier added to allow the CommandLine library to recognize them. Note that
specified.</li>
<li><a name="cl::Grouping">The <b><tt>cl::Grouping</tt></b></a> modifier is used
to implement unix style tools (like <tt>ls</tt>) that have lots of single letter
to implement Unix-style tools (like <tt>ls</tt>) that have lots of single letter
arguments, but only require a single dash. For example, the '<tt>ls -labF</tt>'
command actually enables four different options, all of which are single
letters. Note that <b><tt><a href="#cl::Grouping">cl::Grouping</a></tt></b>
@@ -1424,7 +1423,7 @@ more values (i.e. it is a <a href="#cl::list">cl::list</a> option).</li>
positional arguments, and only makes sense for lists) indicates that positional
argument should consume any strings after it (including strings that start with
a "-") up until another recognized positional argument. For example, if you
have two "eating" positional arguments "<tt>pos1</tt>" and "<tt>pos2</tt>" the
have two "eating" positional arguments, "<tt>pos1</tt>" and "<tt>pos2</tt>", the
string "<tt>-pos1 -foo -bar baz -pos2 -bork</tt>" would cause the "<tt>-foo -bar
-baz</tt>" strings to be applied to the "<tt>-pos1</tt>" option and the
"<tt>-bork</tt>" string to be applied to the "<tt>-pos2</tt>" option.</li>
@@ -1485,14 +1484,14 @@ as <a
href="#cl::ParseCommandLineOptions"><tt>cl::ParseCommandLineOptions</tt></a>,
except that it is designed to take values for options from an environment
variable, for those cases in which reading the command line is not convenient or
not desired. It fills in the values of all the command line option variables
just like <a
desired. It fills in the values of all the command line option variables just
like <a
href="#cl::ParseCommandLineOptions"><tt>cl::ParseCommandLineOptions</tt></a>
does.</p>
<p>It takes three parameters: first, the name of the program (since
<tt>argv</tt> may not be available, it can't just look in <tt>argv[0]</tt>),
second, the name of the environment variable to examine, and third, the optional
<p>It takes three parameters: the name of the program (since <tt>argv</tt> may
not be available, it can't just look in <tt>argv[0]</tt>), the name of the
environment variable to examine, and the optional
<a href="#description">additional extra text</a> to emit when the
<tt>--help</tt> option is invoked.</p>
@@ -1516,7 +1515,7 @@ input.</p>
<div class="doc_text">
<p>The <tt>cl::SetVersionPrinter</tt> function is designed to be called
directly from <tt>main</tt>, and <i>before</i>
directly from <tt>main</tt> and <i>before</i>
<tt>cl::ParseCommandLineOptions</tt>. Its use is optional. It simply arranges
for a function to be called in response to the <tt>--version</tt> option instead
of having the <tt>CommandLine</tt> library print out the usual version string
@@ -1702,6 +1701,12 @@ is used to convert boolean strings to a boolean value. Currently accepted
strings are "<tt>true</tt>", "<tt>TRUE</tt>", "<tt>True</tt>", "<tt>1</tt>",
"<tt>false</tt>", "<tt>FALSE</tt>", "<tt>False</tt>", and "<tt>0</tt>".</li>
<li><a name="boolOrDefaultparser">The <b><tt>parser&lt;boolOrDefault&gt;</tt>
specialization</b></a> is used for cases where the value is boolean,
but we also need to know whether the option was specified at all. boolOrDefault
is an enum with 3 values, BOU_UNSET, BOU_TRUE and BOU_FALSE. This parser accepts
the same strings as <b><tt>parser&lt;bool&gt;</tt></b>.</li>
<li><a name="stringparser">The <b><tt>parser&lt;string&gt;</tt>
specialization</b></a> simply stores the parsed string into the string value
specified. No conversion or modification of the data is performed.</li>
@@ -1775,7 +1780,7 @@ it.</p>
<p>This approach works well in situations where you would line to parse an
option using special syntax for a not-very-special data-type. The drawback of
this approach is that users of your parser have to be aware that they are using
your parser, instead of the builtin ones.</p>
your parser instead of the builtin ones.</p>
</li>
@@ -1799,16 +1804,16 @@ this the default for all <tt>unsigned</tt> options.</p>
</pre></div>
<p>Our new class inherits from the <tt>cl::basic_parser</tt> template class to
fill in the default, boiler plate, code for us. We give it the data type that
we parse into (the last argument to the <tt>parse</tt> method so that clients of
our custom parser know what object type to pass in to the parse method (here we
declare that we parse into '<tt>unsigned</tt>' variables.</p>
fill in the default, boiler plate code for us. We give it the data type that
we parse into, the last argument to the <tt>parse</tt> method, so that clients of
our custom parser know what object type to pass in to the parse method. (Here we
declare that we parse into '<tt>unsigned</tt>' variables.)</p>
<p>For most purposes, the only method that must be implemented in a custom
parser is the <tt>parse</tt> method. The <tt>parse</tt> method is called
whenever the option is invoked, passing in the option itself, the option name,
the string to parse, and a reference to a return value. If the string to parse
is not well formed, the parser should output an error message and return true.
is not well-formed, the parser should output an error message and return true.
Otherwise it should return false and set '<tt>Val</tt>' to the parsed value. In
our example, we implement <tt>parse</tt> as:</p>

View File

@@ -199,7 +199,7 @@
</ul></td>
<td class="td_left"><ul>
<li>LLVM Assembly</li>
<li>LLVM Bytecode</li>
<li>LLVM Bitcode</li>
<li>LLVM C++ IR</li>
</ul></td>
<td class="td_left"><dl>
@@ -215,10 +215,10 @@
<td><b>Optimization</b></td>
<td class="td_left"><ul>
<li>LLVM Assembly</li>
<li>LLVM Bytecode</li>
<li>LLVM Bitcode</li>
</ul></td>
<td class="td_left"><ul>
<li>LLVM Bytecode</li>
<li>LLVM Bitcode</li>
</ul></td>
<td class="td_left"><dl>
<dt><tt>-Ox</tt>
@@ -229,13 +229,13 @@
<tr>
<td><b>Linking</b></td>
<td class="td_left"><ul>
<li>LLVM Bytecode</li>
<li>LLVM Bitcode</li>
<li>Native Object Code</li>
<li>LLVM Library</li>
<li>Native Library</li>
</ul></td>
<td class="td_left"><ul>
<li>LLVM Bytecode Executable</li>
<li>LLVM Bitcode Executable</li>
<li>Native Executable</li>
</ul></td>
<td class="td_left"><dl>
@@ -291,7 +291,7 @@ should be invoked. Users may but are not advised to alter the compiler's
available command line options for those programs regardless of whether they
were written for LLVM or not. Furthermore, not all compiler tools will
have the same capabilities. Some compiler tools will simply generate LLVM assembly
code, others will be able to generate fully optimized byte code. In general,
code, others will be able to generate fully optimized bitcode. In general,
<tt>llvmc</tt> doesn't make any assumptions about the capabilities or command
line options of a sub-tool. It simply uses the details found in the
configuration files and leaves it to the compiler writer to specify the
@@ -299,9 +299,9 @@ configuration correctly.</p>
<p>This approach means that new compiler tools can be up and working very
quickly. As a first cut, a tool can simply compile its source to raw
(unoptimized) bytecode or LLVM assembly and <tt>llvmc</tt> can be configured
to pick up the slack (translate LLVM assembly to bytecode, optimize the
bytecode, generate native assembly, link, etc.). In fact, the compiler tools
(unoptimized) bitcode or LLVM assembly and <tt>llvmc</tt> can be configured
to pick up the slack (translate LLVM assembly to bitcode, optimize the
bitcode, generate native assembly, link, etc.). In fact, the compiler tools
need not use any LLVM libraries, and it could be written in any language
(instead of C++). The configuration data will allow the full range of
optimization, assembly, and linking capabilities that LLVM provides to be added
@@ -309,7 +309,7 @@ to these kinds of tools. Enabling the rapid development of front-ends is one
of the primary goals of <tt>llvmc</tt>.</p>
<p>As a compiler tool matures, it may utilize the LLVM libraries and tools
to more efficiently produce optimized bytecode directly in a single compilation
to more efficiently produce optimized bitcode directly in a single compilation
and optimization program. In these cases, multiple tools would not be needed
and the configuration data for the compiler would change.</p>
@@ -532,10 +532,10 @@ optimization.</p>
</tr>
<tr>
<td><b>translator.output</b></td>
<td><tt>bytecode</tt> or <tt>assembly</tt></td>
<td><tt>bitcode</tt> or <tt>assembly</tt></td>
<td class="td_left">This item specifies the kind of output the language's
translator generates.</td>
<td><tt>bytecode</tt></td>
<td><tt>bitcode</tt></td>
</tr>
<tr>
<td><b>translator.preprocesses</b></td>
@@ -556,10 +556,10 @@ optimization.</p>
</tr>
<tr>
<td><b>optimizer.output</b></td>
<td><tt>bytecode</tt> or <tt>assembly</tt></td>
<td><tt>bitcode</tt> or <tt>assembly</tt></td>
<td class="td_left">This item specifies the kind of output the language's
optimizer generates. Valid values are "assembly" and "bytecode"</td>
<td><tt>bytecode</tt></td>
optimizer generates. Valid values are "assembly" and "bitcode"</td>
<td><tt>bitcode</tt></td>
</tr>
<tr>
<td><b>optimizer.preprocesses</b></td>
@@ -724,7 +724,7 @@ optimization.</p>
translator.required=true
# stkrc doesn't handle the -On options
translator.output=bytecode
translator.output=bitcode
##########################################################
# Optimizer definitions
@@ -742,7 +742,7 @@ optimization.</p>
# opt doesn't preprocess
optimizer.preprocesses=no
# opt produces bytecode
# opt produces bitcode
optimizer.output = bc
##########################################################
@@ -761,7 +761,7 @@ optimization.</p>
defined below.</p>
<dl>
<dt><a name="def_assembly"><b>assembly</b></a></dt>
<dd>A compilation <a href="#def_phase">phase</a> in which LLVM bytecode or
<dd>A compilation <a href="#def_phase">phase</a> in which LLVM bitcode or
LLVM assembly code is assembled to a native code format (either target
specific aseembly language or the platform's native object file format).
</dd>
@@ -774,12 +774,12 @@ optimization.</p>
<dd>Refers to <tt>llvmc</tt> itself.</dd>
<dt><a name="def_linking"><b>linking</b></a></dt>
<dd>A compilation <a href="#def_phase">phase</a> in which LLVM bytecode files
<dd>A compilation <a href="#def_phase">phase</a> in which LLVM bitcode files
and (optionally) native system libraries are combined to form a complete
executable program.</dd>
<dt><a name="def_optimization"><b>optimization</b></a></dt>
<dd>A compilation <a href="#def_phase">phase</a> in which LLVM bytecode is
<dd>A compilation <a href="#def_phase">phase</a> in which LLVM bitcode is
optimized.</dd>
<dt><a name="def_phase"><b>phase</b></a></dt>
@@ -804,7 +804,7 @@ optimization.</p>
<dt><a name="def_translation"><b>translation</b></a></dt>
<dd>A compilation <a href="#def_phase">phase</a> in which
<a href="#def_sourcelanguage">source language</a> code is translated into
either LLVM assembly language or LLVM bytecode.</dd>
either LLVM assembly language or LLVM bitcode.</dd>
</dl>
</div>
<!-- *********************************************************************** -->

View File

@@ -15,6 +15,7 @@
<li><a href="#informed">Stay Informed</a></li>
<li><a href="#patches">Making a Patch</a></li>
<li><a href="#reviews">Code Reviews</a></li>
<li><a href="#owners">Code Owners</a></li>
<li><a href="#testcases">Test Cases</a></li>
<li><a href="#quality">Quality</a></li>
<li><a href="#commitaccess">Obtaining Commit Access</a></li>
@@ -46,7 +47,7 @@
<ol>
<li>Attract both users and developers to the LLVM project.</li>
<li>Make life as simple and easy for contributors as possible.</li>
<li>Keep the top of tree CVS/SVN trees as stable as possible.</li>
<li>Keep the top of Subversion trees as stable as possible.</li>
</ol>
<p>This policy is aimed at frequent contributors to LLVM. People interested in
@@ -93,16 +94,15 @@
<p>When making a patch for review, the goal is to make it as easy for the
reviewer to read it as possible. As such, we recommend that you:</p>
<ol>
<li>Make your patch against the CVS HEAD (main development trunk),
not a branch, and not an old version of LLVM. This makes it easy to
apply the patch.</li>
<li>Make your patch against the Subversion trunk, not a branch, and not an
old version of LLVM. This makes it easy to apply the patch.</li>
<li>Similarly, patches should be submitted soon after they are generated.
Old patches may not apply correctly if the underlying code changes between
the time the patch was created and the time it is applied.</li>
<li>Patches should be made with this command:
<pre>cvs diff -Ntdup -5</pre>
<pre>svn diff -x -u</pre>
or with the utility <tt>utils/mkpatch</tt>, which makes it easy to read the
diff.</li>
@@ -141,11 +141,55 @@
<p>Developers should participate in code reviews as both reviewers and
reviewees. If someone is kind enough to review your code, you should
return the favor for someone else. Note that anyone is welcome to review
and give feedback on a patch, but only people with CVS write access can
approve it.</p>
and give feedback on a patch, but only people with Subversion write access
can approve it.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"> <a name="owners">Code Owners</a></div>
<div class="doc_text">
<p>The LLVM Project relies on two features of its process to maintain rapid
development in addition to the high quality of its source base: the
combination of code review plus post-commit review for trusted maintainers.
Having both is a great way for the project to take advantage of the fact
that most people do the right thing most of the time, and only commit
patches without pre-commit review when they are confident they are
right.</p>
<p>The trick to this is that the project has to guarantee that all patches
that are committed are reviewed after they go in: you don't want everyone
to assume someone else will review it, allowing the patch to go unreviewed.
To solve this problem, we have a notion of an 'owner' for a piece of the
code. The sole responsibility of a code owner is to ensure that a commit
to their area of the code is appropriately reviewed, either by themself or
by someone else. The current code owners are:</p>
<ol>
<li><b>Anton Korobeynikov</b>: Exception handling, debug information, and
Windows codegen.</li>
<li><b>Duncan Sands</b>: llvm-gcc 4.2.</li>
<li><b>Evan Cheng</b>: Code generator and all targets.</li>
<li><b>Chris Lattner</b>: Everything else.</li>
</ol>
<p>Note that code ownership is completely different than reviewers: anyone can
review a piece of code, and we welcome code review from anyone who is
interested. Code owners are the "last line of defense" to guarantee that
all patches that are committed are actually reviewed.</p>
<p>Being a code owner is a somewhat unglamorous position, but it is incredibly
important for the ongoing success of the project. Because people get busy,
interests change, and unexpected things happen, code ownership is purely
opt-in, and anyone can choose to resign their "title" at any time. For now,
we do not have an official policy on how one gets elected to be a code
owner.
</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"> <a name="testcases">Test Cases</a></div>
<div class="doc_text">
@@ -228,10 +272,32 @@
<p>
We grant commit access to contributors with a track record of submitting high
quality patches. If you would like commit access, please send an email to the
<a href="mailto:llvm-oversight@cs.uiuc.edu">LLVM oversight group</a>.</p>
quality patches. If you would like commit access, please send an email to
<a href="mailto:sabre@nondot.org">Chris</a> with the following information:</p>
<ol>
<li>The user name you want to commit with, e.g. "sabre".</li>
<li>The full name and email address you want message to llvm-commits to come
from, e.g. "Chris Lattner &lt;sabre@nondot.org&gt;".</li>
<li>A "password hash" of the password you want to use, e.g. "2ACR96qjUqsyM".
Note that you don't ever tell us what your password is, you just give it
to us in an encrypted form. To get this, run "htpasswd" (a utility that
comes with apache) in crypt mode (often enabled with "-d"), or find a web
page that will do it for you.</li>
</ol>
<p>Once you've been granted commit access, you should be able to check out an
LLVM tree with an SVN URL of "https://username@llvm.org/..." instead of the
normal anonymous URL of "http://llvm.org/...". The first time you commit
you'll have to type in your password. Note that you may get a warning from
SVN about an untrusted key, you can ignore this. To verify that your commit
access works, please do a test commit (e.g. change a comment or add a blank
line). Your first commit to a repository may require the autogenerated email
to be approved by a mailing list. This is normal, and will be done when
the mailing list owner has time.</p>
<p>If you have recently been granted commit access, these policies apply:</p>
<ol>
<li>You are granted <i>commit-after-approval</i> to all parts of LLVM.
To get approval, submit a <a href="#patches">patch</a> to
@@ -351,28 +417,12 @@ Changes</a></div>
<div class="doc_text">
<p>We believe in correct attribution of contributions to
their contributors. However, we do not want the source code to be littered
with random attributions (this is noisy/distracting and revision control
keeps a perfect history of this anyway). As such, we follow these rules:</p>
<ol>
<li>Developers who originate new files in LLVM should place their name at
the top of the file per the
<a href="CodingStandards.html#scf_commenting">Coding Standards</a>.</li>
<li>There should be only one name at the top of the file and it should be
the person who created the file.</li>
<li>Placing your name in the file does not imply <a
href="#clp">copyright</a>: it is only used to attribute the file to
its original author.</li>
<li>Developers should be aware that after some time has passed, the name at
the top of a file may become meaningless as maintenance/ownership of files
changes. Despite this, once set, the attribution of a file never changes.
Revision control keeps an accurate history of contributions.</li>
<li>Developers should maintain their entry in the
<a href="http://llvm.org/cvsweb/cvsweb.cgi/llvm/CREDITS.TXT?rev=HEAD&amp;content-type=text/x-cvsweb-markup">CREDITS.txt</a>
file to summarize their contributions.</li>
<li>Commit comments should contain correct attribution of the person who
submitted the patch if that person is not the committer (i.e. when a
developer with commit privileges commits a patch for someone else).</li>
</ol>
with random attributions "this code written by J Random Guy" (this is noisy
and distracting. In practice, the revision control system keeps a perfect
history of who change what, and the CREDITS.txt file describes higher-level
contributions.</p>
<p>Overall, please do not add contributor names to the source base.</p>
</div>

View File

@@ -22,14 +22,14 @@
<ol>
<li><a href="#throw">Throw</a></li>
<li><a href="#try_catch">Try/Catch</a></li>
<li><a href="#finallys">Finallys</a></li>
<li><a href="#cleanups">Cleanups</a></li>
<li><a href="#throw_filters">Throw Filters</a></li>
<li><a href="#restrictions">Restrictions</a></li>
</ol></li>
<li><a href="#format_common_intrinsics">Exception Handling Intrinsics</a>
<ol>
<li><a href="#llvm_eh_exception"><tt>llvm.eh.exception</tt></a></li>
<li><a href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a></li>
<li><a href="#llvm_eh_filter"><tt>llvm.eh.filter</tt></a></li>
<li><a href="#llvm_eh_typeid_for"><tt>llvm.eh.typeid.for</tt></a></li>
</ol></li>
<li><a href="#asm">Asm Table Formats</a>
@@ -72,21 +72,20 @@ C/C++.</p>
<p>Exception handling for most programming languages is designed to recover from
conditions that rarely occur during general use of an application. To that end,
exception handling should not interfere with the main flow of an
application&apos;s algorithm by performing checkpointing tasks such as saving
application's algorithm by performing checkpointing tasks such as saving
the current pc or register state.</p>
<p>The Itanium ABI Exception Handling Specification defines a methodology for
providing outlying data in the form of exception tables without inlining
speculative exception handling code in the flow of an application&apos;s main
speculative exception handling code in the flow of an application's main
algorithm. Thus, the specification is said to add "zero-cost" to the normal
execution of an application.</p>
<p>A more complete description of the Itanium ABI exception handling runtime
support of can be found at <a
href="http://www.codesourcery.com/cxx-abi/abi-eh.html">Itanium C++ ABI:
Exception Handling.</a> A description of the exception frame format can be
found at <a
href="http://refspecs.freestandards.org/LSB_3.0.0/LSB-Core-generic/LSB-
Exception Handling.</a> A description of the exception frame format can be found
at <a href="http://refspecs.freestandards.org/LSB_3.0.0/LSB-Core-generic/LSB-
Core-generic/ehframechpt.html">Exception Frames</a>, with details of the Dwarf
specification at <a href="http://www.eagercon.com/dwarf/dwarf3std.htm">Dwarf 3
Standard.</a> A description for the C++ exception table formats can be found at
@@ -212,13 +211,20 @@ further use in the landing pad and catch code.</p>
<p><a href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a> takes a minimum of
three arguments. The first argument is the reference to the exception
structure. The second argument is a reference to the personality function to be
used for this try catch sequence. The remaining arguments are references to the
type infos for each of the catch statements in the order they should be tested.
The <i>catch all</i> (...) is represented with a <tt>null i8*</tt>. The result
of the <a href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a> is the index of
the type info in the corresponding exception table. The LLVM C++ front end
generates code to save this value in an alloca location for further use in the
landing pad and catch code.</p>
used for this try catch sequence. Each of the remaining arguments is either a
reference to the type info for a catch statement,
a <a href="#throw_filters">filter</a> expression,
or the number zero representing a <a href="#cleanups">cleanup</a>.
The exception is tested against the arguments sequentially from first to last.
The result of the <a href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a> is a
positive number if the exception matched a type info, a negative number if it matched
a filter, and zero if it matched a cleanup. If nothing is matched, the behaviour of
the program is <a href="#restrictions">undefined</a>.
The LLVM C++ front end generates code to save the selector value in an alloca
location for further use in the landing pad and catch code.
If a type info matched then the selector value is the index of the type info in
the exception table, which can be obtained using the
<a href="#llvm_eh_typeid_for"><tt>llvm.eh.typeid.for</tt></a> intrinsic.</p>
<p>Once the landing pad has the type info selector, the code branches to the
code for the first catch. The catch then checks the value of the type info
@@ -236,7 +242,7 @@ selector.</p>
<p>Finally, the entry and exit of catch code is bracketed with calls to
<tt>__cxa_begin_catch</tt> and <tt>__cxa_end_catch</tt>.
<tt>__cxa_begin_catch</tt> takes a exception structure reference as an argument
and returns the value of the exception object.</tt> <tt>__cxa_end_catch</tt>
and returns the value of the exception object. <tt>__cxa_end_catch</tt>
takes a exception structure reference as an argument. This function clears the
exception from the exception space. Note: a rethrow from within the catch may
replace this call with a <tt>__cxa_rethrow</tt>.</p>
@@ -245,7 +251,7 @@ replace this call with a <tt>__cxa_rethrow</tt>.</p>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="finallys">Finallys</a>
<a name="cleanups">Cleanups</a>
</div>
<div class="doc_text">
@@ -254,7 +260,12 @@ replace this call with a <tt>__cxa_rethrow</tt>.</p>
from a landing pad to the first catch. Control may actually flow from the
landing pad to clean up code and then to the first catch. Since the required
clean up for each invoke in a try may be different (ex., intervening
constructor), there may be several landing pads for a given try.</p>
constructor), there may be several landing pads for a given try. If cleanups
need to be run, the number zero should be passed as the last
<a href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a> argument.
However for C++ a <tt>null i8*</tt> <a href="#restrictions">must</a> be passed
instead.
</p>
</div>
@@ -268,17 +279,45 @@ constructor), there may be several landing pads for a given try.</p>
<p>C++ allows the specification of which exception types that can be thrown from
a function. To represent this a top level landing pad may exist to filter out
invalid types. To express this in LLVM code the landing pad will call <a
href="#llvm_eh_filter"><tt>llvm.eh.filter</tt></a> instead of <a
href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a>. The arguments are the
same, but what gets created in the exception table is different. <a
href="#llvm_eh_filter"><tt>llvm.eh.filter</tt></a> will return a negative value
if it doesn't find a match. If no match is found then a call to
<tt>__cxa_call_unexpected</tt> should be made, otherwise
length of the filter expression (the number of type infos plus one), followed by
the type infos themselves.
<a href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a> will return a negative
value if the exception does not match any of the type infos. If no match is
found then a call to <tt>__cxa_call_unexpected</tt> should be made, otherwise
<tt>_Unwind_Resume</tt>. Each of these functions require a reference to the
exception structure.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="restrictions">Restrictions</a>
</div>
<div class="doc_text">
<p>The semantics of the invoke instruction require that any exception that
unwinds through an invoke call should result in a branch to the invoke's unwind
label. However such a branch will only happen if the
<a href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a> matches.
Thus in order to ensure correct operation, the front-end must only generate
<a href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a> calls that are
guaranteed to always match whatever exception unwinds through the invoke.
For most languages it is enough to pass zero, indicating the presence of
a <a href="#cleanups">cleanup</a>, as the last
<a href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a> argument.
However for C++ this is not sufficient, because the C++ personality function
will terminate the program if it detects that unwinding the exception only
results in matches with cleanups. For C++ a <tt>null i8*</tt> should
be passed as the last
<a href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a> argument instead.
This is interpreted as a catch-all by the C++ personality function, and will
always match.
</p>
</div>
<!-- ======================================================================= -->
<div class="doc_section">
<a name="format_common_intrinsics">Exception Handling Intrinsics</a>
@@ -315,7 +354,8 @@ exception structure reference.</p>
<div class="doc_text">
<pre>
i32 %<a href="#llvm_eh_selector">llvm.eh.selector</a>(i8*, i8*, i8*, ...)
i32 %<a href="#llvm_eh_selector">llvm.eh.selector.i32</a>(i8*, i8*, i8*, ...)
i64 %<a href="#llvm_eh_selector">llvm.eh.selector.i64</a>(i8*, i8*, i8*, ...)
</pre>
<p>This intrinsic indicates that the exception selector is available at this
@@ -326,32 +366,18 @@ exception selector.</p>
<p><a href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a> takes a minimum of
three arguments. The first argument is the reference to the exception
structure. The second argument is a reference to the personality function to be
used for this try catch sequence. The remaining arguments are references to the
type infos for each of the catch statements in the order they should be tested.
The <i>catch all</i> (...) is represented with a <tt>null i8*</tt>.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection">
<a name="llvm_eh_filter">llvm.eh.filter</a>
</div>
<div class="doc_text">
<pre>
i32 %<a href="#llvm_eh_filter">llvm.eh.filter</a>(i8*, i8*, i8*, ...)
</pre>
<p>This intrinsic indicates that the exception selector is available at this
point in the code. The backend will replace this intrinsic with code to fetch
the second argument of a call. The effect is that the intrinsic result is the
exception selector.</p>
<p><a href="#llvm_eh_filter"><tt>llvm.eh.filter</tt></a> takes a minimum of
three arguments. The first argument is the reference to the exception
structure. The second argument is a reference to the personality function to be
used for this function. The remaining arguments are references to the type infos
for each type that can be thrown by the current function.</p>
used for this try catch sequence. Each of the remaining arguments is either a
reference to the type info for a catch statement,
a <a href="#throw_filters">filter</a> expression,
or the number zero representing a <a href="#cleanups">cleanup</a>.
The exception is tested against the arguments sequentially from first to last.
The result of the <a href="#llvm_eh_selector"><tt>llvm.eh.selector</tt></a> is a
positive number if the exception matched a type info, a negative number if it matched
a filter, and zero if it matched a cleanup. If nothing is matched, the behaviour of
the program is <a href="#restrictions">undefined</a>.
If a type info matched then the selector value is the index of the type info in
the exception table, which can be obtained using the
<a href="#llvm_eh_typeid_for"><tt>llvm.eh.typeid.for</tt></a> intrinsic.</p>
</div>
@@ -362,7 +388,8 @@ for each type that can be thrown by the current function.</p>
<div class="doc_text">
<pre>
i32 %<a href="#llvm_eh_typeid_for">llvm.eh.typeid.for</a>(i8*)
i32 %<a href="#llvm_eh_typeid_for">llvm.eh.typeid.for.i32</a>(i8*)
i64 %<a href="#llvm_eh_typeid_for">llvm.eh.typeid.for.i64</a>(i8*)
</pre>
<p>This intrinsic returns the type info index in the exception table of the
@@ -410,7 +437,7 @@ all functions in the unit.</p>
<div class="doc_text">
<p>An exception table contains information about what actions to take when an
exception is thrown in a particular part of a function&apos;s code. There is
exception is thrown in a particular part of a function's code. There is
one exception table per function except leaf routines and functions that have
only calls to non-throwing functions will not need an exception table.</p>
@@ -427,16 +454,7 @@ only calls to non-throwing functions will not need an exception table.</p>
<ol>
<li><p>Need to create landing pads for code in between explicit landing pads.
The landing pads will have a zero action and a NULL landing pad address and are
used to inform the runtime that the exception should be rethrown.</li></p>
<li><p>Actions for a given function should be folded to save space.</p></li>
<li><p>Filters for inlined functions need to be handled more extensively.
Currently it&apos;s hardwired for one filter per function.</li></p>
<li><p>Testing/Testing/Testing.</li></p>
<li><p>Testing/Testing/Testing.</p></li>
</ol>

View File

@@ -107,19 +107,17 @@ support for it. Generally you must do the following steps:</p>
<dt>Add support to the C backend in <tt>lib/Target/CBackend/</tt></dt>
<dd>Depending on the intrinsic, there are a few ways to implement this. For
most intrinsics, it makes sense to add code to lower your intrinsic in
<tt>LowerIntrinsicCall</tt> in <tt>lib/CodeGen/IntrinsicLowering.cpp</tt>.
Second, if it makes sense to lower the intrinsic to an expanded sequence of C
code in all cases, just emit the expansion in <tt>visitCallInst</tt> in
<tt>Writer.cpp</tt>. If the intrinsic has some way to express it with GCC
(or any other compiler) extensions, it can be conditionally supported based on
the compiler compiling the CBE output (see <tt>llvm.prefetch</tt> for an
example).
Third, if the intrinsic really has no way to be lowered, just have the code
generator emit code that prints an error message and calls abort if executed.
</dd>
most intrinsics, it makes sense to add code to lower your intrinsic in
<tt>LowerIntrinsicCall</tt> in <tt>lib/CodeGen/IntrinsicLowering.cpp</tt>.
Second, if it makes sense to lower the intrinsic to an expanded sequence of
C code in all cases, just emit the expansion in <tt>visitCallInst</tt> in
<tt>Writer.cpp</tt>. If the intrinsic has some way to express it with GCC
(or any other compiler) extensions, it can be conditionally supported based
on the compiler compiling the CBE output (see <tt>llvm.prefetch</tt> for an
example). Third, if the intrinsic really has no way to be lowered, just
have the code generator emit code that prints an error message and calls
abort if executed.</dd>
<dl>
<dt>Add support to the .td file for the target(s) of your choice in
<tt>lib/Target/*/*.td</tt>.</dt>
@@ -127,6 +125,7 @@ generator emit code that prints an error message and calls abort if executed.
the intrinsic, though it may obviously require adding the instructions you
want to generate as well. There are lots of examples in the PowerPC and X86
backend to follow.</dd>
</dl>
</div>
@@ -228,7 +227,7 @@ complicated behavior in a single node (rotate).</p>
<div class="doc_text">
<p><span class="doc_warning">WARNING: adding instructions changes the bytecode
<p><span class="doc_warning">WARNING: adding instructions changes the bitcode
format, and it will take some effort to maintain compatibility with
the previous version.</span> Only add an instruction if it is absolutely
necessary.</p>
@@ -251,8 +250,8 @@ necessary.</p>
add the grammar on how your instruction can be read and what it will
construct as a result</li>
<li><tt>llvm/lib/Bytecode/Reader/Reader.cpp</tt>:
add a case for your instruction and how it will be parsed from bytecode</li>
<li><tt>llvm/lib/Bitcode/Reader/Reader.cpp</tt>:
add a case for your instruction and how it will be parsed from bitcode</li>
<li><tt>llvm/lib/VMCore/Instruction.cpp</tt>:
add a case for how your instruction will be printed out to assembly</li>
@@ -285,7 +284,7 @@ to understand this new instruction.</p>
<div class="doc_text">
<p><span class="doc_warning">WARNING: adding new types changes the bytecode
<p><span class="doc_warning">WARNING: adding new types changes the bitcode
format, and will break compatibility with currently-existing LLVM
installations.</span> Only add new types if it is absolutely necessary.</p>
@@ -348,12 +347,12 @@ bool TypesEqual(const Type *Ty, const Type *Ty2,
<li><tt>llvm/lib/AsmReader/Lexer.l</tt>:
add ability to parse in the type from text assembly</li>
<li><tt>llvm/lib/ByteCode/Writer/Writer.cpp</tt>:
modify <tt>void BytecodeWriter::outputType(const Type *T)</tt> to serialize
<li><tt>llvm/lib/BitCode/Writer/Writer.cpp</tt>:
modify <tt>void BitcodeWriter::outputType(const Type *T)</tt> to serialize
your type</li>
<li><tt>llvm/lib/ByteCode/Reader/Reader.cpp</tt>:
modify <tt>const Type *BytecodeReader::ParseType()</tt> to read your data
<li><tt>llvm/lib/BitCode/Reader/Reader.cpp</tt>:
modify <tt>const Type *BitcodeReader::ParseType()</tt> to read your data
type</li>
<li><tt>llvm/lib/VMCore/AsmWriter.cpp</tt>:

View File

@@ -39,8 +39,8 @@
<li>The <tt>configure</tt> script finds the right C compiler, but it uses the
LLVM linker from a previous build. What do I do?</li>
<li>When creating a dynamic library, I get a strange GLIBC error.</li>
<li>I've updated my source tree from CVS, and now my build is trying to use a
file/directory that doesn't exist.</li>
<li>I've updated my source tree from Subversion, and now my build is trying
to use a file/directory that doesn't exist.</li>
<li>I've modified a Makefile in my source tree, but my build tree keeps using
the old version. What do I do?</li>
<li>I've upgraded to a new version of LLVM, and I get strange build
@@ -50,8 +50,10 @@
<li>Compiling LLVM with GCC 3.3.2 fails, what should I do?</li>
<li>When I use the test suite, all of the C Backend tests fail. What is
wrong?</li>
<li>After CVS update, rebuilding gives the error "No rule to make
target".</li>
<li>After Subversion update, rebuilding gives the error "No rule to make
target".</li>
<li><a href="#llvmc">The <tt>llvmc</tt> program gives me errors/doesn't
work.</a></li>
</ol></li>
<li><a href="#felangs">Source Languages</a>
@@ -87,8 +89,6 @@
<li><a href="#cfe_code">Questions about code generated by the GCC front-end</a>
<ol>
<li><a href="#__main">What is this <tt>__main()</tt> call that gets inserted into
<tt>main()</tt>?</a></li>
<li><a href="#iosinit">What is this <tt>llvm.global_ctors</tt> and
<tt>_GLOBAL__I__tmp_webcompile...</tt> stuff that happens when I
#include &lt;iostream&gt;?</a></li>
@@ -180,14 +180,12 @@ LLVM have been ported to a plethora of platforms.</p>
<p>Some porting problems may exist in the following areas:</p>
<ul>
<li>The GCC front end code is not as portable as the LLVM suite, so it may not
compile as well on unsupported platforms.</li>
compile as well on unsupported platforms.</li>
<li>The LLVM build system relies heavily on UNIX shell tools, like the Bourne
Shell and sed. Porting to systems without these tools (MacOS 9, Plan 9) will
require more effort.</li>
Shell and sed. Porting to systems without these tools (MacOS 9, Plan 9)
will require more effort.</li>
</ul>
</div>
@@ -225,21 +223,23 @@ if it's grabbing the wrong linker/assembler/etc, there are two ways to fix
it:</p>
<ol>
<li><p>Adjust your <tt>PATH</tt> environment variable so that the correct
program appears first in the <tt>PATH</tt>. This may work, but may not be
convenient when you want them <i>first</i> in your path for other
work.</p></li>
program appears first in the <tt>PATH</tt>. This may work, but may not be
convenient when you want them <i>first</i> in your path for other
work.</p></li>
<li><p>Run <tt>configure</tt> with an alternative <tt>PATH</tt> that is
correct. In a Borne compatible shell, the syntax would be:</p>
<p><tt>PATH=[the path without the bad program] ./configure ...</tt></p>
correct. In a Borne compatible shell, the syntax would be:</p>
<div class="doc_code">
<pre>
% PATH=[the path without the bad program] ./configure ...
</pre>
</div>
<p>This is still somewhat inconvenient, but it allows <tt>configure</tt>
to do its work without having to adjust your <tt>PATH</tt>
permanently.</p></li>
to do its work without having to adjust your <tt>PATH</tt>
permanently.</p></li>
</ol>
</div>
@@ -255,8 +255,8 @@ your own version of GCC that has shared libraries enabled by default.</p>
</div>
<div class="question">
<p>I've updated my source tree from CVS, and now my build is trying to use a
file/directory that doesn't exist.</p>
<p>I've updated my source tree from Subversion, and now my build is trying to
use a file/directory that doesn't exist.</p>
</div>
<div class="answer">
@@ -271,12 +271,13 @@ old version. What do I do?</p>
</div>
<div class="answer">
<p>If the Makefile already exists in your object tree, you
can just run the following command in the top level directory of your object
tree:</p>
<p><tt>./config.status &lt;relative path to Makefile&gt;</tt><p>
<div class="doc_code">
<pre>% ./config.status &lt;relative path to Makefile&gt;</pre>
</div>
<p>If the Makefile is new, you will have to modify the configure script to copy
it over.</p>
@@ -311,11 +312,18 @@ clean</tt> and then <tt>make</tt> in the directory that fails to build.</p>
<p>For example, if you built LLVM with the command:</p>
<p><tt>gmake ENABLE_PROFILING=1</tt>
<div class="doc_code">
<pre>% gmake ENABLE_PROFILING=1</pre>
</div>
<p>...then you must run the tests with the following commands:</p>
<p><tt>cd llvm/test<br>gmake ENABLE_PROFILING=1</tt></p>
<div class="doc_code">
<pre>
% cd llvm/test
% gmake ENABLE_PROFILING=1
</pre>
</div>
</div>
@@ -343,27 +351,28 @@ build.</p>
<div class="answer">
<p>This is <a href="http://gcc.gnu.org/PR?13392">a bug in GCC</a>, and
affects projects other than LLVM. Try upgrading or downgrading your GCC.</p>
affects projects other than LLVM. Try upgrading or downgrading your GCC.</p>
</div>
<div class="question">
<p>After CVS update, rebuilding gives the error "No rule to make target".</p>
<p>After Subversion update, rebuilding gives the error "No rule to make
target".</p>
</div>
<div class="answer">
<p>If the error is of the form:</p>
<div class="doc_code">
<tt>
<pre>
gmake[2]: *** No rule to make target `/path/to/somefile', needed by
`/path/to/another/file.d'.<br>
Stop.
</tt>
</pre>
</div>
<p>This may occur anytime files are moved within the CVS repository or removed
entirely. In this case, the best solution is to erase all <tt>.d</tt> files,
which list dependencies for source files, and rebuild:</p>
<p>This may occur anytime files are moved within the Subversion repository or
removed entirely. In this case, the best solution is to erase all
<tt>.d</tt> files, which list dependencies for source files, and rebuild:</p>
<div class="doc_code">
<pre>
@@ -377,6 +386,15 @@ which list dependencies for source files, and rebuild:</p>
rebuilding.</p>
</div>
<div class="question"><p><a name="llvmc">
The <tt>llvmc</tt> program gives me errors/doesn't work.</a></p>
</div>
<div class="answer">
<p><tt>llvmc</tt> is experimental and isn't really supported. We suggest
using <tt>llvm-gcc</tt> instead.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section"><a name="felangs">Source Languages</a></div>
@@ -388,17 +406,15 @@ rebuilding.</p>
available through a special version of GCC that LLVM calls the
<a href="#cfe">C Front End</a></p>
<p>There is an incomplete version of a Java front end available in the
<tt>llvm-java</tt> CVS repository. There is no documentation on this yet so
<tt>java</tt> module. There is no documentation on this yet so
you'll need to download the code, compile it, and try it.</p>
<p>In the <tt>examples/BFtoLLVM</tt> directory is a translator for the
BrainF*** language (2002 Language Specification).</p>
<p>In the <tt>projects/Stacker</tt> directory is a compiler and runtime
<p>In the <tt>stacker</tt> module is a compiler and runtime
library for the Stacker language, a "toy" language loosely based on Forth.</p>
<p>The PyPy developers are working on integrating LLVM into the PyPy backend
so that PyPy language can translate to LLVM.</p>
</div>
<div class="question"><a name="langhlsupp">
<p>What support is there for a higher level source language constructs for
<div class="question"><p><a name="langhlsupp">
What support is there for a higher level source language constructs for
building a compiler?</a></p>
</div>
<div class="answer">
@@ -411,13 +427,12 @@ rebuilding.</p>
of running optimizations, linking, and executable generation.</p>
</div>
<div class="question"><a name="langhlsupp">
<p>I don't understand the GetElementPtr
instruction. Help!</a></p>
<div class="question"><p><a name="langhlsupp">
I don't understand the GetElementPtr instruction. Help!</a></p>
</div>
<div class="answer">
<p>See <a href="GetElementPtr.html">The Often Misunderstood GEP
Instruction</a>.</li>
Instruction</a>.</p>
</div>
<!-- *********************************************************************** -->
@@ -471,11 +486,14 @@ find libcrtend.a.
<p>
The only way this can happen is if you haven't installed the runtime library. To
correct this, do:</p>
<div class="doc_code">
<pre>
% cd llvm/runtime
% make clean ; make install-bytecode
% cd llvm/runtime
% make clean ; make install-bytecode
</pre>
</div>
</div>
<div class="question">
<p>
@@ -510,79 +528,67 @@ C++ support for a processor that does not otherwise have a C++ compiler.
<p>Use commands like this:</p>
<ol>
<li><p>Compile your program as normal with llvm-g++:</p></li>
<div class="doc_code">$ llvm-g++ x.cpp -o program</div>
<p>or:</p>
<li><p>Compile your program as normal with llvm-g++:</p>
<div class="doc_code">
llvm-g++ a.cpp -c<br>
llvm-g++ b.cpp -c<br>
llvm-g++ a.o b.o -o program
<pre>
% llvm-g++ x.cpp -o program
</pre>
</div>
<p>With llvm-gcc3, this will generate program and program.bc. The .bc file is
the LLVM version of the program all linked together.</p>
<p>or:</p>
<li><p>Convert the LLVM code to C code, using the LLC tool with the C
backend:</p></li>
<div class="doc_code">
<pre>
% llvm-g++ a.cpp -c
% llvm-g++ b.cpp -c
% llvm-g++ a.o b.o -o program
</pre>
</div>
<div class="doc_code">$ llc -march=c program.bc -o program.c</div>
<p>With llvm-gcc3, this will generate program and program.bc. The .bc
file is the LLVM version of the program all linked together.</p></li>
<li><p>Finally, compile the c file:</p></li>
<li><p>Convert the LLVM code to C code, using the LLC tool with the C
backend:</p>
<div class="doc_code">$ cc x.c</div>
<div class="doc_code">
<pre>
% llc -march=c program.bc -o program.c
</pre>
</div></li>
<li><p>Finally, compile the C file:</p>
<div class="doc_code">
<pre>
% cc x.c
</pre>
</div></li>
</ol>
<p>Note that, by default, the C backend does not support exception handling.
If you want/need it for a certain program, you can enable it by passing
"-enable-correct-eh-support" to the llc program. The resultant code will
use setjmp/longjmp to implement exception support that is correct but
relatively slow.
</p>
<p>Note that, by default, the C backend does not support exception handling. If
you want/need it for a certain program, you can enable it by passing
"-enable-correct-eh-support" to the llc program. The resultant code will use
setjmp/longjmp to implement exception support that is correct but relatively
slow.</p>
<p>Also note: this specific sequence of commands won't work if you use a
function defined in the C++ runtime library (or any other C++ library). To
access an external C++ library, you must manually
compile libstdc++ to LLVM bytecode, statically link it into your program, then
use the commands above to convert the whole result into C code. Alternatively,
you can compile the libraries and your application into two different chunks
of C code and link them.</p>
<p>Also note: this specific sequence of commands won't work if you use a
function defined in the C++ runtime library (or any other C++ library). To
access an external C++ library, you must manually compile libstdc++ to LLVM
bitcode, statically link it into your program, then use the commands above to
convert the whole result into C code. Alternatively, you can compile the
libraries and your application into two different chunks of C code and link
them.</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="cfe_code">Questions about code generated by the GCC front-end</a>
</div>
<div class="question"><p>
<a name="__main"></a>
What is this <tt>__main()</tt> call that gets inserted into <tt>main()</tt>?
</p></div>
<div class="answer">
<p>
The <tt>__main</tt> call is inserted by the C/C++ compiler in order to guarantee
that static constructors and destructors are called when the program starts up
and shuts down. In C, you can create static constructors and destructors by
using GCC extensions, and in C++ you can do so by creating a global variable
whose class has a ctor or dtor.
</p>
<p>
The actual implementation of <tt>__main</tt> lives in the
<tt>llvm/runtime/GCCLibraries/crtend/</tt> directory in the source-base, and is
linked in automatically when you link the program.
</p>
</div>
<!--=========================================================================-->
<div class="question">
<a name="iosinit"></a>
<p> What is this <tt>llvm.global_ctors</tt> and
@@ -650,12 +656,13 @@ a value that is not defined. You can get these if you do not initialize a
variable before you use it. For example, the C function:</p>
<div class="doc_code">
<tt>int X() { int i; return i; }</tt>
<pre>
int X() { int i; return i; }
</pre>
</div>
<p>Is compiled to "<tt>ret int undef</tt>" because "i" never has a value
specified for it.
</p>
<p>Is compiled to "<tt>ret i32 undef</tt>" because "<tt>i</tt>" never has
a value specified for it.</p>
</div>
<!-- *********************************************************************** -->

File diff suppressed because it is too large Load Diff

View File

@@ -53,7 +53,7 @@
<p>When people are first confronted with the GEP instruction, they tend to
relate it to known concepts from other programming paradigms, most notably C
array indexing and field selection. However, GEP is a little different and
this leads to the following questions, all of which are answered in the
this leads to the following questions; all of which are answered in the
following sections.</p>
<ol>
<li><a href="#firstptr">What is the first index of the GEP instruction?</a>
@@ -74,10 +74,15 @@
<p>The confusion with the first index usually arises from thinking about
the GetElementPtr instruction as if it was a C index operator. They aren't the
same. For example, when we write, in "C":</p>
<pre>
AType* Foo;
...
X = &amp;Foo-&gt;F;</pre>
<div class="doc_code">
<pre>
AType *Foo;
...
X = &amp;Foo-&gt;F;
</pre>
</div>
<p>it is natural to think that there is only one index, the selection of the
field <tt>F</tt>. However, in this example, <tt>Foo</tt> is a pointer. That
pointer must be indexed explicitly in LLVM. C, on the other hand, indexs
@@ -85,8 +90,13 @@
code, you would provide the GEP instruction with two index operands. The
first operand indexes through the pointer; the second operand indexes the
field <tt>F</tt> of the structure, just as if you wrote:</p>
<pre>
X = &amp;Foo[0].F;</pre>
<div class="doc_code">
<pre>
X = &amp;Foo[0].F;
</pre>
</div>
<p>Sometimes this question gets rephrased as:</p>
<blockquote><p><i>Why is it okay to index through the first pointer, but
subsequent pointers won't be dereferenced?</i></p></blockquote>
@@ -96,19 +106,23 @@
the GEP instruction as an operand without any need for accessing memory. It
must, therefore be indexed and requires an index operand. Consider this
example:</p>
<pre>
struct munger_struct {
int f1;
int f2;
};
void munge(struct munger_struct *P)
{
P[0].f1 = P[1].f1 + P[2].f2;
}
...
munger_struct Array[3];
...
munge(Array);</pre>
<div class="doc_code">
<pre>
struct munger_struct {
int f1;
int f2;
};
void munge(struct munger_struct *P) {
P[0].f1 = P[1].f1 + P[2].f2;
}
...
munger_struct Array[3];
...
munge(Array);
</pre>
</div>
<p>In this "C" example, the front end compiler (llvm-gcc) will generate three
GEP instructions for the three indices through "P" in the assignment
statement. The function argument <tt>P</tt> will be the first operand of each
@@ -117,36 +131,50 @@
<tt>struct munger_struct</tt> type, for either the <tt>f1</tt> or
<tt>f2</tt> field. So, in LLVM assembly the <tt>munge</tt> function looks
like:</p>
<pre>
void %munge(%struct.munger_struct* %P) {
entry:
%tmp = getelementptr %struct.munger_struct* %P, i32 1, i32 0
%tmp = load i32* %tmp
%tmp6 = getelementptr %struct.munger_struct* %P, i32 2, i32 1
%tmp7 = load i32* %tmp6
%tmp8 = add i32 %tmp7, %tmp
%tmp9 = getelementptr %struct.munger_struct* %P, i32 0, i32 0
store i32 %tmp8, i32* %tmp9
ret void
}</pre>
<div class="doc_code">
<pre>
void %munge(%struct.munger_struct* %P) {
entry:
%tmp = getelementptr %struct.munger_struct* %P, i32 1, i32 0
%tmp = load i32* %tmp
%tmp6 = getelementptr %struct.munger_struct* %P, i32 2, i32 1
%tmp7 = load i32* %tmp6
%tmp8 = add i32 %tmp7, %tmp
%tmp9 = getelementptr %struct.munger_struct* %P, i32 0, i32 0
store i32 %tmp8, i32* %tmp9
ret void
}
</pre>
</div>
<p>In each case the first operand is the pointer through which the GEP
instruction starts. The same is true whether the first operand is an
argument, allocated memory, or a global variable. </p>
<p>To make this clear, let's consider a more obtuse example:</p>
<pre>
%MyVar = unintialized global i32
...
%idx1 = getelementptr i32* %MyVar, i64 0
%idx2 = getelementptr i32* %MyVar, i64 1
%idx3 = getelementptr i32* %MyVar, i64 2</pre>
<div class="doc_code">
<pre>
%MyVar = unintialized global i32
...
%idx1 = getelementptr i32* %MyVar, i64 0
%idx2 = getelementptr i32* %MyVar, i64 1
%idx3 = getelementptr i32* %MyVar, i64 2
</pre>
</div>
<p>These GEP instructions are simply making address computations from the
base address of <tt>MyVar</tt>. They compute, as follows (using C syntax):
</p>
<ul>
<li> idx1 = (char*) &amp;MyVar + 0</li>
<li> idx2 = (char*) &amp;MyVar + 4</li>
<li> idx3 = (char*) &amp;MyVar + 8</li>
</ul>
<div class="doc_code">
<pre>
idx1 = (char*) &amp;MyVar + 0
idx2 = (char*) &amp;MyVar + 4
idx3 = (char*) &amp;MyVar + 8
</pre>
</div>
<p>Since the type <tt>i32</tt> is known to be four bytes long, the indices
0, 1 and 2 translate into memory offsets of 0, 4, and 8, respectively. No
memory is accessed to make these computations because the address of
@@ -168,10 +196,16 @@
<p>Quick answer: there are no superfluous indices.</p>
<p>This question arises most often when the GEP instruction is applied to a
global variable which is always a pointer type. For example, consider
this:</p><pre>
%MyStruct = uninitialized global { float*, i32 }
...
%idx = getelementptr { float*, i32 }* %MyStruct, i64 0, i32 1</pre>
this:</p>
<div class="doc_code">
<pre>
%MyStruct = uninitialized global { float*, i32 }
...
%idx = getelementptr { float*, i32 }* %MyStruct, i64 0, i32 1
</pre>
</div>
<p>The GEP above yields an <tt>i32*</tt> by indexing the <tt>i32</tt> typed
field of the structure <tt>%MyStruct</tt>. When people first look at it, they
wonder why the <tt>i64 0</tt> index is needed. However, a closer inspection
@@ -205,10 +239,15 @@
access memory in any way. That's what the Load and Store instructions are for.
GEP is only involved in the computation of addresses. For example, consider
this:</p>
<pre>
%MyVar = uninitialized global { [40 x i32 ]* }
...
%idx = getelementptr { [40 x i32]* }* %MyVar, i64 0, i32 0, i64 0, i64 17</pre>
<div class="doc_code">
<pre>
%MyVar = uninitialized global { [40 x i32 ]* }
...
%idx = getelementptr { [40 x i32]* }* %MyVar, i64 0, i32 0, i64 0, i64 17
</pre>
</div>
<p>In this example, we have a global variable, <tt>%MyVar</tt> that is a
pointer to a structure containing a pointer to an array of 40 ints. The
GEP instruction seems to be accessing the 18th integer of the structure's
@@ -218,17 +257,27 @@
GEP instruction never accesses memory, it is illegal.</p>
<p>In order to access the 18th integer in the array, you would need to do the
following:</p>
<pre>
%idx = getelementptr { [40 x i32]* }* %, i64 0, i32 0
%arr = load [40 x i32]** %idx
%idx = getelementptr [40 x i32]* %arr, i64 0, i64 17</pre>
<div class="doc_code">
<pre>
%idx = getelementptr { [40 x i32]* }* %, i64 0, i32 0
%arr = load [40 x i32]** %idx
%idx = getelementptr [40 x i32]* %arr, i64 0, i64 17
</pre>
</div>
<p>In this case, we have to load the pointer in the structure with a load
instruction before we can index into the array. If the example was changed
to:</p>
<pre>
%MyVar = uninitialized global { [40 x i32 ] }
...
%idx = getelementptr { [40 x i32] }*, i64 0, i32 0, i64 17</pre>
<div class="doc_code">
<pre>
%MyVar = uninitialized global { [40 x i32 ] }
...
%idx = getelementptr { [40 x i32] }*, i64 0, i32 0, i64 17
</pre>
</div>
<p>then everything works fine. In this case, the structure does not contain a
pointer and the GEP instruction can index through the global variable,
into the first field of the structure and access the 18th <tt>i32</tt> in the
@@ -244,10 +293,15 @@
<p>If you look at the first indices in these GEP
instructions you find that they are different (0 and 1), therefore the address
computation diverges with that index. Consider this example:</p>
<pre>
%MyVar = global { [10 x i32 ] }
%idx1 = getlementptr { [10 x i32 ] }* %MyVar, i64 0, i32 0, i64 1
%idx2 = getlementptr { [10 x i32 ] }* %MyVar, i64 1</pre>
<div class="doc_code">
<pre>
%MyVar = global { [10 x i32 ] }
%idx1 = getlementptr { [10 x i32 ] }* %MyVar, i64 0, i32 0, i64 1
%idx2 = getlementptr { [10 x i32 ] }* %MyVar, i64 1
</pre>
</div>
<p>In this example, <tt>idx1</tt> computes the address of the second integer
in the array that is in the structure in %MyVar, that is <tt>MyVar+4</tt>. The
type of <tt>idx1</tt> is <tt>i32*</tt>. However, <tt>idx2</tt> computes the
@@ -267,10 +321,15 @@
<p>These two GEP instructions will compute the same address because indexing
through the 0th element does not change the address. However, it does change
the type. Consider this example:</p>
<pre>
%MyVar = global { [10 x i32 ] }
%idx1 = getlementptr { [10 x i32 ] }* %MyVar, i64 1, i32 0, i64 0
%idx2 = getlementptr { [10 x i32 ] }* %MyVar, i64 1</pre>
<div class="doc_code">
<pre>
%MyVar = global { [10 x i32 ] }
%idx1 = getlementptr { [10 x i32 ] }* %MyVar, i64 1, i32 0, i64 0
%idx2 = getlementptr { [10 x i32 ] }* %MyVar, i64 1
</pre>
</div>
<p>In this example, the value of <tt>%idx1</tt> is <tt>%MyVar+40</tt> and
its type is <tt>i32*</tt>. The value of <tt>%idx2</tt> is also
<tt>MyVar+40</tt> but its type is <tt>{ [10 x i32] }*</tt>.</p>

View File

@@ -17,38 +17,37 @@
<li><a href="#quickstart">Getting Started Quickly (A Summary)</a>
<li><a href="#requirements">Requirements</a>
<ol>
<li><a href="#hardware">Hardware</a>
<li><a href="#software">Software</a>
<li><a href="#brokengcc">Broken versions of GCC</a>
<li><a href="#hardware">Hardware</a></li>
<li><a href="#software">Software</a></li>
<li><a href="#brokengcc">Broken versions of GCC and other tools</a></li>
</ol></li>
<li><a href="#starting">Getting Started with LLVM</a>
<ol>
<li><a href="#terminology">Terminology and Notation</a>
<li><a href="#environment">Setting Up Your Environment</a>
<li><a href="#unpack">Unpacking the LLVM Archives</a>
<li><a href="#checkout">Checkout LLVM from CVS</a>
<li><a href="#installcf">Install the GCC Front End</a>
<li><a href="#config">Local LLVM Configuration</a>
<li><a href="#compile">Compiling the LLVM Suite Source Code</a>
<li><a href="#cross-compile">Cross-Compiling LLVM</a>
<li><a href="#objfiles">The Location of LLVM Object Files</a>
<li><a href="#optionalconfig">Optional Configuration Items</a>
<li><a href="#terminology">Terminology and Notation</a></li>
<li><a href="#environment">Setting Up Your Environment</a></li>
<li><a href="#unpack">Unpacking the LLVM Archives</a></li>
<li><a href="#checkout">Checkout LLVM from Subversion</a></li>
<li><a href="#installcf">Install the GCC Front End</a></li>
<li><a href="#config">Local LLVM Configuration</a></li>
<li><a href="#compile">Compiling the LLVM Suite Source Code</a></li>
<li><a href="#cross-compile">Cross-Compiling LLVM</a></li>
<li><a href="#objfiles">The Location of LLVM Object Files</a></li>
<li><a href="#optionalconfig">Optional Configuration Items</a></li>
</ol></li>
<li><a href="#layout">Program layout</a>
<ol>
<li><a href="#cvsdir"><tt>CVS</tt> directories</a>
<li><a href="#examples"><tt>llvm/examples</tt></a>
<li><a href="#include"><tt>llvm/include</tt></a>
<li><a href="#lib"><tt>llvm/lib</tt></a>
<li><a href="#projects"><tt>llvm/projects</tt></a>
<li><a href="#runtime"><tt>llvm/runtime</tt></a>
<li><a href="#test"><tt>llvm/test</tt></a>
<li><a href="#llvmtest"><tt>llvm-test</tt></a>
<li><a href="#tools"><tt>llvm/tools</tt></a>
<li><a href="#utils"><tt>llvm/utils</tt></a>
<li><a href="#win32"><tt>llvm/win32</tt></a>
<li><a href="#examples"><tt>llvm/examples</tt></a></li>
<li><a href="#include"><tt>llvm/include</tt></a></li>
<li><a href="#lib"><tt>llvm/lib</tt></a></li>
<li><a href="#projects"><tt>llvm/projects</tt></a></li>
<li><a href="#runtime"><tt>llvm/runtime</tt></a></li>
<li><a href="#test"><tt>llvm/test</tt></a></li>
<li><a href="#llvmtest"><tt>llvm-test</tt></a></li>
<li><a href="#tools"><tt>llvm/tools</tt></a></li>
<li><a href="#utils"><tt>llvm/utils</tt></a></li>
<li><a href="#win32"><tt>llvm/win32</tt></a></li>
</ol></li>
<li><a href="#tutorial">An Example Using the LLVM Tool Chain</a>
@@ -83,14 +82,14 @@ basic information.</p>
<p>First, LLVM comes in two pieces. The first piece is the LLVM suite. This
contains all of the tools, libraries, and header files needed to use the low
level virtual machine. It contains an assembler, disassembler, bytecode
analyzer and bytecode optimizer. It also contains a test suite that can be
level virtual machine. It contains an assembler, disassembler, bitcode
analyzer and bitcode optimizer. It also contains a test suite that can be
used to test the LLVM tools and the GCC front end.</p>
<p>The second piece is the GCC front end. This component provides a version of
GCC that compiles C and C++ code into LLVM bytecode. Currently, the GCC front
GCC that compiles C and C++ code into LLVM bitcode. Currently, the GCC front
end uses the GCC parser to convert code to LLVM. Once
compiled into LLVM bytecode, a program can be manipulated with the LLVM tools
compiled into LLVM bitcode, a program can be manipulated with the LLVM tools
from the LLVM suite.</p>
<p>
@@ -115,19 +114,19 @@ and performance.
<li>Read the documentation.</li>
<li>Read the documentation.</li>
<li>Remember that you were warned twice about reading the documentation.</li>
<li>Install the GCC front end if you intend to compile C or C++:
<li>Install the llvm-gcc4.0 (or llvm-gcc4.2) front end if you intend to compile C or C++:
<ol>
<li><tt>cd <i>where-you-want-the-C-front-end-to-live</i></tt></li>
<li><tt>gunzip --stdout llvm-gcc.<i>platform</i>.tar.gz | tar -xvf -</tt>
</li>
<li><tt>cd llvm-gcc3.4/<i>platform</i> (llvm-gcc3.4 only)<br>
./fixheaders</tt></li>
<ul><li>If the binary extension is ".bz" use bunzip2 instead of gunzip.</li>
</ul>
<li>Add llvm-gcc's "bin" directory to your PATH variable.</li>
</ol></li>
<li>Get the LLVM Source Code
<ul>
<li>With the distributed files (or use <a href="#checkout">CVS</a>):
<li>With the distributed files (or use <a href="#checkout">SVN</a>):
<ol>
<li><tt>cd <i>where-you-want-llvm-to-live</i></tt>
<li><tt>gunzip --stdout llvm-<i>version</i>.tar.gz | tar -xvf -</tt>
@@ -137,7 +136,7 @@ and performance.
<li><b>[Optional]</b> Get the Test Suite Source Code
<ul>
<li>With the distributed files (or use <a href="#checkout">CVS</a>):
<li>With the distributed files (or use <a href="#checkout">SVN</a>):
<ol>
<li><tt>cd <i>where-you-want-llvm-to-live</i></tt>
<li><tt>cd llvm/projects</tt>
@@ -333,7 +332,7 @@ build requires considerably less space.</p>
<p>The LLVM suite <i>may</i> compile on other platforms, but it is not
guaranteed to do so. If compilation is successful, the LLVM utilities should be
able to assemble, disassemble, analyze, and optimize LLVM bytecode. Code
able to assemble, disassemble, analyze, and optimize LLVM bitcode. Code
generation should work as well, although the generated native code may not work
on your platform.</p>
@@ -385,9 +384,9 @@ href="CFEBuildInstrs.html">try to compile it</a> on your platform.</p>
</tr>
<tr>
<td><a href="https://www.cvshome.org/downloads.html">CVS</a></td>
<td>&ge;1.11</td>
<td>CVS access to LLVM<sup><a href="#sf2">2</a></sup></td>
<td><a href="http://subversion.tigris.org/project_packages.html">SVN</a></td>
<td>&ge;1.3</td>
<td>Subversion access to LLVM<sup><a href="#sf2">2</a></sup></td>
</tr>
<tr>
@@ -446,9 +445,9 @@ href="CFEBuildInstrs.html">try to compile it</a> on your platform.</p>
<li><a name="sf1">Only the C and C++ languages are needed so there's no
need to build the other languages for LLVM's purposes.</a> See
<a href="#brokengcc">below</a> for specific version info.</li>
<li><a name="sf2">You only need CVS if you intend to build from the
<li><a name="sf2">You only need Subversion if you intend to build from the
latest LLVM sources. If you're working from a release distribution, you
don't need CVS.</a></li>
don't need Subversion.</a></li>
<li><a name="sf3">Only needed if you want to run the automated test
suite in the <tt>llvm/test</tt> directory.</a></li>
<li><a name="sf4">If you want to make changes to the configure scripts,
@@ -470,7 +469,6 @@ href="CFEBuildInstrs.html">try to compile it</a> on your platform.</p>
<li><b>date</b> - print the current date/time </li>
<li><b>echo</b> - print to standard output</li>
<li><b>egrep</b> - extended regular expression search utility</li>
<li><b>etags</b> - C/C++ tag file creator for vim/emacs</li>
<li><b>find</b> - find files/dirs in a file system</li>
<li><b>grep</b> - regular expression search utility</li>
<li><b>gzip*</b> - gzip command for distribution generation</li>
@@ -491,7 +489,7 @@ href="CFEBuildInstrs.html">try to compile it</a> on your platform.</p>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="brokengcc">Broken versions of GCC</a>
<a name="brokengcc">Broken versions of GCC and other tools</a>
</div>
<div class="doc_text">
@@ -499,8 +497,8 @@ href="CFEBuildInstrs.html">try to compile it</a> on your platform.</p>
<p>LLVM is very demanding of the host C++ compiler, and as such tends to expose
bugs in the compiler. In particular, several versions of GCC crash when trying
to compile LLVM. We routinely use GCC 3.3.3, 3.4.0, and Apple 4.0.1
successfully with them (however, see below). Other versions of GCC will
probably work as well. GCC versions listed
successfully with them (however, see important notes below). Other versions
of GCC will probably work as well. GCC versions listed
here are known to not work. If you are using one of these versions, please try
to upgrade your GCC to something more recent. If you run into a problem with a
version of GCC not listed here, please <a href="mailto:llvmdev@cs.uiuc.edu">let
@@ -525,8 +523,19 @@ the "<tt>convert_from_eh_region_ranges_1</tt>" GCC function.</p>
possibly others) does not compile LLVM correctly (it appears that exception
handling is broken in some cases). Please download the FSF 3.3.3 or upgrade
to a newer version of GCC.</p>
<p><b>GCC 3.4.x</b> on X86-64/amd64</b>: GCC <a href="http://llvm.org/PR1056">
<p><b>GCC 3.4.0 on linux/x86 (32-bit)</b>: GCC miscompiles portions of the
code generator, causing an infinite loop in the llvm-gcc build when built
with optimizations enabled (i.e. a release build).</p>
<p><b>GCC 3.4.2 on linux/x86 (32-bit)</b>: GCC miscompiles portions of the
code generator at -O3, as with 3.4.0. However gcc 3.4.2 (unlike 3.4.0)
correctly compiles LLVM at -O2. A work around is to build release LLVM
builds with "make ENABLE_OPTIMIZED=1 OPTIMIZE_OPTION=-O2 ..."</p>
<p><b>GCC 3.4.x on X86-64/amd64</b>: GCC <a href="http://llvm.org/PR1056">
miscompiles portions of LLVM</a>.</p>
<p><b>GCC 3.4.4 (CodeSourcery ARM 2005q3-2)</b>: this compiler miscompiles LLVM
when building with optimizations enabled. It appears to work with
"<tt>make ENABLE_OPTIMIZED=1 OPTIMIZE_OPTION=-O1</tt>" or build a debug
build.</p>
<p><b>IA-64 GCC 4.0.0</b>: The IA-64 version of GCC 4.0.0 is known to
miscompile LLVM.</p>
<p><b>Apple Xcode 2.3</b>: GCC crashes when compiling LLVM at -O3 (which is the
@@ -546,6 +555,12 @@ long warning messages complaining that some ".gnu.linkonce.t.*" symbol was
defined in a discarded section. You can safely ignore these messages as they are
erroneous and the linkage is correct. These messages disappear using ld
2.17.</p>
<p><b>GNU binutils 2.17</b>: Binutils 2.17 contains <a
href="http://sourceware.org/bugzilla/show_bug.cgi?id=3111">a bug</a> which
causes huge link times (minutes instead of seconds) when building LLVM. We
recommend upgrading to a newer version (2.17.50.0.4 or later).</p>
</div>
@@ -617,11 +632,11 @@ In order to compile and use LLVM, you may need to set some environment
variables.
<dl>
<dt><tt>LLVM_LIB_SEARCH_PATH</tt>=<tt>/path/to/your/bytecode/libs</tt></dt>
<dt><tt>LLVM_LIB_SEARCH_PATH</tt>=<tt>/path/to/your/bitcode/libs</tt></dt>
<dd>[Optional] This environment variable helps LLVM linking tools find the
locations of your bytecode libraries. It is provided only as a
locations of your bitcode libraries. It is provided only as a
convenience since you can specify the paths using the -L options of the
tools and the C/C++ front-end will automatically use the bytecode files
tools and the C/C++ front-end will automatically use the bitcode files
installed in its
<tt>lib</tt> directory.</dd>
</dl>
@@ -668,32 +683,36 @@ svn://anonsvn.opensource.apple.com/svn/llvm/trunk. </p>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="checkout">Checkout LLVM from CVS</a>
<a name="checkout">Checkout LLVM from Subversion</a>
</div>
<div class="doc_text">
<p>If you have access to our CVS repository, you can get a fresh copy of
the entire source code. All you need to do is check it out from CVS as
<p>If you have access to our Subversion repository, you can get a fresh copy of
the entire source code. All you need to do is check it out from Subvresion as
follows:</p>
<ul>
<li><tt>cd <i>where-you-want-llvm-to-live</i></tt>
<li><tt>cvs -d :pserver:anon@llvm.org:/var/cvs/llvm login</tt>
<li>Hit the return key when prompted for the password.
<li><tt>cvs -z3 -d :pserver:anon@llvm.org:/var/cvs/llvm co
llvm</tt>
<li><tt>cd <i>where-you-want-llvm-to-live</i></tt></li>
<li>Read-Only: <tt>svn co http://llvm.org/svn/llvm-project/llvm/trunk llvm</tt></li>
<li>Read-Write:<tt>svn co https://user@llvm.org/svn/llvm-project/llvm/trunk
llvm</tt></li>
</ul>
<p>This will create an '<tt>llvm</tt>' directory in the current
directory and fully populate it with the LLVM source code, Makefiles,
test directories, and local copies of documentation files.</p>
<p>If you want to get a specific release (as opposed to the most recent
revision), you can specify a label. The following releases have the following
labels:</p>
revision), you can checkout it from the '<tt>tags</tt>' directory (instead of
'<tt>trunk</tt>'). The following releases are located in the following
subdirectories of the '<tt>tags</tt>' directory:</p>
<ul>
<li>Release 2.2: <b>RELEASE_22</b></li>
<li>Release 2.1: <b>RELEASE_21</b></li>
<li>Release 2.0: <b>RELEASE_20</b></li>
<li>Release 1.9: <b>RELEASE_19</b></li>
<li>Release 1.8: <b>RELEASE_18</b></li>
<li>Release 1.7: <b>RELEASE_17</b></li>
@@ -707,14 +726,18 @@ labels:</p>
</ul>
<p>If you would like to get the LLVM test suite (a separate package as of 1.4),
you get it from the CVS repository:</p>
you get it from the Subversion repository:</p>
<div class="doc_code">
<pre>
cd llvm/projects
cvs -z3 -d :pserver:anon@llvm.org:/var/cvs/llvm co llvm-test
% cd llvm/projects
% svn co http://llvm.org/svn/llvm-project/test-suite/trunk llvm-test
</pre>
</div>
<p>By placing it in the <tt>llvm/projects</tt>, it will be automatically
configured by the LLVM configure script as well as automatically updated when
you run <tt>cvs update</tt>.</p>
you run <tt>svn update</tt>.</p>
<p>If you would like to get the GCC front end source code, you can also get it
and build it yourself. Please follow <a href="CFEBuildInstrs.html">these
@@ -769,7 +792,8 @@ much easier now than it was in the past.</p>
<div class="doc_text">
<p>Once checked out from the CVS repository, the LLVM suite source code must be
<p>Once checked out from the Subversion repository, the LLVM suite source
code must be
configured via the <tt>configure</tt> script. This script sets variables in the
various <tt>*.in</tt> files, most notably <tt>llvm/Makefile.config</tt> and
<tt>llvm/include/Config/config.h</tt>. It also populates <i>OBJ_ROOT</i> with
@@ -867,15 +891,16 @@ script to configure the build system:</p>
<p>To configure LLVM, follow these steps:</p>
<ol>
<li>Change directory into the object root directory:
<br>
<tt>cd <i>OBJ_ROOT</i></tt>
<br><br>
<li><p>Change directory into the object root directory:</p>
<li>Run the <tt>configure</tt> script located in the LLVM source tree:
<br>
<tt><i>SRC_ROOT</i>/configure --prefix=/install/path [other options]</tt>
<br><br>
<div class="doc_code"><pre>% cd <i>OBJ_ROOT</i></pre></div></li>
<li><p>Run the <tt>configure</tt> script located in the LLVM source
tree:</p>
<div class="doc_code">
<pre>% <i>SRC_ROOT</i>/configure --prefix=/install/path [other options]</pre>
</div></li>
</ol>
</div>
@@ -919,7 +944,7 @@ builds:</p>
<p>Once you have LLVM configured, you can build it by entering the
<i>OBJ_ROOT</i> directory and issuing the following command:</p>
<p><tt>gmake</tt></p>
<div class="doc_code"><pre>% gmake</pre></div>
<p>If the build fails, please <a href="#brokengcc">check here</a> to see if you
are using a version of GCC that is known not to compile LLVM.</p>
@@ -929,7 +954,7 @@ If you have multiple processors in your machine, you may wish to use some of
the parallel build options provided by GNU Make. For example, you could use the
command:</p>
<p><tt>gmake -j2</tt></p>
<div class="doc_code"><pre>% gmake -j2</pre></div>
<p>There are several special targets which are useful when working with the LLVM
source code:</p>
@@ -959,8 +984,8 @@ source code:</p>
<dt><tt>gmake -C runtime install-bytecode</tt>
<dd>
Assuming you built LLVM into $OBJDIR, when this command is run, it will
install bytecode libraries into the GCC front end's bytecode library
directory. If you need to update your bytecode libraries,
install bitcode libraries into the GCC front end's bitcode library
directory. If you need to update your bitcode libraries,
this is the target to use once you've built them.
<br><br>
</dl>
@@ -1067,12 +1092,12 @@ platforms or configurations using the same source tree.</p>
<ul>
<li><p>Change directory to where the LLVM object files should live:</p>
<p><tt>cd <i>OBJ_ROOT</i></tt></p></li>
<div class="doc_code"><pre>% cd <i>OBJ_ROOT</i></pre></div></li>
<li><p>Run the <tt>configure</tt> script found in the LLVM source
directory:</p>
<p><tt><i>SRC_ROOT</i>/configure</tt></p></li>
<div class="doc_code"><pre>% <i>SRC_ROOT</i>/configure</pre></div></li>
</ul>
<p>The LLVM build will place files underneath <i>OBJ_ROOT</i> in directories
@@ -1120,23 +1145,22 @@ named after the build type:</p>
<p>
If you're running on a Linux system that supports the "<a
href="http://www.tat.physik.uni-tuebingen.de/~rguenth/linux/binfmt_misc.html">
binfmt_misc</a>"
href="http://www.tat.physik.uni-tuebingen.de/~rguenth/linux/binfmt_misc.html">binfmt_misc</a>"
module, and you have root access on the system, you can set your system up to
execute LLVM bytecode files directly. To do this, use commands like this (the
execute LLVM bitcode files directly. To do this, use commands like this (the
first command may not be required if you are already using the module):</p>
<div class="doc_code">
<pre>
$ mount -t binfmt_misc none /proc/sys/fs/binfmt_misc
$ echo ':llvm:M::llvm::/path/to/lli:' &gt; /proc/sys/fs/binfmt_misc/register
$ chmod u+x hello.bc (if needed)
$ ./hello.bc
$ mount -t binfmt_misc none /proc/sys/fs/binfmt_misc
$ echo ':llvm:M::llvm::/path/to/lli:' &gt; /proc/sys/fs/binfmt_misc/register
$ chmod u+x hello.bc (if needed)
$ ./hello.bc
</pre>
</div>
<p>
This allows you to execute LLVM bytecode files directly. Thanks to Jack
This allows you to execute LLVM bitcode files directly. Thanks to Jack
Cummings for pointing this out!
</p>
@@ -1158,13 +1182,6 @@ The following is a brief introduction to code layout:</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="cvsdir"><tt>CVS</tt> directories</a></div>
<div class="doc_text">
<p>Every directory checked out of CVS will contain a <tt>CVS</tt> directory; for
the most part these can just be ignored.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="examples"><tt>llvm/examples</tt></a></div>
<div class="doc_text">
@@ -1217,8 +1234,8 @@ different <a href="#tools">tools</a>.</p>
<dd>This directory holds the source code for the LLVM assembly language parser
library.</dd>
<dt><tt><b>llvm/lib/ByteCode/</b></tt></dt>
<dd>This directory holds code for reading and write LLVM bytecode.</dd>
<dt><tt><b>llvm/lib/BitCode/</b></tt></dt>
<dd>This directory holds code for reading and write LLVM bitcode.</dd>
<dt><tt><b>llvm/lib/Analysis/</b></tt><dd>This directory contains a variety of
different program analyses, such as Dominator Information, Call Graphs,
@@ -1247,7 +1264,7 @@ different <a href="#tools">tools</a>.</p>
source code locations at which the program is executing.</dd>
<dt><tt><b>llvm/lib/ExecutionEngine/</b></tt></dt>
<dd> This directory contains libraries for executing LLVM bytecode directly
<dd> This directory contains libraries for executing LLVM bitcode directly
at runtime in both interpreted and JIT compiled fashions.</dd>
<dt><tt><b>llvm/lib/Support/</b></tt></dt>
@@ -1275,7 +1292,7 @@ different <a href="#tools">tools</a>.</p>
<div class="doc_subsection"><a name="runtime"><tt>llvm/runtime</tt></a></div>
<div class="doc_text">
<p>This directory contains libraries which are compiled into LLVM bytecode and
<p>This directory contains libraries which are compiled into LLVM bitcode and
used when linking programs with the GCC front end. Most of these libraries are
skeleton versions of real libraries; for example, libc is a stripped down
version of glibc.</p>
@@ -1294,13 +1311,16 @@ end to compile.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="llvmtest"><tt>llvm-test</tt></a></div>
<div class="doc_subsection"><a name="llvmtest"><tt>test-suite</tt></a></div>
<div class="doc_text">
<p>This is not a directory in the normal llvm module; it is a separate CVS
module that must be checked out (usually to <tt>projects/llvm-test</tt>). This
<p>This is not a directory in the normal llvm module; it is a separate
Subversion
module that must be checked out (usually to <tt>projects/test-suite</tt>).
This
module contains a comprehensive correctness, performance, and benchmarking
test
suite for LLVM. It is a separate CVS module because not every LLVM user is
suite for LLVM. It is a separate Subversion module because not every LLVM
user is
interested in downloading or building such a comprehensive test suite. For
further details on this test suite, please see the
<a href="TestingGuide.html">Testing Guide</a> document.</p>
@@ -1331,22 +1351,22 @@ information is in the <a href="CommandGuide/index.html">Command Guide</a>.</p>
be configured to utilize both LLVM and non-LLVM compilation tools to enable
pre-processing, translation, optimization, assembly, and linking of programs
all from one command line. <tt>llvmc</tt> also takes care of processing the
dependent libraries found in bytecode. This reduces the need to get the
dependent libraries found in bitcode. This reduces the need to get the
traditional <tt>-l&lt;name&gt;</tt> options right on the command line. Please
note that this tool, while functional, is still experimental and not feature
complete.</dd>
<dt><tt><b>llvm-ar</b></tt></dt>
<dd>The archiver produces an archive containing
the given LLVM bytecode files, optionally with an index for faster
the given LLVM bitcode files, optionally with an index for faster
lookup.</dd>
<dt><tt><b>llvm-as</b></tt></dt>
<dd>The assembler transforms the human readable LLVM assembly to LLVM
bytecode.</dd>
bitcode.</dd>
<dt><tt><b>llvm-dis</b></tt></dt>
<dd>The disassembler transforms the LLVM bytecode to human readable
<dd>The disassembler transforms the LLVM bitcode to human readable
LLVM assembly.</dd>
<dt><tt><b>llvm-ld</b></tt></dt>
@@ -1361,35 +1381,32 @@ information is in the <a href="CommandGuide/index.html">Command Guide</a>.</p>
<dt><tt><b>lli</b></tt></dt>
<dd><tt>lli</tt> is the LLVM interpreter, which
can directly execute LLVM bytecode (although very slowly...). In addition
to a simple interpreter, <tt>lli</tt> also has a tracing mode (entered by
specifying <tt>-trace</tt> on the command line). Finally, for
architectures that support it (currently x86, Sparc, and PowerPC), by default,
<tt>lli</tt> will function as a Just-In-Time compiler (if the
functionality was compiled in), and will execute the code <i>much</i>
faster than the interpreter.</dd>
can directly execute LLVM bitcode (although very slowly...). For architectures
that support it (currently x86, Sparc, and PowerPC), by default, <tt>lli</tt>
will function as a Just-In-Time compiler (if the functionality was compiled
in), and will execute the code <i>much</i> faster than the interpreter.</dd>
<dt><tt><b>llc</b></tt></dt>
<dd> <tt>llc</tt> is the LLVM backend compiler, which
translates LLVM bytecode to a native code assembly file or to C code (with
translates LLVM bitcode to a native code assembly file or to C code (with
the -march=c option).</dd>
<dt><tt><b>llvm-gcc</b></tt></dt>
<dd><tt>llvm-gcc</tt> is a GCC-based C frontend that has been retargeted to
use LLVM as its backend instead of GCC's RTL backend. It can also emit LLVM
byte code or assembly (with the <tt>-emit-llvm</tt> option) instead of the
bitcode or assembly (with the <tt>-emit-llvm</tt> option) instead of the
usual machine code output. It works just like any other GCC compiler,
taking the typical <tt>-c, -S, -E, -o</tt> options that are typically used.
Additionally, the the source code for <tt>llvm-gcc</tt> is available as a
separate CVS module.</dd>
separate Subversion module.</dd>
<dt><tt><b>opt</b></tt></dt>
<dd><tt>opt</tt> reads LLVM bytecode, applies a series of LLVM to LLVM
<dd><tt>opt</tt> reads LLVM bitcode, applies a series of LLVM to LLVM
transformations (which are specified on the command line), and then outputs
the resultant bytecode. The '<tt>opt --help</tt>' command is a good way to
the resultant bitcode. The '<tt>opt --help</tt>' command is a good way to
get a list of the program transformations available in LLVM.<br/>
<dd><tt>opt</tt> can also be used to run a specific analysis on an input
LLVM bytecode file and print out the results. It is primarily useful for
LLVM bitcode file and print out the results. It is primarily useful for
debugging analyses, or familiarizing yourself with what an analysis does.</dd>
</dl>
</div>
@@ -1409,14 +1426,6 @@ are code generators for parts of LLVM infrastructure.</p>
assuming that the other generates correct output. For the full user
manual, run <tt>`perldoc codegen-diff'</tt>.<br><br>
<dt><tt><b>cvsupdate</b></tt> <dd><tt>cvsupdate</tt> is a script that will
update your CVS tree, but produce a much cleaner and more organized output
than simply running <tt>`cvs -z3 up -dP'</tt> will. For example, it will group
together all the new and updated files and modified files in separate
sections, so you can see at a glance what has changed. If you are at the
top of your LLVM CVS tree, running <tt>utils/cvsupdate</tt> is the
preferred way of updating the tree.<br><br>
<dt><tt><b>emacs/</b></tt> <dd>The <tt>emacs</tt> directory contains
syntax-highlighting files which will work with Emacs and XEmacs editors,
providing syntax highlighting support for LLVM assembly files and TableGen
@@ -1444,7 +1453,7 @@ are code generators for parts of LLVM infrastructure.</p>
directory, switch to directory <tt>llvm/tools/llc</tt> and build it,
causing a re-linking of LLC.<br><br>
<dt><tt><b>NightlyTest.pl</b></tt> and
<dt><tt><b>NewNightlyTest.pl</b></tt> and
<tt><b>NightlyTestTemplate.html</b></tt> <dd>These files are used in a
cron script to generate nightly status reports of the functionality of
tools, and the results can be seen by following the appropriate link on
@@ -1487,9 +1496,9 @@ so we only include instructiosn for llvm-gcc4.
<p><b>Note:</b> The <i>gcc4</i> frontend's invocation is <b><i>considerably different</i></b>
from the previous <i>gcc3</i> frontend. In particular, the <i>gcc4</i> frontend <b><i>does not</i></b>
create bytecode by default: <i>gcc4</i> produces native code. As the example below illustrates,
the '--emit-llvm' flag is needed to produce LLVM bytecode output. For <i>makefiles</i> and
<i>configure</i> scripts, the CFLAGS variable needs '--emit-llvm' to produce bytecode
create bitcode by default: <i>gcc4</i> produces native code. As the example below illustrates,
the '--emit-llvm' flag is needed to produce LLVM bitcode output. For <i>makefiles</i> and
<i>configure</i> scripts, the CFLAGS variable needs '--emit-llvm' to produce bitcode
output.</p>
</div>
@@ -1499,41 +1508,46 @@ output.</p>
<div class="doc_text">
<ol>
<li>First, create a simple C file, name it 'hello.c':
<pre>
#include &lt;stdio.h&gt;
int main() {
printf("hello world\n");
return 0;
}
</pre></li>
<li><p>First, create a simple C file, name it 'hello.c':</p>
<div class="doc_code">
<pre>
#include &lt;stdio.h&gt;
int main() {
printf("hello world\n");
return 0;
}
</pre></div></li>
<li><p>Next, compile the C file into a native executable:</p>
<p><tt>% llvm-gcc hello.c -o hello</tt></p>
<div class="doc_code"><pre>% llvm-gcc hello.c -o hello</pre></div>
<p>Note that llvm-gcc works just like GCC by default. The standard -S and
-c arguments work as usual (producing a native .s or .o file,
respectively). </p>
respectively).</p></li>
<li><p>Next, compile the C file into a LLVM bytecode file:</p>
<p><tt>% llvm-gcc -O3 -emit-llvm hello.c -c -o hello.bc</tt></p>
<li><p>Next, compile the C file into a LLVM bitcode file:</p>
<div class="doc_code">
<pre>% llvm-gcc -O3 -emit-llvm hello.c -c -o hello.bc</pre></div>
<p>The -emit-llvm option can be used with the -S or -c options to emit an
LLVM ".ll" or ".bc" file (respectively) for the code. This allows you
to use the <a href="CommandGuide/index.html">standard LLVM tools</a> on
the bytecode file.</p>
the bitcode file.</p>
<p>Unlike llvm-gcc3, llvm-gcc4 correctly responds to -O[0123] arguments.
</p></li>
<li><p>Run the program in both forms. To run the program, use:</p>
<p><tt>% ./hello</tt></p>
<div class="doc_code"><pre>% ./hello</pre></div>
<p>and</p>
<p><tt>% lli hello.bc</tt></p>
<div class="doc_code"><pre>% lli hello.bc</pre></div>
<p>The second examples shows how to invoke the LLVM JIT, <a
href="CommandGuide/html/lli.html">lli</a>.</p></li>
@@ -1541,21 +1555,28 @@ output.</p>
<li><p>Use the <tt>llvm-dis</tt> utility to take a look at the LLVM assembly
code:</p>
<p><tt>% llvm-dis &lt; hello.bc | less</tt><br><br></li>
<div class="doc_code">
<pre>llvm-dis &lt; hello.bc | less</pre>
</div></li>
<li><p>Compile the program to native assembly using the LLC code
generator:</p>
<p><tt>% llc hello.bc -o hello.s</tt></p>
<div class="doc_code"><pre>% llc hello.bc -o hello.s</pre></div></li>
<li><p>Assemble the native assembly language file into a program:</p>
<p><b>Solaris:</b><tt>% /opt/SUNWspro/bin/cc -xarch=v9 hello.s -o hello.native</tt></p>
<p><b>Others:</b><tt>% gcc hello.s -o hello.native</tt></p>
<div class="doc_code">
<pre>
<b>Solaris:</b> % /opt/SUNWspro/bin/cc -xarch=v9 hello.s -o hello.native
<b>Others:</b> % gcc hello.s -o hello.native
</pre>
</div></li>
<li><p>Execute the native code program:</p>
<p><tt>% ./hello.native</tt></p>
<div class="doc_code"><pre>% ./hello.native</pre></div>
<p>Note that using llvm-gcc to compile directly to native code (i.e. when
the -emit-llvm option is not present) does steps 6/7/8 for you.</p>

View File

@@ -57,7 +57,7 @@
<p>To emphasize, there is no C/C++ front end currently available.
<tt>llvm-gcc</tt> is based on GCC, which cannot be bootstrapped using VC++.
Eventually there should be a <tt>llvm-gcc</tt> based on Cygwin or MinGW that
is usable. There is also the option of generating bytecode files on Unix and
is usable. There is also the option of generating bitcode files on Unix and
copying them over to Windows. But be aware the odds of linking C++ code
compiled with <tt>llvm-gcc</tt> with code compiled with VC++ is essentially
zero.</p>
@@ -86,7 +86,7 @@
<ol>
<li>Read the documentation.</li>
<li>Read the documentation.</li>
<li>Seriously, read the documentation.</li>
<li>Remember that you were warned twice about reading the documentation.</li>
<li>Get the Source Code
@@ -99,16 +99,13 @@
<li><tt>cd llvm</tt></li>
</ol></li>
<li>With anonymous CVS access:
<li>With anonymous Subversion access:
<ol>
<li><tt>cd <i>where-you-want-llvm-to-live</i></tt></li>
<li><tt>cvs -d
:pserver:anon@llvm-cvs.cs.uiuc.edu:/var/cvs/llvm login</tt></li>
<li>Hit the return key when prompted for the password.
<li><tt>cvs -z3 -d :pserver:anon@llvm-cvs.cs.uiuc.edu:/var/cvs/llvm
co llvm</tt></li>
<li><tt>svn co http://llvm.org/svn/llvm-project/llvm-top/trunk llvm-top
</tt></li>
<li><tt>make checkout MODULE=llvm</tt>
<li><tt>cd llvm</tt></li>
<li><tt>cvs up -P -d</tt></li>
</ol></li>
</ul></li>
@@ -128,8 +125,8 @@
</ol>
<p>It is strongly encouraged that you get the latest version from CVS. Much
progress has been made since the 1.4 release.</p>
<p>It is strongly encouraged that you get the latest version from Subversion as
changes are continually making the VS support better.</p>
</div>
@@ -175,6 +172,10 @@ progress has been made since the 1.4 release.</p>
not need them and the pre-generated files that come with the source tree
will be used.</p>
<p>
Do not install the LLVM directory tree into a path containing spaces (e.g.
C:\Documents and Settings\...) as the configure step will fail.</p>
</div>
<!-- *********************************************************************** -->
@@ -206,17 +207,13 @@ each of these names with the appropriate pathname on your local system.
All these paths are absolute:</p>
<dl>
<dt>SRC_ROOT
<dd>
This is the top level directory of the LLVM source tree.
<p>
<dt>SRC_ROOT</dt>
<dd><p>This is the top level directory of the LLVM source tree.</p></dd>
<dt>OBJ_ROOT
<dd>
This is the top level directory of the LLVM object tree (i.e. the
tree where object files and compiled programs will be placed. It
is fixed at SRC_ROOT/win32).
<p>
<dt>OBJ_ROOT</dt>
<dd><p>This is the top level directory of the LLVM object tree (i.e. the
tree where object files and compiled programs will be placed. It is
fixed at SRC_ROOT/win32).</p></dd>
</dl>
</div>
@@ -230,12 +227,12 @@ All these paths are absolute:</p>
<p>The object files are placed under <tt>OBJ_ROOT/Debug</tt> for debug builds
and <tt>OBJ_ROOT/Release</tt> for release (optimized) builds. These include
both executables and libararies that your application can link against.
both executables and libararies that your application can link against.</p>
<p>The files that <tt>configure</tt> would create when building on Unix are
created by the <tt>Configure</tt> project and placed in
<tt>OBJ_ROOT/llvm</tt>. You application must have OBJ_ROOT in its include
search path just before <tt>SRC_ROOT/include</tt>.
search path just before <tt>SRC_ROOT/include</tt>.</p>
</div>
@@ -248,57 +245,83 @@ All these paths are absolute:</p>
<div class="doc_text">
<ol>
<li>First, create a simple C file, name it 'hello.c':
<pre>
#include &lt;stdio.h&gt;
int main() {
printf("hello world\n");
return 0;
}
</pre></li>
<li><p>First, create a simple C file, name it 'hello.c':</p>
<li><p>Next, compile the C file into a LLVM bytecode file:</p>
<p><tt>% llvm-gcc -c hello.c -emit-llvm -o hello.bc</tt></p>
<div class="doc_code">
<pre>
#include &lt;stdio.h&gt;
int main() {
printf("hello world\n");
return 0;
}
</pre></div></li>
<p>This will create the result file <tt>hello.bc</tt> which is the LLVM
bytecode that corresponds the the compiled program and the library
facilities that it required. You can execute this file directly using
<tt>lli</tt> tool, compile it to native assembly with the <tt>llc</tt>,
optimize or analyze it further with the <tt>opt</tt> tool, etc.</p>
<li><p>Next, compile the C file into a LLVM bitcode file:</p>
<div class="doc_code">
<pre>
% llvm-gcc -c hello.c -emit-llvm -o hello.bc
</pre>
</div>
<p>This will create the result file <tt>hello.bc</tt> which is the LLVM
bitcode that corresponds the the compiled program and the library
facilities that it required. You can execute this file directly using
<tt>lli</tt> tool, compile it to native assembly with the <tt>llc</tt>,
optimize or analyze it further with the <tt>opt</tt> tool, etc.</p>
<p><b>Note: while you cannot do this step on Windows, you can do it on a
Unix system and transfer <tt>hello.bc</tt> to Windows. Important:
transfer as a binary file!</b></p></li>
Unix system and transfer <tt>hello.bc</tt> to Windows. Important:
transfer as a binary file!</b></p></li>
<li><p>Run the program using the just-in-time compiler:</p>
<p><tt>% lli hello.bc</tt></p></li>
<div class="doc_code">
<pre>
% lli hello.bc
</pre>
</div>
<p>Note: this will only work for trivial C programs. Non-trivial programs
(and any C++ program) will have dependencies on the GCC runtime that
won't be satisfied by the Microsoft runtime libraries.</p>
(and any C++ program) will have dependencies on the GCC runtime that
won't be satisfied by the Microsoft runtime libraries.</p></li>
<li><p>Use the <tt>llvm-dis</tt> utility to take a look at the LLVM assembly
code:</p>
<p><tt>% llvm-dis &lt; hello.bc | more</tt><p></li>
<div class="doc_code">
<pre>
% llvm-dis &lt; hello.bc | more
</pre>
</div></li>
<li><p>Compile the program to C using the LLC code generator:</p>
<p><tt>% llc -march=c hello.bc</tt></p></li>
<div class="doc_code">
<pre>
% llc -march=c hello.bc
</pre>
</div></li>
<li><p>Compile to binary using Microsoft C:</p>
<p><tt>% cl hello.cbe.c</tt></p></li>
<div class="doc_code">
<pre>
% cl hello.cbe.c
</pre>
</div>
<p>Note: this will only work for trivial C programs. Non-trivial programs
(and any C++ program) will have dependencies on the GCC runtime that
won't be satisfied by the Microsoft runtime libraries.</p>
won't be satisfied by the Microsoft runtime libraries.</p></li>
<li><p>Execute the native code program:</p>
<p><tt>% hello.cbe.exe</tt></p></li>
<div class="doc_code">
<pre>
% hello.cbe.exe
</pre>
</div></li>
</ol>
</div>
@@ -335,7 +358,7 @@ out:</p>
<li><a href="http://llvm.org/">LLVM homepage</a></li>
<li><a href="http://llvm.org/doxygen/">LLVM doxygen tree</a></li>
<li><a href="http://llvm.org/docs/Projects.html">Starting a Project
that Uses LLVM</a></li>
that Uses LLVM</a></li>
</ul>
</div>

File diff suppressed because it is too large Load Diff

View File

@@ -67,7 +67,7 @@ information:</p>
<ul>
<li>All information necessary to reproduce the problem.</li>
<li>The reduced test-case that triggers the bug.</li>
<li>The location where you obtained LLVM (if not from our CVS
<li>The location where you obtained LLVM (if not from our Subversion
repository).</li>
</ul>
@@ -242,7 +242,7 @@ JIT, or LLC) and optionally a series of LLVM passes to run. For example:</p>
</div>
<p><tt>bugpoint</tt> will try to narrow down your list of passes to the one pass
that causes an error, and simplify the bytecode file as much as it can to assist
that causes an error, and simplify the bitcode file as much as it can to assist
you. It will print a message letting you know how to reproduce the resulting
error.</p>
@@ -268,7 +268,7 @@ Backend, and then link in the shared object it generates.</p>
<div class="doc_code">
<pre>
bugpoint -run-jit -output=[correct output file] [bytecode file] \
bugpoint -run-jit -output=[correct output file] [bitcode file] \
--tool-args -- [arguments to pass to lli] \
--args -- [program arguments]
</pre>
@@ -278,7 +278,7 @@ bugpoint -run-jit -output=[correct output file] [bytecode file] \
<div class="doc_code">
<pre>
bugpoint -run-llc -output=[correct output file] [bytecode file] \
bugpoint -run-llc -output=[correct output file] [bitcode file] \
--tool-args -- [arguments to pass to llc] \
--args -- [program arguments]
</pre>
@@ -297,7 +297,7 @@ make bugpoint-jit
</div>
<p>At the end of a successful <tt>bugpoint</tt> run, you will be presented
with two bytecode files: a <em>safe</em> file which can be compiled with the C
with two bitcode files: a <em>safe</em> file which can be compiled with the C
backend and the <em>test</em> file which either LLC or the JIT
mis-codegenerates, and thus causes the error.</p>
@@ -306,7 +306,7 @@ the following:</p>
<ol>
<li><p>Regenerate the shared object from the safe bytecode file:</p>
<li><p>Regenerate the shared object from the safe bitcode file:</p>
<div class="doc_code">
<p><tt>
@@ -315,7 +315,7 @@ the following:</p>
</tt></p>
</div></li>
<li><p>If debugging LLC, compile test bytecode native and link with the shared
<li><p>If debugging LLC, compile test bitcode native and link with the shared
object:</p>
<div class="doc_code">
@@ -327,7 +327,7 @@ the following:</p>
</div></li>
<li><p>If debugging the JIT, load the shared object and supply the test
bytecode:</p>
bitcode:</p>
<div class="doc_code">
<p><tt><b>lli</b> -load=safe.so test.bc [program options]</tt></p>

File diff suppressed because it is too large Load Diff

View File

@@ -30,13 +30,19 @@
</tr>
<tr><th colspan="8"><b>- <a href="#D">D</a> -</b></th></tr>
<tr>
<td><a href="#DAG">DAG</a></td>
<td><a href="#Derived_Pointer">Derived Pointer</a></td>
<td><a href="#DSA">DSA</a></td>
<td><a href="#DSE">DSE</a></td>
</tr>
<tr><th colspan="8"><b>- <a href="#G">G</a> -</b></th></tr>
<td><a href="#GC">GC</a></td>
</tr>
<tr><th colspan="8"><b>- <a href="#I">I</a> -</b></th></tr>
<tr>
<td><a href="#IPA">IPA</a></td>
<td><a href="#IPO">IPO</a></td>
<td><a href="#ISel">ISel</a></td>
</tr>
<tr><th colspan="8"><b>- <a href="#L">L</a> -</b></th></tr>
<tr>
@@ -44,6 +50,10 @@
<td><a href="#LICM">LICM</a></td>
<td><a href="#Load-VN">Load-VN</a></td>
</tr>
<tr><th colspan="8"><b>- <a href="#O">O</a> -</b></th></tr>
<tr>
<td><a href="#Object_Pointer">Object Pointer</a></td>
</tr>
<tr><th colspan="8"><b>- <a href="#P">P</a> -</b></th></tr>
<tr>
<td><a href="#PRE">PRE</a></td>
@@ -51,13 +61,16 @@
<tr><th colspan="8"><b>- <a href="#R">R</a> -</b></th></tr>
<tr>
<td><a href="#Reassociation">Reassociation</a></td>
<td><a href="#Root">Root</a></td>
</tr>
<tr><th colspan="8"><b>- <a href="#S">S</a> -</b></th></tr>
<tr>
<td><a href="#Safe_Point">Safe Point</a></td>
<td><a href="#SCC">SCC</a></td>
<td><a href="#SCCP">SCCP</a></td>
<td><a href="#SDISel">SDISel</a></td>
<td><a href="#SRoA">SRoA</a></td>
<td><a href="#SSA">SSA</a></td>
<td><a href="#Stack_Map">Stack Map</a></td>
</tr>
</table>
</div>
@@ -92,13 +105,23 @@ href="http://www.program-transformation.org/Transform/BURG">BURG</a> tool.</dd>
subexpression compuation. For example <tt>(a+b)*(a+b)</tt> has two
subexpressions that are the same: <tt>(a+b)</tt>. This optimization would
perform the addition only once and then perform the multiply (but only if
its compulationally correct/safe).
it's compulationally correct/safe).
</dl>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="D">- D -</a></div>
<div class="doc_text">
<dl>
<dt><a name="DAG"><b>DAG</b></a></dt>
<dd>Directed Acyclic Graph</dd>
<dt><a name="Derived_Pointer"><b>Derived Pointer</b></a></dt>
<dd>A pointer to the interior of an object, such that a garbage collector
is unable to use the pointer for reachability analysis. While a derived
pointer is live, the corresponding object pointer must be kept in a root,
otherwise the collector might free the referenced object. With copying
collectors, derived pointers pose an additional hazard that they may be
invalidated at any <a href="Safe_Point">safe point</a>. This term is used in
opposition to <a href="#Object_Pointer">object pointer</a>.</dd>
<dt><a name="DSA"><b>DSA</b></a></dt>
<dd>Data Structure Analysis</dd>
<dt><a name="DSE"><b>DSE</b></a></dt>
@@ -106,6 +129,24 @@ href="http://www.program-transformation.org/Transform/BURG">BURG</a> tool.</dd>
</dl>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="G">- G -</a></div>
<div class="doc_text">
<dl>
<dt><a name="GC"><b>GC</b></a></dt>
<dd>Garbage Collection. The practice of using reachability analysis instead
of explicit memory management to reclaim unused memory.</dd>
</dl>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="H">- H -</a></div>
<div class="doc_text">
<dl>
<dt><a name="Heap"><b>Heap</b></a></dt>
<dd>In garbage collection, the region of memory which is managed using
reachability analysis.</dd>
</dl>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="I">- I -</a></div>
<div class="doc_text">
<dl>
@@ -116,6 +157,8 @@ href="http://www.program-transformation.org/Transform/BURG">BURG</a> tool.</dd>
<dd>Inter-Procedural Optimization. Refers to any variety of code
optimization that occurs between procedures, functions or compilation units
(modules).</dd>
<dt><a name="IPO"><b>ISel</b></a></dt>
<dd>Instruction Selection.</dd>
</dl>
</div>
<!-- _______________________________________________________________________ -->
@@ -131,6 +174,17 @@ href="http://www.program-transformation.org/Transform/BURG">BURG</a> tool.</dd>
</dl>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="P">- O -</a></div>
<div class="doc_text">
<dl>
<dt><a name="Object_Pointer"><b>Object Pointer</b></a></dt>
<dd>A pointer to an object such that the garbage collector is able to trace
references contained within the object. This term is used in opposition to
<a href="#Derived_Pointer">derived pointer</a>.</dd>
</dl>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsection"><a name="P">- P -</a></div>
<div class="doc_text">
@@ -147,7 +201,12 @@ href="http://www.program-transformation.org/Transform/BURG">BURG</a> tool.</dd>
<dt><a name="Reassociation"><b>Reassociation</b></a></dt> <dd>Rearranging
associative expressions to promote better redundancy elimination and other
optimization. For example, changing (A+B-A) into (B+A-A), permitting it to
be optimized into (B+0) then (B).
be optimized into (B+0) then (B).</dd>
<dt><a name="Root"><b>Root</b></a></dt> <dd>In garbage collection, a
pointer variable lying outside of the <a href="#Heap">heap</a> from which
the collector begins its reachability analysis. In the context of code
generation, "root" almost always refers to a "stack root"&#151;a local or
temporary variable within an executing function.</dd>
</dl>
</div>
@@ -155,6 +214,16 @@ href="http://www.program-transformation.org/Transform/BURG">BURG</a> tool.</dd>
<div class="doc_subsection"><a name="S">- S -</a></div>
<div class="doc_text">
<dl>
<dt><a name="SCC"><b>Safe Point</b></a></dt>
<dd>In garbage collection, it is necessary to identify <a href="#Root">stack
roots</a> so that reachability analysis may proceed. It may be infeasible to
provide this information for every instruction, so instead the information
may is calculated only at designated safe points. With a copying collector,
<a href="#Derived_Pointers">derived pointers</a> must not be retained across
safe points and <a href="#Object_Pointers">object pointers</a> must be
reloaded from stack roots.</dd>
<dt><a name="SDISel"><b>SDISel</b></a></dt>
<dd>Selection DAG Instruction Selection.</dd>
<dt><a name="SCC"><b>SCC</b></a></dt>
<dd>Strongly Connected Component</dd>
<dt><a name="SCCP"><b>SCCP</b></a></dt>
@@ -163,6 +232,10 @@ href="http://www.program-transformation.org/Transform/BURG">BURG</a> tool.</dd>
<dd>Scalar Replacement of Aggregates</dd>
<dt><a name="SSA"><b>SSA</b></a></dt>
<dd>Static Single Assignment</dd>
<dt><a name="Stack_Map"><b>Stack Map</b></a></dt>
<dd>In garbage collection, metadata emitted by the code generator which
identifies <a href="#Root">roots</a> within the stack frame of an executing
function.</dd>
</dl>
</div>
<!-- *********************************************************************** -->

View File

@@ -67,9 +67,9 @@ intermodular optimization, in the compiler tool chain. Its main goal is to let
the developer take advantage of intermodular optimizations without making any
significant changes to the developer's makefiles or build system. This is
achieved through tight integration with the linker. In this model, the linker
treates LLVM bytecode files like native object files and allows mixing and
treates LLVM bitcode files like native object files and allows mixing and
matching among them. The linker uses <a href="#lto">LLVMlto</a>, a dynamically
loaded library, to handle LLVM bytecode files. This tight integration between
loaded library, to handle LLVM bitcode files. This tight integration between
the linker and LLVM optimizer helps to do optimizations that are not possible
in other models. The linker input allows the optimizer to avoid relying on
conservative escape analysis.
@@ -85,9 +85,9 @@ conservative escape analysis.
<p>The following example illustrates the advantages of LTO's integrated
approach and clean interface. This example requires a system linker which
supports LTO through the interface described in this document. Here,
llvm-gcc4 transparently invokes system linker. </p>
llvm-gcc transparently invokes system linker. </p>
<ul>
<li> Input source file <tt>a.c</tt> is compiled into LLVM byte code form.
<li> Input source file <tt>a.c</tt> is compiled into LLVM bitcode form.
<li> Input source file <tt>main.c</tt> is compiled into native object code.
</ul>
<div class="doc_code"><pre>
@@ -131,12 +131,12 @@ int main() {
}
--- command lines ---
$ llvm-gcc4 --emit-llvm -c a.c -o a.o # &lt;-- a.o is LLVM bytecode file
$ llvm-gcc4 -c main.c -o main.o # &lt;-- main.o is native object file
$ llvm-gcc4 a.o main.o -o main # &lt;-- standard link command without any modifications
$ llvm-gcc --emit-llvm -c a.c -o a.o # &lt;-- a.o is LLVM bitcode file
$ llvm-gcc -c main.c -o main.o # &lt;-- main.o is native object file
$ llvm-gcc a.o main.o -o main # &lt;-- standard link command without any modifications
</pre></div>
<p>In this example, the linker recognizes that <tt>foo2()</tt> is an
externally visible symbol defined in LLVM byte code file. This information
externally visible symbol defined in LLVM bitcode file. This information
is collected using <a href="#readllvmobjectfile"> readLLVMObjectFile()</a>.
Based on this information, the linker completes its usual symbol resolution
pass and finds that <tt>foo2()</tt> is not used anywhere. This information
@@ -202,15 +202,15 @@ $ llvm-gcc4 a.o main.o -o main # &lt;-- standard link command without any modifi
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="phase1">Phase 1 : Read LLVM Bytecode Files</a>
<a name="phase1">Phase 1 : Read LLVM Bitcode Files</a>
</div>
<div class="doc_text">
<p>The linker first reads all object files in natural order and collects
symbol information. This includes native object files as well as LLVM byte
code files. In this phase, the linker uses
symbol information. This includes native object files as well as LLVM bitcode
files. In this phase, the linker uses
<a href="#readllvmobjectfile"> readLLVMObjectFile() </a> to collect symbol
information from each LLVM bytecode files and updates its internal global
information from each LLVM bitcode files and updates its internal global
symbol table accordingly. The intent of this interface is to avoid overhead
in the non LLVM case, where all input object files are native object files,
by putting this code in the error path of the linker. When the linker sees
@@ -228,7 +228,7 @@ $ llvm-gcc4 a.o main.o -o main # &lt;-- standard link command without any modifi
<p>In this stage, the linker resolves symbols using global symbol table
information to report undefined symbol errors, read archive members, resolve
weak symbols, etc. The linker is able to do this seamlessly even though it
does not know the exact content of input LLVM bytecode files because it uses
does not know the exact content of input LLVM bitcode files because it uses
symbol information provided by
<a href="#readllvmobjectfile">readLLVMObjectFile()</a>. If dead code
stripping is enabled then the linker collects the list of live symbols.
@@ -237,12 +237,12 @@ $ llvm-gcc4 a.o main.o -o main # &lt;-- standard link command without any modifi
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="phase3">Phase 3 : Optimize Bytecode Files</a>
<a name="phase3">Phase 3 : Optimize Bitcode Files</a>
</div>
<div class="doc_text">
<p>After symbol resolution, the linker updates symbol information supplied
by LLVM bytecode files appropriately. For example, whether certain LLVM
bytecode supplied symbols are used or not. In the example above, the linker
by LLVM bitcode files appropriately. For example, whether certain LLVM
bitcode supplied symbols are used or not. In the example above, the linker
reports that <tt>foo2()</tt> is not used anywhere in the program, including
native <tt>.o</tt> files. This information is used by the LLVM interprocedural
optimizer. The linker uses <a href="#optimizemodules">optimizeModules()</a>
@@ -260,12 +260,12 @@ $ llvm-gcc4 a.o main.o -o main # &lt;-- standard link command without any modifi
<p>In this phase, the linker reads optimized a native object file and
updates the internal global symbol table to reflect any changes. The linker
also collects information about any changes in use of external symbols by
LLVM bytecode files. In the examle above, the linker notes that
LLVM bitcode files. In the examle above, the linker notes that
<tt>foo4()</tt> is not used any more. If dead code stripping is enabled then
the linker refreshes the live symbol information appropriately and performs
dead code stripping.</p>
<p>After this phase, the linker continues linking as if it never saw LLVM
bytecode files.</p>
bitcode files.</p>
</div>
<!-- *********************************************************************** -->
@@ -288,10 +288,10 @@ $ llvm-gcc4 a.o main.o -o main # &lt;-- standard link command without any modifi
<div class="doc_text">
<p>The <tt>LLVMSymbol</tt> class is used to describe the externally visible
functions and global variables, defined in LLVM bytecode files, to the linker.
functions and global variables, defined in LLVM bitcode files, to the linker.
This includes symbol visibility information. This information is used by
the linker to do symbol resolution. For example: function <tt>foo2()</tt> is
defined inside an LLVM bytecode module and it is an externally visible symbol.
defined inside an LLVM bitcode module and it is an externally visible symbol.
This helps the linker connect the use of <tt>foo2()</tt> in native object
files with a future definition of the symbol <tt>foo2()</tt>. The linker
will see the actual definition of <tt>foo2()</tt> when it receives the
@@ -310,12 +310,12 @@ $ llvm-gcc4 a.o main.o -o main # &lt;-- standard link command without any modifi
<div class="doc_text">
<p>The <tt>readLLVMObjectFile()</tt> function is used by the linker to read
LLVM bytecode files and collect LLVMSymbol information. This routine also
supplies a list of externally defined symbols that are used by LLVM bytecode
LLVM bitcode files and collect LLVMSymbol information. This routine also
supplies a list of externally defined symbols that are used by LLVM bitcode
files. The linker uses this symbol information to do symbol resolution.
Internally, <a href="#lto">LLVMlto</a> maintains LLVM bytecode modules in
Internally, <a href="#lto">LLVMlto</a> maintains LLVM bitcode modules in
memory. This function also provides a list of external references used by
bytecode files.</p>
bitcode files.</p>
</div>
<!-- ======================================================================= -->
@@ -325,7 +325,7 @@ $ llvm-gcc4 a.o main.o -o main # &lt;-- standard link command without any modifi
<div class="doc_text">
<p>The linker invokes <tt>optimizeModules</tt> to optimize already read
LLVM bytecode files by applying LLVM intermodular optimization techniques.
LLVM bitcode files by applying LLVM intermodular optimization techniques.
This function runs the LLVM intermodular optimizer and generates native
object code as <tt>.o</tt> files at the name and location provided by the
linker.</p>
@@ -338,7 +338,7 @@ $ llvm-gcc4 a.o main.o -o main # &lt;-- standard link command without any modifi
<div class="doc_text">
<p>The linker may use <tt>getTargetTriple()</tt> to query target architecture
while validating LLVM bytecode file.</p>
while validating LLVM bitcode file.</p>
</div>
<!-- ======================================================================= -->
@@ -347,7 +347,7 @@ $ llvm-gcc4 a.o main.o -o main # &lt;-- standard link command without any modifi
</div>
<div class="doc_text">
<p>Internally, <a href="#lto">LLVMlto</a> maintains LLVM bytecode modules in
<p>Internally, <a href="#lto">LLVMlto</a> maintains LLVM bitcode modules in
memory. The linker may use <tt>removeModule()</tt> method to remove desired
modules from memory. </p>
</div>

View File

@@ -2,8 +2,8 @@
#
# The LLVM Compiler Infrastructure
#
# This file was developed by the LLVM research group and is distributed under
# the University of Illinois Open Source License. See LICENSE.TXT for details.
# This file is distributed under the University of Illinois Open Source
# License. See LICENSE.TXT for details.
#
##===----------------------------------------------------------------------===##
@@ -14,15 +14,14 @@ ifdef BUILD_FOR_WEBSITE
PROJ_OBJ_DIR = .
DOXYGEN = doxygen
# Extract version number from the AC_INT line in configure.ac
# AC_INIT([[llvm]],[[2.0cvs]],[llvmbugs@cs.uiuc.edu])
PACKAGE_VERSION = $(shell grep AC_INIT ../autoconf/configure.ac | sed -e 's/[^,]*,[[][[]//' -e 's/]],.*//')
$(warning VERSION=$(VERSION))
# AC_INIT([[llvm]],[[2.1svn]],[llvmbugs@cs.uiuc.edu])
PACKAGE_VERSION = $(shell grep AC_INIT ../autoconf/configure.ac | sed -e 's/^[^0-9]*\([0-9_.a-zA-Z-]*\).*/\1/' )
$(PROJ_OBJ_DIR)/doxygen.cfg: doxygen.cfg.in
cat $< | sed \
-e 's/@abs_top_srcdir@/../g' \
-e 's/@DOT@/dot/g' \
-e 's/@PACKAGE_VERSION@/$(PACKAGE_VERSION)/g' \
-e 's/@PACKAGE_VERSION@/$(PACKAGE_VERSION)/' \
-e 's/@abs_top_builddir@/../g' > $@
endif

View File

@@ -30,7 +30,7 @@
<ol>
<li><a href="#libraries">Libraries</a>
<ol>
<li><a href="#BCModules">Bytecode Modules</a></li>
<li><a href="#BCModules">Bitcode Modules</a></li>
<li><a href="#LoadableModules">Loadable Modules</a></li>
</ol>
</li>
@@ -260,11 +260,11 @@
</div>
<!-- ======================================================================= -->
<div class="doc_subsubsection"><a name="BCModules">Bytecode Modules</a></div>
<div class="doc_subsubsection"><a name="BCModules">Bitcode Modules</a></div>
<div class="doc_text">
<p>In some situations, it is desireable to build a single bytecode module from
a variety of sources, instead of an archive, shared library, or bytecode
library. Bytecode modules can be specified in addition to any of the other
<p>In some situations, it is desireable to build a single bitcode module from
a variety of sources, instead of an archive, shared library, or bitcode
library. Bitcode modules can be specified in addition to any of the other
types of libraries by defining the <a href="#MODULE_NAME">MODULE_NAME</a>
variable. For example:</p>
<pre><tt>
@@ -273,9 +273,9 @@
MODULE_NAME = mymod
</tt></pre>
<p>will build a module named <tt>mymod.bc</tt> from the sources in the
directory. This module will be an aggregation of all the bytecode modules
derived from the sources. The example will also build a bytecode archive
containing a bytecode module for each compiled source file. The difference is
directory. This module will be an aggregation of all the bitcode modules
derived from the sources. The example will also build a bitcode archive
containing a bitcode module for each compiled source file. The difference is
subtle, but important depending on how the module or library is to be linked.
</p>
</div>
@@ -626,7 +626,7 @@
files. These sources will be built before any other target processing to
ensure they are present.</dd>
<dt><a name="BYTECODE_LIBRARY"><tt>BYTECODE_LIBRARY</tt></a></dt>
<dd>If set to any value, causes a bytecode library (.bc) to be built.</dd>
<dd>If set to any value, causes a bitcode library (.bc) to be built.</dd>
<dt><a name="CONFIG_FILES"><tt>CONFIG_FILES</tt></a></dt>
<dd>Specifies a set of configuration files to be installed.</dd>
<dt><a name="DIRS"><tt>DIRS</tt></a></dt>
@@ -709,9 +709,9 @@
setting this variable without also setting <tt>SHARED_LIBRARY</tt> will have
no effect.</dd>
<dt><a name="MODULE_NAME"><tt>MODULE_NAME</tt></a></dt>
<dd>Specifies the name of a bytecode module to be created. A bytecode
<dd>Specifies the name of a bitcode module to be created. A bitcode
module can be specified in conjunction with other kinds of library builds
or by itself. It constructs from the sources a single linked bytecode
or by itself. It constructs from the sources a single linked bitcode
file.</dd>
<dt><a name="NO_INSTALL"><tt>NO_INSTALL</tt></a></dt>
<dd>Specifies that the build products of the directory should not be
@@ -808,11 +808,6 @@
isn't one.</dd>
<dt><a name="ECHO"><tt>ECHO</tt></a><small>(configured)</small></dt>
<dd>Specifies the path to the <tt>echo</tt> tool for printing output.</dd>
<dt><a name="ETAGS"><tt>ETAGS</tt></a><small>(configured)</small></dt>
<dd>Specifies the path to the <tt>etags</tt> tool.</dd>
<dt><a name="ETAGSFLAGS"><tt>ETAGSFLAGS</tt></a><small>(configured)</small>
</dt>
<dd>Provides flags to be passed to the <tt>etags</tt> tool.</dd>
<dt><a name="EXEEXT"><tt>EXEEXT</tt></a><small>(configured)</small></dt>
<dd>Provides the extension to be used on executables built by the makefiles.
The value may be empty on platforms that do not use file extensions for
@@ -835,7 +830,7 @@
<dt><a name="LLVMGXX"><tt>LLVMGXX</tt></a><small>(defaulted)</small></dt>
<dd>Specifies the path to the LLVM version of the GCC C++ Compiler</dd>
<dt><a name="LLVMLD"><tt>LLVMLD</tt></a><small>(defaulted)</small></dt>
<dd>Specifies the path to the LLVM bytecode linker tool</dd>
<dd>Specifies the path to the LLVM bitcode linker tool</dd>
<dt><a name="LLVM_OBJ_ROOT"><tt>LLVM_OBJ_ROOT</tt></a><small>(configured)
</small></dt>
<dd>Specifies the top directory into which the output of the build is
@@ -884,8 +879,8 @@
<dt><a name="BuildMode"><tt>BuildMode</tt></a></dt>
<dd>The name of the type of build being performed: Debug, Release, or
Profile</dd>
<dt><a name="bytecode_libdir"><tt>bytecode_libdir</tt></a></dt>
<dd>The directory into which bytecode libraries will ultimately be
<dt><a name="bitcode_libdir"><tt>bytecode_libdir</tt></a></dt>
<dd>The directory into which bitcode libraries will ultimately be
installed. This value is derived from the <tt>--prefix</tt> option given to
<tt>configure</tt>.</dd>
<dt><a name="ConfigureScriptFLAGS"><tt>ConfigureScriptFLAGS</tt></a></dt>
@@ -965,7 +960,7 @@
CXX.Flags
DependFiles
DestArchiveLib
DestBytecodeLib
DestBitcodeLib
DestModule
DestRelinkedLib
DestSharedLib

File diff suppressed because it is too large Load Diff

View File

@@ -62,6 +62,7 @@ option</a></li>
<li><a href="#dss_sortedvectorset">A sorted 'vector'</a></li>
<li><a href="#dss_smallset">"llvm/ADT/SmallSet.h"</a></li>
<li><a href="#dss_smallptrset">"llvm/ADT/SmallPtrSet.h"</a></li>
<li><a href="#dss_denseset">"llvm/ADT/DenseSet.h"</a></li>
<li><a href="#dss_FoldingSet">"llvm/ADT/FoldingSet.h"</a></li>
<li><a href="#dss_set">&lt;set&gt;</a></li>
<li><a href="#dss_setvector">"llvm/ADT/SetVector.h"</a></li>
@@ -77,6 +78,11 @@ option</a></li>
<li><a href="#dss_map">&lt;map&gt;</a></li>
<li><a href="#dss_othermap">Other Map-Like Container Options</a></li>
</ul></li>
<li><a href="#ds_bit">BitVector-like containers</a>
<ul>
<li><a href="#dss_bitvector">A dense bitvector</a></li>
<li><a href="#dss_sparsebitvector">A sparse bitvector</a></li>
</ul></li>
</ul>
</li>
<li><a href="#common">Helpful Hints for Common Operations</a>
@@ -97,6 +103,8 @@ complex example</a> </li>
the same way</a> </li>
<li><a href="#iterate_chains">Iterating over def-use &amp;
use-def chains</a> </li>
<li><a href="#iterate_preds">Iterating over predecessors &amp;
successors of blocks</a></li>
</ul>
</li>
<li><a href="#simplechanges">Making simple changes</a>
@@ -106,6 +114,7 @@ use-def chains</a> </li>
<li><a href="#schanges_deleting">Deleting <tt>Instruction</tt>s</a> </li>
<li><a href="#schanges_replacing">Replacing an <tt>Instruction</tt>
with another <tt>Value</tt></a> </li>
<li><a href="#schanges_deletingGV">Deleting <tt>GlobalVariable</tt>s</a> </li>
</ul>
</li>
<!--
@@ -580,9 +589,9 @@ suite, it gives a report that looks like this:</p>
<div class="doc_code">
<pre>
7646 bytecodewriter - Number of normal instructions
725 bytecodewriter - Number of oversized instructions
129996 bytecodewriter - Number of bytecode bytes written
7646 bitcodewriter - Number of normal instructions
725 bitcodewriter - Number of oversized instructions
129996 bitcodewriter - Number of bitcode bytes written
2817 raise - Number of insts DCEd or constprop'd
3213 raise - Number of cast-of-self removed
5046 raise - Number of expression trees converted
@@ -704,6 +713,11 @@ access the container. Based on that, you should use:</p>
iteration, but do not support efficient look-up based on a key.
</li>
<li>a <a href="#ds_bit">bit</a> container provides an efficient way to store and
perform set operations on sets of numeric id's, while automatically
eliminating duplicates. Bit containers require a maximum of 1 bit for each
identifier you want to store.
</li>
</ul>
<p>
@@ -975,6 +989,25 @@ visited in sorted order.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<a name="dss_denseset">"llvm/ADT/DenseSet.h"</a>
</div>
<div class="doc_text">
<p>
DenseSet is a simple quadratically probed hash table. It excels at supporting
small values: it uses a single allocation to hold all of the pairs that
are currently inserted in the set. DenseSet is a great way to unique small
values that are not simple pointers (use <a
href="#dss_smallptrset">SmallPtrSet</a> for pointers). Note that DenseSet has
the same requirements for the value type that <a
href="#dss_densemap">DenseMap</a> has.
</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<a name="dss_FoldingSet">"llvm/ADT/FoldingSet.h"</a>
@@ -1224,7 +1257,7 @@ iterators in a densemap are invalidated whenever an insertion occurs, unlike
map. Also, because DenseMap allocates space for a large number of key/value
pairs (it starts with 64 by default), it will waste a lot of space if your keys
or values are large. Finally, you must implement a partial specialization of
DenseMapKeyInfo for the key that you want, if it isn't already supported. This
DenseMapInfo for the key that you want, if it isn't already supported. This
is required to tell DenseMap about two special marker values (which can never be
inserted into the map) that it needs internally.</p>
@@ -1275,6 +1308,52 @@ expensive. Element iteration does not visit elements in a useful order.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="ds_bit">Bit storage containers (BitVector, SparseBitVector)</a>
</div>
<div class="doc_text">
<p>Unlike the other containers, there are only two bit storage containers, and
choosing when to use each is relatively straightforward.</p>
<p>One additional option is
<tt>std::vector&lt;bool&gt;</tt>: we discourage its use for two reasons 1) the
implementation in many common compilers (e.g. commonly available versions of
GCC) is extremely inefficient and 2) the C++ standards committee is likely to
deprecate this container and/or change it significantly somehow. In any case,
please don't use it.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<a name="dss_bitvector">BitVector</a>
</div>
<div class="doc_text">
<p> The BitVector container provides a fixed size set of bits for manipulation.
It supports individual bit setting/testing, as well as set operations. The set
operations take time O(size of bitvector), but operations are performed one word
at a time, instead of one bit at a time. This makes the BitVector very fast for
set operations compared to other containers. Use the BitVector when you expect
the number of set bits to be high (IE a dense set).
</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
<a name="dss_sparsebitvector">SparseBitVector</a>
</div>
<div class="doc_text">
<p> The SparseBitVector container is much like BitVector, with one major
difference: Only the bits that are set, are stored. This makes the
SparseBitVector much more space efficient than BitVector when the set is sparse,
as well as making set operations O(number of set bits) instead of O(size of
universe). The downside to the SparseBitVector is that setting and testing of random bits is O(N), and on large SparseBitVectors, this can be slower than BitVector. In our implementation, setting or testing bits in sorted order
(either forwards or reverse) is O(1) worst case. Testing and setting bits within 128 bits (depends on size) of the current bit is also O(1). As a general statement, testing/setting bits in a SparseBitVector is O(distance away from last set bit).
</p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
@@ -1459,7 +1538,7 @@ the last line of the last example,</p>
<div class="doc_code">
<pre>
Instruction* pinst = &amp;*i;
Instruction *pinst = &amp;*i;
</pre>
</div>
@@ -1467,7 +1546,7 @@ Instruction* pinst = &amp;*i;
<div class="doc_code">
<pre>
Instruction* pinst = i;
Instruction *pinst = i;
</pre>
</div>
@@ -1535,8 +1614,7 @@ class OurFunctionPass : public FunctionPass {
href="#CallInst">CallInst</a>&gt;(&amp;*i)) {
// <i>We know we've encountered a call instruction, so we</i>
// <i>need to determine if it's a call to the</i>
// <i>function pointed to by m_func or not</i>
// <i>function pointed to by m_func or not.</i>
if (callInst-&gt;getCalledFunction() == targetFunc)
++callCounter;
}
@@ -1545,7 +1623,7 @@ class OurFunctionPass : public FunctionPass {
}
private:
unsigned callCounter;
unsigned callCounter;
};
</pre>
</div>
@@ -1597,7 +1675,7 @@ of <tt>F</tt>:</p>
<div class="doc_code">
<pre>
Function* F = ...;
Function *F = ...;
for (Value::use_iterator i = F-&gt;use_begin(), e = F-&gt;use_end(); i != e; ++i)
if (Instruction *Inst = dyn_cast&lt;Instruction&gt;(*i)) {
@@ -1617,10 +1695,10 @@ the particular <tt>Instruction</tt>):</p>
<div class="doc_code">
<pre>
Instruction* pi = ...;
Instruction *pi = ...;
for (User::op_iterator i = pi-&gt;op_begin(), e = pi-&gt;op_end(); i != e; ++i) {
Value* v = *i;
Value *v = *i;
// <i>...</i>
}
</pre>
@@ -1633,6 +1711,36 @@ for (User::op_iterator i = pi-&gt;op_begin(), e = pi-&gt;op_end(); i != e; ++i)
</div>
<!--_______________________________________________________________________-->
<div class="doc_subsubsection">
<a name="iterate_preds">Iterating over predecessors &amp;
successors of blocks</a>
</div>
<div class="doc_text">
<p>Iterating over the predecessors and successors of a block is quite easy
with the routines defined in <tt>"llvm/Support/CFG.h"</tt>. Just use code like
this to iterate over all predecessors of BB:</p>
<div class="doc_code">
<pre>
#include "llvm/Support/CFG.h"
BasicBlock *BB = ...;
for (pred_iterator PI = pred_begin(BB), E = pred_end(BB); PI != E; ++PI) {
BasicBlock *Pred = *PI;
// <i>...</i>
}
</pre>
</div>
<p>Similarly, to iterate over successors use
succ_iterator/succ_begin/succ_end.</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="simplechanges">Making simple changes</a>
@@ -1665,7 +1773,7 @@ parameters. For example, an <tt>AllocaInst</tt> only <i>requires</i> a
<div class="doc_code">
<pre>
AllocaInst* ai = new AllocaInst(Type::IntTy);
AllocaInst* ai = new AllocaInst(Type::Int32Ty);
</pre>
</div>
@@ -1693,7 +1801,7 @@ used as some kind of index by some other code. To accomplish this, I place an
<div class="doc_code">
<pre>
AllocaInst* pa = new AllocaInst(Type::IntTy, 0, "indexLoc");
AllocaInst* pa = new AllocaInst(Type::Int32Ty, 0, "indexLoc");
</pre>
</div>
@@ -1845,7 +1953,7 @@ AllocaInst* instToReplace = ...;
BasicBlock::iterator ii(instToReplace);
ReplaceInstWithValue(instToReplace-&gt;getParent()-&gt;getInstList(), ii,
Constant::getNullValue(PointerType::get(Type::IntTy)));
Constant::getNullValue(PointerType::get(Type::Int32Ty)));
</pre></div></li>
<li><tt>ReplaceInstWithInst</tt>
@@ -1860,7 +1968,7 @@ AllocaInst* instToReplace = ...;
BasicBlock::iterator ii(instToReplace);
ReplaceInstWithInst(instToReplace-&gt;getParent()-&gt;getInstList(), ii,
new AllocaInst(Type::IntTy, 0, "ptrToReplacedInt"));
new AllocaInst(Type::Int32Ty, 0, "ptrToReplacedInt"));
</pre></div></li>
</ul>
@@ -1878,6 +1986,28 @@ ReplaceInstWithValue, ReplaceInstWithInst -->
</div>
<!--_______________________________________________________________________-->
<div class="doc_subsubsection">
<a name="schanges_deletingGV">Deleting <tt>GlobalVariable</tt>s</a>
</div>
<div class="doc_text">
<p>Deleting a global variable from a module is just as easy as deleting an
Instruction. First, you must have a pointer to the global variable that you wish
to delete. You use this pointer to erase it from its parent, the module.
For example:</p>
<div class="doc_code">
<pre>
<a href="#GlobalVariable">GlobalVariable</a> *GV = .. ;
GV-&gt;eraseFromParent();
</pre>
</div>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="advanced">Advanced Topics</a>
@@ -1912,7 +2042,7 @@ recursive types and late resolution of opaque types makes the situation very
difficult to handle. Fortunately, for the most part, our implementation makes
most clients able to be completely unaware of the nasty internal details. The
primary case where clients are exposed to the inner workings of it are when
building a recursive type. In addition to this case, the LLVM bytecode reader,
building a recursive type. In addition to this case, the LLVM bitcode reader,
assembly parser, and linker also have to be aware of the inner workings of this
system.
</p>
@@ -1957,7 +2087,7 @@ To build this, use the following LLVM APIs:
<a href="#PATypeHolder">PATypeHolder</a> StructTy = OpaqueType::get();
std::vector&lt;const Type*&gt; Elts;
Elts.push_back(PointerType::get(StructTy));
Elts.push_back(Type::IntTy);
Elts.push_back(Type::Int32Ty);
StructType *NewSTy = StructType::get(Elts);
// <i>At this point, NewSTy = "{ opaque*, i32 }". Tell VMCore that</i>

View File

@@ -88,10 +88,10 @@ choosing. You can place it anywhere you like. Rename the directory to match
the name of your project.</li>
<li>
If you downloaded LLVM using CVS, remove all the directories named CVS (and all
the files therein) from your project's new source tree. This will keep CVS
from thinking that your project is inside <tt>llvm/projects/sample</tt>.
</li>
If you downloaded LLVM using Subversion, remove all the directories named .svn
(and all the files therein) from your project's new source tree. This will
keep Subversion from thinking that your project is inside
<tt>llvm/trunk/projects/sample</tt>.</li>
<li>Add your source code and Makefiles to your source tree.</li>

View File

@@ -4,11 +4,11 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="llvm.css" type="text/css">
<title>LLVM 1.9 Release Notes</title>
<title>LLVM 2.2 Release Notes</title>
</head>
<body>
<div class="doc_title">LLVM 1.9 Release Notes</div>
<div class="doc_title">LLVM 2.2 Release Notes</div>
<ol>
<li><a href="#intro">Introduction</a></li>
@@ -23,6 +23,7 @@
<p>Written by the <a href="http://llvm.org">LLVM Team</a><p>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="intro">Introduction</a>
@@ -32,13 +33,10 @@
<div class="doc_text">
<p>This document contains the release notes for the LLVM compiler
infrastructure, release 1.9. Here we describe the status of LLVM, including any
known problems and major improvements from the previous release. The most
up-to-date version of this document (corresponding to LLVM CVS) can be found
on the <a
href="http://llvm.org/releases/">LLVM releases web site</a>. If you are
not reading this on the LLVM web pages, you should probably go there because
this document may be updated after the release.</p>
infrastructure, release 2.2. Here we describe the status of LLVM, including
major improvements from the previous release and any known problems. All LLVM
releases may be downloaded from the <a href="http://llvm.org/releases/">LLVM
releases web site</a>.</p>
<p>For more information about LLVM, including information about the latest
release, please check out the <a href="http://llvm.org/">main LLVM
@@ -46,10 +44,10 @@ web site</a>. If you have questions or comments, the <a
href="http://mail.cs.uiuc.edu/mailman/listinfo/llvmdev">LLVM developer's mailing
list</a> is a good place to send them.</p>
<p>Note that if you are reading this file from CVS or the main LLVM web page,
this document applies to the <i>next</i> release, not the current one. To see
the release notes for the current or previous releases, see the <a
href="http://llvm.org/releases/">releases page</a>.</p>
<p>Note that if you are reading this file from a Subversion checkout or the
main LLVM web page, this document applies to the <i>next</i> release, not the
current one. To see the release notes for a specific releases, please see the
<a href="http://llvm.org/releases/">releases page</a>.</p>
</div>
@@ -61,171 +59,283 @@ href="http://llvm.org/releases/">releases page</a>.</p>
<div class="doc_text">
<p>This is the tenth public release of the LLVM Compiler Infrastructure. This
release incorporates a large number of enhancements, new features, and bug
fixes. We recommend that all users of previous LLVM versions upgrade.
</p>
<p>This is the thirteenth public release of the LLVM Compiler Infrastructure.
It includes many features and refinements from LLVM 2.1.</p>
</div>
<!-- Unfinished features in 2.2:
Index Set Splitting not enabled by default
Machine LICM
Machine Sinking
LegalizeDAGTypes
-->
<!--=========================================================================-->
<div class="doc_subsection">
<a name="deprecation">Deprecated features in LLVM 2.2</a>
</div>
<div class="doc_text">
<p>This is the last LLVM release to support llvm-gcc 4.0, llvm-upgrade, and
llvmc in its current form. llvm-gcc 4.0 has been replaced with llvm-gcc 4.2.
llvm-upgrade is useful for upgrading llvm 1.9 files to llvm 2.x syntax, but you
can always use an old release to do this. llvmc is currently mostly useless in
llvm 2.2, and will be redesigned or removed in llvm 2.3.</p>
</div>
<!--=========================================================================-->
<div class="doc_subsection">
<a name="newfeatures">New Features in LLVM 1.9</a>
<a name="frontends">llvm-gcc 4.0, llvm-gcc 4.2, and clang</a>
</div>
<!--_________________________________________________________________________-->
<div class="doc_subsubsection"><a name="x86-64">New X86-64 Backend</a></div>
<div class="doc_text">
<p>LLVM 1.9 now fully supports the x86-64 instruction set on Mac OS/X, and
supports it on Linux (and other operating systems) when compiling in -static
mode. LLVM includes JIT support for X86-64, and supports both Intel EMT-64T
and AMD-64 architectures. The X86-64 instruction set permits addressing a
64-bit addressing space and provides the compiler with twice the
number of integer registers to use.</p>
<p>LLVM 2.2 fully supports both the llvm-gcc 4.0 and llvm-gcc 4.2 front-ends (in
LLVM 2.1, llvm-gcc 4.2 was beta). Since LLVM 2.1, the llvm-gcc 4.2 front-end
has made leaps and bounds and is now at least as good as 4.0 in virtually every
area, and is better in several areas (for example, exception handling
correctness, support for Ada and Fortran, better ABI compatibility, etc). We
strongly recommend that you
migrate from llvm-gcc 4.0 to llvm-gcc 4.2 in this release cycle because
<b>LLVM 2.2 is the last release that will support llvm-gcc 4.0</b>: LLVM 2.3
will only support the llvm-gcc 4.2 front-end.</p>
<p>The <a href="http://clang.llvm.org/">clang project</a> is an effort to build
a set of new 'llvm native' front-end technologies for the LLVM optimizer
and code generator. Currently, its C and Objective-C support is maturing
nicely, and it has advanced source-to-source analysis and transformation
capabilities. If you are interested in building source-level tools for C and
Objective-C (and eventually C++), you should take a look. However, note that
clang is not an official part of the LLVM 2.2 release. If you are interested in
this project, please see its <a href="http://clang.llvm.org/">web site</a>.</p>
</div>
<!--_________________________________________________________________________-->
<div class="doc_subsubsection"><a name="lto">Link-Time Optimization integration
with native linkers</a></div>
<div class="doc_text">
<p>LLVM now includes <a href="LinkTimeOptimization.html">liblto</a> which can
be used to integrate LLVM Link-Time Optimization support into a native linker.
This allows LLVM .bc to transparently participate with linking an application,
even when some .o files are in LLVM form and some are not.</p>
<!--=========================================================================-->
<div class="doc_subsection">
<a name="majorfeatures">Major New Features</a>
</div>
<!--_________________________________________________________________________-->
<div class="doc_subsubsection"><a name="dwarf">DWARF debugging
support for Linux, Cygwin and MinGW on X86</a></div>
<div class="doc_text">
<p>llvm-gcc4 now supports generating debugging info for Linux, Cygwin and MinGW.
This extends the PPC/Darwin and X86/Darwin debugging support available in the
1.8 release. DWARF is a standard debugging format used on many platforms.</p>
</div>
<!--_________________________________________________________________________-->
<div class="doc_subsubsection"><a name="optimizer">Optimizer
Improvements</a></div>
<div class="doc_text">
<p>The mid-level optimizer is now faster and produces better code in many cases.
Significant changes include:</p>
<p>LLVM 2.2 includes several major new capabilities:</p>
<ul>
<li>LLVM includes a new 'predicate simplifier' pass, which
currently performs dominator tree-based optimizations.</li>
<li>The complete loop unroll pass now supports unrolling of
multiple basic block loops.</li>
<li>The 'globalopt' pass can now perform the scalar replacement of
aggregates transformation on some heap allocations.</li>
<li>The globalsmodref-aa alias analysis can now track 'indirect pointer
globals' more accurately.</li>
<li>The instruction combiner can now perform element propagation
analysis of vector expressions, eliminating computation of vector elements
that are not used.</li>
<li>A research team led by Scott Michel in the Computer Systems Research
Department at The Aerospace Corporation contributed the CellSPU backend, which
generates code for the vector coprocessors on the Sony/Toshiba/IBM Cell BE
processor. llvm-gcc 4.2 supports CellSPU as a 'configure' target and progress
is being made so that libgcc.a compiles cleanly. Notable pieces still in
development include full 64-bit integer and full double precision floating
point support.</li>
<li>Anton and Duncan significantly improved llvm-gcc 4.2 support for the GCC Ada
(GNAT) and Fortran (gfortran) front-ends. These front-ends should still be considered
experimental however: see the <a href="#knownproblems">list of known problems</a>.
The release binaries do not contain either front-end: they need to be built from
source (the Ada front-end only builds on x86-32 linux).</li>
<li>Dale contributed full support for long double on x86/x86-64 (where it is 80
bits) and on Darwin PPC/PPC64 (where it is 128 bits). In previous LLVM
releases, llvm-gcc silently mapped long double to double.</li>
<li>Gordon Henriksen rewrote most of the <a href="GarbageCollection.html"
>Accurate Garbage Collection</a> code in the code generator, making the
generated code more efficient and adding support for the OCaml garbage collector
metadata format.</li>
<li>Christopher Lamb contributed support for multiple address spaces in LLVM
IR. This is useful for supporting targets that have 'near' vs 'far' pointers,
'RAM' vs 'ROM' pointers, or that have non-local memory that can be accessed with
special instructions.</li>
<li>LLVM now includes a new set of detailed <a
href="tutorial/index.html">tutorials</a>, which explain how to implement a
language with LLVM and shows how to use several important APIs.</li>
</ul>
</div>
<!--=========================================================================-->
<div class="doc_subsection">
<a name="coreimprovements">LLVM Core Improvements</a>
</div>
<div class="doc_text">
<p>New features include:
</p>
<ul>
<li>Gordon contributed support for C and OCaml Bindings for the basic LLVM IR
construction routines as well as several other auxiliary APIs.</li>
<li>Anton added readnone/readonly attributes for modeling function side effects.
Duncan hooked up GCC's pure/const attributes to them and enhanced mod/ref
analysis to use them.</li>
<li>Devang added LLVMFoldingBuilder, a version of LLVMBuilder that implicitly
simplifies the code as it is constructed.</li>
<li>Ted Kremenek added a framework for generic object serialization to bitcode
files. This support is only used by clang right now for ASTs but is extensible
and could be used for serializing arbitrary other data into bitcode files.</li>
<li>Duncan improved TargetData to distinguish between the size/alignment of a
type in a register, in memory according to the platform ABI, and in memory when
we have a choice.</li>
<li>Reid moved parameter attributes off of FunctionType and onto functions
and calls. This makes it much easier to add attributes to a function in a
transformation pass.</li>
<li>Dan Gohman added support for vector sin, cos, and pow intrinsics.</li>
</ul>
</div>
<!--_________________________________________________________________________-->
<div class="doc_subsubsection"><a name="codegen">Code
Generator Enhancements</a></div>
<div class="doc_text">
<p>
The LLVM Target-Independent code generator now supports more target features and
optimizes many cases more aggressively. New features include:
</p>
<ul>
<li>LLVM now includes a late branch folding pass which optimizes code
layout, performs several branch optzns, and deletes unreachable code.</li>
<li>The code generator now support targets that have pre/post-increment
addressing modes.</li>
<li>LLVM now supports dynamically-loadable register allocators and
schedulers.</li>
<li>LLVM 1.9 includes several improvements to inline asm support,
including support for new constraints and modifiers.</li>
<li>The register coalescer is now more aggressive than before,
allowing it to eliminate more copies.</li>
</ul>
<p>In addition, the LLVM target description format has itself been extended in
several ways:</p>
<ul>
<li>tblgen now allows definition of '<a
href="TableGenFundamentals.html#multiclass">multiclasses</a>' which can be
used to factor instruction patterns more aggressively in .td files.</li>
<li>LLVM has a new TargetAsmInfo class which captures a variety of
information about the target assembly language format.</li>
<li>.td files now support "<tt>${:foo}</tt>" syntax for encoding
subtarget-specific assembler syntax into instruction descriptions.</li>
</ul>
<p>Further, several significant target-specific enhancements are included in
LLVM 1.9:</p>
<ul>
<li>The LLVM ARM backend now supports more instructions
and the use of a frame pointer. It is now possible to build
libgcc and a simple cross compiler, but it is not considered "complete" yet.
</li>
<li>LLVM supports the Win32 dllimport/dllexport linkage and
stdcall/fastcall calling conventions.</li>
</ul>
<!--=========================================================================-->
<div class="doc_subsection">
<a name="codegen">Code Generator Improvements</a>
</div>
<!--_________________________________________________________________________-->
<div class="doc_subsubsection"><a name="other">Other Improvements</a></div>
<div class="doc_text">
<p>This release includes many other improvements, including improvements to
the optimizers and code generators (improving the generated code) changes to
speed up the compiler in many ways (improving algorithms and fine tuning
code), and changes to reduce the code size of the compiler itself.</p>
<p>More specific changes include:</p>
<p>We put a significant amount of work into the code generator infrastructure,
which allows us to implement more aggressive algorithms and make it run
faster:</p>
<ul>
<li>The llvm-test framework now supports SPEC2006.</li>
<li>LLVM now includes a <a href="GetElementPtr.html">FAQ about the
<tt>getelementptr</tt> instruction</a>.</li>
<li>Bugpoint now supports a new "<tt>-find-bugs</tt>" mode. This mode makes
bugpoint permute pass sequences to try to expose bugs due to pass
sequencing.</li>
<li>The JIT now supports lazily streaming code from multiple modules at a
time, implicitly linking the code as it goes.</li>
<li>Owen refactored the existing LLVM dominator and loop information code to
allow it work on the machine code representation. He contributed support for
dominator and loop information on machine code and merged the code for forward
and backward dominator computation.</li>
<li>Dan added support for emitting debug information with .file and .loc
directives on platforms that support it, instead of emitting large tables in the .s
file.</li>
<li>Evan extended the DAG scheduler to model physical register dependencies
explicitly and have the BURR scheduler pick a correct schedule based on the
dependencies. This reduces our use of the 'flag' operand hack.</li>
<li>Evan added initial support for register coalescing of subregister
references.</li>
<li>Rafael Espindola implemented initial support for a new 'byval' attribute,
which allows more efficient by-value argument passing in the LLVM IR. Evan
finished support for it and enabled it in the X86 (32- and 64-bit) and C
backends.</li>
<li>The LLVM TargetInstrInfo class can now answer queries about the mod/ref and
side-effect behavior of MachineInstr's. This information is inferred
automatically by TableGen from .td files for all instructions with
patterns.</li>
<li>Evan implemented simple live interval splitting on basic block boundaries.
This allows the register allocator to be more successful at keeping values in
registers in some parts of a value's live range, even if they need to be spilled
in some other block.</li>
<li>The new MachineRegisterInfo.h class provides support for efficiently
iterating over all defs/uses of a register, and this information is
automatically kept up-to-date. This support is similar to the use_iterator in
the LLVM IR level.</li>
<li>The MachineInstr, MachineOperand and TargetInstrDesc classes are simpler,
more consistent, and better documented.</li>
</ul>
</div>
<!--=========================================================================-->
<div class="doc_subsection">
<a name="apichanges">Significant API Changes in LLVM 1.9</a>
<a name="optimizer">Optimizer Improvements</a>
</div>
<div class="doc_text">
<p>Several significant API changes have been made. If you are maintaining
out-of-tree code, please be aware that:</p>
<p>In addition to a huge array of bug fixes and minor performance tweaks, the
LLVM 2.2 optimizers support a few major enhancements:</p>
<ul>
<li>The ConstantSInt and ConstantUInt classes have been merged into the
ConstantInt class.</li>
<li><p>As a step towards making LLVM's integer types signless, several new
instructions have been added to LLVM. The <tt>Div</tt> instruction is now
<tt>UDiv</tt>, <tt>SDiv</tt>, and <tt>FDiv</tt>. The <tt>Rem</tt> instruction
is now <tt>URem</tt>, <tt>SRem</tt> and <tt>FRem</tt>. See the
<a href="LangRef.html">Language Reference</a> for details on these new
instructions.</p>
<li><p><tt>ConstantBool::True</tt> and <tt>ConstantBool::False</tt> have been
renamed to <tt>ConstantBool::getTrue()</tt> and
<tt>ConstantBool::getFalse()</tt>.</p></li>
<li>The 'analyze' tool has been merged into the 'opt' tool.</li>
<li>Daniel Berlin and Curtis Dunham rewrote Andersen's alias analysis to be
several orders of magnitude faster, and implemented Offline Variable
Substitution and Lazy Cycle Detection. Note that Andersen's is not enabled in
llvm-gcc by default, but can be accessed through 'opt'.</li>
<li>Dan Gohman contributed several enhancements to Loop Strength Reduction (LSR)
to make it more aggressive with SSE intrinsics and when induction variables are
used by non-memory instructions.</li>
<li>Evan added support for simple exit value substitution to LSR.</li>
<li>Evan enhanced LSR to support induction variable reuse when the induction
variables have different widths.</li>
</ul>
</div>
<!--=========================================================================-->
<div class="doc_subsection">
<a name="targetspecific">Target Specific Improvements</a>
</div>
<div class="doc_text">
<p>New target-specific features include:
</p>
<ul>
<li>Evan contributed support to the X86 backend to model the mod/ref behavior
of the EFLAGS register explicitly in all instructions. This gives more freedom
to the scheduler, and is a more explicit way to model the instructions.</li>
<li>Dale contributed support for exception handling on Darwin/PPC and he and
Anton got x86-64 working.</li>
<li>Evan turned on if-conversion by default for ARM, allowing LLVM to take
advantage of its predication features.</li>
<li>Bruno added PIC support to the MIPS backend, fixed many bugs and improved
support for architecture variants.</li>
<li>Arnold Schwaighofer added initial support for X86 tail calls.</li>
<li>Evan contributed several enhancements to Darwin/x86 debug information.</li>
<li>Duncan added x86-64 support for trampolines (pointers to nested functions).</li>
</ul>
</div>
<!--=========================================================================-->
<div class="doc_subsection">
<a name="otherimprovements">Other Improvements</a>
</div>
<div class="doc_text">
<p>New features include:
</p>
<ul>
<li>Gordon expanded and updated the <a href="Passes.html">LLVM Analysis and
Transformation Passes</a> reference to include descriptions for each pass.</li>
<li>We rewrote the lexer and parser used by TableGen to make them simpler
and cleaner. This gives tblgen support for 'caret diagnostics'. The .ll file
lexer was also rewritten to support caret diagnostics but doesn't use this
support yet.</li>
<li>Dale has been grinding through the GCC testsuite, and marked many
LLVM-incompatible tests as not-to-be-run (for example, if they are grepping
through some GCC dump file that LLVM doesn't produce), he also found and fixed
many LLVM bugs exposed by the testsuite.</li>
</ul>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="portability">Portability and Supported Platforms</a>
@@ -237,14 +347,14 @@ instructions.</p>
<p>LLVM is known to work on the following platforms:</p>
<ul>
<li>Intel and AMD machines running Red Hat Linux, Fedora Core and FreeBSD
<li>Intel and AMD machines running Red Hat Linux, Fedora Core and FreeBSD
(and probably other unix-like systems).</li>
<li>Intel and AMD machines running on Win32 using MinGW libraries (native)</li>
<li>Sun UltraSPARC workstations running Solaris 8.</li>
<li>PowerPC and X86-based Mac OS X systems, running 10.3 and above in 32-bit and
64-bit modes.</li>
<li>Intel and AMD machines running on Win32 using MinGW libraries (native).</li>
<li>Intel and AMD machines running on Win32 with the Cygwin libraries (limited
support is available for native builds with Visual C++).</li>
<li>PowerPC and X86-based Mac OS X systems, running 10.2 and above in 32-bit and
64-bit modes.</li>
<li>Sun UltraSPARC workstations running Solaris 8.</li>
<li>Alpha-based machines running Debian GNU/Linux.</li>
<li>Itanium-based machines running Linux and HP-UX.</li>
</ul>
@@ -287,13 +397,12 @@ useful to some people. In particular, if you would like to work on one of these
components, please contact us on the <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev">LLVMdev list</a>.</p>
<ul>
<li>The <tt>-cee</tt> pass is known to be buggy, and may be removed in in a
future release.</li>
<li>The IA64 code generator is experimental.</li>
<li>The ARM code generator is experimental.</li>
<li>The Alpha JIT is experimental.</li>
<li>"<tt>-filetype=asm</tt>" (the default) is the only supported value for the
<tt>-filetype</tt> llc option.</li>
<li>The <tt>-cee</tt> pass is known to be buggy and will be removed in
LLVM 2.3.</li>
<li>The MSIL, IA64, Alpha, and MIPS backends are experimental.</li>
<li>The LLC "<tt>-filetype=asm</tt>" (the default) is the only supported
value for this option.</li>
<li>The llvmc tool is not supported.</li>
</ul>
</div>
@@ -307,9 +416,12 @@ components, please contact us on the <a href="http://lists.cs.uiuc.edu/mailman/l
<ul>
<li>The X86 backend does not yet support <a href="http://llvm.org/PR879">inline
assembly that uses the X86 floating point stack</a>. See the <a
href="http://llvm.org/PR879">bug</a> for details on workarounds on
Linux.</li>
assembly that uses the X86 floating point stack</a>.</li>
<li>The X86 backend occasionally has <a href="http://llvm.org/PR1649">alignment
problems</a> on operating systems that don't require 16-byte stack alignment
(including most non-darwin OS's like linux).</li>
<li>The X86 backend generates inefficient floating point code when configured to
generate code for systems that don't have SSE2.</li>
</ul>
</div>
@@ -322,10 +434,27 @@ components, please contact us on the <a href="http://lists.cs.uiuc.edu/mailman/l
<div class="doc_text">
<ul>
<li><a href="http://llvm.org/PR642">PowerPC backend does not correctly
implement ordered FP comparisons</a>.</li>
<li>The 64-bit PowerPC backend is not fully stable. If you desire PPC64 support,
please use mainline CVS LLVM, which has several important bug fixes.</li>
<li>The Linux PPC32/ABI support needs testing for the interpreter and static
compilation, and lacks support for debug information.</li>
</ul>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="arm-be">Known problems with the ARM back-end</a>
</div>
<div class="doc_text">
<ul>
<li>Thumb mode works only on ARMv6 or higher processors. On sub-ARMv6
processors, thumb programs can crash or produce wrong
results (<a href="http://llvm.org/PR1388">PR1388</a>).</li>
<li>Compilation for ARM Linux OABI (old ABI) is supported, but not fully tested.
</li>
<li>There is a bug in QEMU-ARM (&lt;= 0.9.0) which causes it to incorrectly execute
programs compiled with LLVM. Please use more recent versions of QEMU.</li>
</ul>
</div>
@@ -344,36 +473,6 @@ implement ordered FP comparisons</a>.</li>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="c-be">Known problems with the C back-end</a>
</div>
<div class="doc_text">
<ul>
<li>The C back-end produces code that violates the ANSI C Type-Based Alias
Analysis rules. As such, special options may be necessary to compile the code
(for example, GCC requires the <tt>-fno-strict-aliasing</tt> option). This
problem probably cannot be fixed.</li>
<li><a href="http://llvm.org/PR56">Zero arg vararg functions are not
supported</a>. This should not affect LLVM produced by the C or C++
frontends.</li>
<li>The C backend does not correctly implement the <a
href="LangRef.html#int_stacksave"><tt>llvm.stacksave</tt></a> or
<a href="LangRef.html#int_stackrestore"><tt>llvm.stackrestore</tt></a>
intrinsics. This means that some code compiled by it can run out of stack
space if they depend on these (e.g. C99 varargs).</li>
<li><a href="http://llvm.org/PR802">The C backend does not support inline
assembly code</a>.</li>
</ul>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="alpha-be">Known problems with the Alpha back-end</a>
@@ -415,36 +514,31 @@ programs.</li>
<li>Defining vararg functions is not supported (but calling them is ok).</li>
<li>The Itanium backend has bitrotted somewhat.</li>
</ul>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="arm-be">Known problems with the ARM back-end</a>
<a name="c-be">Known problems with the C back-end</a>
</div>
<div class="doc_text">
<ul>
<li>The ARM backend is currently in early development stages, it is not
ready for production use.</li>
<li><a href="http://llvm.org/PR802">The C backend does not support inline
assembly code</a>.</li>
<li><a href="http://llvm.org/PR1126">The C backend does not support vectors
yet</a>.</li>
<li><a href="http://llvm.org/PR1658">The C backend violates the ABI of common
C++ programs</a>, preventing intermixing between C++ compiled by the CBE and
C++ code compiled with LLC or native compilers.</li>
<li>The C backend does not support all exception handling constructs.</li>
</ul>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="core">Known problems with the LLVM Core</a>
</div>
<div class="doc_text">
<ul>
<li>In the JIT, <tt>dlsym()</tt> on a symbol compiled by the JIT will not
work.</li>
</ul>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
@@ -456,15 +550,9 @@ ready for production use.</li>
<div class="doc_text">
<p>
<p>llvm-gcc4 is far more stable and produces better code than llvm-gcc3, but
does not currently support <a href="http://llvm.org/PR869">Link-Time
Optimization</a> or <a href="http://llvm.org/PR870">C++ Exception Handling</a>,
which llvm-gcc3 does.</p>
<p>llvm-gcc4 does not support the <a href="http://llvm.org/PR947">GCC indirect
goto extension</a>, but llvm-gcc3 does.</p>
<p>llvm-gcc does not currently support <a href="http://llvm.org/PR869">Link-Time
Optimization</a> on most platforms "out-of-the-box". Please inquire on the
llvmdev mailing list if you are interested.</p>
</div>
@@ -474,86 +562,52 @@ goto extension</a>, but llvm-gcc3 does.</p>
</div>
<div class="doc_text">
<ul>
<li>"long double" is transformed by the front-end into "double". There is no
support for floating point data types of any size other than 32 and 64
bits.</li>
<li>Although many GCC extensions are supported, some are not. In particular,
the following extensions are known to <b>not be</b> supported:
<ol>
<li><a href="http://gcc.gnu.org/onlinedocs/gcc/Local-Labels.html#Local%20Labels">Local Labels</a>: Labels local to a block.</li>
<li><a href="http://gcc.gnu.org/onlinedocs/gcc/Nested-Functions.html#Nested%20Functions">Nested Functions</a>: As in Algol and Pascal, lexical scoping of functions.</li>
<li><a href="http://gcc.gnu.org/onlinedocs/gcc/Constructing-Calls.html#Constructing%20Calls">Constructing Calls</a>: Dispatching a call to another function.</li>
<li><a href="http://gcc.gnu.org/onlinedocs/gcc/Thread_002dLocal.html">Thread-Local</a>: Per-thread variables.</li>
<li><a href="http://gcc.gnu.org/onlinedocs/gcc/Pragmas.html#Pragmas">Pragmas</a>: Pragmas accepted by GCC.</li>
</ol>
<p>The following GCC extensions are <b>partially</b> supported. An ignored
attribute means that the LLVM compiler ignores the presence of the attribute,
but the code should still work. An unsupported attribute is one which is
ignored by the LLVM compiler and will cause a different interpretation of
the program.</p>
<li><p>llvm-gcc does <b>not</b> support <tt>__builtin_apply</tt> yet.
See <a href="http://gcc.gnu.org/onlinedocs/gcc/Constructing-Calls.html#Constructing%20Calls">Constructing Calls</a>: Dispatching a call to another function.</p>
</li>
<li><p>llvm-gcc <b>partially</b> supports these GCC extensions:</p>
<ol>
<li><a href="http://gcc.gnu.org/onlinedocs/gcc/Variable-Length.html#Variable%20Length">Variable Length</a>:
Arrays whose length is computed at run time.<br>
Supported, but allocated stack space is not freed until the function returns (noted above).</li>
<li><a href="http://gcc.gnu.org/onlinedocs/gcc/Nested-Functions.html#Nested%20Functions">Nested Functions</a>:
As in Algol and Pascal, lexical scoping of functions.
Nested functions are supported, but llvm-gcc does not support
taking the address of a nested function (except on X86 targets)
or non-local gotos.</li>
<li><a href="http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html#Function%20Attributes">Function Attributes</a>:
Declaring that functions have no side effects or that they can never
return.<br>
<b>Supported:</b> <tt>constructor</tt>, <tt>destructor</tt>,
<b>Supported:</b> <tt>alias</tt>, <tt>always_inline</tt>, <tt>cdecl</tt>,
<tt>const</tt>, <tt>constructor</tt>, <tt>destructor</tt>,
<tt>deprecated</tt>, <tt>fastcall</tt>, <tt>format</tt>,
<tt>format_arg</tt>, <tt>non_null</tt>, <tt>noreturn</tt>,
<tt>format_arg</tt>, <tt>non_null</tt>, <tt>noinline</tt>,
<tt>noreturn</tt>, <tt>nothrow</tt>, <tt>pure</tt>, <tt>regparm</tt>
<tt>section</tt>, <tt>stdcall</tt>, <tt>unused</tt>, <tt>used</tt>,
<tt>visibility</tt>, <tt>warn_unused_result</tt>, <tt>weak</tt><br>
<b>Ignored:</b> <tt>noinline</tt>,
<tt>always_inline</tt>, <tt>pure</tt>, <tt>const</tt>, <tt>nothrow</tt>,
<tt>malloc</tt>, <tt>no_instrument_function</tt>, <tt>cdecl</tt><br>
<b>Unsupported:</b> <tt>alias</tt>, <tt>regparm</tt>, all other target specific
attributes</li>
<li><a href="http://gcc.gnu.org/onlinedocs/gcc/Variable-Attributes.html#Variable%20Attributes">Variable Attributes</a>:
Specifying attributes of variables.<br>
<b>Supported:</b> <tt>cleanup</tt>, <tt>common</tt>, <tt>nocommon</tt>,
<tt>deprecated</tt>, <tt>dllimport</tt>, <tt>dllexport</tt>,
<tt>section</tt>, <tt>transparent_union</tt>, <tt>unused</tt>,
<tt>used</tt>, <tt>weak</tt><br>
<b>Unsupported:</b> <tt>aligned</tt>, <tt>mode</tt>, <tt>packed</tt>,
<tt>shared</tt>, <tt>tls_model</tt>,
<tt>vector_size</tt>, all target specific attributes.
</li>
<li><a href="http://gcc.gnu.org/onlinedocs/gcc/Type-Attributes.html#Type%20Attributes">Type Attributes</a>: Specifying attributes of types.<br>
<b>Supported:</b> <tt>transparent_union</tt>, <tt>unused</tt>,
<tt>deprecated</tt>, <tt>may_alias</tt><br>
<b>Unsupported:</b> <tt>aligned</tt>, <tt>packed</tt>,
all target specific attributes.</li>
<li><a href="http://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html#Other%20Builtins">Other Builtins</a>:
Other built-in functions.<br>
We support all builtins which have a C language equivalent (e.g.,
<tt>__builtin_cos</tt>), <tt>__builtin_alloca</tt>,
<tt>__builtin_types_compatible_p</tt>, <tt>__builtin_choose_expr</tt>,
<tt>__builtin_constant_p</tt>, and <tt>__builtin_expect</tt>
(currently ignored). We also support builtins for ISO C99 floating
point comparison macros (e.g., <tt>__builtin_islessequal</tt>),
<tt>__builtin_prefetch</tt>, <tt>__builtin_popcount[ll]</tt>,
<tt>__builtin_clz[ll]</tt>, and <tt>__builtin_ctz[ll]</tt>.</li>
<b>Ignored:</b> <tt>malloc</tt>,
<tt>no_instrument_function</tt></li>
</ol>
</li>
<p>The following extensions <b>are</b> known to be supported:</p>
<li><p>llvm-gcc supports the vast majority of GCC extensions, including:</p>
<ol>
<li><a href="http://gcc.gnu.org/onlinedocs/gcc/Pragmas.html#Pragmas">Pragmas</a>: Pragmas accepted by GCC.</li>
<li><a href="http://gcc.gnu.org/onlinedocs/gcc/Local-Labels.html#Local%20Labels">Local Labels</a>: Labels local to a block.</li>
<li><a href="http://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html#Other%20Builtins">Other Builtins</a>:
Other built-in functions.</li>
<li><a href="http://gcc.gnu.org/onlinedocs/gcc/Variable-Attributes.html#Variable%20Attributes">Variable Attributes</a>:
Specifying attributes of variables.</li>
<li><a href="http://gcc.gnu.org/onlinedocs/gcc/Type-Attributes.html#Type%20Attributes">Type Attributes</a>: Specifying attributes of types.</li>
<li><a href="http://gcc.gnu.org/onlinedocs/gcc/Thread_002dLocal.html">Thread-Local</a>: Per-thread variables.</li>
<li><a href="http://gcc.gnu.org/onlinedocs/gcc/Variable-Length.html#Variable%20Length">Variable Length</a>:
Arrays whose length is computed at run time.</li>
<li><a href="http://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html#Labels%20as%20Values">Labels as Values</a>: Getting pointers to labels and computed gotos.</li>
<li><a href="http://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html#Statement%20Exprs">Statement Exprs</a>: Putting statements and declarations inside expressions.</li>
<li><a href="http://gcc.gnu.org/onlinedocs/gcc/Typeof.html#Typeof">Typeof</a>: <code>typeof</code>: referring to the type of an expression.</li>
@@ -609,44 +663,66 @@ lists, please let us know (also including whether or not they work).</p>
<div class="doc_text">
<p>For this release, the C++ front-end is considered to be fully
<p>The C++ front-end is considered to be fully
tested and works for a number of non-trivial programs, including LLVM
itself.</p>
itself, Qt, Mozilla, etc.</p>
</div>
<!-- _______________________________________________________________________ -->
<div class="doc_subsubsection">
Notes
</div>
<div class="doc_text">
<ul>
<li>llvm-gcc4 does not support C++ exception handling at all yet.</li>
<li>Destructors for local objects are not always run when a <tt>longjmp</tt> is
performed. In particular, destructors for objects in the <tt>longjmp</tt>ing
function and in the <tt>setjmp</tt> receiver function may not be run.
Objects in intervening stack frames will be destroyed, however (which is
better than most compilers).</li>
<li>The LLVM C++ front-end follows the <a
href="http://www.codesourcery.com/cxx-abi">Itanium C++ ABI</a>.
This document, which is not Itanium specific, specifies a standard for name
mangling, class layout, v-table layout, RTTI formats, and other C++
representation issues. Because we use this API, code generated by the LLVM
compilers should be binary compatible with machine code generated by other
Itanium ABI C++ compilers (such as G++, the Intel and HP compilers, etc).
<i>However</i>, the exception handling mechanism used by llvm-gcc3 is very
different from the model used in the Itanium ABI, so <b>exceptions will not
interact correctly</b>. </li>
<li>Exception handling only works well on the X86 and PowerPC targets.
It works well for x86-64 darwin but not x86-64 linux.</li>
</ul>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="ada-fe">Known problems with the Ada front-end</a>
</div>
<div class="doc_text">
The llvm-gcc 4.2 Ada compiler works fairly well, however this is not a mature
technology and problems should be expected.
<ul>
<li>The Ada front-end currently only builds on x86-32. This is mainly due
to lack of trampoline support (pointers to nested functions) on other platforms,
however it <a href="http://llvm.org/PR2006">also fails to build on x86-64</a>
which does support trampolines.</li>
<li>The Ada front-end <a href="http://llvm.org/PR2007">fails to bootstrap</a>.
Workaround: configure with --disable-bootstrap.</li>
<li>The c380004 and <a href="http://llvm.org/PR2010">c393010</a> ACATS tests
fail (c380004 also fails with gcc-4.2 mainline).</li>
<li>Many gcc specific Ada tests continue to crash the compiler.</li>
<li>The -E binder option (exception backtraces)
<a href="http://llvm.org/PR1982">does not work</a> and will result in programs
crashing if an exception is raised. Workaround: do not use -E.</li>
<li>Only discrete types <a href="http://llvm.org/PR1981">are allowed to start
or finish at a non-byte offset</a> in a record. Workaround: do not pack records
or use representation clauses that result in a field of a non-discrete type
starting or finishing in the middle of a byte.</li>
<li>The lli interpreter <a href="http://llvm.org/PR2009">considers 'main'
as generated by the Ada binder to be invalid</a>.
Workaround: hand edit the file to use pointers for argv and envp rather than
integers.</li>
<li>The -fstack-check option <a href="http://llvm.org/PR2008">is ignored</a>.</li>
</ul>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection">
<a name="fortran-fe">Known problems with the Fortran front-end</a>
</div>
<div class="doc_text">
<ul>
<li>The llvm-gcc 4.2 gfortran front-end supports a broad range of Fortran code, but does
<a href="http://llvm.org/PR1971">not support EQUIVALENCE yet</a>.</li>
</ul>
</div>
<!-- *********************************************************************** -->
<div class="doc_section">
<a name="additionalinfo">Additional Information</a>
@@ -656,11 +732,10 @@ itself.</p>
<div class="doc_text">
<p>A wide variety of additional information is available on the <a
href="http://llvm.org">LLVM web page</a>, including <a
href="http://llvm.org/docs/">documentation</a> and <a
href="http://llvm.org/pubs/">publications describing algorithms and
components implemented in LLVM</a>. The web page also contains versions of the
API documentation which is up-to-date with the CVS version of the source code.
href="http://llvm.org">LLVM web page</a>, in particular in the <a
href="http://llvm.org/docs/">documentation</a> section. The web page also
contains versions of the API documentation which is up-to-date with the
Subversion version of the source code.
You can access versions of these documents specific to this release by going
into the "<tt>llvm/doc/</tt>" directory in the LLVM tree.</p>
@@ -677,9 +752,9 @@ lists</a>.</p>
<a href="http://jigsaw.w3.org/css-validator/check/referer"><img
src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a>
<a href="http://validator.w3.org/check/referer"><img
src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!" /></a>
src="http://www.w3.org/Icons/valid-html401" alt="Valid HTML 4.01!"></a>
<a href="http://llvm.org/">The LLVM Compiler Infrastructure</a><br>
<a href="http://llvm.org/">LLVM Compiler Infrastructure</a><br>
Last modified: $Date$
</address>

View File

@@ -747,7 +747,7 @@ provide debug information at various points in generated code.</p>
<p>This intrinsic is used to provide correspondence between the source file and
the generated code. The first argument is the line number (base 1), second
argument si the column number (0 if unknown) and the third argument the source
argument is the column number (0 if unknown) and the third argument the source
<tt>%<a href="#format_compile_units">llvm.dbg.compile_unit</a>*</tt> cast to a
<tt>{ }*</tt>. Code following a call to this intrinsic will have been defined
in close proximity of the line, column and file. This information holds until
@@ -991,7 +991,7 @@ another scope).</p>
<p>It is worth noting that this scoping mechanism is used to control scoping of
all declarations, not just variable declarations. For example, the scope of a
C++ using declaration is controlled with this couldchange how name lookup is
C++ using declaration is controlled with this and could change how name lookup is
performed.</p>
</div>

View File

@@ -1296,18 +1296,26 @@ remainder of the story.
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"> <a name="directory">Directory Structure</a></div>
<div class="doc_text">
<p>The source code, test programs, and sample programs can all be found
in the LLVM repository named <tt>llvm-stacker</tt> This should be checked out to
the <tt>projects</tt> directory so that it will auto-configure. To do that, make
sure you have the llvm sources in <tt><i>llvm</i></tt>
(see <a href="GettingStarted.html">Getting Started</a>) and then use these
commands:<pre>
cd <i>llvm</i>/projects
cvs co llvm-stacker</pre>
</p>
commands:</p>
<div class="doc_code">
<pre>
% svn co http://llvm.org/svn/llvm-project/llvm-top/trunk llvm-top
% cd llvm-top
% make build MODULE=stacker
</pre>
</div>
<p>Under the <tt>projects/llvm-stacker</tt> directory you will find the
implementation of the Stacker compiler, as follows:</p>
<ul>
<li><em>lib</em> - contains most of the source code
<ul>
@@ -1322,11 +1330,14 @@ implementation of the Stacker compiler, as follows:</p>
<li><em>sample</em> - contains the sample programs</li>
</ul>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="lexer"></a>The Lexer</div>
<div class="doc_text">
<p>See projects/llvm-stacker/lib/compiler/Lexer.l</p>
</div>
<!-- ======================================================================= -->
<div class="doc_subsection"><a name="parser"></a>The Parser</div>
<div class="doc_text">

View File

@@ -106,30 +106,40 @@ and tcl.</p>
<div class="doc_text">
<p>The tests are located in two separate CVS modules. The basic feature and
regression tests are in the main "llvm" module under the directory
<tt>llvm/test</tt>. A more comprehensive test suite that includes whole
programs in C and C++ is in the <tt>llvm-test</tt> module. This module should
be checked out to the <tt>llvm/projects</tt> directory. When you
<tt>configure</tt> the <tt>llvm</tt> module, the <tt>llvm-test</tt> module
will be automatically configured. Alternatively, you can configure the
<tt>llvm-test</tt> module manually.</p>
<p>The tests are located in two separate Subversion modules. The basic feature
and regression tests are in the main "llvm" module under the directory
<tt>llvm/test</tt>. A more comprehensive test suite that includes whole
programs in C and C++ is in the <tt>test-suite</tt> module. This module should
be checked out to the <tt>llvm/projects</tt> directory as llvm-test (for
historical purpose). When you <tt>configure</tt> the <tt>llvm</tt> module,
the <tt>llvm-test</tt> directory will be automatically configured.
Alternatively, you can configure the <tt>test-suite</tt> module manually.</p>
<p>To run all of the simple tests in LLVM using DejaGNU, use the master Makefile
in the <tt>llvm/test</tt> directory:</p>
<div class="doc_code">
<pre>
% gmake -C llvm/test
</pre>
or<br>
</div>
<p>or</p>
<div class="doc_code">
<pre>
% gmake check
</pre>
</div>
<p>To run only a subdirectory of tests in llvm/test using DejaGNU (ie.
Regression/Transforms), just set the TESTSUITE variable to the path of the
subdirectory (relative to <tt>llvm/test</tt>):</p>
<div class="doc_code">
<pre>
% gmake -C llvm/test TESTSUITE=Regression/Transforms
</pre>
</div>
<p><b>Note: If you are running the tests with <tt>objdir != subdir</tt>, you
must have run the complete testsuite before you can specify a
@@ -138,13 +148,16 @@ subdirectory.</b></p>
<p>To run the comprehensive test suite (tests that compile and execute whole
programs), run the <tt>llvm-test</tt> tests:</p>
<div class="doc_code">
<pre>
% cd llvm/projects
% cvs co llvm-test
% cd llvm-test
% ./configure --with-llvmsrc=$LLVM_SRC_ROOT --with-llvmobj=$LLVM_OBJ_ROOT
% svn co http://llvm.org/svn/llvm-project/test-suite/trunk llvm-test
% cd ..
% ./configure --with-llvmgccdir=$LLVM_GCC_DIR
% cd projects/llvm-test
% gmake
</pre>
</div>
</div>
@@ -201,7 +214,7 @@ a way of benchmarking LLVM performance, both in terms of the efficiency of the
programs generated as well as the speed with which LLVM compiles, optimizes, and
generates code.</p>
<p>All "whole program" tests are located in the <tt>llvm-test</tt> CVS
<p>All "whole program" tests are located in the <tt>test-suite</tt> Subversion
module.</p>
</div>
@@ -220,26 +233,27 @@ subtrees of the test suite directory tree are as follows:</p>
<p>This directory contains a large array of small tests
that exercise various features of LLVM and to ensure that regressions do not
occur. The directory is broken into several sub-directories, each focused on
a particular area of LLVM. A few of the important ones are:<ul>
a particular area of LLVM. A few of the important ones are:</p>
<ul>
<li><tt>Analysis</tt>: checks Analysis passes.</li>
<li><tt>Archive</tt>: checks the Archive library.</li>
<li><tt>Assembler</tt>: checks Assembly reader/writer functionality.</li>
<li><tt>Bytecode</tt>: checks Bytecode reader/writer functionality.</li>
<li><tt>Bitcode</tt>: checks Bitcode reader/writer functionality.</li>
<li><tt>CodeGen</tt>: checks code generation and each target.</li>
<li><tt>Features</tt>: checks various features of the LLVM language.</li>
<li><tt>Linker</tt>: tests bytecode linking.</li>
<li><tt>Linker</tt>: tests bitcode linking.</li>
<li><tt>Transforms</tt>: tests each of the scalar, IPO, and utility
transforms to ensure they make the right transformations.</li>
<li><tt>Verifier</tt>: tests the IR verifier.</li>
</ul></p>
</ul>
<p>Typically when a bug is found in LLVM, a regression test containing
just enough code to reproduce the problem should be written and placed
somewhere underneath this directory. In most cases, this will be a small
piece of LLVM assembly language code, often distilled from an actual
application or benchmark.</p></li>
<li><tt>llvm-test</tt>
<p>The <tt>llvm-test</tt> CVS module contains programs that can be compiled
<li><tt>test-suite</tt>
<p>The <tt>test-suite</tt> module contains programs that can be compiled
with LLVM and executed. These programs are compiled using the native compiler
and various LLVM backends. The output from the program compiled with the
native compiler is assumed correct; the results from the other programs are
@@ -324,11 +338,14 @@ location of these external programs is configured by the llvm-test
</p>
<p> Below is an example of legal RUN lines in a <tt>.ll</tt> file:</p>
<pre>
; RUN: llvm-as &lt; %s | llvm-dis &gt; %t1
; RUN: llvm-dis &lt; %s.bc-13 &gt; %t2
; RUN: diff %t1 %t2
</pre>
<div class="doc_code">
<pre>
; RUN: llvm-as &lt; %s | llvm-dis &gt; %t1
; RUN: llvm-dis &lt; %s.bc-13 &gt; %t2
; RUN: diff %t1 %t2
</pre>
</div>
<p>As with a Unix shell, the RUN: lines permit pipelines and I/O redirection
to be used. However, the usage is slightly different than for Bash. To check
@@ -351,43 +368,66 @@ location of these external programs is configured by the llvm-test
<p>There are some quoting rules that you must pay attention to when writing
your RUN lines. In general nothing needs to be quoted. Tcl won't strip off any
' or " so they will get passed to the invoked program. For example:</p>
<pre>
... | grep 'find this string'
</pre>
<div class="doc_code">
<pre>
... | grep 'find this string'
</pre>
</div>
<p>This will fail because the ' characters are passed to grep. This would
instruction grep to look for <tt>'find</tt> in the files <tt>this</tt> and
<tt>string'</tt>. To avoid this use curly braces to tell Tcl that it should
treat everything enclosed as one value. So our example would become:</p>
<pre>
... | grep {find this string}
</pre>
<div class="doc_code">
<pre>
... | grep {find this string}
</pre>
</div>
<p>Additionally, the characters <tt>[</tt> and <tt>]</tt> are treated
specially by Tcl. They tell Tcl to interpret the content as a command to
execute. Since these characters are often used in regular expressions this can
have disastrous results and cause the entire test run in a directory to fail.
For example, a common idiom is to look for some basicblock number:</p>
<pre>
... | grep bb[2-8]
</pre>
<div class="doc_code">
<pre>
... | grep bb[2-8]
</pre>
</div>
<p>This, however, will cause Tcl to fail because its going to try to execute
a program named "2-8". Instead, what you want is this:</p>
<pre>
... | grep {bb\[2-8\]}
</pre>
<div class="doc_code">
<pre>
... | grep {bb\[2-8\]}
</pre>
</div>
<p>Finally, if you need to pass the <tt>\</tt> character down to a program,
then it must be doubled. This is another Tcl special character. So, suppose
you had:
<pre>
... | grep 'i32\*'
</pre>
<div class="doc_code">
<pre>
... | grep 'i32\*'
</pre>
</div>
<p>This will fail to match what you want (a pointer to i32). First, the
<tt>'</tt> do not get stripped off. Second, the <tt>\</tt> gets stripped off
by Tcl so what grep sees is: <tt>'i32*'</tt>. That's not likely to match
anything. To resolve this you must use <tt>\\</tt> and the <tt>{}</tt>, like
this:</p>
<pre>
... | grep {i32\\*}
</pre>
<div class="doc_code">
<pre>
... | grep {i32\\*}
</pre>
</div>
</div>
@@ -402,38 +442,49 @@ location of these external programs is configured by the llvm-test
library, certain names can be accessed with an alternate syntax: a % prefix.
These alternates are deprecated and may go away in a future version.
</p>
Here are the available variable names. The alternate syntax is listed in
<p>Here are the available variable names. The alternate syntax is listed in
parentheses.</p>
<dl style="margin-left: 25px">
<dt><b>$test</b> (%s)</dt>
<dd>The full path to the test case's source. This is suitable for passing
on the command line as the input to an llvm tool.</dd>
<dt><b>$srcdir</b></dt>
<dd>The source directory from where the "<tt>make check</tt>" was run.</dd>
<dt><b>objdir</b></dt>
<dd>The object directory that corresponds to the </tt>$srcdir</tt>.</dd>
<dd>The object directory that corresponds to the <tt>$srcdir</tt>.</dd>
<dt><b>subdir</b></dt>
<dd>A partial path from the <tt>test</tt> directory that contains the
sub-directory that contains the test source being executed.</dd>
<dt><b>srcroot</b></dt>
<dd>The root directory of the LLVM src tree.</dd>
<dt><b>objroot</b></dt>
<dd>The root directory of the LLVM object tree. This could be the same
as the srcroot.</dd>
<dt><b>path</b><dt>
<dd>The path to the directory that contains the test case source. This is
for locating any supporting files that are not generated by the test, but
used by the test.</dd>
<dt><b>tmp</b></dt>
<dd>The path to a temporary file name that could be used for this test case.
The file name won't conflict with other test cases. You can append to it if
you need multiple temporaries. This is useful as the destination of some
redirected output.</dd>
<dt><b>llvmlibsdir</b> (%llvmlibsdir)</dt>
<dd>The directory where the LLVM libraries are located.</dd>
<dt><b>target_triplet</b> (%target_triplet)</dt>
<dd>The target triplet that corresponds to the current host machine (the one
running the test cases). This should probably be called "host".<dd>
<dt><b>prcontext</b> (%prcontext)</dt>
<dd>Path to the prcontext tcl script that prints some context around a
line that matches a pattern. This isn't strictly necessary as the test suite
@@ -441,31 +492,41 @@ location of these external programs is configured by the llvm-test
the prcontext script is located. Note that this script is similar to
<tt>grep -C</tt> but you should use the <tt>prcontext</tt> script because
not all platforms support <tt>grep -C</tt>.</dd>
<dt><b>llvmgcc</b> (%llvmgcc)</dt>
<dd>The full path to the <tt>llvm-gcc</tt> executable as specified in the
configured LLVM environment</dd>
<dt><b>llvmgxx</b> (%llvmgxx)</dt>
<dd>The full path to the <tt>llvm-gxx</tt> executable as specified in the
configured LLVM environment</dd>
<dt><b>llvmgcc_version</b> (%llvmgcc_version)</dt>
<dd>The full version number of the <tt>llvm-gcc</tt> executable.</dd>
<dt><b>llvmgccmajvers</b> (%llvmgccmajvers)</dt>
<dd>The major version number of the <tt>llvm-gcc</tt> executable.</dd>
<dt><b>gccpath</b></dt>
<dd>The full path to the C compiler used to <i>build </i> LLVM. Note that
this might not be gcc.</dd>
<dt><b>gxxpath</b></dt>
<dd>The full path to the C++ compiler used to <i>build </i> LLVM. Note that
this might not be g++.</dd>
<dt><b>compile_c</b> (%compile_c)</dt>
<dd>The full command line used to compile LLVM C source code. This has all
the configured -I, -D and optimization options.</dd>
<dt><b>compile_cxx</b> (%compile_cxx)</dt>
<dd>The full command used to compile LLVM C++ source code. This has
all the configured -I, -D and optimization options.</dd>
<dt><b>link</b> (%link)</dt>
<dd>This full link command used to link LLVM executables. This has all the
configured -I, -L and -l options.</dd>
<dt><b>shlibext</b> (%shlibext)</dt>
<dd>The suffix for the host platforms share library (dll) files. This
includes the period as the first character.</dd>
@@ -491,6 +552,7 @@ location of these external programs is configured by the llvm-test
non-zero result will cause the test to fail. This script overcomes that
issue and nicely documents that the test case is purposefully ignoring the
result code of the tool</dd>
<dt><b>not</b></dt>
<dd>This script runs its arguments and then inverts the result code from
it. Zero result codes become 1. Non-zero result codes become 0. This is
@@ -511,9 +573,12 @@ location of these external programs is configured by the llvm-test
succeed. To XFAIL everywhere just specify <tt>XFAIL: *</tt>. When matching
the llvm-gcc version, you can specify the major (e.g. 3) or full version
(i.e. 3.4) number. Here is an example of an <tt>XFAIL</tt> line:</p>
<pre>
; XFAIL: darwin,sun,llvmgcc4
</pre>
<div class="doc_code">
<pre>
; XFAIL: darwin,sun,llvmgcc4
</pre>
</div>
<p>To make the output more useful, the <tt>llvm_runtest</tt> function wil
scan the lines of the test case for ones that contain a pattern that matches
@@ -573,12 +638,14 @@ specify the following configuration options:</p>
uses the default value
<tt>/home/vadve/shared/benchmarks/speccpu2000/benchspec</tt>.
<p>
<dt><i>--enable-spec95</i>
<dt><i>--enable-spec95=&lt;<tt>directory</tt>&gt;</i>
<dd>
Enable the use of SPEC95 when testing LLVM. It is similar to the
<i>--enable-spec2000</i> option.
<p>
<dt><i>--enable-povray</i>
<dt><i>--enable-povray=&lt;<tt>directory</tt>&gt;</i>
<dd>
@@ -598,12 +665,12 @@ specify the following configuration options:</p>
<i>are not</i> executed inside of the LLVM source tree. This is because the
test suite creates temporary files during execution.</p>
<p>The master Makefile in llvm/test is capable of running only the DejaGNU
driven tests. By default, it will run all of these tests.</p>
<p>The master Makefile in <tt>llvm/test</tt> is capable of running only the
DejaGNU driven tests. By default, it will run all of these tests.</p>
<p>To run only the DejaGNU driven tests, run <tt>gmake</tt> at the
command line in <tt>llvm/test</tt>. To run a specific directory of tests, use
the TESTSUITE variable.
the <tt>TESTSUITE</tt> variable.
</p>
<p>For example, to run the Regression tests, type
@@ -613,40 +680,54 @@ the TESTSUITE variable.
<tt>llvm/test/Regression</tt>. You must use DejaGNU from the <tt>llvm/test</tt>
directory to run them.</p>
<p>To run the <tt>llvm-test</tt> suite, you need to use the following steps:
</p>
<p>To run the <tt>llvm-test</tt> suite, you need to use the following steps:</p>
<ol>
<li>cd into the llvm/projects directory</li>
<li>check out the <tt>llvm-test</tt> module with:<br/>
<tt>cvs -d :pserver:anon@llvm.org:/var/cvs/llvm co -PR llvm-test</tt><br>
This will get the test suite into <tt>llvm/projects/llvm-test</tt></li>
<li>configure the test suite. You can do this one of two ways:
<ol>
<li>Use the regular llvm configure:<br/>
<tt>cd $LLVM_OBJ_ROOT ; $LLVM_SRC_ROOT/configure</tt><br/>
This will ensure that the <tt>projects/llvm-test</tt> directory is also
properly configured.</li>
<li>Use the <tt>configure</tt> script found in the <tt>llvm-test</tt> source
directory:<br/>
<tt>$LLVM_SRC_ROOT/projects/llvm-test/configure
--with-llvmsrc=$LLVM_SRC_ROOT --with-llvmobj=$LLVM_OBJ_ROOT</tt>
</li>
</ol>
<li>gmake</li>
<li><tt>cd</tt> into the <tt>llvm/projects</tt> directory</li>
<li><p>Check out the <tt>test-suite</tt> module with:</p>
<div class="doc_code">
<pre>
% svn co http://llvm.org/svn/llvm-project/test-suite/trunk llvm-test
</pre>
</div>
<p>This will get the test suite into <tt>llvm/projects/llvm-test</tt></p>
<li><p>Configure the test suite using llvm configure. This will automatically configure llvm-test.
You must do it from the top level otherwise llvm-gcc will not be set which is required to
run llvm-test:</p>
<div class="doc_code">
<pre>
% cd $LLVM_OBJ_ROOT ; $LLVM_SRC_ROOT/configure --with-llvmgccdir=$LLVM_GCC_DIR
</pre>
</div>
<li><tt>gmake</tt></li>
</ol>
<p>Note that the second and third steps only need to be done once. After you
have the suite checked out and configured, you don't need to do it again (unless
the test code or configure script changes).</p>
the test code or configure script changes). $LLVM_GCC_DIR is the path to the LLVM
C/C++ FrontEnd</p>
<p>To make a specialized test (use one of the
<tt>llvm-test/TEST.&lt;type&gt;.Makefile</tt>s), just run:<br/>
<tt>gmake TEST=&lt;type&gt; test</tt><br/>For example, you could run the
nightly tester tests using the following commands:</p>
<tt>llvm-test/TEST.&lt;type&gt;.Makefile</tt>s), just run:</p>
<div class="doc_code">
<pre>
% cd llvm/projects/llvm-test
% gmake TEST=nightly test
% gmake TEST=&lt;type&gt; test
</pre>
</div>
<p>For example, you could run the nightly tester tests using the following
commands:</p>
<div class="doc_code">
<pre>
% cd llvm/projects/llvm-test
% gmake TEST=nightly test
</pre>
</div>
<p>Regardless of which test you're running, the results are printed on standard
output and standard error. You can redirect these results to a file if you
@@ -760,24 +841,15 @@ as keep track of LLVM's progress over time.</p>
machine, take a look at the comments at the top of the
<tt>utils/NewNightlyTest.pl</tt> file. If you decide to set up a nightly tester
please choose a unique nickname and invoke <tt>utils/NewNightlyTest.pl</tt>
with the "-nickname [yournickname]" command line option. We usually run it
from a crontab entry that looks like this:</p>
with the "-nickname [yournickname]" command line option.
<div class="doc_code">
<pre>
5 3 * * * $HOME/llvm/utils/NewNightlyTest.pl -parallel -nickname Nickname \
$CVSROOT $HOME/buildtest $HOME/cvs/testresults
</pre>
</div>
<p>Or, you can create a shell script to encapsulate the running of the script.
<p>You can create a shell script to encapsulate the running of the script.
The optimized x86 Linux nightly test is run from just such a script:</p>
<div class="doc_code">
<pre>
#!/bin/bash
BASE=/proj/work/llvm/nightlytest
export CVSROOT=:pserver:anon@llvm.org:/var/cvs/llvm
export BUILDDIR=$BASE/build
export WEBDIR=$BASE/testresults
export LLVMGCCDIR=/proj/work/llvm/cfrontend/install
@@ -786,7 +858,7 @@ export LD_LIBRARY_PATH=/proj/install/lib
cd $BASE
cp /proj/work/llvm/llvm/utils/NewNightlyTest.pl .
nice ./NewNightlyTest.pl -nice -release -verbose -parallel -enable-linscan \
-nickname NightlyTester -noexternals 2&gt;&amp;1 &gt; output.log
-nickname NightlyTester -noexternals &gt; output.log 2&gt;&amp;1
</pre>
</div>

Some files were not shown because too many files have changed in this diff Show More