[llvm-commits] [llvm] r76689 - in /llvm/trunk/lib/Target: ELFTargetAsmInfo.cpp TargetAsmInfo.cpp

Chris Lattner sabre at nondot.org
Tue Jul 21 16:49:55 PDT 2009


Author: lattner
Date: Tue Jul 21 18:49:55 2009
New Revision: 76689

URL: http://llvm.org/viewvc/llvm-project?rev=76689&view=rev
Log:
simplify code now that it is inlined.

Modified:
    llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp
    llvm/trunk/lib/Target/TargetAsmInfo.cpp

Modified: llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp?rev=76689&r1=76688&r2=76689&view=diff

==============================================================================
--- llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/ELFTargetAsmInfo.cpp Tue Jul 21 18:49:55 2009
@@ -61,10 +61,8 @@
     
     // 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))
+    if (TM.getRelocationModel() != Reloc::Static &&
+        C->ContainsRelocations(Reloc::LocalOrGlobal))
       return (C->ContainsRelocations(Reloc::Global) ?
               (isConstant ?
                SectionKind::DataRelRO : SectionKind::DataRel) :

Modified: llvm/trunk/lib/Target/TargetAsmInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetAsmInfo.cpp?rev=76689&r1=76688&r2=76689&view=diff

==============================================================================
--- llvm/trunk/lib/Target/TargetAsmInfo.cpp (original)
+++ llvm/trunk/lib/Target/TargetAsmInfo.cpp Tue Jul 21 18:49:55 2009
@@ -209,20 +209,11 @@
     // 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 = (TM.getRelocationModel() != Reloc::Static ?
-                        Reloc::LocalOrGlobal : Reloc::None);
-
-      // We already did a query for 'all' relocs, thus - early exits.
-      if (Reloc == Reloc::LocalOrGlobal)
+      // Decide whether it is still possible to put symbol into r/o section.
+      if (TM.getRelocationModel() != Reloc::Static)
         return SectionKind::Data;
-      else if (Reloc == Reloc::None)
+      else
         return SectionKind::ROData;
-      else {
-        // Ok, target wants something funny. Honour it.
-        return (C->ContainsRelocations(Reloc) ?
-                SectionKind::Data : SectionKind::ROData);
-      }
     } else {
       // Check, if initializer is a null-terminated string
       if (isConstantString(C))





More information about the llvm-commits mailing list