Value Use User

本文深入探讨了LLVMIR中的ValueUseUser关系,解释了Value如何通过Use与User相连,以及User如何指向数据Value。此外,文章还介绍了SDNode类,包括其在SelectionDAG中的作用,以及如何通过SDUse来管理数据节点和结果选择。同时,示例代码展示了SDNode的结构和SDValue的使用。
摘要由CSDN通过智能技术生成

提示:文章写完后,目录可以自动生成,如何生成可参考右边的帮助文档


前言

提示:这里可以添加本文要记录的大概内容:

例如:随着人工智能的不断发展,机器学习这门技术也越来越重要,很多人都开启了学习机器学习,本文就介绍了机器学习的基础内容。


提示:以下是本篇文章正文内容,下面案例可供参考

一、LLVMIR中的Value Use User的关系

图示 LLVMIR中指令逻辑组成
图示i32 %1 = add i32 %2, i32%3,定义了三个变量%1 , %2,%3 。图示展示了三个变量在代码层面的构成逻辑。

为了保证Value的可复用性。引入了User Use Value
User本质也是Value.

  • User代表输出时,User->hidden pointer指向了它的输入参数,这里用Use作为中介,再指向最终的数据Value
  • 如果某个Value被多次使用,那么一定有多个Use与之关联。UseNext、 Prev的构成了这些Use的链表。这某个Value 的UseList指向第一个Use。最后一个Use的Next指向这某个Value。

二、SDNode

1.引入库

代码如下(示例):

class SDNode {
	DebugLoc debugLoc;//source line information,记录原行信息
	unsigned short NumOperands;
    unsigned short NumValues;	
private:
  friend class SelectionDAG;
  // TODO: unfriend HandleSDNode once we fix its operand handling.
  friend class HandleSDNode;

  /// Unique id per SDNode in the DAG.
  int NodeId = -1;

  /// The values that are used by this operation.
  SDUse *OperandList = nullptr;

  /// The types of the values this node defines.  SDNode's may
  /// define multiple values simultaneously.
  const EVT *ValueList;

  /// List of uses for this SDNode.
  SDUse *UseList = nullptr;

  /// The number of entries in the Operand/Value list.
  unsigned short NumOperands = 0;
  unsigned short NumValues;

  // The ordering of the SDNodes. It roughly corresponds to the ordering of the
  // original LLVM instructions.
  // This is used for turning off scheduling, because we'll forgo
  // the normal scheduling algorithms and output the instructions according to
  // this ordering.
  unsigned IROrder;
  /// Source line information.
  DebugLoc debugLoc;
class SDValue {
	friend struct DenseMapInfo<SDValue>;
	
	SDNode *Node = nullptr; // The node defining the value we are using.
	unsigned ResNo = 0;     // Which return value of the node we are using.
	get the index which selects a specific result in the SDNode

在这里插入图片描述

Value可以直接转为SDValue;
SDValue可以直接定向SDNode;
SDUse是核心,SDNode指明用的数据节点,SDValue->ResNo指明使用该数据节点中的哪一个结果。

2.读入数据

代码如下(示例):

data = pd.read_csv(
    'https://labfile.oss.aliyuncs.com/courses/1283/adult.data.csv')
print(data.head())

该处使用的url网络请求的数据。


总结

提示:这里对文章进行总结:
例如:以上就是今天要讲的内容,本文仅仅简单介绍了pandas的使用,而pandas提供了大量能使我们快速便捷地处理数据的函数和方法。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值