Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add try-catches everywhere #3

Open
Lense opened this issue Dec 3, 2016 · 1 comment
Open

Add try-catches everywhere #3

Lense opened this issue Dec 3, 2016 · 1 comment
Assignees

Comments

@Lense
Copy link
Collaborator

Lense commented Dec 3, 2016

1 around every basic block

@Lense
Copy link
Collaborator Author

Lense commented Dec 4, 2016

try-catch example:

int
main(void)
{
        try {
                throw 1;
        } catch (...) { }
        return 0;
}
@_ZTIi = external constant i8*

; Function Attrs: norecurse sspstrong uwtable
define i32 @main() #0 personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*) {
  %1 = alloca i32, align 4
  %2 = alloca i8*
  %3 = alloca i32
  store i32 0, i32* %1, align 4
  %4 = call i8* @__cxa_allocate_exception(i64 4) #1
  %5 = bitcast i8* %4 to i32*
  store i32 1, i32* %5, align 16
  %5 = bitcast i8* %4 to i32*
  store i32 1, i32* %5, align 16
  invoke void @__cxa_throw(i8* %4, i8* bitcast (i8** @_ZTIi to i8*), i8* null) #2
          to label %14 unwind label %6

; <label>:6:                                      ; preds = %0
  %7 = landingpad { i8*, i32 }
          catch i8* null
  %8 = extractvalue { i8*, i32 } %7, 0
  store i8* %8, i8** %2, align 8
  %9 = extractvalue { i8*, i32 } %7, 1
  store i32 %9, i32* %3, align 4
  br label %10

; <label>:10:                                     ; preds = %6
  %11 = load i8*, i8** %2, align 8
  %12 = call i8* @__cxa_begin_catch(i8* %11) #1
  call void @__cxa_end_catch()
  br label %13

; <label>:13:                                     ; preds = %10
  ret i32 0

; <label>:14:                                     ; preds = %0
  unreachable
}

declare i8* @__cxa_allocate_exception(i64)

declare void @__cxa_throw(i8*, i8*, i8*)

declare i32 @__gxx_personality_v0(...)

declare i8* @__cxa_begin_catch(i8*)

declare void @__cxa_end_catch()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant