[llvm-commits] [llvm] r53292 - in /llvm/trunk: include/llvm/Target/TargetAsmInfo.h lib/Target/TargetAsmInfo.cpp
Anton Korobeynikov
asl at math.spbu.ru
Wed Jul 9 06:18:02 PDT 2008
Author: asl
Date: Wed Jul 9 08:18:02 2008
New Revision: 53292
URL: http://llvm.org/viewvc/llvm-project?rev=53292&view=rev
Log:
Add default section name resolution routine
Modified:
llvm/trunk/include/llvm/Target/TargetAsmInfo.h
llvm/trunk/lib/Target/TargetAsmInfo.cpp
Modified: llvm/trunk/include/llvm/Target/TargetAsmInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetAsmInfo.h?rev=53292&r1=53291&r2=53292&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetAsmInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetAsmInfo.h Wed Jul 9 08:18:02 2008
@@ -471,6 +471,10 @@
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 {
Modified: llvm/trunk/lib/Target/TargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetAsmInfo.cpp?rev=53292&r1=53291&r2=53292&view=diff
==============================================================================
--- llvm/trunk/lib/Target/TargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/TargetAsmInfo.cpp Wed Jul 9 08:18:02 2008
@@ -254,3 +254,15 @@
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();
+}
More information about the llvm-commits
mailing list