From cc0d2f586f87a6aef77514ee75dab67cbfc235cb Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 17 Feb 2004 18:23:55 +0000 Subject: [PATCH] Add support for GlobalAddress's for alkis git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11560 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/X86CodeEmitter.cpp | 7 ++++++- lib/Target/X86/X86RegisterInfo.cpp | 10 ++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/Target/X86/X86CodeEmitter.cpp b/lib/Target/X86/X86CodeEmitter.cpp index f9de6febb7f..e02fcbf16f5 100644 --- a/lib/Target/X86/X86CodeEmitter.cpp +++ b/lib/Target/X86/X86CodeEmitter.cpp @@ -602,7 +602,12 @@ void Emitter::emitInstruction(MachineInstr &MI) { if (MI.getNumOperands() == 5) { unsigned Size = sizeOfPtr(Desc); - emitConstant(MI.getOperand(4).getImmedValue(), Size); + if (MI.getOperand(4).isImmediate()) + emitConstant(MI.getOperand(4).getImmedValue(), Size); + else if (MI.getOperand(4).isGlobalAddress()) + emitGlobalAddressForPtr(MI.getOperand(4).getGlobal()); + else + assert(0 && "Unknown operand!"); } break; } diff --git a/lib/Target/X86/X86RegisterInfo.cpp b/lib/Target/X86/X86RegisterInfo.cpp index d94e4ac2661..6479ad56a7e 100644 --- a/lib/Target/X86/X86RegisterInfo.cpp +++ b/lib/Target/X86/X86RegisterInfo.cpp @@ -100,8 +100,14 @@ static MachineInstr *MakeMRInst(unsigned Opcode, unsigned FrameIndex, static MachineInstr *MakeMIInst(unsigned Opcode, unsigned FrameIndex, MachineInstr *MI) { - return addFrameReference(BuildMI(Opcode, 5), FrameIndex) - .addZImm(MI->getOperand(1).getImmedValue()); + if (MI->getOperand(1).isImmediate()) + return addFrameReference(BuildMI(Opcode, 5), FrameIndex) + .addZImm(MI->getOperand(1).getImmedValue()); + else if (MI->getOperand(1).isGlobalAddress()) + return addFrameReference(BuildMI(Opcode, 5), FrameIndex) + .addGlobalAddress(MI->getOperand(1).getGlobal()); + assert(0 && "Unknown operand for MakeMI!"); + return 0; } static MachineInstr *MakeRMInst(unsigned Opcode, unsigned FrameIndex,