class SubRegIndex { .....} 是什么语法

Panda_熊猫 2014-02-18 03:41:07
如题。
不像是类模板啊,没有template。
类模板必须要有 template吗?

希望能讲的详细一些,谢谢。
...全文
123 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
Panda_熊猫 2014-02-18
  • 打赏
  • 举报
回复
引用 2 楼 mougaidong 的回复:
问:是什么语法? 答:是错误的语法。
您说的应该是对的。
//===- Target.td - Target Independent TableGen interface ---*- tablegen -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines the target-independent interfaces which should be
// implemented by each target which is using a TableGen based code generator.
//
//===----------------------------------------------------------------------===//

// Include all information about LLVM intrinsics.
include "llvm/IR/Intrinsics.td"

//===----------------------------------------------------------------------===//
// Register file description - These classes are used to fill in the target
// description classes.

class RegisterClass; // Forward def

// SubRegIndex - Use instances of SubRegIndex to identify subregisters.
class SubRegIndex<int size, int offset = 0> {
  string Namespace = "";

  // Size - Size (in bits) of the sub-registers represented by this index.
  int Size = size;

  // Offset - Offset of the first bit that is part of this sub-register index.
  // Set it to -1 if the same index is used to represent sub-registers that can
  // be at different offsets (for example when using an index to access an
  // element in a register tuple).
  int Offset = offset;

  // ComposedOf - A list of two SubRegIndex instances, [A, B].
  // This indicates that this SubRegIndex is the result of composing A and B.
  // See ComposedSubRegIndex.
  list<SubRegIndex> ComposedOf = [];

  // CoveringSubRegIndices - A list of two or more sub-register indexes that
  // cover this sub-register.
  //
  // This field should normally be left blank as TableGen can infer it.
  //
  // TableGen automatically detects sub-registers that straddle the registers
  // in the SubRegs field of a Register definition. For example:
  //
  //   Q0    = dsub_0 -> D0, dsub_1 -> D1
  //   Q1    = dsub_0 -> D2, dsub_1 -> D3
  //   D1_D2 = dsub_0 -> D1, dsub_1 -> D2
  //   QQ0   = qsub_0 -> Q0, qsub_1 -> Q1
  //
  // TableGen will infer that D1_D2 is a sub-register of QQ0. It will be given
  // the synthetic index dsub_1_dsub_2 unless some SubRegIndex is defined with
  // CoveringSubRegIndices = [dsub_1, dsub_2].
  list<SubRegIndex> CoveringSubRegIndices = [];
}
上面的代码来自一个.td 文件。好像有td文件对应的解释器
Panda_熊猫 2014-02-18
  • 打赏
  • 举报
回复
引用 2 楼 mougaidong 的回复:
问:是什么语法? 答:是错误的语法。
求正确写法啊,我是copy的一段代码,可能不完整把。 求指教。求多码字。
Panda_熊猫 2014-02-18
  • 打赏
  • 举报
回复
引用 1 楼 u010027950 的回复:
类模版知识啊 见下面链接 http://www.cnblogs.com/gaojun/archive/2010/09/10/1823354.html
没有template关键字,好像不是模板
Panda_熊猫 2014-02-18
  • 打赏
  • 举报
回复
是泛型 还是模板?
turing-complete 2014-02-18
  • 打赏
  • 举报
回复
问:是什么语法? 答:是错误的语法。
  • 打赏
  • 举报
回复
类模版知识啊 见下面链接 http://www.cnblogs.com/gaojun/archive/2010/09/10/1823354.html

64,681

社区成员

发帖
与我相关
我的任务
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++ 技术论坛(原bbs)
社区管理员
  • C++ 语言社区
  • encoderlee
  • paschen
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
  1. 请不要发布与C++技术无关的贴子
  2. 请不要发布与技术无关的招聘、广告的帖子
  3. 请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下

试试用AI创作助手写篇文章吧