diff options
author | Evan Cheng <evan.cheng@apple.com> | 2006-11-01 00:27:05 +0000 |
---|---|---|
committer | Evan Cheng <evan.cheng@apple.com> | 2006-11-01 00:27:05 +0000 |
commit | e2ba8975883874633a1035c245af3b948b940b25 (patch) | |
tree | c96cb0a2c458ddce539001e9f610df39969257df /include/llvm/Target/TargetInstrInfo.h | |
parent | 2f15c063baec25d337a8cd18cb8209e866b7845d (diff) | |
download | external_llvm-e2ba8975883874633a1035c245af3b948b940b25.zip external_llvm-e2ba8975883874633a1035c245af3b948b940b25.tar.gz external_llvm-e2ba8975883874633a1035c245af3b948b940b25.tar.bz2 |
Add operand constraints to TargetInstrInfo.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@31333 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Target/TargetInstrInfo.h')
-rw-r--r-- | include/llvm/Target/TargetInstrInfo.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/include/llvm/Target/TargetInstrInfo.h b/include/llvm/Target/TargetInstrInfo.h index b0ac41b..0098870 100644 --- a/include/llvm/Target/TargetInstrInfo.h +++ b/include/llvm/Target/TargetInstrInfo.h @@ -94,6 +94,9 @@ public: /// if the operand is a register. If not, this contains 0. unsigned short RegClass; unsigned short Flags; + /// Lower 16 bits are used to specify which constraints are set. The higher 16 + /// bits are used to specify the value of constraints (4 bits each). + unsigned int Constraints; /// Currently no other information. }; @@ -219,6 +222,24 @@ public: return get(Opcode).Flags & M_VARIABLE_OPS; } + // Operand constraints: only "tied_to" for now. + enum OperandConstraint { + TIED_TO = 0 // Must be allocated the same register as. + }; + + /// getOperandConstraint - Returns the value of the specific constraint if + /// it is set. Returns -1 if it is not set. + int getOperandConstraint(MachineOpCode Opcode, unsigned OpNum, + OperandConstraint Constraint) { + assert(OpNum < get(Opcode).numOperands && + "Invalid operand # of TargetInstrInfo"); + if (get(Opcode).OpInfo[OpNum].Constraints & (1 << Constraint)) { + unsigned Pos = 16 + Constraint * 4; + return (int)(get(Opcode).OpInfo[OpNum].Constraints >> Pos) & 0xf; + } + return -1; + } + /// getDWARF_LABELOpcode - Return the opcode of the target's DWARF_LABEL /// instruction if it has one. This is used by codegen passes that update /// DWARF line number info as they modify the code. |