clang 23.0.0git
AVR.cpp
Go to the documentation of this file.
1//===------ AVR.cpp - Emit LLVM Code for AVR builtins ---------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8//
9// This contains code to emit Builtin calls as LLVM code.
10//
11//===----------------------------------------------------------------------===//
12
13#include "CGBuiltin.h"
15#include "llvm/IR/InlineAsm.h"
16#include "llvm/IR/IntrinsicsAVR.h"
17
18using namespace clang;
19using namespace CodeGen;
20using namespace llvm;
21
23 const CallExpr *E) {
24 switch (BuiltinID) {
25 default:
26 return nullptr;
27 case AVR::BI__builtin_avr_nop:
28 return Builder.CreateCall(CGM.getIntrinsic(Intrinsic::avr_nop));
29 case AVR::BI__builtin_avr_sei:
30 return Builder.CreateCall(CGM.getIntrinsic(Intrinsic::avr_sei));
31 case AVR::BI__builtin_avr_cli:
32 return Builder.CreateCall(CGM.getIntrinsic(Intrinsic::avr_cli));
33 case AVR::BI__builtin_avr_sleep:
34 return Builder.CreateCall(CGM.getIntrinsic(Intrinsic::avr_sleep));
35 case AVR::BI__builtin_avr_wdr:
36 return Builder.CreateCall(CGM.getIntrinsic(Intrinsic::avr_wdr));
37 case AVR::BI__builtin_avr_swap: {
38 Value *Arg0 = EmitScalarExpr(E->getArg(0));
39 return Builder.CreateCall(CGM.getIntrinsic(Intrinsic::avr_swap), Arg0);
40 }
41 }
42}
Enumerates target-specific builtins in their own namespaces within namespace clang.
CallExpr - Represents a function call (C99 6.5.2.2, C++ [expr.call]).
Definition Expr.h:2946
Expr * getArg(unsigned Arg)
getArg - Return the specified argument.
Definition Expr.h:3150
llvm::Value * EmitAVRBuiltinExpr(unsigned BuiltinID, const CallExpr *E)
Definition AVR.cpp:22
llvm::Value * EmitScalarExpr(const Expr *E, bool IgnoreResultAssign=false)
EmitScalarExpr - Emit the computation of the specified expression of LLVM scalar type,...
The JSON file list parser is used to communicate input to InstallAPI.
Diagnostic wrappers for TextAPI types for error reporting.
Definition Dominators.h:30