Mercurial > hg > CbC > CbC_llvm
changeset 108:1881386f7909
use llvm.setjmp and llvm.longjmp
author | Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 01 Feb 2016 02:57:01 +0900 |
parents | a03ddd01be7e |
children | 6916f1d3a436 |
files | tools/clang/include/clang/Basic/Builtins.def tools/clang/lib/Parse/ParseCbC.cpp |
diffstat | 2 files changed, 8 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/tools/clang/include/clang/Basic/Builtins.def Sun Jan 31 17:34:49 2016 +0900 +++ b/tools/clang/include/clang/Basic/Builtins.def Mon Feb 01 02:57:01 2016 +0900 @@ -1278,6 +1278,10 @@ LANGBUILTIN(get_pipe_num_packets, "Ui.", "tn", OCLC_LANG) LANGBUILTIN(get_pipe_max_packets, "Ui.", "tn", OCLC_LANG) +#ifndef noCbC +BUILTIN(__builtin_CbC_setjmp, "iv**", "j") +#endif + #undef BUILTIN #undef LIBBUILTIN #undef LANGBUILTIN
--- a/tools/clang/lib/Parse/ParseCbC.cpp Sun Jan 31 17:34:49 2016 +0900 +++ b/tools/clang/lib/Parse/ParseCbC.cpp Mon Feb 01 02:57:01 2016 +0900 @@ -434,7 +434,7 @@ ExprResult CondExp; Decl *CondVar = 0; - CondExp = LookupNameAndBuildExpr(CreateIdentifierInfo("setjmp", Loc)); + CondExp = LookupNameAndBuildExpr(CreateIdentifierInfo("__builtin_setjmp", Loc)); ExprVector ArgExprs; ExprResult __envExprRes = CondExp.get(); @@ -539,7 +539,7 @@ SmallVector<Decl *, 32> FieldDecls; FieldDecls.push_back(Create__CbC_envBody(TagDecl, DeclSpec::TST_void, Loc, __CBC_STRUCT_POINTER_NAME)); - FieldDecls.push_back(Create__CbC_envBody(TagDecl, DeclSpec::TST_int, Loc, __CBC_STRUCT_ENV_NAME)); + FieldDecls.push_back(Create__CbC_envBody(TagDecl, DeclSpec::TST_void, Loc, __CBC_STRUCT_ENV_NAME)); Actions.ActOnFields(getCurScope(),Loc, TagDecl, FieldDecls,Loc, Loc,attrs.getList()); StructScope.Exit(); @@ -611,7 +611,7 @@ /// create these codes: /// __code ret(return_type retval, void *env){ /// *(return_type)((struct CbC_environment *)(env))->ret_p = n; -/// longjmp((int*)(((struct __CbC_environment *)env)->env),1); +/// longjmp((void*)(((struct __CbC_environment *)env)->env),1); /// } void Parser::CreateRetCS(IdentifierInfo *csName){ const PrintingPolicy &Policy = Actions.getASTContext().getPrintingPolicy(); @@ -730,7 +730,7 @@ FnStmts.push_back(innerR.get()); ExprResult ljExpr,ljLHS; - ljExpr = IIToExpr(CreateIdentifierInfo("longjmp", Loc), tok::l_paren); + ljExpr = IIToExpr(CreateIdentifierInfo("__builtin_longjmp", Loc), tok::l_paren); ExprVector ljArgExprs; DeclSpec ljDS(AttrFactory); setTST(&ljDS, DeclSpec::TST_struct, structName);