For PR950:
Make necessary changes to support DIV -> [SUF]Div. This changes llvm to
have three division instructions: signed, unsigned, floating point. The
bytecode and assembler are bacwards compatible, however.
llvm-svn: 31195
diff --git a/llvm/lib/Bytecode/Reader/Reader.h b/llvm/lib/Bytecode/Reader/Reader.h
index 86ccc20..cba7154 100644
--- a/llvm/lib/Bytecode/Reader/Reader.h
+++ b/llvm/lib/Bytecode/Reader/Reader.h
@@ -226,6 +226,18 @@
Function* F ///< The function into which BBs will be inserted
);
+ /// Convert previous opcode values into the current value and/or construct
+ /// the instruction. This function handles all *abnormal* cases for
+ /// instruction generation based on obsolete opcode values. The normal cases
+ /// are handled by the ParseInstruction function.
+ Instruction* handleObsoleteOpcodes(
+ unsigned &opcode, ///< The old opcode, possibly updated by this function
+ std::vector<unsigned> &Oprnds, ///< The operands to the instruction
+ unsigned &iType, ///< The type code from the bytecode file
+ const Type* InstTy, ///< The type of the instruction
+ BasicBlock* BB ///< The basic block to insert into, if we need to
+ );
+
/// @brief Parse a single instruction.
void ParseInstruction(
std::vector<unsigned>& Args, ///< The arguments to be filled in
@@ -336,6 +348,13 @@
// unreachable instruction.
bool hasNoUnreachableInst;
+ // In version 5 and prior, instructions were signless. In version 6,
+ // instructions became signed. For example in version 5 we have the DIV
+ // instruction but in version 6 we have FDIV, SDIV and UDIV to replace it.
+ // This causes a renumbering of the instruction codes in version 6 that must
+ // be dealt with when reading old bytecode files.
+ bool hasSignlessInstructions;
+
/// In release 1.7 we changed intrinsic functions to not be overloaded. There
/// is no bytecode change for this, but to optimize the auto-upgrade of calls
/// to intrinsic functions, we save a mapping of old function definitions to