]>
Commit | Line | Data |
---|---|---|
92c4a786 | 1 | #ifndef __constraint_h__ |
bf92e32c | 2 | |
92c4a786 | 3 | #define __constraint_h__ |
bf92e32c | 4 | |
d0e5b01f | 5 | typedef enum |
6 | { | |
7 | LT, LTE, GT, GTE, EQ, NONNEGATIVE, POSITIVE | |
8 | } | |
9 | arithType; | |
10 | ||
28bf4b0b | 11 | struct s_constraint { |
bf92e32c | 12 | constraint orig; |
90bc41f7 | 13 | constraint or; |
4ab867d6 | 14 | bool fcnPre; |
361091cc | 15 | constraintExpr lexpr; |
4cccc6ad | 16 | arithType ar; |
361091cc | 17 | constraintExpr expr; |
4cccc6ad | 18 | bool post; |
795e7f34 | 19 | /*@observer@*/ /*@exposed@*/ /*@dependent@*/ exprNode generatingExpr; |
d0e5b01f | 20 | } ; |
21 | ||
6e88de2d | 22 | /*@constant null constraint constraint_undefined; @*/ |
92c4a786 | 23 | |
6e88de2d | 24 | # define constraint_undefined ((constraint)NULL) |
4cccc6ad | 25 | |
0e41eb0e | 26 | extern /*@falsewhennull@*/ bool constraint_isDefined (constraint p_e) /*@*/ ; |
27 | extern /*@unused@*/ /*@nullwhentrue@*/ bool constraint_isUndefined (constraint p_e) /*@*/ ; | |
28 | extern /*@nullwhentrue@*/ /*@unused@*/ bool constraint_isError (constraint p_e) /*@*/ ; | |
93307a76 | 29 | |
6e88de2d | 30 | # define constraint_isDefined(e) ((e) != constraint_undefined) |
31 | # define constraint_isUndefined(e) ((e) == constraint_undefined) | |
32 | # define constraint_isError(e) ((e) == constraint_undefined) | |
93307a76 | 33 | |
28bf4b0b | 34 | extern void constraint_free (/*@only@*/ constraint p_c); |
4cccc6ad | 35 | |
b7b694d6 | 36 | /* constraint makeConstraintParse (sRef x, lltok relOp, exprNode cconstant); */ |
4cccc6ad | 37 | |
38 | /*@i22*/ | |
39 | /*@-czechfcns*/ | |
4cccc6ad | 40 | |
03d670b6 | 41 | extern constraint constraint_makeReadSafeExprNode ( /*@dependent@*/ /*@observer@*/ exprNode p_po, /*@dependent@*/ /*@observer@*/ exprNode p_ind); |
4cccc6ad | 42 | |
03d670b6 | 43 | extern /*@only@*/ constraint constraint_makeWriteSafeExprNode (/*@dependent@*/ /*@observer@*/ exprNode p_po, /*@dependent@*/ /*@observer@*/ exprNode p_ind); |
4cccc6ad | 44 | |
03d670b6 | 45 | extern /*@only@*/ constraint constraint_makeReadSafeInt (/*@dependent@*/ /*@observer@*/ exprNode p_t1, int p_index); |
4cccc6ad | 46 | |
03d670b6 | 47 | extern /*@only@*/ constraint constraint_makeEnsureMaxReadAtLeast (/*@dependent@*/ /*@observer@*/ exprNode p_t1, /*@dependent@*/ /*@observer@*/ exprNode p_t2, fileloc p_sequencePoint); |
4cccc6ad | 48 | |
28bf4b0b | 49 | extern void constraint_overWrite (constraint p_c1, /*@observer@*/ constraint p_c2) /*@modifies p_c1 @*/; |
4cccc6ad | 50 | |
28bf4b0b | 51 | extern /*@only@*/ constraint constraint_copy (/*@temp@*/ /*@observer@*/ constraint p_c); |
4cccc6ad | 52 | |
28bf4b0b | 53 | extern bool fileloc_closer (/*@observer@*/ fileloc p_loc1, /*@observer@*/ fileloc p_loc2, /*@observer@*/ fileloc p_loc3) /*@*/; |
4cccc6ad | 54 | |
28bf4b0b | 55 | extern /*@only@*/ cstring arithType_print (arithType p_ar) /*@*/; |
4cccc6ad | 56 | |
28bf4b0b | 57 | extern /*@only@*/ fileloc constraint_getFileloc (constraint p_c); |
3814599d | 58 | |
59 | extern /*@only@*/ cstring constraint_unparse (/*@temp@*/ /*@observer@*/ constraint p_c) /*@*/; | |
60 | # define constraint_unparse constraint_print | |
61 | ||
28bf4b0b | 62 | extern /*@only@*/ cstring constraint_print (/*@temp@*/ /*@observer@*/ constraint p_c) /*@*/; |
d46ce6a4 | 63 | |
03d670b6 | 64 | extern /*@only@*/ constraint constraint_makeWriteSafeInt (/*@dependent@*/ /*@observer@*/ exprNode p_po, int p_ind); |
ef2aa32a | 65 | |
28bf4b0b | 66 | extern exprNode exprNode_copyConstraints (/*@returned@*/ exprNode p_dst, exprNode p_src) /*@modifies p_dst @*/; |
4cccc6ad | 67 | |
03d670b6 | 68 | extern /*@only@*/ constraint constraint_makeEnsureEqual (/*@dependent@*/ /*@observer@*/ exprNode p_e1, /*@dependent@*/ /*@observer@*/ exprNode p_e2, fileloc p_sequencePoint); |
4cccc6ad | 69 | |
03d670b6 | 70 | extern /*@only@*/ constraint constraint_makeMaxSetSideEffectPostIncrement (/*@dependent@*/ /*@observer@*/ exprNode p_e, fileloc p_sequencePoint); |
ef2aa32a | 71 | |
28bf4b0b | 72 | extern constraint constraint_preserveOrig (/*@returned@*/ constraint p_c) /*@modifies p_c @*/; |
73 | extern /*@only@*/ constraint constraint_doSRefFixBaseParam (/*@returned@*/ /*@only@*/ constraint p_precondition, | |
74 | exprNodeList p_arglist); | |
75 | extern /*@only@*/ cstring constraint_printDetailed (constraint p_c); | |
754746a0 | 76 | |
03d670b6 | 77 | extern /*@only@*/ constraint constraint_makeEnsureLessThan (/*@dependent@*/ /*@observer@*/ exprNode p_e1, /*@dependent@*/ /*@observer@*/ exprNode p_e2, fileloc p_sequencePoint); |
78 | extern /*@only@*/ constraint constraint_makeEnsureLessThanEqual (/*@dependent@*/ /*@observer@*/ exprNode p_e1, /*@dependent@*/ /*@observer@*/ exprNode p_e2, fileloc p_sequencePoint); | |
754746a0 | 79 | |
03d670b6 | 80 | extern /*@only@*/ constraint constraint_makeEnsureGreaterThan (/*@dependent@*/ /*@observer@*/ exprNode p_e1, /*@dependent@*/ /*@observer@*/ exprNode p_e2, fileloc p_sequencePoint); |
81 | extern /*@only@*/ constraint constraint_makeEnsureGreaterThanEqual (/*@dependent@*/ /*@observer@*/ exprNode p_e1, /*@dependent@*/ /*@observer@*/ exprNode p_e2, fileloc p_sequencePoint); | |
34f0c5e7 | 82 | |
83 | /*drl add 11/28/2000 */ | |
28bf4b0b | 84 | extern /*@only@*/ constraint constraint_makeSRefWriteSafeInt (sRef p_s, int p_ind); |
85 | extern /*@unused@*/ /*@only@*/ constraint constraint_makeSRefReadSafeInt (sRef p_s, int p_ind); | |
ef2aa32a | 86 | /*drl add 11/26/2000 */ |
28bf4b0b | 87 | extern void constraint_printError (/*@observer@*/ /*@temp@*/ constraint p_c, /*@temp@*/ /*@observer@*/ fileloc p_loc); |
d46ce6a4 | 88 | |
28bf4b0b | 89 | extern /*@only@*/ constraint constraint_doSRefFixConstraintParam (constraint p_precondition, |
90 | /*@temp@*/ /*@observer@*/ exprNodeList p_arglist); | |
ef2aa32a | 91 | |
28bf4b0b | 92 | extern /*@only@*/ constraint constraint_makeSRefSetBufferSize (sRef p_s, long int p_size); |
d46ce6a4 | 93 | |
28bf4b0b | 94 | extern /*@only@*/ constraint constraint_doFixResult (constraint p_postcondition, /*@dependent@*/ /*@observer@*/ exprNode p_fcnCall); |
ef2aa32a | 95 | |
03d670b6 | 96 | extern /*@only@*/ constraint constraint_makeEnsureLteMaxRead(/*@dependent@*/ /*@observer@*/ exprNode p_index, /*@dependent@*/ /*@observer@*/ exprNode p_buffer); |
ef2aa32a | 97 | |
03d670b6 | 98 | extern /*@only@*/ constraint constraint_makeMaxSetSideEffectPostDecrement (/*@dependent@*/ /*@observer@*/ exprNode p_e, fileloc p_sequencePoint); |
ef2aa32a | 99 | |
28bf4b0b | 100 | extern bool constraint_search (constraint p_c, constraintExpr p_old); |
103db890 | 101 | |
28bf4b0b | 102 | extern /*@only@*/ constraint makeConstraintParse3 (constraintExpr p_l, lltok p_relOp, constraintExpr p_r); |
103db890 | 103 | |
b37cf05e | 104 | extern constraint constraint_addGeneratingExpr (/*@returned@*/ constraint p_c, /*@dependent@*/ /*@exposed@*/ exprNode p_e); |
103db890 | 105 | |
28bf4b0b | 106 | extern bool constraint_hasMaxSet(constraint p_c); |
103db890 | 107 | |
470b7798 | 108 | /*from constraintGenreation.c*/ |
28bf4b0b | 109 | extern void exprNode_exprTraverse (/*@dependent@*/ exprNode p_e, bool p_definatelv, bool p_definaterv, /*@temp@*/ /*@observer@*/ fileloc p_sequencePoint); |
2934b455 | 110 | |
28bf4b0b | 111 | extern /*@only@*/ constraintList exprNode_traversRequiresConstraints (/*@dependent@*/ exprNode p_e); |
112 | extern /*@only@*/ constraintList exprNode_traversEnsuresConstraints (/*@dependent@*/ exprNode p_e); | |
2934b455 | 113 | |
28bf4b0b | 114 | extern constraint constraint_togglePost (/*@returned@*/ constraint p_c); |
115 | extern bool constraint_same (constraint p_c1, constraint p_c2) ; | |
2934b455 | 116 | |
28bf4b0b | 117 | /*@only@*/ cstring constraint_printOr (constraint p_c) /*@*/; |
2934b455 | 118 | extern void constraint_printErrorPostCondition (constraint p_c, fileloc p_loc) ; |
e60dcce4 | 119 | |
120 | extern cstring constraint_printLocation (/*@observer@*/ /*@temp@*/ constraint p_c) /*@*/; /*drl add 8-11-001*/ | |
121 | ||
2934b455 | 122 | extern constraint constraint_setFcnPre (/*@returned@*/ constraint p_c) ; |
03d670b6 | 123 | extern constraint constraint_origAddGeneratingExpr (/*@returned@*/ constraint p_c, /*@dependent@*/ /*@observer@*/ exprNode p_e) ; |
470b7798 | 124 | |
28bf4b0b | 125 | extern bool /*@alt void@*/ exprNode_generateConstraints (/*@dependent@*/ exprNode p_e) ; |
126 | constraint constraint_togglePostOrig (/*@returned@*/ constraint p_c); | |
470b7798 | 127 | |
28bf4b0b | 128 | bool constraint_hasOrig( /*@observer@*/ /*@temp@*/ constraint p_c); |
470b7798 | 129 | |
28bf4b0b | 130 | constraint constraint_makeAddAssign (/*@dependent@*/ /*@observer@*/ exprNode p_e, /*@dependent@*/ /*@observer@*/ exprNode p_f, fileloc p_sequencePoint); |
920a3797 | 131 | |
28bf4b0b | 132 | constraint constraint_makeSubtractAssign (/*@dependent@*/ /*@observer@*/ exprNode p_e, /*@dependent@*/ /*@observer@*/ exprNode p_f, fileloc p_sequencePoint); |
920a3797 | 133 | |
28bf4b0b | 134 | /*@only@*/ constraint constraint_undump (FILE * p_f); |
920a3797 | 135 | |
28bf4b0b | 136 | void constraint_dump (/*@observer@*/ constraint p_c, FILE * p_f); |
137 | ||
138 | extern void exprNode_forLoopHeuristics( /*@dependent@*/ exprNode p_e, /*@dependent@*/ exprNode p_forPred, /*@dependent@*/ exprNode p_forBody); | |
d46ce6a4 | 139 | |
e60dcce4 | 140 | int constraint_compare (/*@observer@*/ /*@temp@*/ const constraint * p_c1, /*@observer@*/ /*@temp@*/ const constraint * p_c2) /*@*/; |
02984642 | 141 | |
84380658 | 142 | bool constraint_isPost (/*@observer@*/ /*@temp@*/ constraint p_c); |
02984642 | 143 | |
a779b61e | 144 | bool constraint_tooDeep (/*@observer@*/ /*@temp@*/ constraint p_c); |
145 | ||
e5f31c00 | 146 | void exprNode_findValue( exprNode p_e); |
a779b61e | 147 | |
4cccc6ad | 148 | /*@=czechfcns*/ |
b7b694d6 | 149 | /* drl possible problem : warning take this out */ |
d0e5b01f | 150 | |
754746a0 | 151 | #include "constraintResolve.h" |
dc92450f | 152 | #include "constraintOutput.h" |
153 | ||
6e88de2d | 154 | #else |
155 | ||
156 | #error Multiple include | |
157 | ||
92c4a786 | 158 | #endif |
d0e5b01f | 159 |