Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
Paddle
提交
9a8e9417
P
Paddle
项目概览
PaddlePaddle
/
Paddle
大约 1 年 前同步成功
通知
2299
Star
20931
Fork
5422
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1423
列表
看板
标记
里程碑
合并请求
543
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
Paddle
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1,423
Issue
1,423
列表
看板
标记
里程碑
合并请求
543
合并请求
543
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
9a8e9417
编写于
6月 02, 2023
作者:
W
winter-wang
提交者:
GitHub
6月 02, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[IR] standardize the use of new IR api. (#54289)
上级
f1c9c505
变更
19
显示空白变更内容
内联
并排
Showing
19 changed file
with
67 addition
and
94 deletion
+67
-94
paddle/fluid/dialect/op_gen.py
paddle/fluid/dialect/op_gen.py
+3
-3
paddle/fluid/translator/program_translator.cc
paddle/fluid/translator/program_translator.cc
+1
-0
paddle/fluid/translator/translate.cc
paddle/fluid/translator/translate.cc
+1
-1
paddle/ir/core/attribute_base.h
paddle/ir/core/attribute_base.h
+0
-16
paddle/ir/core/builder.cc
paddle/ir/core/builder.cc
+4
-3
paddle/ir/core/builder.h
paddle/ir/core/builder.h
+0
-1
paddle/ir/core/builtin_op.cc
paddle/ir/core/builtin_op.cc
+1
-1
paddle/ir/core/operation.cc
paddle/ir/core/operation.cc
+1
-0
paddle/ir/core/operation.h
paddle/ir/core/operation.h
+4
-3
paddle/ir/core/operation_utils.h
paddle/ir/core/operation_utils.h
+9
-9
paddle/ir/core/printer.cc
paddle/ir/core/printer.cc
+3
-3
paddle/ir/core/program.cc
paddle/ir/core/program.cc
+0
-2
paddle/ir/core/program.h
paddle/ir/core/program.h
+1
-1
paddle/ir/core/type_base.h
paddle/ir/core/type_base.h
+0
-13
paddle/ir/core/value.cc
paddle/ir/core/value.cc
+6
-10
paddle/ir/core/value.h
paddle/ir/core/value.h
+16
-7
test/cpp/ir/core/ir_op_test.cc
test/cpp/ir/core/ir_op_test.cc
+3
-3
test/cpp/ir/core/ir_program_test.cc
test/cpp/ir/core/ir_program_test.cc
+7
-8
test/cpp/ir/core/ir_value_test.cc
test/cpp/ir/core/ir_value_test.cc
+7
-10
未找到文件。
paddle/fluid/dialect/op_gen.py
浏览文件 @
9a8e9417
...
...
@@ -613,7 +613,7 @@ def GenBuildInputArgsStr(
def
GenBuildInputs
(
op_input_name_list
):
BUILD_INPUT_TEMPLATE
=
""" std::vector<ir::OpResult> argument_inputs = {{{inputs_args}}};
argument.
a
ddOperands(argument_inputs.begin(), argument_inputs.end());
argument.
A
ddOperands(argument_inputs.begin(), argument_inputs.end());
"""
build_input_str
=
""
if
len
(
op_input_name_list
)
>
0
:
...
...
@@ -693,7 +693,7 @@ def GenBuildAttributes(op_attribute_name_list, op_attribute_type_list):
op_attribute_type
=
op_attribute_type_list
[
idx
],
attr
=
op_attribute_name_list
[
idx
],
)
attr_str
+=
""" argument.
a
ddAttribute("{attr_name}", attr_{attr_name});
\n
"""
.
format
(
attr_str
+=
""" argument.
A
ddAttribute("{attr_name}", attr_{attr_name});
\n
"""
.
format
(
attr_name
=
op_attribute_name_list
[
idx
]
)
...
...
@@ -847,7 +847,7 @@ def GenBuildOutputs(
name
=
op_output_name_list
[
idx
]
)
build_output_str
+=
" argument.
a
ddTypes(argument_outputs.begin(), argument_outputs.end());
\n
"
build_output_str
+=
" argument.
A
ddTypes(argument_outputs.begin(), argument_outputs.end());
\n
"
return
build_output_str
...
...
paddle/fluid/translator/program_translator.cc
浏览文件 @
9a8e9417
...
...
@@ -22,6 +22,7 @@
#include "paddle/fluid/translator/op_translator.h"
#include "paddle/fluid/translator/type_translator.h"
#include "paddle/ir/core/attribute.h"
#include "paddle/ir/core/block.h"
#include "paddle/ir/core/builtin_op.h"
#include "paddle/ir/core/builtin_type.h"
#include "paddle/ir/core/operation.h"
...
...
paddle/fluid/translator/translate.cc
浏览文件 @
9a8e9417
...
...
@@ -28,7 +28,7 @@ using Program = ::ir::Program;
std
::
unique_ptr
<
Program
>
TranslateLegacyProgramToProgram
(
const
LegacyProgramDesc
&
legacy_program
)
{
auto
program
=
std
::
make_unique
<
Program
>
();
auto
program
=
std
::
make_unique
<
Program
>
(
ir
::
IrContext
::
Instance
()
);
translator
::
ProgramTranslator
program_translator
(
&
legacy_program
,
program
.
get
());
...
...
paddle/ir/core/attribute_base.h
浏览文件 @
9a8e9417
...
...
@@ -263,20 +263,4 @@ struct AttributeManager {
return ir::AttributeManager::template get<concrete_attribute>(ctx, \
args...); \
}
///
/// \brief This macro definition is used to register custom Attribute class.
///
#define REGISTER_ATTRIBUTE_2_IRCONTEXT(concrete_attribute, dialect) \
ir::AbstractAttribute *abstract_attribute_##concrete_attribute = \
new ir::AbstractAttribute(std::move( \
ir::AbstractAttribute::get<concrete_attribute>(*dialect))); \
\
dialect->ir_context()->RegisterAbstractAttribute( \
ir::TypeId::get<concrete_attribute>(), \
abstract_attribute_##concrete_attribute); \
\
ir::AttributeManager::RegisterAttribute<concrete_attribute>( \
dialect->ir_context());
}
// namespace ir
paddle/ir/core/builder.cc
浏览文件 @
9a8e9417
...
...
@@ -14,6 +14,7 @@
#include "paddle/ir/core/builder.h"
#include "paddle/ir/core/region.h"
#include "paddle/ir/core/value.h"
namespace
ir
{
Operation
*
Builder
::
insert
(
Operation
*
op
)
{
...
...
@@ -31,10 +32,10 @@ Operation *Builder::create(OperationArgument &&argument) {
}
/// Creates an operation with the given fields.
Operation
*
Builder
::
create
(
const
std
::
vector
<
ir
::
OpResult
>
&
inputs
,
Operation
*
Builder
::
create
(
const
std
::
vector
<
OpResult
>
&
inputs
,
const
AttributeMap
&
attribute
,
const
std
::
vector
<
ir
::
Type
>
&
output_types
,
ir
::
OpInfo
op_info
)
{
const
std
::
vector
<
Type
>
&
output_types
,
OpInfo
op_info
)
{
return
create
(
OperationArgument
(
inputs
,
attribute
,
output_types
,
op_info
));
}
...
...
paddle/ir/core/builder.h
浏览文件 @
9a8e9417
...
...
@@ -18,7 +18,6 @@
#include "paddle/ir/core/block.h"
#include "paddle/ir/core/operation.h"
#include "paddle/ir/core/program.h"
namespace
ir
{
///
...
...
paddle/ir/core/builtin_op.cc
浏览文件 @
9a8e9417
...
...
@@ -41,7 +41,7 @@ ModuleOp ModuleOp::create(IrContext *context, Program *pointer) {
ir
::
OpInfo
info
=
context
->
GetRegisteredOpInfo
(
name
());
OperationArgument
argument
(
info
);
argument
.
AddRegion
()
->
emplace_back
();
argument
.
a
ddAttribute
(
"program"
,
PointerAttribute
::
get
(
context
,
pointer
));
argument
.
A
ddAttribute
(
"program"
,
PointerAttribute
::
get
(
context
,
pointer
));
return
ModuleOp
(
Operation
::
create
(
std
::
move
(
argument
)));
}
...
...
paddle/ir/core/operation.cc
浏览文件 @
9a8e9417
...
...
@@ -18,6 +18,7 @@
#include "paddle/ir/core/program.h"
#include "paddle/ir/core/region.h"
#include "paddle/ir/core/utils.h"
#include "paddle/ir/core/value_impl.h"
namespace
ir
{
Operation
*
Operation
::
create
(
OperationArgument
&&
argument
)
{
...
...
paddle/ir/core/operation.h
浏览文件 @
9a8e9417
...
...
@@ -18,12 +18,13 @@
#include "paddle/ir/core/op_info.h"
#include "paddle/ir/core/operation_utils.h"
#include "paddle/ir/core/type.h"
#include "paddle/ir/core/value_impl.h"
namespace
ir
{
class
OpBase
;
class
Program
;
class
Block
;
class
OpOperand
;
class
OpResult
;
class
alignas
(
8
)
Operation
final
{
public:
...
...
@@ -47,9 +48,9 @@ class alignas(8) Operation final {
IrContext
*
ir_context
()
const
;
ir
::
OpResult
GetResultByIndex
(
uint32_t
index
)
const
;
OpResult
GetResultByIndex
(
uint32_t
index
)
const
;
ir
::
OpOperand
GetOperandByIndex
(
uint32_t
index
)
const
;
OpOperand
GetOperandByIndex
(
uint32_t
index
)
const
;
std
::
string
print
();
...
...
paddle/ir/core/operation_utils.h
浏览文件 @
9a8e9417
...
...
@@ -14,11 +14,11 @@
#pragma once
#include "paddle/ir/core/
builtin_
attribute.h"
#include "paddle/ir/core/attribute.h"
#include "paddle/ir/core/op_info.h"
#include "paddle/ir/core/region.h"
#include "paddle/ir/core/type.h"
#include "paddle/ir/core/value
_impl
.h"
#include "paddle/ir/core/value.h"
namespace
ir
{
...
...
@@ -52,18 +52,18 @@ struct OperationArgument {
regions
(
std
::
move
(
regions
))
{}
template
<
class
InputIt
>
void
a
ddOperands
(
InputIt
first
,
InputIt
last
);
void
A
ddOperands
(
InputIt
first
,
InputIt
last
);
template
<
class
InputIt
>
void
a
ddTypes
(
InputIt
first
,
InputIt
last
);
void
A
ddTypes
(
InputIt
first
,
InputIt
last
);
/// Add an attribute with the specified name.
void
a
ddAttribute
(
const
std
::
string
&
name
,
Attribute
attr
)
{
void
A
ddAttribute
(
const
std
::
string
&
name
,
Attribute
attr
)
{
attributes
[
name
]
=
attr
;
}
/// Add an array of named attributes.
template
<
class
InputIt
>
void
a
ddAttributes
(
InputIt
first
,
InputIt
last
);
void
A
ddAttributes
(
InputIt
first
,
InputIt
last
);
/// Get the context held by this operation state.
IrContext
*
getContext
()
const
{
return
info
.
ir_context
();
}
...
...
@@ -74,19 +74,19 @@ struct OperationArgument {
};
template
<
class
InputIt
>
void
OperationArgument
::
a
ddOperands
(
InputIt
first
,
InputIt
last
)
{
void
OperationArgument
::
A
ddOperands
(
InputIt
first
,
InputIt
last
)
{
while
(
first
!=
last
)
{
inputs
.
emplace_back
(
*
first
++
);
}
}
template
<
class
InputIt
>
void
OperationArgument
::
a
ddTypes
(
InputIt
first
,
InputIt
last
)
{
void
OperationArgument
::
A
ddTypes
(
InputIt
first
,
InputIt
last
)
{
while
(
first
!=
last
)
{
output_types
.
emplace_back
(
*
first
++
);
}
}
template
<
class
InputIt
>
void
OperationArgument
::
a
ddAttributes
(
InputIt
first
,
InputIt
last
)
{
void
OperationArgument
::
A
ddAttributes
(
InputIt
first
,
InputIt
last
)
{
while
(
first
!=
last
)
{
attributes
[
first
->
first
]
=
first
->
second
;
++
first
;
...
...
paddle/ir/core/printer.cc
浏览文件 @
9a8e9417
...
...
@@ -17,6 +17,7 @@
#include <string>
#include <unordered_map>
#include "paddle/ir/core/block.h"
#include "paddle/ir/core/builtin_attribute.h"
#include "paddle/ir/core/builtin_type.h"
#include "paddle/ir/core/dialect.h"
...
...
@@ -160,7 +161,7 @@ class ProgramPrinter : public Printer {
std
::
vector
<
ir
::
Value
>
op_operands
;
op_operands
.
reserve
(
num_op_operands
);
for
(
size_t
idx
=
0
;
idx
<
num_op_operands
;
idx
++
)
{
op_operands
.
push_back
(
op
->
GetOperandByIndex
(
idx
).
impl
()
->
source
());
op_operands
.
push_back
(
op
->
GetOperandByIndex
(
idx
).
source
());
}
PrintInterleave
(
op_operands
.
begin
(),
...
...
@@ -175,8 +176,7 @@ class ProgramPrinter : public Printer {
std
::
vector
<
ir
::
Type
>
op_operand_types
;
op_operand_types
.
reserve
(
num_op_operands
);
for
(
size_t
idx
=
0
;
idx
<
num_op_operands
;
idx
++
)
{
op_operand_types
.
push_back
(
op
->
GetOperandByIndex
(
idx
).
impl
()
->
source
().
type
());
op_operand_types
.
push_back
(
op
->
GetOperandByIndex
(
idx
).
source
().
type
());
}
PrintInterleave
(
op_operand_types
.
begin
(),
...
...
paddle/ir/core/program.cc
浏览文件 @
9a8e9417
...
...
@@ -21,8 +21,6 @@ Program::Program(IrContext* context) {
module_
=
ModuleOp
::
create
(
context
,
this
);
}
Program
::
Program
()
:
Program
(
IrContext
::
Instance
())
{}
Program
::~
Program
()
{
if
(
module_
)
{
module_
.
destroy
();
...
...
paddle/ir/core/program.h
浏览文件 @
9a8e9417
...
...
@@ -17,6 +17,7 @@
#include <list>
#include <unordered_map>
#include "paddle/ir/core/attribute.h"
#include "paddle/ir/core/block.h"
#include "paddle/ir/core/builtin_attribute.h"
#include "paddle/ir/core/builtin_op.h"
...
...
@@ -39,7 +40,6 @@ class Program {
using
ParameterMap
=
std
::
unordered_map
<
std
::
string
,
std
::
unique_ptr
<
Parameter
>>
;
explicit
Program
(
IrContext
*
context
);
Program
();
Program
(
Program
&&
)
=
delete
;
Program
(
const
Program
&
program
)
=
delete
;
Program
&
operator
=
(
const
Program
&
)
=
delete
;
...
...
paddle/ir/core/type_base.h
浏览文件 @
9a8e9417
...
...
@@ -259,17 +259,4 @@ struct TypeManager {
static concrete_type get(ir::IrContext *ctx, Args... args) { \
return ir::TypeManager::template get<concrete_type>(ctx, args...); \
}
///
/// \brief This macro definition is used to register custom Type class.
///
#define REGISTER_TYPE_2_IRCONTEXT(concrete_type, dialect) \
ir::AbstractType *abstract_type_##concrete_type = new ir::AbstractType( \
std::move(ir::AbstractType::get<concrete_type>(*dialect))); \
\
dialect->ir_context()->RegisterAbstractType( \
ir::TypeId::get<concrete_type>(), abstract_type_##concrete_type); \
\
ir::TypeManager::RegisterType<concrete_type>(dialect->ir_context());
}
// namespace ir
paddle/ir/core/value.cc
浏览文件 @
9a8e9417
...
...
@@ -32,19 +32,13 @@ OpOperand &OpOperand::operator=(const detail::OpOperandImpl *impl) {
return
*
this
;
}
bool
OpOperand
::
operator
==
(
OpOperand
other
)
const
{
return
impl_
==
other
.
impl_
;
}
bool
OpOperand
::
operator
!=
(
OpOperand
other
)
const
{
return
impl_
!=
other
.
impl_
;
}
OpOperand
OpOperand
::
next_use
()
const
{
return
impl_
->
next_use
();
}
bool
OpOperand
::
operator
!
()
const
{
return
impl_
==
nullptr
;
}
Value
OpOperand
::
source
()
const
{
return
impl_
->
source
()
;
}
Op
Operand
::
operator
bool
()
const
{
return
impl_
;
}
Op
eration
*
OpOperand
::
owner
()
const
{
return
impl_
->
owner
()
;
}
detail
::
OpOperandImpl
*
OpOperand
::
impl
()
const
{
return
impl_
;
}
//
detail::OpOperandImpl *OpOperand::impl() const { return impl_; }
// Value
Value
::
Value
(
const
detail
::
ValueImpl
*
impl
)
...
...
@@ -81,6 +75,8 @@ Value::use_iterator Value::begin() const {
Value
::
use_iterator
Value
::
end
()
const
{
return
Value
::
use_iterator
();
}
OpOperand
Value
::
first_use
()
const
{
return
impl
()
->
first_use
();
}
// OpResult
bool
OpResult
::
classof
(
Value
value
)
{
return
ir
::
isa
<
detail
::
OpResultImpl
>
(
value
.
impl
());
...
...
paddle/ir/core/value.h
浏览文件 @
9a8e9417
...
...
@@ -19,6 +19,7 @@
namespace
ir
{
class
Operation
;
class
Value
;
namespace
detail
{
class
OpOperandImpl
;
...
...
@@ -42,15 +43,21 @@ class OpOperand {
OpOperand
&
operator
=
(
const
detail
::
OpOperandImpl
*
impl
);
bool
operator
==
(
OpOperand
other
)
const
;
bool
operator
==
(
const
OpOperand
&
other
)
const
{
return
impl_
==
other
.
impl_
;
}
bool
operator
!=
(
OpOperand
other
)
const
;
bool
operator
!=
(
const
OpOperand
&
other
)
const
{
return
!
operator
==
(
other
);
}
bool
operator
!
()
const
;
bool
operator
!
()
const
{
return
impl_
==
nullptr
;
}
explicit
operator
bool
()
const
;
operator
bool
()
const
{
return
impl_
;
}
detail
::
OpOperandImpl
*
impl
()
const
;
OpOperand
next_use
()
const
;
Value
source
()
const
;
Operation
*
owner
()
const
;
// detail::OpOperandImpl *impl() const { return impl_;}
private:
detail
::
OpOperandImpl
*
impl_
{
nullptr
};
...
...
@@ -71,14 +78,14 @@ class ValueUseIterator {
return
!
(
*
this
==
rhs
);
}
ir
::
Operation
*
owner
()
const
{
return
current_
.
impl
()
->
owner
();
}
ir
::
Operation
*
owner
()
const
{
return
current_
.
owner
();
}
OperandType
get
()
const
{
return
current_
;
}
OperandType
operator
*
()
const
{
return
get
();
}
ValueUseIterator
<
OperandType
>
&
operator
++
()
{
current_
=
current_
.
impl
()
->
next_use
();
current_
=
current_
.
next_use
();
return
*
this
;
}
...
...
@@ -141,6 +148,8 @@ class Value {
use_iterator
end
()
const
;
OpOperand
first_use
()
const
;
friend
struct
std
::
hash
<
Value
>
;
protected:
...
...
test/cpp/ir/core/ir_op_test.cc
浏览文件 @
9a8e9417
...
...
@@ -103,11 +103,11 @@ class Operation1 : public ir::Op<Operation1> {
std
::
unordered_map
<
std
::
string
,
ir
::
Attribute
>
attributes
=
CreateAttributeMap
({
"op1_attr1"
,
"op1_attr2"
},
{
"op1_attr1"
,
"op1_attr2"
});
argument
.
a
ddOperands
<
std
::
vector
<
ir
::
OpResult
>::
iterator
>
(
inputs
.
begin
(),
argument
.
A
ddOperands
<
std
::
vector
<
ir
::
OpResult
>::
iterator
>
(
inputs
.
begin
(),
inputs
.
end
());
argument
.
a
ddTypes
<
std
::
vector
<
ir
::
Type
>::
iterator
>
(
output_types
.
begin
(),
argument
.
A
ddTypes
<
std
::
vector
<
ir
::
Type
>::
iterator
>
(
output_types
.
begin
(),
output_types
.
end
());
argument
.
a
ddAttributes
<
argument
.
A
ddAttributes
<
std
::
unordered_map
<
std
::
string
,
ir
::
Attribute
>::
iterator
>
(
attributes
.
begin
(),
attributes
.
end
());
}
...
...
test/cpp/ir/core/ir_program_test.cc
浏览文件 @
9a8e9417
...
...
@@ -188,9 +188,9 @@ TEST(program_test, program) {
std
::
unordered_map
<
std
::
string
,
ir
::
Attribute
>
abs_op_attribute
;
std
::
vector
<
ir
::
Type
>
output_types
=
{
dense_tensor_dtype
};
ir
::
OperationArgument
abs_argument
(
abs_info
);
abs_argument
.
a
ddOperands
(
operands
.
begin
(),
operands
.
end
());
abs_argument
.
a
ddAttributes
(
abs_op_attribute
.
begin
(),
abs_op_attribute
.
end
());
abs_argument
.
a
ddTypes
(
output_types
.
begin
(),
output_types
.
end
());
abs_argument
.
A
ddOperands
(
operands
.
begin
(),
operands
.
end
());
abs_argument
.
A
ddAttributes
(
abs_op_attribute
.
begin
(),
abs_op_attribute
.
end
());
abs_argument
.
A
ddTypes
(
output_types
.
begin
(),
output_types
.
end
());
ir
::
Operation
*
abs_op
=
ir
::
Operation
::
create
(
std
::
move
(
abs_argument
));
paddle
::
dialect
::
GetOpInfoInterface
interface
=
abs_op
->
dyn_cast
<
paddle
::
dialect
::
GetOpInfoInterface
>
();
...
...
@@ -205,15 +205,14 @@ TEST(program_test, program) {
ir
::
OperationArgument
op4_argument
(
{
op3
->
GetResultByIndex
(
0
)},
{},
{},
op4_info
);
op4_argument
.
a
ddAttributes
(
op4_attribute
.
begin
(),
op4_attribute
.
end
());
op4_argument
.
A
ddAttributes
(
op4_attribute
.
begin
(),
op4_attribute
.
end
());
ir
::
Operation
*
op4
=
ir
::
Operation
::
create
(
std
::
move
(
op4_argument
));
block
->
push_back
(
op4
);
EXPECT_EQ
(
op4
->
GetOperandByIndex
(
0
).
impl
()
->
source
().
type
().
dialect
().
id
(),
EXPECT_EQ
(
op4
->
GetOperandByIndex
(
0
).
source
().
type
().
dialect
().
id
(),
paddle_dialect
->
id
());
Interface
*
c_interface
=
op4
->
GetOperandByIndex
(
0
)
.
impl
()
->
source
()
.
source
()
.
type
()
.
dialect
()
.
GetRegisteredInterface
<
Interface
>
();
...
...
@@ -239,7 +238,7 @@ TEST(program_test, slice_combine_test) {
ctx
->
GetOrRegisterDialect
<
ir
::
BuiltinDialect
>
();
// (2) Create an empty program object
ir
::
Program
program
;
ir
::
Program
program
(
ctx
)
;
// ir::Program *program = new ir::Program();
EXPECT_EQ
(
program
.
block
()
->
size
()
==
0
,
true
);
...
...
test/cpp/ir/core/ir_value_test.cc
浏览文件 @
9a8e9417
...
...
@@ -85,16 +85,13 @@ TEST(value_test, value_test) {
// Test 2: op1_first_output -> op4_first_input
ir
::
OpResult
op1_first_output
=
op1
->
GetResultByIndex
(
0
);
ir
::
detail
::
OpOperandImpl
*
op4_first_input
=
reinterpret_cast
<
ir
::
detail
::
OpOperandImpl
*>
(
reinterpret_cast
<
uintptr_t
>
(
op4
)
+
sizeof
(
ir
::
Operation
));
EXPECT_EQ
(
static_cast
<
ir
::
Value
>
(
op1_first_output
).
impl
()
->
first_use
(),
op4_first_input
);
ir
::
detail
::
OpOperandImpl
*
op3_first_input
=
reinterpret_cast
<
ir
::
detail
::
OpOperandImpl
*>
(
reinterpret_cast
<
uintptr_t
>
(
op3
)
+
sizeof
(
ir
::
Operation
));
EXPECT_EQ
(
op4_first_input
->
next_use
(),
op3_first_input
);
EXPECT_EQ
(
op3_first_input
->
next_use
(),
nullptr
);
ir
::
OpOperand
op4_first_input
=
op4
->
GetOperandByIndex
(
0
);
EXPECT_EQ
(
op1_first_output
.
first_use
(),
op4_first_input
);
ir
::
OpOperand
op3_first_input
=
op3
->
GetOperandByIndex
(
0
);
EXPECT_EQ
(
op4_first_input
.
next_use
(),
op3_first_input
);
EXPECT_EQ
(
op3_first_input
.
next_use
(),
nullptr
);
// Test 3: Value iterator
ir
::
Value
::
use_iterator
iter
=
op1
->
GetResultByIndex
(
0
).
begin
();
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录