OLD | NEW |
1 //===- subzero/src/IceTargetLowering.h - Lowering interface -----*- C++ -*-===// | 1 //===- subzero/src/IceTargetLowering.h - Lowering interface -----*- 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 |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 void assignVarStackSlots(VarList &SortedSpilledVariables, | 454 void assignVarStackSlots(VarList &SortedSpilledVariables, |
455 size_t SpillAreaPaddingBytes, | 455 size_t SpillAreaPaddingBytes, |
456 size_t SpillAreaSizeBytes, | 456 size_t SpillAreaSizeBytes, |
457 size_t GlobalsAndSubsequentPaddingSize, | 457 size_t GlobalsAndSubsequentPaddingSize, |
458 bool UsesFramePointer); | 458 bool UsesFramePointer); |
459 | 459 |
460 /// Sort the variables in Source based on required alignment. The variables | 460 /// Sort the variables in Source based on required alignment. The variables |
461 /// with the largest alignment need are placed in the front of the Dest list. | 461 /// with the largest alignment need are placed in the front of the Dest list. |
462 void sortVarsByAlignment(VarList &Dest, const VarList &Source) const; | 462 void sortVarsByAlignment(VarList &Dest, const VarList &Source) const; |
463 | 463 |
464 /// Make a call to an external helper function. | 464 InstCall *makeHelperCall(RuntimeHelperFuncID FuncID, Variable *Dest, |
465 InstCall *makeHelperCall(const IceString &Name, Variable *Dest, | |
466 SizeT MaxSrcs); | 465 SizeT MaxSrcs); |
467 | 466 |
468 void _set_dest_redefined() { Context.getLastInserted()->setDestRedefined(); } | 467 void _set_dest_redefined() { Context.getLastInserted()->setDestRedefined(); } |
469 | 468 |
470 bool shouldOptimizeMemIntrins(); | 469 bool shouldOptimizeMemIntrins(); |
471 | 470 |
472 void scalarizeArithmetic(InstArithmetic::OpKind K, Variable *Dest, | 471 void scalarizeArithmetic(InstArithmetic::OpKind K, Variable *Dest, |
473 Operand *Src0, Operand *Src1); | 472 Operand *Src0, Operand *Src1); |
474 | 473 |
475 /// Generalizes scalarizeArithmetic to support other instruction types. | 474 /// Generalizes scalarizeArithmetic to support other instruction types. |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 | 561 |
563 Cfg *Func; | 562 Cfg *Func; |
564 GlobalContext *Ctx; | 563 GlobalContext *Ctx; |
565 bool HasComputedFrame = false; | 564 bool HasComputedFrame = false; |
566 bool CallsReturnsTwice = false; | 565 bool CallsReturnsTwice = false; |
567 SizeT NextLabelNumber = 0; | 566 SizeT NextLabelNumber = 0; |
568 SizeT NextJumpTableNumber = 0; | 567 SizeT NextJumpTableNumber = 0; |
569 LoweringContext Context; | 568 LoweringContext Context; |
570 const SandboxType SandboxingType = ST_None; | 569 const SandboxType SandboxingType = ST_None; |
571 | 570 |
572 // Runtime helper function names | 571 /// Returns the constant defining the corresponding runtime helper function. |
573 const static constexpr char *H_bitcast_16xi1_i16 = "__Sz_bitcast_16xi1_i16"; | 572 Constant *getRuntimeHelperFunc(RuntimeHelperFuncID FuncID) const { |
574 const static constexpr char *H_bitcast_8xi1_i8 = "__Sz_bitcast_8xi1_i8"; | 573 return Ctx->getRuntimeHelperFunc(FuncID); |
575 const static constexpr char *H_bitcast_i16_16xi1 = "__Sz_bitcast_i16_16xi1"; | 574 } |
576 const static constexpr char *H_bitcast_i8_8xi1 = "__Sz_bitcast_i8_8xi1"; | 575 |
577 const static constexpr char *H_call_ctpop_i32 = "__popcountsi2"; | |
578 const static constexpr char *H_call_ctpop_i64 = "__popcountdi2"; | |
579 const static constexpr char *H_call_longjmp = "longjmp"; | |
580 const static constexpr char *H_call_memcpy = "memcpy"; | |
581 const static constexpr char *H_call_memmove = "memmove"; | |
582 const static constexpr char *H_call_memset = "memset"; | |
583 const static constexpr char *H_call_read_tp = "__nacl_read_tp"; | |
584 const static constexpr char *H_call_setjmp = "setjmp"; | |
585 const static constexpr char *H_fptosi_f32_i64 = "__Sz_fptosi_f32_i64"; | |
586 const static constexpr char *H_fptosi_f64_i64 = "__Sz_fptosi_f64_i64"; | |
587 const static constexpr char *H_fptoui_4xi32_f32 = "__Sz_fptoui_4xi32_f32"; | |
588 const static constexpr char *H_fptoui_f32_i32 = "__Sz_fptoui_f32_i32"; | |
589 const static constexpr char *H_fptoui_f32_i64 = "__Sz_fptoui_f32_i64"; | |
590 const static constexpr char *H_fptoui_f64_i32 = "__Sz_fptoui_f64_i32"; | |
591 const static constexpr char *H_fptoui_f64_i64 = "__Sz_fptoui_f64_i64"; | |
592 const static constexpr char *H_frem_f32 = "fmodf"; | |
593 const static constexpr char *H_frem_f64 = "fmod"; | |
594 const static constexpr char *H_getIP_prefix = "__Sz_getIP_"; | 576 const static constexpr char *H_getIP_prefix = "__Sz_getIP_"; |
595 const static constexpr char *H_sdiv_i32 = "__divsi3"; | |
596 const static constexpr char *H_sdiv_i64 = "__divdi3"; | |
597 const static constexpr char *H_sitofp_i64_f32 = "__Sz_sitofp_i64_f32"; | |
598 const static constexpr char *H_sitofp_i64_f64 = "__Sz_sitofp_i64_f64"; | |
599 const static constexpr char *H_srem_i32 = "__modsi3"; | |
600 const static constexpr char *H_srem_i64 = "__moddi3"; | |
601 const static constexpr char *H_udiv_i32 = "__udivsi3"; | |
602 const static constexpr char *H_udiv_i64 = "__udivdi3"; | |
603 const static constexpr char *H_uitofp_4xi32_4xf32 = "__Sz_uitofp_4xi32_4xf32"; | |
604 const static constexpr char *H_uitofp_i32_f32 = "__Sz_uitofp_i32_f32"; | |
605 const static constexpr char *H_uitofp_i32_f64 = "__Sz_uitofp_i32_f64"; | |
606 const static constexpr char *H_uitofp_i64_f32 = "__Sz_uitofp_i64_f32"; | |
607 const static constexpr char *H_uitofp_i64_f64 = "__Sz_uitofp_i64_f64"; | |
608 const static constexpr char *H_urem_i32 = "__umodsi3"; | |
609 const static constexpr char *H_urem_i64 = "__umoddi3"; | |
610 }; | 577 }; |
611 | 578 |
612 /// TargetDataLowering is used for "lowering" data including initializers for | 579 /// TargetDataLowering is used for "lowering" data including initializers for |
613 /// global variables, and the internal constant pools. It is separated out from | 580 /// global variables, and the internal constant pools. It is separated out from |
614 /// TargetLowering because it does not require a Cfg. | 581 /// TargetLowering because it does not require a Cfg. |
615 class TargetDataLowering { | 582 class TargetDataLowering { |
616 TargetDataLowering() = delete; | 583 TargetDataLowering() = delete; |
617 TargetDataLowering(const TargetDataLowering &) = delete; | 584 TargetDataLowering(const TargetDataLowering &) = delete; |
618 TargetDataLowering &operator=(const TargetDataLowering &) = delete; | 585 TargetDataLowering &operator=(const TargetDataLowering &) = delete; |
619 | 586 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
655 virtual void lower() {} | 622 virtual void lower() {} |
656 | 623 |
657 protected: | 624 protected: |
658 explicit TargetHeaderLowering(GlobalContext *Ctx) : Ctx(Ctx) {} | 625 explicit TargetHeaderLowering(GlobalContext *Ctx) : Ctx(Ctx) {} |
659 GlobalContext *Ctx; | 626 GlobalContext *Ctx; |
660 }; | 627 }; |
661 | 628 |
662 } // end of namespace Ice | 629 } // end of namespace Ice |
663 | 630 |
664 #endif // SUBZERO_SRC_ICETARGETLOWERING_H | 631 #endif // SUBZERO_SRC_ICETARGETLOWERING_H |
OLD | NEW |