diff options
| author | Anton Korobeynikov <asl@math.spbu.ru> | 2008-07-09 13:18:02 +0000 |
|---|---|---|
| committer | Anton Korobeynikov <asl@math.spbu.ru> | 2008-07-09 13:18:02 +0000 |
| commit | 21539c6d1ee7d2ca494bde26b9f3dccfc52d8635 (patch) | |
| tree | ef44b43ff24708504c8e3771d3dd9946c7d9983b /llvm | |
| parent | aab504fb191f30d467b4dffe18221b29e2d31a46 (diff) | |
| download | bcm5719-llvm-21539c6d1ee7d2ca494bde26b9f3dccfc52d8635.tar.gz bcm5719-llvm-21539c6d1ee7d2ca494bde26b9f3dccfc52d8635.zip | |
Add default section name resolution routine
llvm-svn: 53292
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/include/llvm/Target/TargetAsmInfo.h | 4 | ||||
| -rw-r--r-- | llvm/lib/Target/TargetAsmInfo.cpp | 12 |
2 files changed, 16 insertions, 0 deletions
diff --git a/llvm/include/llvm/Target/TargetAsmInfo.h b/llvm/include/llvm/Target/TargetAsmInfo.h index 7af2c03aa63..3f7dbc7206d 100644 --- a/llvm/include/llvm/Target/TargetAsmInfo.h +++ b/llvm/include/llvm/Target/TargetAsmInfo.h @@ -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 { diff --git a/llvm/lib/Target/TargetAsmInfo.cpp b/llvm/lib/Target/TargetAsmInfo.cpp index 404e152da7b..8e34fc30ec5 100644 --- a/llvm/lib/Target/TargetAsmInfo.cpp +++ b/llvm/lib/Target/TargetAsmInfo.cpp @@ -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(); +} |

