[llvm-commits] [gcc-plugin] r81330 - /gcc-plugin/trunk/llvm-convert.cpp
Duncan Sands
baldrick at free.fr
Wed Sep 9 03:07:42 PDT 2009
Author: baldrick
Date: Wed Sep 9 05:07:42 2009
New Revision: 81330
URL: http://llvm.org/viewvc/llvm-project?rev=81330&view=rev
Log:
Get EmitBuiltinVAStart working by calling fold_builtin_next_arg
on the call expression itself rather than on TREE_CHAIN of the
argument.
Modified:
gcc-plugin/trunk/llvm-convert.cpp
Modified: gcc-plugin/trunk/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-convert.cpp?rev=81330&r1=81329&r2=81330&view=diff
==============================================================================
--- gcc-plugin/trunk/llvm-convert.cpp (original)
+++ gcc-plugin/trunk/llvm-convert.cpp Wed Sep 9 05:07:42 2009
@@ -6112,27 +6112,26 @@
}
bool TreeToLLVM::EmitBuiltinVAStart(tree exp) {
- tree arglist = CALL_EXPR_ARGS(exp);
- tree fntype = TREE_TYPE(current_function_decl);
+ if (call_expr_nargs(exp) < 2) {
+ error_at (EXPR_LOCATION(exp), "too few arguments to function %<va_start%>");
+ return true;
+ }
+ tree fntype = TREE_TYPE(current_function_decl);
if (TYPE_ARG_TYPES(fntype) == 0 ||
(TREE_VALUE(tree_last(TYPE_ARG_TYPES(fntype))) == void_type_node)) {
- error("`va_start' used in function with fixed args");
+ error("%<va_start%> used in function with fixed args");
return true;
}
- tree chain = TREE_CHAIN(arglist);
-
// Check for errors.
- if (fold_builtin_next_arg (chain, true))
+ if (fold_builtin_next_arg (exp, true))
return true;
- Value *ArgVal = Emit(TREE_VALUE(arglist), 0);
-
- Constant *llvm_va_start_fn = Intrinsic::getDeclaration(TheModule,
- Intrinsic::vastart);
+ Constant *va_start = Intrinsic::getDeclaration(TheModule, Intrinsic::vastart);
+ Value *ArgVal = Emit(TREE_VALUE(CALL_EXPR_ARGS(exp)), 0);
ArgVal = BitCastToType(ArgVal, PointerType::getUnqual(Type::getInt8Ty(Context)));
- Builder.CreateCall(llvm_va_start_fn, ArgVal);
+ Builder.CreateCall(va_start, ArgVal);
return true;
}
More information about the llvm-commits
mailing list