aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation/linear
diff options
authorLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2017-05-29 04:25:56 +0200
committerLuc Van Oostenryck <luc.vanoostenryck@gmail.com>2018-09-06 01:37:32 +0200
commit15fa4d60ebba3025495bb34f0718764336d3dfe0 (patch)
tree8181fe37ffeb90f76f72da3363ba97ff75cb084c /validation/linear
parent448a527590b1446f7625d8b3280eb94c9a757702 (diff)
downloadsparse-dev-15fa4d60ebba3025495bb34f0718764336d3dfe0.tar.gz
topasm: top-level asm is special
Top-level ASM statements are parsed as fake anonymous functions. Obviously, they have few in common with functions (for example, they don't have a return type) and mixing the two makes things more complicated than needed (for example, to detect a top-level ASM, we had to check that the corresponding symbol (name) had a null ident). Avoid potential problems by special casing them and return early in linearize_fn(). As consequence, they now don't have anymore an OP_ENTRY as first instructions and can be detected by testing ep->entry. Note: It would be more logical to catch them even erlier, in linearize_symbol() but they also need an entrypoint and an active BB so that we can generate the single statement. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com>
Diffstat (limited to 'validation/linear')
-rw-r--r--validation/linear/asm-toplevel.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/validation/linear/asm-toplevel.c b/validation/linear/asm-toplevel.c
new file mode 100644
index 00000000..8bdd7fc1
--- /dev/null
+++ b/validation/linear/asm-toplevel.c
@@ -0,0 +1,7 @@
+__asm__("/* nothing */");
+/*
+ * check-name: asm-toplevel.c
+ * check-command: test-linearize $file
+ * check-output-ignore
+ * check-output-contains: asm *".. nothing .."
+ */