mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-25 16:29:20 +00:00
X86/exp-asm-printer: Lower MachineOperand::MO_JumpTableIndex to MCOperand.
- Down to 7 failures on 403.gcc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@80605 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
d2a0b272fe
commit
ec2e4679fd
@ -24,6 +24,7 @@
|
|||||||
#include "llvm/DerivedTypes.h"
|
#include "llvm/DerivedTypes.h"
|
||||||
#include "llvm/Module.h"
|
#include "llvm/Module.h"
|
||||||
#include "llvm/Type.h"
|
#include "llvm/Type.h"
|
||||||
|
#include "llvm/ADT/SmallString.h"
|
||||||
#include "llvm/ADT/Statistic.h"
|
#include "llvm/ADT/Statistic.h"
|
||||||
#include "llvm/ADT/StringExtras.h"
|
#include "llvm/ADT/StringExtras.h"
|
||||||
#include "llvm/Assembly/Writer.h"
|
#include "llvm/Assembly/Writer.h"
|
||||||
@ -810,7 +811,7 @@ MCOperand X86ATTAsmPrinter::LowerGlobalAddressOperand(const MachineOperand &MO){
|
|||||||
}
|
}
|
||||||
|
|
||||||
MCOperand X86ATTAsmPrinter::
|
MCOperand X86ATTAsmPrinter::
|
||||||
LowerExternalSymbolOperand(const MachineOperand &MO){
|
LowerExternalSymbolOperand(const MachineOperand &MO) {
|
||||||
std::string Name = Mang->makeNameProper(MO.getSymbolName());
|
std::string Name = Mang->makeNameProper(MO.getSymbolName());
|
||||||
if (MO.getTargetFlags() == X86II::MO_DARWIN_STUB) {
|
if (MO.getTargetFlags() == X86II::MO_DARWIN_STUB) {
|
||||||
FnStubs[Name+"$stub"] = Name;
|
FnStubs[Name+"$stub"] = Name;
|
||||||
@ -829,6 +830,35 @@ LowerExternalSymbolOperand(const MachineOperand &MO){
|
|||||||
return MCOperand::CreateExpr(Expr);
|
return MCOperand::CreateExpr(Expr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MCOperand X86ATTAsmPrinter::LowerJumpTableOperand(const MachineOperand &MO) {
|
||||||
|
SmallString<256> Name;
|
||||||
|
raw_svector_ostream(Name) << MAI->getPrivateGlobalPrefix() << "JTI"
|
||||||
|
<< getFunctionNumber() << '_' << MO.getIndex();
|
||||||
|
|
||||||
|
MCSymbol *NegatedSymbol = 0;
|
||||||
|
switch (MO.getTargetFlags()) {
|
||||||
|
default:
|
||||||
|
llvm_unreachable("Unknown target flag on GV operand");
|
||||||
|
case X86II::MO_PIC_BASE_OFFSET:
|
||||||
|
case X86II::MO_DARWIN_NONLAZY_PIC_BASE:
|
||||||
|
case X86II::MO_DARWIN_HIDDEN_NONLAZY_PIC_BASE:
|
||||||
|
// Subtract the pic base.
|
||||||
|
NegatedSymbol = GetPICBaseSymbol();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a symbol for the name.
|
||||||
|
MCSymbol *Sym = OutContext.GetOrCreateSymbol(Name.str());
|
||||||
|
// FIXME: We would like an efficient form for this, so we don't have to do a
|
||||||
|
// lot of extra uniquing.
|
||||||
|
const MCExpr *Expr = MCSymbolRefExpr::Create(Sym, OutContext);
|
||||||
|
if (NegatedSymbol)
|
||||||
|
Expr = MCBinaryExpr::CreateSub(Expr, MCSymbolRefExpr::Create(NegatedSymbol,
|
||||||
|
OutContext),
|
||||||
|
OutContext);
|
||||||
|
return MCOperand::CreateExpr(Expr);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/// printMachineInstruction -- Print out a single X86 LLVM instruction MI in
|
/// printMachineInstruction -- Print out a single X86 LLVM instruction MI in
|
||||||
/// AT&T syntax to the current output stream.
|
/// AT&T syntax to the current output stream.
|
||||||
@ -895,6 +925,9 @@ void X86ATTAsmPrinter::printMachineInstruction(const MachineInstr *MI) {
|
|||||||
O.flush();
|
O.flush();
|
||||||
errs() << "Cannot lower operand #" << i << " of :" << *MI;
|
errs() << "Cannot lower operand #" << i << " of :" << *MI;
|
||||||
llvm_unreachable("Unimp");
|
llvm_unreachable("Unimp");
|
||||||
|
case MachineOperand::MO_JumpTableIndex:
|
||||||
|
MCOp = LowerJumpTableOperand(MO);
|
||||||
|
break;
|
||||||
case MachineOperand::MO_Register:
|
case MachineOperand::MO_Register:
|
||||||
MCOp = MCOperand::CreateReg(MO.getReg());
|
MCOp = MCOperand::CreateReg(MO.getReg());
|
||||||
break;
|
break;
|
||||||
|
@ -69,6 +69,7 @@ class VISIBILITY_HIDDEN X86ATTAsmPrinter : public AsmPrinter {
|
|||||||
// New MCInst printing stuff.
|
// New MCInst printing stuff.
|
||||||
void printInstruction(const MCInst *MI);
|
void printInstruction(const MCInst *MI);
|
||||||
MCSymbol *GetPICBaseSymbol();
|
MCSymbol *GetPICBaseSymbol();
|
||||||
|
MCOperand LowerJumpTableOperand(const MachineOperand &MO);
|
||||||
MCOperand LowerGlobalAddressOperand(const MachineOperand &MO);
|
MCOperand LowerGlobalAddressOperand(const MachineOperand &MO);
|
||||||
MCOperand LowerExternalSymbolOperand(const MachineOperand &MO);
|
MCOperand LowerExternalSymbolOperand(const MachineOperand &MO);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user