Rebase to the llvm-project monorepo
The new git submodule src/llvm-project is a monorepo replacing src/llvm and src/tools/{clang,lld,lldb}. This also serves as a rebase for these projects to the new 8.x branch from trunk. The src/llvm-emscripten fork is unchanged for now.
This commit is contained in:
parent
bf669d1e32
commit
df0466d0bb
18 changed files with 166 additions and 65 deletions
|
@ -294,7 +294,7 @@ extern "C" void LLVMRustSetHasUnsafeAlgebra(LLVMValueRef V) {
|
|||
extern "C" LLVMValueRef
|
||||
LLVMRustBuildAtomicLoad(LLVMBuilderRef B, LLVMValueRef Source, const char *Name,
|
||||
LLVMAtomicOrdering Order) {
|
||||
LoadInst *LI = new LoadInst(unwrap(Source), 0);
|
||||
LoadInst *LI = new LoadInst(unwrap(Source));
|
||||
LI->setAtomic(fromRust(Order));
|
||||
return wrap(unwrap(B)->Insert(LI, Name));
|
||||
}
|
||||
|
@ -511,6 +511,71 @@ static DINode::DIFlags fromRust(LLVMRustDIFlags Flags) {
|
|||
return Result;
|
||||
}
|
||||
|
||||
// These values **must** match debuginfo::DISPFlags! They also *happen*
|
||||
// to match LLVM, but that isn't required as we do giant sets of
|
||||
// matching below. The value shouldn't be directly passed to LLVM.
|
||||
enum class LLVMRustDISPFlags : uint32_t {
|
||||
SPFlagZero = 0,
|
||||
SPFlagVirtual = 1,
|
||||
SPFlagPureVirtual = 2,
|
||||
SPFlagLocalToUnit = (1 << 2),
|
||||
SPFlagDefinition = (1 << 3),
|
||||
SPFlagOptimized = (1 << 4),
|
||||
// Do not add values that are not supported by the minimum LLVM
|
||||
// version we support! see llvm/include/llvm/IR/DebugInfoFlags.def
|
||||
// (In LLVM < 8, createFunction supported these as separate bool arguments.)
|
||||
};
|
||||
|
||||
inline LLVMRustDISPFlags operator&(LLVMRustDISPFlags A, LLVMRustDISPFlags B) {
|
||||
return static_cast<LLVMRustDISPFlags>(static_cast<uint32_t>(A) &
|
||||
static_cast<uint32_t>(B));
|
||||
}
|
||||
|
||||
inline LLVMRustDISPFlags operator|(LLVMRustDISPFlags A, LLVMRustDISPFlags B) {
|
||||
return static_cast<LLVMRustDISPFlags>(static_cast<uint32_t>(A) |
|
||||
static_cast<uint32_t>(B));
|
||||
}
|
||||
|
||||
inline LLVMRustDISPFlags &operator|=(LLVMRustDISPFlags &A, LLVMRustDISPFlags B) {
|
||||
return A = A | B;
|
||||
}
|
||||
|
||||
inline bool isSet(LLVMRustDISPFlags F) { return F != LLVMRustDISPFlags::SPFlagZero; }
|
||||
|
||||
inline LLVMRustDISPFlags virtuality(LLVMRustDISPFlags F) {
|
||||
return static_cast<LLVMRustDISPFlags>(static_cast<uint32_t>(F) & 0x3);
|
||||
}
|
||||
|
||||
#if LLVM_VERSION_GE(8, 0)
|
||||
static DISubprogram::DISPFlags fromRust(LLVMRustDISPFlags SPFlags) {
|
||||
DISubprogram::DISPFlags Result = DISubprogram::DISPFlags::SPFlagZero;
|
||||
|
||||
switch (virtuality(SPFlags)) {
|
||||
case LLVMRustDISPFlags::SPFlagVirtual:
|
||||
Result |= DISubprogram::DISPFlags::SPFlagVirtual;
|
||||
break;
|
||||
case LLVMRustDISPFlags::SPFlagPureVirtual:
|
||||
Result |= DISubprogram::DISPFlags::SPFlagPureVirtual;
|
||||
break;
|
||||
default:
|
||||
// The rest are handled below
|
||||
break;
|
||||
}
|
||||
|
||||
if (isSet(SPFlags & LLVMRustDISPFlags::SPFlagLocalToUnit)) {
|
||||
Result |= DISubprogram::DISPFlags::SPFlagLocalToUnit;
|
||||
}
|
||||
if (isSet(SPFlags & LLVMRustDISPFlags::SPFlagDefinition)) {
|
||||
Result |= DISubprogram::DISPFlags::SPFlagDefinition;
|
||||
}
|
||||
if (isSet(SPFlags & LLVMRustDISPFlags::SPFlagOptimized)) {
|
||||
Result |= DISubprogram::DISPFlags::SPFlagOptimized;
|
||||
}
|
||||
|
||||
return Result;
|
||||
}
|
||||
#endif
|
||||
|
||||
extern "C" uint32_t LLVMRustDebugMetadataVersion() {
|
||||
return DEBUG_METADATA_VERSION;
|
||||
}
|
||||
|
@ -575,16 +640,26 @@ LLVMRustDIBuilderCreateSubroutineType(LLVMRustDIBuilderRef Builder,
|
|||
extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateFunction(
|
||||
LLVMRustDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
|
||||
const char *LinkageName, LLVMMetadataRef File, unsigned LineNo,
|
||||
LLVMMetadataRef Ty, bool IsLocalToUnit, bool IsDefinition,
|
||||
unsigned ScopeLine, LLVMRustDIFlags Flags, bool IsOptimized,
|
||||
LLVMValueRef Fn, LLVMMetadataRef TParam, LLVMMetadataRef Decl) {
|
||||
LLVMMetadataRef Ty, unsigned ScopeLine, LLVMRustDIFlags Flags,
|
||||
LLVMRustDISPFlags SPFlags, LLVMValueRef Fn, LLVMMetadataRef TParam,
|
||||
LLVMMetadataRef Decl) {
|
||||
DITemplateParameterArray TParams =
|
||||
DITemplateParameterArray(unwrap<MDTuple>(TParam));
|
||||
#if LLVM_VERSION_GE(8, 0)
|
||||
DISubprogram *Sub = Builder->createFunction(
|
||||
unwrapDI<DIScope>(Scope), Name, LinkageName, unwrapDI<DIFile>(File),
|
||||
LineNo, unwrapDI<DISubroutineType>(Ty), ScopeLine, fromRust(Flags),
|
||||
fromRust(SPFlags), TParams, unwrapDIPtr<DISubprogram>(Decl));
|
||||
#else
|
||||
bool IsLocalToUnit = isSet(SPFlags & LLVMRustDISPFlags::SPFlagLocalToUnit);
|
||||
bool IsDefinition = isSet(SPFlags & LLVMRustDISPFlags::SPFlagDefinition);
|
||||
bool IsOptimized = isSet(SPFlags & LLVMRustDISPFlags::SPFlagOptimized);
|
||||
DISubprogram *Sub = Builder->createFunction(
|
||||
unwrapDI<DIScope>(Scope), Name, LinkageName, unwrapDI<DIFile>(File),
|
||||
LineNo, unwrapDI<DISubroutineType>(Ty), IsLocalToUnit, IsDefinition,
|
||||
ScopeLine, fromRust(Flags), IsOptimized, TParams,
|
||||
unwrapDIPtr<DISubprogram>(Decl));
|
||||
#endif
|
||||
unwrap<Function>(Fn)->setSubprogram(Sub);
|
||||
return wrap(Sub);
|
||||
}
|
||||
|
@ -773,14 +848,14 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateEnumerationType(
|
|||
LLVMRustDIBuilderRef Builder, LLVMMetadataRef Scope, const char *Name,
|
||||
LLVMMetadataRef File, unsigned LineNumber, uint64_t SizeInBits,
|
||||
uint32_t AlignInBits, LLVMMetadataRef Elements,
|
||||
LLVMMetadataRef ClassTy, bool IsFixed) {
|
||||
LLVMMetadataRef ClassTy, bool IsScoped) {
|
||||
#if LLVM_VERSION_GE(7, 0)
|
||||
return wrap(Builder->createEnumerationType(
|
||||
unwrapDI<DIDescriptor>(Scope), Name, unwrapDI<DIFile>(File), LineNumber,
|
||||
SizeInBits, AlignInBits, DINodeArray(unwrapDI<MDTuple>(Elements)),
|
||||
unwrapDI<DIType>(ClassTy), "", IsFixed));
|
||||
unwrapDI<DIType>(ClassTy), "", IsScoped));
|
||||
#else
|
||||
// Ignore IsFixed on older LLVM.
|
||||
// Ignore IsScoped on older LLVM.
|
||||
return wrap(Builder->createEnumerationType(
|
||||
unwrapDI<DIDescriptor>(Scope), Name, unwrapDI<DIFile>(File), LineNumber,
|
||||
SizeInBits, AlignInBits, DINodeArray(unwrapDI<MDTuple>(Elements)),
|
||||
|
@ -920,7 +995,11 @@ extern "C" void LLVMRustUnpackOptimizationDiagnostic(
|
|||
if (loc.isValid()) {
|
||||
*Line = loc.getLine();
|
||||
*Column = loc.getColumn();
|
||||
#if LLVM_VERSION_GE(8, 0)
|
||||
FilenameOS << loc.getAbsolutePath();
|
||||
#else
|
||||
FilenameOS << loc.getFilename();
|
||||
#endif
|
||||
}
|
||||
|
||||
RawRustStringOstream MessageOS(MessageOut);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue