summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExpr.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
* This patch is motivated by numerous strict-aliasing warnings when compilingTed Kremenek2008-06-171-12/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | clang as a Release build. The big change is that all AST nodes (subclasses of Stmt) whose children are Expr* store their children as Stmt* or arrays of Stmt*. This is to remove strict-aliasing warnings when using StmtIterator. None of the interfaces of any of the classes have changed (except those with arg_iterators, see below), as the accessor methods introduce the needed casts (via cast<>). While this extra casting may seem cumbersome, it actually adds some important sanity checks throughout the codebase, as clients using StmtIterator can potentially overwrite children that are expected to be Expr* with Stmt* (that aren't Expr*). The casts provide extra sanity checks that are operational in debug builds to catch invariant violations such as these. For classes that have arg_iterators (e.g., CallExpr), the definition of arg_iterator has been replaced. Instead of it being Expr**, it is an actual class (called ExprIterator) that wraps a Stmt**, and provides the necessary operators for iteration. The nice thing about this class is that it also uses cast<> to type-checking, which introduces extra sanity checks throughout the codebase that are useful for debugging. A few of the CodeGen functions that use arg_iterator (especially from OverloadExpr) have been modified to take begin and end iterators instead of a base Expr** and the number of arguments. This matches more with the abstraction of iteration. This still needs to be cleaned up a little bit, as clients expect that ExprIterator is a RandomAccessIterator (which we may or may not wish to allow for efficiency of representation). This is a fairly large patch. It passes the tests (except CodeGen/bitfield.c, which was already broken) on both a Debug and Release build, but it should obviously be reviewed. llvm-svn: 52378
* Basic support for volatile loads and stores. Stores the volatile Eli Friedman2008-06-131-38/+64
| | | | | | | | | | qualifier in the lvalue, and changes lvalue loads/stores to honor the volatile flag. Places which need some further attention are marked with FIXMEs. Patch by Cédric Venet. llvm-svn: 52264
* First cut at setting attributes for functions and calls; this puts us Eli Friedman2008-06-011-0/+23
| | | | | | | | | | | | | | | much closer to passing the gcc struct layout tests. It might be possible to refactor this a bit, but I'm not sure there's actually enough common code for that to be useful. To get the calling convention completely correct, a bit of platform-specific code is necessary even for x86-Linux. On x86-Linux, the alignment of function parameters is extremely strange; as far as I can tell, it's always 4 except for SSE vectors or structs containing SSE vectors. I'm continuing to investigate this. llvm-svn: 51839
* Minor cleanup to use the ConvertTypeForMem helper.Eli Friedman2008-06-011-5/+3
| | | | llvm-svn: 51837
* Rearrange EmitLValueForField a bit to work properly for _Bool bitfields Eli Friedman2008-05-291-10/+9
| | | | | | | in unions (we don't want to do the union-specific bitcast for bit-fields). llvm-svn: 51678
* Change uses of llvm::Type::isFirstClassType to use the newDan Gohman2008-05-221-1/+1
| | | | | | | | | | | | llvm::Type::isSingleValueType. Currently these two functions have the same behavior, but soon isFirstClassType will return true for struct and array types. Clang may some day want to use of isFirstClassType for some of these some day as an optimization, but it'll require some consideration. llvm-svn: 51446
* Move getAccessedFieldNo out of lib/AST/Expr.cpp intoDan Gohman2008-05-221-5/+15
| | | | | | | | | lib/CodeGen/CGExpr.cpp and to change include/clang/AST/Attr.h to use its own enum for visibility types instead of using llvm::GlobalValue::VisibilityTypes. These changes eliminate dependencies in the AST library on LLVM's VMCore library. llvm-svn: 51398
* Remove an unnecessary/buggy if check. Ran into this with some other Eli Friedman2008-05-211-6/+4
| | | | | | changes in my tree, so I don't have a testcase which affects trunk. llvm-svn: 51371
* Fix the emission of expressions like char a[10] = "asdf"; previously, Eli Friedman2008-05-191-0/+7
| | | | | | | | they were causing bad code to be emitted. There are two fixes here: one makes sure we emit a string that is long enough, and one makes sure we properly handle string initialization in init lists. llvm-svn: 51259
* Fix support for _Bool bitfields. The issue is that the bitfield width Eli Friedman2008-05-171-4/+20
| | | | | | | | | | | | used for _Bool is not the same as the primitive width (which for _Bool is 1 bit). The load and store changes add some casts to make the types consistent. The EmitLValue changes make sure that the pointer is of an appropriate type for loading the bitfield. This isn't perfect, but it's an improvement, and getting everything right depends on actually laying out structs in an ABI-compliant way. llvm-svn: 51224
* Add codegen support for block-level compound literals.Eli Friedman2008-05-131-0/+20
| | | | llvm-svn: 51081
* Remove AST dependency on VMCore by switching ExtVectorElementExpr off Constant.Nate Begeman2008-05-131-21/+30
| | | | llvm-svn: 51068
* Extend vector member references to include {.hi, .lo, .e, .o} which return aNate Begeman2008-05-091-8/+27
| | | | | | | | | | | | | vector of the same element type and half the width, with the high, low, even, and odd elements respectively. Allow member references to member references, so that .hi.hi gives you the high quarter of a vector. This is fairly convenient syntax for some insert/extract operations. Remove some unnecessary methods/types in the ExtVectorElementExpr class. llvm-svn: 50892
* OCUVector -> ExtVector, shorthand for extended vector, per feedback from Chris.Nate Begeman2008-04-181-23/+25
| | | | llvm-svn: 49942
* Remove FileVarDecl and BlockVarDecl. They are replaced by ↵Steve Naroff2008-04-151-7/+7
| | | | | | | | VarDecl::isBlockVarDecl() and VarDecl::isFileVarDecl(). This is a fairly mechanical/large change. As a result, I avoided making any changes/simplifications that weren't directly related. I did break two Analysis tests. I also have a couple FIXME's in UninitializedValues.cpp. Ted, can you take a look? If the bug isn't obvious, I am happy to dig in and fix it (since I broke it). llvm-svn: 49748
* Since isComplexType() no longer returns true for _Complex integers, the codeChris Lattner2008-04-041-4/+4
| | | | | | generator needs to call isAnyComplexType(). This fixes PR1960. llvm-svn: 49220
* Codegen assignment to self correctly, patch by David Chisnall!Chris Lattner2008-04-041-2/+10
| | | | llvm-svn: 49201
* some cleanups on top of David's patch. There are still twoChris Lattner2008-03-301-23/+18
| | | | | | | | | | | | | remaining open issues I've communicated to him: 1) self can be assigned to, and his patch didn't handle it correctly. 2) CollectObjCIvarTypes is N^2 (because each subclass reprocesses all parent class ivars) and flattens classes. If A derives from B, and both have an int, I'd expect to get { {i32}, i32}, not { i32, i32}. David, please review. llvm-svn: 48970
* Add initial support for objc codegen for methods, ivars, and theChris Lattner2008-03-301-0/+39
| | | | | | etoile runtime, patch by David Chisnall! llvm-svn: 48969
* simplify the clang codegen by using the new Builder.CreateStructGEP method.Chris Lattner2008-03-191-20/+15
| | | | llvm-svn: 48534
* Make a major restructuring of the clang tree: introduce a top-levelChris Lattner2008-03-151-0/+615
lib dir and move all the libraries into it. This follows the main llvm tree, and allows the libraries to be built in parallel. The top level now enforces that all the libs are built before Driver, but we don't care what order the libs are built in. This speeds up parallel builds, particularly incremental ones. llvm-svn: 48402
OpenPOWER on IntegriCloud