This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Tested on i686-linux, committed on trunk. This patch adds some new warnings to code statements. In particular if Volatile is not specified then a warning is given if two or more code statements appear in sequence, or if either Input or Output operands are not present. Here are examples (these are x86 specific) (compiled with -gnatlj60) 1. with System.Machine_Code; use System.Machine_Code; 2. function Exp1 (X : Long_Long_Float) return Long_Long_Float is 3. Result : Long_Long_Float := 0.0; 4. NL : constant Character := ASCII.LF; 5. begin 6. Asm (Template => | >>> warning: code statement with no inputs should usually be Volatile 7. "fldl2e " & NL 8. & "fscale ", 9. Inputs => No_Input_Operands, 10. Outputs => No_Output_Operands); 11. return Result; 12. end; 1. with System.Machine_Code; use System.Machine_Code; 2. function Exp3 (X : Long_Long_Float) return Long_Long_Float is 3. Result : Long_Long_Float; 4. NL : constant Character := ASCII.LF; 5. begin 6. Asm (Template => 7. "faddp %st, %st(1)", 8. Outputs => Long_Long_Float'Asm_Output ("=t", Result), 9. Inputs => Long_Long_Float'Asm_Input ("0", X)); 10. 11. Asm (Template => | >>> warning: code statements in sequence should usually be Volatile (suggest using template with multiple instructions) 12. "fmulp %st, %st(1)", 13. Outputs => Long_Long_Float'Asm_Output ("=t", Result), 14. Inputs => Long_Long_Float'Asm_Input ("0", X)); 15. return Result; 16. end Exp3; 2006-10-31 Robert Dewar <dewar@adacore.com> * s-osinte-tru64.adb: Mark Asm statements Volatile to prevent warnings (seems a reasonable change anyway) Fixes new warnings * s-mastop-irix.adb: Add Volatile to Asm statements Suppresses warning, and seems appropriate in any case * s-osinte-vms.adb: Add Volatile to Asm statement * s-vaflop-vms-alpha.adb: Add Volatile to Asm statements * exp_code.ads, exp_code.adb (Asm_Input_Value): Note that Error can be returned. Add call to Check_Code_Statement
Attachment:
difs
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |