OLD | NEW |
1 //===------- ItaniumCXXABI.cpp - Emit LLVM Code from ASTs for a Module ----===// | 1 //===------- ItaniumCXXABI.cpp - Emit LLVM Code from ASTs for a Module ----===// |
2 // | 2 // |
3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
4 // | 4 // |
5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
7 // | 7 // |
8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
9 // | 9 // |
10 // This provides C++ code generation targeting the Itanium C++ ABI. The class | 10 // This provides C++ code generation targeting the Itanium C++ ABI. The class |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 // Note that AArch64 uses the generic ItaniumCXXABI class since it doesn't | 351 // Note that AArch64 uses the generic ItaniumCXXABI class since it doesn't |
352 // include the other 32-bit ARM oddities: constructor/destructor return values | 352 // include the other 32-bit ARM oddities: constructor/destructor return values |
353 // and array cookies. | 353 // and array cookies. |
354 case TargetCXXABI::GenericAArch64: | 354 case TargetCXXABI::GenericAArch64: |
355 return new ItaniumCXXABI(CGM, /* UseARMMethodPtrABI = */ true, | 355 return new ItaniumCXXABI(CGM, /* UseARMMethodPtrABI = */ true, |
356 /* UseARMGuardVarABI = */ true); | 356 /* UseARMGuardVarABI = */ true); |
357 | 357 |
358 case TargetCXXABI::GenericMIPS: | 358 case TargetCXXABI::GenericMIPS: |
359 return new ItaniumCXXABI(CGM, /* UseARMMethodPtrABI = */ true); | 359 return new ItaniumCXXABI(CGM, /* UseARMMethodPtrABI = */ true); |
360 | 360 |
361 // @LOCALMOD-START Emscripten | |
362 case TargetCXXABI::Emscripten: | |
363 // Use ARM-style method pointers so that generated code does not assume | |
364 // anything about the alignment of function pointers. | |
365 return new ItaniumCXXABI(CGM, /* UseARMMethodPtrABI = */ true, | |
366 /* UseARMGuardVarABI = */ false); | |
367 // @LOCALMOD-END Emscripten | |
368 | |
369 case TargetCXXABI::GenericItanium: | 361 case TargetCXXABI::GenericItanium: |
370 if (CGM.getContext().getTargetInfo().getTriple().getArch() | 362 if (CGM.getContext().getTargetInfo().getTriple().getArch() |
371 == llvm::Triple::le32) { | 363 == llvm::Triple::le32) { |
372 // For PNaCl, use ARM-style method pointers so that PNaCl code | 364 // For PNaCl, use ARM-style method pointers so that PNaCl code |
373 // does not assume anything about the alignment of function | 365 // does not assume anything about the alignment of function |
374 // pointers. | 366 // pointers. |
375 return new ItaniumCXXABI(CGM, /* UseARMMethodPtrABI = */ true, | 367 return new ItaniumCXXABI(CGM, /* UseARMMethodPtrABI = */ true, |
376 /* UseARMGuardVarABI = */ false); | 368 /* UseARMGuardVarABI = */ false); |
377 } | 369 } |
378 return new ItaniumCXXABI(CGM); | 370 return new ItaniumCXXABI(CGM); |
(...skipping 3256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3635 llvm::CallInst * | 3627 llvm::CallInst * |
3636 ItaniumCXXABI::emitTerminateForUnexpectedException(CodeGenFunction &CGF, | 3628 ItaniumCXXABI::emitTerminateForUnexpectedException(CodeGenFunction &CGF, |
3637 llvm::Value *Exn) { | 3629 llvm::Value *Exn) { |
3638 // In C++, we want to call __cxa_begin_catch() before terminating. | 3630 // In C++, we want to call __cxa_begin_catch() before terminating. |
3639 if (Exn) { | 3631 if (Exn) { |
3640 assert(CGF.CGM.getLangOpts().CPlusPlus); | 3632 assert(CGF.CGM.getLangOpts().CPlusPlus); |
3641 return CGF.EmitNounwindRuntimeCall(getClangCallTerminateFn(CGF.CGM), Exn); | 3633 return CGF.EmitNounwindRuntimeCall(getClangCallTerminateFn(CGF.CGM), Exn); |
3642 } | 3634 } |
3643 return CGF.EmitNounwindRuntimeCall(CGF.CGM.getTerminateFn()); | 3635 return CGF.EmitNounwindRuntimeCall(CGF.CGM.getTerminateFn()); |
3644 } | 3636 } |
OLD | NEW |