summaryrefslogtreecommitdiff
path: root/src/cmd/gc/popt.h
blob: 8d5dfff1a70a6a012cca5eece9938ad5f5668d1c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Copyright 2013 The Go Authors.  All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

typedef struct Flow Flow;
typedef struct Graph Graph;

struct Flow {
	Prog*	prog;   	// actual instruction
	Flow*	p1;     	// predecessors of this instruction: p1,
	Flow*	p2;     	// and then p2 linked though p2link.
	Flow*	p2link;
	Flow*	s1;     	// successors of this instruction (at most two: s1 and s2).
	Flow*	s2;
	Flow*	link;   	// next instruction in function code
	
	int32	active;	// usable by client

	int32	rpo;		// reverse post ordering
	uint16	loop;		// x5 for every loop
	uchar	refset;		// diagnostic generated
};

struct Graph
{
	Flow*	start;
	int	num;
	
	// After calling flowrpo, rpo lists the flow nodes in reverse postorder,
	// and each non-dead Flow node f has g->rpo[f->rpo] == f.
	Flow**	rpo;
};

void	fixjmp(Prog*);
Graph*	flowstart(Prog*, int);
void	flowrpo(Graph*);
void	flowend(Graph*);
void	mergetemp(Prog*);
void	nilopt(Prog*);
int	noreturn(Prog*);
int	regtyp(Addr*);
int	sameaddr(Addr*, Addr*);
int	smallindir(Addr*, Addr*);
int	stackaddr(Addr*);
Flow*	uniqp(Flow*);
Flow*	uniqs(Flow*);