summaryrefslogtreecommitdiff
path: root/utils/TableGen
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2010-10-07 16:56:28 +0000
committerJim Grosbach <grosbach@apple.com>2010-10-07 16:56:28 +0000
commit8b892ae3d6a23c2370ef64f6d4fe0a6abed94d39 (patch)
tree1fe0a455c860662d62d7652e553b8e99df09f251 /utils/TableGen
parent218c98c2848ef55607c729feb2c3d6d40ca504ae (diff)
downloadllvm-8b892ae3d6a23c2370ef64f6d4fe0a6abed94d39.tar.gz
llvm-8b892ae3d6a23c2370ef64f6d4fe0a6abed94d39.tar.bz2
llvm-8b892ae3d6a23c2370ef64f6d4fe0a6abed94d39.tar.xz
trailing whitespace
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@115923 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen')
-rw-r--r--utils/TableGen/CodeEmitterGen.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/utils/TableGen/CodeEmitterGen.cpp b/utils/TableGen/CodeEmitterGen.cpp
index ec702c2a5d..ac085120bf 100644
--- a/utils/TableGen/CodeEmitterGen.cpp
+++ b/utils/TableGen/CodeEmitterGen.cpp
@@ -42,7 +42,7 @@ void CodeEmitterGen::reverseBits(std::vector<Record*> &Insts) {
unsigned middle = (numBits + 1) / 2;
NewBI->setBit(middle, BI->getBit(middle));
}
-
+
// Update the bits in reversed order so that emitInstrOpBits will get the
// correct endianness.
R->getValue("Inst")->setValue(NewBI);
@@ -56,26 +56,26 @@ int CodeEmitterGen::getVariableBit(const std::string &VarName,
BitsInit *BI, int bit) {
if (VarBitInit *VBI = dynamic_cast<VarBitInit*>(BI->getBit(bit))) {
TypedInit *TI = VBI->getVariable();
-
+
if (VarInit *VI = dynamic_cast<VarInit*>(TI)) {
if (VI->getName() == VarName) return VBI->getBitNum();
}
}
-
+
return -1;
-}
+}
void CodeEmitterGen::run(raw_ostream &o) {
CodeGenTarget Target;
std::vector<Record*> Insts = Records.getAllDerivedDefinitions("Instruction");
-
+
// For little-endian instruction bit encodings, reverse the bit order
if (Target.isLittleEndianEncoding()) reverseBits(Insts);
EmitSourceFileHeader("Machine Code Emitter", o);
std::string Namespace = Insts[0]->getValueAsString("Namespace") + "::";
-
+
const std::vector<const CodeGenInstruction*> &NumberedInstructions =
Target.getInstructionsByEnumValue();
@@ -91,12 +91,12 @@ void CodeEmitterGen::run(raw_ostream &o) {
IN != EN; ++IN) {
const CodeGenInstruction *CGI = *IN;
Record *R = CGI->TheDef;
-
+
if (R->getValueAsString("Namespace") == "TargetOpcode") {
o << " 0U,\n";
continue;
}
-
+
BitsInit *BI = R->getValueAsBitsInit("Inst");
// Start by filling in fixed values...
@@ -109,10 +109,10 @@ void CodeEmitterGen::run(raw_ostream &o) {
o << " " << Value << "U," << '\t' << "// " << R->getName() << "\n";
}
o << " 0U\n };\n";
-
+
// Map to accumulate all the cases.
std::map<std::string, std::vector<std::string> > CaseMap;
-
+
// Construct all cases statement for each opcode
for (std::vector<Record*>::iterator IC = Insts.begin(), EC = Insts.end();
IC != EC; ++IC) {
@@ -125,7 +125,7 @@ void CodeEmitterGen::run(raw_ostream &o) {
BitsInit *BI = R->getValueAsBitsInit("Inst");
const std::vector<RecordVal> &Vals = R->getValues();
CodeGenInstruction &CGI = Target.getInstruction(R);
-
+
// Loop over all of the fields in the instruction, determining which are the
// operands to the instruction.
unsigned op = 0;
@@ -135,17 +135,17 @@ void CodeEmitterGen::run(raw_ostream &o) {
// instead of doing it bit-by-bit, saving a lot in runtime cost.
const std::string &VarName = Vals[i].getName();
bool gotOp = false;
-
+
for (int bit = BI->getNumBits()-1; bit >= 0; ) {
int varBit = getVariableBit(VarName, BI, bit);
-
+
if (varBit == -1) {
--bit;
} else {
int beginInstBit = bit;
int beginVarBit = varBit;
int N = 1;
-
+
for (--bit; bit >= 0;) {
varBit = getVariableBit(VarName, BI, bit);
if (varBit == -1 || varBit != (beginVarBit - N)) break;
@@ -158,18 +158,18 @@ void CodeEmitterGen::run(raw_ostream &o) {
/// emitter, skip it.
while (CGI.isFlatOperandNotEmitted(op))
++op;
-
+
Case += " // op: " + VarName + "\n"
+ " op = getMachineOpValue(MI, MI.getOperand("
+ utostr(op++) + "));\n";
gotOp = true;
}
-
+
unsigned opMask = ~0U >> (32-N);
int opShift = beginVarBit - N + 1;
opMask <<= opShift;
opShift = beginInstBit - beginVarBit;
-
+
if (opShift > 0) {
Case += " Value |= (op & " + utostr(opMask) + "U) << "
+ itostr(opShift) + ";\n";