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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | tests_lit/assembler/arm32/call.ll » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 //===- subzero/src/IceTargetLoweringARM32.cpp - ARM32 lowering ------------===// 1 //===- subzero/src/IceTargetLoweringARM32.cpp - ARM32 lowering ------------===//
2 // 2 //
3 // The Subzero Code Generator 3 // The Subzero Code Generator
4 // 4 //
5 // This file is distributed under the University of Illinois Open Source 5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details. 6 // License. See LICENSE.TXT for details.
7 // 7 //
8 //===----------------------------------------------------------------------===// 8 //===----------------------------------------------------------------------===//
9 /// 9 ///
10 /// \file 10 /// \file
(...skipping 3331 matching lines...) Expand 10 before | Expand all | Expand 10 after
3342 case CondARM32::kNone: 3342 case CondARM32::kNone:
3343 _br(TargetFalse); 3343 _br(TargetFalse);
3344 break; 3344 break;
3345 case CondARM32::AL: 3345 case CondARM32::AL:
3346 _br(TargetTrue); 3346 _br(TargetTrue);
3347 break; 3347 break;
3348 } 3348 }
3349 } 3349 }
3350 3350
3351 void TargetARM32::lowerCall(const InstCall *Instr) { 3351 void TargetARM32::lowerCall(const InstCall *Instr) {
3352 Operand *CallTarget = Instr->getCallTarget(); 3352 // Note: Keep original call target. This allows us to call the correct
3353 // postamble helper, even if the CallTarget gets modified during lowering.
3354 Operand *OrigCallTarget = Instr->getCallTarget();
3355 Operand *CallTarget = OrigCallTarget;
3353 if (Instr->isTargetHelperCall()) { 3356 if (Instr->isTargetHelperCall()) {
3354 auto TargetHelperPreamble = ARM32HelpersPreamble.find(CallTarget); 3357 auto TargetHelperPreamble = ARM32HelpersPreamble.find(CallTarget);
3355 if (TargetHelperPreamble != ARM32HelpersPreamble.end()) { 3358 if (TargetHelperPreamble != ARM32HelpersPreamble.end()) {
3356 (this->*TargetHelperPreamble->second)(Instr); 3359 (this->*TargetHelperPreamble->second)(Instr);
3357 } 3360 }
3358 } 3361 }
3359 MaybeLeafFunc = false; 3362 MaybeLeafFunc = false;
3360 NeedsStackAlignment = true; 3363 NeedsStackAlignment = true;
3361 3364
3362 // Assign arguments to registers and stack. Also reserve stack. 3365 // Assign arguments to registers and stack. Also reserve stack.
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
3467 case IceType_v16i1: 3470 case IceType_v16i1:
3468 case IceType_v16i8: 3471 case IceType_v16i8:
3469 case IceType_v8i16: 3472 case IceType_v8i16:
3470 case IceType_v4i32: 3473 case IceType_v4i32:
3471 case IceType_v4f32: 3474 case IceType_v4f32:
3472 ReturnReg = makeReg(Dest->getType(), RegARM32::Reg_q0); 3475 ReturnReg = makeReg(Dest->getType(), RegARM32::Reg_q0);
3473 break; 3476 break;
3474 } 3477 }
3475 } 3478 }
3476 3479
3477 // Allow ConstantRelocatable to be left alone as a direct call, but force 3480 // Note: To allow far calls, even for constant relocatables, we force
3478 // other constants like ConstantInteger32 to be in a register and make it an 3481 // the call target into a register, and make an indirect call.
3479 // indirect call. 3482 CallTarget = legalizeToReg(CallTarget);
3480 if (!llvm::isa<ConstantRelocatable>(CallTarget)) {
3481 CallTarget = legalize(CallTarget, Legal_Reg);
3482 }
3483 3483
3484 // Copy arguments to be passed in registers to the appropriate registers. 3484 // Copy arguments to be passed in registers to the appropriate registers.
3485 for (auto &FPArg : FPArgs) { 3485 for (auto &FPArg : FPArgs) {
3486 Variable *Reg = legalizeToReg(FPArg.first, FPArg.second); 3486 Variable *Reg = legalizeToReg(FPArg.first, FPArg.second);
3487 Context.insert<InstFakeUse>(Reg); 3487 Context.insert<InstFakeUse>(Reg);
3488 } 3488 }
3489 for (auto &GPRArg : GPRArgs) { 3489 for (auto &GPRArg : GPRArgs) {
3490 Variable *Reg = legalizeToReg(GPRArg.first, GPRArg.second); 3490 Variable *Reg = legalizeToReg(GPRArg.first, GPRArg.second);
3491 // Generate a FakeUse of register arguments so that they do not get dead 3491 // Generate a FakeUse of register arguments so that they do not get dead
3492 // code eliminated as a result of the FakeKill of scratch registers after 3492 // code eliminated as a result of the FakeKill of scratch registers after
(...skipping 30 matching lines...) Expand all
3523 } else { 3523 } else {
3524 assert(isIntegerType(Dest->getType()) && 3524 assert(isIntegerType(Dest->getType()) &&
3525 typeWidthInBytes(Dest->getType()) <= 4); 3525 typeWidthInBytes(Dest->getType()) <= 4);
3526 _mov(Dest, ReturnReg); 3526 _mov(Dest, ReturnReg);
3527 } 3527 }
3528 } 3528 }
3529 } 3529 }
3530 } 3530 }
3531 3531
3532 if (Instr->isTargetHelperCall()) { 3532 if (Instr->isTargetHelperCall()) {
3533 auto TargetHelpersPostamble = ARM32HelpersPostamble.find(CallTarget); 3533 auto TargetHelpersPostamble = ARM32HelpersPostamble.find(OrigCallTarget);
3534 if (TargetHelpersPostamble != ARM32HelpersPostamble.end()) { 3534 if (TargetHelpersPostamble != ARM32HelpersPostamble.end()) {
3535 (this->*TargetHelpersPostamble->second)(Instr); 3535 (this->*TargetHelpersPostamble->second)(Instr);
3536 } 3536 }
3537 } 3537 }
3538 } 3538 }
3539 3539
3540 namespace { 3540 namespace {
3541 void configureBitcastTemporary(Variable64On32 *Var) { 3541 void configureBitcastTemporary(Variable64On32 *Var) {
3542 Var->setMustNotHaveReg(); 3542 Var->setMustNotHaveReg();
3543 Var->getHi()->setMustHaveReg(); 3543 Var->getHi()->setMustHaveReg();
(...skipping 2980 matching lines...) Expand 10 before | Expand all | Expand 10 after
6524 Str << ".eabi_attribute 14, 3 @ Tag_ABI_PCS_R9_use: Not used\n"; 6524 Str << ".eabi_attribute 14, 3 @ Tag_ABI_PCS_R9_use: Not used\n";
6525 } 6525 }
6526 6526
6527 llvm::SmallBitVector TargetARM32::TypeToRegisterSet[RegARM32::RCARM32_NUM]; 6527 llvm::SmallBitVector TargetARM32::TypeToRegisterSet[RegARM32::RCARM32_NUM];
6528 llvm::SmallBitVector 6528 llvm::SmallBitVector
6529 TargetARM32::TypeToRegisterSetUnfiltered[RegARM32::RCARM32_NUM]; 6529 TargetARM32::TypeToRegisterSetUnfiltered[RegARM32::RCARM32_NUM];
6530 llvm::SmallBitVector TargetARM32::RegisterAliases[RegARM32::Reg_NUM]; 6530 llvm::SmallBitVector TargetARM32::RegisterAliases[RegARM32::Reg_NUM];
6531 6531
6532 } // end of namespace ARM32 6532 } // end of namespace ARM32
6533 } // end of namespace Ice 6533 } // end of namespace Ice
OLDNEW
« 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