Dominique Torette via llvm-dev
2018-Sep-28 08:58 UTC
[llvm-dev] ‘mayLoad’ and ‘mayStore’ attributes
Hi, I have a few short questions: I haven’t found any documentation on the purposes of the ‘mayLoad’ and ‘mayStore’ attributes of the .td file Instruction class... Have these attributes some effects on final instruction scheduling ? What is the concept of ‘load barrier’ ? References to articles will be welcome. TIA, Dominique T. [http://www.spacebel.be/wp-content/uploads/2011/06/image-sign-sbp.jpg] Dominique Torette System Architect Rue des Chasseurs Ardennais - Liège Science Park - B-4031 Angleur Tel: +32 (0) 4 361 81 11 - Fax: +32 (0) 4 361 81 20 www.spacebel.be<http://www.spacebel.be/> ------------------------------------------------------------------------------ E-MAIL DISCLAIMER The present message may contain confidential and/or legally privileged information. If you are not the intended addressee and in case of a transmission error, please notify the sender immediately and destroy this E-mail. Disclosure, reproduction or distribution of this document and its possible attachments is strictly forbidden. SPACEBEL denies all liability for incomplete, improper, inaccurate, intercepted, (partly) destroyed, lost and/or belated transmission of the current information given that unencrypted electronic transmission cannot currently be guaranteed to be secure or error free. Upon request or in conformity with formal, contractual agreements, an originally signed hard copy will be sent to you to confirm the information contained in this E-mail. SPACEBEL denies all liability where E-mail is used for private use. SPACEBEL cannot be held responsible for possible viruses that might corrupt this message and/or your computer system. ------------------------------------------------------------------------------- -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180928/3de8c4db/attachment-0001.html>
Hi Dominique, MayLoad/MayStore is a property that is true if the instruction could possibly read/write memory even if it is not just a simple load/store instruction. This is documented in llvm/include/llvm/CodeGen/MachineInstr.h: http://llvm.org/doxygen/classllvm_1_1MachineInstr.html#a682028ac4a06c9e3550fa8e6e1909fa9 Looking it functions referencing it, it does affect scheduling, e.g., whether instructions can be reordered or folded into others. Memory barriers or memory fences are part of a machine's and/or compilers memory model that define which operations (loads or stores in a single or different threads) may be reordered and in which way. A "load barrier" might mean an instruction within a CPU architecture that forces all memory stores to finish before the next load, but you'll have to consult the exact memory model of that CPU. For a compiler/LLVM, a "load barrier" might be an intrinsic limits which type of instruction reordering the compiler can do (and possibly also issue a memory fence instruction to tell the CPU the same). In general, for memory models I recommend: https://www.kernel.org/doc/Documentation/memory-barriers.txt for a general description and how it effects the Linux kernel https://en.cppreference.com/w/c/atomic/memory_order for how it relates to C code (the LLVM memory model tries to follow that I believe) http://releases.llvm.org/4.0.1/docs/LangRef.html#ordering for how LLVM specifically defines different memory orderings http://releases.llvm.org/4.0.1/docs/LangRef.html#fence-instruction The fence instruction might be the specific load barrier you asked about in LLVM IR Boldizsar Palotas From: Dominique Torette via llvm-dev <llvm-dev at lists.llvm.org> To: "llvm-dev at lists.llvm.org" <llvm-dev at lists.llvm.org> Date: 2018.09.28 10:59 Subject: [llvm-dev] ‘mayLoad’ and ‘mayStore’ attributes Sent by: "llvm-dev" <llvm-dev-bounces at lists.llvm.org> Hi, I have a few short questions: I haven’t found any documentation on the purposes of the ‘mayLoad’ and ‘mayStore’ attributes of the .td file Instruction class... Have these attributes some effects on final instruction scheduling ? What is the concept of ‘load barrier’ ? References to articles will be welcome. TIA, Dominique T. Dominique Torette System Architect Rue des Chasseurs Ardennais - Liège Science Park - B-4031 Angleur Tel: +32 (0) 4 361 81 11 - Fax: +32 (0) 4 361 81 20 www.spacebel.be ------------------------------------------------------------------------------ E-MAIL DISCLAIMER The present message may contain confidential and/or legally privileged information. If you are not the intended addressee and in case of a transmission error, please notify the sender immediately and destroy this E-mail. Disclosure, reproduction or distribution of this document and its possible attachments is strictly forbidden. SPACEBEL denies all liability for incomplete, improper, inaccurate, intercepted, (partly) destroyed, lost and/or belated transmission of the current information given that unencrypted electronic transmission cannot currently be guaranteed to be secure or error free. Upon request or in conformity with formal, contractual agreements, an originally signed hard copy will be sent to you to confirm the information contained in this E-mail. SPACEBEL denies all liability where E-mail is used for private use. SPACEBEL cannot be held responsible for possible viruses that might corrupt this message and/or your computer system. ------------------------------------------------------------------------------- _______________________________________________ LLVM Developers mailing list llvm-dev at lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev This message is intended only for the recipient(s) named above. It may contain proprietary information and/or protected content. Any unauthorised disclosure, use, retention or dissemination is prohibited. If you have received this e-mail in error, please notify the sender immediately. ESA applies appropriate organisational measures to protect personal data, in case of data privacy queries, please contact the ESA Data Protection Officer (dpo at esa.int). -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180928/c2831b5b/attachment.html>