Vector Optimized Library of Kernels  2.4
Architecture-tuned implementations of math kernels
list_cpu_features.c File Reference
#include <assert.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "cpu_features_macros.h"

Data Structures

struct  BumpAllocator
 
struct  Node
 

Macros

#define ALIGN   8
 
#define DEFINE_ADD_FLAGS(HasFeature, FeatureName, FeatureType, LastEnum)
 

Typedefs

typedef struct Node Node
 

Enumerations

enum  NodeType {
  NT_INVALID , NT_INT , NT_MAP , NT_MAP_ENTRY ,
  NT_ARRAY , NT_ARRAY_ELEMENT , NT_STRING
}
 

Functions

static void internal_error ()
 
static void assertAligned ()
 
static void BA_Align ()
 
static voidBA_Bump (size_t size)
 
static NodeBA_CreateNode (NodeType type)
 
static NodeCreateInt (int value)
 
static NodeCreateConstantString (const char *value)
 
static NodeCreateMap ()
 
static NodeCreateArray ()
 
static NodeCreatePrintfString (const char *format,...)
 
static NodeCreateString (const char *value)
 
static void AddMapEntry (Node *map, const char *key, Node *value)
 
static void AddArrayElement (Node *array, Node *value)
 
static int cmp (const void *p1, const void *p2)
 
static void printJsonString (const char *str)
 
static void printJson (const Node *current)
 
static void printTextField (const Node *current)
 
static void printTextRoot (const Node *current)
 
static void showUsage (const char *name)
 
static NodeGetCacheTypeString (CacheType cache_type)
 
static void AddCacheInfo (Node *root, const CacheInfo *cache_info)
 
static NodeCreateTree ()
 
int main (int argc, char **argv)
 

Variables

char gGlobalBuffer [64 *1024]
 
BumpAllocator gBumpAllocator
 

Macro Definition Documentation

◆ ALIGN

#define ALIGN   8

◆ DEFINE_ADD_FLAGS

#define DEFINE_ADD_FLAGS (   HasFeature,
  FeatureName,
  FeatureType,
  LastEnum 
)
Value:
static void AddFlags(Node* map, const FeatureType* features) { \
size_t i; \
const char* ptrs[LastEnum] = {0}; \
size_t count = 0; \
for (i = 0; i < LastEnum; ++i) { \
if (HasFeature(features, i)) { \
ptrs[count] = FeatureName(i); \
++count; \
} \
} \
qsort((void*)ptrs, count, sizeof(char*), cmp); \
Node* const array = CreateArray(); \
for (i = 0; i < count; ++i) \
AddMapEntry(map, "flags", array); \
}
static Node * CreateArray()
Definition: list_cpu_features.c:135
static int cmp(const void *p1, const void *p2)
Definition: list_cpu_features.c:171
static Node * CreateConstantString(const char *value)
Definition: list_cpu_features.c:125
static void AddArrayElement(Node *array, Node *value)
Definition: list_cpu_features.c:163
Definition: list_cpu_features.c:100
for i
Definition: volk_config_fixed.tmpl.h:25

Typedef Documentation

◆ Node

typedef struct Node Node

Enumeration Type Documentation

◆ NodeType

enum NodeType
Enumerator
NT_INVALID 
NT_INT 
NT_MAP 
NT_MAP_ENTRY 
NT_ARRAY 
NT_ARRAY_ELEMENT 
NT_STRING 

Function Documentation

◆ AddArrayElement()

static void AddArrayElement ( Node array,
Node value 
)
static

◆ AddCacheInfo()

static void AddCacheInfo ( Node root,
const CacheInfo cache_info 
)
static

◆ AddMapEntry()

static void AddMapEntry ( Node map,
const char *  key,
Node value 
)
static

◆ assertAligned()

static void assertAligned ( )
static

◆ BA_Align()

static void BA_Align ( )
static

◆ BA_Bump()

static void* BA_Bump ( size_t  size)
static

◆ BA_CreateNode()

static Node* BA_CreateNode ( NodeType  type)
static

◆ cmp()

static int cmp ( const void p1,
const void p2 
)
static

◆ CreateArray()

static Node* CreateArray ( )
static

◆ CreateConstantString()

static Node* CreateConstantString ( const char *  value)
static

◆ CreateInt()

static Node* CreateInt ( int  value)
static

◆ CreateMap()

static Node* CreateMap ( )
static

◆ CreatePrintfString()

static Node* CreatePrintfString ( const char *  format,
  ... 
)
static

◆ CreateString()

static Node* CreateString ( const char *  value)
static

◆ CreateTree()

static Node* CreateTree ( )
static

◆ GetCacheTypeString()

static Node* GetCacheTypeString ( CacheType  cache_type)
static

◆ internal_error()

static void internal_error ( )
static

◆ main()

int main ( int  argc,
char **  argv 
)

◆ printJson()

static void printJson ( const Node current)
static

◆ printJsonString()

static void printJsonString ( const char *  str)
static

◆ printTextField()

static void printTextField ( const Node current)
static

◆ printTextRoot()

static void printTextRoot ( const Node current)
static

◆ showUsage()

static void showUsage ( const char *  name)
static

Variable Documentation

◆ gBumpAllocator

BumpAllocator gBumpAllocator
Initial value:
= {.ptr = gGlobalBuffer,
.size = sizeof(gGlobalBuffer)}
char gGlobalBuffer[64 *1024]
Definition: list_cpu_features.c:53

◆ gGlobalBuffer

char gGlobalBuffer[64 *1024]