[llvm-commits] [llvm] r53498 - in /llvm/trunk: include/llvm/CodeGen/MachineInstr.h lib/Target/X86/X86InstrInfo.cpp
Dan Gohman
gohman at apple.com
Fri Jul 11 17:10:52 PDT 2008
Author: djg
Date: Fri Jul 11 19:10:52 2008
New Revision: 53498
URL: http://llvm.org/viewvc/llvm-project?rev=53498&view=rev
Log:
Add a utility function to MachineInstr for testing whether an instruction
has exactly one MachineMemOperand, and change some X86 lowering code to
make use of it.
Modified:
llvm/trunk/include/llvm/CodeGen/MachineInstr.h
llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
Modified: llvm/trunk/include/llvm/CodeGen/MachineInstr.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/MachineInstr.h?rev=53498&r1=53497&r2=53498&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/MachineInstr.h (original)
+++ llvm/trunk/include/llvm/CodeGen/MachineInstr.h Fri Jul 11 19:10:52 2008
@@ -115,6 +115,13 @@
{ return MemOperands.end(); }
bool memoperands_empty() const { return MemOperands.empty(); }
+ /// hasOneMemOperand - Return true if this instruction has exactly one
+ /// MachineMemOperand.
+ bool hasOneMemOperand() const {
+ return !memoperands_empty() &&
+ next(memoperands_begin()) == memoperands_end();
+ }
+
/// isIdenticalTo - Return true if this instruction is identical to (same
/// opcode and same operands as) the specified instruction.
bool isIdenticalTo(const MachineInstr *Other) const {
Modified: llvm/trunk/lib/Target/X86/X86InstrInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrInfo.cpp?rev=53498&r1=53497&r2=53498&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrInfo.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86InstrInfo.cpp Fri Jul 11 19:10:52 2008
@@ -2030,14 +2030,10 @@
// Check switch flag
if (NoFusing) return NULL;
+ // Determine the alignment of the load.
unsigned Alignment = 0;
- for (alist<MachineMemOperand>::iterator i = LoadMI->memoperands_begin(),
- e = LoadMI->memoperands_end(); i != e; ++i) {
- const MachineMemOperand &MRO = *i;
- unsigned Align = MRO.getAlignment();
- if (Align > Alignment)
- Alignment = Align;
- }
+ if (LoadMI->hasOneMemOperand())
+ Alignment = LoadMI->memoperands_begin()->getAlignment();
// FIXME: Move alignment requirement into tables?
if (Alignment < 16) {
More information about the llvm-commits
mailing list