Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / lldb / test / API / lang / c / register_variables / test.c
blob2c69039d40a2639f60d4309350a0112aacba2cb4
1 #include <stdio.h>
3 #if defined(__arm__) || defined(__aarch64__) || defined (__mips__) || defined(__powerpc64__)
4 // Clang does not accept regparm attribute on these platforms.
5 // Fortunately, the default calling convention passes arguments in registers
6 // anyway.
7 #define REGPARM(N)
8 #else
9 #define REGPARM(N) __attribute__((regparm(N)))
10 #endif
12 struct bar {
13 int m1;
14 int m2;
17 void f1(int a, struct bar *b) __attribute__((noinline)) REGPARM(2);
18 void f1(int a, struct bar *b)
20 b->m2 = b->m1 + a; // set breakpoint here
23 void f2(struct bar *b) __attribute__((noinline)) REGPARM(1);
24 void f2(struct bar *b)
26 int c = b->m2;
27 printf("%d\n", c); // set breakpoint here
30 float f3() __attribute__((noinline));
31 float f3() {
32 return 3.14f;
35 int main()
37 struct bar myBar = { 3, 4 };
38 f1(2, &myBar);
39 f2(&myBar);
41 float f = f3();
42 printf("%f\n", f); // set breakpoint here
43 return 0;