github.com/llir/llvm@v0.3.6/asm/enum/floatkind_string2enum.go (about)

     1  // Code generated by "string2enum -linecomment -type FloatKind -pkg enum ../../ir/types"; DO NOT EDIT.
     2  
     3  package enum
     4  
     5  import (
     6  	"fmt"
     7  
     8  	"github.com/llir/llvm/ir/types"
     9  )
    10  
    11  func _() {
    12  	// An "invalid array index" compiler error signifies that the constant values have changed.
    13  	// Re-run the string2enum command to generate them again.
    14  	var x [1]struct{}
    15  	_ = x[types.FloatKindHalf-0]
    16  	_ = x[types.FloatKindFloat-1]
    17  	_ = x[types.FloatKindDouble-2]
    18  	_ = x[types.FloatKindFP128-3]
    19  	_ = x[types.FloatKindX86_FP80-4]
    20  	_ = x[types.FloatKindPPC_FP128-5]
    21  }
    22  
    23  const _FloatKind_name = "halffloatdoublefp128x86_fp80ppc_fp128"
    24  
    25  var _FloatKind_index = [...]uint8{0, 4, 9, 15, 20, 28, 37}
    26  
    27  // FloatKindFromString returns the FloatKind enum corresponding to s.
    28  func FloatKindFromString(s string) types.FloatKind {
    29  	if len(s) == 0 {
    30  		return 0
    31  	}
    32  	for i := range _FloatKind_index[:len(_FloatKind_index)-1] {
    33  		if s == _FloatKind_name[_FloatKind_index[i]:_FloatKind_index[i+1]] {
    34  			return types.FloatKind(i)
    35  		}
    36  	}
    37  	panic(fmt.Errorf("unable to locate FloatKind enum corresponding to %q", s))
    38  }
    39  
    40  func _(s string) {
    41  	// Check for duplicate string values in type "FloatKind".
    42  	switch s {
    43  	// 0
    44  	case "half":
    45  	// 1
    46  	case "float":
    47  	// 2
    48  	case "double":
    49  	// 3
    50  	case "fp128":
    51  	// 4
    52  	case "x86_fp80":
    53  	// 5
    54  	case "ppc_fp128":
    55  	}
    56  }