[PATCH] MC: For variable symbols, maintain MCSymbol::Section as a cache.

Peter Collingbourne peter at pcc.me.uk
Tue Mar 24 14:53:54 PDT 2015


================
Comment at: include/llvm/MC/MCSymbol.h:73
@@ -70,1 +72,3 @@
     void operator=(const MCSymbol&) = delete;
+    const MCSection *getSectionPtr() const {
+      if (Section || !Value)
----------------
rafael wrote:
> Why not just getSection?
This class already has a `getSection` function. Or are you suggesting that we should also be updating the callers to expect a pointer from this function? That seems like it should be a separate change if anything.

================
Comment at: lib/MC/MCExpr.cpp:787
@@ -786,1 +786,3 @@
 
+    if (BE->getOpcode() == MCBinaryExpr::Sub)
+      return MCSymbol::AbsolutePseudoSection;
----------------
rafael wrote:
> This is not always correct, but I guess it is less wrong than the case that follows.
Right, we probably can't do much better here without more context.

================
Comment at: lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp:520
@@ -500,5 +519,3 @@
   if (!IsLittleEndian && Fixup.getKind() == FK_Data_4) {
-    const MCSection *Sec = Fixup.getValue()->FindAssociatedSection();
-    const MCSectionELF *SecELF = dyn_cast_or_null<const MCSectionELF>(Sec);
-    if (SecELF && SecELF->getSectionName() == ".eh_frame")
+    if (isByteSwappedFixup(Fixup.getValue()))
       Value = ByteSwap_32(unsigned(Value));
----------------
rafael wrote:
> This can just use EvaluateAsRelocatable and can be an independent fix.
r233119

================
Comment at: test/MC/ELF/alias.s:111
@@ -101,2 +110,3 @@
 // CHECK-NEXT:     Name: .text (0)
+// CHECK-NOT: Symbol {
 // CHECK:        }
----------------
rafael wrote:
> Can these CHECK-NOT go in first as an independent cleanup?
r233118

http://reviews.llvm.org/D8586

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list