mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-17 21:29:20 +00:00
Objective-C was generating EH frame info like this:
"_-[NSString(local) isNullOrNil]".eh = 0 .no_dead_strip "_-[NSString(local) isNullOrNil]".eh The ".eh" should be inside the quotes. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42074 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
ecd9137758
commit
6e19896999
@ -43,6 +43,11 @@ namespace llvm {
|
|||||||
///
|
///
|
||||||
unsigned FunctionNumber;
|
unsigned FunctionNumber;
|
||||||
|
|
||||||
|
/// Cache of mangled exception handling name for current function. This is
|
||||||
|
/// recalculated at the beginning of each call to runOnMachineFunction().
|
||||||
|
///
|
||||||
|
std::string CurrentFnEHName;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// Necessary for external weak linkage support
|
// Necessary for external weak linkage support
|
||||||
std::set<const GlobalValue*> ExtWeakSymbols;
|
std::set<const GlobalValue*> ExtWeakSymbols;
|
||||||
@ -112,6 +117,11 @@ namespace llvm {
|
|||||||
/// Should be overridden if an indirect reference should be used.
|
/// Should be overridden if an indirect reference should be used.
|
||||||
virtual void EmitExternalGlobal(const GlobalVariable *GV);
|
virtual void EmitExternalGlobal(const GlobalVariable *GV);
|
||||||
|
|
||||||
|
/// getCurrentFunctionEHName - Called to return (and cache) the
|
||||||
|
/// CurrentFnEHName.
|
||||||
|
///
|
||||||
|
const std::string &getCurrentFunctionEHName(const MachineFunction *MF);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// doInitialization - Set up the AsmPrinter when we are working on a new
|
/// doInitialization - Set up the AsmPrinter when we are working on a new
|
||||||
/// module. If your pass overrides this, it must make sure to explicitly
|
/// module. If your pass overrides this, it must make sure to explicitly
|
||||||
|
@ -160,6 +160,15 @@ bool AsmPrinter::doFinalization(Module &M) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::string &
|
||||||
|
AsmPrinter::getCurrentFunctionEHName(const MachineFunction *MF) {
|
||||||
|
assert(MF && "No machine function?");
|
||||||
|
if (CurrentFnEHName != "") return CurrentFnEHName;
|
||||||
|
return CurrentFnEHName =
|
||||||
|
Mang->makeNameProper(MF->getFunction()->getName() + ".eh",
|
||||||
|
TAI->getGlobalPrefix());
|
||||||
|
}
|
||||||
|
|
||||||
void AsmPrinter::SetupMachineFunction(MachineFunction &MF) {
|
void AsmPrinter::SetupMachineFunction(MachineFunction &MF) {
|
||||||
// What's my mangled name?
|
// What's my mangled name?
|
||||||
CurrentFnName = Mang->getValueName(MF.getFunction());
|
CurrentFnName = Mang->getValueName(MF.getFunction());
|
||||||
|
@ -2833,13 +2833,13 @@ private:
|
|||||||
|
|
||||||
// Externally visible entry into the functions eh frame info.
|
// Externally visible entry into the functions eh frame info.
|
||||||
if (const char *GlobalDirective = TAI->getGlobalDirective())
|
if (const char *GlobalDirective = TAI->getGlobalDirective())
|
||||||
O << GlobalDirective << EHFrameInfo.FnName << ".eh\n";
|
O << GlobalDirective << EHFrameInfo.FnName << "\n";
|
||||||
|
|
||||||
// If there are no calls then you can't unwind.
|
// If there are no calls then you can't unwind.
|
||||||
if (!EHFrameInfo.hasCalls) {
|
if (!EHFrameInfo.hasCalls) {
|
||||||
O << EHFrameInfo.FnName << ".eh = 0\n";
|
O << EHFrameInfo.FnName << " = 0\n";
|
||||||
} else {
|
} else {
|
||||||
O << EHFrameInfo.FnName << ".eh:\n";
|
O << EHFrameInfo.FnName << ":\n";
|
||||||
|
|
||||||
// EH frame header.
|
// EH frame header.
|
||||||
EmitDifference("eh_frame_end", EHFrameInfo.Number,
|
EmitDifference("eh_frame_end", EHFrameInfo.Number,
|
||||||
@ -2887,7 +2887,7 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (const char *UsedDirective = TAI->getUsedDirective())
|
if (const char *UsedDirective = TAI->getUsedDirective())
|
||||||
O << UsedDirective << EHFrameInfo.FnName << ".eh\n\n";
|
O << UsedDirective << EHFrameInfo.FnName << "\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
/// EmitExceptionTable - Emit landing pads and actions.
|
/// EmitExceptionTable - Emit landing pads and actions.
|
||||||
@ -3321,12 +3321,13 @@ public:
|
|||||||
EmitExceptionTable();
|
EmitExceptionTable();
|
||||||
|
|
||||||
// Save EH frame information
|
// Save EH frame information
|
||||||
EHFrames.push_back(FunctionEHFrameInfo(getAsm()->CurrentFnName,
|
EHFrames.
|
||||||
SubprogramCount,
|
push_back(FunctionEHFrameInfo(getAsm()->getCurrentFunctionEHName(MF),
|
||||||
MMI->getPersonalityIndex(),
|
SubprogramCount,
|
||||||
MF->getFrameInfo()->hasCalls(),
|
MMI->getPersonalityIndex(),
|
||||||
!MMI->getLandingPads().empty(),
|
MF->getFrameInfo()->hasCalls(),
|
||||||
MMI->getFrameMoves()));
|
!MMI->getLandingPads().empty(),
|
||||||
|
MMI->getFrameMoves()));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
65
test/CodeGen/X86/2007-09-17-ObjcFrameEH.ll
Normal file
65
test/CodeGen/X86/2007-09-17-ObjcFrameEH.ll
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
; RUN: llvm-as < %s | llc -march=x86 -enable-eh | grep {isNullOrNil].eh"} | wc -l | grep 2
|
||||||
|
|
||||||
|
%struct.NSString = type { }
|
||||||
|
%struct._objc__method_prototype_list = type opaque
|
||||||
|
%struct._objc_category = type { i8*, i8*, %struct._objc_method_list*, %struct._objc_method_list*, %struct._objc_protocol**, i32, %struct._prop_list_t* }
|
||||||
|
%struct._objc_method = type { %struct.objc_selector*, i8*, i8* }
|
||||||
|
%struct._objc_method_list = type opaque
|
||||||
|
%struct._objc_module = type { i32, i32, i8*, %struct._objc_symtab* }
|
||||||
|
%struct._objc_protocol = type { %struct._objc_protocol_extension*, i8*, %struct._objc_protocol**, %struct._objc__method_prototype_list*, %struct._objc__method_prototype_list* }
|
||||||
|
%struct._objc_protocol_extension = type opaque
|
||||||
|
%struct._objc_symtab = type { i32, %struct.objc_selector**, i16, i16, [1 x i8*] }
|
||||||
|
%struct._prop_list_t = type opaque
|
||||||
|
%struct.anon = type { %struct._objc__method_prototype_list*, i32, [1 x %struct._objc_method] }
|
||||||
|
%struct.objc_selector = type opaque
|
||||||
|
@"\01L_OBJC_SYMBOLS" = internal global { i32, i32, i16, i16, [1 x %struct._objc_category*] } {
|
||||||
|
i32 0,
|
||||||
|
i32 0,
|
||||||
|
i16 0,
|
||||||
|
i16 1,
|
||||||
|
[1 x %struct._objc_category*] [ %struct._objc_category* bitcast ({ i8*, i8*, %struct._objc_method_list*, i32, i32, i32, i32 }* @"\01L_OBJC_CATEGORY_NSString_local" to %struct._objc_category*) ] }, section "__OBJC,__symbols,regular,no_dead_strip" ; <{ i32, i32, i16, i16, [1 x %struct._objc_category*] }*> [#uses=2]
|
||||||
|
@"\01L_OBJC_CATEGORY_INSTANCE_METHODS_NSString_local" = internal global { i32, i32, [1 x %struct._objc_method] } {
|
||||||
|
i32 0,
|
||||||
|
i32 1,
|
||||||
|
[1 x %struct._objc_method] [ %struct._objc_method {
|
||||||
|
%struct.objc_selector* bitcast ([12 x i8]* @"\01L_OBJC_METH_VAR_NAME_0" to %struct.objc_selector*),
|
||||||
|
i8* getelementptr ([7 x i8]* @"\01L_OBJC_METH_VAR_TYPE_0", i32 0, i32 0),
|
||||||
|
i8* bitcast (i8 (%struct.NSString*, %struct.objc_selector*) signext * @"-[NSString(local) isNullOrNil]" to i8*) } ] }, section "__OBJC,__cat_inst_meth,regular,no_dead_strip" ; <{ i32, i32, [1 x %struct._objc_method] }*> [#uses=3]
|
||||||
|
@"\01L_OBJC_CATEGORY_NSString_local" = internal global { i8*, i8*, %struct._objc_method_list*, i32, i32, i32, i32 } {
|
||||||
|
i8* getelementptr ([6 x i8]* @"\01L_OBJC_CLASS_NAME_0", i32 0, i32 0),
|
||||||
|
i8* getelementptr ([9 x i8]* @"\01L_OBJC_CLASS_NAME_1", i32 0, i32 0),
|
||||||
|
%struct._objc_method_list* bitcast ({ i32, i32, [1 x %struct._objc_method] }* @"\01L_OBJC_CATEGORY_INSTANCE_METHODS_NSString_local" to %struct._objc_method_list*),
|
||||||
|
i32 0,
|
||||||
|
i32 0,
|
||||||
|
i32 28,
|
||||||
|
i32 0 }, section "__OBJC,__category,regular,no_dead_strip" ; <{ i8*, i8*, %struct._objc_method_list*, i32, i32, i32, i32 }*> [#uses=2]
|
||||||
|
@"\01L_OBJC_IMAGE_INFO" = internal constant [2 x i32] zeroinitializer, section "__OBJC,__image_info,regular" ; <[2 x i32]*> [#uses=1]
|
||||||
|
@"\01L_OBJC_MODULES" = internal global %struct._objc_module {
|
||||||
|
i32 7,
|
||||||
|
i32 16,
|
||||||
|
i8* getelementptr ([1 x i8]* @"\01L_OBJC_CLASS_NAME_2", i32 0, i32 0),
|
||||||
|
%struct._objc_symtab* bitcast ({ i32, i32, i16, i16, [1 x %struct._objc_category*] }* @"\01L_OBJC_SYMBOLS" to %struct._objc_symtab*) }, section "__OBJC,__module_info,regular,no_dead_strip" ; <%struct._objc_module*> [#uses=1]
|
||||||
|
@"\01.objc_class_ref_NSString" = internal global i8* @"\01.objc_class_name_NSString" ; <i8**> [#uses=0]
|
||||||
|
@"\01.objc_class_name_NSString" = external global i8 ; <i8*> [#uses=1]
|
||||||
|
@"\01.objc_category_name_NSString_local" = constant i32 0 ; <i32*> [#uses=1]
|
||||||
|
@"\01L_OBJC_CLASS_NAME_2" = internal global [1 x i8] zeroinitializer, section "__TEXT,__cstring,cstring_literals" ; <[1 x i8]*> [#uses=2]
|
||||||
|
@"\01L_OBJC_CLASS_NAME_1" = internal global [9 x i8] c"NSString\00", section "__TEXT,__cstring,cstring_literals" ; <[9 x i8]*> [#uses=2]
|
||||||
|
@"\01L_OBJC_CLASS_NAME_0" = internal global [6 x i8] c"local\00", section "__TEXT,__cstring,cstring_literals" ; <[6 x i8]*> [#uses=2]
|
||||||
|
@"\01L_OBJC_METH_VAR_NAME_0" = internal global [12 x i8] c"isNullOrNil\00", section "__TEXT,__cstring,cstring_literals" ; <[12 x i8]*> [#uses=3]
|
||||||
|
@"\01L_OBJC_METH_VAR_TYPE_0" = internal global [7 x i8] c"c8@0:4\00", section "__TEXT,__cstring,cstring_literals" ; <[7 x i8]*> [#uses=2]
|
||||||
|
@llvm.used = appending global [11 x i8*] [ i8* bitcast ({ i32, i32, i16, i16, [1 x %struct._objc_category*] }* @"\01L_OBJC_SYMBOLS" to i8*), i8* bitcast ({ i32, i32, [1 x %struct._objc_method] }* @"\01L_OBJC_CATEGORY_INSTANCE_METHODS_NSString_local" to i8*), i8* bitcast ({ i8*, i8*, %struct._objc_method_list*, i32, i32, i32, i32 }* @"\01L_OBJC_CATEGORY_NSString_local" to i8*), i8* bitcast ([2 x i32]* @"\01L_OBJC_IMAGE_INFO" to i8*), i8* bitcast (%struct._objc_module* @"\01L_OBJC_MODULES" to i8*), i8* bitcast (i32* @"\01.objc_category_name_NSString_local" to i8*), i8* getelementptr ([1 x i8]* @"\01L_OBJC_CLASS_NAME_2", i32 0, i32 0), i8* getelementptr ([9 x i8]* @"\01L_OBJC_CLASS_NAME_1", i32 0, i32 0), i8* getelementptr ([6 x i8]* @"\01L_OBJC_CLASS_NAME_0", i32 0, i32 0), i8* getelementptr ([12 x i8]* @"\01L_OBJC_METH_VAR_NAME_0", i32 0, i32 0), i8* getelementptr ([7 x i8]* @"\01L_OBJC_METH_VAR_TYPE_0", i32 0, i32 0) ], section "llvm.metadata" ; <[11 x i8*]*> [#uses=0]
|
||||||
|
|
||||||
|
define internal i8 @"-[NSString(local) isNullOrNil]"(%struct.NSString* %self, %struct.objc_selector* %_cmd) signext {
|
||||||
|
entry:
|
||||||
|
%self_addr = alloca %struct.NSString* ; <%struct.NSString**> [#uses=1]
|
||||||
|
%_cmd_addr = alloca %struct.objc_selector* ; <%struct.objc_selector**> [#uses=1]
|
||||||
|
%retval = alloca i8, align 1 ; <i8*> [#uses=1]
|
||||||
|
%"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
|
||||||
|
store %struct.NSString* %self, %struct.NSString** %self_addr
|
||||||
|
store %struct.objc_selector* %_cmd, %struct.objc_selector** %_cmd_addr
|
||||||
|
br label %return
|
||||||
|
|
||||||
|
return: ; preds = %entry
|
||||||
|
%retval1 = load i8* %retval ; <i8> [#uses=1]
|
||||||
|
ret i8 %retval1
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user