Home | History | Annotate | Download | only in IR
      1 /// Attribute base class.
      2 class Attr<string S> {
      3   // String representation of this attribute in the IR.
      4   string AttrString = S;
      5 }
      6 
      7 /// Enum attribute.
      8 class EnumAttr<string S> : Attr<S>;
      9 
     10 /// StringBool attribute.
     11 class StrBoolAttr<string S> : Attr<S>;
     12 
     13 /// Target-independent enum attributes.
     14 
     15 /// Alignment of parameter (5 bits) stored as log2 of alignment with +1 bias.
     16 /// 0 means unaligned (different from align(1)).
     17 def Alignment : EnumAttr<"align">;
     18 
     19 /// inline=always.
     20 def AlwaysInline : EnumAttr<"alwaysinline">;
     21 
     22 /// Function can access memory only using pointers based on its arguments.
     23 def ArgMemOnly : EnumAttr<"argmemonly">;
     24 
     25 /// Callee is recognized as a builtin, despite nobuiltin attribute on its
     26 /// declaration.
     27 def Builtin : EnumAttr<"builtin">;
     28 
     29 /// Pass structure by value.
     30 def ByVal : EnumAttr<"byval">;
     31 
     32 /// Marks function as being in a cold path.
     33 def Cold : EnumAttr<"cold">;
     34 
     35 /// Can only be moved to control-equivalent blocks.
     36 def Convergent : EnumAttr<"convergent">;
     37 
     38 /// Pointer is known to be dereferenceable.
     39 def Dereferenceable : EnumAttr<"dereferenceable">;
     40 
     41 /// Pointer is either null or dereferenceable.
     42 def DereferenceableOrNull : EnumAttr<"dereferenceable_or_null">;
     43 
     44 /// Function may only access memory that is inaccessible from IR.
     45 def InaccessibleMemOnly : EnumAttr<"inaccessiblememonly">;
     46 
     47 /// Function may only access memory that is either inaccessible from the IR,
     48 /// or pointed to by its pointer arguments.
     49 def InaccessibleMemOrArgMemOnly : EnumAttr<"inaccessiblemem_or_argmemonly">;
     50 
     51 /// Pass structure in an alloca.
     52 def InAlloca : EnumAttr<"inalloca">;
     53 
     54 /// Source said inlining was desirable.
     55 def InlineHint : EnumAttr<"inlinehint">;
     56 
     57 /// Force argument to be passed in register.
     58 def InReg : EnumAttr<"inreg">;
     59 
     60 /// Build jump-instruction tables and replace refs.
     61 def JumpTable : EnumAttr<"jumptable">;
     62 
     63 /// Function must be optimized for size first.
     64 def MinSize : EnumAttr<"minsize">;
     65 
     66 /// Naked function.
     67 def Naked : EnumAttr<"naked">;
     68 
     69 /// Nested function static chain.
     70 def Nest : EnumAttr<"nest">;
     71 
     72 /// Considered to not alias after call.
     73 def NoAlias : EnumAttr<"noalias">;
     74 
     75 /// Callee isn't recognized as a builtin.
     76 def NoBuiltin : EnumAttr<"nobuiltin">;
     77 
     78 /// Function creates no aliases of pointer.
     79 def NoCapture : EnumAttr<"nocapture">;
     80 
     81 /// Call cannot be duplicated.
     82 def NoDuplicate : EnumAttr<"noduplicate">;
     83 
     84 /// Disable implicit floating point insts.
     85 def NoImplicitFloat : EnumAttr<"noimplicitfloat">;
     86 
     87 /// inline=never.
     88 def NoInline : EnumAttr<"noinline">;
     89 
     90 /// Function is called early and/or often, so lazy binding isn't worthwhile.
     91 def NonLazyBind : EnumAttr<"nonlazybind">;
     92 
     93 /// Pointer is known to be not null.
     94 def NonNull : EnumAttr<"nonnull">;
     95 
     96 /// The function does not recurse.
     97 def NoRecurse : EnumAttr<"norecurse">;
     98 
     99 /// Disable redzone.
    100 def NoRedZone : EnumAttr<"noredzone">;
    101 
    102 /// Mark the function as not returning.
    103 def NoReturn : EnumAttr<"noreturn">;
    104 
    105 /// Function doesn't unwind stack.
    106 def NoUnwind : EnumAttr<"nounwind">;
    107 
    108 /// opt_size.
    109 def OptimizeForSize : EnumAttr<"optsize">;
    110 
    111 /// Function must not be optimized.
    112 def OptimizeNone : EnumAttr<"optnone">;
    113 
    114 /// Function does not access memory.
    115 def ReadNone : EnumAttr<"readnone">;
    116 
    117 /// Function only reads from memory.
    118 def ReadOnly : EnumAttr<"readonly">;
    119 
    120 /// Return value is always equal to this argument.
    121 def Returned : EnumAttr<"returned">;
    122 
    123 /// Function can return twice.
    124 def ReturnsTwice : EnumAttr<"returns_twice">;
    125 
    126 /// Safe Stack protection.
    127 def SafeStack : EnumAttr<"safestack">;
    128 
    129 /// Sign extended before/after call.
    130 def SExt : EnumAttr<"signext">;
    131 
    132 /// Alignment of stack for function (3 bits)  stored as log2 of alignment with
    133 /// +1 bias 0 means unaligned (different from alignstack=(1)).
    134 def StackAlignment : EnumAttr<"alignstack">;
    135 
    136 /// Stack protection.
    137 def StackProtect : EnumAttr<"ssp">;
    138 
    139 /// Stack protection required.
    140 def StackProtectReq : EnumAttr<"sspreq">;
    141 
    142 /// Strong Stack protection.
    143 def StackProtectStrong : EnumAttr<"sspstrong">;
    144 
    145 /// Hidden pointer to structure to return.
    146 def StructRet : EnumAttr<"sret">;
    147 
    148 /// AddressSanitizer is on.
    149 def SanitizeAddress : EnumAttr<"sanitize_address">;
    150 
    151 /// ThreadSanitizer is on.
    152 def SanitizeThread : EnumAttr<"sanitize_thread">;
    153 
    154 /// MemorySanitizer is on.
    155 def SanitizeMemory : EnumAttr<"sanitize_memory">;
    156 
    157 /// Function must be in a unwind table.
    158 def UWTable : EnumAttr<"uwtable">;
    159 
    160 /// Zero extended before/after call.
    161 def ZExt : EnumAttr<"zeroext">;
    162 
    163 /// Target-independent string attributes.
    164 def LessPreciseFPMAD : StrBoolAttr<"less-precise-fpmad">;
    165 def NoInfsFPMath : StrBoolAttr<"no-infs-fp-math">;
    166 def NoNansFPMath : StrBoolAttr<"no-nans-fp-math">;
    167 def UnsafeFPMath : StrBoolAttr<"unsafe-fp-math">;
    168