summaryrefslogtreecommitdiff
path: root/backend
diff options
context:
space:
mode:
authorLuo Xionghu <xionghu.luo@intel.com>2016-05-06 00:11:51 +0800
committerYang Rong <rong.r.yang@intel.com>2016-05-23 18:07:31 +0800
commitf71a8eab8e8c663c47a29b8b1a548675bf5c4075 (patch)
treec51071d6f0c8e0541cc9245e901c778dcd4c5431 /backend
parent2a1998145fce8fb6f5b82841db446056b6bb8e9a (diff)
downloadbeignet-f71a8eab8e8c663c47a29b8b1a548675bf5c4075.tar.gz
gbe/ir: initialize the InstructionBase by a straightforward way.
Signed-off-by: Luo Xionghu <xionghu.luo@intel.com> Reviewed-by: Yang Rong <rong.r.yang@intel.com>
Diffstat (limited to 'backend')
-rw-r--r--backend/src/ir/instruction.hpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/backend/src/ir/instruction.hpp b/backend/src/ir/instruction.hpp
index 9cc926dd..bbdef917 100644
--- a/backend/src/ir/instruction.hpp
+++ b/backend/src/ir/instruction.hpp
@@ -134,10 +134,10 @@ namespace ir {
{
public:
/*! Initialize the instruction from a 8 bytes stream */
- INLINE InstructionBase(const char *stream) {
- opcode = Opcode(stream[0]);
+ INLINE InstructionBase(Opcode op, const char* opaque) {
+ opcode = op;
for (uint32_t byte = 0; byte < opaqueSize; ++byte)
- opaque[byte] = stream[byte+1];
+ this->opaque[byte] = opaque[byte];
}
/*! Uninitialized instruction */
INLINE InstructionBase(void) {}
@@ -155,12 +155,12 @@ namespace ir {
{
public:
/*! Initialize the instruction from a 8 bytes stream */
- INLINE Instruction(const char *stream) : InstructionBase(stream) {
+ INLINE Instruction(const char *stream) : InstructionBase(Opcode(stream[0]), &stream[1]) {
parent = NULL;
}
/*! Copy the private fields and give it the same parent */
INLINE Instruction(const Instruction &other) :
- InstructionBase(reinterpret_cast<const char*>(&other.opcode)) {
+ InstructionBase(other.opcode, other.opaque) {
parent = other.parent;
}