summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGStmt.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* Fix assertion failure in CodeGen where the input operand to an asmPeter Collingbourne2011-07-291-1/+5
| | | | | | | instruction is tied to an output operand which is a pointer, and the input operand is narrower than the output operand. llvm-svn: 136438
* remove unneeded llvm:: namespace qualifiers on some core types now that ↵Chris Lattner2011-07-231-11/+11
| | | | | | | | LLVM.h imports them into the clang namespace. llvm-svn: 135852
* de-constify llvm::Type, patch by David Blaikie!Chris Lattner2011-07-181-6/+6
| | | | llvm-svn: 135370
* Convert CallInst and InvokeInst APIs to use ArrayRef.Jay Foad2011-07-151-1/+1
| | | | llvm-svn: 135265
* De-constify Types in StructType::get() and TargetData::getIntPtrType().Jay Foad2011-07-111-3/+3
| | | | llvm-svn: 134893
* clang side to match the LLVM IR type system rewrite patch.Chris Lattner2011-07-091-2/+2
| | | | llvm-svn: 134831
* Split out logic for valid clobbers and valid inline asm registers.Eric Christopher2011-06-281-0/+1
| | | | | | Fixes rdar://9281377 llvm-svn: 134016
* LValue carries a type now, so simplify the main EmitLoad/Store APIsJohn McCall2011-06-251-3/+2
| | | | | | by removing the redundant type parameter. llvm-svn: 133860
* Canonicalize register names properly.Eric Christopher2011-06-211-0/+2
| | | | | | Fixes rdar://9425559 llvm-svn: 133486
* Check the specific target to figure out if a constraint is a validEric Christopher2011-06-171-2/+5
| | | | | | | | | register constraint. Note that we're not checking if the register itself is valid for the constraint. Fixes rdar://9382985 llvm-svn: 133226
* Automatic Reference Counting.John McCall2011-06-151-1/+4
| | | | | | | | | | Language-design credit goes to a lot of people, but I particularly want to single out Blaine Garst and Patrick Beard for their contributions. Compiler implementation credit goes to Argyrios, Doug, Fariborz, and myself, in no particular order. llvm-svn: 133103
* Clang support for ARM Uv/Uy/Uq inline-asm constraints.Stuart Hastings2011-06-071-1/+1
| | | | | | rdar://problem/9037836 llvm-svn: 132737
* Rework r132576.Devang Patel2011-06-041-0/+5
| | | | | | Emit debug info only if there is an insertion point. The debug info should not force an insertion point. Codegen may later on decide to not emit code for some reason, see extensive comment in CodeGenFunction::EmitStmt(), and debug info should not get in the way. llvm-svn: 132610
* Emit debug info only if there is an insertion point. The debug info should ↵Devang Patel2011-06-031-7/+0
| | | | | | not force an insertion point. Codegen may later on decide to not emit code for some reason, see extensive comment in CodeGenFunction::EmitStmt(), and debug info should not get in the way. llvm-svn: 132576
* 80-column cleanup.Eric Christopher2011-06-031-2/+2
| | | | llvm-svn: 132548
* Fix the clang part of PR7952: rewrite the specialization of isa<> in DeclBase,Eli Friedman2011-05-211-1/+1
| | | | | | and stop abusing the multi-level dereference isa<> used to allow. llvm-svn: 131804
* Parsing/AST support for Structured Exception HandlingJohn Wiegley2011-04-281-0/+4
| | | | | | | | Patch authored by Sohail Somani. Provide parsing and AST support for Windows structured exception handling. llvm-svn: 130366
* PR9214: Convert Metadata API to use ArrayRef.Jay Foad2011-04-211-1/+1
| | | | llvm-svn: 129929
* use the newly introduced IRBuilder getInt() method to reduce someChris Lattner2011-04-191-17/+12
| | | | | | redundancy pointed out by John. llvm-svn: 129808
* Fix a miscompilation I introduced in r129652, thanks for Eli for tracking Chris Lattner2011-04-171-1/+9
| | | | | | | | | | | | | | | it down. we effectively were compile the testcase into: void test14(int x) { switch (x) { case 11: break; case 42: test14(97); // fallthrough default: test14(42); break; which is not the same thing at all. This fixes a miscompilation of MallocBench/gs seen on the clang-x86_64-linux-fnt buildbot. llvm-svn: 129679
* implement rdar://9289524 - case followed immediately by break results in ↵Chris Lattner2011-04-171-0/+14
| | | | | | | | empty IR block, a -O0 code quality issue. llvm-svn: 129652
* Add support for C++0x's range-based for loops, as specified by the C++11 ↵Richard Smith2011-04-141-0/+77
| | | | | | draft standard (N3291). llvm-svn: 129541
* Fix in r128471 is very broad. Some of the unconditional branches need line ↵Devang Patel2011-03-301-3/+6
| | | | | | | | number information for better user experience. Restrict the fix. This fixes break.exp failures from gdb testsuite. llvm-svn: 128513
* Do not line number entry for unconditional branches. Usually, users do not ↵Devang Patel2011-03-291-0/+3
| | | | | | want to stop at closing '}'. llvm-svn: 128471
* Make skipping of vardecls more precise: it's ok to skip a decl if the entireChris Lattner2011-02-281-3/+18
| | | | | | compound stmt containing the decl is skipped. llvm-svn: 126639
* make switch constant folding a bit stronger, handling a missed case.Chris Lattner2011-02-281-3/+8
| | | | llvm-svn: 126638
* remove a bogus assertion, add a comment.Chris Lattner2011-02-281-3/+1
| | | | llvm-svn: 126603
* make switch condition constant folding much more aggressive, handling Chris Lattner2011-02-281-1/+68
| | | | | | | compound statements and break statements. This implements enough to handle PR9322 and rdar://6970405. llvm-svn: 126602
* First tiny step to implementing PR9322: build infrastructure for only ↵Chris Lattner2011-02-281-0/+133
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | emitting the live case of a switch statement when switching on a constant. This is terribly limited, but enough to handle the trivial example included. Before we would emit: define void @test1(i32 %i) nounwind { entry: %i.addr = alloca i32, align 4 store i32 %i, i32* %i.addr, align 4 switch i32 1, label %sw.epilog [ i32 1, label %sw.bb ] sw.bb: ; preds = %entry %tmp = load i32* %i.addr, align 4 %inc = add nsw i32 %tmp, 1 store i32 %inc, i32* %i.addr, align 4 br label %sw.epilog sw.epilog: ; preds = %sw.bb, %entry switch i32 0, label %sw.epilog3 [ i32 1, label %sw.bb1 ] sw.bb1: ; preds = %sw.epilog %tmp2 = load i32* %i.addr, align 4 %add = add nsw i32 %tmp2, 2 store i32 %add, i32* %i.addr, align 4 br label %sw.epilog3 sw.epilog3: ; preds = %sw.bb1, %sw.epilog ret void } now we emit: define void @test1(i32 %i) nounwind { entry: %i.addr = alloca i32, align 4 store i32 %i, i32* %i.addr, align 4 %tmp = load i32* %i.addr, align 4 %inc = add nsw i32 %tmp, 1 store i32 %inc, i32* %i.addr, align 4 ret void } This improves -O0 compile time (less IR to generate and shove through the code generator) and the clever linux kernel people found a way to fail to build if we don't do this optimization. This step isn't enough to handle the kernel case though. llvm-svn: 126597
* Change the interface to ConstantFoldsToSimpleInteger to not encode Chris Lattner2011-02-271-3/+5
| | | | | | a bool + success into one tri-state integer, simplifying things. llvm-svn: 126592
* Re-instate r125819 and r125820 with no functionality changePeter Collingbourne2011-02-191-4/+5
| | | | llvm-svn: 126060
* Revert 125820 and 125819 to fix PR9266.Rafael Espindola2011-02-191-5/+4
| | | | llvm-svn: 126050
* Move TargetInfo::adjustInlineAsmType to TargetCodeGenInfoPeter Collingbourne2011-02-181-4/+5
| | | | llvm-svn: 125819
* Step #1/N of implementing support for __label__: split labels intoChris Lattner2011-02-171-9/+9
| | | | | | | | | | | | | | | | | | | LabelDecl and LabelStmt. There is a 1-1 correspondence between the two, but this simplifies a bunch of code by itself. This is because labels are the only place where we previously had references to random other statements, causing grief for AST serialization and other stuff. This does cause one regression (attr(unused) doesn't silence unused label warnings) which I'll address next. This does fix some minor bugs: 1. "The only valid attribute " diagnostic was capitalized. 2. Various diagnostics printed as ''labelname'' instead of 'labelname' 3. This reduces duplication of label checking between functions and blocks. Review appreciated, particularly for the cindex and template bits. llvm-svn: 125733
* Remove vtables from the Stmt hierarchy; this was pretty easy asJohn McCall2011-02-091-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | there were only three virtual methods of any significance. The primary way to grab child iterators now is with Stmt::child_range children(); Stmt::const_child_range children() const; where a child_range is just a std::pair of iterators suitable for being llvm::tie'd to some locals. I've left the old child_begin() and child_end() accessors in place, but it's probably a substantial penalty to grab the iterators individually now, since the switch-based dispatch is kindof inherently slower than vtable dispatch. Grabbing them together is probably a slight win over the status quo, although of course we could've achieved that with vtables, too. I also reclassified SwitchCase (correctly) as an abstract Stmt class, which (as the first such class that wasn't an Expr subclass) required some fiddling in a few places. There are somewhat gross metaprogramming hooks in place to ensure that new statements/expressions continue to implement getSourceRange() and children(). I had to work around a recent clang bug; dgregor actually fixed it already, but I didn't want to introduce a selfhosting dependency on ToT. llvm-svn: 125183
* Reorganize CodeGen{Function,Module} to eliminate the unfortunateJohn McCall2011-02-081-22/+21
| | | | | | | | Block{Function,Module} base class. Minor other refactorings. Fixed a few address-space bugs while I was there. llvm-svn: 125085
* Fix a latent bug where, after emitting an expression statement, we wouldJohn McCall2011-01-121-8/+24
| | | | | | | | | | | | | | delete the block we began emitting into if it had no predecessors. We never want to do this, because there are several valid cases during statement emission where an existing block has no known predecessors but will acquire some later. The case in my test case doesn't inherently fall into this category, because we could safely emit the case-range code before the statement body, but there are examples with labels that can't be fallen into that would also demonstrate this bug. rdar://problem/8837067 llvm-svn: 123303
* fix a -Wself-assign warningChris Lattner2011-01-051-1/+1
| | | | llvm-svn: 122894
* Add support for passing variables declared to use a xmm register to asmRafael Espindola2011-01-021-1/+2
| | | | | | statements using the "x" constraint. llvm-svn: 122679
* Produce a better error message for invalid register names.Rafael Espindola2011-01-011-4/+1
| | | | llvm-svn: 122670
* Fix typo and add comment.Rafael Espindola2011-01-011-5/+8
| | | | llvm-svn: 122669
* Add support for declaring register contraints in variables. They are only usedRafael Espindola2010-12-301-0/+34
| | | | | | | | | | | | | | in asm statements: register int foo asm("rdi"); asm("..." : ... "r" (foo) ... We also only accept these variables if the constraint in the asm statement is "r". This fixes most of PR3933. llvm-svn: 122643
* Fix a bug in the emission of __real/__imag l-values on scalar operands.John McCall2010-12-051-7/+22
| | | | | | | | | Fix a bug in the emission of complex compound assignment l-values. Introduce a method to emit an expression whose value isn't relevant. Make that method evaluate its operand as an l-value if it is one. Fixes our volatile compliance in C++. llvm-svn: 120931
* When forming the !srcloc mdnode for an inline asm, add the SourceLocations Chris Lattner2010-11-171-4/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* factor some code out to a helper function, no functionality change.Chris Lattner2010-11-171-4/+10
| | | | llvm-svn: 119464
* Generate bitcasts going in and out of MMX parametersDale Johannesen2010-10-291-1/+10
| | | | | | | | | in asm's. PR 8501, 8602988. I don't like including Type.h where it is; the idea was to get references to X86_MMXTy out of the common code. Maybe there's a better way? llvm-svn: 117736
* Implement an indirect-goto optimization for goto *&&lbl and respect thisJohn McCall2010-10-281-0/+5
| | | | | | | | | | | | | | in the scope checker. With that done, turn an indirect goto into a protected scope into a hard error; otherwise IR generation has to start worrying about declarations not dominating their scopes, as exemplified in PR8473. If this really affects anyone, I can probably adjust this to only hard-error on possible indirect gotos into VLA scopes rather than arbitrary scopes. But we'll see how people cope with the aggressive change on the marginal feature. llvm-svn: 117539
* Death to blocks, or at least the word "block" in one particular obnoxiouslyJohn McCall2010-10-151-4/+4
| | | | | | ambiguous context. llvm-svn: 116567
* Added '|' delimiter to separate inline asm multiple alternative constraints ↵John Thompson2010-09-181-6/+3
| | | | | | for Clang side of support. llvm-svn: 114253
* one piece of code is responsible for the lifetime of every aggregateJohn McCall2010-09-151-4/+4
| | | | | | | | | | | | | slot. The easiest way to do that was to bundle up the information we care about for aggregate slots into a new structure which demands that its creators at least consider the question. I could probably be convinced that the ObjC 'needs GC' bit should be rolled into this structure. Implement generalized copy elision. The main obstacle here is that IR-generation must be much more careful about making sure that exactly llvm-svn: 113962
OpenPOWER on IntegriCloud