【问题标题】:Cannot figure out /[ex] operator from gcc's -fdump-tree-gimple无法从 gcc 的 -fdump-tree-gimple 中找出 /[ex] 运算符
【发布时间】:2012-02-24 18:11:59
【问题描述】:

使用 -fdump-tree-gimple 选项 (GCC 4.6.1) 编译 C++ 时,我得到的代码中包含以下函数:

std::_Vector_base<_Tp, _Alloc>::~_Vector_base() [with _Tp = int, _Alloc = std::allocator<int>] (struct _Vector_base * const this)
{
  int * D.8482;
  long int D.8483;
  int * D.8484;
  long int D.8485;
  long int D.8486;
  long int D.8487;
  long unsigned int D.8488;
  int * D.8489;
  struct _Vector_impl * D.8490;

  {
    try
      {
        D.8482 = this->_M_impl._M_end_of_storage;
        D.8483 = (long int) D.8482;
        D.8484 = this->_M_impl._M_start;
        D.8485 = (long int) D.8484;
        D.8486 = D.8483 - D.8485;
        D.8487 = D.8486 /[ex] 4;
        D.8488 = (long unsigned int) D.8487;
        D.8489 = this->_M_impl._M_start;
        std::_Vector_base<int, std::allocator<int> >::_M_deallocate(this, D.8489, D.8488);
      }
    finally
      {
        D.8490 = &this->_M_impl;
        std::_Vector_base<int, std::allocator<int>::_Vector_impl::~_Vector_impl (D.8490);
      }
  }
  <D.8393>:
}

您可以通过编写一个使用std::vector&lt;int&gt; 的简单程序来获取此代码。无论如何,我不明白的代码部分是D.8487 = D.8486 /[ex] 4;。我查看了/usr/include/c++/4.6.1/std_vector.h 的源代码,它的析构函数是一个调用_M_deallocate 的单行代码。有谁知道运算符/[ex] 代表什么?到目前为止,我唯一注意到的是 RHS 操作数是向量参数化的类型的大小。

【问题讨论】:

  • 不会将此作为答案发布,因为我没有支持文档,但我认为它有两个单独的标记 /[ex],第一个是除法,第二个是扩展运算符4 表示与分子相同的类型。

标签: c++ gcc gimple


【解决方案1】:

/[ex] 表示它是一个精确的除法表达式。

来自 GCC 内部手册:

EXACT_DIV_EXPR

EXACT_DIV_EXPR 代码用于表示已知分子是分母的精确倍数的整数除法。这允许后端为当前目标在 TRUNC_DIV_EXPR、CEIL_DIV_EXPR 和 FLOOR_DIV_EXPR 中选择较快的一个。

【讨论】:

    猜你喜欢
    • 2011-02-10
    • 1970-01-01
    • 2018-09-27
    • 2019-11-27
    • 1970-01-01
    • 2012-02-24
    • 2018-12-23
    • 1970-01-01
    • 2014-03-06
    相关资源
    最近更新 更多