Chris Lattner | c9670ef | 2003-07-31 04:43:49 +0000 | [diff] [blame] | 1 | //===- CodeEmitterGen.cpp - Code Emitter Generator ------------------------===// |
Misha Brukman | 3da94ae | 2005-04-22 00:00:37 +0000 | [diff] [blame] | 2 | // |
John Criswell | 01d4582 | 2003-10-20 20:20:30 +0000 | [diff] [blame] | 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
Chris Lattner | 3060910 | 2007-12-29 20:37:13 +0000 | [diff] [blame] | 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
Misha Brukman | 3da94ae | 2005-04-22 00:00:37 +0000 | [diff] [blame] | 7 | // |
John Criswell | 01d4582 | 2003-10-20 20:20:30 +0000 | [diff] [blame] | 8 | //===----------------------------------------------------------------------===// |
Chris Lattner | c9670ef | 2003-07-31 04:43:49 +0000 | [diff] [blame] | 9 | // |
Misha Brukman | 4e4f863 | 2004-08-04 22:07:54 +0000 | [diff] [blame] | 10 | // CodeEmitterGen uses the descriptions of instructions and their fields to |
| 11 | // construct an automated code emitter: a function that, given a MachineInstr, |
| 12 | // returns the (currently, 32-bit unsigned) value of the instruction. |
Chris Lattner | c9670ef | 2003-07-31 04:43:49 +0000 | [diff] [blame] | 13 | // |
| 14 | //===----------------------------------------------------------------------===// |
| 15 | |
Misha Brukman | 9fff7e1 | 2003-05-24 00:15:53 +0000 | [diff] [blame] | 16 | #include "CodeEmitterGen.h" |
Misha Brukman | d7a5b28 | 2004-08-09 19:10:43 +0000 | [diff] [blame] | 17 | #include "CodeGenTarget.h" |
Chris Lattner | c9670ef | 2003-07-31 04:43:49 +0000 | [diff] [blame] | 18 | #include "Record.h" |
Jim Laskey | f1b05bf | 2006-07-13 21:02:53 +0000 | [diff] [blame] | 19 | #include "llvm/ADT/StringExtras.h" |
Reid Spencer | 551ccae | 2004-09-01 22:55:40 +0000 | [diff] [blame] | 20 | #include "llvm/Support/Debug.h" |
Chris Lattner | 2082ebe | 2004-08-01 03:55:39 +0000 | [diff] [blame] | 21 | using namespace llvm; |
Brian Gaeke | d0fde30 | 2003-11-11 22:41:34 +0000 | [diff] [blame] | 22 | |
Jim Laskey | f1b05bf | 2006-07-13 21:02:53 +0000 | [diff] [blame] | 23 | void CodeEmitterGen::reverseBits(std::vector<Record*> &Insts) { |
| 24 | for (std::vector<Record*>::iterator I = Insts.begin(), E = Insts.end(); |
| 25 | I != E; ++I) { |
| 26 | Record *R = *I; |
Jim Laskey | a683f9b | 2007-01-26 17:29:20 +0000 | [diff] [blame] | 27 | if (R->getName() == "PHI" || |
| 28 | R->getName() == "INLINEASM" || |
Dan Gohman | 4406604 | 2008-07-01 00:05:16 +0000 | [diff] [blame] | 29 | R->getName() == "DBG_LABEL" || |
| 30 | R->getName() == "EH_LABEL" || |
| 31 | R->getName() == "GC_LABEL" || |
Jakob Stoklund Olesen | 26207e5 | 2009-09-28 20:32:26 +0000 | [diff] [blame] | 32 | R->getName() == "KILL" || |
Christopher Lamb | 08d5207 | 2007-07-26 07:48:21 +0000 | [diff] [blame] | 33 | R->getName() == "EXTRACT_SUBREG" || |
Evan Cheng | da47e6e | 2008-03-15 00:03:38 +0000 | [diff] [blame] | 34 | R->getName() == "INSERT_SUBREG" || |
Christopher Lamb | c929823 | 2008-03-16 03:12:01 +0000 | [diff] [blame] | 35 | R->getName() == "IMPLICIT_DEF" || |
Dan Gohman | f8c7394 | 2009-04-13 15:38:05 +0000 | [diff] [blame] | 36 | R->getName() == "SUBREG_TO_REG" || |
Dale Johannesen | 87563b3 | 2010-01-08 23:51:25 +0000 | [diff] [blame] | 37 | R->getName() == "COPY_TO_REGCLASS" || |
Dale Johannesen | 243a32f | 2010-01-15 01:50:44 +0000 | [diff] [blame] | 38 | R->getName() == "DEBUG_VALUE") continue; |
Dan Gohman | f8c7394 | 2009-04-13 15:38:05 +0000 | [diff] [blame] | 39 | |
Jim Laskey | f1b05bf | 2006-07-13 21:02:53 +0000 | [diff] [blame] | 40 | BitsInit *BI = R->getValueAsBitsInit("Inst"); |
Misha Brukman | 28eefa5 | 2004-10-14 05:53:01 +0000 | [diff] [blame] | 41 | |
Jim Laskey | f1b05bf | 2006-07-13 21:02:53 +0000 | [diff] [blame] | 42 | unsigned numBits = BI->getNumBits(); |
| 43 | BitsInit *NewBI = new BitsInit(numBits); |
| 44 | for (unsigned bit = 0, end = numBits / 2; bit != end; ++bit) { |
| 45 | unsigned bitSwapIdx = numBits - bit - 1; |
| 46 | Init *OrigBit = BI->getBit(bit); |
| 47 | Init *BitSwap = BI->getBit(bitSwapIdx); |
| 48 | NewBI->setBit(bit, BitSwap); |
| 49 | NewBI->setBit(bitSwapIdx, OrigBit); |
Misha Brukman | 28eefa5 | 2004-10-14 05:53:01 +0000 | [diff] [blame] | 50 | } |
Jim Laskey | f1b05bf | 2006-07-13 21:02:53 +0000 | [diff] [blame] | 51 | if (numBits % 2) { |
| 52 | unsigned middle = (numBits + 1) / 2; |
| 53 | NewBI->setBit(middle, BI->getBit(middle)); |
| 54 | } |
| 55 | |
| 56 | // Update the bits in reversed order so that emitInstrOpBits will get the |
| 57 | // correct endianness. |
| 58 | R->getValue("Inst")->setValue(NewBI); |
Misha Brukman | 28eefa5 | 2004-10-14 05:53:01 +0000 | [diff] [blame] | 59 | } |
| 60 | } |
| 61 | |
| 62 | |
Jim Laskey | cb12903 | 2006-07-13 22:17:08 +0000 | [diff] [blame] | 63 | // If the VarBitInit at position 'bit' matches the specified variable then |
| 64 | // return the variable bit position. Otherwise return -1. |
Dan Gohman | 9b03da6 | 2009-12-15 20:21:44 +0000 | [diff] [blame] | 65 | int CodeEmitterGen::getVariableBit(const std::string &VarName, |
Jim Laskey | cb12903 | 2006-07-13 22:17:08 +0000 | [diff] [blame] | 66 | BitsInit *BI, int bit) { |
Jim Laskey | f1b05bf | 2006-07-13 21:02:53 +0000 | [diff] [blame] | 67 | if (VarBitInit *VBI = dynamic_cast<VarBitInit*>(BI->getBit(bit))) { |
| 68 | TypedInit *TI = VBI->getVariable(); |
Dan Gohman | 9b03da6 | 2009-12-15 20:21:44 +0000 | [diff] [blame] | 69 | |
| 70 | if (VarInit *VI = dynamic_cast<VarInit*>(TI)) { |
| 71 | if (VI->getName() == VarName) return VBI->getBitNum(); |
| 72 | } |
Jim Laskey | f1b05bf | 2006-07-13 21:02:53 +0000 | [diff] [blame] | 73 | } |
| 74 | |
| 75 | return -1; |
| 76 | } |
| 77 | |
| 78 | |
Daniel Dunbar | 1a55180 | 2009-07-03 00:10:29 +0000 | [diff] [blame] | 79 | void CodeEmitterGen::run(raw_ostream &o) { |
Misha Brukman | e2ba778 | 2004-08-10 18:31:01 +0000 | [diff] [blame] | 80 | CodeGenTarget Target; |
Chris Lattner | 048c00d | 2003-08-01 04:38:18 +0000 | [diff] [blame] | 81 | std::vector<Record*> Insts = Records.getAllDerivedDefinitions("Instruction"); |
Jim Laskey | f1b05bf | 2006-07-13 21:02:53 +0000 | [diff] [blame] | 82 | |
| 83 | // For little-endian instruction bit encodings, reverse the bit order |
| 84 | if (Target.isLittleEndianEncoding()) reverseBits(Insts); |
Misha Brukman | 9fff7e1 | 2003-05-24 00:15:53 +0000 | [diff] [blame] | 85 | |
Chris Lattner | 0e5e49e | 2003-08-06 04:36:35 +0000 | [diff] [blame] | 86 | EmitSourceFileHeader("Machine Code Emitter", o); |
Misha Brukman | e2ba778 | 2004-08-10 18:31:01 +0000 | [diff] [blame] | 87 | std::string Namespace = Insts[0]->getValueAsString("Namespace") + "::"; |
Jim Laskey | ed39343 | 2006-07-12 19:15:43 +0000 | [diff] [blame] | 88 | |
| 89 | std::vector<const CodeGenInstruction*> NumberedInstructions; |
| 90 | Target.getInstructionsByEnumValue(NumberedInstructions); |
Misha Brukman | 9fff7e1 | 2003-05-24 00:15:53 +0000 | [diff] [blame] | 91 | |
Misha Brukman | ad346ad | 2004-08-10 20:54:58 +0000 | [diff] [blame] | 92 | // Emit function declaration |
Misha Brukman | e2ba778 | 2004-08-10 18:31:01 +0000 | [diff] [blame] | 93 | o << "unsigned " << Target.getName() << "CodeEmitter::" |
Evan Cheng | acff339 | 2008-09-02 06:51:36 +0000 | [diff] [blame] | 94 | << "getBinaryCodeForInstr(const MachineInstr &MI) {\n"; |
Misha Brukman | ad346ad | 2004-08-10 20:54:58 +0000 | [diff] [blame] | 95 | |
Jim Laskey | ed39343 | 2006-07-12 19:15:43 +0000 | [diff] [blame] | 96 | // Emit instruction base values |
| 97 | o << " static const unsigned InstBits[] = {\n"; |
| 98 | for (std::vector<const CodeGenInstruction*>::iterator |
| 99 | IN = NumberedInstructions.begin(), |
| 100 | EN = NumberedInstructions.end(); |
| 101 | IN != EN; ++IN) { |
| 102 | const CodeGenInstruction *CGI = *IN; |
| 103 | Record *R = CGI->TheDef; |
Chris Lattner | 188454a | 2006-01-27 01:39:38 +0000 | [diff] [blame] | 104 | |
Jim Laskey | a683f9b | 2007-01-26 17:29:20 +0000 | [diff] [blame] | 105 | if (R->getName() == "PHI" || |
| 106 | R->getName() == "INLINEASM" || |
Dan Gohman | 4406604 | 2008-07-01 00:05:16 +0000 | [diff] [blame] | 107 | R->getName() == "DBG_LABEL" || |
| 108 | R->getName() == "EH_LABEL" || |
| 109 | R->getName() == "GC_LABEL" || |
Jakob Stoklund Olesen | 26207e5 | 2009-09-28 20:32:26 +0000 | [diff] [blame] | 110 | R->getName() == "KILL" || |
Christopher Lamb | 08d5207 | 2007-07-26 07:48:21 +0000 | [diff] [blame] | 111 | R->getName() == "EXTRACT_SUBREG" || |
Evan Cheng | da47e6e | 2008-03-15 00:03:38 +0000 | [diff] [blame] | 112 | R->getName() == "INSERT_SUBREG" || |
Christopher Lamb | c929823 | 2008-03-16 03:12:01 +0000 | [diff] [blame] | 113 | R->getName() == "IMPLICIT_DEF" || |
Dan Gohman | f8c7394 | 2009-04-13 15:38:05 +0000 | [diff] [blame] | 114 | R->getName() == "SUBREG_TO_REG" || |
Dale Johannesen | 87563b3 | 2010-01-08 23:51:25 +0000 | [diff] [blame] | 115 | R->getName() == "COPY_TO_REGCLASS" || |
Dale Johannesen | 243a32f | 2010-01-15 01:50:44 +0000 | [diff] [blame] | 116 | R->getName() == "DEBUG_VALUE") { |
Evan Cheng | bc95b23 | 2008-09-17 06:29:52 +0000 | [diff] [blame] | 117 | o << " 0U,\n"; |
Jim Laskey | ed39343 | 2006-07-12 19:15:43 +0000 | [diff] [blame] | 118 | continue; |
| 119 | } |
| 120 | |
Chris Lattner | 6f334ad | 2003-08-01 04:46:24 +0000 | [diff] [blame] | 121 | BitsInit *BI = R->getValueAsBitsInit("Inst"); |
Misha Brukman | 9fff7e1 | 2003-05-24 00:15:53 +0000 | [diff] [blame] | 122 | |
Misha Brukman | 9fff7e1 | 2003-05-24 00:15:53 +0000 | [diff] [blame] | 123 | // Start by filling in fixed values... |
Reid Spencer | fa3e3b9 | 2006-11-03 01:48:30 +0000 | [diff] [blame] | 124 | unsigned Value = 0; |
Misha Brukman | cbfde0a | 2003-05-27 22:19:58 +0000 | [diff] [blame] | 125 | for (unsigned i = 0, e = BI->getNumBits(); i != e; ++i) { |
| 126 | if (BitInit *B = dynamic_cast<BitInit*>(BI->getBit(e-i-1))) { |
| 127 | Value |= B->getValue() << (e-i-1); |
Misha Brukman | cbfde0a | 2003-05-27 22:19:58 +0000 | [diff] [blame] | 128 | } |
| 129 | } |
Evan Cheng | bc95b23 | 2008-09-17 06:29:52 +0000 | [diff] [blame] | 130 | o << " " << Value << "U," << '\t' << "// " << R->getName() << "\n"; |
Jim Laskey | ed39343 | 2006-07-12 19:15:43 +0000 | [diff] [blame] | 131 | } |
Evan Cheng | bc95b23 | 2008-09-17 06:29:52 +0000 | [diff] [blame] | 132 | o << " 0U\n };\n"; |
Jim Laskey | f1b05bf | 2006-07-13 21:02:53 +0000 | [diff] [blame] | 133 | |
| 134 | // Map to accumulate all the cases. |
| 135 | std::map<std::string, std::vector<std::string> > CaseMap; |
| 136 | |
| 137 | // Construct all cases statement for each opcode |
| 138 | for (std::vector<Record*>::iterator IC = Insts.begin(), EC = Insts.end(); |
| 139 | IC != EC; ++IC) { |
| 140 | Record *R = *IC; |
| 141 | const std::string &InstName = R->getName(); |
| 142 | std::string Case(""); |
Jim Laskey | ed39343 | 2006-07-12 19:15:43 +0000 | [diff] [blame] | 143 | |
Jim Laskey | a683f9b | 2007-01-26 17:29:20 +0000 | [diff] [blame] | 144 | if (InstName == "PHI" || |
| 145 | InstName == "INLINEASM" || |
Dan Gohman | 4406604 | 2008-07-01 00:05:16 +0000 | [diff] [blame] | 146 | InstName == "DBG_LABEL"|| |
| 147 | InstName == "EH_LABEL"|| |
| 148 | InstName == "GC_LABEL"|| |
Jakob Stoklund Olesen | 26207e5 | 2009-09-28 20:32:26 +0000 | [diff] [blame] | 149 | InstName == "KILL"|| |
Christopher Lamb | 08d5207 | 2007-07-26 07:48:21 +0000 | [diff] [blame] | 150 | InstName == "EXTRACT_SUBREG" || |
Evan Cheng | da47e6e | 2008-03-15 00:03:38 +0000 | [diff] [blame] | 151 | InstName == "INSERT_SUBREG" || |
Christopher Lamb | c929823 | 2008-03-16 03:12:01 +0000 | [diff] [blame] | 152 | InstName == "IMPLICIT_DEF" || |
Dan Gohman | f8c7394 | 2009-04-13 15:38:05 +0000 | [diff] [blame] | 153 | InstName == "SUBREG_TO_REG" || |
Dale Johannesen | 87563b3 | 2010-01-08 23:51:25 +0000 | [diff] [blame] | 154 | InstName == "COPY_TO_REGCLASS" || |
Dale Johannesen | 243a32f | 2010-01-15 01:50:44 +0000 | [diff] [blame] | 155 | InstName == "DEBUG_VALUE") continue; |
Dan Gohman | f8c7394 | 2009-04-13 15:38:05 +0000 | [diff] [blame] | 156 | |
Jim Laskey | ed39343 | 2006-07-12 19:15:43 +0000 | [diff] [blame] | 157 | BitsInit *BI = R->getValueAsBitsInit("Inst"); |
| 158 | const std::vector<RecordVal> &Vals = R->getValues(); |
Chris Lattner | f64f9a4 | 2006-11-15 23:23:02 +0000 | [diff] [blame] | 159 | CodeGenInstruction &CGI = Target.getInstruction(InstName); |
| 160 | |
Misha Brukman | 28eefa5 | 2004-10-14 05:53:01 +0000 | [diff] [blame] | 161 | // Loop over all of the fields in the instruction, determining which are the |
Misha Brukman | 3da94ae | 2005-04-22 00:00:37 +0000 | [diff] [blame] | 162 | // operands to the instruction. |
Misha Brukman | cbfde0a | 2003-05-27 22:19:58 +0000 | [diff] [blame] | 163 | unsigned op = 0; |
Misha Brukman | 9fff7e1 | 2003-05-24 00:15:53 +0000 | [diff] [blame] | 164 | for (unsigned i = 0, e = Vals.size(); i != e; ++i) { |
Misha Brukman | 28eefa5 | 2004-10-14 05:53:01 +0000 | [diff] [blame] | 165 | if (!Vals[i].getPrefix() && !Vals[i].getValue()->isComplete()) { |
Misha Brukman | 7eac476 | 2003-07-15 21:00:32 +0000 | [diff] [blame] | 166 | // Is the operand continuous? If so, we can just mask and OR it in |
Misha Brukman | 3da94ae | 2005-04-22 00:00:37 +0000 | [diff] [blame] | 167 | // instead of doing it bit-by-bit, saving a lot in runtime cost. |
Dan Gohman | 9b03da6 | 2009-12-15 20:21:44 +0000 | [diff] [blame] | 168 | const std::string &VarName = Vals[i].getName(); |
Jim Laskey | f1b05bf | 2006-07-13 21:02:53 +0000 | [diff] [blame] | 169 | bool gotOp = false; |
| 170 | |
| 171 | for (int bit = BI->getNumBits()-1; bit >= 0; ) { |
Dan Gohman | 9b03da6 | 2009-12-15 20:21:44 +0000 | [diff] [blame] | 172 | int varBit = getVariableBit(VarName, BI, bit); |
Jim Laskey | f1b05bf | 2006-07-13 21:02:53 +0000 | [diff] [blame] | 173 | |
| 174 | if (varBit == -1) { |
| 175 | --bit; |
| 176 | } else { |
| 177 | int beginInstBit = bit; |
| 178 | int beginVarBit = varBit; |
| 179 | int N = 1; |
| 180 | |
| 181 | for (--bit; bit >= 0;) { |
Dan Gohman | 9b03da6 | 2009-12-15 20:21:44 +0000 | [diff] [blame] | 182 | varBit = getVariableBit(VarName, BI, bit); |
Jim Laskey | f1b05bf | 2006-07-13 21:02:53 +0000 | [diff] [blame] | 183 | if (varBit == -1 || varBit != (beginVarBit - N)) break; |
| 184 | ++N; |
| 185 | --bit; |
Chris Lattner | d7efef9 | 2003-08-05 03:53:04 +0000 | [diff] [blame] | 186 | } |
Misha Brukman | 3da94ae | 2005-04-22 00:00:37 +0000 | [diff] [blame] | 187 | |
Jim Laskey | f1b05bf | 2006-07-13 21:02:53 +0000 | [diff] [blame] | 188 | if (!gotOp) { |
Chris Lattner | f64f9a4 | 2006-11-15 23:23:02 +0000 | [diff] [blame] | 189 | /// If this operand is not supposed to be emitted by the generated |
| 190 | /// emitter, skip it. |
| 191 | while (CGI.isFlatOperandNotEmitted(op)) |
| 192 | ++op; |
| 193 | |
Dan Gohman | 9b03da6 | 2009-12-15 20:21:44 +0000 | [diff] [blame] | 194 | Case += " // op: " + VarName + "\n" |
Jim Laskey | f1b05bf | 2006-07-13 21:02:53 +0000 | [diff] [blame] | 195 | + " op = getMachineOpValue(MI, MI.getOperand(" |
Chris Lattner | f64f9a4 | 2006-11-15 23:23:02 +0000 | [diff] [blame] | 196 | + utostr(op++) + "));\n"; |
Jim Laskey | f1b05bf | 2006-07-13 21:02:53 +0000 | [diff] [blame] | 197 | gotOp = true; |
| 198 | } |
| 199 | |
Chris Lattner | 1cfa077 | 2008-10-05 18:31:58 +0000 | [diff] [blame] | 200 | unsigned opMask = ~0U >> (32-N); |
Jim Laskey | f1b05bf | 2006-07-13 21:02:53 +0000 | [diff] [blame] | 201 | int opShift = beginVarBit - N + 1; |
| 202 | opMask <<= opShift; |
| 203 | opShift = beginInstBit - beginVarBit; |
| 204 | |
| 205 | if (opShift > 0) { |
| 206 | Case += " Value |= (op & " + utostr(opMask) + "U) << " |
| 207 | + itostr(opShift) + ";\n"; |
| 208 | } else if (opShift < 0) { |
| 209 | Case += " Value |= (op & " + utostr(opMask) + "U) >> " |
| 210 | + itostr(-opShift) + ";\n"; |
| 211 | } else { |
| 212 | Case += " Value |= op & " + utostr(opMask) + "U;\n"; |
| 213 | } |
Chris Lattner | d7efef9 | 2003-08-05 03:53:04 +0000 | [diff] [blame] | 214 | } |
Misha Brukman | 7eac476 | 2003-07-15 21:00:32 +0000 | [diff] [blame] | 215 | } |
Misha Brukman | 9fff7e1 | 2003-05-24 00:15:53 +0000 | [diff] [blame] | 216 | } |
| 217 | } |
| 218 | |
Chris Lattner | f64f9a4 | 2006-11-15 23:23:02 +0000 | [diff] [blame] | 219 | std::vector<std::string> &InstList = CaseMap[Case]; |
Jim Laskey | f1b05bf | 2006-07-13 21:02:53 +0000 | [diff] [blame] | 220 | InstList.push_back(InstName); |
| 221 | } |
Misha Brukman | 9fff7e1 | 2003-05-24 00:15:53 +0000 | [diff] [blame] | 222 | |
Jim Laskey | f1b05bf | 2006-07-13 21:02:53 +0000 | [diff] [blame] | 223 | |
| 224 | // Emit initial function code |
| 225 | o << " const unsigned opcode = MI.getOpcode();\n" |
| 226 | << " unsigned Value = InstBits[opcode];\n" |
Evan Cheng | e3e3626 | 2008-09-07 09:00:57 +0000 | [diff] [blame] | 227 | << " unsigned op = 0;\n" |
Evan Cheng | acff339 | 2008-09-02 06:51:36 +0000 | [diff] [blame] | 228 | << " op = op; // suppress warning\n" |
Jim Laskey | f1b05bf | 2006-07-13 21:02:53 +0000 | [diff] [blame] | 229 | << " switch (opcode) {\n"; |
| 230 | |
| 231 | // Emit each case statement |
| 232 | std::map<std::string, std::vector<std::string> >::iterator IE, EE; |
| 233 | for (IE = CaseMap.begin(), EE = CaseMap.end(); IE != EE; ++IE) { |
| 234 | const std::string &Case = IE->first; |
| 235 | std::vector<std::string> &InstList = IE->second; |
| 236 | |
| 237 | for (int i = 0, N = InstList.size(); i < N; i++) { |
| 238 | if (i) o << "\n"; |
| 239 | o << " case " << Namespace << InstList[i] << ":"; |
| 240 | } |
| 241 | o << " {\n"; |
| 242 | o << Case; |
Misha Brukman | 9fff7e1 | 2003-05-24 00:15:53 +0000 | [diff] [blame] | 243 | o << " break;\n" |
| 244 | << " }\n"; |
| 245 | } |
Misha Brukman | 7eac476 | 2003-07-15 21:00:32 +0000 | [diff] [blame] | 246 | |
Misha Brukman | 28eefa5 | 2004-10-14 05:53:01 +0000 | [diff] [blame] | 247 | // Default case: unhandled opcode |
Misha Brukman | cbfde0a | 2003-05-27 22:19:58 +0000 | [diff] [blame] | 248 | o << " default:\n" |
Torok Edwin | 804e0fe | 2009-07-08 19:04:27 +0000 | [diff] [blame] | 249 | << " std::string msg;\n" |
| 250 | << " raw_string_ostream Msg(msg);\n" |
| 251 | << " Msg << \"Not supported instr: \" << MI;\n" |
| 252 | << " llvm_report_error(Msg.str());\n" |
Misha Brukman | cbfde0a | 2003-05-27 22:19:58 +0000 | [diff] [blame] | 253 | << " }\n" |
Misha Brukman | 9fff7e1 | 2003-05-24 00:15:53 +0000 | [diff] [blame] | 254 | << " return Value;\n" |
Misha Brukman | 28eefa5 | 2004-10-14 05:53:01 +0000 | [diff] [blame] | 255 | << "}\n\n"; |
Misha Brukman | 9fff7e1 | 2003-05-24 00:15:53 +0000 | [diff] [blame] | 256 | } |