Daniel Dunbar
a7566f163a
IRgen: Add CreateMemTemp, for creating an temporary memory object for a particular type, and flood fill. - CreateMemTemp sets the alignment on the alloca correctly, which fixes a great many places in IRgen where we were doing the wrong thing.
...
- This fixes many many more places than the test case, but my feeling is we need to audit alignment systematically so I'm not inclined to try hard to test the individual fixes in this patch. If this bothers you, patches welcome!
PR6240.
llvm-svn: 95648
2010-02-09 02:48:28 +00:00
Daniel Dunbar
3d33fab7fc
Reapply r95393, without the change to CGExpr. I was wrong in assuming that the
...
element type always matched the converted LLVM type for ExprType.
llvm-svn: 95596
2010-02-08 22:53:07 +00:00
Anders Carlsson
cee2d2f016
Use the right linkage for static variables inside C++ inline functions.
...
llvm-svn: 95512
2010-02-07 02:03:08 +00:00
Douglas Gregor
a643780483
Revert r95393, which broke Clang's self-host.
...
llvm-svn: 95430
2010-02-05 21:10:36 +00:00
Daniel Dunbar
363589bded
IRgen: Use hasAggregateLLVMType instead of isSingleValueType() for cases that
...
need to deal with aggregates specially; this is consistent with the rest of IRgen.
Also, simplify EmitParmDecl and don't worry about using Decl::getNameAsString.
llvm-svn: 95393
2010-02-05 17:51:33 +00:00
Anders Carlsson
3b227bd629
Revert the new reference binding code; I came up with a way simpler solution for the reference binding bug that is preventing self-hosting.
...
llvm-svn: 95223
2010-02-03 16:38:03 +00:00
Anders Carlsson
ab0ddb57b1
Start creating CXXBindReferenceExpr nodes when binding complex types to references.
...
llvm-svn: 94964
2010-01-31 18:34:51 +00:00
Ken Dyck
160146eba2
Change the return type of ASTContext::getDeclAlignInBytes() to CharUnits and,
...
now that the "InBytes" part of the name is implied by the return type, rename
it to getDeclAlign().
llvm-svn: 94681
2010-01-27 17:10:57 +00:00
Ken Dyck
98ca79435a
Introduce CodeGenModule::GetTargetTypeStoreSize() to calculate the store size
...
of LLVM types in character units.
llvm-svn: 94542
2010-01-26 13:48:07 +00:00
Anders Carlsson
20bbbd489b
Make sure to always mark a global variable as not being constant if it has a C++ initializer.
...
llvm-svn: 94504
2010-01-26 04:02:23 +00:00
Ken Dyck
40775003e6
Roll out ASTContext::getTypeSizeInChars(), replacing instances of
...
"ASTContext::getTypeSize() / 8". Replace [u]int64_t variables with CharUnits
ones as appropriate.
Also rename RawType, fromRaw(), and getRaw() in CharUnits to QuantityType,
fromQuantity(), and getQuantity() for clarity.
llvm-svn: 93153
2010-01-11 17:06:35 +00:00
Anders Carlsson
61a401caec
Pass ReturnValueSlot to EmitCall. No functionality change yet.
...
llvm-svn: 92138
2009-12-24 19:25:24 +00:00
Ken Dyck
8c89d59c82
Move the implementation of ASTContext::getTypeSizeInChars() to the .cpp file to
...
avoid #including CharUnits.h in ASTContext.h.
llvm-svn: 91903
2009-12-22 14:23:30 +00:00
Ken Dyck
01e620efaa
Change the return type of ASTContext::getTypeSizeInChars() from uint64_t to the
...
new opaque value type, CharUnits. This will help us avoid accidentally mixing
quantities that are in bit and character units.
llvm-svn: 91689
2009-12-18 15:55:54 +00:00
Ken Dyck
acfe6aa83a
Rename getByteSize() and getTypeSizeInBytes() in ASTContext to getCharWidth()
...
and getTypeSizeInChars() to reflect their basis in character type units, not
that of a possibly independent architecture-specific byte.
llvm-svn: 91688
2009-12-18 15:24:05 +00:00
Mike Stump
aff69af918
Add cleanups for exceptional edges. WIP.
...
llvm-svn: 90940
2009-12-09 03:35:49 +00:00
Benjamin Kramer
ba8451b243
Use StringRef in CGDebugInfo::EmitFunctionStart.
...
llvm-svn: 90856
2009-12-08 14:04:35 +00:00
Benjamin Kramer
43c7c5befd
Use a Twine to concatenate the name instead of going through std::string.
...
llvm-svn: 90854
2009-12-08 13:07:37 +00:00
Chris Lattner
e99c110d06
implement rdar://7346691 by codegen'ing struct/array initializers
...
to a memset or a memcpy from a global when possible.
llvm-svn: 90658
2009-12-05 08:22:11 +00:00
Chris Lattner
ffcd06ea7c
simplify a condition and add a testcase.
...
llvm-svn: 90652
2009-12-05 06:49:57 +00:00
Anders Carlsson
ce2cd01647
Handle static_assert inside functions.
...
llvm-svn: 90461
2009-12-03 17:26:31 +00:00
Mike Stump
a68e2a2967
Add missing branch to exit. Seemingly obvious when I look at the
...
code, but to track this down was laborious.
llvm-svn: 90356
2009-12-02 23:28:08 +00:00
Daniel Dunbar
c76493a65d
Don't pass false (default) for isVolatile parameter to CreateLoad.
...
llvm-svn: 90098
2009-11-29 21:23:36 +00:00
Douglas Gregor
48a409eb39
Rename CleanupScope -> DelayedCleanupBlock. No functionality change.
...
llvm-svn: 89769
2009-11-24 16:21:10 +00:00
Daniel Dunbar
785406bd19
Teach CodeGenFunction::EmitDecl to ignore Using and UsingShadow decls.
...
llvm-svn: 89633
2009-11-23 00:07:06 +00:00
Mike Stump
643818bdd8
Trim whitespace.
...
llvm-svn: 89219
2009-11-18 18:52:31 +00:00
Chandler Carruth
bc55fe26c6
Move CompileOptions -> CodeGenOptions, and sink it into the CodeGen library.
...
This resolves the layering violation where CodeGen depended on Frontend.
llvm-svn: 86998
2009-11-12 17:24:48 +00:00
Douglas Gregor
4ef1d400d9
Make sure that Type::getAs<ArrayType>() (or Type::getAs<subclass of
...
ArrayType>()) does not instantiate. Update all callers that used this
unsafe feature to use the appropriate ASTContext::getAs*ArrayType method.
llvm-svn: 86596
2009-11-09 22:08:55 +00:00
Fariborz Jahanian
09cc10f9f8
This patch extends CleanupScope to support destruction
...
of array objects on block exit. Patch is by Anders Calrsson.
llvm-svn: 86032
2009-11-04 17:57:40 +00:00
Tanya Lattner
f9d41df093
Merge constant array and structures. This will create a global variables for arrays and structs that are constant and their initializer is constant. It is on by default but can be disable with the flag -fno-merge-all-constants.
...
llvm-svn: 85991
2009-11-04 01:18:09 +00:00
Mike Stump
53f9ded62b
Refine volatile handling, specifically, we must have the canonical
...
type to look at the volatile specifier. I found these all from just
hand auditing the code.
llvm-svn: 85967
2009-11-03 23:25:48 +00:00
Fariborz Jahanian
c9076fecdf
Patch for destruction of array of objects on block exit.
...
llvm-svn: 85512
2009-10-29 16:22:54 +00:00
Mike Stump
70197d5441
Fix 80-col violation.
...
llvm-svn: 84719
2009-10-21 00:42:55 +00:00
Nuno Lopes
8550cb250c
ignore 'using' directive in CodeGenFunction::EmitDecl(). this fixes PR5085
...
llvm-svn: 84255
2009-10-16 14:40:52 +00:00
Benjamin Kramer
abd5b90e4c
Simplify pointer creation with the new Type::getInt*Ptr methods.
...
llvm-svn: 83964
2009-10-13 10:07:13 +00:00
Devang Patel
3028a43f57
Revert 83567.
...
llvm-svn: 83676
2009-10-09 22:06:15 +00:00
Devang Patel
abf71fa9fc
Record location info before emiting alloca for arguments. This allows arguments to have proper location info.
...
llvm-svn: 83567
2009-10-08 18:53:37 +00:00
Anders Carlsson
e33eed5c1e
Set alignment on static function level decls and VLAs. Fixes PR5060.
...
llvm-svn: 82868
2009-09-26 18:16:06 +00:00
Mike Stump
2114d7c299
Improve debug info generation for __block variables.
...
llvm-svn: 82508
2009-09-22 02:12:52 +00:00
Anders Carlsson
ccbabc9645
Fix another byref bug. This should hopefully get QuickLookPlugins building successfully.
...
llvm-svn: 81681
2009-09-13 17:55:13 +00:00
Mike Stump
6768683933
Add FIXME for alignments that won't be honored.
...
llvm-svn: 81620
2009-09-12 18:58:28 +00:00
Anders Carlsson
f8e94f2008
Add support for __block variables with alignment greater than __alignof(void *).
...
llvm-svn: 81602
2009-09-12 02:44:18 +00:00
Anders Carlsson
0168f4b202
For __block variables, cache the LLVM types as well as which LLVM field where the variable is stored.
...
llvm-svn: 81599
2009-09-12 02:14:24 +00:00
Anders Carlsson
ecf9bf0158
GlobalDecl doesn't have an explicit constructor anymore.
...
llvm-svn: 81481
2009-09-10 23:43:36 +00:00
Anders Carlsson
10f2c10b83
Make the forwarding member of block byref structs be a pointer to the block byref struct itself.
...
llvm-svn: 81423
2009-09-10 01:32:12 +00:00
Daniel Dunbar
277aa36d68
Suppress build warning.
...
llvm-svn: 81384
2009-09-09 22:32:15 +00:00
Mike Stump
11289f4280
Remove tabs, and whitespace cleanups.
...
llvm-svn: 81346
2009-09-09 15:08:12 +00:00
Anders Carlsson
71d1d92d37
Make BuildByRefType take a ValueDecl instead of a QualType and an alignment.
...
llvm-svn: 81315
2009-09-09 02:51:03 +00:00
Anders Carlsson
49033712e4
Remove an ErrorUnsupported call.
...
llvm-svn: 79261
2009-08-17 18:24:57 +00:00
Anders Carlsson
5b106a7545
Add an IsInitializer flag to EmitAnyExpr. This is used to prevent temporaries from being destroyed when they're bound to a reference variable.
...
llvm-svn: 79179
2009-08-16 07:36:22 +00:00