diff options
author | Chris Lattner <sabre@nondot.org> | 2007-12-30 23:10:15 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-12-30 23:10:15 +0000 |
commit | 8aa797aa51cd4ea1ec6f46f4891a6897944b75b2 (patch) | |
tree | e0a02ef069161c19c6e91b8cdca0640b53d29db9 /include/llvm/CodeGen/MachineOperand.h | |
parent | 78d34664e7935a3c0e8f0fc7a345b94314a1b3b8 (diff) |
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
Diffstat (limited to 'include/llvm/CodeGen/MachineOperand.h')
-rw-r--r-- | include/llvm/CodeGen/MachineOperand.h | 26 |
1 files changed, 13 insertions, 13 deletions
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) { |