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)) {
252 auto Cleanup = llvm::make_scope_exit(
258 if (LookupLocalVarExpr) {
262 if (
const Expr *E = LookupLocalVarExpr(VD)) {
289 case Stmt::DeclRefExprClass:
291 case Stmt::CXXThisExprClass:
293 case Stmt::MemberExprClass:
295 case Stmt::ObjCIvarRefExprClass:
297 case Stmt::CallExprClass:
299 case Stmt::CXXMemberCallExprClass:
301 case Stmt::CXXOperatorCallExprClass:
303 case Stmt::UnaryOperatorClass:
305 case Stmt::BinaryOperatorClass:
306 case Stmt::CompoundAssignOperatorClass:
309 case Stmt::ArraySubscriptExprClass:
311 case Stmt::ConditionalOperatorClass:
312 return translateAbstractConditionalOperator(
314 case Stmt::BinaryConditionalOperatorClass:
315 return translateAbstractConditionalOperator(
319 case Stmt::ConstantExprClass:
321 case Stmt::ParenExprClass:
323 case Stmt::ExprWithCleanupsClass:
325 case Stmt::CXXBindTemporaryExprClass:
327 case Stmt::MaterializeTemporaryExprClass:
331 case Stmt::CharacterLiteralClass:
332 case Stmt::CXXNullPtrLiteralExprClass:
333 case Stmt::GNUNullExprClass:
334 case Stmt::CXXBoolLiteralExprClass:
335 case Stmt::FloatingLiteralClass:
336 case Stmt::ImaginaryLiteralClass:
337 case Stmt::IntegerLiteralClass:
338 case Stmt::StringLiteralClass:
339 case Stmt::ObjCStringLiteralClass:
342 case Stmt::DeclStmtClass:
344 case Stmt::StmtExprClass:
349 if (
const auto *CE = dyn_cast<CastExpr>(S))
350 return translateCastExpr(CE, Ctx);
360 if (
const auto *PV = dyn_cast<ParmVarDecl>(VD)) {
361 unsigned I = PV->getFunctionScopeIndex();
369 if (
const Expr *
const *FunArgs =
370 dyn_cast<const Expr *const *>(Ctx->
FunArgs)) {
371 assert(I < Ctx->NumArgs);
386 if (
const auto *VarD = dyn_cast<VarDecl>(VD))
390 return new (Arena) til::LiteralPtr(VD);
393til::SExpr *SExprBuilder::translateCXXThisExpr(
const CXXThisExpr *TE,
397 if (
const auto *SelfArg = dyn_cast<const Expr *>(Ctx->
SelfArg))
402 assert(SelfVar &&
"We have no variable for 'this'!");
407 if (
const auto *
V = dyn_cast<til::Variable>(E))
408 return V->clangDecl();
409 if (
const auto *Ph = dyn_cast<til::Phi>(E))
410 return Ph->clangDecl();
411 if (
const auto *P = dyn_cast<til::Project>(E))
412 return P->clangDecl();
413 if (
const auto *L = dyn_cast<til::LiteralPtr>(E))
414 return L->clangDecl();
420 if (VD && VD->getType()->isAnyPointerType())
422 if (
const auto *
C = dyn_cast<til::Cast>(E))
433 if (OverriddenMethods.begin() == OverriddenMethods.end())
436 D = *OverriddenMethods.begin();
441til::SExpr *SExprBuilder::translateMemberExpr(
const MemberExpr *ME,
444 til::SExpr *E =
new (Arena) til::SApply(BE);
447 if (
const auto *VD = dyn_cast<CXXMethodDecl>(D))
450 til::Project *P =
new (Arena) til::Project(E, D);
456til::SExpr *SExprBuilder::translateObjCIVarRefExpr(
const ObjCIvarRefExpr *IVRE,
459 til::SExpr *E =
new (Arena) til::SApply(BE);
463 til::Project *P =
new (Arena) til::Project(E, D);
469til::SExpr *SExprBuilder::translateCallExpr(
const CallExpr *CE,
472 if (CapabilityExprMode) {
475 FD = FD->getMostRecentDecl();
476 if (LockReturnedAttr *At = FD->getAttr<LockReturnedAttr>()) {
479 LRCallCtx.SelfArg = SelfE;
481 LRCallCtx.FunArgs = CE->
getArgs();
482 return const_cast<til::SExpr *
>(
489 for (
const auto *Arg : CE->
arguments()) {
491 E =
new (Arena) til::Apply(E, A);
493 return new (Arena) til::Call(E, CE);
496til::SExpr *SExprBuilder::translateCXXMemberCallExpr(
498 if (CapabilityExprMode) {
511til::SExpr *SExprBuilder::translateCXXOperatorCallExpr(
513 if (CapabilityExprMode) {
516 if (k == OO_Star || k == OO_Arrow) {
525til::SExpr *SExprBuilder::translateUnaryOperator(
const UnaryOperator *UO,
532 return new (Arena) til::Undefined(UO);
535 if (CapabilityExprMode) {
537 if (
const auto *DRE = dyn_cast<DeclRefExpr>(UO->
getSubExpr())) {
541 auto *W =
new (Arena) til::Wildcard();
542 return new (Arena) til::Project(W, DRE->
getDecl());
569 return new (Arena) til::Undefined(UO);
571 return new (Arena) til::Undefined(UO);
575 const BinaryOperator *BO,
580 return new (Arena) til::BinaryOp(Op, E1, E0);
582 return new (Arena) til::BinaryOp(Op, E0, E1);
586 const BinaryOperator *BO,
589 const Expr *LHS = BO->
getLHS();
590 const Expr *RHS = BO->
getRHS();
594 const ValueDecl *VD =
nullptr;
595 til::SExpr *CV =
nullptr;
596 if (
const auto *DRE = dyn_cast<DeclRefExpr>(LHS)) {
598 CV = lookupVarDecl(VD);
602 til::SExpr *Arg = CV ? CV :
new (Arena) til::Load(E0);
603 E1 =
new (Arena) til::BinaryOp(Op, Arg, E1);
604 E1 = addStatement(E1,
nullptr, VD);
607 return updateVarDecl(VD, E1);
608 return new (Arena) til::Store(E0, E1);
611til::SExpr *SExprBuilder::translateBinaryOperator(
const BinaryOperator *BO,
616 return new (Arena) til::Undefined(BO);
618 case BO_Mul:
return translateBinOp(
til::BOP_Mul, BO, Ctx);
619 case BO_Div:
return translateBinOp(
til::BOP_Div, BO, Ctx);
620 case BO_Rem:
return translateBinOp(
til::BOP_Rem, BO, Ctx);
621 case BO_Add:
return translateBinOp(
til::BOP_Add, BO, Ctx);
622 case BO_Sub:
return translateBinOp(
til::BOP_Sub, BO, Ctx);
623 case BO_Shl:
return translateBinOp(
til::BOP_Shl, BO, Ctx);
624 case BO_Shr:
return translateBinOp(
til::BOP_Shr, BO, Ctx);
625 case BO_LT:
return translateBinOp(
til::BOP_Lt, BO, Ctx);
626 case BO_GT:
return translateBinOp(
til::BOP_Lt, BO, Ctx,
true);
627 case BO_LE:
return translateBinOp(
til::BOP_Leq, BO, Ctx);
628 case BO_GE:
return translateBinOp(
til::BOP_Leq, BO, Ctx,
true);
629 case BO_EQ:
return translateBinOp(
til::BOP_Eq, BO, Ctx);
630 case BO_NE:
return translateBinOp(
til::BOP_Neq, BO, Ctx);
631 case BO_Cmp:
return translateBinOp(
til::BOP_Cmp, BO, Ctx);
638 case BO_Assign:
return translateBinAssign(
til::BOP_Eq, BO, Ctx,
true);
639 case BO_MulAssign:
return translateBinAssign(
til::BOP_Mul, BO, Ctx);
640 case BO_DivAssign:
return translateBinAssign(
til::BOP_Div, BO, Ctx);
641 case BO_RemAssign:
return translateBinAssign(
til::BOP_Rem, BO, Ctx);
642 case BO_AddAssign:
return translateBinAssign(
til::BOP_Add, BO, Ctx);
643 case BO_SubAssign:
return translateBinAssign(
til::BOP_Sub, BO, Ctx);
644 case BO_ShlAssign:
return translateBinAssign(
til::BOP_Shl, BO, Ctx);
645 case BO_ShrAssign:
return translateBinAssign(
til::BOP_Shr, BO, Ctx);
646 case BO_AndAssign:
return translateBinAssign(
til::BOP_BitAnd, BO, Ctx);
647 case BO_XorAssign:
return translateBinAssign(
til::BOP_BitXor, BO, Ctx);
648 case BO_OrAssign:
return translateBinAssign(
til::BOP_BitOr, BO, Ctx);
654 return new (Arena) til::Undefined(BO);
661 case CK_LValueToRValue: {
662 if (
const auto *DRE = dyn_cast<DeclRefExpr>(CE->
getSubExpr())) {
663 til::SExpr *E0 = lookupVarDecl(DRE->
getDecl());
673 case CK_DerivedToBase:
674 case CK_UncheckedDerivedToBase:
675 case CK_ArrayToPointerDecay:
676 case CK_FunctionToPointerDecay: {
683 if (CapabilityExprMode)
691SExprBuilder::translateArraySubscriptExpr(
const ArraySubscriptExpr *E,
695 return new (Arena) til::ArrayIndex(E0, E1);
699SExprBuilder::translateAbstractConditionalOperator(
704 return new (Arena) til::IfThenElse(
C,
T, E);
708SExprBuilder::translateDeclStmt(
const DeclStmt *S,
CallingContext *Ctx) {
710 for (
auto *I : DGrp) {
711 if (
auto *VD = dyn_cast_or_null<VarDecl>(I)) {
712 Expr *E = VD->getInit();
718 return addVarDecl(VD, SE);
727til::SExpr *SExprBuilder::translateStmtExpr(
const StmtExpr *SE,
732 return CS->
body_empty() ?
new (Arena) til::Undefined(SE)
741 const ValueDecl *VD) {
745 E =
new (Arena) til::Variable(E, VD);
746 CurrentInstructions.push_back(E);
753til::SExpr *SExprBuilder::lookupVarDecl(
const ValueDecl *VD) {
754 auto It = LVarIdxMap.find(VD);
755 if (It != LVarIdxMap.end()) {
756 assert(CurrentLVarMap[It->second].first == VD);
757 return CurrentLVarMap[It->second].second;
766 if (
auto *
V = dyn_cast<til::Variable>(E)) {
775 LVarIdxMap.insert(std::make_pair(VD, CurrentLVarMap.size()));
776 CurrentLVarMap.makeWritable();
777 CurrentLVarMap.push_back(std::make_pair(VD, E));
784 auto It = LVarIdxMap.find(VD);
785 if (It == LVarIdxMap.end()) {
786 til::SExpr *Ptr =
new (Arena) til::LiteralPtr(VD);
787 til::SExpr *St =
new (Arena) til::Store(Ptr, E);
790 CurrentLVarMap.makeWritable();
791 CurrentLVarMap.elem(It->second).second = E;
798void SExprBuilder::makePhiNodeVar(
unsigned i,
unsigned NPreds,
til::SExpr *E) {
799 unsigned ArgIndex = CurrentBlockInfo->ProcessedPredecessors;
800 assert(ArgIndex > 0 && ArgIndex < NPreds);
802 til::SExpr *CurrE = CurrentLVarMap[i].second;
803 if (CurrE->
block() == CurrentBB) {
806 auto *Ph = dyn_cast<til::Phi>(CurrE);
807 assert(Ph &&
"Expecting Phi node.");
809 Ph->values()[ArgIndex] = E;
815 til::Phi *Ph =
new (Arena) til::Phi(Arena, NPreds);
817 for (
unsigned PIdx = 0; PIdx < ArgIndex; ++PIdx)
818 Ph->
values()[PIdx] = CurrE;
820 Ph->
values()[ArgIndex] = E;
828 CurrentArguments.push_back(Ph);
830 IncompleteArgs.push_back(Ph);
832 CurrentLVarMap.makeWritable();
833 CurrentLVarMap.elem(i).second = Ph;
838void SExprBuilder::mergeEntryMap(LVarDefinitionMap Map) {
839 assert(CurrentBlockInfo &&
"Not processing a block!");
841 if (!CurrentLVarMap.valid()) {
843 CurrentLVarMap = std::move(Map);
846 if (CurrentLVarMap.sameAs(Map))
849 unsigned NPreds = CurrentBB->numPredecessors();
850 unsigned ESz = CurrentLVarMap.size();
851 unsigned MSz = Map.size();
852 unsigned Sz = std::min(ESz, MSz);
854 for (
unsigned i = 0; i < Sz; ++i) {
855 if (CurrentLVarMap[i].first != Map[i].first) {
857 CurrentLVarMap.makeWritable();
858 CurrentLVarMap.downsize(i);
861 if (CurrentLVarMap[i].second != Map[i].second)
862 makePhiNodeVar(i, NPreds, Map[i].second);
865 CurrentLVarMap.makeWritable();
866 CurrentLVarMap.downsize(Map.size());
872void SExprBuilder::mergeEntryMapBackEdge() {
881 assert(CurrentBlockInfo &&
"Not processing a block!");
883 if (CurrentBlockInfo->HasBackEdges)
885 CurrentBlockInfo->HasBackEdges =
true;
887 CurrentLVarMap.makeWritable();
888 unsigned Sz = CurrentLVarMap.size();
889 unsigned NPreds = CurrentBB->numPredecessors();
891 for (
unsigned i = 0; i < Sz; ++i)
892 makePhiNodeVar(i, NPreds,
nullptr);
898void SExprBuilder::mergePhiNodesBackEdge(
const CFGBlock *Blk) {
900 unsigned ArgIndex = BBInfo[Blk->
getBlockID()].ProcessedPredecessors;
901 assert(ArgIndex > 0 && ArgIndex < BB->numPredecessors());
904 auto *Ph = dyn_cast_or_null<til::Phi>(PE);
905 assert(Ph &&
"Expecting Phi Node.");
906 assert(Ph->
values()[ArgIndex] ==
nullptr &&
"Wrong index for back edge.");
908 til::SExpr *E = lookupVarDecl(Ph->
clangDecl());
909 assert(E &&
"Couldn't find local variable for Phi node.");
910 Ph->
values()[ArgIndex] = E;
914void SExprBuilder::enterCFG(CFG *Cfg,
const NamedDecl *D,
915 const CFGBlock *
First) {
918 Scfg =
new (Arena) til::SCFG(Arena, NBlocks);
921 BBInfo.resize(NBlocks);
922 BlockMap.resize(NBlocks,
nullptr);
924 for (
auto *B : *Cfg) {
925 auto *BB =
new (Arena) til::BasicBlock(Arena);
927 BlockMap[B->getBlockID()] = BB;
933 for (
auto *Pm : Parms) {
934 QualType
T = Pm->getType();
935 if (!
T.isTrivialType(Pm->getASTContext()))
940 til::SExpr *Lp =
new (Arena) til::LiteralPtr(Pm);
941 til::SExpr *Ld =
new (Arena) til::Load(Lp);
942 til::SExpr *
V = addStatement(Ld,
nullptr, Pm);
947void SExprBuilder::enterCFGBlock(
const CFGBlock *B) {
950 CurrentBB->reservePredecessors(B->
pred_size());
951 Scfg->add(CurrentBB);
960void SExprBuilder::handlePredecessor(
const CFGBlock *Pred) {
963 CurrentBB->addPredecessor(BlockMap[Pred->
getBlockID()]);
964 BlockInfo *PredInfo = &BBInfo[Pred->
getBlockID()];
965 assert(PredInfo->UnprocessedSuccessors > 0);
967 if (--PredInfo->UnprocessedSuccessors == 0)
968 mergeEntryMap(std::move(PredInfo->ExitMap));
970 mergeEntryMap(PredInfo->ExitMap.clone());
972 ++CurrentBlockInfo->ProcessedPredecessors;
975void SExprBuilder::handlePredecessorBackEdge(
const CFGBlock *Pred) {
976 mergeEntryMapBackEdge();
979void SExprBuilder::enterCFGBlockBody(
const CFGBlock *B) {
982 CurrentBB->arguments().reserve(
983 static_cast<unsigned>(CurrentArguments.size()), Arena);
984 for (
auto *A : CurrentArguments)
985 CurrentBB->addArgument(A);
988void SExprBuilder::handleStatement(
const Stmt *S) {
993void SExprBuilder::handleDestructorCall(
const VarDecl *VD,
994 const CXXDestructorDecl *DD) {
995 til::SExpr *Sf =
new (Arena) til::LiteralPtr(VD);
996 til::SExpr *Dr =
new (Arena) til::LiteralPtr(DD);
997 til::SExpr *Ap =
new (Arena) til::Apply(Dr, Sf);
998 til::SExpr *E =
new (Arena) til::Call(Ap);
999 addStatement(E,
nullptr);
1002void SExprBuilder::exitCFGBlockBody(
const CFGBlock *B) {
1003 CurrentBB->instructions().reserve(
1004 static_cast<unsigned>(CurrentInstructions.size()), Arena);
1005 for (
auto *
V : CurrentInstructions)
1006 CurrentBB->addInstruction(
V);
1015 auto *Tm =
new (Arena) til::Goto(BB, Idx);
1016 CurrentBB->setTerminator(Tm);
1024 auto *Tm =
new (Arena) til::Branch(
C, BB1, BB2);
1025 CurrentBB->setTerminator(Tm);
1029void SExprBuilder::handleSuccessor(
const CFGBlock *Succ) {
1030 ++CurrentBlockInfo->UnprocessedSuccessors;
1033void SExprBuilder::handleSuccessorBackEdge(
const CFGBlock *Succ) {
1034 mergePhiNodesBackEdge(Succ);
1035 ++BBInfo[Succ->
getBlockID()].ProcessedPredecessors;
1038void SExprBuilder::exitCFGBlock(
const CFGBlock *B) {
1039 CurrentArguments.clear();
1040 CurrentInstructions.clear();
1041 CurrentBlockInfo->ExitMap = std::move(CurrentLVarMap);
1042 CurrentBB =
nullptr;
1043 CurrentBlockInfo =
nullptr;
1046void SExprBuilder::exitCFG(
const CFGBlock *
Last) {
1047 for (
auto *Ph : IncompleteArgs) {
1052 CurrentArguments.clear();
1053 CurrentInstructions.clear();
1054 IncompleteArgs.clear();
1069 llvm::BumpPtrAllocator Bpa;
1073 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
unsigned getBlockID() const
Stmt * getTerminatorCondition(bool StripParens=true)
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.
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.
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.
const FunctionProtoType * T
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