enc

package
v0.3.0-pre4 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2018 License: 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 Comdat

func Comdat(name string) string

Comdat 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 Global

func Global(name string) string

Global encodes a global 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 Label

func Label(name string) string

Label encodes a label 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 Local

func Local(name string) string

Local encodes a local 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 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 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