[Hexagon] [NFC] Moving function implementations out of header. Clang-formatting files.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@223245 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Colin LeMahieu
2014-12-03 17:35:39 +00:00
parent 0f87df2033
commit d54ac604b3
2 changed files with 88 additions and 79 deletions

View File

@@ -18,13 +18,27 @@
using namespace llvm;
HexagonMCInst::HexagonMCInst()
: MCInst(), MCID(nullptr), packetBegin(0), packetEnd(0){};
HexagonMCInst::HexagonMCInst(MCInstrDesc const &mcid)
: MCInst(), MCID(&mcid), packetBegin(0), packetEnd(0){};
bool HexagonMCInst::isPacketBegin() const { return (packetBegin); };
bool HexagonMCInst::isPacketEnd() const { return (packetEnd); };
void HexagonMCInst::setPacketBegin(bool Y) { packetBegin = Y; };
void HexagonMCInst::setPacketEnd(bool Y) { packetEnd = Y; };
void HexagonMCInst::resetPacket() {
setPacketBegin(false);
setPacketEnd(false);
};
// Return the slots used by the insn.
unsigned HexagonMCInst::getUnits(const HexagonTargetMachine *TM) const {
const HexagonInstrInfo *QII = TM->getSubtargetImpl()->getInstrInfo();
const InstrItineraryData *II =
TM->getSubtargetImpl()->getInstrItineraryData();
const InstrStage*
IS = II->beginStage(QII->get(this->getOpcode()).getSchedClass());
const InstrStage *IS =
II->beginStage(QII->get(this->getOpcode()).getSchedClass());
return (IS->getUnits());
}
@@ -38,8 +52,7 @@ unsigned HexagonMCInst::getType() const {
// Return whether the insn is an actual insn.
bool HexagonMCInst::isCanon() const {
return (!MCID->isPseudo() &&
!isPrefix() &&
return (!MCID->isPseudo() && !isPrefix() &&
getType() != HexagonII::TypeENDLOOP);
}
@@ -69,8 +82,8 @@ bool HexagonMCInst::hasNewValue() const {
// Return the operand that consumes or produces a new value.
const MCOperand &HexagonMCInst::getNewValue() const {
const uint64_t F = MCID->TSFlags;
const unsigned O = (F >> HexagonII::NewValueOpPos) &
HexagonII::NewValueOpMask;
const unsigned O =
(F >> HexagonII::NewValueOpPos) & HexagonII::NewValueOpMask;
const MCOperand &MCO = getOperand(O);
assert((isNewValue() || hasNewValue()) && MCO.isReg());
@@ -141,18 +154,17 @@ unsigned short HexagonMCInst::getCExtOpNum(void) const {
// Return whether the operand can be constant extended.
bool HexagonMCInst::isOperandExtended(const unsigned short OperandNum) const {
const uint64_t F = MCID->TSFlags;
return ((F >> HexagonII::ExtendableOpPos) & HexagonII::ExtendableOpMask)
== OperandNum;
return ((F >> HexagonII::ExtendableOpPos) & HexagonII::ExtendableOpMask) ==
OperandNum;
}
// Return the min value that a constant extendable operand can have
// without being extended.
int HexagonMCInst::getMinValue(void) const {
const uint64_t F = MCID->TSFlags;
unsigned isSigned = (F >> HexagonII::ExtentSignedPos)
& HexagonII::ExtentSignedMask;
unsigned bits = (F >> HexagonII::ExtentBitsPos)
& HexagonII::ExtentBitsMask;
unsigned isSigned =
(F >> HexagonII::ExtentSignedPos) & HexagonII::ExtentSignedMask;
unsigned bits = (F >> HexagonII::ExtentBitsPos) & HexagonII::ExtentBitsMask;
if (isSigned) // if value is signed
return -1U << (bits - 1);
@@ -164,10 +176,9 @@ int HexagonMCInst::getMinValue(void) const {
// without being extended.
int HexagonMCInst::getMaxValue(void) const {
const uint64_t F = MCID->TSFlags;
unsigned isSigned = (F >> HexagonII::ExtentSignedPos)
& HexagonII::ExtentSignedMask;
unsigned bits = (F >> HexagonII::ExtentBitsPos)
& HexagonII::ExtentBitsMask;
unsigned isSigned =
(F >> HexagonII::ExtentSignedPos) & HexagonII::ExtentSignedMask;
unsigned bits = (F >> HexagonII::ExtentBitsPos) & HexagonII::ExtentBitsMask;
if (isSigned) // if value is signed
return ~(-1U << (bits - 1));

View File

@@ -30,16 +30,14 @@ namespace llvm {
unsigned packetBegin : 1, packetEnd : 1;
public:
explicit HexagonMCInst():
MCInst(), MCID(nullptr), packetBegin(0), packetEnd(0) {};
HexagonMCInst(const MCInstrDesc& mcid):
MCInst(), MCID(&mcid), packetBegin(0), packetEnd(0) {};
explicit HexagonMCInst();
HexagonMCInst(const MCInstrDesc &mcid);
bool isPacketBegin() const { return (packetBegin); };
bool isPacketEnd() const { return (packetEnd); };
void setPacketBegin(bool Y) { packetBegin = Y; };
void setPacketEnd(bool Y) { packetEnd = Y; };
void resetPacket() { setPacketBegin(false); setPacketEnd(false); };
bool isPacketBegin() const;
bool isPacketEnd() const;
void setPacketBegin(bool Y);
void setPacketEnd(bool Y);
void resetPacket();
// Return the slots used by the insn.
unsigned getUnits(const HexagonTargetMachine *TM) const;