mirror of
https://github.com/RPCSX/llvm.git
synced 2025-01-18 18:32:32 +00:00
Implement indirect function calls
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5024 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b8ead9dc22
commit
6e49a4b814
@ -577,8 +577,14 @@ ISel::visitCallInst (CallInst & CI)
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Emit a CALL instruction with PC-relative displacement.
|
||||
BuildMI (BB, X86::CALLpcrel32, 1).addPCDisp (CI.getCalledValue ());
|
||||
|
||||
if (Function *F = CI.getCalledFunction()) {
|
||||
// Emit a CALL instruction with PC-relative displacement.
|
||||
BuildMI(BB, X86::CALLpcrel32, 1).addPCDisp(F);
|
||||
} else {
|
||||
unsigned Reg = getReg(CI.getCalledValue());
|
||||
BuildMI(BB, X86::CALLr32, 1).addReg(Reg);
|
||||
}
|
||||
|
||||
// Adjust the stack by `bytesPushed' amount if non-zero
|
||||
if (bytesPushed > 0)
|
||||
|
@ -577,8 +577,14 @@ ISel::visitCallInst (CallInst & CI)
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Emit a CALL instruction with PC-relative displacement.
|
||||
BuildMI (BB, X86::CALLpcrel32, 1).addPCDisp (CI.getCalledValue ());
|
||||
|
||||
if (Function *F = CI.getCalledFunction()) {
|
||||
// Emit a CALL instruction with PC-relative displacement.
|
||||
BuildMI(BB, X86::CALLpcrel32, 1).addPCDisp(F);
|
||||
} else {
|
||||
unsigned Reg = getReg(CI.getCalledValue());
|
||||
BuildMI(BB, X86::CALLr32, 1).addReg(Reg);
|
||||
}
|
||||
|
||||
// Adjust the stack by `bytesPushed' amount if non-zero
|
||||
if (bytesPushed > 0)
|
||||
|
@ -66,6 +66,10 @@ I(JNE , "jne", 0x85, M_BRANCH_FLAG, X86II::RawFrm | X86II::TB | X86II:
|
||||
I(JE , "je", 0x84, M_BRANCH_FLAG, X86II::RawFrm | X86II::TB | X86II::Void, NoIR,
|
||||
NoIR) // je foo
|
||||
I(CALLpcrel32 , "call", 0xE8, M_BRANCH_FLAG, X86II::Void, NoIR, NoIR) // call pc+42
|
||||
I(CALLr32 , "call", 0xFF, M_BRANCH_FLAG, X86II::Void | X86II::MRMS2r | X86II::Arg32,
|
||||
NoIR, NoIR) // call [r32]
|
||||
I(CALLm32 , "call", 0xFF, M_BRANCH_FLAG, X86II::Void | X86II::MRMS2m | X86II::Arg32,
|
||||
NoIR, NoIR) // call [m32]
|
||||
|
||||
// Misc instructions
|
||||
I(LEAVE , "leave", 0xC9, 0, X86II::RawFrm, O_EBP, O_EBP) // leave
|
||||
|
Loading…
x
Reference in New Issue
Block a user