38 #include "arch/gpu_types.hh"
41 #include "config/the_gpu_isa.hh"
42 #include "debug/BRIG.hh"
43 #include "debug/HSAILObject.hh"
53 :
HsaCode(name_str), private_size(-1), readonly_size(-1)
69 fatal(
"unexpected directive kind %d inside kernel/function init\n",
73 DPRINTF(HSAILObject,
"Initializing code, first code block entry is: %d\n",
94 int funcarg_size_scope = 0;
99 while (entryPtr < endPtr) {
100 switch (entryPtr->
kind) {
106 DPRINTF(HSAILObject,
"Initializing code, directive is "
107 "kind_variable, symbol is: %s\n",
115 funcarg_size_scope += se->size;
125 DPRINTF(HSAILObject,
"Initializing code, directive is "
126 "kind_label, label is: %s \n",
135 DPRINTF(HSAILObject,
"Initializing code, directive "
142 DPRINTF(HSAILObject,
"Initializing code, directive is "
149 DPRINTF(HSAILObject,
"Initializing code, directive is "
150 "kind_arg_block_start\n");
153 funcarg_size_scope = 0;
159 DPRINTF(HSAILObject,
"Initializing code, directive is "
160 "kind_arg_block_end\n");
168 DPRINTF(HSAILObject,
"Initializing code, dircetive is "
182 DPRINTF(HSAILObject,
"Initializing code, processing inst "
183 "byte addr #%d idx %d: OPCODE=%d\n", inst_addr,
184 inst_idx, instPtr->
opcode);
189 _insts.push_back(raw_inst);
190 instructions.push_back(iptr);
196 warn(
"unexpected operand entry in code segment\n");
200 fatal(
"unexpected directive kind %d inside kernel scope\n",
221 :
HsaCode(name_str), private_size(-1), readonly_size(-1)
223 init(code_dir, obj, objStorageMap);
234 fatal(
"Attempt to redefine existing label %s\n", lbl_name);
237 lbl.
define(lbl_name, inst_index);
238 DPRINTF(HSAILObject,
"label %s = %d\n", lbl_name, inst_index);
282 fatal(
"unhandled symbol data type %d", t);
297 size *= (((uint64_t)sym->
dim.
hi) << 32 | (uint64_t)sym->
dim.
lo);
308 DPRINTF(HSAILObject,
"Adding %s SYMBOL %s size %d offset 0x%x, init: %d\n",
323 if (it->name == name) {
360 : outerScopeMap(outerScope)
const_iterator end() const
const_iterator insert(const AddrRange &r, const V &d)
int getSize(Brig::BrigSegment segment)
BrigDataOffsetString32_t name
int getBrigDataTypeBytes(BrigType16_t t)
Defines classes encapsulating HSAIL instruction operands.
const std::string & name()
Label * refLabel(const Brig::BrigDirectiveLabel *lbl, const BrigObject *obj)
void instAddr(int inst_addr)
StorageElement * addSymbol(const Brig::BrigDirectiveVariable *sym, const BrigObject *obj)
BrigOperandOffset32_t init
void checkName(std::string &_name)
DirVarToSE_map elements_by_brigptr
void setPrivateSize(int32_t _private_size)
StorageElement * findSymbol(Brig::BrigSegment segment, std::string name)
static unsigned maxRegIdx
Brig::BrigSegment segment
T roundUp(const T &val, const U &align)
StorageSpace * space[NumSegments]
StorageElement * addSymbol(const Brig::BrigDirectiveVariable *sym, const BrigObject *obj)
void define(std::string &_name, int _value)
static unsigned maxRegIdx
void resetOffset(Brig::BrigSegment segment)
static void assignImmediatePostDominators(const std::vector< GPUStaticInst * > &instructions)
Compute immediate post-dominator instruction for kernel instructions.
The AddrRange class encapsulates an address range, and supports a number of tests to check if two ran...
const char * getString(int offs) const
StorageElement * findSymbol(std::string name)
StorageMap(StorageMap *outerScope=nullptr)
const Brig::BrigBase * getCodeSectionEntry(int offs) const
std::list< StorageElement * > elements
const_iterator find(const AddrRange &r) const
TheGpuISA::Decoder decoder
AddrRangeMap< StorageElement * > elements_by_addr
static unsigned maxRegIdx
void init(const Brig::BrigDirectiveExecutable *code_dir, const BrigObject *obj, StorageMap *objStorageMap)
std::map< std::string, Label > map
BrigCodeOffset32_t nextModuleEntry
BrigDataOffsetString32_t name
HsailCode(const std::string &name_str, const Brig::BrigDirectiveExecutable *code_dir, const BrigObject *obj, StorageMap *objStorageMap)
StorageMap * outerScopeMap
const char * segmentNames[]
BrigCodeOffset32_t firstCodeBlockEntry
std::vector< TheGpuISA::RawMachInst > _insts
void addLabel(const Brig::BrigDirectiveLabel *lbl, int inst_index, const BrigObject *obj)