Commit 12f980bc authored by Keith Randall's avatar Keith Randall

[dev.ssa] cmd/internal/ssa: delete ssac

We don't need this standalone tool any more.  We can now feed the
ssa compiler directly from the Go frontend.

Change-Id: I922f1e061c2d3db6bf77acc137d4d1fc7dc86c0d
Reviewed-on: https://go-review.googlesource.com/10034Reviewed-by: default avatarAlan Donovan <adonovan@google.com>
parent 23df95b9
(TYPE T127bd68 int)
(TYPE T127bd68 int)
(TYPE T127bd68 int)
(TYPE T127bd68 int)
(TYPE T7faedc523360 (FUNC (int) (int)))
(TYPE T127bd68 int)
(TYPE T127bd68 int)
(TYPE T7faedc523360 (FUNC (int) (int)))
(TYPE T127bd68 int)
(TYPE T127bd68 int)
(TYPE T127bd68 int)
(TYPE T127bd68 int)
(TYPE T127bd68 int)
(TYPE T127bd68 int)
(DCL n T127bd68)
(AS n (LOAD (FP T127bd68 0)))
(DCL ~r1 T127bd68)
(DCL n T127bd68)
(DCL autotmp_0000 T127bd68)
(DCL fib T7faedc523360)
(DCL n T127bd68)
(DCL autotmp_0001 T127bd68)
(DCL fib T7faedc523360)
(DCL n T127bd68)
(DCL ~r1 T127bd68)
(DCL autotmp_0000 T127bd68)
(DCL autotmp_0001 T127bd68)
(DCL autotmp_0001 T127bd68)
(DCL autotmp_0000 T127bd68)
(IF (LT n (CINT 2)) .then0 .else0)
(LABEL .then0)
(AS ~r1 n)
(AS (FP T127bd68 8) ~r1)
(RETURN)
(GOTO .end0)
(LABEL .else0)
(GOTO .end0)
(LABEL .end0)
(AS (SP T127bd68 0) (SUB n (CINT 1)))
(CALL fib)
(AS autotmp_0000 (LOAD (SP T127bd68 8)))
(AS (SP T127bd68 0) (SUB n (CINT 2)))
(CALL fib)
(AS autotmp_0001 (LOAD (SP T127bd68 8)))
(AS ~r1 (ADD autotmp_0000 autotmp_0001))
(AS (FP T127bd68 8) ~r1)
(RETURN)
(NAME runtime·fibiter)
(TYPE Tf5dd68 int)
(TYPE Tf5dd68 int)
(TYPE Tf5dd68 int)
(TYPE Tf5dd68 int)
(TYPE Tf5dd68 int)
(TYPE Tf5dd68 int)
(TYPE Tf5dd68 int)
(TYPE Tf5dd68 int)
(TYPE Tf5dd68 int)
(TYPE Tf5dd68 int)
(TYPE Tf5dd68 int)
(TYPE Tf5dd68 int)
(TYPE Tf5dd68 int)
(TYPE Tf5dd68 int)
(TYPE Tf5dd68 int)
(TYPE Tf5dd68 int)
(TYPE Tf5dd68 int)
(TYPE Tf5dd68 int)
(TYPE Tf5dd68 int)
(TYPE Tf5dd68 int)
(TYPE Tf5dd68 int)
(TYPE Tf5dd68 int)
(DCL a Tf5dd68)
(DCL a Tf5dd68)
(DCL b Tf5dd68)
(DCL b Tf5dd68)
(DCL i Tf5dd68)
(DCL i Tf5dd68)
(DCL i Tf5dd68)
(DCL n Tf5dd68)
(DCL autotmp_0002 Tf5dd68)
(DCL i Tf5dd68)
(DCL i Tf5dd68)
(DCL autotmp_0002 Tf5dd68)
(DCL autotmp_0002 Tf5dd68)
(DCL autotmp_0003 Tf5dd68)
(DCL a Tf5dd68)
(DCL b Tf5dd68)
(DCL a Tf5dd68)
(DCL b Tf5dd68)
(DCL b Tf5dd68)
(DCL autotmp_0003 Tf5dd68)
(DCL ~r1 Tf5dd68)
(DCL a Tf5dd68)
(AS n (LOAD (FP Tf5dd68 0)))
(AS a (CINT 0))
(AS b (CINT 1))
(AS i (CINT 0))
(GOTO .top0)
(LABEL .top0)
(IF (LT i n) .body0 .end0)
(LABEL .body0)
(AS autotmp_0003 (ADD a b))
(AS a b)
(AS b autotmp_0003)
(AS autotmp_0002 i)
(AS i (ADD autotmp_0002 (CINT 1)))
(GOTO .top0)
(LABEL .end0)
(AS (FP Tf5dd68 8) a)
(RETURN)
This diff is collapsed.
// Copyright 2015 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.
package main
import "strings"
// an sexpr is an s-expression. It is either a token or a
// parenthesized list of s-expressions.
//
// Used just for initial development. Should we keep it for testing, or
// ditch it once we've plugged into the main compiler output?
type sexpr struct {
compound bool
name string // !compound
parts []sexpr // compound
}
func (s *sexpr) String() string {
if !s.compound {
return s.name
}
x := "("
for i, p := range s.parts {
if i != 0 {
x += " "
}
x += p.String()
}
return x + ")"
}
func parseSexpr(s string) sexpr {
var e string
e, s = grabOne(s)
if len(e) > 0 && e[0] == '(' {
e = e[1 : len(e)-1]
var parts []sexpr
for e != "" {
var p string
p, e = grabOne(e)
parts = append(parts, parseSexpr(p))
}
return sexpr{true, "", parts}
}
return sexpr{false, e, nil}
}
// grabOne peels off first token or parenthesized string from s.
// returns first thing and the remainder of s.
func grabOne(s string) (string, string) {
for len(s) > 0 && s[0] == ' ' {
s = s[1:]
}
if len(s) == 0 || s[0] != '(' {
i := strings.Index(s, " ")
if i < 0 {
return s, ""
}
return s[:i], s[i:]
}
d := 0
i := 0
for {
if len(s) == i {
panic("unterminated s-expression: " + s)
}
if s[i] == '(' {
d++
}
if s[i] == ')' {
d--
if d == 0 {
i++
return s[:i], s[i:]
}
}
i++
}
}
// Copyright 2015 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.
package main
// Maintains a map[int]*ssa.Value, but cheaper.
// from http://research.swtch.com/sparse
// in turn, from Briggs and Torczon
import (
"cmd/internal/ssa"
)
type SparseMap struct {
dense []SparseMapEntry
sparse []int
}
type SparseMapEntry struct {
Key int
Val *ssa.Value
}
// NewSparseMap returns a SparseMap that can have
// integers between 0 and n-1 as keys.
func NewSparseMap(n int) *SparseMap {
return &SparseMap{nil, make([]int, n)}
}
func (s *SparseMap) Get(x int) *ssa.Value {
i := s.sparse[x]
if i < len(s.dense) && s.dense[i].Key == x {
return s.dense[i].Val
}
return nil
}
func (s *SparseMap) Put(x int, v *ssa.Value) {
i := s.sparse[x]
if i < len(s.dense) && s.dense[i].Key == x {
s.dense[i].Val = v
return
}
i = len(s.dense)
s.dense = append(s.dense, SparseMapEntry{x, v})
s.sparse[x] = i
}
func (s *SparseMap) Remove(x int) {
i := s.sparse[x]
if i < len(s.dense) && s.dense[i].Key == x {
y := s.dense[len(s.dense)-1]
s.dense[i] = y
s.sparse[y.Key] = i
s.dense = s.dense[:len(s.dense)-1]
}
}
func (s *SparseMap) Clear() {
s.dense = s.dense[:0]
}
// Contents returns a slice of key/value pairs.
// Caller must not modify any returned entries.
// The return value is invalid after the SparseMap is modified in any way.
func (s *SparseMap) Contents() []SparseMapEntry {
return s.dense
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment