Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Unified Diff: src/IceTargetLoweringARM32.cpp

Issue 1687553002: Change all ARM calls into indirect calls. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Fix nits. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests_lit/assembler/arm32/call.ll » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceTargetLoweringARM32.cpp
diff --git a/src/IceTargetLoweringARM32.cpp b/src/IceTargetLoweringARM32.cpp
index 0322a7e54ef60c6a77ff3599f78f52998d4a1620..4139fb8b951b9bc6b3bb581e24f1930367f7d3c7 100644
--- a/src/IceTargetLoweringARM32.cpp
+++ b/src/IceTargetLoweringARM32.cpp
@@ -3349,7 +3349,10 @@ void TargetARM32::lowerBr(const InstBr *Instr) {
}
void TargetARM32::lowerCall(const InstCall *Instr) {
- Operand *CallTarget = Instr->getCallTarget();
+ // Note: Keep original call target. This allows us to call the correct
+ // postamble helper, even if the CallTarget gets modified during lowering.
+ Operand *OrigCallTarget = Instr->getCallTarget();
+ Operand *CallTarget = OrigCallTarget;
if (Instr->isTargetHelperCall()) {
auto TargetHelperPreamble = ARM32HelpersPreamble.find(CallTarget);
if (TargetHelperPreamble != ARM32HelpersPreamble.end()) {
@@ -3474,12 +3477,9 @@ void TargetARM32::lowerCall(const InstCall *Instr) {
}
}
- // Allow ConstantRelocatable to be left alone as a direct call, but force
- // other constants like ConstantInteger32 to be in a register and make it an
- // indirect call.
- if (!llvm::isa<ConstantRelocatable>(CallTarget)) {
- CallTarget = legalize(CallTarget, Legal_Reg);
- }
+ // Note: To allow far calls, even for constant relocatables, we force
+ // the call target into a register, and make an indirect call.
+ CallTarget = legalizeToReg(CallTarget);
// Copy arguments to be passed in registers to the appropriate registers.
for (auto &FPArg : FPArgs) {
@@ -3530,7 +3530,7 @@ void TargetARM32::lowerCall(const InstCall *Instr) {
}
if (Instr->isTargetHelperCall()) {
- auto TargetHelpersPostamble = ARM32HelpersPostamble.find(CallTarget);
+ auto TargetHelpersPostamble = ARM32HelpersPostamble.find(OrigCallTarget);
if (TargetHelpersPostamble != ARM32HelpersPostamble.end()) {
(this->*TargetHelpersPostamble->second)(Instr);
}
« no previous file with comments | « no previous file | tests_lit/assembler/arm32/call.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698