enc

package
v0.3.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 2, 2022 License: 0BSD, Unlicense Imports: 3 Imported by: 0

Documentation

Overview

Package enc implements encoding of identifiers for LLVM IR assembly.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AttrGroupID

func AttrGroupID(id int64) string

AttrGroupID encodes a attribute group ID to its LLVM IR assembly representation.

Examples:

"42" -> "#42"

References:

http://www.llvm.org/docs/LangRef.html#identifiers

func ComdatName

func ComdatName(name string) string

ComdatName encodes a comdat name to its LLVM IR assembly representation.

Examples:

"foo" -> $%foo"
"a b" -> `$"a b"`
"世" -> `$"\E4\B8\96"`

References:

http://www.llvm.org/docs/LangRef.html#identifiers

func Escape

func Escape(s []byte, valid func(b byte) bool) string

Escape replaces any characters in s categorized as invalid by the valid function with corresponding hexadecimal escape sequence (\XX).

func EscapeIdent

func EscapeIdent(s string) string

EscapeIdent replaces any characters which are not valid in identifiers with corresponding hexadecimal escape sequence (\XX).

func EscapeString

func EscapeString(s []byte) string

EscapeString replaces any characters in s categorized as invalid in string literals with corresponding hexadecimal escape sequence (\XX).

func GlobalID

func GlobalID(id int64) string

GlobalID encodes a global ID to its LLVM IR assembly representation.

Examples:

"42" -> "@42"

References:

http://www.llvm.org/docs/LangRef.html#identifiers

func GlobalName

func GlobalName(name string) string

GlobalName encodes a global name to its LLVM IR assembly representation.

Examples:

"foo" -> "@foo"
"a b" -> `@"a b"`
"世" -> `@"\E4\B8\96"`
"2" -> `@"2"`

References:

http://www.llvm.org/docs/LangRef.html#identifiers

func LabelID

func LabelID(id int64) string

LabelID encodes a label ID to its LLVM IR assembly representation.

Examples:

"42" -> 42:

References:

http://www.llvm.org/docs/LangRef.html#identifiers

func LabelName

func LabelName(name string) string

LabelName encodes a label name to its LLVM IR assembly representation.

Examples:

"foo" -> "foo:"
"a b" -> `"a b":`
"世" -> `"\E4\B8\96":`
"2" -> `"2":`

References:

http://www.llvm.org/docs/LangRef.html#identifiers

func LocalID

func LocalID(id int64) string

LocalID encodes a local ID to its LLVM IR assembly representation.

Examples:

"42" -> "%42"

References:

http://www.llvm.org/docs/LangRef.html#identifiers

func LocalName

func LocalName(name string) string

LocalName encodes a local name to its LLVM IR assembly representation.

Examples:

"foo" -> "%foo"
"a b" -> `%"a b"`
"世" -> `%"\E4\B8\96"`
"2" -> `%"2"`

References:

http://www.llvm.org/docs/LangRef.html#identifiers

func MetadataID

func MetadataID(id int64) string

MetadataID encodes a metadata ID to its LLVM IR assembly representation.

Examples:

"42" -> "!42"

References:

http://www.llvm.org/docs/LangRef.html#identifiers

func MetadataName

func MetadataName(name string) string

MetadataName encodes a metadata name to its LLVM IR assembly representation.

Examples:

"foo" -> "!foo"
"a b" -> `!a\20b`
"世" -> `!\E4\B8\96`

References:

http://www.llvm.org/docs/LangRef.html#identifiers

func Quote

func Quote(s []byte) string

Quote returns s as a double-quoted string literal.

func TypeName

func TypeName(name string) string

TypeName encodes a type name to its LLVM IR assembly representation.

Examples:

"foo" -> "%foo"
"a b" -> `%"a b"`
"世" -> `%"\E4\B8\96"`
"2" -> `%2`

References:

http://www.llvm.org/docs/LangRef.html#identifiers

func Unescape

func Unescape(s string) []byte

Unescape replaces hexadecimal escape sequences (\xx) in s with their corresponding characters.

func Unquote

func Unquote(s string) []byte

Unquote interprets s as a double-quoted string literal, returning the string value that s quotes.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL