29#include "llvm/ADT/ScopeExit.h"
30#include "llvm/ADT/StringExtras.h"
31#include "llvm/ADT/StringRef.h"
43 case Stmt::IntegerLiteralClass:
45 case Stmt::StringLiteralClass: {
46 std::string ret(
"\"");
51 case Stmt::CharacterLiteralClass:
52 case Stmt::CXXNullPtrLiteralExprClass:
53 case Stmt::GNUNullExprClass:
54 case Stmt::CXXBoolLiteralExprClass:
55 case Stmt::FloatingLiteralClass:
56 case Stmt::ImaginaryLiteralClass:
57 case Stmt::ObjCStringLiteralClass:
65 if (
const auto *Ph = dyn_cast<til::Phi>(E))
76 if (
const auto *CA = TD.
getAttr<CapabilityAttr>())
77 return {CA->getName(), TD.
hasAttr<ReentrantCapabilityAttr>()};
113 return ME ? ME->isArrow() :
false;
130 if (!DeclExp && !
Self)
139 else if (
const auto *ME = dyn_cast<MemberExpr>(DeclExp)) {
142 }
else if (
const auto *CE = dyn_cast<CXXMemberCallExpr>(DeclExp)) {
143 Ctx.
SelfArg = CE->getImplicitObjectArgument();
145 Ctx.
NumArgs = CE->getNumArgs();
147 }
else if (
const auto *CE = dyn_cast<CallExpr>(DeclExp)) {
152 Ctx.
NumArgs = CE->getNumArgs() - 1;
153 Ctx.
FunArgs = CE->getArgs() + 1;
155 Ctx.
NumArgs = CE->getNumArgs();
158 }
else if (
const auto *CE = dyn_cast<CXXConstructExpr>(DeclExp)) {
160 Ctx.
NumArgs = CE->getNumArgs();
168 if (
const auto *CMD = dyn_cast<CXXMethodDecl>(D))
169 if (CMD->getParent()->isLambda())
173 assert(!Ctx.
SelfArg &&
"Ambiguous self argument");
203 if (
const auto* SLit = dyn_cast<StringLiteral>(AttrExp)) {
204 if (SLit->getString() ==
"*")
215 if (
const auto *OE = dyn_cast<CXXOperatorCallExpr>(AttrExp)) {
216 if (OE->getOperator() == OO_Exclaim) {
218 AttrExp = OE->getArg(0);
221 else if (
const auto *UO = dyn_cast<UnaryOperator>(AttrExp)) {
222 if (UO->getOpcode() == UO_LNot) {
236 if (
const auto *CE = dyn_cast<til::Cast>(E)) {
254 llvm::scope_exit Cleanup([&, RestoreClosure = VarsBeingTranslated.empty()
257 VarsBeingTranslated.erase(VD->getCanonicalDecl());
258 if (VarsBeingTranslated.empty())
259 LookupLocalVarExpr = RestoreClosure;
266 if (LookupLocalVarExpr) {
270 if (
const Expr *E = LookupLocalVarExpr(VD)) {
297 case Stmt::DeclRefExprClass:
299 case Stmt::CXXThisExprClass:
301 case Stmt::MemberExprClass:
303 case Stmt::ObjCIvarRefExprClass:
305 case Stmt::CallExprClass:
307 case Stmt::CXXMemberCallExprClass:
309 case Stmt::CXXOperatorCallExprClass:
311 case Stmt::UnaryOperatorClass:
313 case Stmt::BinaryOperatorClass:
314 case Stmt::CompoundAssignOperatorClass:
317 case Stmt::ArraySubscriptExprClass:
319 case Stmt::ConditionalOperatorClass:
320 return translateAbstractConditionalOperator(
322 case Stmt::BinaryConditionalOperatorClass:
323 return translateAbstractConditionalOperator(
327 case Stmt::ConstantExprClass:
329 case Stmt::ParenExprClass:
331 case Stmt::ExprWithCleanupsClass:
333 case Stmt::CXXBindTemporaryExprClass:
335 case Stmt::MaterializeTemporaryExprClass:
339 case Stmt::CharacterLiteralClass:
342 case Stmt::CXXNullPtrLiteralExprClass:
343 case Stmt::GNUNullExprClass:
345 case Stmt::CXXBoolLiteralExprClass:
347 case Stmt::IntegerLiteralClass: {
350 const llvm::APInt &
Value = IL->getValue();
351 if (BT->isSignedInteger())
353 else if (BT->isUnsignedInteger())
356 llvm_unreachable(
"Invalid integer type");
358 case Stmt::StringLiteralClass:
360 case Stmt::ObjCStringLiteralClass:
364 case Stmt::DeclStmtClass:
366 case Stmt::StmtExprClass:
371 if (
const auto *CE = dyn_cast<CastExpr>(S))
372 return translateCastExpr(CE, Ctx);
382 if (
const auto *PV = dyn_cast<ParmVarDecl>(VD)) {
383 unsigned I = PV->getFunctionScopeIndex();
391 if (
const Expr *
const *FunArgs =
392 dyn_cast<const Expr *const *>(Ctx->
FunArgs)) {
393 assert(I < Ctx->NumArgs);
408 if (
const auto *VarD = dyn_cast<VarDecl>(VD))
412 return new (Arena) til::LiteralPtr(VD);
415til::SExpr *SExprBuilder::translateCXXThisExpr(
const CXXThisExpr *TE,
419 if (
const auto *SelfArg = dyn_cast<const Expr *>(Ctx->
SelfArg))
424 assert(SelfVar &&
"We have no variable for 'this'!");
429 if (
const auto *
V = dyn_cast<til::Variable>(E))
430 return V->clangDecl();
431 if (
const auto *Ph = dyn_cast<til::Phi>(E))
432 return Ph->clangDecl();
433 if (
const auto *P = dyn_cast<til::Project>(E))
434 return P->clangDecl();
435 if (
const auto *L = dyn_cast<til::LiteralPtr>(E))
436 return L->clangDecl();
442 if (VD && VD->getType()->isAnyPointerType())
444 if (
const auto *
C = dyn_cast<til::Cast>(E))
455 if (OverriddenMethods.begin() == OverriddenMethods.end())
458 D = *OverriddenMethods.begin();
463til::SExpr *SExprBuilder::translateMemberExpr(
const MemberExpr *ME,
466 til::SExpr *E =
new (Arena) til::SApply(BE);
469 if (
const auto *VD = dyn_cast<CXXMethodDecl>(D))
472 til::Project *P =
new (Arena) til::Project(E, D);
478til::SExpr *SExprBuilder::translateObjCIVarRefExpr(
const ObjCIvarRefExpr *IVRE,
481 til::SExpr *E =
new (Arena) til::SApply(BE);
485 til::Project *P =
new (Arena) til::Project(E, D);
491til::SExpr *SExprBuilder::translateCallExpr(
const CallExpr *CE,
494 if (CapabilityExprMode) {
497 FD = FD->getMostRecentDecl();
498 if (LockReturnedAttr *At = FD->getAttr<LockReturnedAttr>()) {
501 LRCallCtx.SelfArg = SelfE;
503 LRCallCtx.FunArgs = CE->
getArgs();
504 return const_cast<til::SExpr *
>(
511 for (
const auto *Arg : CE->
arguments()) {
513 E =
new (Arena) til::Apply(E, A);
515 return new (Arena) til::Call(E, CE);
518til::SExpr *SExprBuilder::translateCXXMemberCallExpr(
520 if (CapabilityExprMode) {
533til::SExpr *SExprBuilder::translateCXXOperatorCallExpr(
535 if (CapabilityExprMode) {
538 if (k == OO_Star || k == OO_Arrow) {
547til::SExpr *SExprBuilder::translateUnaryOperator(
const UnaryOperator *UO,
554 return new (Arena) til::Undefined(UO);
557 if (CapabilityExprMode) {
559 if (
const auto *DRE = dyn_cast<DeclRefExpr>(UO->
getSubExpr())) {
563 auto *W =
new (Arena) til::Wildcard();
564 return new (Arena) til::Project(W, DRE->
getDecl());
591 return new (Arena) til::Undefined(UO);
593 return new (Arena) til::Undefined(UO);
597 const BinaryOperator *BO,
602 return new (Arena) til::BinaryOp(Op, E1, E0);
604 return new (Arena) til::BinaryOp(Op, E0, E1);
608 const BinaryOperator *BO,
611 const Expr *LHS = BO->
getLHS();
612 const Expr *RHS = BO->
getRHS();
616 const ValueDecl *VD =
nullptr;
617 til::SExpr *CV =
nullptr;
618 if (
const auto *DRE = dyn_cast<DeclRefExpr>(LHS)) {
620 CV = lookupVarDecl(VD);
624 til::SExpr *Arg = CV ? CV :
new (Arena) til::Load(E0);
625 E1 =
new (Arena) til::BinaryOp(Op, Arg, E1);
626 E1 = addStatement(E1,
nullptr, VD);
629 return updateVarDecl(VD, E1);
630 return new (Arena) til::Store(E0, E1);
633til::SExpr *SExprBuilder::translateBinaryOperator(
const BinaryOperator *BO,
638 return new (Arena) til::Undefined(BO);
640 case BO_Mul:
return translateBinOp(
til::BOP_Mul, BO, Ctx);
641 case BO_Div:
return translateBinOp(
til::BOP_Div, BO, Ctx);
642 case BO_Rem:
return translateBinOp(
til::BOP_Rem, BO, Ctx);
643 case BO_Add:
return translateBinOp(
til::BOP_Add, BO, Ctx);
644 case BO_Sub:
return translateBinOp(
til::BOP_Sub, BO, Ctx);
645 case BO_Shl:
return translateBinOp(
til::BOP_Shl, BO, Ctx);
646 case BO_Shr:
return translateBinOp(
til::BOP_Shr, BO, Ctx);
647 case BO_LT:
return translateBinOp(
til::BOP_Lt, BO, Ctx);
648 case BO_GT:
return translateBinOp(
til::BOP_Lt, BO, Ctx,
true);
649 case BO_LE:
return translateBinOp(
til::BOP_Leq, BO, Ctx);
650 case BO_GE:
return translateBinOp(
til::BOP_Leq, BO, Ctx,
true);
651 case BO_EQ:
return translateBinOp(
til::BOP_Eq, BO, Ctx);
652 case BO_NE:
return translateBinOp(
til::BOP_Neq, BO, Ctx);
653 case BO_Cmp:
return translateBinOp(
til::BOP_Cmp, BO, Ctx);
660 case BO_Assign:
return translateBinAssign(
til::BOP_Eq, BO, Ctx,
true);
661 case BO_MulAssign:
return translateBinAssign(
til::BOP_Mul, BO, Ctx);
662 case BO_DivAssign:
return translateBinAssign(
til::BOP_Div, BO, Ctx);
663 case BO_RemAssign:
return translateBinAssign(
til::BOP_Rem, BO, Ctx);
664 case BO_AddAssign:
return translateBinAssign(
til::BOP_Add, BO, Ctx);
665 case BO_SubAssign:
return translateBinAssign(
til::BOP_Sub, BO, Ctx);
666 case BO_ShlAssign:
return translateBinAssign(
til::BOP_Shl, BO, Ctx);
667 case BO_ShrAssign:
return translateBinAssign(
til::BOP_Shr, BO, Ctx);
668 case BO_AndAssign:
return translateBinAssign(
til::BOP_BitAnd, BO, Ctx);
669 case BO_XorAssign:
return translateBinAssign(
til::BOP_BitXor, BO, Ctx);
670 case BO_OrAssign:
return translateBinAssign(
til::BOP_BitOr, BO, Ctx);
676 return new (Arena) til::Undefined(BO);
683 case CK_LValueToRValue: {
684 if (
const auto *DRE = dyn_cast<DeclRefExpr>(CE->
getSubExpr())) {
685 til::SExpr *E0 = lookupVarDecl(DRE->
getDecl());
695 case CK_DerivedToBase:
696 case CK_UncheckedDerivedToBase:
697 case CK_ArrayToPointerDecay:
698 case CK_FunctionToPointerDecay: {
705 if (CapabilityExprMode)
713SExprBuilder::translateArraySubscriptExpr(
const ArraySubscriptExpr *E,
717 return new (Arena) til::ArrayIndex(E0, E1);
721SExprBuilder::translateAbstractConditionalOperator(
726 return new (Arena) til::IfThenElse(
C, T, E);
730SExprBuilder::translateDeclStmt(
const DeclStmt *S,
CallingContext *Ctx) {
732 for (
auto *I : DGrp) {
733 if (
auto *VD = dyn_cast_or_null<VarDecl>(I)) {
734 Expr *E = VD->getInit();
740 return addVarDecl(VD, SE);
749til::SExpr *SExprBuilder::translateStmtExpr(
const StmtExpr *SE,
754 return CS->
body_empty() ?
new (Arena) til::Undefined(SE)
763 const ValueDecl *VD) {
767 E =
new (Arena) til::Variable(E, VD);
768 CurrentInstructions.push_back(E);
775til::SExpr *SExprBuilder::lookupVarDecl(
const ValueDecl *VD) {
776 auto It = LVarIdxMap.find(VD);
777 if (It != LVarIdxMap.end()) {
778 assert(CurrentLVarMap[It->second].first == VD);
779 return CurrentLVarMap[It->second].second;
788 if (
auto *
V = dyn_cast<til::Variable>(E)) {
797 LVarIdxMap.insert(std::make_pair(VD, CurrentLVarMap.size()));
798 CurrentLVarMap.makeWritable();
799 CurrentLVarMap.push_back(std::make_pair(VD, E));
806 auto It = LVarIdxMap.find(VD);
807 if (It == LVarIdxMap.end()) {
808 til::SExpr *Ptr =
new (Arena) til::LiteralPtr(VD);
809 til::SExpr *St =
new (Arena) til::Store(Ptr, E);
812 CurrentLVarMap.makeWritable();
813 CurrentLVarMap.elem(It->second).second = E;
820void SExprBuilder::makePhiNodeVar(
unsigned i,
unsigned NPreds,
til::SExpr *E) {
821 unsigned ArgIndex = CurrentBlockInfo->ProcessedPredecessors;
822 assert(ArgIndex > 0 && ArgIndex < NPreds);
824 til::SExpr *CurrE = CurrentLVarMap[i].second;
825 if (CurrE->
block() == CurrentBB) {
828 auto *Ph = dyn_cast<til::Phi>(CurrE);
829 assert(Ph &&
"Expecting Phi node.");
831 Ph->values()[ArgIndex] = E;
837 til::Phi *Ph =
new (Arena) til::Phi(Arena, NPreds);
839 for (
unsigned PIdx = 0; PIdx < ArgIndex; ++PIdx)
840 Ph->
values()[PIdx] = CurrE;
842 Ph->
values()[ArgIndex] = E;
850 CurrentArguments.push_back(Ph);
852 IncompleteArgs.push_back(Ph);
854 CurrentLVarMap.makeWritable();
855 CurrentLVarMap.elem(i).second = Ph;
860void SExprBuilder::mergeEntryMap(LVarDefinitionMap Map) {
861 assert(CurrentBlockInfo &&
"Not processing a block!");
863 if (!CurrentLVarMap.valid()) {
865 CurrentLVarMap = std::move(Map);
868 if (CurrentLVarMap.sameAs(Map))
871 unsigned NPreds = CurrentBB->numPredecessors();
872 unsigned ESz = CurrentLVarMap.size();
873 unsigned MSz = Map.size();
874 unsigned Sz = std::min(ESz, MSz);
876 for (
unsigned i = 0; i < Sz; ++i) {
877 if (CurrentLVarMap[i].first != Map[i].first) {
879 CurrentLVarMap.makeWritable();
880 CurrentLVarMap.downsize(i);
883 if (CurrentLVarMap[i].second != Map[i].second)
884 makePhiNodeVar(i, NPreds, Map[i].second);
887 CurrentLVarMap.makeWritable();
888 CurrentLVarMap.downsize(Map.size());
894void SExprBuilder::mergeEntryMapBackEdge() {
903 assert(CurrentBlockInfo &&
"Not processing a block!");
905 if (CurrentBlockInfo->HasBackEdges)
907 CurrentBlockInfo->HasBackEdges =
true;
909 CurrentLVarMap.makeWritable();
910 unsigned Sz = CurrentLVarMap.size();
911 unsigned NPreds = CurrentBB->numPredecessors();
913 for (
unsigned i = 0; i < Sz; ++i)
914 makePhiNodeVar(i, NPreds,
nullptr);
920void SExprBuilder::mergePhiNodesBackEdge(
const CFGBlock *Blk) {
922 unsigned ArgIndex = BBInfo[Blk->
getBlockID()].ProcessedPredecessors;
923 assert(ArgIndex > 0 && ArgIndex < BB->numPredecessors());
926 auto *Ph = dyn_cast_or_null<til::Phi>(PE);
927 assert(Ph &&
"Expecting Phi Node.");
928 assert(Ph->
values()[ArgIndex] ==
nullptr &&
"Wrong index for back edge.");
930 til::SExpr *E = lookupVarDecl(Ph->
clangDecl());
931 assert(E &&
"Couldn't find local variable for Phi node.");
932 Ph->
values()[ArgIndex] = E;
936void SExprBuilder::enterCFG(CFG *Cfg,
const NamedDecl *D,
937 const CFGBlock *
First) {
940 Scfg =
new (Arena) til::SCFG(Arena, NBlocks);
943 BBInfo.resize(NBlocks);
944 BlockMap.resize(NBlocks,
nullptr);
946 for (
auto *B : *Cfg) {
947 auto *BB =
new (Arena) til::BasicBlock(Arena);
949 BlockMap[B->getBlockID()] = BB;
955 for (
auto *Pm : Parms) {
956 QualType T = Pm->getType();
962 til::SExpr *Lp =
new (Arena) til::LiteralPtr(Pm);
963 til::SExpr *Ld =
new (Arena) til::Load(Lp);
964 til::SExpr *
V = addStatement(Ld,
nullptr, Pm);
969void SExprBuilder::enterCFGBlock(
const CFGBlock *B) {
972 CurrentBB->reservePredecessors(B->
pred_size());
973 Scfg->add(CurrentBB);
982void SExprBuilder::handlePredecessor(
const CFGBlock *Pred) {
985 CurrentBB->addPredecessor(BlockMap[Pred->
getBlockID()]);
986 BlockInfo *PredInfo = &BBInfo[Pred->
getBlockID()];
987 assert(PredInfo->UnprocessedSuccessors > 0);
989 if (--PredInfo->UnprocessedSuccessors == 0)
990 mergeEntryMap(std::move(PredInfo->ExitMap));
992 mergeEntryMap(PredInfo->ExitMap.clone());
994 ++CurrentBlockInfo->ProcessedPredecessors;
997void SExprBuilder::handlePredecessorBackEdge(
const CFGBlock *Pred) {
998 mergeEntryMapBackEdge();
1001void SExprBuilder::enterCFGBlockBody(
const CFGBlock *B) {
1004 CurrentBB->arguments().reserve(
1005 static_cast<unsigned>(CurrentArguments.size()), Arena);
1006 for (
auto *A : CurrentArguments)
1007 CurrentBB->addArgument(A);
1010void SExprBuilder::handleStatement(
const Stmt *S) {
1015void SExprBuilder::handleDestructorCall(
const VarDecl *VD,
1016 const CXXDestructorDecl *DD) {
1017 til::SExpr *Sf =
new (Arena) til::LiteralPtr(VD);
1018 til::SExpr *Dr =
new (Arena) til::LiteralPtr(DD);
1019 til::SExpr *Ap =
new (Arena) til::Apply(Dr, Sf);
1020 til::SExpr *E =
new (Arena) til::Call(Ap);
1021 addStatement(E,
nullptr);
1024void SExprBuilder::exitCFGBlockBody(
const CFGBlock *B) {
1025 CurrentBB->instructions().reserve(
1026 static_cast<unsigned>(CurrentInstructions.size()), Arena);
1027 for (
auto *
V : CurrentInstructions)
1028 CurrentBB->addInstruction(
V);
1037 auto *Tm =
new (Arena) til::Goto(BB, Idx);
1038 CurrentBB->setTerminator(Tm);
1046 auto *Tm =
new (Arena) til::Branch(
C, BB1, BB2);
1047 CurrentBB->setTerminator(Tm);
1051void SExprBuilder::handleSuccessor(
const CFGBlock *Succ) {
1052 ++CurrentBlockInfo->UnprocessedSuccessors;
1055void SExprBuilder::handleSuccessorBackEdge(
const CFGBlock *Succ) {
1056 mergePhiNodesBackEdge(Succ);
1057 ++BBInfo[Succ->
getBlockID()].ProcessedPredecessors;
1060void SExprBuilder::exitCFGBlock(
const CFGBlock *B) {
1061 CurrentArguments.clear();
1062 CurrentInstructions.clear();
1063 CurrentBlockInfo->ExitMap = std::move(CurrentLVarMap);
1064 CurrentBB =
nullptr;
1065 CurrentBlockInfo =
nullptr;
1068void SExprBuilder::exitCFG(
const CFGBlock *
Last) {
1069 for (
auto *Ph : IncompleteArgs) {
1074 CurrentArguments.clear();
1075 CurrentInstructions.clear();
1076 IncompleteArgs.clear();
1091 llvm::BumpPtrAllocator Bpa;
1095 TILPrinter::print(Scfg, llvm::errs());
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines the clang::Expr interface and subclasses for C++ expressions.
static const Decl * getCanonicalDecl(const Decl *D)
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines an enumeration for C++ overloaded operators.
static std::string toString(const clang::SanitizerSet &Sanitizers)
Produce a string containing comma-separated names of sanitizers in Sanitizers set.
Defines various enumerations that describe declaration and type specifiers.
static bool isIncompletePhi(const til::SExpr *E)
SExprBuilder::CallingContext CallingContext
static const ValueDecl * getValueDeclFromSExpr(const til::SExpr *E)
static void maybeUpdateVD(til::SExpr *E, const ValueDecl *VD)
static bool hasAnyPointerType(const til::SExpr *E)
static const CXXMethodDecl * getFirstVirtualDecl(const CXXMethodDecl *D)
static std::pair< StringRef, bool > classifyCapability(const TypeDecl &TD)
static bool isCalleeArrow(const Expr *E)
static constexpr std::pair< StringRef, bool > ClassifyCapabilityFallback
C Language Family Type Representation.
Expr * getCond() const
getCond - Return the expression representing the condition for the ?
Expr * getTrueExpr() const
getTrueExpr - Return the subexpression representing the value of the expression if the condition eval...
Expr * getFalseExpr() const
getFalseExpr - Return the subexpression representing the value of the expression if the condition eva...
succ_iterator succ_begin()
unsigned pred_size() const
const Stmt * getTerminatorCondition(bool StripParens=true) const
unsigned getBlockID() const
unsigned succ_size() const
unsigned getNumBlockIDs() const
Returns the total number of BlockIDs allocated (which start at 0).
CXXMethodDecl * getMethodDecl() const
Retrieve the declaration of the called method.
Expr * getImplicitObjectArgument() const
Retrieve the implicit object argument for the member call.
Represents a static or instance method of a struct/union/class.
overridden_method_range overridden_methods() const
CXXMethodDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
OverloadedOperatorKind getOperator() const
Returns the kind of overloaded operator that this expression refers to.
Expr * getArg(unsigned Arg)
getArg - Return the specified argument.
FunctionDecl * getDirectCallee()
If the callee is a FunctionDecl, return it. Otherwise return null.
unsigned getNumArgs() const
getNumArgs - Return the number of actual arguments to this call.
Expr ** getArgs()
Retrieve the call arguments.
CastKind getCastKind() const
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
A reference to a declared variable, function, enum, etc.
const DeclGroupRef getDeclGroup() const
Decl - This represents one declaration (or definition), e.g.
ASTContext & getASTContext() const LLVM_READONLY
virtual Decl * getCanonicalDecl()
Retrieves the "canonical" declaration of the given declaration.
This represents one expression.
Expr * IgnoreParenCasts() LLVM_READONLY
Skip past any parentheses and casts which might surround this expression until reaching a fixed point...
Expr * IgnoreImplicit() LLVM_READONLY
Skip past any implicit AST nodes which might surround this expression until reaching a fixed point.
ValueDecl * getMemberDecl() const
Retrieve the member declaration to which this expression refers.
This represents a decl that may have a name.
std::string getNameAsString() const
Get a human-readable name for the declaration, even if it is one of the special kinds of names (C++ c...
bool isCXXInstanceMember() const
Determine whether the given declaration is an instance member of a C++ class.
ObjCIvarDecl * getCanonicalDecl() override
Retrieves the canonical declaration of this field.
const Expr * getBase() const
A (possibly-)qualified type.
bool isTrivialType(const ASTContext &Context) const
Return true if this is a trivial type per (C++0x [basic.types]p9)
CompoundStmt * getSubStmt()
Stmt - This represents one statement.
StmtClass getStmtClass() const
Represents a declaration of a type.
RecordDecl * getAsRecordDecl() const
Retrieves the RecordDecl this type refers to.
bool isPointerType() const
QualType getPointeeType() const
If this is a pointer, ObjC object pointer, or block pointer, this returns the respective pointee.
bool isPointerOrReferenceType() const
const T * getAs() const
Member-template getAs<specific type>'.
Expr * getSubExpr() const
Represent the declaration of a variable (in which case it is an lvalue) a function (in which case it ...
Represents a variable declaration or definition.
VarDecl * getCanonicalDecl() override
Retrieves the "canonical" declaration of the given declaration.
bool isStaticLocal() const
Returns true if a variable with function scope is a static local variable.
const til::SExpr * sexpr() const
CapabilityExpr translateAttrExpr(const Expr *AttrExp, const NamedDecl *D, const Expr *DeclExp, til::SExpr *Self=nullptr)
Translate a clang expression in an attribute to a til::SExpr.
til::SExpr * translate(const Stmt *S, CallingContext *Ctx)
til::SExpr * lookupStmt(const Stmt *S)
til::SCFG * buildCFG(CFGWalker &Walker)
til::SExpr * translateVariable(const VarDecl *VD, CallingContext *Ctx)
til::BasicBlock * lookupBlock(const CFGBlock *B)
const InstrArray & arguments() const
void reserveInstructions(unsigned Nins)
unsigned findPredecessorIndex(const BasicBlock *BB) const
Return the index of BB, or Predecessors.size if BB is not a predecessor.
A Literal pointer to an object allocated in memory.
const ValueDecl * clangDecl() const
Return the clang declaration of the variable for this Phi node, if any.
void setClangDecl(const ValueDecl *Cvd)
Set the clang variable associated with this Phi node.
const ValArray & values() const
An SCFG is a control-flow graph.
Base class for AST nodes in the typed intermediate language.
BasicBlock * block() const
Returns the block, if this is an instruction in a basic block, otherwise returns null.
void setValues(unsigned Sz, const T &C)
Placeholder for expressions that cannot be represented in the TIL.
Placeholder for a wildcard that matches any other expression.
bool isTrivial(const SExpr *E)
void simplifyIncompleteArg(til::Phi *Ph)
TIL_BinaryOpcode
Opcode for binary arithmetic operations.
void printSCFG(CFGWalker &Walker)
std::string getSourceLiteralString(const Expr *CE)
The JSON file list parser is used to communicate input to InstallAPI.
OverloadedOperatorKind
Enumeration specifying the different kinds of C++ overloaded operators.
bool isa(CodeGen::Address addr)
@ Self
'self' clause, allowed on Compute and Combined Constructs, plus 'update'.
nullptr
This class represents a compute construct, representing a 'Kind' of ‘parallel’, 'serial',...
@ Result
The result type of a method or function.
CastKind
CastKind - The kind of operation required for a conversion.
U cast(CodeGen::Address addr)
Encapsulates the lexical context of a function call.
llvm::PointerUnion< const Expr *const *, til::SExpr * > FunArgs
const NamedDecl * AttrDecl
llvm::PointerUnion< const Expr *, til::SExpr * > SelfArg