X86/Encoding: Support ExternalSymbol operands in emitDisplacementField (for consistency).

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80727 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Daniel Dunbar 2009-09-01 22:06:53 +00:00
parent 31e2c7b4c1
commit 4e8d5fe510

View File

@ -337,6 +337,11 @@ void Emitter<CodeEmitter>::emitDisplacementField(const MachineOperand *RelocOp,
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 @@ void Emitter<CodeEmitter>::emitMemModRMByte(const MachineInstr &MI,
// 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;