소스 검색

* sizeof(x), typeof(x): if "x" is typenode, request GOT for PIC because a global VMT label will be loaded.
* typeinfo(x): transform into rttinode (which does request GOT) during pass 1, so pass 2 is not needed.

git-svn-id: trunk@24798 -

sergei 12 년 전
부모
커밋
cc8772cf92
2개의 변경된 파일10개의 추가작업 그리고 13개의 파일을 삭제
  1. 1 6
      compiler/ncginl.pas
  2. 9 7
      compiler/ninl.pas

+ 1 - 6
compiler/ncginl.pas

@@ -451,13 +451,8 @@ implementation
                          TYPEINFO GENERIC HANDLING
 *****************************************************************************}
       procedure tcginlinenode.second_typeinfo;
-        var
-         href : treference;
         begin
-          location_reset(location,LOC_REGISTER,OS_ADDR);
-          location.register:=cg.getaddressregister(current_asmdata.CurrAsmList);
-          reference_reset_symbol(href,RTTIWriter.get_rtti_label(left.resultdef,fullrtti),0,sizeof(pint));
-          cg.a_loadaddr_ref_reg(current_asmdata.CurrAsmList,href,location.register);
+          internalerror(2013060301);
         end;
 
 

+ 9 - 7
compiler/ninl.pas

@@ -3277,14 +3277,14 @@ implementation
               firstpass(result);
             end;
 
-          in_sizeof_x:
-            begin
-              expectloc:=LOC_REGISTER;
-            end;
-
+          in_sizeof_x,
           in_typeof_x:
             begin
-               expectloc:=LOC_REGISTER;
+              expectloc:=LOC_REGISTER;
+              if (left.nodetype=typen) and
+                 (cs_create_pic in current_settings.moduleswitches) and
+                 (tf_pic_uses_got in target_info.flags) then
+                include(current_procinfo.flags,pi_needs_got);
             end;
 
           in_length_x:
@@ -3294,7 +3294,9 @@ implementation
 
           in_typeinfo_x:
             begin
-               expectloc:=LOC_REGISTER;
+              result:=caddrnode.create_internal(
+                crttinode.create(tstoreddef(left.resultdef),fullrtti,rdt_normal)
+              );
             end;
 
           in_assigned_x: