GAMSlinks  0.4
GamsNLinstr.h
Go to the documentation of this file.
1 /* Copyright (C) 2008 GAMS Development and others
2  All Rights Reserved.
3  This code is published under the Common Public License.
4 
5  $Id: GamsNLinstr.h 462 2008-06-21 18:31:26Z stefan $
6 
7  Author: Stefan Vigerske
8 
9  WARNING:
10  The NL instruction (codes, format, semantics, etc.) are subject to change.
11  Thus, there is no warranty that a code based on this file is going to work fine
12  after changes in the GAMS I/O libraries as provided by GAMS.
13  GAMS is NOT obligated to issue a warning when it changes the NL instructions.
14 */
15 
16 #ifndef GAMSNLINSTR_H_
17 #define GAMSNLINSTR_H_
18 
19 #include "GAMSlinksConfig.h"
20 
21 #if defined(__cplusplus)
22 extern "C" {
23 #endif
24 
27 typedef enum GamsOpCode_ {
28  nlNoOp = 0, /* no operation */
29  nlPushV = 1, /* push variable */
30  nlPushI = 2, /* push immediate (constant) */
31  nlStore = 3, /* store row */
32  nlAdd = 4, /* add */
33  nlAddV = 5, /* add variable */
34  nlAddI = 6, /* add immediate */
35  nlAddL = 7, /* add local */
36  nlSub = 8, /* minus */
37  nlSubV = 9, /* subtract variable */
38  nlSubI = 10, /* subtract immediate */
39  nlSubL = 11, /* subtract local */
40  nlMul = 12, /* multiply */
41  nlMulV = 13, /* multiply variable */
42  nlMulI = 14, /* multiply immediate */
43  nlMulL = 15, /* multiply local */
44  nlDiv = 16, /* divide */
45  nlDivV = 17, /* divide variable */
46  nlDivI = 18, /* divide immediate */
47  nlDivL = 19, /* divide local */
48  nlUMin = 20, /* unary minus */
49  nlUMinV = 21, /* unary minus variable */
50  nlSwap = 22, /* swap two positions on stack top */
51  nlPushL = 23, /* push local */
52  nlPopL = 24, /* pop local */
53  nlPopDeriv = 25, /* pop derivative */
54  nlHeader = 26, /* header */
55  nlUMinL = 27, /* push umin local */
56  nlStoreS = 28, /* store scaled row */
57  nlPopDerivS= 29, /* store scaled gradient */
58  nlEquScale = 30, /* equation scale */
59  nlEnd = 31, /* end of instruction list */
60  nlCallArg1 = 32,
61  nlCallArg2 = 33,
62  nlCallArgN = 34,
63  nlFuncArgN = 35,
64  nlPushS = 36,
65  nlPopup = 37,
66  nlArg = 38,
67  nlMulIAdd = 39,
68  nlPushZero = 40,
69  nlMulPop1 = 41,
70  nlMulPop2 = 42,
71  nlMulPop = 43,
72  nlAddPop = 44,
73  nlSubPop = 45,
74  nlGetConst = 46,
77  nlMulConst = 49,
78  nlNegLocal = 50,
79  nlGetLocal = 51,
82  nlSetLocal = 54,
83  nlGetGrad = 55,
85  nlChk = 57,
86  nlAddO = 58,
87  nlPushO = 59,
88  nlInvoc = 60,
89  nlStackIn = 61,
90  MAXINS = 62
91 } GamsOpCode;
92 
95 extern const char* GamsOpCodeName[MAXINS];
96 
132 
133 
136 GamsOpCode getInstrOpCode(unsigned int instr);
137 
141 int getInstrAddress(unsigned int instr);
142 
145 void reorderInstr(unsigned int* instr, int num_instr);
146 
147 #if defined(__cplusplus)
148 } /* extern "C" */
149 #endif
150 
151 #endif /*GAMSNLINSTR_H_*/
int getInstrAddress(unsigned int instr)
Gives the address in a GAMS nonlinear instruction.
enum GamsOpCode_ GamsOpCode
The opcodes of GAMS nonlinear expressions.
GamsOpCode getInstrOpCode(unsigned int instr)
Gives the opcode of a GAMS nonlinear instruction.
GamsOpCode_
The opcodes of GAMS nonlinear expressions.
Definition: GamsNLinstr.h:27
enum GamsFuncCode_ GamsFuncCode
The codes of GAMS nonlinear functions.
void reorderInstr(unsigned int *instr, int num_instr)
Reorders instructions such that they do not contain PushS, Popup, or Swap anymore.
const char * GamsOpCodeName[MAXINS]
Names of GAMS nonlinear expressions for printing.
GamsFuncCode_
The codes of GAMS nonlinear functions.
Definition: GamsNLinstr.h:99