Source file src/cmd/compile/internal/ssa/schedule.go

     1  // Copyright 2015 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package ssa
     6  
     7  import "cmd/compile/internal/ssa/ssaop"
     8  
     9  // IsFlagOp reports if v is an OP with the flag type.
    10  func (v *Value) IsFlagOp() bool {
    11  	if v.Type.IsFlags() || v.Type.IsTuple() && v.Type.FieldType(1).IsFlags() {
    12  		return true
    13  	}
    14  	// PPC64 carry generators put their carry in a non-flag-typed register
    15  	// in their output.
    16  	switch v.Op {
    17  	case ssaop.OpPPC64SUBC, ssaop.OpPPC64ADDC, ssaop.OpPPC64SUBCconst, ssaop.OpPPC64ADDCconst:
    18  		return true
    19  	}
    20  	return false
    21  }
    22  
    23  // HasFlagInput reports whether v has a flag value as any of its inputs.
    24  func (v *Value) HasFlagInput() bool {
    25  	for _, a := range v.Args {
    26  		if a.IsFlagOp() {
    27  			return true
    28  		}
    29  	}
    30  	// PPC64 carry dependencies are conveyed through their final argument,
    31  	// so we treat those operations as taking flags as well.
    32  	switch v.Op {
    33  	case ssaop.OpPPC64SUBE, ssaop.OpPPC64ADDE, ssaop.OpPPC64SUBZEzero, ssaop.OpPPC64ADDZE, ssaop.OpPPC64ADDZEzero:
    34  		return true
    35  	}
    36  	return false
    37  }
    38  

View as plain text