* Add option to read isLittleEndianEncoding for InstrInfo classes

* Doxygen-ify some function comments

llvm-svn: 16974
This commit is contained in:
Misha Brukman 2004-10-14 05:50:43 +00:00
parent 45c35b1d1f
commit 243ded5e1a
2 changed files with 13 additions and 0 deletions

View File

@ -188,6 +188,7 @@ void CodeGenTarget::ReadInstructions() const {
} }
/// getPHIInstruction - Return the designated PHI instruction. /// getPHIInstruction - Return the designated PHI instruction.
///
const CodeGenInstruction &CodeGenTarget::getPHIInstruction() const { const CodeGenInstruction &CodeGenTarget::getPHIInstruction() const {
Record *PHI = getInstructionSet()->getValueAsDef("PHIInst"); Record *PHI = getInstructionSet()->getValueAsDef("PHIInst");
std::map<std::string, CodeGenInstruction>::const_iterator I = std::map<std::string, CodeGenInstruction>::const_iterator I =
@ -197,6 +198,13 @@ const CodeGenInstruction &CodeGenTarget::getPHIInstruction() const {
return I->second; return I->second;
} }
/// isLittleEndianEncoding - Return whether this target encodes its instruction
/// in little-endian format, i.e. bits laid out in the order [0..n]
///
bool CodeGenTarget::isLittleEndianEncoding() const {
return getInstructionSet()->getValueAsBit("isLittleEndianEncoding");
}
CodeGenInstruction::CodeGenInstruction(Record *R, const std::string &AsmStr) CodeGenInstruction::CodeGenInstruction(Record *R, const std::string &AsmStr)
: TheDef(R), AsmString(AsmStr) { : TheDef(R), AsmString(AsmStr) {
Name = R->getValueAsString("Name"); Name = R->getValueAsString("Name");
@ -250,6 +258,7 @@ CodeGenInstruction::CodeGenInstruction(Record *R, const std::string &AsmStr)
/// getOperandNamed - Return the index of the operand with the specified /// getOperandNamed - Return the index of the operand with the specified
/// non-empty name. If the instruction does not have an operand with the /// non-empty name. If the instruction does not have an operand with the
/// specified name, throw an exception. /// specified name, throw an exception.
///
unsigned CodeGenInstruction::getOperandNamed(const std::string &Name) const { unsigned CodeGenInstruction::getOperandNamed(const std::string &Name) const {
assert(!Name.empty() && "Cannot search for operand with no name!"); assert(!Name.empty() && "Cannot search for operand with no name!");
for (unsigned i = 0, e = OperandList.size(); i != e; ++i) for (unsigned i = 0, e = OperandList.size(); i != e; ++i)

View File

@ -96,6 +96,10 @@ public:
/// getPHIInstruction - Return the designated PHI instruction. /// getPHIInstruction - Return the designated PHI instruction.
/// ///
const CodeGenInstruction &getPHIInstruction() const; const CodeGenInstruction &getPHIInstruction() const;
/// isLittleEndianEncoding - are instruction bit patterns defined as [0..n]?
///
bool isLittleEndianEncoding() const;
}; };
} // End llvm namespace } // End llvm namespace