[X86MCInst] Move LowerSTATEPOINT to inside X86AsmPrinter. NFC.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@236676 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Sanjoy Das 2015-05-06 23:53:26 +00:00
parent 9a46db689a
commit d9fd44e97a
2 changed files with 8 additions and 11 deletions

View File

@ -82,6 +82,7 @@ class LLVM_LIBRARY_VISIBILITY X86AsmPrinter : public AsmPrinter {
void InsertStackMapShadows(MachineFunction &MF); void InsertStackMapShadows(MachineFunction &MF);
void LowerSTACKMAP(const MachineInstr &MI); void LowerSTACKMAP(const MachineInstr &MI);
void LowerPATCHPOINT(const MachineInstr &MI, X86MCInstLower &MCIL); void LowerPATCHPOINT(const MachineInstr &MI, X86MCInstLower &MCIL);
void LowerSTATEPOINT(const MachineInstr &MI, X86MCInstLower &MCIL);
void LowerTlsAddr(X86MCInstLower &MCInstLowering, const MachineInstr &MI); void LowerTlsAddr(X86MCInstLower &MCInstLowering, const MachineInstr &MI);

View File

@ -808,12 +808,9 @@ static void EmitNops(MCStreamer &OS, unsigned NumBytes, bool Is64Bit, const MCSu
} // while (NumBytes) } // while (NumBytes)
} }
static void LowerSTATEPOINT(MCStreamer &OS, StackMaps &SM, void X86AsmPrinter::LowerSTATEPOINT(const MachineInstr &MI,
const MachineInstr &MI, bool Is64Bit, X86MCInstLower &MCIL) {
const TargetMachine& TM, assert(Subtarget->is64Bit() && "Statepoint currently only supports X86-64");
const MCSubtargetInfo& STI,
X86MCInstLower &MCInstLowering) {
assert(Is64Bit && "Statepoint currently only supports X86-64");
// Lower call target and choose correct opcode // Lower call target and choose correct opcode
const MachineOperand &CallTarget = StatepointOpers(&MI).getCallTarget(); const MachineOperand &CallTarget = StatepointOpers(&MI).getCallTarget();
@ -822,8 +819,8 @@ static void LowerSTATEPOINT(MCStreamer &OS, StackMaps &SM,
switch (CallTarget.getType()) { switch (CallTarget.getType()) {
case MachineOperand::MO_GlobalAddress: case MachineOperand::MO_GlobalAddress:
case MachineOperand::MO_ExternalSymbol: case MachineOperand::MO_ExternalSymbol:
CallTargetMCOp = MCInstLowering.LowerSymbolOperand( CallTargetMCOp = MCIL.LowerSymbolOperand(
CallTarget, MCInstLowering.GetSymbolFromOperand(CallTarget)); CallTarget, MCIL.GetSymbolFromOperand(CallTarget));
CallOpcode = X86::CALL64pcrel32; CallOpcode = X86::CALL64pcrel32;
// Currently, we only support relative addressing with statepoints. // Currently, we only support relative addressing with statepoints.
// Otherwise, we'll need a scratch register to hold the target // Otherwise, we'll need a scratch register to hold the target
@ -851,7 +848,7 @@ static void LowerSTATEPOINT(MCStreamer &OS, StackMaps &SM,
MCInst CallInst; MCInst CallInst;
CallInst.setOpcode(CallOpcode); CallInst.setOpcode(CallOpcode);
CallInst.addOperand(CallTargetMCOp); CallInst.addOperand(CallTargetMCOp);
OS.EmitInstruction(CallInst, STI); OutStreamer->EmitInstruction(CallInst, getSubtargetInfo());
// Record our statepoint node in the same section used by STACKMAP // Record our statepoint node in the same section used by STACKMAP
// and PATCHPOINT // and PATCHPOINT
@ -1111,8 +1108,7 @@ void X86AsmPrinter::EmitInstruction(const MachineInstr *MI) {
return; return;
} }
case TargetOpcode::STATEPOINT: case TargetOpcode::STATEPOINT:
return LowerSTATEPOINT(*OutStreamer, SM, *MI, Subtarget->is64Bit(), TM, return LowerSTATEPOINT(*MI, MCInstLowering);
getSubtargetInfo(), MCInstLowering);
case TargetOpcode::STACKMAP: case TargetOpcode::STACKMAP:
return LowerSTACKMAP(*MI); return LowerSTACKMAP(*MI);