forked from OSchip/llvm-project
-fms-extensions: Recognize _alloca as an alias for the alloca builtin
Differential Revision: http://llvm-reviews.chandlerc.com/D1989 llvm-svn: 194617
This commit is contained in:
parent
aae88013c7
commit
59e4a6f5e2
|
@ -675,6 +675,7 @@ BUILTIN(__builtin_index, "c*cC*i", "Fn")
|
|||
BUILTIN(__builtin_rindex, "c*cC*i", "Fn")
|
||||
|
||||
// Microsoft builtins. These are only active with -fms-extensions.
|
||||
LANGBUILTIN(_alloca, "v*z", "n", ALL_MS_LANGUAGES)
|
||||
LANGBUILTIN(__assume, "vb", "n", ALL_MS_LANGUAGES)
|
||||
LANGBUILTIN(__noop, "v.", "n", ALL_MS_LANGUAGES)
|
||||
LANGBUILTIN(__debugbreak, "v", "n", ALL_MS_LANGUAGES)
|
||||
|
|
|
@ -604,6 +604,7 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
|
|||
}
|
||||
|
||||
case Builtin::BIalloca:
|
||||
case Builtin::BI_alloca:
|
||||
case Builtin::BI__builtin_alloca: {
|
||||
Value *Size = EmitScalarExpr(E->getArg(0));
|
||||
return RValue::get(Builder.CreateAlloca(Builder.getInt8Ty(), Size));
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
// RUN: %clang_cc1 %s -emit-llvm -o - -fms-extensions -triple i686-pc-win32 | FileCheck %s
|
||||
|
||||
// CHECK-LABEL: define void @test_alloca
|
||||
void capture(void *);
|
||||
void test_alloca(int n) {
|
||||
capture(_alloca(n));
|
||||
// CHECK: %[[arg:.*]] = alloca i8, i32 %
|
||||
// CHECK: call void @capture(i8* %[[arg]])
|
||||
}
|
Loading…
Reference in New Issue