Refactor AtomicExpandPass and add a generic isAtomic() method to Instruction
authorRobin Morisset <morisset@google.com>
Wed, 3 Sep 2014 21:29:59 +0000 (21:29 +0000)
committerRobin Morisset <morisset@google.com>
Wed, 3 Sep 2014 21:29:59 +0000 (21:29 +0000)
commit1ad925ccf8608266326b82c26144e2e67dff33af
tree71250df720280c66e84256fd3f8b4a85231f7b5c
parentf0644b42a7947d5a4a57682b10edce631a80f36b
Refactor AtomicExpandPass and add a generic isAtomic() method to Instruction

Summary:
Split shouldExpandAtomicInIR() into different versions for Stores/Loads/RMWs/CmpXchgs.
Makes runOnFunction cleaner (no more redundant checking/casting), and will help moving
the X86 backend to this pass.

This requires a way of easily detecting which instructions are atomic.
I followed the pattern of mayReadFromMemory, mayWriteOrReadMemory, etc.. in making
isAtomic() a method of Instruction implemented by a switch on the opcodes.

Test Plan: make check

Reviewers: jfb

Subscribers: mcrosier, llvm-commits

Differential Revision: http://reviews.llvm.org/D5035

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@217080 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/IR/Instruction.h
include/llvm/IR/Instructions.h
include/llvm/Target/TargetLowering.h
lib/CodeGen/AtomicExpandPass.cpp
lib/IR/Instruction.cpp
lib/Target/AArch64/AArch64ISelLowering.cpp
lib/Target/AArch64/AArch64ISelLowering.h
lib/Target/ARM/ARMISelLowering.cpp
lib/Target/ARM/ARMISelLowering.h