src/codegen.c
static const char *
generateType(Type *type) {
  switch (type->type) {
    case TYP_S8:
    case TYP_U8:
    case TYP_S16:
    case TYP_U16:
    case TYP_S32:
    case TYP_U32:
    case TYP_BOOL:
    case TYP_INTLIT:
    case TYP_CHAR:
      return "w";
    case TYP_S64:
    case TYP_U64:
    case TYP_PTR:
    case TYP_FUN:
    case TYP_ARRAY:
      return "l";
    case TYP_VOID:
      return "";
    case TYP_BINDING:
      return generateType(type->typeEntry->data);
    case TYP_RECORD:
      printf("These types dont work yet.\n");
      exit(1);
  }
  assert(false);
  return NULL;
}
/* Generates either 'w' or 'l' for a given type, which are the only types that
 * QBE allows temporaries to have */
Generates either 'w' or 'l' for a given type, which are the only types that
QBE allows temporaries to have
Generates either ' w ' or ' l ' for a given type which are the only types that QBE allows temporaries to have
static const char *
generateType(Type *type) {
  switch (type->type) {
    case TYP_S8:
    case TYP_U8:
    case TYP_S16:
    case TYP_U16:
    case TYP_S32:
    case TYP_U32:
    case TYP_BOOL:
    case TYP_INTLIT:
    case TYP_CHAR:
      return "w";
    case TYP_S64:
    case TYP_U64:
    case TYP_PTR:
    case TYP_FUN:
    case TYP_ARRAY:
      return "l";
    case TYP_VOID:
      return "";
    case TYP_BINDING:
      return generateType(type->typeEntry->data);
    case TYP_RECORD:
      printf("These types dont work yet.\n");
      exit(1);
  }
  assert(false);
  return NULL;
}
static const char * generateType ( Type * type ) { switch ( type -> type ) { case TYP_S8 : case TYP_U8 : case TYP_S16 : case TYP_U16 : case TYP_S32 : case TYP_U32 : case TYP_BOOL : case TYP_INTLIT : case TYP_CHAR : return " " ; case TYP_S64 : case TYP_U64 : case TYP_PTR : case TYP_FUN : case TYP_ARRAY : return " " ; case TYP_VOID : return " " ; case TYP_BINDING : return generateType ( type -> typeEntry -> data ) ; case TYP_RECORD : printf ( " \n " ) ; exit ( 1 ) ; } assert ( false ) ; return NULL ; }
Generates either 'w' or 'l' for a given type, which are the only types that
 QBE allows temporaries to have
Generates either ' w ' or ' l ' for a given type which are the only types that QBE allows temporaries to have