Enum cranelift_codegen::ir::ExternalName
source · pub enum ExternalName {
User {
namespace: u32,
index: u32,
},
TestCase {
length: u8,
ascii: [u8; 16],
},
LibCall(LibCall),
}
Expand description
The name of an external is either a reference to a user-defined symbol table, or a short sequence of ascii bytes so that test cases do not have to keep track of a symbol table.
External names are primarily used as keys by code using Cranelift to map
from a cranelift_codegen::ir::FuncRef
or similar to additional associated
data.
External names can also serve as a primitive testing and debugging tool.
In particular, many .clif
test files use function names to identify
functions.
Variants§
User
A name in a user-defined symbol table. Cranelift does not interpret these numbers in any way.
TestCase
A test case function name of up to 10 ascii characters. This is not intended to be used outside test cases.
LibCall(LibCall)
A well-known runtime library function.
Implementations§
source§impl ExternalName
impl ExternalName
sourcepub fn testcase<T: AsRef<[u8]>>(v: T) -> Self
pub fn testcase<T: AsRef<[u8]>>(v: T) -> Self
Creates a new external name from a sequence of bytes. Caller is expected
to guarantee bytes are only ascii alphanumeric or _
.
Examples
// Create `ExternalName` from a string.
let name = ExternalName::testcase("hello");
assert_eq!(name.to_string(), "%hello");
Trait Implementations§
source§impl Clone for ExternalName
impl Clone for ExternalName
source§fn clone(&self) -> ExternalName
fn clone(&self) -> ExternalName
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more