From 36b5c1338a03453ba1c110b120269ca972fb65a3 Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Mon, 7 Apr 2008 19:35:22 +0000 Subject: [PATCH] Rename MemOperand to MachineMemOperand. This was suggested by review feedback from Chris quite a while ago. No functionality change. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@49348 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/CodeGen/MachineInstr.h | 14 +++++++------- include/llvm/CodeGen/MachineInstrBuilder.h | 2 +- .../CodeGen/{MemOperand.h => MachineMemOperand.h} | 16 ++++++++-------- include/llvm/CodeGen/ScheduleDAG.h | 2 +- include/llvm/CodeGen/SelectionDAG.h | 2 +- include/llvm/CodeGen/SelectionDAGNodes.h | 22 +++++++++++----------- lib/CodeGen/MachineInstr.cpp | 2 +- lib/CodeGen/SelectionDAG/ScheduleDAG.cpp | 4 ++-- lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 21 +++++++++++---------- lib/Target/PowerPC/PPCISelLowering.cpp | 4 ++-- lib/Target/X86/X86InstrInfo.cpp | 2 +- 11 files changed, 46 insertions(+), 45 deletions(-) rename include/llvm/CodeGen/{MemOperand.h => MachineMemOperand.h} (83%) diff --git a/include/llvm/CodeGen/MachineInstr.h b/include/llvm/CodeGen/MachineInstr.h index af4e8cea6e9..5dfe14cb623 100644 --- a/include/llvm/CodeGen/MachineInstr.h +++ b/include/llvm/CodeGen/MachineInstr.h @@ -17,7 +17,7 @@ #define LLVM_CODEGEN_MACHINEINSTR_H #include "llvm/CodeGen/MachineOperand.h" -#include "llvm/CodeGen/MemOperand.h" +#include "llvm/CodeGen/MachineMemOperand.h" namespace llvm { @@ -37,7 +37,7 @@ class MachineInstr { // are determined at construction time). std::vector Operands; // the operands - std::vector MemOperands; // information on memory references + std::vector MemOperands;// information on memory references MachineInstr *Prev, *Next; // Links for MBB's intrusive list. MachineBasicBlock *Parent; // Pointer to the owning basic block. @@ -100,11 +100,11 @@ public: /// Access to memory operands of the instruction unsigned getNumMemOperands() const { return MemOperands.size(); } - const MemOperand& getMemOperand(unsigned i) const { + const MachineMemOperand& getMemOperand(unsigned i) const { assert(i < getNumMemOperands() && "getMemOperand() out of range!"); return MemOperands[i]; } - MemOperand& getMemOperand(unsigned i) { + MachineMemOperand& getMemOperand(unsigned i) { assert(i < getNumMemOperands() && "getMemOperand() out of range!"); return MemOperands[i]; } @@ -268,9 +268,9 @@ public: /// void RemoveOperand(unsigned i); - /// addMemOperand - Add a MemOperand to the machine instruction, referencing - /// arbitrary storage. - void addMemOperand(const MemOperand &MO) { + /// addMemOperand - Add a MachineMemOperand to the machine instruction, + /// referencing arbitrary storage. + void addMemOperand(const MachineMemOperand &MO) { MemOperands.push_back(MO); } diff --git a/include/llvm/CodeGen/MachineInstrBuilder.h b/include/llvm/CodeGen/MachineInstrBuilder.h index 51900603ac9..748a9b40065 100644 --- a/include/llvm/CodeGen/MachineInstrBuilder.h +++ b/include/llvm/CodeGen/MachineInstrBuilder.h @@ -85,7 +85,7 @@ public: } /// addMemOperand - Add a memory operand to the machine instruction. - const MachineInstrBuilder &addMemOperand(const MemOperand &MO) const { + const MachineInstrBuilder &addMemOperand(const MachineMemOperand &MO) const { MI->addMemOperand(MO); return *this; } diff --git a/include/llvm/CodeGen/MemOperand.h b/include/llvm/CodeGen/MachineMemOperand.h similarity index 83% rename from include/llvm/CodeGen/MemOperand.h rename to include/llvm/CodeGen/MachineMemOperand.h index 296ed132fda..404de0689a0 100644 --- a/include/llvm/CodeGen/MemOperand.h +++ b/include/llvm/CodeGen/MachineMemOperand.h @@ -1,4 +1,4 @@ -//===-- llvm/CodeGen/MemOperand.h - MemOperand class ------------*- C++ -*-===// +//==- llvm/CodeGen/MachineMemOperand.h - MachineMemOperand class -*- C++ -*-==// // // The LLVM Compiler Infrastructure // @@ -7,7 +7,7 @@ // //===----------------------------------------------------------------------===// // -// This file contains the declaration of the MemOperand class, which is a +// This file contains the declaration of the MachineMemOperand class, which is a // description of a memory reference. It is used to help track dependencies // in the backend. // @@ -21,14 +21,14 @@ namespace llvm { class Value; //===----------------------------------------------------------------------===// -/// MemOperand - A description of a memory reference used in the backend. +/// MachineMemOperand - A description of a memory reference used in the backend. /// Instead of holding a StoreInst or LoadInst, this class holds the address /// Value of the reference along with a byte size and offset. This allows it /// to describe lowered loads and stores. Also, the special PseudoSourceValue /// objects can be used to represent loads and stores to memory locations /// that aren't explicit in the regular LLVM IR. /// -class MemOperand { +class MachineMemOperand { const Value *V; unsigned int Flags; int64_t Offset; @@ -46,10 +46,10 @@ public: MOVolatile = 4 }; - /// MemOperand - Construct an MemOperand object with the specified - /// address Value, flags, offset, size, and alignment. - MemOperand(const Value *v, unsigned int f, int64_t o, uint64_t s, - unsigned int a) + /// MachineMemOperand - Construct an MachineMemOperand object with the + /// specified address Value, flags, offset, size, and alignment. + MachineMemOperand(const Value *v, unsigned int f, int64_t o, uint64_t s, + unsigned int a) : V(v), Flags(f), Offset(o), Size(s), Alignment(a) {} /// getValue - Return the base address of the memory access. diff --git a/include/llvm/CodeGen/ScheduleDAG.h b/include/llvm/CodeGen/ScheduleDAG.h index 1649912f6a6..8c63aaf2822 100644 --- a/include/llvm/CodeGen/ScheduleDAG.h +++ b/include/llvm/CodeGen/ScheduleDAG.h @@ -365,7 +365,7 @@ namespace llvm { const TargetInstrDesc *II, DenseMap &VRBaseMap); - void AddMemOperand(MachineInstr *MI, const MemOperand &MO); + void AddMemOperand(MachineInstr *MI, const MachineMemOperand &MO); void EmitCrossRCCopy(SUnit *SU, DenseMap &VRBaseMap); diff --git a/include/llvm/CodeGen/SelectionDAG.h b/include/llvm/CodeGen/SelectionDAG.h index a77f8541341..2b8d678eb31 100644 --- a/include/llvm/CodeGen/SelectionDAG.h +++ b/include/llvm/CodeGen/SelectionDAG.h @@ -401,7 +401,7 @@ public: // getMemOperand - Construct a node to track a memory reference // through the backend. - SDOperand getMemOperand(const MemOperand &MO); + SDOperand getMemOperand(const MachineMemOperand &MO); /// UpdateNodeOperands - *Mutate* the specified node in-place to have the /// specified operands. If the resultant node already exists in the DAG, diff --git a/include/llvm/CodeGen/SelectionDAGNodes.h b/include/llvm/CodeGen/SelectionDAGNodes.h index 2ebabe51d92..6b2b8572c30 100644 --- a/include/llvm/CodeGen/SelectionDAGNodes.h +++ b/include/llvm/CodeGen/SelectionDAGNodes.h @@ -26,7 +26,7 @@ #include "llvm/ADT/APFloat.h" #include "llvm/ADT/APInt.h" #include "llvm/CodeGen/ValueTypes.h" -#include "llvm/CodeGen/MemOperand.h" +#include "llvm/CodeGen/MachineMemOperand.h" #include "llvm/Support/DataTypes.h" #include @@ -530,9 +530,9 @@ namespace ISD { // make reference to a value in the LLVM IR. SRCVALUE, - // MEMOPERAND - This is a node that contains a MemOperand which records - // information about a memory reference. This is used to make AliasAnalysis - // queries from the backend. + // MEMOPERAND - This is a node that contains a MachineMemOperand which + // records information about a memory reference. This is used to make + // AliasAnalysis queries from the backend. MEMOPERAND, // PCMARKER - This corresponds to the pcmarker intrinsic. @@ -1645,7 +1645,7 @@ public: }; -/// MemOperandSDNode - An SDNode that holds a MemOperand. This is +/// MemOperandSDNode - An SDNode that holds a MachineMemOperand. This is /// used to represent a reference to memory after ISD::LOAD /// and ISD::STORE have been lowered. /// @@ -1653,13 +1653,13 @@ class MemOperandSDNode : public SDNode { virtual void ANCHOR(); // Out-of-line virtual method to give class a home. protected: friend class SelectionDAG; - /// Create a MemOperand node - explicit MemOperandSDNode(const MemOperand &mo) + /// Create a MachineMemOperand node + explicit MemOperandSDNode(const MachineMemOperand &mo) : SDNode(ISD::MEMOPERAND, getSDVTList(MVT::Other)), MO(mo) {} public: - /// MO - The contained MemOperand. - const MemOperand MO; + /// MO - The contained MachineMemOperand. + const MachineMemOperand MO; static bool classof(const MemOperandSDNode *) { return true; } static bool classof(const SDNode *N) { @@ -1906,9 +1906,9 @@ public: /// isUnindexed - Return true if this is NOT a pre/post inc/dec load/store. bool isUnindexed() const { return AddrMode == ISD::UNINDEXED; } - /// getMemOperand - Return a MemOperand object describing the memory + /// getMemOperand - Return a MachineMemOperand object describing the memory /// reference performed by this load or store. - MemOperand getMemOperand() const; + MachineMemOperand getMemOperand() const; static bool classof(const LSBaseSDNode *N) { return true; } static bool classof(const SDNode *N) { diff --git a/lib/CodeGen/MachineInstr.cpp b/lib/CodeGen/MachineInstr.cpp index d2aa2bb2212..6c4fb3c8340 100644 --- a/lib/CodeGen/MachineInstr.cpp +++ b/lib/CodeGen/MachineInstr.cpp @@ -693,7 +693,7 @@ void MachineInstr::print(std::ostream &OS, const TargetMachine *TM) const { if (getNumMemOperands() > 0) { OS << ", Mem:"; for (unsigned i = 0; i < getNumMemOperands(); i++) { - const MemOperand &MRO = getMemOperand(i); + const MachineMemOperand &MRO = getMemOperand(i); const Value *V = MRO.getValue(); assert((MRO.isLoad() || MRO.isStore()) && diff --git a/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp b/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp index 00b5677879f..2af394fa8a8 100644 --- a/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp +++ b/lib/CodeGen/SelectionDAG/ScheduleDAG.cpp @@ -369,7 +369,7 @@ unsigned ScheduleDAG::CountResults(SDNode *Node) { unsigned ScheduleDAG::CountOperands(SDNode *Node) { unsigned N = ComputeMemOperandsEnd(Node); while (N && isa(Node->getOperand(N - 1).Val)) - --N; // Ignore MemOperand nodes + --N; // Ignore MEMOPERAND nodes return N; } @@ -656,7 +656,7 @@ void ScheduleDAG::AddOperand(MachineInstr *MI, SDOperand Op, } -void ScheduleDAG::AddMemOperand(MachineInstr *MI, const MemOperand &MO) { +void ScheduleDAG::AddMemOperand(MachineInstr *MI, const MachineMemOperand &MO) { MI->addMemOperand(MO); } diff --git a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp index a3a0c82e78a..a1d6c779b9b 100644 --- a/lib/CodeGen/SelectionDAG/SelectionDAG.cpp +++ b/lib/CodeGen/SelectionDAG/SelectionDAG.cpp @@ -385,7 +385,7 @@ static void AddNodeIDNode(FoldingSetNodeID &ID, SDNode *N) { ID.AddPointer(cast(N)->getValue()); break; case ISD::MEMOPERAND: { - const MemOperand &MO = cast(N)->MO; + const MachineMemOperand &MO = cast(N)->MO; ID.AddPointer(MO.getValue()); ID.AddInteger(MO.getFlags()); ID.AddInteger(MO.getOffset()); @@ -1014,7 +1014,7 @@ SDOperand SelectionDAG::getSrcValue(const Value *V) { return SDOperand(N, 0); } -SDOperand SelectionDAG::getMemOperand(const MemOperand &MO) { +SDOperand SelectionDAG::getMemOperand(const MachineMemOperand &MO) { const Value *v = MO.getValue(); assert((!v || isa(v->getType())) && "SrcValue is not a pointer?"); @@ -3635,24 +3635,25 @@ GlobalAddressSDNode::GlobalAddressSDNode(bool isTarget, const GlobalValue *GA, TheGlobal = const_cast(GA); } -/// getMemOperand - Return a MemOperand object describing the memory +/// getMemOperand - Return a MachineMemOperand object describing the memory /// reference performed by this load or store. -MemOperand LSBaseSDNode::getMemOperand() const { +MachineMemOperand LSBaseSDNode::getMemOperand() const { int Size = (MVT::getSizeInBits(getMemoryVT()) + 7) >> 3; int Flags = - getOpcode() == ISD::LOAD ? MemOperand::MOLoad : MemOperand::MOStore; - if (IsVolatile) Flags |= MemOperand::MOVolatile; + getOpcode() == ISD::LOAD ? MachineMemOperand::MOLoad : + MachineMemOperand::MOStore; + if (IsVolatile) Flags |= MachineMemOperand::MOVolatile; // Check if the load references a frame index, and does not have // an SV attached. const FrameIndexSDNode *FI = dyn_cast(getBasePtr().Val); if (!getSrcValue() && FI) - return MemOperand(PseudoSourceValue::getFixedStack(), Flags, - FI->getIndex(), Size, Alignment); + return MachineMemOperand(PseudoSourceValue::getFixedStack(), Flags, + FI->getIndex(), Size, Alignment); else - return MemOperand(getSrcValue(), Flags, - getSrcValueOffset(), Size, Alignment); + return MachineMemOperand(getSrcValue(), Flags, + getSrcValueOffset(), Size, Alignment); } /// Profile - Gather unique data for the node. diff --git a/lib/Target/PowerPC/PPCISelLowering.cpp b/lib/Target/PowerPC/PPCISelLowering.cpp index f3071845613..ddc8e1a7859 100644 --- a/lib/Target/PowerPC/PPCISelLowering.cpp +++ b/lib/Target/PowerPC/PPCISelLowering.cpp @@ -2500,8 +2500,8 @@ SDOperand PPCTargetLowering::LowerSINT_TO_FP(SDOperand Op, SelectionDAG &DAG) { Op.getOperand(0)); // STD the extended value into the stack slot. - MemOperand MO(PseudoSourceValue::getFixedStack(), - MemOperand::MOStore, FrameIdx, 8, 8); + MachineMemOperand MO(PseudoSourceValue::getFixedStack(), + MachineMemOperand::MOStore, FrameIdx, 8, 8); SDOperand Store = DAG.getNode(PPCISD::STD_32, MVT::Other, DAG.getEntryNode(), Ext64, FIdx, DAG.getMemOperand(MO)); diff --git a/lib/Target/X86/X86InstrInfo.cpp b/lib/Target/X86/X86InstrInfo.cpp index c9de586e78d..eaf58b39e28 100644 --- a/lib/Target/X86/X86InstrInfo.cpp +++ b/lib/Target/X86/X86InstrInfo.cpp @@ -1930,7 +1930,7 @@ MachineInstr* X86InstrInfo::foldMemoryOperand(MachineFunction &MF, unsigned Alignment = 0; for (unsigned i = 0, e = LoadMI->getNumMemOperands(); i != e; ++i) { - const MemOperand &MRO = LoadMI->getMemOperand(i); + const MachineMemOperand &MRO = LoadMI->getMemOperand(i); unsigned Align = MRO.getAlignment(); if (Align > Alignment) Alignment = Align; -- 2.11.0