Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
Intrinsics Namespace Reference

Classes

struct  Function
 
struct  Singleton
 

Functions

RUNTIME_API Runtime::ObjectInstancefind (const std::string &name, const IR::ObjectType &type)
 
RUNTIME_API std::vector< Runtime::ObjectInstance * > getAllIntrinsicObjects ()
 
std::string getDecoratedName (const std::string &name, const IR::ObjectType &type)
 

Function Documentation

◆ find()

Runtime::ObjectInstance * Intrinsics::find ( const std::string & name,
const IR::ObjectType & type )

Definition at line 48 of file Intrinsics.cpp.

49 {
50 std::string decoratedName = getDecoratedName(name,type);
51 Runtime::ObjectInstance* result = nullptr;
52 switch(type.kind)
53 {
55 {
56 auto keyValue = Singleton::get().functionMap.find(decoratedName);
57 result = keyValue == Singleton::get().functionMap.end() ? nullptr : asObject(keyValue->second->function);
58 break;
59 }
61 {
62 result = nullptr;
63 break;
64 }
66 {
67 result = nullptr;
68 break;
69 }
71 {
72 result = nullptr;
73 break;
74 }
75 default: Errors::unreachable();
76 };
77 if(result && !isA(result,type)) { result = nullptr; }
78 return result;
79 }
std::string name
void unreachable()
Definition Errors.h:22
std::string getDecoratedName(const std::string &name, const IR::ObjectType &type)
RUNTIME_API bool isA(ObjectInstance *object, const IR::ObjectType &type)
Definition Linker.cpp:15
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getAllIntrinsicObjects()

std::vector< Runtime::ObjectInstance * > Intrinsics::getAllIntrinsicObjects ( )

Definition at line 81 of file Intrinsics.cpp.

82 {
83 std::vector<Runtime::ObjectInstance*> result;
84 for(auto mapIt : Singleton::get().functionMap) { result.push_back(mapIt.second->function); }
85 return result;
86 }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDecoratedName()

std::string Intrinsics::getDecoratedName ( const std::string & name,
const IR::ObjectType & type )

Definition at line 25 of file Intrinsics.cpp.

26 {
27 std::string decoratedName = name;
28 decoratedName += " : ";
29 decoratedName += IR::asString(type);
30 return decoratedName;
31 }
std::string asString(I32 value)
Definition Types.h:50
Here is the call graph for this function:
Here is the caller graph for this function: