gem5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
operand.hh
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012-2015 Advanced Micro Devices, Inc.
3  * All rights reserved.
4  *
5  * For use for simulation and test purposes only
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions are met:
9  *
10  * 1. Redistributions of source code must retain the above copyright notice,
11  * this list of conditions and the following disclaimer.
12  *
13  * 2. Redistributions in binary form must reproduce the above copyright notice,
14  * this list of conditions and the following disclaimer in the documentation
15  * and/or other materials provided with the distribution.
16  *
17  * 3. Neither the name of the copyright holder nor the names of its contributors
18  * may be used to endorse or promote products derived from this software
19  * without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
25  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31  * POSSIBILITY OF SUCH DAMAGE.
32  *
33  * Author: Steve Reinhardt
34  */
35 
36 #ifndef __ARCH_HSAIL_OPERAND_HH__
37 #define __ARCH_HSAIL_OPERAND_HH__
38 
45 #include <limits>
46 #include <string>
47 
48 #include "arch/hsail/Brig.h"
49 #include "base/trace.hh"
50 #include "base/types.hh"
51 #include "debug/GPUReg.hh"
52 #include "enums/RegisterType.hh"
56 #include "gpu-compute/shader.hh"
58 #include "gpu-compute/wavefront.hh"
59 
60 class Label;
61 class StorageElement;
62 
64 {
65  public:
66  Enums::RegisterType registerType;
67  uint32_t regOperandSize;
68  BaseOperand() { registerType = Enums::RT_NONE; regOperandSize = 0; }
69  bool isVectorRegister() { return registerType == Enums::RT_VECTOR; }
70  bool isScalarRegister() { return registerType == Enums::RT_SCALAR; }
71  bool isCondRegister() { return registerType == Enums::RT_CONDITION; }
72  unsigned int regIndex() { return 0; }
73  uint32_t opSize() { return regOperandSize; }
74  virtual ~BaseOperand() { }
75 };
76 
78 {
79  public:
83 
85  Brig::BrigRegisterKind _regKind)
86  : kind(_kind), regKind(_regKind)
87  {
88  }
89 
91  : kind(_kind), type(_type)
92  {
93  }
94 
96  type(Brig::BRIG_TYPE_NONE)
97  {
98  }
99 };
100 
101 BrigRegOperandInfo findRegDataType(unsigned opOffset, const BrigObject *obj);
102 
104 {
105  public:
106  unsigned regIdx;
108 
109  bool init(unsigned opOffset, const BrigObject *obj,
110  unsigned &maxRegIdx, char _regFileChar);
111 
112  bool init_from_vect(unsigned opOffset, const BrigObject *obj, int at,
113  unsigned &maxRegIdx, char _regFileChar);
114 
115  void initWithStrOffset(unsigned strOffset, const BrigObject *obj,
116  unsigned &maxRegIdx, char _regFileChar);
117  unsigned int regIndex() { return regIdx; }
118 };
119 
121 {
122  public:
123  static unsigned maxRegIdx;
124 
125  bool
126  init(unsigned opOffset, const BrigObject *obj)
127  {
128  regOperandSize = sizeof(uint32_t);
129  registerType = Enums::RT_VECTOR;
130 
131  return BaseRegOperand::init(opOffset, obj, maxRegIdx, 's');
132  }
133 
134  bool
135  init_from_vect(unsigned opOffset, const BrigObject *obj, int at)
136  {
137  regOperandSize = sizeof(uint32_t);
138  registerType = Enums::RT_VECTOR;
139 
140  return BaseRegOperand::init_from_vect(opOffset, obj, at, maxRegIdx,
141  's');
142  }
143 
144  void
145  initWithStrOffset(unsigned strOffset, const BrigObject *obj)
146  {
147  regOperandSize = sizeof(uint32_t);
148  registerType = Enums::RT_VECTOR;
149 
150  return BaseRegOperand::initWithStrOffset(strOffset, obj, maxRegIdx,
151  's');
152  }
153 
154  template<typename OperandType>
155  OperandType
156  get(Wavefront *w, int lane)
157  {
158  assert(sizeof(OperandType) <= sizeof(uint32_t));
159  assert(regIdx < w->maxSpVgprs);
160  // if OperandType is smaller than 32-bit, we truncate the value
161  OperandType ret;
162  uint32_t vgprIdx;
163 
164  switch (sizeof(OperandType)) {
165  case 1: // 1 byte operand
166  vgprIdx = w->remap(regIdx, 1, 1);
167  ret = (w->computeUnit->vrf[w->simdId]->
168  read<uint32_t>(vgprIdx, lane)) & 0xff;
169  break;
170  case 2: // 2 byte operand
171  vgprIdx = w->remap(regIdx, 2, 1);
172  ret = (w->computeUnit->vrf[w->simdId]->
173  read<uint32_t>(vgprIdx, lane)) & 0xffff;
174  break;
175  case 4: // 4 byte operand
176  vgprIdx = w->remap(regIdx,sizeof(OperandType), 1);
177  ret = w->computeUnit->vrf[w->simdId]->
178  read<OperandType>(vgprIdx, lane);
179  break;
180  default:
181  panic("Bad OperandType\n");
182  break;
183  }
184 
185  return (OperandType)ret;
186  }
187 
188  // special get method for compatibility with LabelOperand
189  uint32_t
190  getTarget(Wavefront *w, int lane)
191  {
192  return get<uint32_t>(w, lane);
193  }
194 
195  template<typename OperandType>
196  void set(Wavefront *w, int lane, OperandType &val);
197  std::string disassemble();
198 };
199 
200 template<typename OperandType>
201 void
202 SRegOperand::set(Wavefront *w, int lane, OperandType &val)
203 {
204  DPRINTF(GPUReg, "CU%d, WF[%d][%d], lane %d: $s%d <- %d\n",
205  w->computeUnit->cu_id, w->simdId, w->wfSlotId, lane, regIdx, val);
206 
207  assert(sizeof(OperandType) == sizeof(uint32_t));
208  assert(regIdx < w->maxSpVgprs);
209  uint32_t vgprIdx = w->remap(regIdx, sizeof(OperandType), 1);
210  w->computeUnit->vrf[w->simdId]->write<OperandType>(vgprIdx,val,lane);
211 }
212 
213 template<>
214 inline void
215 SRegOperand::set(Wavefront *w, int lane, uint64_t &val)
216 {
217  DPRINTF(GPUReg, "CU%d, WF[%d][%d], lane %d: $s%d <- %d\n",
218  w->computeUnit->cu_id, w->simdId, w->wfSlotId, lane, regIdx, val);
219 
220  assert(regIdx < w->maxSpVgprs);
221  uint32_t vgprIdx = w->remap(regIdx, sizeof(uint32_t), 1);
222  w->computeUnit->vrf[w->simdId]->write<uint32_t>(vgprIdx, val, lane);
223 }
224 
226 {
227  public:
228  static unsigned maxRegIdx;
229 
230  bool
231  init(unsigned opOffset, const BrigObject *obj)
232  {
233  regOperandSize = sizeof(uint64_t);
234  registerType = Enums::RT_VECTOR;
235 
236  return BaseRegOperand::init(opOffset, obj, maxRegIdx, 'd');
237  }
238 
239  bool
240  init_from_vect(unsigned opOffset, const BrigObject *obj, int at)
241  {
242  regOperandSize = sizeof(uint64_t);
243  registerType = Enums::RT_VECTOR;
244 
245  return BaseRegOperand::init_from_vect(opOffset, obj, at, maxRegIdx,
246  'd');
247  }
248 
249  void
250  initWithStrOffset(unsigned strOffset, const BrigObject *obj)
251  {
252  regOperandSize = sizeof(uint64_t);
253  registerType = Enums::RT_VECTOR;
254 
255  return BaseRegOperand::initWithStrOffset(strOffset, obj, maxRegIdx,
256  'd');
257  }
258 
259  template<typename OperandType>
260  OperandType
261  get(Wavefront *w, int lane)
262  {
263  assert(sizeof(OperandType) <= sizeof(uint64_t));
264  // TODO: this check is valid only for HSAIL
265  assert(regIdx < w->maxDpVgprs);
266  uint32_t vgprIdx = w->remap(regIdx, sizeof(OperandType), 1);
267 
268  return w->computeUnit->vrf[w->simdId]->read<OperandType>(vgprIdx,lane);
269  }
270 
271  template<typename OperandType>
272  void
273  set(Wavefront *w, int lane, OperandType &val)
274  {
275  DPRINTF(GPUReg, "CU%d, WF[%d][%d], lane %d: $d%d <- %d\n",
276  w->computeUnit->cu_id, w->simdId, w->wfSlotId, lane, regIdx,
277  val);
278 
279  assert(sizeof(OperandType) <= sizeof(uint64_t));
280  // TODO: this check is valid only for HSAIL
281  assert(regIdx < w->maxDpVgprs);
282  uint32_t vgprIdx = w->remap(regIdx, sizeof(OperandType), 1);
283  w->computeUnit->vrf[w->simdId]->write<OperandType>(vgprIdx,val,lane);
284  }
285 
286  std::string disassemble();
287 };
288 
290 {
291  public:
292  static unsigned maxRegIdx;
293 
294  bool
295  init(unsigned opOffset, const BrigObject *obj)
296  {
297  regOperandSize = sizeof(uint8_t);
298  registerType = Enums::RT_CONDITION;
299 
300  return BaseRegOperand::init(opOffset, obj, maxRegIdx, 'c');
301  }
302 
303  bool
304  init_from_vect(unsigned opOffset, const BrigObject *obj, int at)
305  {
306  regOperandSize = sizeof(uint8_t);
307  registerType = Enums::RT_CONDITION;
308 
309  return BaseRegOperand::init_from_vect(opOffset, obj, at, maxRegIdx,
310  'c');
311  }
312 
313  void
314  initWithStrOffset(unsigned strOffset, const BrigObject *obj)
315  {
316  regOperandSize = sizeof(uint8_t);
317  registerType = Enums::RT_CONDITION;
318 
319  return BaseRegOperand::initWithStrOffset(strOffset, obj, maxRegIdx,
320  'c');
321  }
322 
323  template<typename OperandType>
324  OperandType
325  get(Wavefront *w, int lane)
326  {
327  assert(regIdx < w->condRegState->numRegs());
328 
329  return w->condRegState->read<OperandType>((int)regIdx, lane);
330  }
331 
332  template<typename OperandType>
333  void
334  set(Wavefront *w, int lane, OperandType &val)
335  {
336  DPRINTF(GPUReg, "CU%d, WF[%d][%d], lane %d: $c%d <- %d\n",
337  w->computeUnit->cu_id, w->simdId, w->wfSlotId, lane, regIdx,
338  val);
339 
340  assert(regIdx < w->condRegState->numRegs());
341  w->condRegState->write<OperandType>(regIdx,lane,val);
342  }
343 
344  std::string disassemble();
345 };
346 
347 template<typename T>
348 class ImmOperand : public BaseOperand
349 {
350  private:
351  uint16_t kind;
352  public:
353  T bits;
354 
355  bool init(unsigned opOffset, const BrigObject *obj);
356  bool init_from_vect(unsigned opOffset, const BrigObject *obj, int at);
357  std::string disassemble();
358 
359  template<typename OperandType>
360  OperandType
361  get(Wavefront *w)
362  {
363  assert(sizeof(OperandType) <= sizeof(T));
364  panic_if(w == nullptr, "WF pointer needs to be set");
365 
366  switch (kind) {
367  // immediate operand is WF size
369  return (OperandType)w->computeUnit->wfSize();
370  break;
371 
372  default:
373  return *(OperandType*)&bits;
374  break;
375  }
376  }
377 
378  // This version of get() takes a WF* and a lane id for
379  // compatibility with the register-based get() methods.
380  template<typename OperandType>
381  OperandType
382  get(Wavefront *w, int lane)
383  {
384  return get<OperandType>(w);
385  }
386 };
387 
388 template<typename T>
389 bool
390 ImmOperand<T>::init(unsigned opOffset, const BrigObject *obj)
391 {
392  const Brig::BrigOperand *brigOp = obj->getOperand(opOffset);
393 
394  switch (brigOp->kind) {
395  // this is immediate operand
397  {
398  DPRINTF(GPUReg, "sizeof(T): %lu, byteCount: %d\n", sizeof(T),
399  brigOp->byteCount);
400 
401  auto cbptr = (Brig::BrigOperandConstantBytes*)brigOp;
402 
403  bits = *((T*)(obj->getData(cbptr->bytes + 4)));
404  kind = brigOp->kind;
405  return true;
406  }
407  break;
408 
410  kind = brigOp->kind;
411  bits = std::numeric_limits<unsigned long long>::digits;
412  return true;
413 
414  default:
415  kind = Brig::BRIG_KIND_NONE;
416  return false;
417  }
418 }
419 
420 template <typename T>
421 bool
422 ImmOperand<T>::init_from_vect(unsigned opOffset, const BrigObject *obj, int at)
423 {
424  const Brig::BrigOperand *brigOp = obj->getOperand(opOffset);
425 
427  kind = Brig::BRIG_KIND_NONE;
428  return false;
429  }
430 
431 
432  const Brig::BrigOperandOperandList *brigVecOp =
433  (const Brig::BrigOperandOperandList *)brigOp;
434 
435  unsigned *data_offset =
436  (unsigned *)obj->getData(brigVecOp->elements + 4 * (at + 1));
437 
438  const Brig::BrigOperand *p =
439  (const Brig::BrigOperand *)obj->getOperand(*data_offset);
440 
442  kind = Brig::BRIG_KIND_NONE;
443  return false;
444  }
445 
446  return init(*data_offset, obj);
447 }
448 template<typename T>
449 std::string
451 {
452  return csprintf("0x%08x", bits);
453 }
454 
455 template<typename RegOperand, typename T>
457 {
458  private:
459  bool is_imm;
460 
461  public:
462  void setImm(const bool value) { is_imm = value; }
463 
465  RegOperand reg_op;
466 
467  RegOrImmOperand() { is_imm = false; }
468  void init(unsigned opOffset, const BrigObject *obj);
469  void init_from_vect(unsigned opOffset, const BrigObject *obj, int at);
470  std::string disassemble();
471 
472  template<typename OperandType>
473  OperandType
474  get(Wavefront *w, int lane)
475  {
476  return is_imm ? imm_op.template get<OperandType>(w) :
477  reg_op.template get<OperandType>(w, lane);
478  }
479 
480  uint32_t
482  {
483  if (!is_imm) {
484  return reg_op.opSize();
485  }
486 
487  return 0;
488  }
489 
490  bool
492  {
493  if (!is_imm) {
494  return reg_op.registerType == Enums::RT_VECTOR;
495  }
496  return false;
497  }
498 
499  bool
501  {
502  if (!is_imm) {
503  return reg_op.registerType == Enums::RT_CONDITION;
504  }
505 
506  return false;
507  }
508 
509  bool
511  {
512  if (!is_imm) {
513  return reg_op.registerType == Enums::RT_SCALAR;
514  }
515 
516  return false;
517  }
518 
519  unsigned int
521  {
522  if (!is_imm) {
523  return reg_op.regIndex();
524  }
525  return 0;
526  }
527 };
528 
529 template<typename RegOperand, typename T>
530 void
531 RegOrImmOperand<RegOperand, T>::init(unsigned opOffset, const BrigObject *obj)
532 {
533  is_imm = false;
534 
535  if (reg_op.init(opOffset, obj)) {
536  return;
537  }
538 
539  if (imm_op.init(opOffset, obj)) {
540  is_imm = true;
541  return;
542  }
543 
544  fatal("RegOrImmOperand::init(): bad operand kind %d\n",
545  obj->getOperand(opOffset)->kind);
546 }
547 
548 template<typename RegOperand, typename T>
549 void
551  const BrigObject *obj, int at)
552 {
553  if (reg_op.init_from_vect(opOffset, obj, at)) {
554  is_imm = false;
555 
556  return;
557  }
558 
559  if (imm_op.init_from_vect(opOffset, obj, at)) {
560  is_imm = true;
561 
562  return;
563  }
564 
565  fatal("RegOrImmOperand::init(): bad operand kind %d\n",
566  obj->getOperand(opOffset)->kind);
567 }
568 
569 template<typename RegOperand, typename T>
570 std::string
572 {
573  return is_imm ? imm_op.disassemble() : reg_op.disassemble();
574 }
575 
579 
581 {
582  protected:
583  // helper function for init()
584  void parseAddr(const Brig::BrigOperandAddress *op, const BrigObject *obj);
585 
586  // helper function for disassemble()
587  std::string disassemble(std::string reg_disassembly);
588  uint64_t calcUniformBase();
589 
590  public:
591  virtual void calcVector(Wavefront *w, std::vector<Addr> &addrVec) = 0;
592  virtual uint64_t calcLane(Wavefront *w, int lane=0) = 0;
593 
594  int64_t offset;
595  const char *name = nullptr;
597 };
598 
599 template<typename RegOperandType>
601 {
602  public:
603  RegOperandType reg;
604  void init(unsigned opOffset, const BrigObject *obj);
605  uint64_t calcUniform();
606  void calcVector(Wavefront *w, std::vector<Addr> &addrVec);
607  uint64_t calcLane(Wavefront *w, int lane=0);
608  uint32_t opSize() { return reg.opSize(); }
609  bool isVectorRegister() { return reg.registerType == Enums::RT_VECTOR; }
610  bool isCondRegister() { return reg.registerType == Enums::RT_CONDITION; }
611  bool isScalarRegister() { return reg.registerType == Enums::RT_SCALAR; }
612  unsigned int regIndex() { return reg.regIndex(); }
613  std::string disassemble();
614 };
615 
616 template<typename RegOperandType>
617 void
618 RegAddrOperand<RegOperandType>::init(unsigned opOffset, const BrigObject *obj)
619 {
620  using namespace Brig;
621 
622  const BrigOperand *baseOp = obj->getOperand(opOffset);
623 
624  switch (baseOp->kind) {
626  {
627  const BrigOperandAddress *op = (BrigOperandAddress*)baseOp;
628  storageElement = nullptr;
629 
630  reg.init(op->reg, obj);
631 
632  if (reg.regFileChar == 's') {
633  // if the address expression is 32b, then the hi
634  // bits of the offset must be set to 0 in the BRIG
635  assert(!op->offset.hi);
641  offset = (int32_t)(op->offset.lo);
642  reg.regOperandSize = sizeof(uint32_t);
643  registerType = Enums::RT_VECTOR;
644  }
645  else if (reg.regFileChar == 'd') {
646  offset = (int64_t)(((uint64_t)(op->offset.hi) << 32)
647  | (uint64_t)(op->offset.lo));
648  reg.regOperandSize = sizeof(uint64_t);
649  registerType = Enums::RT_VECTOR;
650  }
651  }
652  break;
653 
654  default:
655  fatal("RegAddrOperand: bad operand kind %d\n", baseOp->kind);
656  break;
657  }
658 }
659 
660 template<typename RegOperandType>
661 uint64_t
663 {
664  fatal("can't do calcUniform() on register-based address\n");
665 
666  return 0;
667 }
668 
669 template<typename RegOperandType>
670 void
672  std::vector<Addr> &addrVec)
673 {
674  Addr address = calcUniformBase();
675 
676  for (int lane = 0; lane < w->computeUnit->wfSize(); ++lane) {
677  if (w->execMask(lane)) {
678  if (reg.regFileChar == 's') {
679  addrVec[lane] = address + reg.template get<uint32_t>(w, lane);
680  } else {
681  addrVec[lane] = address + reg.template get<Addr>(w, lane);
682  }
683  }
684  }
685 }
686 
687 template<typename RegOperandType>
688 uint64_t
690 {
691  Addr address = calcUniformBase();
692 
693  return address + reg.template get<Addr>(w, lane);
694 }
695 
696 template<typename RegOperandType>
697 std::string
699 {
700  return AddrOperandBase::disassemble(reg.disassemble());
701 }
702 
705 
707 {
708  public:
709  void init(unsigned opOffset, const BrigObject *obj);
710  uint64_t calcUniform();
711  void calcVector(Wavefront *w, std::vector<Addr> &addrVec);
712  uint64_t calcLane(Wavefront *w, int lane=0);
713  std::string disassemble();
714 };
715 
716 inline uint64_t
718 {
720 }
721 
722 inline uint64_t
724 {
725  return calcUniform();
726 }
727 
728 inline void
730 {
731  uint64_t address = calcUniformBase();
732 
733  for (int lane = 0; lane < w->computeUnit->wfSize(); ++lane)
734  addrVec[lane] = address;
735 }
736 
737 class LabelOperand : public BaseOperand
738 {
739  public:
741 
742  void init(unsigned opOffset, const BrigObject *obj);
743  std::string disassemble();
744 
745  // special get method for compatibility with SRegOperand
746  uint32_t getTarget(Wavefront *w, int lane);
747 
748 };
749 
750 class ListOperand : public BaseOperand
751 {
752  public:
755 
756  int
757  getSrcOperand(int idx)
758  {
759  DPRINTF(GPUReg, "getSrcOperand, idx: %d, sz_args: %d\n", idx,
760  callArgs.size());
761 
762  return callArgs.at(idx)->offset;
763  }
764 
765  void init(unsigned opOffset, const BrigObject *obj);
766 
767  std::string disassemble();
768 
769  template<typename OperandType>
770  OperandType
771  get(Wavefront *w, int lane, int arg_idx)
772  {
773  return w->readCallArgMem<OperandType>(lane, getSrcOperand(arg_idx));
774  }
775 
776  template<typename OperandType>
777  void
778  set(Wavefront *w, int lane, OperandType val)
779  {
780  w->writeCallArgMem<OperandType>(lane, getSrcOperand(0), val);
781  DPRINTF(GPUReg, "CU%d, WF[%d][%d], lane %d: arg[%d] <- %d\n",
782  w->computeUnit->cu_id, w->simdId, w->wfSlotId, lane,
783  getSrcOperand(0), val);
784  }
785 };
786 
788 {
789  public:
790  const char *func_name;
791 
792  void init(unsigned opOffset, const BrigObject *obj);
793  std::string disassemble();
794 };
795 
796 #endif // __ARCH_HSAIL_OPERAND_HH__
bool init(unsigned opOffset, const BrigObject *obj)
Definition: operand.hh:231
#define DPRINTF(x,...)
Definition: trace.hh:212
bool isScalarRegister()
Definition: operand.hh:70
void init(unsigned opOffset, const BrigObject *obj)
Definition: operand.cc:63
uint32_t getTarget(Wavefront *w, int lane)
Definition: operand.cc:459
Bitfield< 5, 3 > reg
Definition: types.hh:89
const Brig::BrigOperand * getOperand(int offs) const
Definition: brig_object.cc:116
BaseOperand()
Definition: operand.hh:68
unsigned int regIndex()
Definition: operand.hh:72
std::string disassemble()
Definition: operand.cc:438
void init(unsigned opOffset, const BrigObject *obj)
Definition: operand.cc:422
virtual ~BaseOperand()
Definition: operand.hh:74
uint16_t byteCount
Definition: Brig.h:1179
int elementCount
Definition: operand.hh:753
#define panic(...)
Definition: misc.hh:153
uint16_t BrigKind16_t
Definition: Brig.h:102
void write(int regIdx, int threadId, T value)
std::string disassemble(std::string reg_disassembly)
Definition: operand.cc:394
BrigRegOperandInfo(Brig::BrigKind16_t _kind, Brig::BrigRegisterKind _regKind)
Definition: operand.hh:84
void init(unsigned opOffset, const BrigObject *obj)
Definition: operand.cc:116
void calcVector(Wavefront *w, std::vector< Addr > &addrVec)
Definition: operand.hh:729
RegOrImmOperand< SRegOperand, uint32_t > SRegOrImmOperand
Definition: operand.hh:576
void setImm(const bool value)
Definition: operand.hh:462
std::string disassemble()
Definition: operand.cc:195
RegAddrOperand< SRegOperand > SRegAddrOperand
Definition: operand.hh:703
StorageElement * storageElement
Definition: operand.hh:596
panic_if(!root,"Invalid expression\n")
uint64_t calcUniform()
Definition: operand.hh:662
int wfSize() const
int simdId
Definition: wavefront.hh:165
Bitfield< 23, 0 > offset
Definition: types.hh:149
bool isVectorRegister()
Definition: operand.hh:609
bool init_from_vect(unsigned opOffset, const BrigObject *obj, int at)
Definition: operand.hh:240
const char * func_name
Definition: operand.hh:790
bool isCondRegister()
Definition: operand.hh:500
class ConditionRegisterState * condRegState
Definition: wavefront.hh:175
bool isVectorRegister()
Definition: operand.hh:491
virtual uint64_t calcLane(Wavefront *w, int lane=0)=0
static unsigned maxRegIdx
Definition: operand.hh:292
int wfSlotId
Definition: wavefront.hh:162
void init(unsigned opOffset, const BrigObject *obj)
Definition: operand.hh:531
char regFileChar
Definition: operand.hh:107
std::string disassemble()
Definition: operand.cc:104
std::string disassemble()
Definition: operand.cc:201
int getSrcOperand(int idx)
Definition: operand.hh:757
Bitfield< 63 > val
Definition: misc.hh:770
const uint8_t * getData(int offs) const
Definition: brig_object.cc:110
static unsigned maxRegIdx
Definition: operand.hh:228
std::string disassemble()
Definition: operand.cc:465
bool isCondRegister()
Definition: operand.hh:610
Brig::BrigKind16_t kind
Definition: operand.hh:80
const char * name
Definition: operand.hh:595
BrigKind16_t kind
Definition: Brig.h:1180
bool init_from_vect(unsigned opOffset, const BrigObject *obj, int at)
Definition: operand.hh:422
BrigUInt64 offset
Definition: Brig.h:1465
uint32_t opSize()
Definition: operand.hh:481
virtual void calcVector(Wavefront *w, std::vector< Addr > &addrVec)=0
unsigned int regIndex()
Definition: operand.hh:612
uint32_t lo
Definition: Brig.h:1164
bool init(unsigned opOffset, const BrigObject *obj)
Definition: operand.hh:390
BrigType
Definition: Brig.h:974
void calcVector(Wavefront *w, std::vector< Addr > &addrVec)
Definition: operand.hh:671
bool init_from_vect(unsigned opOffset, const BrigObject *obj, int at)
Definition: operand.hh:304
uint32_t opSize()
Definition: operand.hh:73
std::string csprintf(const char *format, const Args &...args)
Definition: cprintf.hh:161
void init_from_vect(unsigned opOffset, const BrigObject *obj, int at)
Definition: operand.hh:550
void init(unsigned opOffset, const BrigObject *obj)
Definition: operand.hh:618
void writeCallArgMem(int lane, int addr, CType val)
Definition: wavefront.hh:316
Enums::RegisterType registerType
Definition: operand.hh:66
BrigRegOperandInfo(Brig::BrigKind16_t _kind, Brig::BrigType _type)
Definition: operand.hh:90
void init(unsigned opOffset, const BrigObject *obj)
Definition: operand.cc:444
std::vector< StorageElement * > callArgs
Definition: operand.hh:754
ComputeUnit * computeUnit
Definition: wavefront.hh:167
#define fatal(...)
Definition: misc.hh:163
Label * label
Definition: operand.hh:740
Bitfield< 14, 13 > at
uint16_t kind
Definition: operand.hh:351
std::string disassemble()
Definition: operand.cc:207
std::string disassemble()
Definition: operand.hh:450
Bitfield< 0 > w
Defines global host-dependent types: Counter, Tick, and (indirectly) {int,uint}{8,16,32,64}_t.
uint64_t Addr
Address type This will probably be moved somewhere else in the near future.
Definition: types.hh:142
void initWithStrOffset(unsigned strOffset, const BrigObject *obj)
Definition: operand.hh:314
Brig::BrigType type
Definition: operand.hh:81
uint64_t calcLane(Wavefront *w, int lane=0)
Definition: operand.hh:723
bool isScalarRegister()
Definition: operand.hh:611
BrigRegisterKind
Definition: Brig.h:795
RegAddrOperand< DRegOperand > DRegAddrOperand
Definition: operand.hh:704
RegOperandType reg
Definition: operand.hh:603
unsigned regIdx
Definition: operand.hh:106
static unsigned maxRegIdx
Definition: operand.hh:123
void parseAddr(const Brig::BrigOperandAddress *op, const BrigObject *obj)
Definition: operand.cc:313
uint64_t calcUniform()
Definition: operand.hh:717
VectorMask execMask() const
Definition: wavefront.cc:828
std::vector< VectorRegisterFile * > vrf
BrigDataOffsetOperandList32_t elements
Definition: Brig.h:1523
std::string disassemble()
Definition: operand.hh:698
uint32_t hi
Definition: Brig.h:1165
BrigRegOperandInfo findRegDataType(unsigned opOffset, const BrigObject *obj)
Definition: operand.cc:213
bool init(unsigned opOffset, const BrigObject *obj)
Definition: operand.hh:126
bool isCondRegister()
Definition: operand.hh:71
std::string disassemble()
Definition: operand.cc:133
void initWithStrOffset(unsigned strOffset, const BrigObject *obj, unsigned &maxRegIdx, char _regFileChar)
Definition: operand.cc:176
Brig::BrigRegisterKind regKind
Definition: operand.hh:82
bool init(unsigned opOffset, const BrigObject *obj, unsigned &maxRegIdx, char _regFileChar)
Definition: operand.cc:41
uint32_t regOperandSize
Definition: operand.hh:67
bool init_from_vect(unsigned opOffset, const BrigObject *obj, int at)
Definition: operand.hh:135
uint32_t opSize()
Definition: operand.hh:608
bool isScalarRegister()
Definition: operand.hh:510
void set(Wavefront *w, int lane, OperandType &val)
Definition: operand.hh:334
RegOperand reg_op
Definition: operand.hh:465
uint64_t calcUniformBase()
Definition: operand.cc:380
unsigned int regIndex()
Definition: operand.hh:520
Bitfield< 4 > op
Definition: types.hh:80
uint32_t remap(uint32_t vgprIndex, uint32_t size, uint8_t mode=0)
Definition: wavefront.cc:282
T bits(T val, int first, int last)
Extract the bitfield from position 'first' to 'last' (inclusive) from 'val' and right justify it...
Definition: bitfield.hh:67
uint32_t getTarget(Wavefront *w, int lane)
Definition: operand.hh:190
uint64_t calcLane(Wavefront *w, int lane=0)
Definition: operand.hh:689
unsigned int regIndex()
Definition: operand.hh:117
int64_t offset
Definition: operand.hh:594
bool init_from_vect(unsigned opOffset, const BrigObject *obj, int at, unsigned &maxRegIdx, char _regFileChar)
Definition: operand.cc:141
Bitfield< 0 > p
bool isVectorRegister()
Definition: operand.hh:69
void set(Wavefront *w, int lane, OperandType &val)
Definition: operand.hh:273
bool init(unsigned opOffset, const BrigObject *obj)
Definition: operand.hh:295
RegOrImmOperand< CRegOperand, bool > CRegOrImmOperand
Definition: operand.hh:578
void set(Wavefront *w, int lane, OperandType &val)
Definition: operand.hh:202
const FlagsType init
This Stat is Initialized.
Definition: info.hh:45
void initWithStrOffset(unsigned strOffset, const BrigObject *obj)
Definition: operand.hh:250
RegOrImmOperand< DRegOperand, uint64_t > DRegOrImmOperand
Definition: operand.hh:577
std::string disassemble()
Definition: operand.hh:571
void set(Wavefront *w, int lane, OperandType val)
Definition: operand.hh:778
BrigOperandOffset32_t reg
Definition: Brig.h:1464
ImmOperand< T > imm_op
Definition: operand.hh:464
void initWithStrOffset(unsigned strOffset, const BrigObject *obj)
Definition: operand.hh:145

Generated on Fri Jun 9 2017 13:03:39 for gem5 by doxygen 1.8.6