From 8aa797aa51cd4ea1ec6f46f4891a6897944b75b2 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 30 Dec 2007 23:10:15 +0000 Subject: Add new shorter predicates for testing machine operands for various types: e.g. MO.isMBB() instead of MO.isMachineBasicBlock(). I don't plan on switching everything over, so new clients should just start using the shorter names. Remove old long accessors, switching everything over to use the short accessor: getMachineBasicBlock() -> getMBB(), getConstantPoolIndex() -> getIndex(), setMachineBasicBlock -> setMBB(), etc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@45464 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/CodeGen/MachineOperand.h | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'include/llvm/CodeGen/MachineOperand.h') diff --git a/include/llvm/CodeGen/MachineOperand.h b/include/llvm/CodeGen/MachineOperand.h index a1c8350e15..3bcd53b05c 100644 --- a/include/llvm/CodeGen/MachineOperand.h +++ b/include/llvm/CodeGen/MachineOperand.h @@ -122,6 +122,15 @@ public: bool isGlobalAddress() const { return OpKind == MO_GlobalAddress; } bool isExternalSymbol() const { return OpKind == MO_ExternalSymbol; } + bool isReg() const { return OpKind == MO_Register; } + bool isImm() const { return OpKind == MO_Immediate; } + bool isMBB() const { return OpKind == MO_MachineBasicBlock; } + bool isFI() const { return OpKind == MO_FrameIndex; } + bool isCPI() const { return OpKind == MO_ConstantPoolIndex; } + bool isJTI() const { return OpKind == MO_JumpTableIndex; } + bool isGlobal() const { return OpKind == MO_GlobalAddress; } + bool isSymbol() const { return OpKind == MO_ExternalSymbol; } + //===--------------------------------------------------------------------===// // Accessors for Register Operands //===--------------------------------------------------------------------===// @@ -215,10 +224,6 @@ public: assert(isMachineBasicBlock() && "Wrong MachineOperand accessor"); return Contents.MBB; } - MachineBasicBlock *getMachineBasicBlock() const { - assert(isMachineBasicBlock() && "Wrong MachineOperand accessor"); - return Contents.MBB; - } int getIndex() const { assert((isFrameIndex() || isConstantPoolIndex() || isJumpTableIndex()) && @@ -226,19 +231,17 @@ public: return Contents.OffsetedInfo.Val.Index; } - int getFrameIndex() const { return getIndex(); } - unsigned getConstantPoolIndex() const { return getIndex(); } - unsigned getJumpTableIndex() const { return getIndex(); } - GlobalValue *getGlobal() const { assert(isGlobalAddress() && "Wrong MachineOperand accessor"); return Contents.OffsetedInfo.Val.GV; } + int getOffset() const { assert((isGlobalAddress() || isExternalSymbol() || isConstantPoolIndex()) && "Wrong MachineOperand accessor"); return Contents.OffsetedInfo.Offset; } + const char *getSymbolName() const { assert(isExternalSymbol() && "Wrong MachineOperand accessor"); return Contents.OffsetedInfo.Val.SymbolName; @@ -265,10 +268,7 @@ public: Contents.OffsetedInfo.Val.Index = Idx; } - void setConstantPoolIndex(unsigned Idx) { setIndex(Idx); } - void setJumpTableIndex(unsigned Idx) { setIndex(Idx); } - - void setMachineBasicBlock(MachineBasicBlock *MBB) { + void setMBB(MachineBasicBlock *MBB) { assert(isMachineBasicBlock() && "Wrong MachineOperand accessor"); Contents.MBB = MBB; } @@ -327,7 +327,7 @@ public: } static MachineOperand CreateMBB(MachineBasicBlock *MBB) { MachineOperand Op(MachineOperand::MO_MachineBasicBlock); - Op.setMachineBasicBlock(MBB); + Op.setMBB(MBB); return Op; } static MachineOperand CreateFI(unsigned Idx) { -- cgit v1.2.3