Ver Fonte

+ pic code reading for the assembler readers
* loadaddr generates pic code as well now

florian há 20 anos atrás
pai
commit
0811184277
2 ficheiros alterados com 62 adições e 6 exclusões
  1. 22 4
      compiler/x86/cgx86.pas
  2. 40 2
      compiler/x86/rax86att.pas

+ 22 - 4
compiler/x86/cgx86.pas

@@ -659,9 +659,23 @@ unit cgx86;
             begin
               if assigned(ref.symbol) then
                 begin
-                  tmpref:=ref;
-                  tmpref.refaddr:=ADDR_FULL;
-                  list.concat(Taicpu.op_ref_reg(A_MOV,tcgsize2opsize[OS_ADDR],tmpref,r));
+                  if cs_create_pic in aktmoduleswitches then
+                    begin
+{$ifdef x86_64}
+                      reference_reset_symbol(tmpref,ref.symbol,0);
+                      tmpref.refaddr:=addr_pic;
+                      tmpref.base:=NR_RIP;
+                      list.concat(taicpu.op_ref_reg(A_MOV,S_Q,tmpref,r));
+{$else x86_64}
+                      internalerror(2005042501);
+{$endif x86_64}
+                    end
+                  else
+                    begin
+                      tmpref:=ref;
+                      tmpref.refaddr:=ADDR_FULL;
+                      list.concat(Taicpu.op_ref_reg(A_MOV,tcgsize2opsize[OS_ADDR],tmpref,r));
+                    end;
                 end
               else
                 a_load_const_reg(list,OS_ADDR,offset,r);
@@ -1774,7 +1788,11 @@ unit cgx86;
 end.
 {
   $Log$
-  Revision 1.147  2005-03-13 17:15:26  florian
+  Revision 1.148  2005-04-25 09:51:07  florian
+    + pic code reading for the assembler readers
+    * loadaddr generates pic code as well now
+
+  Revision 1.147  2005/03/13 17:15:26  florian
     + storing non-extended floats to memory generates now a fwait to get exceptions at the correct place
 
   Revision 1.146  2005/02/14 17:13:10  peter

+ 40 - 2
compiler/x86/rax86att.pas

@@ -327,6 +327,11 @@ Implementation
           end;
 
 
+        procedure handleat;
+          begin
+          end;
+
+
         function MaybeBuildReference:boolean;
           { Try to create a reference, if not a reference is found then false
             is returned }
@@ -369,6 +374,19 @@ Implementation
                      BuildRecordOffsetSize(tempstr,l,k);
                      inc(oper.opr.ref.offset,l);
                    end;
+                  if actasmtoken=AS_AT then
+                    begin
+                      consume(AS_AT);
+                      if actasmtoken=AS_ID then
+                        begin
+                          if actasmpattern='GOTPCREL' then
+                            oper.opr.ref.refaddr:=addr_pic
+                          else
+                            Message(asmr_e_invalid_reference_syntax);
+                        end
+                      else
+                        Message(asmr_e_invalid_reference_syntax);
+                    end;
                   case actasmtoken of
                     AS_END,
                     AS_SEPARATOR,
@@ -486,7 +504,23 @@ Implementation
                      begin
                        if oper.SetupVar(expr,false) then
                         begin
-                        end
+                          if actasmtoken=AS_AT then
+                            begin
+                              consume(AS_AT);
+                              if actasmtoken=AS_ID then
+                                begin
+                                  if actasmpattern='GOTPCREL' then
+                                    begin
+                                      oper.opr.ref.refaddr:=addr_pic;
+                                      consume(AS_ID);
+                                    end
+                                  else
+                                    Message(asmr_e_invalid_reference_syntax);
+                                end
+                              else
+                                Message(asmr_e_invalid_reference_syntax);
+                            end;
+                          end
                        else
                         Begin
                           { look for special symbols ... }
@@ -775,7 +809,11 @@ Implementation
 end.
 {
   $Log$
-  Revision 1.10  2005-02-14 17:13:10  peter
+  Revision 1.11  2005-04-25 09:51:07  florian
+    + pic code reading for the assembler readers
+    * loadaddr generates pic code as well now
+
+  Revision 1.10  2005/02/14 17:13:10  peter
     * truncate log
 
 }