Commit Graph

95912 Commits

Author SHA1 Message Date
Benjamin Kramer 07726c7d52 InstCombine: Add a missing irem identity (X % X -> 0).
llvm-svn: 119538
2010-11-17 19:11:46 +00:00
Argyrios Kyrtzidis b94e5a33b3 Don't emit warn_logical_and_in_logical_or for macros. Fixes rdar://8678458
llvm-svn: 119537
2010-11-17 18:54:22 +00:00
Duncan Sands c89ac07e7a Move some those Xor simplifications which don't require creating new
instructions out of InstCombine and into InstructionSimplify.  While
there, introduce an m_AllOnes pattern to simplify matching with integers
and vectors with all bits equal to one.

llvm-svn: 119536
2010-11-17 18:52:15 +00:00
Argyrios Kyrtzidis 14a96625b8 Don't warn for parentheses for the '&&' inside '||' for cases like:
assert(a || b && "bad");

since this is safe. This way we avoid a big source of such warnings which in this case are practically useless.

Note that we don't handle *all* cases where precedence wouldn't matter because of constants since
this is a bit costly to check, and IMO clarifying precedence with parentheses is good for
readability in general.

llvm-svn: 119533
2010-11-17 18:26:36 +00:00
Argyrios Kyrtzidis f10c43c7f7 Put warn_logical_and_in_logical_or warning in new warning group "logical-op-parentheses" member of "parentheses".
llvm-svn: 119532
2010-11-17 18:26:33 +00:00
Jim Grosbach 8839775df6 More ARM encoding bits. LDRH now encodes properly.
llvm-svn: 119529
2010-11-17 18:11:11 +00:00
Howard Hinnant 57d1ebcc38 Update <string> to use allocator_traits.
llvm-svn: 119522
2010-11-17 17:55:08 +00:00
Dan Gohman ff66a7c66d Add a comment explaining why r117813 was needed.
llvm-svn: 119518
2010-11-17 17:23:53 +00:00
Dan Gohman f41b525161 Drop the warning about __attribute__((may_alias)) being used
on a non-type declaration, as GCC permits it on variables too.
This fixes PR8635.

llvm-svn: 119517
2010-11-17 17:21:47 +00:00
Douglas Gregor 30313cbb80 When libclang is walking a member access expression, don't walk into
an implicit "this"; it causes clang_getCursor() to find the implicit
"this" expression (which isn't written in the source!) rather than the
actual member.

llvm-svn: 119516
2010-11-17 17:15:08 +00:00
Chris Lattner 8defde09fd various cleanups and other improvements, patch by Zhanyong Wan!
llvm-svn: 119515
2010-11-17 17:14:55 +00:00
Douglas Gregor 29ee422861 When comparing the source range of a declaration against the region of
interest (e.g., as used by clang_getCursor()), count the
decl-specifier-seq as part of the source range, as we do for
clang_annotateTokens(). Makes clang_getCursor() work properly for the
result types of functions, for example.

llvm-svn: 119514
2010-11-17 17:14:07 +00:00
Rafael Espindola b67912d5cd Add support for .int.
llvm-svn: 119512
2010-11-17 16:24:40 +00:00
Rafael Espindola 5c996894bd Add support for .2byte, .4byte and .8byte.
Fixes PR8631.

llvm-svn: 119511
2010-11-17 16:15:42 +00:00
Daniel Dunbar 95d37be1a9 MC-JIT: Stub out "pure" streamer.
- No immediate use, but maybe someone feels like hacking on it.

llvm-svn: 119510
2010-11-17 16:06:47 +00:00
Daniel Dunbar 7e5d8a765f MCJIT: Stub out MCJIT implementation, still doesn't do anything useful.
llvm-svn: 119509
2010-11-17 16:06:43 +00:00
Daniel Dunbar 70ff8b05e3 lli: Add stub -use-mcjit option, which doesn't currently do anything.
llvm-svn: 119508
2010-11-17 16:06:37 +00:00
Rafael Espindola 9b6fae5d6d Silence warning for "clang -O2 -O0 -c foo.c -o foo.o.
Fixes PR8607.

llvm-svn: 119498
2010-11-17 15:16:14 +00:00
Duncan Sands 9d9a4e2ca2 Have InlineFunction use SimplifyInstruction rather than
hasConstantValue.  I was leery of using SimplifyInstruction
while the IR was still in a half-baked state, which is the
reason for delaying the simplification until the IR is fully
cooked.

llvm-svn: 119494
2010-11-17 11:16:23 +00:00
Duncan Sands ec7a6ecb92 Now that hasConstantValue has been made simpler, it may return the
phi node itself if it occurs in an unreachable basic block.  Protect
against this.  Hopefully this will fix some more buildbots.

llvm-svn: 119493
2010-11-17 10:23:23 +00:00
Evan Cheng 7c91bb855f Revert r119109 for now. It's breaking 176.gcc.
llvm-svn: 119492
2010-11-17 09:31:04 +00:00
Zhongxing Xu 33d7ea9355 Add skeleton for handling various cfg dtors.
llvm-svn: 119491
2010-11-17 09:16:19 +00:00
Duncan Sands 64e41cf865 Previously SimplifyInstruction could report that an instruction
simplified to itself (this can only happen in unreachable blocks).
Change it to return null instead.  Hopefully this will fix some
buildbot failures.

llvm-svn: 119490
2010-11-17 08:35:29 +00:00
Chris Lattner 11feaf5921 When forming the !srcloc mdnode for an inline asm, add the SourceLocations
of all the lines of the inline asm.  With the refactoring and enhancement
of the backend, we can now reports errors on the correct source line when
an asm contains multiple lines of text.  For something like this:

void foo() {
  asm("push %rax\n"
      ".code32\n");
}

we used to get this: (note that the line 4 in t.c isn't helpful)

t.c:4:7: error: warning: ignoring directive for now
  asm("push %rax\n"
      ^
<inline asm>:2:1: note: instantiated into assembly here
.code32
^

now we get:

t.c:5:8: error: warning: ignoring directive for now
      ".code32\n"
       ^
<inline asm>:2:1: note: instantiated into assembly here
.code32
^

Note that we're pointing to line 5 properly now.  This implements
rdar://7839391 - inline asm errors should point to the right line in the asm
and makes the error message in PR8595 much less confusing.

llvm-svn: 119489
2010-11-17 08:25:26 +00:00
Chris Lattner 79ffdc7581 With the newly simplified SourceMgr interfaces and the generalized
SrcMgrDiagHandler, we can improve clang diagnostics for inline asm:
instead of reporting them on a source line of the original line,
we can report it on the correct line wherever the string literal came
from. For something like this:

void foo() {
  asm("push %rax\n"
      ".code32\n");
}

we used to get this: (note that the line in t.c isn't helpful)

t.c:4:7: error: warning: ignoring directive for now
  asm("push %rax\n"
      ^
<inline asm>:2:1: note: instantiated into assembly here
.code32
^

now we get:

t.c:5:8: error: warning: ignoring directive for now
      ".code32\n"
       ^
<inline asm>:2:1: note: instantiated into assembly here
.code32
^

Note that we're pointing to line 5 properly now.

llvm-svn: 119488
2010-11-17 08:20:42 +00:00
Chris Lattner 068f2ab10f adjust for llvm mainline, yay type safety
llvm-svn: 119487
2010-11-17 08:13:04 +00:00
Chris Lattner b0e36085c4 now that AsmPrinter::EmitInlineAsm is factored right, we can eliminate the
cookie argument to the SourceMgr diagnostic stuff.  This cleanly separates
LLVMContext's inlineasm handler from the sourcemgr error handling 
definition, increasing type safety and cleaning things up.

llvm-svn: 119486
2010-11-17 08:13:01 +00:00
Che-Liang Chiou c03d04ee1f Add simple arithmetics and %type directive for PTX
llvm-svn: 119485
2010-11-17 08:08:49 +00:00
Evan Cheng 655364797e Simplify code that toggle optional operand to ARM::CPSR.
llvm-svn: 119484
2010-11-17 08:06:50 +00:00
Chris Lattner 300fa45d8b rearrange how the handler in SourceMgr is installed, eliminating the use of
the cookie argument to setDiagHandler

llvm-svn: 119483
2010-11-17 08:03:32 +00:00
Chris Lattner 2a7f6fd9d4 refactor the interface to EmitInlineAsm a bit, no functionality change.
llvm-svn: 119482
2010-11-17 07:53:40 +00:00
Chris Lattner e925d61785 a metric ton of refactoring later, Sema::getLocationOfStringLiteralByte
no longer depends on Preprocessor, so we can move it out of Sema into
a nice new StringLiteral::getLocationOfByte method that can be used by
any AST client.

llvm-svn: 119481
2010-11-17 07:37:15 +00:00
Zhongxing Xu 35d023164c do not do post checks. Because at this point we just enter the call.
llvm-svn: 119480
2010-11-17 07:31:08 +00:00
Chris Lattner 39720111e0 move getSpelling from Preprocessor to Lexer, which it is more conceptually related to.
llvm-svn: 119479
2010-11-17 07:26:20 +00:00
Zhongxing Xu 366340298e Remove comments. We are already doing actual method call by inlining it.
llvm-svn: 119477
2010-11-17 07:21:49 +00:00
Chris Lattner 6bab435db6 propagate preprocessor out of StringLiteralParser. It is now
possible to create one without a preprocessor.

llvm-svn: 119476
2010-11-17 07:21:13 +00:00
Chris Lattner 2be8aa9611 push the preprocessor out of EncodeUCNEscape
llvm-svn: 119475
2010-11-17 07:12:42 +00:00
Chris Lattner 2a6ee91619 move AdvanceToTokenCharacter and getLocForEndOfToken from
Preprocessor to Lexer where they make more sense.

llvm-svn: 119474
2010-11-17 07:05:50 +00:00
Chris Lattner b1ab2c2d3d add a static version of PP::AdvanceToTokenCharacter.
llvm-svn: 119472
2010-11-17 06:55:10 +00:00
Chris Lattner bde1b81eb8 push use of Preprocessor out farther.
llvm-svn: 119471
2010-11-17 06:46:14 +00:00
Chris Lattner 3a324d3232 push use of Preprocessor out of getOffsetOfStringByte
llvm-svn: 119470
2010-11-17 06:35:43 +00:00
Chris Lattner 30d4c928ac add a static form of the efficient PP::getSpelling method.
llvm-svn: 119469
2010-11-17 06:31:48 +00:00
Chris Lattner 7a02bfdfce refactor the interface to StringLiteralParser::getOffsetOfStringByte,
pushing the dependency on the preprocessor out a bit.

llvm-svn: 119468
2010-11-17 06:26:08 +00:00
Marcin Swiderski 2b2cd0e6b4 Added mapping from 'this' to it's SymbolicRegion in BasicStoreManager::getInitialStore.
llvm-svn: 119467
2010-11-17 06:22:54 +00:00
Chris Lattner 776a30ddfc factor some code out to a helper function, no functionality change.
llvm-svn: 119464
2010-11-17 05:58:54 +00:00
Chris Lattner baf00151ba fix PR8613 - Copy constructor of SwitchInst does not call SwitchInst::init
llvm-svn: 119463
2010-11-17 05:41:46 +00:00
Chris Lattner 9fdd10dbce tidy up
llvm-svn: 119462
2010-11-17 05:41:32 +00:00
Bill Wendling b100f91754 The machine instruction no longer encodes the submode as a separate operand. We
should get the submode from the load/store multiple instruction's opcode.

llvm-svn: 119461
2010-11-17 05:31:09 +00:00
Bill Wendling 9898ac97fd Proper encoding for VLDM and VSTM instructions. The register lists for these
instructions have to distinguish between lists of single- and double-precision
registers in order for the ASM matcher to do a proper job. In all other
respects, a list of single- or double-precision registers are the same as a list
of GPR registers.

llvm-svn: 119460
2010-11-17 04:32:08 +00:00
Duncan Sands 7412f6e53d Fix a layering violation: hasConstantValue, which is part of the PHINode
class, uses DominatorTree which is an analysis.  This change moves all of
the tricky hasConstantValue logic to SimplifyInstruction, and replaces it
with a very simple literal implementation.  I already taught users of
hasConstantValue that need tricky stuff to use SimplifyInstruction instead.
I didn't update InlineFunction because the IR looks like it might be in a
funky state at the point it calls hasConstantValue, which makes calling
SimplifyInstruction dangerous since it can in theory do a lot of tricky
reasoning.  This may be a pessimization, for example in the case where
all phi node operands are either undef or a fixed constant.

llvm-svn: 119459
2010-11-17 04:30:22 +00:00