make dependency edge handling more robust
[libfirm] / include / libfirm / typerep.h
index 55e4f8a..e2bc6b2 100644 (file)
  */
 typedef enum {
        /**
-        * The entity is visible outside the compilation unit, but it is defined
-        * here.
+        * The entity is visible across compilation units. It might have an
+        * initializer/graph.
+        * Note that entities with visibility_external without initializer are
+        * assumed to be defined in another compilation unit (not like C variables
+        * which are considered 'uninitialized' in this case).
         */
-       ir_visibility_default,
+       ir_visibility_external,
        /**
         * The entity is local to the compilation unit.
         * A local entity is not visible in other compilation units.
@@ -103,18 +106,13 @@ typedef enum {
         */
        ir_visibility_local,
        /**
-        * The entity is defined outside the compilation unit but potentially used
-        * here.
-        */
-       ir_visibility_external,
-       /**
-        * This has the same semantic as visibility_local. Additionally the symbol is
-        * completely hidden from the linker (it only appears in the assembly).
+        * This has the same semantic as visibility_local. Additionally the symbol
+        * is completely hidden from the linker (it only appears in the assembly).
         * While visibility_local is probably still visible to debuggers,
         * visibility_private symbols aren't and probably won't appear in the object
         * files
         */
-       ir_visibility_private
+       ir_visibility_private,
 } ir_visibility;
 
 /**
@@ -157,7 +155,15 @@ typedef enum ir_linkage {
         * read/write behaviour to global variables or changing calling conventions
         * from cdecl to fastcall.
         */
-       IR_LINKAGE_HIDDEN_USER     = 1 << 4
+       IR_LINKAGE_HIDDEN_USER     = 1 << 4,
+       /**
+        * Do not generate code even if the entity has a graph attached. The graph
+        * is only used for inlining. Otherwise the entity is regarded as a
+        * declaration of an externally defined entity.
+        * This linkage flag can be used to implement C99 "inline" or GNU89
+        * "extern inline".
+        */
+       IR_LINKAGE_NO_CODEGEN      = 1 << 5,
 } ir_linkage;
 ENUM_BITSET(ir_linkage)
 
@@ -183,7 +189,8 @@ FIRM_API int entity_is_externally_visible(const ir_entity *entity);
 
 /**
  * Returns 1 if the entity has a definition (initializer) in the current
- * compilation unit
+ * compilation unit. Note that this function returns false if
+ * IR_LINKAGE_NO_CODEGEN is set even if a graph is present.
  */
 FIRM_API int entity_has_definition(const ir_entity *entity);