| 1 |
/*========================== begin_copyright_notice ============================ |
| 2 |
|
| 3 |
Copyright (C) 2018-2021 Intel Corporation |
| 4 |
|
| 5 |
SPDX-License-Identifier: MIT |
| 6 |
|
| 7 |
============================= end_copyright_notice ===========================*/ |
| 8 |
|
| 9 |
#ifndef _IGA_BACKEND_GED_GEDBITPROCESSOR_HPP_ |
| 10 |
#define _IGA_BACKEND_GED_GEDBITPROCESSOR_HPP_ |
| 11 |
|
| 12 |
#include "../../IR/Instruction.hpp" |
| 13 |
#include "../../IR/Kernel.hpp" |
| 14 |
#include "../../Models/Models.hpp" |
| 15 |
#include "../BitProcessor.hpp" |
| 16 |
|
| 17 |
namespace iga { |
| 18 |
// Stuff that's common to both the encoder and decoder for GED |
| 19 |
// |
| 20 |
// Methods in this class have acecss to: |
| 21 |
// - model information (m_model) |
| 22 |
// - the parent bit processor (thus we can raise errors and warnings) |
| 23 |
// |
| 24 |
class GEDBitProcessor : public BitProcessor { |
| 25 |
protected: |
| 26 |
const Model &m_model; |
| 27 |
|
| 28 |
Platform platform() const { return m_model.platform; } |
| 29 |
|
| 30 |
public: |
| 31 |
GEDBitProcessor(const Model &model, ErrorHandler &errHandler); |
| 32 |
|
| 33 |
// GEN8-9 CSR (context save and restore) usually via mov of |
| 34 |
// "acc3-9" (mme1-7) need Align16 and |
| 35 |
// specific muxes to distinguish the acc. |
| 36 |
// NOTE: acc2 is mme0, but it encodes Align1 and doesn't need the |
| 37 |
// workaround code for CSR |
| 38 |
// |
| 39 |
// These both check the platform too, so no need to also call |
| 40 |
// isAlign16MathMacroRegisterCsrPlatform |
| 41 |
bool isAlign16MathMacroRegisterCsrOperand(Operand::Kind opKind, RegName reg, |
| 42 |
uint16_t regNum) const; |
| 43 |
bool isAlign16MathMacroRegisterCsrOperand(const Operand &op) const { |
| 44 |
return isAlign16MathMacroRegisterCsrOperand( |
| 45 |
op.getKind(), op.getDirRegName(), op.getDirRegRef().regNum); |
| 46 |
} |
| 47 |
bool isAlign16MathMacroRegisterCsrPlatform() const; |
| 48 |
|
| 49 |
// TODO: some functionality in Model that is shared by |
| 50 |
// ged::Decoder and ged::Encoder might make more sense in this class |
| 51 |
// now that it fits as a common place for shared functionality. |
| 52 |
// |
| 53 |
// A good litmus test is whether that functionality is used by some |
| 54 |
// other third party (keep it in Model in that case). |
| 55 |
}; // GEDBitProcessor |
| 56 |
} // namespace iga |
| 57 |
|
| 58 |
#endif |