42 unsigned &maxRegIdx,
char _regFileChar)
44 regFileChar = _regFileChar;
52 regIdx = brigRegOp->
regNum;
54 DPRINTF(GPUReg,
"Operand: regNum: %d, kind: %d\n", regIdx,
57 maxRegIdx = std::max(maxRegIdx, regIdx);
67 switch (brigOp->
kind) {
79 DPRINTF(GPUReg,
"Operand Code List: # elements: %d\n",
82 for (
int i = 0;
i < elementCount; ++
i) {
83 unsigned *data_offset =
88 getCodeSectionEntry(*data_offset);
94 callArgs.push_back(se);
99 fatal(
"ListOperand: bad operand kind %d\n", brigOp->
kind);
106 std::string res_str(
"");
108 for (
auto it : callArgs) {
109 res_str +=
csprintf(
"%s ", it->name.c_str());
121 fatal(
"FunctionRefOperand: bad operand kind %d\n", baseOp->
kind);
135 DPRINTF(GPUReg,
"Operand Func-ref name: %s\n", func_name);
142 int at,
unsigned &maxRegIdx,
char _regFileChar)
144 regFileChar = _regFileChar;
154 unsigned *data_offset =
165 regIdx = brigRegOp->
regNum;
167 DPRINTF(GPUReg,
"Operand: regNum: %d, kind: %d \n", regIdx,
170 maxRegIdx = std::max(maxRegIdx, regIdx);
177 unsigned &maxRegIdx,
char _regFileChar)
181 regIdx = strtoul(name + 2, &endptr, 10);
183 if (name[0] !=
'$' || name[1] != _regFileChar) {
184 fatal(
"register operand parse error on \"%s\"\n", name);
187 maxRegIdx = std::max(maxRegIdx, regIdx);
217 switch (baseOp->
kind) {
240 int num_operands = 0;
254 if (num_bytes ==
sizeof(uint32_t)) {
256 }
else if (num_bytes ==
sizeof(uint64_t)) {
259 fatal(
"OperandList: bad operand size %d\n", num_bytes);
264 fatal(
"OperandList: bad operand kind %d\n", op_p->
kind);
307 fatal(
"AddrOperand: bad operand kind %d\n", baseOp->
kind);
329 warn(
"HSAIL implementation does not support instructions with "
330 "address calculations where the operand is not a variable\n");
375 assert(storageElement);
383 uint64_t address =
offset;
386 if (storageElement) {
387 address += storageElement->offset;
398 if (
offset || reg_disassembly !=
"") {
401 if (reg_disassembly !=
"") {
402 disasm += reg_disassembly;
428 parseAddr(addrOp, obj);
432 fatal(
"NoRegAddrOperand: bad operand kind %d\n", baseOp->
kind);
void init(unsigned opOffset, const BrigObject *obj)
uint32_t getTarget(Wavefront *w, int lane)
BrigDataOffsetCodeList32_t elements
const Brig::BrigOperand * getOperand(int offs) const
Defines classes encapsulating HSAIL instruction operands.
std::string disassemble()
const std::string & name()
void init(unsigned opOffset, const BrigObject *obj)
Label * refLabel(const Brig::BrigDirectiveLabel *lbl, const BrigObject *obj)
std::string disassemble(std::string reg_disassembly)
void init(unsigned opOffset, const BrigObject *obj)
std::string disassemble()
StorageElement * findSymbol(Brig::BrigSegment segment, std::string name)
static unsigned maxRegIdx
std::string disassemble()
std::string disassemble()
const uint8_t * getData(int offs) const
static unsigned maxRegIdx
std::string disassemble()
BrigCodeOffset32_t symbol
const char * getString(int offs) const
std::string csprintf(const char *format, const Args &...args)
void init(unsigned opOffset, const BrigObject *obj)
StorageElement * findSymbol(Brig::BrigSegment segment, uint64_t addr)
std::string disassemble()
const Brig::BrigBase * getCodeSectionEntry(int offs) const
static unsigned maxRegIdx
void parseAddr(const Brig::BrigOperandAddress *op, const BrigObject *obj)
const Brig::BrigData * getBrigBaseData(int offs) const
BrigDataOffsetOperandList32_t elements
std::string disassemble()
void initWithStrOffset(unsigned strOffset, const BrigObject *obj, unsigned &maxRegIdx, char _regFileChar)
bool init(unsigned opOffset, const BrigObject *obj, unsigned &maxRegIdx, char _regFileChar)
BrigDataOffsetString32_t name
uint64_t calcUniformBase()
BrigRegOperandInfo findRegDataType(unsigned opOffset, const BrigObject *obj)
BrigDataOffsetString32_t name
bool init_from_vect(unsigned opOffset, const BrigObject *obj, int at, unsigned &maxRegIdx, char _regFileChar)
BrigRegisterKind16_t regKind
BrigOperandOffset32_t reg