Exemple #1
0
END_TEST

START_TEST(test_strip)
{
   ident_t a, b, c;

   a = ident_new("something");
   b = ident_new("thing");
   c = ident_strip(a, b);

   fail_if(c == NULL);
   fail_unless(c == ident_new("some"));

   a = ident_new("g");
   b = ident_new("cake");
   c = ident_strip(a, b);

   fail_unless(c == NULL);
}
Exemple #2
0
void cover_report(tree_t top, const int32_t *stmts)
{
   stmt_tag_i = ident_new("stmt_tag");

   tree_visit(top, cover_report_stmts_fn, (void *)stmts);

   ident_t name = ident_strip(tree_ident(top), ident_new(".elab"));

   char dir[256];
   snprintf(dir, sizeof(dir), "%s.cover", istr(name));

   lib_t work = lib_work();
   lib_mkdir(work, dir);

   for (cover_file_t *f = files; f != NULL; f = f->next)
      cover_report_file(f, dir);

   cover_index(name, dir);

   char output[PATH_MAX];
   lib_realpath(work, dir, output, sizeof(output));
   notef("coverage report generated in %s/", output);
}
Exemple #3
0
void jit_init(ident_t top)
{
   ident_t orig = ident_strip(top, ident_new(".elab"));
   ident_t final = ident_prefix(orig, ident_new("final"), '.');

   char bc_fname[64], so_fname[64];;
   snprintf(bc_fname, sizeof(bc_fname), "_%s.bc", istr(final));
#if defined __CYGWIN__
   snprintf(so_fname, sizeof(so_fname), "_%s.dll", istr(final));
#else
   snprintf(so_fname, sizeof(so_fname), "_%s.so", istr(final));
#endif

   char bc_path[PATH_MAX], so_path[PATH_MAX];
   lib_realpath(lib_work(), bc_fname, bc_path, sizeof(bc_path));
   lib_realpath(lib_work(), so_fname, so_path, sizeof(so_path));

   using_jit = (jit_mod_time(bc_path) > jit_mod_time(so_path));

   if (using_jit)
      jit_init_llvm(bc_path);
   else
      jit_init_native(so_path);
}