mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-19 02:25:01 +00:00
Remove support for the pre-1.0 bytecode version #1. This will become
the bytecode revision generated by LLVM 1.2. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10848 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -317,27 +317,18 @@ void BytecodeParser::materializeFunction(Function* F) {
|
|||||||
|
|
||||||
GlobalValue::LinkageTypes Linkage = GlobalValue::ExternalLinkage;
|
GlobalValue::LinkageTypes Linkage = GlobalValue::ExternalLinkage;
|
||||||
|
|
||||||
if (!hasInternalMarkerOnly) {
|
unsigned LinkageType;
|
||||||
// We didn't support weak linkage explicitly.
|
if (read_vbr(Buf, EndBuf, LinkageType))
|
||||||
unsigned LinkageType;
|
throw std::string("ParseFunction: Error reading from buffer.");
|
||||||
if (read_vbr(Buf, EndBuf, LinkageType))
|
if ((!hasExtendedLinkageSpecs && LinkageType > 3) ||
|
||||||
throw std::string("ParseFunction: Error reading from buffer.");
|
( hasExtendedLinkageSpecs && LinkageType > 4))
|
||||||
if ((!hasExtendedLinkageSpecs && LinkageType > 3) ||
|
throw std::string("Invalid linkage type for Function.");
|
||||||
( hasExtendedLinkageSpecs && LinkageType > 4))
|
switch (LinkageType) {
|
||||||
throw std::string("Invalid linkage type for Function.");
|
case 0: Linkage = GlobalValue::ExternalLinkage; break;
|
||||||
switch (LinkageType) {
|
case 1: Linkage = GlobalValue::WeakLinkage; break;
|
||||||
case 0: Linkage = GlobalValue::ExternalLinkage; break;
|
case 2: Linkage = GlobalValue::AppendingLinkage; break;
|
||||||
case 1: Linkage = GlobalValue::WeakLinkage; break;
|
case 3: Linkage = GlobalValue::InternalLinkage; break;
|
||||||
case 2: Linkage = GlobalValue::AppendingLinkage; break;
|
case 4: Linkage = GlobalValue::LinkOnceLinkage; break;
|
||||||
case 3: Linkage = GlobalValue::InternalLinkage; break;
|
|
||||||
case 4: Linkage = GlobalValue::LinkOnceLinkage; break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// We used to only support two linkage models: internal and external
|
|
||||||
unsigned isInternal;
|
|
||||||
if (read_vbr(Buf, EndBuf, isInternal))
|
|
||||||
throw std::string("ParseFunction: Error reading from buffer.");
|
|
||||||
if (isInternal) Linkage = GlobalValue::InternalLinkage;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
F->setLinkage(Linkage);
|
F->setLinkage(Linkage);
|
||||||
@@ -451,33 +442,25 @@ void BytecodeParser::ParseModuleGlobalInfo(const unsigned char *&Buf,
|
|||||||
unsigned SlotNo;
|
unsigned SlotNo;
|
||||||
GlobalValue::LinkageTypes Linkage;
|
GlobalValue::LinkageTypes Linkage;
|
||||||
|
|
||||||
if (!hasInternalMarkerOnly) {
|
unsigned LinkageID;
|
||||||
unsigned LinkageID;
|
if (hasExtendedLinkageSpecs) {
|
||||||
if (hasExtendedLinkageSpecs) {
|
// VarType Fields: bit0 = isConstant, bit1 = hasInitializer,
|
||||||
// VarType Fields: bit0 = isConstant, bit1 = hasInitializer,
|
// bit2,3,4 = Linkage, bit4+ = slot#
|
||||||
// bit2,3,4 = Linkage, bit4+ = slot#
|
SlotNo = VarType >> 5;
|
||||||
SlotNo = VarType >> 5;
|
LinkageID = (VarType >> 2) & 7;
|
||||||
LinkageID = (VarType >> 2) & 7;
|
|
||||||
} else {
|
|
||||||
// VarType Fields: bit0 = isConstant, bit1 = hasInitializer,
|
|
||||||
// bit2,3 = Linkage, bit4+ = slot#
|
|
||||||
SlotNo = VarType >> 4;
|
|
||||||
LinkageID = (VarType >> 2) & 3;
|
|
||||||
}
|
|
||||||
switch (LinkageID) {
|
|
||||||
default: assert(0 && "Unknown linkage type!");
|
|
||||||
case 0: Linkage = GlobalValue::ExternalLinkage; break;
|
|
||||||
case 1: Linkage = GlobalValue::WeakLinkage; break;
|
|
||||||
case 2: Linkage = GlobalValue::AppendingLinkage; break;
|
|
||||||
case 3: Linkage = GlobalValue::InternalLinkage; break;
|
|
||||||
case 4: Linkage = GlobalValue::LinkOnceLinkage; break;
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
// VarType Fields: bit0 = isConstant, bit1 = hasInitializer,
|
// VarType Fields: bit0 = isConstant, bit1 = hasInitializer,
|
||||||
// bit2 = isInternal, bit3+ = slot#
|
// bit2,3 = Linkage, bit4+ = slot#
|
||||||
SlotNo = VarType >> 3;
|
SlotNo = VarType >> 4;
|
||||||
Linkage = (VarType & 4) ? GlobalValue::InternalLinkage :
|
LinkageID = (VarType >> 2) & 3;
|
||||||
GlobalValue::ExternalLinkage;
|
}
|
||||||
|
switch (LinkageID) {
|
||||||
|
default: assert(0 && "Unknown linkage type!");
|
||||||
|
case 0: Linkage = GlobalValue::ExternalLinkage; break;
|
||||||
|
case 1: Linkage = GlobalValue::WeakLinkage; break;
|
||||||
|
case 2: Linkage = GlobalValue::AppendingLinkage; break;
|
||||||
|
case 3: Linkage = GlobalValue::InternalLinkage; break;
|
||||||
|
case 4: Linkage = GlobalValue::LinkOnceLinkage; break;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Type *Ty = getType(SlotNo);
|
const Type *Ty = getType(SlotNo);
|
||||||
@@ -562,34 +545,26 @@ void BytecodeParser::ParseVersionInfo(const unsigned char *&Buf,
|
|||||||
RevisionNum = Version >> 4;
|
RevisionNum = Version >> 4;
|
||||||
|
|
||||||
// Default values for the current bytecode version
|
// Default values for the current bytecode version
|
||||||
hasInternalMarkerOnly = false;
|
|
||||||
hasExtendedLinkageSpecs = true;
|
hasExtendedLinkageSpecs = true;
|
||||||
hasOldStyleVarargs = false;
|
hasOldStyleVarargs = false;
|
||||||
hasVarArgCallPadding = false;
|
hasVarArgCallPadding = false;
|
||||||
FirstDerivedTyID = 14;
|
FirstDerivedTyID = 14;
|
||||||
|
|
||||||
switch (RevisionNum) {
|
switch (RevisionNum) {
|
||||||
case 1: // LLVM pre-1.0 release: will be deleted on the next rev
|
case 2: // LLVM pre-1.0 release: will be deleted on the next rev
|
||||||
// Version #1 has four bit fields: isBigEndian, hasLongPointers,
|
|
||||||
// hasNoEndianness, and hasNoPointerSize.
|
|
||||||
hasInternalMarkerOnly = true;
|
|
||||||
hasExtendedLinkageSpecs = false;
|
|
||||||
hasOldStyleVarargs = true;
|
|
||||||
hasVarArgCallPadding = true;
|
|
||||||
break;
|
|
||||||
case 2: // LLVM pre-1.0 release:
|
|
||||||
// Version #2 added information about all 4 linkage types instead of just
|
// Version #2 added information about all 4 linkage types instead of just
|
||||||
// having internal and external.
|
// having internal and external.
|
||||||
hasExtendedLinkageSpecs = false;
|
hasExtendedLinkageSpecs = false;
|
||||||
hasOldStyleVarargs = true;
|
hasOldStyleVarargs = true;
|
||||||
hasVarArgCallPadding = true;
|
hasVarArgCallPadding = true;
|
||||||
break;
|
break;
|
||||||
case 0: // LLVM 1.0 release version
|
case 0: // LLVM 1.0, 1.1 release version
|
||||||
// Compared to rev #2, we added support for weak linkage, a more dense
|
// Compared to rev #2, we added support for weak linkage, a more dense
|
||||||
// encoding, and better varargs support.
|
// encoding, and better varargs support.
|
||||||
|
|
||||||
// FIXME: densify the encoding!
|
|
||||||
break;
|
break;
|
||||||
|
case 1: // LLVM 1.2 release version
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
throw std::string("Unknown bytecode version number!");
|
throw std::string("Unknown bytecode version number!");
|
||||||
}
|
}
|
||||||
|
@@ -91,7 +91,6 @@ private:
|
|||||||
// Information about the module, extracted from the bytecode revision number.
|
// Information about the module, extracted from the bytecode revision number.
|
||||||
unsigned char RevisionNum; // The rev # itself
|
unsigned char RevisionNum; // The rev # itself
|
||||||
unsigned char FirstDerivedTyID; // First variable index to use for type
|
unsigned char FirstDerivedTyID; // First variable index to use for type
|
||||||
bool hasInternalMarkerOnly; // Only types of linkage are intern/external
|
|
||||||
bool hasExtendedLinkageSpecs; // Supports more than 4 linkage types
|
bool hasExtendedLinkageSpecs; // Supports more than 4 linkage types
|
||||||
bool hasOldStyleVarargs; // Has old version of varargs intrinsics?
|
bool hasOldStyleVarargs; // Has old version of varargs intrinsics?
|
||||||
bool hasVarArgCallPadding; // Bytecode has extra padding in vararg call
|
bool hasVarArgCallPadding; // Bytecode has extra padding in vararg call
|
||||||
|
Reference in New Issue
Block a user