[llvm-commits] [llvm] r80727 - /llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp

Daniel Dunbar daniel at zuster.org
Tue Sep 1 15:06:53 PDT 2009


Author: ddunbar
Date: Tue Sep  1 17:06:53 2009
New Revision: 80727

URL: http://llvm.org/viewvc/llvm-project?rev=80727&view=rev
Log:
X86/Encoding: Support ExternalSymbol operands in emitDisplacementField (for consistency).

Modified:
    llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp

Modified: llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp?rev=80727&r1=80726&r2=80727&view=diff

==============================================================================
--- llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86CodeEmitter.cpp Tue Sep  1 17:06:53 2009
@@ -337,6 +337,11 @@
     bool Indirect = gvNeedsNonLazyPtr(*RelocOp, TM);
     emitGlobalAddress(RelocOp->getGlobal(), rt, RelocOp->getOffset(),
                       Adj, NeedStub, Indirect);
+  } else if (RelocOp->isSymbol()) {
+    unsigned rt = Is64BitMode ?
+      (IsPCRel ? X86::reloc_pcrel_word : X86::reloc_absolute_word_sext)
+      : (IsPCRel ? X86::reloc_picrel_word : X86::reloc_absolute_word);
+    emitExternalSymbolAddress(RelocOp->getSymbolName(), rt);
   } else if (RelocOp->isCPI()) {
     unsigned rt = Is64BitMode ?
       (IsPCRel ? X86::reloc_pcrel_word : X86::reloc_absolute_word_sext)
@@ -364,6 +369,8 @@
   // Figure out what sort of displacement we have to handle here.
   if (Op3.isGlobal()) {
     DispForReloc = &Op3;
+  } else if (Op3.isSymbol()) {
+    DispForReloc = &Op3;
   } else if (Op3.isCPI()) {
     if (!MCE.earlyResolveAddresses() || Is64BitMode || IsPIC) {
       DispForReloc = &Op3;





More information about the llvm-commits mailing list