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

     1  // Code generated by "string2enum -linecomment -type AtomicOp ../../ir/enum"; DO NOT EDIT.
     2  
     3  package enum
     4  
     5  import (
     6  	"fmt"
     7  
     8  	"github.com/llir/llvm/ir/enum"
     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[enum.AtomicOpAdd-1]
    16  	_ = x[enum.AtomicOpAnd-2]
    17  	_ = x[enum.AtomicOpFAdd-3]
    18  	_ = x[enum.AtomicOpFSub-4]
    19  	_ = x[enum.AtomicOpMax-5]
    20  	_ = x[enum.AtomicOpMin-6]
    21  	_ = x[enum.AtomicOpNAnd-7]
    22  	_ = x[enum.AtomicOpOr-8]
    23  	_ = x[enum.AtomicOpSub-9]
    24  	_ = x[enum.AtomicOpUMax-10]
    25  	_ = x[enum.AtomicOpUMin-11]
    26  	_ = x[enum.AtomicOpXChg-12]
    27  	_ = x[enum.AtomicOpXor-13]
    28  }
    29  
    30  const _AtomicOp_name = "addandfaddfsubmaxminnandorsubumaxuminxchgxor"
    31  
    32  var _AtomicOp_index = [...]uint8{0, 3, 6, 10, 14, 17, 20, 24, 26, 29, 33, 37, 41, 44}
    33  
    34  // AtomicOpFromString returns the AtomicOp enum corresponding to s.
    35  func AtomicOpFromString(s string) enum.AtomicOp {
    36  	if len(s) == 0 {
    37  		return 0
    38  	}
    39  	for i := range _AtomicOp_index[:len(_AtomicOp_index)-1] {
    40  		if s == _AtomicOp_name[_AtomicOp_index[i]:_AtomicOp_index[i+1]] {
    41  			return enum.AtomicOp(i + 1)
    42  		}
    43  	}
    44  	panic(fmt.Errorf("unable to locate AtomicOp enum corresponding to %q", s))
    45  }
    46  
    47  func _(s string) {
    48  	// Check for duplicate string values in type "AtomicOp".
    49  	switch s {
    50  	// 1
    51  	case "add":
    52  	// 2
    53  	case "and":
    54  	// 3
    55  	case "fadd":
    56  	// 4
    57  	case "fsub":
    58  	// 5
    59  	case "max":
    60  	// 6
    61  	case "min":
    62  	// 7
    63  	case "nand":
    64  	// 8
    65  	case "or":
    66  	// 9
    67  	case "sub":
    68  	// 10
    69  	case "umax":
    70  	// 11
    71  	case "umin":
    72  	// 12
    73  	case "xchg":
    74  	// 13
    75  	case "xor":
    76  	}
    77  }