OSDN Git Service

Move the section name from GlobalObject to the LLVMContext
authorReid Kleckner <rnk@google.com>
Tue, 10 Jan 2017 23:23:58 +0000 (23:23 +0000)
committerReid Kleckner <rnk@google.com>
Tue, 10 Jan 2017 23:23:58 +0000 (23:23 +0000)
commit7b6850372ecd64d85ede49b6e5ac5a01f1e2d15e
treeec3991c415e1f5ba5a316f6852ff12a822c981fc
parentb5f78ed021d44934c3a9b7dd8a0c07c95a28e0b1
Move the section name from GlobalObject to the LLVMContext

Summary:
Convention wisdom says that bytes in Function are precious, and the
vast, vast majority of globals do not live in special sections. Even
when they do, they tend to live in the same section. Store the section
name on the LLVMContext in a StringSet, and maintain a map from
GlobalObject* to section name like we do for metadata, prefix data, etc.

The fact that we've survived this long wasting at least three pointers
of space in Function suggests that Function bytes are perhaps not as
precious as we once thought. Given that most functions have metadata
attachments when debug info is enabled, we might consider adding a
pointer here to make that access more efficient.

Reviewers: jlebar, dexonsmith, mehdi_amini

Subscribers: mehdi_amini, aprantl, llvm-commits

Differential Revision: https://reviews.llvm.org/D28150

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@291613 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/IR/GlobalObject.h
lib/IR/Globals.cpp
lib/IR/LLVMContextImpl.h