Files
Pietro Fezzardi 6a4ce00ce9 InitModelTypes: improve types of void * variables
This commit adds a post-processing step to initModelTypes, to enable it
to better discover types of void * variables, by looking at their uses.

This is useful in scenarios like e.g.:

```c
struct s {
  int32_t x;
  int32_t y;
};

struct s* init() {
  void *result = calloc(SIZE, 1);
  *((int32_t *)(result)) = SOME_INIT_VALUE;
  *((int32_t *)( (uin64_t)(result) + 4) = OTHER_INIT_VALUE;
  return result;
```

This patch enables initModelTypes to look at uses of `result`, and to
enable other transformations that depend on initModelTypes (such as
MakeModelGEP, SwitchToStatements) to turn the above code into:

```c
struct s {
  int32_t x;
  int32_t y;
};

struct s* init() {
  struct s *result = calloc(SIZE, 1);
  result->x = SOME_INIT_VALUE;
  result->y = OTHER_INIT_VALUE;
  return result;
```
2025-03-05 12:22:30 +01:00
..
2024-11-21 10:50:55 +01:00