X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=utils%2FTableGen%2FCodeEmitterGen.cpp;h=ae4a6aa445b1ca0f80316202f0a61b2f0751f8e5;hb=da71cf0ce95dae621ecd4e9cdb603b7b2d2ec33c;hp=557a8f4df9abfffb2d583f0ba7c232332b4b44e6;hpb=4406604047423576e36657c7ede266ca42e79642;p=oota-llvm.git diff --git a/utils/TableGen/CodeEmitterGen.cpp b/utils/TableGen/CodeEmitterGen.cpp index 557a8f4df9a..ae4a6aa445b 100644 --- a/utils/TableGen/CodeEmitterGen.cpp +++ b/utils/TableGen/CodeEmitterGen.cpp @@ -89,7 +89,7 @@ void CodeEmitterGen::run(std::ostream &o) { // Emit function declaration o << "unsigned " << Target.getName() << "CodeEmitter::" - << "getBinaryCodeForInstr(MachineInstr &MI) {\n"; + << "getBinaryCodeForInstr(const MachineInstr &MI) {\n"; // Emit instruction base values o << " static const unsigned InstBits[] = {\n"; @@ -100,8 +100,6 @@ void CodeEmitterGen::run(std::ostream &o) { const CodeGenInstruction *CGI = *IN; Record *R = CGI->TheDef; - if (IN != NumberedInstructions.begin()) o << ",\n"; - if (R->getName() == "PHI" || R->getName() == "INLINEASM" || R->getName() == "DBG_LABEL" || @@ -112,7 +110,7 @@ void CodeEmitterGen::run(std::ostream &o) { R->getName() == "INSERT_SUBREG" || R->getName() == "IMPLICIT_DEF" || R->getName() == "SUBREG_TO_REG") { - o << " 0U"; + o << " 0U,\n"; continue; } @@ -125,9 +123,9 @@ void CodeEmitterGen::run(std::ostream &o) { Value |= B->getValue() << (e-i-1); } } - o << " " << Value << "U"; + o << " " << Value << "U," << '\t' << "// " << R->getName() << "\n"; } - o << "\n };\n"; + o << " 0U\n };\n"; // Map to accumulate all the cases. std::map > CaseMap; @@ -193,7 +191,7 @@ void CodeEmitterGen::run(std::ostream &o) { gotOp = true; } - unsigned opMask = (1 << N) - 1; + unsigned opMask = ~0U >> (32-N); int opShift = beginVarBit - N + 1; opMask <<= opShift; opShift = beginInstBit - beginVarBit; @@ -220,7 +218,8 @@ void CodeEmitterGen::run(std::ostream &o) { // Emit initial function code o << " const unsigned opcode = MI.getOpcode();\n" << " unsigned Value = InstBits[opcode];\n" - << " unsigned op;\n" + << " unsigned op = 0;\n" + << " op = op; // suppress warning\n" << " switch (opcode) {\n"; // Emit each case statement