Class TargetObj#

Inheritance Relationships#

Base Type#

  • public ffi::Object

Class Documentation#

class TargetObj : public ffi::Object#

Compilation target.

See also

Target

Public Functions

inline explicit TargetObj(TargetKind kind)#
inline explicit TargetObj(ffi::UnsafeInit tag)#
ffi::String str() const#

The JSON string representation of the target.

Returns:

JSON string of the target configuration (e.g. {“kind”: “llvm”, “mcpu”: “cortex-a53”})

ffi::Map<ffi::String, ffi::Any> ToConfig() const#
Returns:

Export target to JSON-like configuration

inline ffi::Optional<Target> GetHost() const#
Returns:

The ffi::Optional<Target> typed target host of the TargetObj

inline int GetTargetDeviceType() const#
Returns:

The device type for this target

inline bool HasKey(const ffi::String &query_key) const#

Check if the target contains a key.

Parameters:

query_key – The string name of the key to be checked

Returns:

True if the target’s TargetObj::keys contains the specified key, False otherwise.

template<typename TObjectRef>
inline ffi::Optional<TObjectRef> GetAttr(const std::string &attr_key, ffi::Optional<TObjectRef> default_value = ffi::Optional<TObjectRef>(std::nullopt)) const#

Get an entry from attrs of the target.

Template Parameters:

TObjectRef – Type of the attribute

Parameters:
  • attr_key – The name of the attribute key

  • default_value – The value returned if the key is not present

Returns:

An optional, std::nullopt if not found, otherwise the value found

template<typename TObjectRef>
inline ffi::Optional<TObjectRef> GetAttr(const std::string &attr_key, TObjectRef default_value) const#

Get an entry from attrs of the target.

Template Parameters:

TObjectRef – Type of the attribute

Parameters:
  • attr_key – The name of the attribute key

  • default_value – The value returned if the key is not present

Returns:

An optional, std::nullopt if not found, otherwise the value found

template<typename T>
inline ffi::Optional<T> GetAttr(ffi::reflection::AttrKey<T> key, ffi::Optional<typename ffi::reflection::AttrKey<T>::ValueType> default_value = std::nullopt) const#

Get an optional Target attribute using the value type declared by its key.

template<typename T>
inline ffi::Optional<T> GetAttr(ffi::reflection::AttrKey<T> key, typename ffi::reflection::AttrKey<T>::ValueType default_value) const#

Use a default value when the typed Target attribute is absent.

Public Members

TargetKind kind#

The kind of the target device.

ffi::Optional<ffi::ObjectRef> host#

Target host information, must be Target type.

ffi::String tag#

Tag of the target, can be empty.

ffi::Array<ffi::String> keys#

Keys for this target.

ffi::Map<ffi::String, Any> attrs#

Collection of attributes (includes feature.* keys set by canonicalizer).

Public Static Functions

static inline void RegisterReflection()#
static inline int32_t _GetOrAllocRuntimeTypeIndex()#
static inline int32_t RuntimeTypeIndex() noexcept#