Now that RelocBehaviour() is never overloaded, it doesn't need to be
authorChris Lattner <sabre@nondot.org>
Tue, 21 Jul 2009 23:47:11 +0000 (23:47 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 21 Jul 2009 23:47:11 +0000 (23:47 +0000)
virtual.  Just inline it into its two current call sites in preparation
for simplifying the code.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@76686 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Target/TargetAsmInfo.h
lib/Target/ELFTargetAsmInfo.cpp
lib/Target/TargetAsmInfo.cpp

index a8da6cb78a9ade6c8c1cb834819cac9d4f794a9c..e59b12a7cd27521f93d7893d85afa54880d5d884 100644 (file)
@@ -601,13 +601,6 @@ namespace llvm {
     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.
index bd2dd0a06445d9130918a98f72db1d8b372fa8a7..8ace00abd939fbfd7d2b130ebeb7bae474023032 100644 (file)
@@ -57,7 +57,13 @@ ELFTargetAsmInfo::SectionKindForGlobal(const GlobalValue *GV) const {
   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 ?
index 2cdaa74843a958d9eaca54162b77ad83056385e0..e60855d3dd42c0e952716868c42d1f2bc8bf2491 100644 (file)
@@ -190,13 +190,6 @@ static bool isConstantString(const Constant *C) {
   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 @@ TargetAsmInfo::SectionKindForGlobal(const GlobalValue *GV) const {
     // 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)