]> granicus.if.org Git - clang/commitdiff
ARM: Add dbg builtin intrinsic
authorYi Kong <Yi.Kong@arm.com>
Tue, 26 Aug 2014 12:48:06 +0000 (12:48 +0000)
committerYi Kong <Yi.Kong@arm.com>
Tue, 26 Aug 2014 12:48:06 +0000 (12:48 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@216452 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/BuiltinsARM.def
lib/CodeGen/CGBuiltin.cpp
lib/Sema/SemaChecking.cpp
test/CodeGen/builtins-arm.c
test/Sema/builtins-arm.c

index 4c1400acf3f710488b4f21e36298d1221d270091..1f2f9a3840c32f639686d70f11bcfbe90daa8f86 100644 (file)
@@ -74,6 +74,7 @@ BUILTIN(__builtin_arm_wfe, "v", "")
 BUILTIN(__builtin_arm_wfi, "v", "")
 BUILTIN(__builtin_arm_sev, "v", "")
 BUILTIN(__builtin_arm_sevl, "v", "")
+BUILTIN(__builtin_arm_dbg, "vUi", "")
 
 // Data barrier
 BUILTIN(__builtin_arm_dmb, "vUi", "nc")
index 76e6e7c4a4061559282432f8f70921373227f75d..181bdc4b27900ec6128b345891fcc740e8360d55 100644 (file)
@@ -3094,6 +3094,11 @@ Value *CodeGenFunction::EmitARMBuiltinExpr(unsigned BuiltinID,
     return Builder.CreateCall(F, llvm::ConstantInt::get(Int32Ty, HintID));
   }
 
+  if (BuiltinID == ARM::BI__builtin_arm_dbg) {
+    Value *Option = EmitScalarExpr(E->getArg(0));
+    return Builder.CreateCall(CGM.getIntrinsic(Intrinsic::arm_dbg), Option);
+  }
+
   if (BuiltinID == ARM::BI__builtin_arm_prefetch) {
     Value *Address = EmitScalarExpr(E->getArg(0));
     Value *RW      = EmitScalarExpr(E->getArg(1));
index 95411f568818f9dda1d88595880581ddd1484f1b..331c5b31a7985a3a8cb2b3f19e3c3bfaa8896e35 100644 (file)
@@ -643,7 +643,8 @@ bool Sema::CheckARMBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
   case ARM::BI__builtin_arm_vcvtr_d: i = 1; u = 1; break;
   case ARM::BI__builtin_arm_dmb:
   case ARM::BI__builtin_arm_dsb:
-  case ARM::BI__builtin_arm_isb: l = 0; u = 15; break;
+  case ARM::BI__builtin_arm_isb:
+  case ARM::BI__builtin_arm_dbg: l = 0; u = 15; break;
   }
 
   // FIXME: VFP Intrinsics should error if VFP not present.
@@ -681,7 +682,6 @@ bool Sema::CheckAArch64BuiltinFunctionCall(unsigned BuiltinID,
   case AArch64::BI__builtin_arm_isb: l = 0; u = 15; break;
   }
 
-  // FIXME: VFP Intrinsics should error if VFP not present.
   return SemaBuiltinConstantArgRange(TheCall, i, l, u + l);
 }
 
index c7668d02f91f55e369f161e74a680be2788e29e9..9f3ed9ac78a1459f02b292711b59af17a3880a31 100644 (file)
@@ -55,6 +55,12 @@ void sevl() {
 
 // CHECK: call {{.*}} @llvm.arm.hint(i32 5)
 
+void dbg() {
+  __builtin_arm_dbg(0);
+}
+
+// CHECK: call {{.*}} @llvm.arm.dbg(i32 0)
+
 void test_barrier() {
   __builtin_arm_dmb(1); //CHECK: call {{.*}} @llvm.arm.dmb(i32 1)
   __builtin_arm_dsb(2); //CHECK: call {{.*}} @llvm.arm.dsb(i32 2)
index cc4af7d11df70b17cf91e85488e0923f3e56bac8..37604dc8bd4335f83d588f2227453377bb8d0a53 100644 (file)
@@ -30,6 +30,7 @@ void test2() {
   __builtin_va_list ptr = "x";
   *ptr = '0'; // expected-error {{incomplete type 'void' is not assignable}}
 }
+#endif
 
 void test3() {
   __builtin_arm_dsb(16); // expected-error {{argument should be a value from 0 to 15}}
@@ -42,4 +43,6 @@ void test4() {
   __builtin_arm_prefetch(0, 0, 2); // expected-error {{argument should be a value from 0 to 1}}
 }
 
-#endif
+void test5() {
+  __builtin_arm_dbg(16); // expected-error {{argument should be a value from 0 to 15}}
+}