1 /* ***********************************************************
 2    *                                                         *
 3    * Copyright, (C) Honeywell Information Systems Inc., 1982 *
 4    *                                                         *
 5    * Copyright (c) 1972 by Massachusetts Institute of        *
 6    * Technology and Honeywell Information Systems, Inc.      *
 7    *                                                         *
 8    *********************************************************** */
 9 
10 
11 /* This procedure decides if an operation can be done inline
12    or if it requires the generation of a call
13 
14    Initial Version: 25 October 1972 by BLW        */
15 
16 inline_operation: proc(node_pt,ref,atom) returns(bit(1) aligned);
17 
18 dcl       node_pt ptr,                  /* points at operator node */
19           ref(3) ptr,                   /* ptrs to reference nodes for operands */
20           atom(3) bit(1) aligned;       /* "1"b if operand(i) atomic */
21 
22 dcl       (null,string) builtin,
23           complex_operand(3) bit(1) unaligned;
24 
25 dcl       compile_exp$save entry(ptr) returns(ptr);
26 
27 %include reference;
28 %include symbol;
29 %include operator;
30 %include data_types;
31 %include op_codes;
32 
33           string(complex_operand) = "0"b;
34 
35           if ref(1) ^= null then call test(1);
36 
37           call test(2);
38 
39           if node_pt -> operator.number = 3 then call test(3);
40 
41           if string(complex_operand)
42           then do;
43 
44                if node_pt -> operator.op_code = abs_fun then goto no;
45 
46                if ^ complex_operand(2)
47                then if ref(2) -> reference.data_type ^= real_flt_bin_1
48                     then goto no;
49 
50                if node_pt -> operator.number = 3
51                then if ^ complex_operand(3)
52                     then if ref(3) -> reference.data_type ^= real_flt_bin_1
53                          then goto no;
54                end;
55 
56 yes:      return("1"b);
57 
58 no:       return("0"b);
59 
60 test:          proc(k);
61 
62 dcl            k fixed bin,
63                (p,s) ptr;
64 
65                p = ref(k);
66                s = p -> reference.symbol;
67 
68                if s -> symbol.decimal then goto no;
69 
70                if s -> symbol.complex
71                then do;
72                     if p -> reference.data_type ^= complex_flt_bin_1 then goto no;
73                     complex_operand(k) = "1"b;
74                     if k > 1
75                     then if ^ atom(k)
76                     then if ^ p -> reference.aligned_ref
77                     then do;
78                          ref(k) = compile_exp$save((node_pt -> operand(k)));
79                          atom(k) = "1"b;
80                          end;
81                     end;
82 
83                end;
84 
85           end;