зеркало из https://github.com/microsoft/clang-1.git
Initial work on refactoring GNU runtime code (long overdue - it's quite obvious
that I hadn't used C++ for several years before writing most of this code). Still lots more to do. This set of changes includes: - Remove the distinction between typed and untyped selectors. More accurately reflect what the runtime does, by using typed selectors everywhere, with an empty type field if the types are unknown. Now we just store a small list of types for each selector (in theory, this should always be exactly one, but this constraint was not enforced back in 1986 when it should have been). - Add some consistency to how runtime functions are created. These are all generated via the LazyRuntimeFunction class (which might be useful outside CGObjCGNU - feel free to move it into a header if it is). This function stores the types of a function, looks it up the first time it's used, and caches the result. This means that we're now not wasting time constructing the llvm::FunctionType every time some of the functions are looked up, but also not inserting references to runtime functions into the module if they're not actually used. - Started separating out the fragile and non-fragile ABI behaviours into two subclasses of CGObjCGNU: CGObjCGCC for the legacy GCC runtime ABI and CGObjCGNUstep for the new GNUstep ABI. Not all of the differences in behaviour are factored out yet, but they will be in future commits. - Removed all of the CodeGen:: things: we've been using namespace CodeGen in this file for ages, so having explicit namespace specifiers is just a bit confusing. - Added a few more comments. - Used llvm::StringRef instead of std::string in a few places. - Finally got around to storing the module path in the module structure. The ABI says that the compiler should do this, although it's not used in the runtime or exposed outside the runtime, so it's pretty useless. Still to do: - We currently have two code paths for generating try blocks, one for ObjC and one for ObjC++. Not only are these substantially similar, they are also very similar to the CGObjCMac version. These need factoring out into a single parameterised implementation, either in CGObjCRuntime or CodeGenFunction. The EmitObjCXXTryStmt() function was added so that the changes to fix a bug in time for the 2.9 release would be self-contained and reduce the chances of breaking anything else, but these should be done properly as soon as possible. - Split up some large functions (e.g. GenerateClass()) into smaller functions for generating the various data structures. - The method lookup code into the two subclasses, removing the conditionals in the message send functions. - Add doxygen comments on the remaining undocumented functions. - We seem to be generating global pointer variables for selectors, then storing a pointer to the selector, then generating a load of this pointer (and then a load of the real selector later) every time a static selector is used. I can only assume I was asleep or drunk when I did this - we should just be referencing the selectors directly in the selector array. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@128152 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
e80d567717
Коммит
9f6614e3c5
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
Загрузка…
Ссылка в новой задаче