Commit 9d7fc96f authored by Alyssa Rosenzweig's avatar Alyssa Rosenzweig 💜

Merge branch 'wip/meson+cleanup' into 'disasm-midgard'

Cleanup

See merge request !2
parents 9297ba3f 280f2b92
# TODO (for all of these): Is this the style we want?
[meson.build]
indent_style = space
indent_size = 4
[Source/BifrostDisasm.cpp]
indent_style = tab
indent_size = 8
#include "Disasm.h"
#include <Disasm.h>
#include <stdio.h>
#include <inttypes.h>
#include <sstream>
......@@ -108,8 +108,9 @@ static unsigned GetRegToWrite(RegWriteUnit unit, Regs regs)
return regs.reg2;
case RegWrite3:
return regs.reg3;
case RegWriteNone:
default: /* RegWriteNone */
assert(0);
return 0;
}
}
......@@ -125,19 +126,19 @@ static void DumpRegs(Regs srcs)
}
if (ctrl.readReg1)
printf("port 1: R%d ", srcs.reg1);
printf("port 1: R%" PRId64 " ", srcs.reg1);
if (ctrl.FMAWriteUnit == RegWrite2)
printf("port 2: R%d (write FMA) ", srcs.reg2);
printf("port 2: R%" PRId64 " (write FMA) ", srcs.reg2);
else if (ctrl.ADDWriteUnit == RegWrite2)
printf("port 2: R%d (write ADD) ", srcs.reg2);
printf("port 2: R%" PRId64 " (write ADD) ", srcs.reg2);
if (ctrl.FMAWriteUnit == RegWrite3)
printf("port 3: R%d (write FMA) ", srcs.reg3);
printf("port 3: R%" PRId64 " (write FMA) ", srcs.reg3);
else if (ctrl.ADDWriteUnit == RegWrite3)
printf("port 3: R%d (write ADD) ", srcs.reg3);
printf("port 3: R%" PRId64 " (write ADD) ", srcs.reg3);
else if (ctrl.readReg3)
printf("port 3: R%d (read) ", srcs.reg3);
printf("port 3: R%" PRId64 " (read) ", srcs.reg3);
if (srcs.uniformConst) {
if (srcs.uniformConst & 0x80) {
......@@ -184,8 +185,8 @@ static void DumpSrc(unsigned src, Regs srcs, uint64_t *consts, bool isFMA)
printf("R%d", reg);
break;
}
case 1: printf("R%d", srcs.reg1); break;
case 2: printf("R%d", srcs.reg3); break;
case 1: printf("R%" PRId64, srcs.reg1); break;
case 2: printf("R%" PRId64, srcs.reg3); break;
case 3:
if (isFMA)
printf("0");
......@@ -349,7 +350,7 @@ static const FMAOpInfo FMAOpInfos[] = {
// and x1 is a floating point value in a predetermined range where the
// value 1 is within the range and not at one extremity of the range (e.g.
// choose a range where 1 is towards middle of range)."
//
//
// This computes x1.
{ 0xe0345, "LOG_FREXPM", FMAOneSrc },
{ 0xe0365, "FRCP_TABLE", FMAOneSrc },
......@@ -380,7 +381,7 @@ static const FMAOpInfo FMAOpInfos[] = {
static FMAOpInfo findFMAOpInfo(unsigned op)
{
for (int i = 0; i < ARRAY_SIZE(FMAOpInfos); i++) {
for (unsigned i = 0; i < ARRAY_SIZE(FMAOpInfos); i++) {
unsigned opCmp;
switch (FMAOpInfos[i].srcType) {
case FMAOneSrc:
......@@ -594,7 +595,7 @@ static const ADDOpInfo ADDOpInfos[] = {
// and x1 is a floating point value in a predetermined range where the
// value 1 is within the range and not at one extremity of the range (e.g.
// choose a range where 1 is towards middle of range)."
//
//
// This computes s.
{ 0x07bc5, "FLOG_FREXPE", ADDOneSrc },
{ 0x07d45, "CEIL", ADDOneSrc },
......@@ -656,7 +657,7 @@ static const ADDOpInfo ADDOpInfos[] = {
static ADDOpInfo findADDOpInfo(unsigned op)
{
for (int i = 0; i < ARRAY_SIZE(ADDOpInfos); i++) {
for (unsigned i = 0; i < ARRAY_SIZE(ADDOpInfos); i++) {
unsigned opCmp;
switch (ADDOpInfos[i].srcType) {
case ADDOneSrc:
......@@ -897,7 +898,7 @@ static void DumpADD(uint64_t word, Regs regs, Regs nextRegs, uint64_t *consts, u
printf(", ");
DumpSrc(ADD.src0, regs, consts, false);
break;
}
}
case ADDTwoSrc:
DumpSrc(ADD.src0, regs, consts, false);
printf(", ");
......@@ -957,7 +958,7 @@ struct AluInstr {
void DumpInstr(const AluInstr &instr, Regs nextRegs, uint64_t *consts, unsigned dataReg)
{
printf("# regs: %016" PRIx32 "\n", instr.regBits);
printf("# regs: %016" PRIx64 "\n", instr.regBits);
Regs regs;
memcpy((char *) &regs, (char *) &instr.regBits, sizeof(regs));
DumpRegs(regs);
......@@ -980,7 +981,7 @@ struct Header {
void DumpHeader(Header header)
{
if (header.clauseType != 0) {
printf("id(%d)", header.scoreboardIndex);
printf("id(%" PRId64 "u)", header.scoreboardIndex);
if (header.scoreboardDeps != 0) {
printf(", next-wait(");
bool first = true;
......@@ -998,8 +999,8 @@ void DumpHeader(Header header)
printf("\n");
}
printf("# clause type %d, next clause type %d\n",
header.clauseType, header.nextClauseType);
printf("# clause type %" PRId64 ", next clause type %" PRId64 "\n",
header.clauseType, header.nextClauseType);
}
void DumpClause(uint32_t *words, unsigned *size)
......@@ -1198,9 +1199,9 @@ void DumpClause(uint32_t *words, unsigned *size)
}
printf("}\n");
for (int i = 0; i < numConsts; i++) {
printf("# const%d: %08x\n", 2 * i, consts[i] & 0xffffffff);
printf("# const%d: %08x\n", 2 * i + 1, consts[i] >> 32);
for (unsigned i = 0; i < numConsts; i++) {
printf("# const%d: %08lx\n", 2 * i, consts[i] & 0xffffffff);
printf("# const%d: %08" PRIx64 "\n", 2 * i + 1, consts[i] >> 32);
}
}
......
......@@ -28,7 +28,6 @@ bool ReadFile(std::vector<uint8_t> *fileData, std::string filename)
fclose(fp);
return true;
err:
if (fp) {
fclose(fp);
}
......@@ -37,7 +36,7 @@ err:
void PrintFile(std::vector<uint8_t> *fileData, size_t offset = 0, size_t realpos = 0)
{
printf("file size is 0x%08llx\n", fileData->size());
printf("file size is 0x%08zx\n", fileData->size());
uint32_t *data = reinterpret_cast<uint32_t*>(fileData->data() + offset);
size_t size = fileData->size() / 4;
for (size_t i = 0; i < size; i++)
......@@ -47,7 +46,7 @@ void PrintFile(std::vector<uint8_t> *fileData, size_t offset = 0, size_t realpos
{
return (uint8_t)(word >> off);
};
printf("%s0x%08x :0x%08x: %c%c%c%c\n",
printf("%s0x%08zx :0x%08x: %c%c%c%c\n",
((realpos - offset) / 4 == i) ? "->" : "",
offset + i * 4,
word,
......@@ -183,7 +182,7 @@ bool ParseSingleBlock(unsigned indent, uint8_t* blockBlob, uint32_t cookie, uint
assert(*reinterpret_cast<uint32_t*>(blockBlob) == COOKIE("RLOC"));
PrintBlock(indent + 1, &blockBlob);
}
// Finally, 8 more bytes
Block_SYMB_pt2 *pt2 = reinterpret_cast<Block_SYMB_pt2*>(blockBlob);
iprintf(indent + 1, "unk4 = 0x%08x\n", pt2->unk4);
......
......@@ -8,5 +8,6 @@ srcs = [
executable(
'disasm',
srcs,
include_directories: inc,
install: true,
)
This diff is collapsed.
......@@ -2,14 +2,14 @@
* Ben Brewer (ben.brewer@codethink.co.uk)
*
* Copyright (c) 2013 Codethink (http://www.codethink.co.uk)
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
......
......@@ -3,14 +3,14 @@
*
* Copyright (c) 2013
* Codethink (http://www.codethink.co.uk)
*
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
......
......@@ -125,7 +125,7 @@ __attribute__((__packed__))
{
bool abs : 1;
bool negate : 1;
/* replicate lower half if dest = half, or low/high half selection if
* dest = full
*/
......@@ -319,7 +319,7 @@ __attribute__((__packed__))
unsigned offset_unknown9 : 1;
unsigned unknownB : 3;
/* Texture bias or LOD, depending on whether it is executed in a
* fragment/vertex shader respectively. Compute as int(2^8 * biasf).
*
......
install_headers(
[
'Disasm.h',
],
subdir : 'panfrost',
)
......@@ -14,4 +14,7 @@ if get_option('cpp_std') != 'c++14'
error('This project requires cpp_std to be in c++14 mode')
endif
inc = include_directories('include')
subdir('Source')
subdir('include')
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment