mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 18:54:02 +01:00
[AsmPrinter] Simplify AsmPrinter::emitXXStructorList after D61547
This commit is contained in:
parent
4b5ee2a22d
commit
8e10dffd51
@ -2090,21 +2090,10 @@ void AsmPrinter::emitXXStructorList(const DataLayout &DL, const Constant *List,
|
||||
// init priority.
|
||||
if (!isa<ConstantArray>(List)) return;
|
||||
|
||||
// Sanity check the structors list.
|
||||
const ConstantArray *InitList = dyn_cast<ConstantArray>(List);
|
||||
if (!InitList) return; // Not an array!
|
||||
StructType *ETy = dyn_cast<StructType>(InitList->getType()->getElementType());
|
||||
if (!ETy || ETy->getNumElements() != 3 ||
|
||||
!isa<IntegerType>(ETy->getTypeAtIndex(0U)) ||
|
||||
!isa<PointerType>(ETy->getTypeAtIndex(1U)) ||
|
||||
!isa<PointerType>(ETy->getTypeAtIndex(2U)))
|
||||
return; // Not (int, ptr, ptr).
|
||||
|
||||
// Gather the structors in a form that's convenient for sorting by priority.
|
||||
SmallVector<Structor, 8> Structors;
|
||||
for (Value *O : InitList->operands()) {
|
||||
ConstantStruct *CS = dyn_cast<ConstantStruct>(O);
|
||||
if (!CS) continue; // Malformed.
|
||||
for (Value *O : cast<ConstantArray>(List)->operands()) {
|
||||
auto *CS = cast<ConstantStruct>(O);
|
||||
if (CS->getOperand(1)->isNullValue())
|
||||
break; // Found a null terminator, skip the rest.
|
||||
ConstantInt *Priority = dyn_cast<ConstantInt>(CS->getOperand(0));
|
||||
|
@ -1,8 +1,8 @@
|
||||
; RUN: %lli -jit-kind=orc-mcjit %s > /dev/null
|
||||
; XFAIL: darwin
|
||||
@var = global i32 1, align 4
|
||||
@llvm.global_ctors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 65535, void ()* @ctor_func }]
|
||||
@llvm.global_dtors = appending global [1 x { i32, void ()* }] [{ i32, void ()* } { i32 65535, void ()* @dtor_func }]
|
||||
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @ctor_func, i8* null }]
|
||||
@llvm.global_dtors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @dtor_func, i8* null }]
|
||||
|
||||
define i32 @main() nounwind {
|
||||
entry:
|
||||
|
Loading…
Reference in New Issue
Block a user