Checking of assembly input for operand type correctness.

This commit is contained in:
cdkersey
2015-09-29 13:23:57 -06:00
parent 7a2ce3ee37
commit 4840bf3ebd
4 changed files with 45 additions and 4 deletions

View File

@@ -1,3 +1,6 @@
#ifndef HARPTOOL_ASM_TOKENS
#define HARPTOOL_ASM_TOKENS
namespace HarpTools {
enum AsmTokens {
ASM_T_DIR_DEF = 1, ASM_T_DIR_PERM, ASM_T_DIR_BYTE, ASM_T_DIR_WORD,
@@ -9,3 +12,5 @@ namespace HarpTools {
ASM_T_REG_FP, ASM_T_LIT, ASM_T_SYM, ASM_T_PEXP
};
};
#endif

View File

@@ -12,7 +12,9 @@
#include "types.h"
#include "archdef.h"
#include "instruction.h"
#include "enc.h"
#include "asm-tokens.h"
namespace Harp {
class Decoder;
@@ -174,6 +176,10 @@ namespace Harp {
virtual Obj *read(std::istream &input);
private:
Size wordSize, nRegs;
// Operand type sequences indexed by argument class
enum ArgType {AT_END, AT_REG, AT_PREG, AT_LIT};
static ArgType operandtype_table[][4]; // ArgClass -> ArgType[arg_idx]
};
class HOFReader : public ObjReader {