mirror of
https://github.com/RPCSX/llvm.git
synced 2025-01-26 22:45:05 +00:00
Remove the ISel->AsmPrinter link via the TargetMachine that was put in
place to help bring up the PowerPC back end on Darwin. This code is no longer serves any purpose now that the AsmPrinter does the right thing all the time printing GlobalValues. --Cruft. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@18267 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
07bfa52405
commit
3330e08888
@ -708,9 +708,6 @@ void PPC32ISel::copyConstantToRegister(MachineBasicBlock *MBB,
|
|||||||
} else {
|
} else {
|
||||||
BuildMI(*MBB, IP, PPC::LA, 2, R).addReg(TmpReg).addGlobalAddress(GV);
|
BuildMI(*MBB, IP, PPC::LA, 2, R).addReg(TmpReg).addGlobalAddress(GV);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the GV to the list of things whose addresses have been taken.
|
|
||||||
TM.AddressTaken.insert(GV);
|
|
||||||
} else {
|
} else {
|
||||||
std::cerr << "Offending constant: " << *C << "\n";
|
std::cerr << "Offending constant: " << *C << "\n";
|
||||||
assert(0 && "Type not handled yet!");
|
assert(0 && "Type not handled yet!");
|
||||||
@ -1857,8 +1854,6 @@ void PPC32ISel::visitCallInst(CallInst &CI) {
|
|||||||
}
|
}
|
||||||
// Emit a CALL instruction with PC-relative displacement.
|
// Emit a CALL instruction with PC-relative displacement.
|
||||||
TheCall = BuildMI(PPC::CALLpcrel, 1).addGlobalAddress(F, true);
|
TheCall = BuildMI(PPC::CALLpcrel, 1).addGlobalAddress(F, true);
|
||||||
// Add it to the set of functions called to be used by the Printer
|
|
||||||
TM.CalledFunctions.insert(F);
|
|
||||||
} else { // Emit an indirect call through the CTR
|
} else { // Emit an indirect call through the CTR
|
||||||
unsigned Reg = getReg(CI.getCalledValue());
|
unsigned Reg = getReg(CI.getCalledValue());
|
||||||
BuildMI(BB, PPC::OR, 2, PPC::R12).addReg(Reg).addReg(Reg);
|
BuildMI(BB, PPC::OR, 2, PPC::R12).addReg(Reg).addReg(Reg);
|
||||||
@ -2646,7 +2641,6 @@ void PPC32ISel::emitDivRemOperation(MachineBasicBlock *MBB,
|
|||||||
Args.push_back(ValueRecord(Op0Reg, Type::FloatTy));
|
Args.push_back(ValueRecord(Op0Reg, Type::FloatTy));
|
||||||
Args.push_back(ValueRecord(Op1Reg, Type::FloatTy));
|
Args.push_back(ValueRecord(Op1Reg, Type::FloatTy));
|
||||||
doCall(ValueRecord(ResultReg, Type::FloatTy), TheCall, Args, false);
|
doCall(ValueRecord(ResultReg, Type::FloatTy), TheCall, Args, false);
|
||||||
TM.CalledFunctions.insert(fmodfFn);
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case cFP64:
|
case cFP64:
|
||||||
@ -2664,7 +2658,6 @@ void PPC32ISel::emitDivRemOperation(MachineBasicBlock *MBB,
|
|||||||
Args.push_back(ValueRecord(Op0Reg, Type::DoubleTy));
|
Args.push_back(ValueRecord(Op0Reg, Type::DoubleTy));
|
||||||
Args.push_back(ValueRecord(Op1Reg, Type::DoubleTy));
|
Args.push_back(ValueRecord(Op1Reg, Type::DoubleTy));
|
||||||
doCall(ValueRecord(ResultReg, Type::DoubleTy), TheCall, Args, false);
|
doCall(ValueRecord(ResultReg, Type::DoubleTy), TheCall, Args, false);
|
||||||
TM.CalledFunctions.insert(fmodFn);
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case cLong: {
|
case cLong: {
|
||||||
@ -2680,7 +2673,6 @@ void PPC32ISel::emitDivRemOperation(MachineBasicBlock *MBB,
|
|||||||
Args.push_back(ValueRecord(Op0Reg, Type::LongTy));
|
Args.push_back(ValueRecord(Op0Reg, Type::LongTy));
|
||||||
Args.push_back(ValueRecord(Op1Reg, Type::LongTy));
|
Args.push_back(ValueRecord(Op1Reg, Type::LongTy));
|
||||||
doCall(ValueRecord(ResultReg, Type::LongTy), TheCall, Args, false);
|
doCall(ValueRecord(ResultReg, Type::LongTy), TheCall, Args, false);
|
||||||
TM.CalledFunctions.insert(Funcs[NameIdx]);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case cByte: case cShort: case cInt:
|
case cByte: case cShort: case cInt:
|
||||||
@ -3272,7 +3264,6 @@ void PPC32ISel::emitCastOperation(MachineBasicBlock *MBB,
|
|||||||
MachineInstr *TheCall =
|
MachineInstr *TheCall =
|
||||||
BuildMI(PPC::CALLpcrel, 1).addGlobalAddress(floatFn, true);
|
BuildMI(PPC::CALLpcrel, 1).addGlobalAddress(floatFn, true);
|
||||||
doCall(ValueRecord(DestReg, DestTy), TheCall, Args, false);
|
doCall(ValueRecord(DestReg, DestTy), TheCall, Args, false);
|
||||||
TM.CalledFunctions.insert(floatFn);
|
|
||||||
} else {
|
} else {
|
||||||
std::vector<ValueRecord> CmpArgs, ClrArgs, SetArgs;
|
std::vector<ValueRecord> CmpArgs, ClrArgs, SetArgs;
|
||||||
unsigned ZeroLong = getReg(ConstantUInt::get(SrcTy, 0));
|
unsigned ZeroLong = getReg(ConstantUInt::get(SrcTy, 0));
|
||||||
@ -3295,7 +3286,6 @@ void PPC32ISel::emitCastOperation(MachineBasicBlock *MBB,
|
|||||||
MachineInstr *TheCall =
|
MachineInstr *TheCall =
|
||||||
BuildMI(PPC::CALLpcrel, 1).addGlobalAddress(__cmpdi2Fn, true);
|
BuildMI(PPC::CALLpcrel, 1).addGlobalAddress(__cmpdi2Fn, true);
|
||||||
doCall(ValueRecord(CondReg, Type::IntTy), TheCall, CmpArgs, false);
|
doCall(ValueRecord(CondReg, Type::IntTy), TheCall, CmpArgs, false);
|
||||||
TM.CalledFunctions.insert(__cmpdi2Fn);
|
|
||||||
BuildMI(*MBB, IP, PPC::CMPWI, 2, PPC::CR0).addReg(CondReg).addSImm(0);
|
BuildMI(*MBB, IP, PPC::CMPWI, 2, PPC::CR0).addReg(CondReg).addSImm(0);
|
||||||
BuildMI(*MBB, IP, PPC::BLE, 2).addReg(PPC::CR0).addMBB(SetMBB);
|
BuildMI(*MBB, IP, PPC::BLE, 2).addReg(PPC::CR0).addMBB(SetMBB);
|
||||||
|
|
||||||
@ -3305,7 +3295,6 @@ void PPC32ISel::emitCastOperation(MachineBasicBlock *MBB,
|
|||||||
ClrArgs.push_back(ValueRecord(SrcReg, SrcTy));
|
ClrArgs.push_back(ValueRecord(SrcReg, SrcTy));
|
||||||
TheCall = BuildMI(PPC::CALLpcrel, 1).addGlobalAddress(floatFn, true);
|
TheCall = BuildMI(PPC::CALLpcrel, 1).addGlobalAddress(floatFn, true);
|
||||||
doCall(ValueRecord(ClrReg, DestTy), TheCall, ClrArgs, false);
|
doCall(ValueRecord(ClrReg, DestTy), TheCall, ClrArgs, false);
|
||||||
TM.CalledFunctions.insert(floatFn);
|
|
||||||
BuildMI(BB, PPC::B, 1).addMBB(PhiMBB);
|
BuildMI(BB, PPC::B, 1).addMBB(PhiMBB);
|
||||||
BB->addSuccessor(PhiMBB);
|
BB->addSuccessor(PhiMBB);
|
||||||
|
|
||||||
@ -3320,7 +3309,6 @@ void PPC32ISel::emitCastOperation(MachineBasicBlock *MBB,
|
|||||||
SetArgs.push_back(ValueRecord(ShiftedReg, SrcTy));
|
SetArgs.push_back(ValueRecord(ShiftedReg, SrcTy));
|
||||||
TheCall = BuildMI(PPC::CALLpcrel, 1).addGlobalAddress(floatFn, true);
|
TheCall = BuildMI(PPC::CALLpcrel, 1).addGlobalAddress(floatFn, true);
|
||||||
doCall(ValueRecord(CallReg, DestTy), TheCall, SetArgs, false);
|
doCall(ValueRecord(CallReg, DestTy), TheCall, SetArgs, false);
|
||||||
TM.CalledFunctions.insert(floatFn);
|
|
||||||
unsigned SetOpcode = (DestClass == cFP32) ? PPC::FADDS : PPC::FADD;
|
unsigned SetOpcode = (DestClass == cFP32) ? PPC::FADDS : PPC::FADD;
|
||||||
BuildMI(BB, SetOpcode, 2, SetReg).addReg(CallReg).addReg(CallReg);
|
BuildMI(BB, SetOpcode, 2, SetReg).addReg(CallReg).addReg(CallReg);
|
||||||
BB->addSuccessor(PhiMBB);
|
BB->addSuccessor(PhiMBB);
|
||||||
@ -3389,7 +3377,6 @@ void PPC32ISel::emitCastOperation(MachineBasicBlock *MBB,
|
|||||||
MachineInstr *TheCall =
|
MachineInstr *TheCall =
|
||||||
BuildMI(PPC::CALLpcrel, 1).addGlobalAddress(floatFn, true);
|
BuildMI(PPC::CALLpcrel, 1).addGlobalAddress(floatFn, true);
|
||||||
doCall(ValueRecord(DestReg, DestTy), TheCall, Args, false);
|
doCall(ValueRecord(DestReg, DestTy), TheCall, Args, false);
|
||||||
TM.CalledFunctions.insert(floatFn);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3928,7 +3915,6 @@ void PPC32ISel::visitMallocInst(MallocInst &I) {
|
|||||||
MachineInstr *TheCall =
|
MachineInstr *TheCall =
|
||||||
BuildMI(PPC::CALLpcrel, 1).addGlobalAddress(mallocFn, true);
|
BuildMI(PPC::CALLpcrel, 1).addGlobalAddress(mallocFn, true);
|
||||||
doCall(ValueRecord(getReg(I), I.getType()), TheCall, Args, false);
|
doCall(ValueRecord(getReg(I), I.getType()), TheCall, Args, false);
|
||||||
TM.CalledFunctions.insert(mallocFn);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// visitFreeInst - Free instructions are code gen'd to call the free libc
|
/// visitFreeInst - Free instructions are code gen'd to call the free libc
|
||||||
@ -3940,7 +3926,6 @@ void PPC32ISel::visitFreeInst(FreeInst &I) {
|
|||||||
MachineInstr *TheCall =
|
MachineInstr *TheCall =
|
||||||
BuildMI(PPC::CALLpcrel, 1).addGlobalAddress(freeFn, true);
|
BuildMI(PPC::CALLpcrel, 1).addGlobalAddress(freeFn, true);
|
||||||
doCall(ValueRecord(0, Type::VoidTy), TheCall, Args, false);
|
doCall(ValueRecord(0, Type::VoidTy), TheCall, Args, false);
|
||||||
TM.CalledFunctions.insert(freeFn);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// createPPC32ISelSimple - This pass converts an LLVM function into a machine
|
/// createPPC32ISelSimple - This pass converts an LLVM function into a machine
|
||||||
|
@ -360,15 +360,14 @@ void PowerPCAsmPrinter::printOp(const MachineOperand &MO, bool IsCallOp) {
|
|||||||
// wary however not to output $stub for external functions whose addresses
|
// wary however not to output $stub for external functions whose addresses
|
||||||
// are taken. Those should be emitted as $non_lazy_ptr below.
|
// are taken. Those should be emitted as $non_lazy_ptr below.
|
||||||
Function *F = dyn_cast<Function>(GV);
|
Function *F = dyn_cast<Function>(GV);
|
||||||
if (F && F->isExternal() && IsCallOp && getTM().CalledFunctions.count(F)) {
|
if (F && IsCallOp && F->isExternal()) {
|
||||||
FnStubs.insert(Name);
|
FnStubs.insert(Name);
|
||||||
O << "L" << Name << "$stub";
|
O << "L" << Name << "$stub";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// External or weakly linked global variables need non-lazily-resolved stubs
|
// External or weakly linked global variables need non-lazily-resolved stubs
|
||||||
if ((GV->isExternal() || GV->hasWeakLinkage() || GV->hasLinkOnceLinkage())
|
if ((GV->isExternal() || GV->hasWeakLinkage() || GV->hasLinkOnceLinkage())){
|
||||||
&& getTM().AddressTaken.count(GV)) {
|
|
||||||
if (GV->hasLinkOnceLinkage())
|
if (GV->hasLinkOnceLinkage())
|
||||||
LinkOnceStubs.insert(Name);
|
LinkOnceStubs.insert(Name);
|
||||||
else
|
else
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
#include "PowerPCFrameInfo.h"
|
#include "PowerPCFrameInfo.h"
|
||||||
#include "llvm/Target/TargetMachine.h"
|
#include "llvm/Target/TargetMachine.h"
|
||||||
#include "llvm/PassManager.h"
|
#include "llvm/PassManager.h"
|
||||||
#include <set>
|
|
||||||
|
|
||||||
namespace llvm {
|
namespace llvm {
|
||||||
|
|
||||||
@ -34,11 +33,6 @@ public:
|
|||||||
virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; }
|
virtual const TargetFrameInfo *getFrameInfo() const { return &FrameInfo; }
|
||||||
|
|
||||||
virtual bool addPassesToEmitAssembly(PassManager &PM, std::ostream &Out);
|
virtual bool addPassesToEmitAssembly(PassManager &PM, std::ostream &Out);
|
||||||
|
|
||||||
// Two shared sets between the instruction selector and the printer allow for
|
|
||||||
// correct linkage on Darwin
|
|
||||||
std::set<GlobalValue*> CalledFunctions;
|
|
||||||
std::set<GlobalValue*> AddressTaken;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // end namespace llvm
|
} // end namespace llvm
|
||||||
|
Loading…
x
Reference in New Issue
Block a user