From d6488671736d0a5aaee1218748b94d8c68f33716 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 22 Jan 2005 18:58:51 +0000 Subject: Refactor code for numbering instructions into CodeGenTarget. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@19758 91177308-0d34-0410-b5e6-96231b3b80d8 --- utils/TableGen/CodeGenTarget.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'utils/TableGen/CodeGenTarget.cpp') diff --git a/utils/TableGen/CodeGenTarget.cpp b/utils/TableGen/CodeGenTarget.cpp index b9c8bdbb9f..cb241aaf95 100644 --- a/utils/TableGen/CodeGenTarget.cpp +++ b/utils/TableGen/CodeGenTarget.cpp @@ -198,6 +198,22 @@ const CodeGenInstruction &CodeGenTarget::getPHIInstruction() const { return I->second; } +/// getInstructionsByEnumValue - Return all of the instructions defined by the +/// target, ordered by their enum value. +void CodeGenTarget:: +getInstructionsByEnumValue(std::vector + &NumberedInstructions) { + + // Print out the rest of the instructions now. + unsigned i = 0; + const CodeGenInstruction *PHI = &getPHIInstruction(); + NumberedInstructions.push_back(PHI); + for (inst_iterator II = inst_begin(), E = inst_end(); II != E; ++II) + if (&II->second != PHI) + NumberedInstructions.push_back(&II->second); +} + + /// isLittleEndianEncoding - Return whether this target encodes its instruction /// in little-endian format, i.e. bits laid out in the order [0..n] /// -- cgit v1.2.3