Add default section name resolution routine

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@53292 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Anton Korobeynikov 2008-07-09 13:18:02 +00:00
parent 8cc948d228
commit 0c602469f4
2 changed files with 16 additions and 0 deletions

View File

@ -471,6 +471,10 @@ namespace llvm {
SectionFlagsForGlobal(const GlobalValue *GV = NULL,
const char* name = NULL) const;
/// SectionForGlobal - This hooks returns proper section name for given
/// global with all necessary flags and marks.
const char* SectionForGlobal(const GlobalValue *GV) const;
// Accessors.
//
const char *getTextSection() const {

View File

@ -254,3 +254,15 @@ TargetAsmInfo::SectionFlagsForGlobal(const GlobalValue *GV,
return flags;
}
const char*
TargetAsmInfo::SectionForGlobal(const GlobalValue *GV) const {
SectionKind::Kind kind = SectionKindForGlobal(GV);
if (kind == SectionKind::Text)
return getTextSection();
else if (kind == SectionKind::BSS && getBSSSection())
return getBSSSection();
return getDataSection();
}