aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-07-25 18:11:58 +0000
committerChris Lattner <sabre@nondot.org>2009-07-25 18:11:58 +0000
commit4f05591e616497d88053c6b2c72d94b1365f10bd (patch)
tree5cb6a6161ccf18a851802a8cdd6e2445d2587c25
parent10cf6a6a4bdc5a99813cc464030b93466842ffc2 (diff)
downloadexternal_llvm-4f05591e616497d88053c6b2c72d94b1365f10bd.zip
external_llvm-4f05591e616497d88053c6b2c72d94b1365f10bd.tar.gz
external_llvm-4f05591e616497d88053c6b2c72d94b1365f10bd.tar.bz2
document some invariants.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77084 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/Target/TargetAsmInfo.h7
-rw-r--r--lib/Target/TargetAsmInfo.cpp7
2 files changed, 10 insertions, 4 deletions
diff --git a/include/llvm/Target/TargetAsmInfo.h b/include/llvm/Target/TargetAsmInfo.h
index fc044b8..24d54cc 100644
--- a/include/llvm/Target/TargetAsmInfo.h
+++ b/include/llvm/Target/TargetAsmInfo.h
@@ -592,9 +592,10 @@ namespace llvm {
return 0;
}
- /// SectionForGlobal - This hooks returns proper section name for given
- /// global with all necessary flags and marks.
- // FIXME: MOVE TO TARGETLOWERING.
+ /// SectionForGlobal - This method computes the appropriate section to emit
+ /// the specified global variable or function definition. This should not
+ /// be passed external (or available externally) globals.
+ // FIXME: MOVE TO ASMPRINTER.
const Section* SectionForGlobal(const GlobalValue *GV) const;
/// getSpecialCasedSectionGlobals - Allow the target to completely override
diff --git a/lib/Target/TargetAsmInfo.cpp b/lib/Target/TargetAsmInfo.cpp
index 727c584..dfb274f 100644
--- a/lib/Target/TargetAsmInfo.cpp
+++ b/lib/Target/TargetAsmInfo.cpp
@@ -293,8 +293,13 @@ static SectionKind::Kind SectionKindForGlobal(const GlobalValue *GV,
}
}
-
+/// SectionForGlobal - This method computes the appropriate section to emit
+/// the specified global variable or function definition. This should not
+/// be passed external (or available externally) globals.
const Section *TargetAsmInfo::SectionForGlobal(const GlobalValue *GV) const {
+ assert(!GV->isDeclaration() && !GV->hasAvailableExternallyLinkage() &&
+ "Can only be used for global definitions");
+
SectionKind::Kind Kind = SectionKindForGlobal(GV, TM.getRelocationModel());
// Select section name.