forked from xcore/tool_axe
-
Notifications
You must be signed in to change notification settings - Fork 1
/
InstructionProperties.h
56 lines (50 loc) · 1.52 KB
/
InstructionProperties.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// Copyright (c) 2012, Richard Osborne, All rights reserved
// This software is freely distributable under a derivative of the
// University of Illinois/NCSA Open Source License posted in
// LICENSE.txt and at <http://github.xcore.com/>
#ifndef _InstructionProperties_h_
#define _InstructionProperties_h_
#include "Register.h"
namespace OperandProperties {
enum OpType {
in,
out,
inout,
imm
};
}
struct InstructionProperties {
enum Flags {
MAY_BRANCH = 1 << 0,
MAY_YIELD = 1 << 1,
MAY_DESCHEDULE = 1 << 2,
MAY_END_TRACE = 1 << 3,
MEM_CHECK_OPT_ENABLED = 1 << 4
};
const char *function;
OperandProperties::OpType *ops;
Register::Reg *implicitOps;
unsigned char size;
unsigned char numOperands;
unsigned char numImplicitOperands;
unsigned char flags;
bool mayBranch() const { return flags & MAY_BRANCH; }
bool mayYield() const { return flags & MAY_YIELD; }
bool mayDeschedule() const { return flags & MAY_DESCHEDULE; }
bool mayEndTrace() const { return flags & MAY_END_TRACE; }
bool memCheckHoistingOptEnabled() const {
return flags & MEM_CHECK_OPT_ENABLED;
}
unsigned getNumOperands() const { return numOperands; }
unsigned getNumExplicitOperands() const {
return numOperands - numImplicitOperands;
}
OperandProperties::OpType getOperandType(unsigned i) const {
return ops[i];
}
Register::Reg getImplicitOperand(unsigned i) const {
return implicitOps[i];
}
};
extern InstructionProperties instructionProperties[];
#endif //_InstructionProperties_h_