mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-05 10:27:02 +00:00
Fix for PR1059: http://llvm.org/PR1059
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@32685 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a68941b2d4
commit
24287ddb81
@ -214,14 +214,17 @@ void AsmPrinter::EmitJumpTableInfo(MachineJumpTableInfo *MJTI,
|
|||||||
// Pick the directive to use to print the jump table entries, and switch to
|
// Pick the directive to use to print the jump table entries, and switch to
|
||||||
// the appropriate section.
|
// the appropriate section.
|
||||||
TargetLowering *LoweringInfo = TM.getTargetLowering();
|
TargetLowering *LoweringInfo = TM.getTargetLowering();
|
||||||
|
|
||||||
if (IsPic && !(LoweringInfo && LoweringInfo->usesGlobalOffsetTable())) {
|
const char* JumpTableDataSection = TAI->getJumpTableDataSection();
|
||||||
|
if ((IsPic && !(LoweringInfo && LoweringInfo->usesGlobalOffsetTable())) ||
|
||||||
|
!JumpTableDataSection) {
|
||||||
// In PIC mode, we need to emit the jump table to the same section as the
|
// In PIC mode, we need to emit the jump table to the same section as the
|
||||||
// function body itself, otherwise the label differences won't make sense.
|
// function body itself, otherwise the label differences won't make sense.
|
||||||
|
// We should also do if the section name is NULL.
|
||||||
const Function *F = MF.getFunction();
|
const Function *F = MF.getFunction();
|
||||||
SwitchToTextSection(getSectionForFunction(*F).c_str(), F);
|
SwitchToTextSection(getSectionForFunction(*F).c_str(), F);
|
||||||
} else {
|
} else {
|
||||||
SwitchToDataSection(TAI->getJumpTableDataSection());
|
SwitchToDataSection(JumpTableDataSection);
|
||||||
}
|
}
|
||||||
|
|
||||||
EmitAlignment(Log2_32(MJTI->getAlignment()));
|
EmitAlignment(Log2_32(MJTI->getAlignment()));
|
||||||
|
@ -113,7 +113,7 @@ void X86IntelAsmPrinter::printOp(const MachineOperand &MO,
|
|||||||
const char *Modifier) {
|
const char *Modifier) {
|
||||||
const MRegisterInfo &RI = *TM.getRegisterInfo();
|
const MRegisterInfo &RI = *TM.getRegisterInfo();
|
||||||
switch (MO.getType()) {
|
switch (MO.getType()) {
|
||||||
case MachineOperand::MO_Register:
|
case MachineOperand::MO_Register: {
|
||||||
if (MRegisterInfo::isPhysicalRegister(MO.getReg())) {
|
if (MRegisterInfo::isPhysicalRegister(MO.getReg())) {
|
||||||
unsigned Reg = MO.getReg();
|
unsigned Reg = MO.getReg();
|
||||||
if (Modifier && strncmp(Modifier, "subreg", strlen("subreg")) == 0) {
|
if (Modifier && strncmp(Modifier, "subreg", strlen("subreg")) == 0) {
|
||||||
@ -126,13 +126,20 @@ void X86IntelAsmPrinter::printOp(const MachineOperand &MO,
|
|||||||
} else
|
} else
|
||||||
O << "reg" << MO.getReg();
|
O << "reg" << MO.getReg();
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
case MachineOperand::MO_Immediate:
|
case MachineOperand::MO_Immediate:
|
||||||
O << MO.getImmedValue();
|
O << MO.getImmedValue();
|
||||||
return;
|
return;
|
||||||
case MachineOperand::MO_MachineBasicBlock:
|
case MachineOperand::MO_MachineBasicBlock:
|
||||||
printBasicBlockLabel(MO.getMachineBasicBlock());
|
printBasicBlockLabel(MO.getMachineBasicBlock());
|
||||||
return;
|
return;
|
||||||
|
case MachineOperand::MO_JumpTableIndex: {
|
||||||
|
bool isMemOp = Modifier && !strcmp(Modifier, "mem");
|
||||||
|
if (!isMemOp) O << "OFFSET ";
|
||||||
|
O << TAI->getPrivateGlobalPrefix() << "JTI" << getFunctionNumber()
|
||||||
|
<< "_" << MO.getJumpTableIndex();
|
||||||
|
return;
|
||||||
|
}
|
||||||
case MachineOperand::MO_ConstantPoolIndex: {
|
case MachineOperand::MO_ConstantPoolIndex: {
|
||||||
bool isMemOp = Modifier && !strcmp(Modifier, "mem");
|
bool isMemOp = Modifier && !strcmp(Modifier, "mem");
|
||||||
if (!isMemOp) O << "OFFSET ";
|
if (!isMemOp) O << "OFFSET ";
|
||||||
|
@ -152,6 +152,7 @@ X86TargetAsmInfo::X86TargetAsmInfo(const X86TargetMachine &TM) {
|
|||||||
|
|
||||||
TextSection = "_text";
|
TextSection = "_text";
|
||||||
DataSection = "_data";
|
DataSection = "_data";
|
||||||
|
JumpTableDataSection = NULL;
|
||||||
SwitchToSectionDirective = "";
|
SwitchToSectionDirective = "";
|
||||||
TextSectionStartSuffix = "\tsegment 'CODE'";
|
TextSectionStartSuffix = "\tsegment 'CODE'";
|
||||||
DataSectionStartSuffix = "\tsegment 'DATA'";
|
DataSectionStartSuffix = "\tsegment 'DATA'";
|
||||||
|
Loading…
Reference in New Issue
Block a user