From 6c283b2f4f8398322e7a9a62ec8e131852b4e015 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy <roberto@inf.puc-rio.br> Date: Tue, 20 Aug 2002 17:03:05 -0300 Subject: new simetric format for ABC instructions, to avoid exchanging operands for `commutative' operators --- lopcodes.c | 82 ++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 39 insertions(+), 43 deletions(-) (limited to 'lopcodes.c') diff --git a/lopcodes.c b/lopcodes.c index 767c6bd5..8dd3bee3 100644 --- a/lopcodes.c +++ b/lopcodes.c @@ -1,5 +1,5 @@ /* -** $Id: lopcodes.c,v 1.19 2002/05/13 13:09:00 roberto Exp roberto $ +** $Id: lopcodes.c,v 1.20 2002/06/12 14:51:31 roberto Exp roberto $ ** extracted automatically from lopcodes.h by mkprint.lua ** DO NOT EDIT ** See Copyright Notice in lua.h @@ -39,8 +39,6 @@ const char *const luaP_opnames[] = { "EQ", "LT", "LE", - "GT", - "GE", "TEST", "CALL", "TAILCALL", @@ -56,49 +54,47 @@ const char *const luaP_opnames[] = { #endif -#define opmode(t,x,b,c,sa,k,m) (((t)<<OpModeT) | \ - ((b)<<OpModeBreg) | ((c)<<OpModeCreg) | \ +#define opmode(t,b,bk,ck,sa,k,m) (((t)<<OpModeT) | \ + ((b)<<OpModeBreg) | ((bk)<<OpModeBrk) | ((ck)<<OpModeCrk) | \ ((sa)<<OpModesetA) | ((k)<<OpModeK) | (m)) const lu_byte luaP_opmodes[NUM_OPCODES] = { -/* T _ B C sA K mode opcode */ - opmode(0,0,1,0, 1,0,iABC) /* OP_MOVE */ - ,opmode(0,0,0,0, 1,1,iABx) /* OP_LOADK */ - ,opmode(0,0,0,0, 1,0,iABC) /* OP_LOADBOOL */ - ,opmode(0,0,1,0, 1,0,iABC) /* OP_LOADNIL */ - ,opmode(0,0,0,0, 1,0,iABC) /* OP_GETUPVAL */ - ,opmode(0,0,0,0, 1,1,iABx) /* OP_GETGLOBAL */ - ,opmode(0,0,1,1, 1,0,iABC) /* OP_GETTABLE */ - ,opmode(0,0,0,0, 0,1,iABx) /* OP_SETGLOBAL */ - ,opmode(0,0,0,0, 0,0,iABC) /* OP_SETUPVAL */ - ,opmode(0,0,1,1, 0,0,iABC) /* OP_SETTABLE */ - ,opmode(0,0,0,0, 1,0,iABC) /* OP_NEWTABLE */ - ,opmode(0,0,1,1, 1,0,iABC) /* OP_SELF */ - ,opmode(0,0,1,1, 1,0,iABC) /* OP_ADD */ - ,opmode(0,0,1,1, 1,0,iABC) /* OP_SUB */ - ,opmode(0,0,1,1, 1,0,iABC) /* OP_MUL */ - ,opmode(0,0,1,1, 1,0,iABC) /* OP_DIV */ - ,opmode(0,0,1,1, 1,0,iABC) /* OP_POW */ - ,opmode(0,0,1,0, 1,0,iABC) /* OP_UNM */ - ,opmode(0,0,1,0, 1,0,iABC) /* OP_NOT */ - ,opmode(0,0,1,1, 1,0,iABC) /* OP_CONCAT */ - ,opmode(0,0,0,0, 0,0,iAsBx) /* OP_JMP */ - ,opmode(1,0,0,1, 0,0,iABC) /* OP_EQ */ - ,opmode(1,0,0,1, 0,0,iABC) /* OP_LT */ - ,opmode(1,0,0,1, 0,0,iABC) /* OP_LE */ - ,opmode(1,0,0,1, 0,0,iABC) /* OP_GT */ - ,opmode(1,0,0,1, 0,0,iABC) /* OP_GE */ - ,opmode(1,0,0,1, 1,0,iABC) /* OP_TEST */ - ,opmode(0,0,0,0, 0,0,iABC) /* OP_CALL */ - ,opmode(0,0,0,0, 0,0,iABC) /* OP_TAILCALL */ - ,opmode(0,0,0,0, 0,0,iABC) /* OP_RETURN */ - ,opmode(0,0,0,0, 0,0,iAsBx) /* OP_FORLOOP */ - ,opmode(1,0,0,0, 0,0,iABC) /* OP_TFORLOOP */ - ,opmode(0,0,0,0, 0,0,iAsBx) /* OP_TFORPREP */ - ,opmode(0,0,0,0, 0,0,iABx) /* OP_SETLIST */ - ,opmode(0,0,0,0, 0,0,iABx) /* OP_SETLISTO */ - ,opmode(0,0,0,0, 0,0,iABC) /* OP_CLOSE */ - ,opmode(0,0,0,0, 1,0,iABx) /* OP_CLOSURE */ +/* T B Bk Ck sA K mode opcode */ + opmode(0, 1, 0, 0, 1, 0, iABC) /* OP_MOVE */ + ,opmode(0, 0, 0, 0, 1, 1, iABx) /* OP_LOADK */ + ,opmode(0, 0, 0, 0, 1, 0, iABC) /* OP_LOADBOOL */ + ,opmode(0, 1, 0, 0, 1, 0, iABC) /* OP_LOADNIL */ + ,opmode(0, 0, 0, 0, 1, 0, iABC) /* OP_GETUPVAL */ + ,opmode(0, 0, 0, 0, 1, 1, iABx) /* OP_GETGLOBAL */ + ,opmode(0, 1, 0, 1, 1, 0, iABC) /* OP_GETTABLE */ + ,opmode(0, 0, 0, 0, 0, 1, iABx) /* OP_SETGLOBAL */ + ,opmode(0, 0, 0, 0, 0, 0, iABC) /* OP_SETUPVAL */ + ,opmode(0, 0, 1, 1, 0, 0, iABC) /* OP_SETTABLE */ + ,opmode(0, 0, 0, 0, 1, 0, iABC) /* OP_NEWTABLE */ + ,opmode(0, 1, 0, 1, 1, 0, iABC) /* OP_SELF */ + ,opmode(0, 0, 1, 1, 1, 0, iABC) /* OP_ADD */ + ,opmode(0, 0, 1, 1, 1, 0, iABC) /* OP_SUB */ + ,opmode(0, 0, 1, 1, 1, 0, iABC) /* OP_MUL */ + ,opmode(0, 0, 1, 1, 1, 0, iABC) /* OP_DIV */ + ,opmode(0, 0, 1, 1, 1, 0, iABC) /* OP_POW */ + ,opmode(0, 1, 0, 0, 1, 0, iABC) /* OP_UNM */ + ,opmode(0, 1, 0, 0, 1, 0, iABC) /* OP_NOT */ + ,opmode(0, 1, 0, 1, 1, 0, iABC) /* OP_CONCAT */ + ,opmode(0, 0, 0, 0, 0, 0, iAsBx) /* OP_JMP */ + ,opmode(1, 0, 1, 1, 0, 0, iABC) /* OP_EQ */ + ,opmode(1, 0, 1, 1, 0, 0, iABC) /* OP_LT */ + ,opmode(1, 0, 1, 1, 0, 0, iABC) /* OP_LE */ + ,opmode(1, 1, 0, 0, 1, 0, iABC) /* OP_TEST */ + ,opmode(0, 0, 0, 0, 0, 0, iABC) /* OP_CALL */ + ,opmode(0, 0, 0, 0, 0, 0, iABC) /* OP_TAILCALL */ + ,opmode(0, 0, 0, 0, 0, 0, iABC) /* OP_RETURN */ + ,opmode(0, 0, 0, 0, 0, 0, iAsBx) /* OP_FORLOOP */ + ,opmode(1, 0, 0, 0, 0, 0, iABC) /* OP_TFORLOOP */ + ,opmode(0, 0, 0, 0, 0, 0, iAsBx) /* OP_TFORPREP */ + ,opmode(0, 0, 0, 0, 0, 0, iABx) /* OP_SETLIST */ + ,opmode(0, 0, 0, 0, 0, 0, iABx) /* OP_SETLISTO */ + ,opmode(0, 0, 0, 0, 0, 0, iABC) /* OP_CLOSE */ + ,opmode(0, 0, 0, 0, 1, 0, iABx) /* OP_CLOSURE */ }; -- cgit v1.2.3-55-g6feb