@@ -539,38 +539,38 @@ void ir_strtab_apply(const ir_strtab *strtab, ir_strtab_apply_t func);
539539void ir_strtab_free (ir_strtab * strtab );
540540
541541/* IR Context Flags */
542- #define IR_FUNCTION (1<<0) /* Generate a function. */
543- #define IR_FASTCALL_FUNC (1<<1) /* Generate a function with fastcall calling convention, x86 32-bit only. */
544- #define IR_VARARG_FUNC (1<<2)
545- #define IR_BUILTIN_FUNC (1<<3 )
546- #define IR_STATIC (1<<4 )
547- #define IR_EXTERN (1<<5 )
548- #define IR_CONST (1<<6)
549-
550- #define IR_CONST_FUNC (1<<6)
551- #define IR_PURE_FUNC (1<<7)
552-
553- #define IR_INITIALIZED (1<<7 ) /* sym data flag: constant or an initialized variable */
554- #define IR_CONST_STRING (1<<8) /* sym data flag: constant string */
555-
556- #define IR_SKIP_PROLOGUE (1<<8) /* Don't generate function prologue. */
557- #define IR_USE_FRAME_POINTER (1<<9 )
558- #define IR_PREALLOCATED_STACK (1<<10 )
559- #define IR_NO_STACK_COMBINE (1<<11 )
560- #define IR_START_BR_TARGET (1<<12)
561- #define IR_ENTRY_BR_TARGET (1<<13)
562- #define IR_GEN_ENDBR (1<<14)
563- #define IR_MERGE_EMPTY_ENTRIES (1<<15 )
564-
565- #define IR_OPT_INLINE (1<<16 )
566- #define IR_OPT_FOLDING (1<<17)
567- #define IR_OPT_CFG (1<<18) /* merge BBs, by remove END->BEGIN nodes during CFG construction */
568- #define IR_OPT_MEM2SSA (1<<19 )
569- #define IR_OPT_CODEGEN (1<<20)
570- #define IR_GEN_NATIVE (1<<21 )
571- #define IR_GEN_CODE (1<<22) /* C or LLVM */
572-
573- #define IR_GEN_CACHE_DEMOTE (1<<23) /* Demote the generated code from closest CPU caches */
542+ #define IR_PROTO_MASK 0xff
543+ #define IR_CALL_CONV_MASK 0x0f
544+
545+ #define IR_VARARG_FUNC (1<<4 )
546+ #define IR_CONST_FUNC (1<<5 )
547+ #define IR_PURE_FUNC (1<<6 )
548+
549+ #define IR_CONST (1<<5)
550+ #define IR_INITIALIZED (1<<6) /* sym data flag: constant or an initialized variable */
551+ #define IR_CONST_STRING (1<<7) /* sym data flag: constant string */
552+
553+ #define IR_FUNCTION (1<<8 ) /* Generate a function. */
554+ #define IR_STATIC (1<<9)
555+ #define IR_EXTERN (1<<10)
556+
557+ #define IR_USE_FRAME_POINTER (1<<11 )
558+ #define IR_NO_STACK_COMBINE (1<<12 )
559+ #define IR_GEN_ENDBR (1<<13 )
560+ #define IR_GEN_CACHE_DEMOTE (1<<14) /* Demote the generated code from closest CPU caches */
561+
562+ #define IR_SKIP_PROLOGUE (1<<15) /* Don't generate function prologue. */
563+ #define IR_START_BR_TARGET (1<<16 )
564+ #define IR_ENTRY_BR_TARGET (1<<17)
565+ #define IR_MERGE_EMPTY_ENTRIES (1<<18 )
566+
567+ #define IR_OPT_INLINE (1<<19)
568+ #define IR_OPT_FOLDING (1<<20 )
569+ #define IR_OPT_CFG (1<<21) /* merge BBs, by remove END->BEGIN nodes during CFG construction */
570+ #define IR_OPT_MEM2SSA (1<<22 )
571+ #define IR_OPT_CODEGEN (1<<23)
572+ #define IR_GEN_NATIVE (1<<24)
573+ #define IR_GEN_CODE (1<<25)
574574
575575/* debug related */
576576#ifdef IR_DEBUG
@@ -582,6 +582,24 @@ void ir_strtab_free(ir_strtab *strtab);
582582# define IR_DEBUG_BB_SCHEDULE (1U<<31)
583583#endif
584584
585+ /* Calling Conventions */
586+ #define IR_CC_DEFAULT 0x00
587+ #define IR_CC_BUILTIN 0x01
588+ #define IR_CC_FASTCALL 0x02
589+ #define IR_CC_PRESERVE_NONE 0x03
590+
591+ #if defined(IR_TARGET_X64 )
592+ # define IR_CC_X86_64_SYSV 0x08
593+ # define IR_CC_X86_64_MS 0x09
594+ #elif defined(IR_TARGET_AARCH64 )
595+ # define IR_CC_AARCH64_SYSV 0x08
596+ # define IR_CC_AARCH64_DARWIN 0x09
597+ #endif
598+
599+ /* Deprecated constants */
600+ #define IR_BUILTIN_FUNC IR_CC_BUILTIN
601+ #define IR_FASTCALL_FUNC IR_CC_FASTCALL
602+
585603typedef struct _ir_ctx ir_ctx ;
586604typedef struct _ir_use_list ir_use_list ;
587605typedef struct _ir_block ir_block ;
@@ -728,7 +746,7 @@ const char *ir_get_strl(const ir_ctx *ctx, ir_ref idx, size_t *len);
728746#define IR_MAX_PROTO_PARAMS 255
729747
730748typedef struct _ir_proto_t {
731- uint8_t flags ;
749+ uint8_t flags ; /* first 8 bits of ir_ctx.flags */
732750 uint8_t ret_type ;
733751 uint8_t params_count ;
734752 uint8_t param_types [5 ];
0 commit comments