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

Side by Side Diff: src/IceTargetLoweringARM32.h

Issue 1348393002: Subzero. Fixes ARM32 VFP calling convention. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: Created 5 years, 3 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
OLDNEW
1 //===- subzero/src/IceTargetLoweringARM32.h - ARM32 lowering ----*- C++ -*-===// 1 //===- subzero/src/IceTargetLoweringARM32.h - ARM32 lowering ----*- C++ -*-===//
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
11 /// This file declares the TargetLoweringARM32 class, which implements the 11 /// This file declares the TargetLoweringARM32 class, which implements the
12 /// TargetLowering interface for the ARM 32-bit architecture. 12 /// TargetLowering interface for the ARM 32-bit architecture.
13 /// 13 ///
14 //===----------------------------------------------------------------------===// 14 //===----------------------------------------------------------------------===//
15 15
16 #ifndef SUBZERO_SRC_ICETARGETLOWERINGARM32_H 16 #ifndef SUBZERO_SRC_ICETARGETLOWERINGARM32_H
17 #define SUBZERO_SRC_ICETARGETLOWERINGARM32_H 17 #define SUBZERO_SRC_ICETARGETLOWERINGARM32_H
18 18
19 #include "IceDefs.h" 19 #include "IceDefs.h"
20 #include "IceInstARM32.h" 20 #include "IceInstARM32.h"
21 #include "IceRegistersARM32.h" 21 #include "IceRegistersARM32.h"
22 #include "IceTargetLowering.h" 22 #include "IceTargetLowering.h"
23 23
24 #include "llvm/ADT/SmallBitVector.h"
25
24 namespace Ice { 26 namespace Ice {
25 27
26 // Class encapsulating ARM cpu features / instruction set. 28 // Class encapsulating ARM cpu features / instruction set.
27 class TargetARM32Features { 29 class TargetARM32Features {
28 TargetARM32Features() = delete; 30 TargetARM32Features() = delete;
29 TargetARM32Features(const TargetARM32Features &) = delete; 31 TargetARM32Features(const TargetARM32Features &) = delete;
30 TargetARM32Features &operator=(const TargetARM32Features &) = delete; 32 TargetARM32Features &operator=(const TargetARM32Features &) = delete;
31 33
32 public: 34 public:
33 explicit TargetARM32Features(const ClFlags &Flags); 35 explicit TargetARM32Features(const ClFlags &Flags);
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 bool MaybeLeafFunc = true; 457 bool MaybeLeafFunc = true;
456 size_t SpillAreaSizeBytes = 0; 458 size_t SpillAreaSizeBytes = 0;
457 // TODO(jpp): std::array instead of array. 459 // TODO(jpp): std::array instead of array.
458 llvm::SmallBitVector TypeToRegisterSet[IceType_NUM]; 460 llvm::SmallBitVector TypeToRegisterSet[IceType_NUM];
459 llvm::SmallBitVector RegisterAliases[RegARM32::Reg_NUM]; 461 llvm::SmallBitVector RegisterAliases[RegARM32::Reg_NUM];
460 llvm::SmallBitVector ScratchRegs; 462 llvm::SmallBitVector ScratchRegs;
461 llvm::SmallBitVector RegsUsed; 463 llvm::SmallBitVector RegsUsed;
462 VarList PhysicalRegisters[IceType_NUM]; 464 VarList PhysicalRegisters[IceType_NUM];
463 465
464 /// Helper class that understands the Calling Convention and register 466 /// Helper class that understands the Calling Convention and register
465 /// assignments. The first few integer type parameters can use r0-r3, 467 /// assignments. The first few integer type parameters can use r0-r3,
Jim Stichnoth 2015/09/16 21:31:54 Is there a public reference that you can cite here
John 2015/09/16 23:12:47 Done.
466 /// regardless of their position relative to the floating-point/vector 468 /// regardless of their position relative to the floating-point/vector
467 /// arguments in the argument list. Floating-point and vector arguments 469 /// arguments in the argument list. Floating-point and vector arguments
468 /// can use q0-q3 (aka d0-d7, s0-s15). Technically, arguments that can 470 /// can use q0-q3 (aka d0-d7, s0-s15). Technically, arguments that can
469 /// start with registers but extend beyond the available registers can be 471 /// start with registers but extend beyond the available registers can be
470 /// split between the registers and the stack. However, this is typically 472 /// split between the registers and the stack. However, this is typically
471 /// for passing GPR structs by value, and PNaCl transforms expand this out. 473 /// for passing GPR structs by value, and PNaCl transforms expand this out.
472 /// 474 ///
473 /// Also, at the point before the call, the stack must be aligned. 475 /// Also, at the point before the call, the stack must be aligned.
474 class CallingConv { 476 class CallingConv {
475 CallingConv(const CallingConv &) = delete; 477 CallingConv(const CallingConv &) = delete;
476 CallingConv &operator=(const CallingConv &) = delete; 478 CallingConv &operator=(const CallingConv &) = delete;
477 479
478 public: 480 public:
479 CallingConv() {} 481 CallingConv()
482 : VFPRegsFree(ARM32_MAX_FP_REG_UNITS, true),
483 ValidF64Regs(ARM32_MAX_FP_REG_UNITS),
484 ValidV128Regs(ARM32_MAX_FP_REG_UNITS) {
485 for (uint32_t i = 0; i < ARM32_MAX_FP_REG_UNITS; ++i) {
Jim Stichnoth 2015/09/16 21:31:54 Whoa! This is almost FizzBuzz! :)
486 if ((i % 2) == 0) {
487 ValidF64Regs[i] = true;
488 }
489 if ((i % 4) == 0) {
490 ValidV128Regs[i] = true;
491 }
492 }
493 }
480 ~CallingConv() = default; 494 ~CallingConv() = default;
481 495
482 bool I64InRegs(std::pair<int32_t, int32_t> *Regs); 496 bool I64InRegs(std::pair<int32_t, int32_t> *Regs);
483 bool I32InReg(int32_t *Reg); 497 bool I32InReg(int32_t *Reg);
484 bool FPInReg(Type Ty, int32_t *Reg); 498 bool FPInReg(Type Ty, int32_t *Reg);
485 499
486 static constexpr uint32_t ARM32_MAX_GPR_ARG = 4; 500 static constexpr uint32_t ARM32_MAX_GPR_ARG = 4;
487 // Units of S registers still available to S/D/Q arguments. 501 // TODO(jpp): comment.
488 static constexpr uint32_t ARM32_MAX_FP_REG_UNITS = 16; 502 static constexpr uint32_t ARM32_MAX_FP_REG_UNITS = 16;
489 503
490 private: 504 private:
491 uint32_t NumGPRRegsUsed = 0; 505 uint32_t NumGPRRegsUsed = 0;
492 uint32_t NumFPRegUnits = 0; 506 llvm::SmallBitVector VFPRegsFree;
507 llvm::SmallBitVector ValidF64Regs;
508 llvm::SmallBitVector ValidV128Regs;
493 }; 509 };
494 510
495 private: 511 private:
496 ~TargetARM32() override = default; 512 ~TargetARM32() override = default;
497 }; 513 };
498 514
499 class TargetDataARM32 final : public TargetDataLowering { 515 class TargetDataARM32 final : public TargetDataLowering {
500 TargetDataARM32() = delete; 516 TargetDataARM32() = delete;
501 TargetDataARM32(const TargetDataARM32 &) = delete; 517 TargetDataARM32(const TargetDataARM32 &) = delete;
502 TargetDataARM32 &operator=(const TargetDataARM32 &) = delete; 518 TargetDataARM32 &operator=(const TargetDataARM32 &) = delete;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 552
537 private: 553 private:
538 ~TargetHeaderARM32() = default; 554 ~TargetHeaderARM32() = default;
539 555
540 TargetARM32Features CPUFeatures; 556 TargetARM32Features CPUFeatures;
541 }; 557 };
542 558
543 } // end of namespace Ice 559 } // end of namespace Ice
544 560
545 #endif // SUBZERO_SRC_ICETARGETLOWERINGARM32_H 561 #endif // SUBZERO_SRC_ICETARGETLOWERINGARM32_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698