Subversion Repositories tendra.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 7u83 1
/*
2
    		 Crown Copyright (c) 1997
3
 
4
    This TenDRA(r) Computer Program is subject to Copyright
5
    owned by the United Kingdom Secretary of State for Defence
6
    acting through the Defence Evaluation and Research Agency
7
    (DERA).  It is made available to Recipients with a
8
    royalty-free licence for its use, reproduction, transfer
9
    to other parties and amendment for any purpose not excluding
10
    product development provided that any such use et cetera
11
    shall be deemed to be acceptance of the following conditions:-
12
 
13
        (1) Its Recipients shall ensure that this Notice is
14
        reproduced upon any copies or amended versions of it;
15
 
16
        (2) Any amended version of it shall be clearly marked to
17
        show both the nature of and the organisation responsible
18
        for the relevant amendment or amendments;
19
 
20
        (3) Its onward transfer from a recipient to another
21
        party shall be deemed to be that party's acceptance of
22
        these conditions;
23
 
24
        (4) DERA gives no warranty or assurance as to its
25
        quality or suitability for any purpose and DERA accepts
26
        no liability whatsoever in relation to any use to which
27
        it may be put.
28
*/
29
 
30
 
31
/* 80x86/is_worth.c */
32
 
33
/**********************************************************************
34
$Author: release $
35
$Date: 1998/01/17 15:55:52 $
36
$Revision: 1.1.1.1 $
37
$Log: is_worth.c,v $
38
 * Revision 1.1.1.1  1998/01/17  15:55:52  release
39
 * First version to be checked into rolling release.
40
 *
41
 * Revision 1.2  1995/01/30  12:56:29  pwe
42
 * Ownership -> PWE, tidy banners
43
 *
44
 * Revision 1.1  1994/10/27  14:15:22  jmf
45
 * Initial revision
46
 *
47
 * Revision 1.5  1994/07/15  13:58:07  jmf
48
 * Admit global real consts. Safeguard father.
49
 *
50
 * Revision 1.4  1994/07/12  15:13:07  jmf
51
 * protected father for test_tag
52
 *
53
 * Revision 1.3  1994/07/12  15:12:11  jmf
54
 * Replaced keywords
55
 *
56
 * Revision 1.1  1994/07/12  14:35:40  jmf
57
 * Initial revision
58
 *
59
**********************************************************************/
60
 
61
 
62
#include "config.h"
63
#include "common_types.h"
64
#include "tags.h"
65
#include "expmacs.h"
66
#include "exp.h"
67
#include "shapemacs.h"
68
#include "is_worth.h"
69
 
70
/* PROCEDURES */
71
 
72
int is_worth
73
    PROTO_N ( (c) )
74
    PROTO_T ( exp c )
75
{
76
				/* decide if constant c is worth declaring
77
				   separately */
78
  unsigned char cnam = name (c);
79
 
80
  if (name(sh(c)) == realhd && cnam == cont_tag &&
81
	name(son(c)) == name_tag && isvar(son(son(c))) &&
82
	isglob(son(son(c))))
83
    return 1;
84
 
85
  if (cnam == cont_tag && name(son(c)) == name_tag &&
86
       !isvar(son(son(c)))) {
87
    return 1;
88
  }
89
 
90
  return ((!is_o (cnam) && cnam != clear_tag &&
91
	   cnam != int_to_bitf_tag && cnam != bitf_to_int_tag) ||
92
  /* ignore simple things unless ... */
93
      (cnam == cont_tag && name (son (c)) == cont_tag &&
94
	name (son (son (c))) == name_tag)
95
      || (cnam == name_tag &&
96
          (isloadparam(son(c)) || isparam(son(c))) &&
97
          !isvar(son(c)) &&
98
          shape_size(sh(c)) <= 32
99
 
100
          && name(sh(c)) != shrealhd
101
 
102
         )
103
      ||  (cnam == cont_tag && name(son(c)) == name_tag &&
104
	   isvar(son(son(c))) && isglob(son(son(c))) &&
105
	   ((last(c) && bro(c) != nilexp) ||
106
		(!last(c) && last(bro(c)) && bro(bro(c)) != nilexp)) &&
107
	   name(father(c)) == test_tag)
108
    );
109
}