Commit Graph

40 Commits

Author SHA1 Message Date
Rafael Espindola bb9e7a3d06 Update for llvm api change.
llvm-svn: 210204
2014-06-04 18:51:46 +00:00
Craig Topper 8a13c4180e [C++11] Use 'nullptr'. CodeGen edition.
llvm-svn: 209272
2014-05-21 05:09:00 +00:00
Craig Topper 4f12f10de4 [C++11] Add 'override' keyword to virtual methods that override their base class.
llvm-svn: 203643
2014-03-12 06:41:41 +00:00
Chandler Carruth c80ceea90b [Modules] Update to reflect the move of CallSite into the IR library in
LLVM r202816.

llvm-svn: 202817
2014-03-04 11:02:08 +00:00
Mark Lacey a8e7df3602 Add CodeGenABITypes.h for use in LLDB.
CodeGenABITypes is a wrapper built on top of CodeGenModule that exposes
some of the functionality of CodeGenTypes (held by CodeGenModule),
specifically methods that determine the LLVM types appropriate for
function argument and return values.

I addition to CodeGenABITypes.h, CGFunctionInfo.h is introduced, and the
definitions of ABIArgInfo, RequiredArgs, and CGFunctionInfo are moved
into this new header from the private headers ABIInfo.h and CGCall.h.

Exposing this functionality is one part of making it possible for LLDB
to determine the actual ABI locations of function arguments and return
values, making it possible for it to determine this for any supported
target without hard-coding ABI knowledge in the LLDB code.

llvm-svn: 193717
2013-10-30 21:53:58 +00:00
John McCall c8e0170578 Standardize accesses to the TargetInfo in IR-gen.
Patch by Stephen Lin!

llvm-svn: 179638
2013-04-16 22:48:15 +00:00
John McCall 882987f30c Use the actual ABI-determined C calling convention for runtime
calls and declarations.

LLVM has a default CC determined by the target triple.  This is
not always the actual default CC for the ABI we've been asked to
target, and so we sometimes find ourselves annotating all user
functions with an explicit calling convention.  Since these
calling conventions usually agree for the simple set of argument
types passed to most runtime functions, using the LLVM-default CC
in principle has no effect.  However, the LLVM optimizer goes
into histrionics if it sees this kind of formal CC mismatch,
since it has no concept of CC compatibility.  Therefore, if this
module happens to define the "runtime" function, or got LTO'ed
with such a definition, we can miscompile;  so it's quite
important to get this right.

Defining runtime functions locally is quite common in embedded
applications.

llvm-svn: 176286
2013-02-28 19:01:20 +00:00
Chandler Carruth ff0e3a1e1c Rework the bitfield access IR generation to address PR13619 and
generally support the C++11 memory model requirements for bitfield
accesses by relying more heavily on LLVM's memory model.

The primary change this introduces is to move from a manually aligned
and strided access pattern across the bits of the bitfield to a much
simpler lump access of all bits in the bitfield followed by math to
extract the bits relevant for the particular field.

This simplifies the code significantly, but relies on LLVM to
intelligently lowering these integers.

I have tested LLVM's lowering both synthetically and in benchmarks. The
lowering appears to be functional, and there are no really significant
performance regressions. Different code patterns accessing bitfields
will vary in how this impacts them. The only real regressions I'm seeing
are a few patterns where the LLVM code generation for loads that feed
directly into a mask operation don't take advantage of the x86 ability
to do a smaller load and a cheap zero-extension. This doesn't regress
any benchmark in the nightly test suite on my box past the noise
threshold, but my box is quite noisy. I'll be watching the LNT numbers,
and will look into further improvements to the LLVM lowering as needed.

llvm-svn: 169489
2012-12-06 11:14:44 +00:00
Chandler Carruth 3a02247dc9 Sort all of Clang's files under 'lib', and fix up the broken headers
uncovered.

This required manually correcting all of the incorrect main-module
headers I could find, and running the new llvm/utils/sort_includes.py
script over the files.

I also manually added quite a few missing headers that were uncovered by
shuffling the order or moving headers up to be main-module-headers.

llvm-svn: 169237
2012-12-04 09:13:33 +00:00
Eli Friedman 8593748ed5 Put something sane in the DWARF offset field for bitfield ObjC ivars.
This is useful because unnamed bitfields can have effects on the
offsets which are not otherwise reflected in the DWARF information.

<rdar://problem/12629719>

llvm-svn: 167503
2012-11-06 23:40:48 +00:00
Eli Friedman 8cbca20a59 Back out 167431+167437+167487; I didn't realize how incomplete our test
coverage of this code is.

llvm-svn: 167495
2012-11-06 22:15:52 +00:00
Eli Friedman 5a56bb83cc Propagate CharUnits into ObjC CodeGen. No intended functional change.
llvm-svn: 167431
2012-11-06 01:51:20 +00:00
John McCall 8dda7b27ee Distinguish more carefully between free functions and C++ instance methods
in the ABI arrangement, and leave a hook behind so that we can easily
tweak CCs on platforms that use different CCs by default for C++
instance methods.

llvm-svn: 159894
2012-07-07 06:41:13 +00:00
Eli Friedman c24e2fb1fb Propagate lvalue alignment into bitfields. Per report on cfe-dev.
llvm-svn: 159295
2012-06-27 21:19:48 +00:00
James Dennett 9426c6c6d3 Documentation fix: made the name given to \param match the code.
llvm-svn: 158511
2012-06-15 09:02:08 +00:00
David Blaikie bbafb8a745 Unify naming of LangOptions variable/get function across the Clang stack (Lex to AST).
The member variable is always "LangOpts" and the member function is always "getLangOpts".

Reviewed by Chris Lattner

llvm-svn: 152536
2012-03-11 07:00:24 +00:00
John McCall a729c62b81 Whether an argument is required (in contrast with being an
optional argument passed through the variadic ellipsis)
potentially affects how we need to lower it.  Propagate
this information down to the various getFunctionInfo(...)
overloads on CodeGenTypes.  Furthermore, rename those
overloads to clarify their distinct purposes, and make
sure we're calling the right one in the right place.
This has a nice side-effect of making it easier to construct
a function type, since the 'variadic' bit is no longer
separable.

This shouldn't really change anything for our existing
platforms, with one minor exception --- we should now call
variadic ObjC methods with the ... in the "right place"
(see the test case), which I guess matters for anyone
running GNUStep on MIPS.  Mostly it's just a substantial
clean-up.

llvm-svn: 150788
2012-02-17 03:33:10 +00:00
Chris Lattner ece0409a1a simplify a bunch of code to use the well-known LLVM IR types computed by CodeGenModule.
llvm-svn: 149943
2012-02-07 00:39:47 +00:00
John McCall 9701731a3e When initializing a catch variable in ARC, be sure to emit retains
or whatever else is required for the initialization instead of
assuming it can be done with a simple store.

Fixes PR11732.

llvm-svn: 148325
2012-01-17 20:16:56 +00:00
Eli Friedman 3184a5e482 Switch a few callers of MakeAddrLValue places over to MakeNaturalAlignAddrLValue.
llvm-svn: 146920
2011-12-19 23:03:09 +00:00
Douglas Gregor 0b144e160a Replace all comparisons between ObjCInterfaceDecl pointers with calls
to declaresSameEntity(), as a baby step toward tracking forward
declarations of Objective-C classes precisely. Part of
<rdar://problem/10583531>.

llvm-svn: 146618
2011-12-15 00:29:59 +00:00
Eric Christopher 7ec8ec8581 Add block information for ObjC @catch blocks.
Fixes rdar://10282889

llvm-svn: 142467
2011-10-19 00:44:01 +00:00
Richard Smith caf3390d44 Constant expression evaluation refactoring:
- Remodel Expr::EvaluateAsInt to behave like the other EvaluateAs* functions,
   and add Expr::EvaluateKnownConstInt to capture the current fold-or-assert
   behaviour.
 - Factor out evaluation of bitfield bit widths.
 - Fix a few places which would evaluate an expression twice: once to determine
   whether it is a constant expression, then again to get the value.

llvm-svn: 141561
2011-10-10 18:28:20 +00:00
Bill Wendling 79a70e42b0 Refactor the load of the exception pointer and the exception selector from their
storage slot into helper functions.

llvm-svn: 139826
2011-09-15 18:57:19 +00:00
Douglas Gregor e8bbc12152 Extend the ASTContext constructor to delay the initialization of
builtin types (When requested). This is another step toward making
ASTUnit build the ASTContext as needed when loading an AST file,
rather than doing so after the fact. No actual functionality change (yet).

llvm-svn: 138985
2011-09-02 00:18:52 +00:00
John McCall 8e4c74bb7c Simplify EH control flow by observing that EH scopes form a simple
hierarchy of delegation, and that EH selector values are meaningful
function-wide (good thing, too, or inlining wouldn't work).
2,3d
1a
hierarchy of delegation and that EH selector values have the same
meaning everywhere in the function instead of being meaningful only
in the context of a specific selector.

This removes the need for routing edges through EH cleanups,
since a cleanup simply always branches to its enclosing scope.

llvm-svn: 137293
2011-08-11 02:22:43 +00:00
John McCall d9bb743e0d The lock operand to an @synchronized statement is also
supposed to be a full-expression;  make it so.  In ARC, make sure
we retain the lock for the entire protected block. 

llvm-svn: 136271
2011-07-27 21:50:02 +00:00
Chris Lattner 0e62c1cc0b remove unneeded llvm:: namespace qualifiers on some core types now that LLVM.h imports
them into the clang namespace.

llvm-svn: 135852
2011-07-23 10:55:15 +00:00
Jordy Rose a91768e569 Add a const overload for ObjCInterfaceDecl::all_declared_ivar_begin.
This was previously not-const only because it has to lazily construct a chain
of ivars the first time it is called (and after the chain is invalidated).
In practice, all the clients were just const_casting their const Decls;
all those now-unnecessary const_casts have been removed.

llvm-svn: 135741
2011-07-22 02:08:32 +00:00
Chris Lattner 2192fe50da de-constify llvm::Type, patch by David Blaikie!
llvm-svn: 135370
2011-07-18 04:24:23 +00:00
Jay Foad 5bd375a6cc Convert CallInst and InvokeInst APIs to use ArrayRef.
llvm-svn: 135265
2011-07-15 08:37:34 +00:00
John McCall 30317fda63 Generalize Cleanup::Emit's "isForEH" parameter into a set
of flags.  No functionality change.

llvm-svn: 134997
2011-07-12 20:27:29 +00:00
Fariborz Jahanian b26d578b41 Eliminate most uses of ShallowCollectObjCIvars which requires
a vector for collection. Use iterators where needed instead.
// rdar://6817577

llvm-svn: 134015
2011-06-28 18:05:25 +00:00
John McCall 6b0feb7ed6 Emit @finally blocks completely lazily instead of forcing their
existence by always threading an edge from the catchall.  Not doing
this was previously causing a crash in the very extreme case where
neither the normal cleanup nor the EH catchall was actually reachable:
we would delete the catchall entry block, which would cause us to
delete the entry block of the finally cleanup as well because the
cleanup logic would merge the blocks, which in turn triggered an assert
because later blocks in the finally would still be using values from the
entry.  Laziness turns out to be the most elegant solution to the problem.

llvm-svn: 133601
2011-06-22 02:32:12 +00:00
John McCall 1553b19067 Restore correct use of GC barriers.
llvm-svn: 133144
2011-06-16 04:16:24 +00:00
David Chisnall 3fe89562e8 Fix some problems where functions must be bitcast but we're expecting a llvm::Function of the right type.
PR9994.

llvm-svn: 131930
2011-05-23 22:33:28 +00:00
John McCall 3f6e745292 Make this code more resilient against catch variables which need cleanups.
llvm-svn: 131215
2011-05-12 01:00:15 +00:00
Ken Dyck abae3beec5 Replace some literal 8s with char width and char align. No change in
functionality intended.

llvm-svn: 129996
2011-04-22 17:23:43 +00:00
Ken Dyck 3563aa6520 Replace a couple of divide-by-8s with divide-by-charwidths. No change in
functionality intended.

llvm-svn: 129496
2011-04-14 01:00:39 +00:00
David Chisnall d3858d6b0c Continuing work on ObjC tidyup:
- Moved the CGObjCRuntime functions out of CGObjCMac.cpp into CGObjCRuntime.cpp

- Added generic functions in CGObjCRuntime for emitting @try and @synchronize
  blocks, usable by any runtime that uses DWARF exceptions.

- Made the GNU runtimes use these functions.

It should now be possible to replace the equivalent functions in
CGObjCNonFragileABIMac with simple calls to these two functions, providing the
runtime functions as arguments.  I'll post a diff to the list for review before
making any changes to the Mac runtime stuff.

llvm-svn: 128274
2011-03-25 11:57:33 +00:00