Exemple #1
0
void crit_edge(int b1, int b2) {
    extern int some_func(int n);
    // Test that we can properly break a critical edge and insert a
    // sync that runs on just the right path.
    // In this program, there are CFG edges a->b, a->d, and c->d
    // and an RMC edge a->d. We want to insert a sync just between
    // a->d, but this is complicated by the existence of a->b and c->d
    // edges in the CFG: if we put the sync at the end of a, it runs
    // even when we go to b and if we put it at the start of d it runs
    // when we came from c. (That is, a->d is a "critical edge", since
    // its source node has multiple successors and its destination
    // node has multiple predecessors.)
    // The solution to this is to "break" the critical edge by adding
    // an empty basic block e in between a and d. We can then add the
    // sync into e.

    // It turns out that this is trivially easy to accomplish: LLVM
    // has a pass called "BreakCriticalEdges", and we make it a
    // dependency.

    XEDGE_HERE(a, d);
    if (b1) {
        L(a, some_func(0)); // a
        if (b2) {
            some_func(1); // b
            return;
        }
    } else {
        some_func(2); // c
    }
    L(d, some_func(3)); // d
}
Exemple #2
0
void test_sibling_scope (void)
{
  int a = 1;
  {
    int b = 2;
    some_func(); // BP_first
  }
  {
    short b = 3;
    some_func(); // BP_second
  }
}
Exemple #3
0
Fichier : macros.c Projet : bszcz/c
int main(void) {
	const int max = 3;
	fori(max) {
		forj(max) {
			printf("(%d, %d) ", i, j);
		}
		printf("\n");
	}
	printf("\n");

	some_func(max);
	printf("\n");

	const int i = 10;
	const float f = 1.0f;
	putl(i);
	putd(f);
	putl(10); // still works, sort of...

	putx(i);
	putx(f);

	print_vec2(vec(1.0, 2.0));
	print_vec3(vec(1.0, 2.0, 3.0));

	struct player p1 = player("Mario");
	struct player p2 = player("Luigi", .lives = 2); // -Winitializer-overrides warning
	print_player(p1);
	print_player(p2);
}
Exemple #4
0
int main(void)
{
	void *ptr;
	struct zr364xx_pipeinfo one;
	struct aa_policy two;
	aa_policy_t three;
	struct foo four;
	struct foo five;
	struct foo six;
	struct foo seven;
	struct foo eight;
	struct foo nine;

	p->a.x = 0;
	global_dec.x = 0;
	memset(&two, 0, sizeof(two));
	four.x = 0;
	six = five;
	some_func(&seven);
	eight.x = (four.x < 5 ? four.x : 5);
	eight.y = !five.y;
	if (some_func()) {
		nine.x = 1;
		nine.y = 2;
	}

	copy_to_user(ptr, &p->a, sizeof(struct aa_policy));
	copy_to_user(ptr, &global_dec, sizeof(struct global_dec));
	copy_to_user(ptr, &one, sizeof(one));
	copy_to_user(ptr, &two, sizeof(two));
	copy_to_user(ptr, &three, sizeof(three));
	copy_to_user(ptr, &four, sizeof(four));
	copy_to_user(ptr, &five, sizeof(five));
	copy_to_user(ptr, &six, sizeof(six));
	copy_to_user(ptr, &seven, sizeof(seven));
	copy_to_user(ptr, &eight, sizeof(eight));
	copy_to_user(ptr, &nine, sizeof(nine));
	return 0;
}
Exemple #5
0
void func (void)
{
	struct ture *ab;
	int ret = 0;

	if (b) {
		ret = -1;
		goto foo;
	}

	if (c) {}

	ab = some_func();
	if (NULL == ab) {
		ret = -1;
		goto foo;
	}
foo:
	if (ret) {
		return;
	}
	ab->a = 1;
}
Exemple #6
0
void main() {
	char* video_memory = 0xb8000;

	*video_memory = some_func();
}