forked from OSchip/llvm-project
Add support for __builtin___clear_cache in Clang
Adding the mapping between __builtin___clear_cache into @llvm.clear_cache llvm-svn: 204820
This commit is contained in:
parent
94321ec003
commit
c491a8d457
|
@ -445,6 +445,7 @@ BUILTIN(__builtin_strstr, "c*cC*cC*", "nF")
|
|||
BUILTIN(__builtin_return_address, "v*IUi", "n")
|
||||
BUILTIN(__builtin_extract_return_addr, "v*v*", "n")
|
||||
BUILTIN(__builtin_frame_address, "v*IUi", "n")
|
||||
BUILTIN(__builtin___clear_cache, "vc*c*", "n")
|
||||
BUILTIN(__builtin_flt_rounds, "i", "nc")
|
||||
BUILTIN(__builtin_setjmp, "iv**", "j")
|
||||
BUILTIN(__builtin_longjmp, "vv**i", "r")
|
||||
|
|
|
@ -429,6 +429,12 @@ RValue CodeGenFunction::EmitBuiltinExpr(const FunctionDecl *FD,
|
|||
Value *F = CGM.getIntrinsic(Intrinsic::readcyclecounter);
|
||||
return RValue::get(Builder.CreateCall(F));
|
||||
}
|
||||
case Builtin::BI__builtin___clear_cache: {
|
||||
Value *Begin = EmitScalarExpr(E->getArg(0));
|
||||
Value *End = EmitScalarExpr(E->getArg(1));
|
||||
Value *F = CGM.getIntrinsic(Intrinsic::clear_cache);
|
||||
return RValue::get(Builder.CreateCall2(F, Begin, End));
|
||||
}
|
||||
case Builtin::BI__builtin_trap: {
|
||||
Value *F = CGM.getIntrinsic(Intrinsic::trap);
|
||||
return RValue::get(Builder.CreateCall(F));
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
|
||||
|
||||
char buffer[32] = "This is a largely unused buffer";
|
||||
|
||||
// __builtin___clear_cache always maps to @llvm.clear_cache, but what
|
||||
// each back-end produces is different, and this is tested in LLVM
|
||||
|
||||
int main() {
|
||||
__builtin___clear_cache(buffer, buffer+32);
|
||||
// CHECK: @llvm.clear_cache(i8* getelementptr {{.*}}, i8* getelementptr {{.*}} (i8* getelementptr {{.*}} 32))
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue