Browse Source

+ add "thunk" attribute for stubs/thunks and emit it for LLVM
- also removed wrong "noreturn" attribute for interface thunks generated
for high level code generator targets

git-svn-id: trunk@43018 -

Jonas Maebe 5 years ago
parent
commit
9678542ba6

+ 2 - 0
compiler/llvm/agllvm.pas

@@ -1026,6 +1026,8 @@ implementation
             writer.AsmWrite(' nobuiltin');
           if po_noreturn in pd.procoptions then
             writer.AsmWrite(' noreturn');
+          if pio_thunk in pd.implprocoptions then
+            writer.AsmWrite(' "thunk"');
           if llvmflag_null_pointer_valid in llvmversion_properties[current_settings.llvmversion] then
             writer.AsmWrite(' "null-pointer-is-valid"="true"');
         end;

+ 1 - 1
compiler/ncgvmt.pas

@@ -1249,7 +1249,7 @@ implementation
                     wrapperpd:=create_procdef_alias(pd,tmps,tmps,
                       current_module.localsymtable,_class,
                       tsk_interface_wrapper,wrapperinfo);
-                    include(wrapperpd.procoptions,po_noreturn);
+                    include(wrapperpd.implprocoptions,pio_thunk);
 {$else cpuhighleveltarget}
                     oldfileposinfo:=current_filepos;
                     if pd.owner.iscurrentunit then

+ 1 - 0
compiler/psub.pas

@@ -2557,6 +2557,7 @@ implementation
                      if is_c_variadic(pd) then
                        Message1(parser_e_callthrough_varargs,pd.fullprocname(false));
                      call_through_new_name(pd,proc_get_importname(pd));
+                     include(pd.implprocoptions,pio_thunk);
                    end
                  else
 {$endif cpuhighleveltarget}

+ 3 - 1
compiler/symconst.pas

@@ -436,7 +436,9 @@ type
     { inline is not possible (has assembler block, etc) }
     pio_inline_not_possible,
     { a nested routine accesses a local variable from this routine }
-    pio_nested_access
+    pio_nested_access,
+    { a stub/thunk }
+    pio_thunk
   );
   timplprocoptions = set of timplprocoption;
 

+ 2 - 1
compiler/utils/ppuutils/ppudump.pp

@@ -3185,7 +3185,8 @@ const
     (mask:pio_empty; str:'IsEmpty'),
     (mask:pio_has_inlininginfo; str:'HasInliningInfo'),
     (mask:pio_inline_not_possible; str:'InlineNotPossible'),
-    (mask:pio_nested_access; str:'NestedAccess')
+    (mask:pio_nested_access; str:'NestedAccess'),
+    (mask:pio_thunk; str:'Thunk')
   );
 var
   i: timplprocoption;