[llvm-commits] [llvm] r76686 - in /llvm/trunk: include/llvm/Target/TargetAsmInfo.h lib/Target/ELFTargetAsmInfo.cpp lib/Target/TargetAsmInfo.cpp
Chris Lattner
sabre at nondot.org
Tue Jul 21 16:47:11 PDT 2009
Author: lattner
Date: Tue Jul 21 18:47:11 2009
New Revision: 76686
URL: http://llvm.org/viewvc/llvm-project?rev=76686&view=rev
Log:
Now that RelocBehaviour() is never overloaded, it doesn't need to be
virtual. Just inline it into its two current call sites in preparation
for simplifying the code.
Modified:
llvm/trunk/include/llvm/Target/TargetAsmInfo.h
llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp
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=76686&r1=76685&r2=76686&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Target/TargetAsmInfo.h (original)
+++ llvm/trunk/include/llvm/Target/TargetAsmInfo.h Tue Jul 21 18:47:11 2009
@@ -601,13 +601,6 @@
virtual SectionKind::Kind
SectionKindForGlobal(const GlobalValue *GV) const;
- /// RelocBehaviour - Describes how relocations should be treated when
- /// selecting sections. Reloc::Global bit should be set if global
- /// relocations should force object to be placed in read-write
- /// sections. Reloc::Local bit should be set if local relocations should
- /// force object to be placed in read-write sections.
- virtual unsigned RelocBehaviour() const;
-
/// SectionFlagsForGlobal - This hook allows the target to select proper
/// section flags either for given global or for section.
// FIXME: Eliminate this.
Modified: llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp?rev=76686&r1=76685&r2=76686&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp Tue Jul 21 18:47:11 2009
@@ -57,7 +57,13 @@
if (GVar->hasInitializer()) {
Constant *C = GVar->getInitializer();
bool isConstant = GVar->isConstant();
- unsigned Reloc = RelocBehaviour();
+
+
+ // By default - all relocations in PIC mode would force symbol to be
+ // placed in r/w section.
+ unsigned Reloc = (TM.getRelocationModel() != Reloc::Static ?
+ Reloc::LocalOrGlobal : Reloc::None);
+
if (Reloc != Reloc::None && C->ContainsRelocations(Reloc))
return (C->ContainsRelocations(Reloc::Global) ?
(isConstant ?
Modified: llvm/trunk/lib/Target/TargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetAsmInfo.cpp?rev=76686&r1=76685&r2=76686&view=diff
==============================================================================
--- llvm/trunk/lib/Target/TargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/TargetAsmInfo.cpp Tue Jul 21 18:47:11 2009
@@ -190,13 +190,6 @@
return false;
}
-unsigned TargetAsmInfo::RelocBehaviour() const {
- // By default - all relocations in PIC mode would force symbol to be
- // placed in r/w section.
- return (TM.getRelocationModel() != Reloc::Static ?
- Reloc::LocalOrGlobal : Reloc::None);
-}
-
SectionKind::Kind
TargetAsmInfo::SectionKindForGlobal(const GlobalValue *GV) const {
// Early exit - functions should be always in text sections.
@@ -211,13 +204,14 @@
// Variable can be easily put to BSS section.
return (isThreadLocal ? SectionKind::ThreadBSS : SectionKind::BSS);
} else if (GVar->isConstant() && !isThreadLocal) {
- // Now we know, that varible has initializer and it is constant. We need to
+ // Now we know, that variable has initializer and it is constant. We need to
// check its initializer to decide, which section to output it into. Also
// note, there is no thread-local r/o section.
Constant *C = GVar->getInitializer();
if (C->ContainsRelocations(Reloc::LocalOrGlobal)) {
// Decide, whether it is still possible to put symbol into r/o section.
- unsigned Reloc = RelocBehaviour();
+ unsigned Reloc = (TM.getRelocationModel() != Reloc::Static ?
+ Reloc::LocalOrGlobal : Reloc::None);
// We already did a query for 'all' relocs, thus - early exits.
if (Reloc == Reloc::LocalOrGlobal)
More information about the llvm-commits
mailing list