1%% -*- erlang-indent-level: 2 -*-
2%%
3%% Licensed under the Apache License, Version 2.0 (the "License");
4%% you may not use this file except in compliance with the License.
5%% You may obtain a copy of the License at
6%%
7%%     http://www.apache.org/licenses/LICENSE-2.0
8%%
9%% Unless required by applicable law or agreed to in writing, software
10%% distributed under the License is distributed on an "AS IS" BASIS,
11%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12%% See the License for the specific language governing permissions and
13%% limitations under the License.
14
15%%%--------------------------------------------------------------------
16%%% Basic Values:
17%%%
18%%% temp	::= #sparc_temp{reg, type, allocatable}
19%%% reg		::= <token from hipe_sparc_registers>
20%%% type	::= tagged | untagged | double
21%%% allocatable	::= true | false
22%%%
23%%% sdesc	::= #sparc_sdesc{exnlab, fsize, arity, live}
24%%% exnlab	::= [] | label
25%%% fsize	::= int32		(frame size in words)
26%%% live	::= <tuple of int32>	(word offsets)
27%%% arity	::= uint8
28%%%
29%%% mfa		::= #sparc_mfa{atom, atom, arity}
30%%% prim	::= #sparc_prim{atom}
31
32-record(sparc_mfa, {m::atom(), f::atom(), a::arity()}).
33-record(sparc_prim, {prim}).
34-record(sparc_sdesc, {exnlab, fsize, arity::arity(), live}).
35-record(sparc_temp, {reg, type, allocatable}).
36-record(sparc_simm13, {value}).
37-record(sparc_uimm5, {value}).
38-record(sparc_uimm6, {value}).	% shift counts in 64-bit mode
39-record(sparc_uimm22, {value}).
40
41%%% Instruction Operands:
42%%%
43%%% aluop	::= add | addcc | and | andcc | or | orcc
44%%%		  | xor | xorcc | sub | subcc | mulx | smul
45%%%		  | sll | srl | sra | sllx | srlx | srax
46%%%		  | ldsb | ldsh | ldsw | ldub | lduh | lduw | ldx
47%%%		  (HW has andn{,cc}, orn{,cc}, xnor{,cc}, addc{,cc},
48%%%		   and subc{,cc}, but we don't use them)
49%%% cond	::= n | e | le | l | leu | lu | neg | vs |
50%%%		  | a | ne | g | ge | gu | geu | pos | vc
51%%% rcond	::= z | lez | lz | nz | gz | gez
52%%% stop	::= stb | stw | stx	(HW has sth, but we don't use it)
53%%%
54%%% immediate	::= int32 | atom | {label, label_type}
55%%% label_type	::= constant | closure | c_const
56%%%
57%%% dst		::= temp
58%%% src		::= temp
59%%% src1	::= temp
60%%% src2	::= temp
61%%%		  | simm13 	(only in alu.src2, jmp.src2, jmpl.src2)
62%%% base	::= src1
63%%% disp	::= src2
64%%%
65%%% fun		::= mfa | prim
66%%% funv	::= fun | temp
67%%%
68%%% fp_binop	::= faddd | fdivd | fmuld | fsubd
69%%% fp_unop	::= fitod | fmovd | fnegd
70
71%%% Instructions:
72
73-record(alu, {aluop, src1, src2, dst}).
74-record(bp, {'cond', label, pred}).	% local jump on %icc
75-ifdef(notdef).	% XXX: only for sparc64, alas
76-record(br, {rcond, src, label, pred}).	% local jump on register
77-endif.
78-record(call_rec, {'fun', sdesc, linkage}).	% known recursive call
79-record(call_tail, {'fun', linkage}).	% known tailcall
80-record(comment, {term}).
81-record(jmp, {src1, src2, labels}).	% return, switch, or computed tailcall
82-record(jmpl, {src, sdesc}).		% computed recursive call (jmpl [src+0],%o7)
83-record(label, {label}).
84-record(pseudo_bp, {'cond', true_label, false_label, pred}).
85%%-record(pseudo_br, {rcond, src, true_label, false_label, pred}).
86-record(pseudo_call, {funv, sdesc, contlab, linkage}).
87-record(pseudo_call_prepare, {nrstkargs}).
88-record(pseudo_move, {src, dst}).
89-record(pseudo_ret, {}).
90-record(pseudo_set, {imm, dst}).
91-record(pseudo_spill_fmove, {src, temp, dst}).
92-record(pseudo_spill_move, {src, temp, dst}).
93-record(pseudo_tailcall, {funv, arity, stkargs, linkage}).
94-record(pseudo_tailcall_prepare, {}).
95-record(rdy, {dst}).
96-record(sethi, {uimm22, dst}).
97-record(store, {stop, src, base, disp}).
98-record(fp_binary, {fp_binop, src1, src2, dst}).
99-record(fp_unary, {fp_unop, src, dst}).
100-record(pseudo_fload, {base, disp, dst, is_single}).
101-record(pseudo_fmove, {src, dst}).
102-record(pseudo_fstore, {src, base, disp}).
103
104%%% Function definitions.
105
106-include("../misc/hipe_consttab.hrl").
107
108-record(defun, {mfa :: mfa(), formals, code,
109	       	data	  :: hipe_consttab(),
110	        isclosure :: boolean(),
111		isleaf    :: boolean(),
112		var_range, label_range}).
113