mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-14 00:32:55 +00:00
Removing LLVM_DELETED_FUNCTION, as MSVC 2012 was the last reason for requiring the macro. NFC; LLVM edition.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@229340 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
aee01b35e4
commit
66981fe208
@ -447,8 +447,8 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
class HelpingMemoryManager : public SectionMemoryManager {
|
class HelpingMemoryManager : public SectionMemoryManager {
|
||||||
HelpingMemoryManager(const HelpingMemoryManager &) LLVM_DELETED_FUNCTION;
|
HelpingMemoryManager(const HelpingMemoryManager &) = delete;
|
||||||
void operator=(const HelpingMemoryManager &) LLVM_DELETED_FUNCTION;
|
void operator=(const HelpingMemoryManager &) = delete;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
HelpingMemoryManager(MCJITHelper *Helper) : MasterHelper(Helper) {}
|
HelpingMemoryManager(MCJITHelper *Helper) : MasterHelper(Helper) {}
|
||||||
|
@ -36,8 +36,8 @@ InputIR("input-IR",
|
|||||||
cl::desc("Specify the name of an IR file to load for function definitions"),
|
cl::desc("Specify the name of an IR file to load for function definitions"),
|
||||||
cl::value_desc("input IR file name"));
|
cl::value_desc("input IR file name"));
|
||||||
|
|
||||||
cl::opt<bool>
|
cl::opt<bool>
|
||||||
UseObjectCache("use-object-cache",
|
UseObjectCache("use-object-cache",
|
||||||
cl::desc("Enable use of the MCJIT object caching"),
|
cl::desc("Enable use of the MCJIT object caching"),
|
||||||
cl::init(false));
|
cl::init(false));
|
||||||
|
|
||||||
@ -55,14 +55,14 @@ enum Token {
|
|||||||
|
|
||||||
// primary
|
// primary
|
||||||
tok_identifier = -4, tok_number = -5,
|
tok_identifier = -4, tok_number = -5,
|
||||||
|
|
||||||
// control
|
// control
|
||||||
tok_if = -6, tok_then = -7, tok_else = -8,
|
tok_if = -6, tok_then = -7, tok_else = -8,
|
||||||
tok_for = -9, tok_in = -10,
|
tok_for = -9, tok_in = -10,
|
||||||
|
|
||||||
// operators
|
// operators
|
||||||
tok_binary = -11, tok_unary = -12,
|
tok_binary = -11, tok_unary = -12,
|
||||||
|
|
||||||
// var definition
|
// var definition
|
||||||
tok_var = -13
|
tok_var = -13
|
||||||
};
|
};
|
||||||
@ -111,11 +111,11 @@ static int gettok() {
|
|||||||
// Comment until end of line.
|
// Comment until end of line.
|
||||||
do LastChar = getchar();
|
do LastChar = getchar();
|
||||||
while (LastChar != EOF && LastChar != '\n' && LastChar != '\r');
|
while (LastChar != EOF && LastChar != '\n' && LastChar != '\r');
|
||||||
|
|
||||||
if (LastChar != EOF)
|
if (LastChar != EOF)
|
||||||
return gettok();
|
return gettok();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for end of file. Don't eat the EOF.
|
// Check for end of file. Don't eat the EOF.
|
||||||
if (LastChar == EOF)
|
if (LastChar == EOF)
|
||||||
return tok_eof;
|
return tok_eof;
|
||||||
@ -159,7 +159,7 @@ class UnaryExprAST : public ExprAST {
|
|||||||
char Opcode;
|
char Opcode;
|
||||||
ExprAST *Operand;
|
ExprAST *Operand;
|
||||||
public:
|
public:
|
||||||
UnaryExprAST(char opcode, ExprAST *operand)
|
UnaryExprAST(char opcode, ExprAST *operand)
|
||||||
: Opcode(opcode), Operand(operand) {}
|
: Opcode(opcode), Operand(operand) {}
|
||||||
virtual Value *Codegen();
|
virtual Value *Codegen();
|
||||||
};
|
};
|
||||||
@ -169,7 +169,7 @@ class BinaryExprAST : public ExprAST {
|
|||||||
char Op;
|
char Op;
|
||||||
ExprAST *LHS, *RHS;
|
ExprAST *LHS, *RHS;
|
||||||
public:
|
public:
|
||||||
BinaryExprAST(char op, ExprAST *lhs, ExprAST *rhs)
|
BinaryExprAST(char op, ExprAST *lhs, ExprAST *rhs)
|
||||||
: Op(op), LHS(lhs), RHS(rhs) {}
|
: Op(op), LHS(lhs), RHS(rhs) {}
|
||||||
virtual Value *Codegen();
|
virtual Value *Codegen();
|
||||||
};
|
};
|
||||||
@ -212,7 +212,7 @@ public:
|
|||||||
VarExprAST(const std::vector<std::pair<std::string, ExprAST*> > &varnames,
|
VarExprAST(const std::vector<std::pair<std::string, ExprAST*> > &varnames,
|
||||||
ExprAST *body)
|
ExprAST *body)
|
||||||
: VarNames(varnames), Body(body) {}
|
: VarNames(varnames), Body(body) {}
|
||||||
|
|
||||||
virtual Value *Codegen();
|
virtual Value *Codegen();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -227,19 +227,19 @@ public:
|
|||||||
PrototypeAST(const std::string &name, const std::vector<std::string> &args,
|
PrototypeAST(const std::string &name, const std::vector<std::string> &args,
|
||||||
bool isoperator = false, unsigned prec = 0)
|
bool isoperator = false, unsigned prec = 0)
|
||||||
: Name(name), Args(args), isOperator(isoperator), Precedence(prec) {}
|
: Name(name), Args(args), isOperator(isoperator), Precedence(prec) {}
|
||||||
|
|
||||||
bool isUnaryOp() const { return isOperator && Args.size() == 1; }
|
bool isUnaryOp() const { return isOperator && Args.size() == 1; }
|
||||||
bool isBinaryOp() const { return isOperator && Args.size() == 2; }
|
bool isBinaryOp() const { return isOperator && Args.size() == 2; }
|
||||||
|
|
||||||
char getOperatorName() const {
|
char getOperatorName() const {
|
||||||
assert(isUnaryOp() || isBinaryOp());
|
assert(isUnaryOp() || isBinaryOp());
|
||||||
return Name[Name.size()-1];
|
return Name[Name.size()-1];
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned getBinaryPrecedence() const { return Precedence; }
|
unsigned getBinaryPrecedence() const { return Precedence; }
|
||||||
|
|
||||||
Function *Codegen();
|
Function *Codegen();
|
||||||
|
|
||||||
void CreateArgumentAllocas(Function *F);
|
void CreateArgumentAllocas(Function *F);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -250,7 +250,7 @@ class FunctionAST {
|
|||||||
public:
|
public:
|
||||||
FunctionAST(PrototypeAST *proto, ExprAST *body)
|
FunctionAST(PrototypeAST *proto, ExprAST *body)
|
||||||
: Proto(proto), Body(body) {}
|
: Proto(proto), Body(body) {}
|
||||||
|
|
||||||
Function *Codegen();
|
Function *Codegen();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -274,7 +274,7 @@ static std::map<char, int> BinopPrecedence;
|
|||||||
static int GetTokPrecedence() {
|
static int GetTokPrecedence() {
|
||||||
if (!isascii(CurTok))
|
if (!isascii(CurTok))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
// Make sure it's a declared binop.
|
// Make sure it's a declared binop.
|
||||||
int TokPrec = BinopPrecedence[CurTok];
|
int TokPrec = BinopPrecedence[CurTok];
|
||||||
if (TokPrec <= 0) return -1;
|
if (TokPrec <= 0) return -1;
|
||||||
@ -293,12 +293,12 @@ static ExprAST *ParseExpression();
|
|||||||
/// ::= identifier '(' expression* ')'
|
/// ::= identifier '(' expression* ')'
|
||||||
static ExprAST *ParseIdentifierExpr() {
|
static ExprAST *ParseIdentifierExpr() {
|
||||||
std::string IdName = IdentifierStr;
|
std::string IdName = IdentifierStr;
|
||||||
|
|
||||||
getNextToken(); // eat identifier.
|
getNextToken(); // eat identifier.
|
||||||
|
|
||||||
if (CurTok != '(') // Simple variable ref.
|
if (CurTok != '(') // Simple variable ref.
|
||||||
return new VariableExprAST(IdName);
|
return new VariableExprAST(IdName);
|
||||||
|
|
||||||
// Call.
|
// Call.
|
||||||
getNextToken(); // eat (
|
getNextToken(); // eat (
|
||||||
std::vector<ExprAST*> Args;
|
std::vector<ExprAST*> Args;
|
||||||
@ -318,7 +318,7 @@ static ExprAST *ParseIdentifierExpr() {
|
|||||||
|
|
||||||
// Eat the ')'.
|
// Eat the ')'.
|
||||||
getNextToken();
|
getNextToken();
|
||||||
|
|
||||||
return new CallExprAST(IdName, Args);
|
return new CallExprAST(IdName, Args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -334,7 +334,7 @@ static ExprAST *ParseParenExpr() {
|
|||||||
getNextToken(); // eat (.
|
getNextToken(); // eat (.
|
||||||
ExprAST *V = ParseExpression();
|
ExprAST *V = ParseExpression();
|
||||||
if (!V) return 0;
|
if (!V) return 0;
|
||||||
|
|
||||||
if (CurTok != ')')
|
if (CurTok != ')')
|
||||||
return Error("expected ')'");
|
return Error("expected ')'");
|
||||||
getNextToken(); // eat ).
|
getNextToken(); // eat ).
|
||||||
@ -344,26 +344,26 @@ static ExprAST *ParseParenExpr() {
|
|||||||
/// ifexpr ::= 'if' expression 'then' expression 'else' expression
|
/// ifexpr ::= 'if' expression 'then' expression 'else' expression
|
||||||
static ExprAST *ParseIfExpr() {
|
static ExprAST *ParseIfExpr() {
|
||||||
getNextToken(); // eat the if.
|
getNextToken(); // eat the if.
|
||||||
|
|
||||||
// condition.
|
// condition.
|
||||||
ExprAST *Cond = ParseExpression();
|
ExprAST *Cond = ParseExpression();
|
||||||
if (!Cond) return 0;
|
if (!Cond) return 0;
|
||||||
|
|
||||||
if (CurTok != tok_then)
|
if (CurTok != tok_then)
|
||||||
return Error("expected then");
|
return Error("expected then");
|
||||||
getNextToken(); // eat the then
|
getNextToken(); // eat the then
|
||||||
|
|
||||||
ExprAST *Then = ParseExpression();
|
ExprAST *Then = ParseExpression();
|
||||||
if (Then == 0) return 0;
|
if (Then == 0) return 0;
|
||||||
|
|
||||||
if (CurTok != tok_else)
|
if (CurTok != tok_else)
|
||||||
return Error("expected else");
|
return Error("expected else");
|
||||||
|
|
||||||
getNextToken();
|
getNextToken();
|
||||||
|
|
||||||
ExprAST *Else = ParseExpression();
|
ExprAST *Else = ParseExpression();
|
||||||
if (!Else) return 0;
|
if (!Else) return 0;
|
||||||
|
|
||||||
return new IfExprAST(Cond, Then, Else);
|
return new IfExprAST(Cond, Then, Else);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -373,24 +373,24 @@ static ExprAST *ParseForExpr() {
|
|||||||
|
|
||||||
if (CurTok != tok_identifier)
|
if (CurTok != tok_identifier)
|
||||||
return Error("expected identifier after for");
|
return Error("expected identifier after for");
|
||||||
|
|
||||||
std::string IdName = IdentifierStr;
|
std::string IdName = IdentifierStr;
|
||||||
getNextToken(); // eat identifier.
|
getNextToken(); // eat identifier.
|
||||||
|
|
||||||
if (CurTok != '=')
|
if (CurTok != '=')
|
||||||
return Error("expected '=' after for");
|
return Error("expected '=' after for");
|
||||||
getNextToken(); // eat '='.
|
getNextToken(); // eat '='.
|
||||||
|
|
||||||
|
|
||||||
ExprAST *Start = ParseExpression();
|
ExprAST *Start = ParseExpression();
|
||||||
if (Start == 0) return 0;
|
if (Start == 0) return 0;
|
||||||
if (CurTok != ',')
|
if (CurTok != ',')
|
||||||
return Error("expected ',' after for start value");
|
return Error("expected ',' after for start value");
|
||||||
getNextToken();
|
getNextToken();
|
||||||
|
|
||||||
ExprAST *End = ParseExpression();
|
ExprAST *End = ParseExpression();
|
||||||
if (End == 0) return 0;
|
if (End == 0) return 0;
|
||||||
|
|
||||||
// The step value is optional.
|
// The step value is optional.
|
||||||
ExprAST *Step = 0;
|
ExprAST *Step = 0;
|
||||||
if (CurTok == ',') {
|
if (CurTok == ',') {
|
||||||
@ -398,18 +398,18 @@ static ExprAST *ParseForExpr() {
|
|||||||
Step = ParseExpression();
|
Step = ParseExpression();
|
||||||
if (Step == 0) return 0;
|
if (Step == 0) return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CurTok != tok_in)
|
if (CurTok != tok_in)
|
||||||
return Error("expected 'in' after for");
|
return Error("expected 'in' after for");
|
||||||
getNextToken(); // eat 'in'.
|
getNextToken(); // eat 'in'.
|
||||||
|
|
||||||
ExprAST *Body = ParseExpression();
|
ExprAST *Body = ParseExpression();
|
||||||
if (Body == 0) return 0;
|
if (Body == 0) return 0;
|
||||||
|
|
||||||
return new ForExprAST(IdName, Start, End, Step, Body);
|
return new ForExprAST(IdName, Start, End, Step, Body);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// varexpr ::= 'var' identifier ('=' expression)?
|
/// varexpr ::= 'var' identifier ('=' expression)?
|
||||||
// (',' identifier ('=' expression)?)* 'in' expression
|
// (',' identifier ('=' expression)?)* 'in' expression
|
||||||
static ExprAST *ParseVarExpr() {
|
static ExprAST *ParseVarExpr() {
|
||||||
getNextToken(); // eat the var.
|
getNextToken(); // eat the var.
|
||||||
@ -419,7 +419,7 @@ static ExprAST *ParseVarExpr() {
|
|||||||
// At least one variable name is required.
|
// At least one variable name is required.
|
||||||
if (CurTok != tok_identifier)
|
if (CurTok != tok_identifier)
|
||||||
return Error("expected identifier after var");
|
return Error("expected identifier after var");
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
std::string Name = IdentifierStr;
|
std::string Name = IdentifierStr;
|
||||||
getNextToken(); // eat identifier.
|
getNextToken(); // eat identifier.
|
||||||
@ -428,29 +428,29 @@ static ExprAST *ParseVarExpr() {
|
|||||||
ExprAST *Init = 0;
|
ExprAST *Init = 0;
|
||||||
if (CurTok == '=') {
|
if (CurTok == '=') {
|
||||||
getNextToken(); // eat the '='.
|
getNextToken(); // eat the '='.
|
||||||
|
|
||||||
Init = ParseExpression();
|
Init = ParseExpression();
|
||||||
if (Init == 0) return 0;
|
if (Init == 0) return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
VarNames.push_back(std::make_pair(Name, Init));
|
VarNames.push_back(std::make_pair(Name, Init));
|
||||||
|
|
||||||
// End of var list, exit loop.
|
// End of var list, exit loop.
|
||||||
if (CurTok != ',') break;
|
if (CurTok != ',') break;
|
||||||
getNextToken(); // eat the ','.
|
getNextToken(); // eat the ','.
|
||||||
|
|
||||||
if (CurTok != tok_identifier)
|
if (CurTok != tok_identifier)
|
||||||
return Error("expected identifier list after var");
|
return Error("expected identifier list after var");
|
||||||
}
|
}
|
||||||
|
|
||||||
// At this point, we have to have 'in'.
|
// At this point, we have to have 'in'.
|
||||||
if (CurTok != tok_in)
|
if (CurTok != tok_in)
|
||||||
return Error("expected 'in' keyword after 'var'");
|
return Error("expected 'in' keyword after 'var'");
|
||||||
getNextToken(); // eat 'in'.
|
getNextToken(); // eat 'in'.
|
||||||
|
|
||||||
ExprAST *Body = ParseExpression();
|
ExprAST *Body = ParseExpression();
|
||||||
if (Body == 0) return 0;
|
if (Body == 0) return 0;
|
||||||
|
|
||||||
return new VarExprAST(VarNames, Body);
|
return new VarExprAST(VarNames, Body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -480,7 +480,7 @@ static ExprAST *ParseUnary() {
|
|||||||
// If the current token is not an operator, it must be a primary expr.
|
// If the current token is not an operator, it must be a primary expr.
|
||||||
if (!isascii(CurTok) || CurTok == '(' || CurTok == ',')
|
if (!isascii(CurTok) || CurTok == '(' || CurTok == ',')
|
||||||
return ParsePrimary();
|
return ParsePrimary();
|
||||||
|
|
||||||
// If this is a unary operator, read it.
|
// If this is a unary operator, read it.
|
||||||
int Opc = CurTok;
|
int Opc = CurTok;
|
||||||
getNextToken();
|
getNextToken();
|
||||||
@ -495,20 +495,20 @@ static ExprAST *ParseBinOpRHS(int ExprPrec, ExprAST *LHS) {
|
|||||||
// If this is a binop, find its precedence.
|
// If this is a binop, find its precedence.
|
||||||
while (1) {
|
while (1) {
|
||||||
int TokPrec = GetTokPrecedence();
|
int TokPrec = GetTokPrecedence();
|
||||||
|
|
||||||
// If this is a binop that binds at least as tightly as the current binop,
|
// If this is a binop that binds at least as tightly as the current binop,
|
||||||
// consume it, otherwise we are done.
|
// consume it, otherwise we are done.
|
||||||
if (TokPrec < ExprPrec)
|
if (TokPrec < ExprPrec)
|
||||||
return LHS;
|
return LHS;
|
||||||
|
|
||||||
// Okay, we know this is a binop.
|
// Okay, we know this is a binop.
|
||||||
int BinOp = CurTok;
|
int BinOp = CurTok;
|
||||||
getNextToken(); // eat binop
|
getNextToken(); // eat binop
|
||||||
|
|
||||||
// Parse the unary expression after the binary operator.
|
// Parse the unary expression after the binary operator.
|
||||||
ExprAST *RHS = ParseUnary();
|
ExprAST *RHS = ParseUnary();
|
||||||
if (!RHS) return 0;
|
if (!RHS) return 0;
|
||||||
|
|
||||||
// If BinOp binds less tightly with RHS than the operator after RHS, let
|
// If BinOp binds less tightly with RHS than the operator after RHS, let
|
||||||
// the pending operator take RHS as its LHS.
|
// the pending operator take RHS as its LHS.
|
||||||
int NextPrec = GetTokPrecedence();
|
int NextPrec = GetTokPrecedence();
|
||||||
@ -516,7 +516,7 @@ static ExprAST *ParseBinOpRHS(int ExprPrec, ExprAST *LHS) {
|
|||||||
RHS = ParseBinOpRHS(TokPrec+1, RHS);
|
RHS = ParseBinOpRHS(TokPrec+1, RHS);
|
||||||
if (RHS == 0) return 0;
|
if (RHS == 0) return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Merge LHS/RHS.
|
// Merge LHS/RHS.
|
||||||
LHS = new BinaryExprAST(BinOp, LHS, RHS);
|
LHS = new BinaryExprAST(BinOp, LHS, RHS);
|
||||||
}
|
}
|
||||||
@ -528,7 +528,7 @@ static ExprAST *ParseBinOpRHS(int ExprPrec, ExprAST *LHS) {
|
|||||||
static ExprAST *ParseExpression() {
|
static ExprAST *ParseExpression() {
|
||||||
ExprAST *LHS = ParseUnary();
|
ExprAST *LHS = ParseUnary();
|
||||||
if (!LHS) return 0;
|
if (!LHS) return 0;
|
||||||
|
|
||||||
return ParseBinOpRHS(0, LHS);
|
return ParseBinOpRHS(0, LHS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -538,10 +538,10 @@ static ExprAST *ParseExpression() {
|
|||||||
/// ::= unary LETTER (id)
|
/// ::= unary LETTER (id)
|
||||||
static PrototypeAST *ParsePrototype() {
|
static PrototypeAST *ParsePrototype() {
|
||||||
std::string FnName;
|
std::string FnName;
|
||||||
|
|
||||||
unsigned Kind = 0; // 0 = identifier, 1 = unary, 2 = binary.
|
unsigned Kind = 0; // 0 = identifier, 1 = unary, 2 = binary.
|
||||||
unsigned BinaryPrecedence = 30;
|
unsigned BinaryPrecedence = 30;
|
||||||
|
|
||||||
switch (CurTok) {
|
switch (CurTok) {
|
||||||
default:
|
default:
|
||||||
return ErrorP("Expected function name in prototype");
|
return ErrorP("Expected function name in prototype");
|
||||||
@ -567,7 +567,7 @@ static PrototypeAST *ParsePrototype() {
|
|||||||
FnName += (char)CurTok;
|
FnName += (char)CurTok;
|
||||||
Kind = 2;
|
Kind = 2;
|
||||||
getNextToken();
|
getNextToken();
|
||||||
|
|
||||||
// Read the precedence if present.
|
// Read the precedence if present.
|
||||||
if (CurTok == tok_number) {
|
if (CurTok == tok_number) {
|
||||||
if (NumVal < 1 || NumVal > 100)
|
if (NumVal < 1 || NumVal > 100)
|
||||||
@ -577,23 +577,23 @@ static PrototypeAST *ParsePrototype() {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CurTok != '(')
|
if (CurTok != '(')
|
||||||
return ErrorP("Expected '(' in prototype");
|
return ErrorP("Expected '(' in prototype");
|
||||||
|
|
||||||
std::vector<std::string> ArgNames;
|
std::vector<std::string> ArgNames;
|
||||||
while (getNextToken() == tok_identifier)
|
while (getNextToken() == tok_identifier)
|
||||||
ArgNames.push_back(IdentifierStr);
|
ArgNames.push_back(IdentifierStr);
|
||||||
if (CurTok != ')')
|
if (CurTok != ')')
|
||||||
return ErrorP("Expected ')' in prototype");
|
return ErrorP("Expected ')' in prototype");
|
||||||
|
|
||||||
// success.
|
// success.
|
||||||
getNextToken(); // eat ')'.
|
getNextToken(); // eat ')'.
|
||||||
|
|
||||||
// Verify right number of names for operator.
|
// Verify right number of names for operator.
|
||||||
if (Kind && ArgNames.size() != Kind)
|
if (Kind && ArgNames.size() != Kind)
|
||||||
return ErrorP("Invalid number of operands for operator");
|
return ErrorP("Invalid number of operands for operator");
|
||||||
|
|
||||||
return new PrototypeAST(FnName, ArgNames, Kind != 0, BinaryPrecedence);
|
return new PrototypeAST(FnName, ArgNames, Kind != 0, BinaryPrecedence);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -762,14 +762,14 @@ private:
|
|||||||
|
|
||||||
class HelpingMemoryManager : public SectionMemoryManager
|
class HelpingMemoryManager : public SectionMemoryManager
|
||||||
{
|
{
|
||||||
HelpingMemoryManager(const HelpingMemoryManager&) LLVM_DELETED_FUNCTION;
|
HelpingMemoryManager(const HelpingMemoryManager&) = delete;
|
||||||
void operator=(const HelpingMemoryManager&) LLVM_DELETED_FUNCTION;
|
void operator=(const HelpingMemoryManager&) = delete;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
HelpingMemoryManager(MCJITHelper *Helper) : MasterHelper(Helper) {}
|
HelpingMemoryManager(MCJITHelper *Helper) : MasterHelper(Helper) {}
|
||||||
virtual ~HelpingMemoryManager() {}
|
virtual ~HelpingMemoryManager() {}
|
||||||
|
|
||||||
/// This method returns the address of the specified function.
|
/// This method returns the address of the specified function.
|
||||||
/// Our implementation will attempt to find functions in other
|
/// Our implementation will attempt to find functions in other
|
||||||
/// modules associated with the MCJITHelper to cross link functions
|
/// modules associated with the MCJITHelper to cross link functions
|
||||||
/// from one generated module to another.
|
/// from one generated module to another.
|
||||||
@ -838,9 +838,9 @@ Function *MCJITHelper::getFunction(const std::string FnName) {
|
|||||||
|
|
||||||
// If we don't have a prototype yet, create one.
|
// If we don't have a prototype yet, create one.
|
||||||
if (!PF)
|
if (!PF)
|
||||||
PF = Function::Create(F->getFunctionType(),
|
PF = Function::Create(F->getFunctionType(),
|
||||||
Function::ExternalLinkage,
|
Function::ExternalLinkage,
|
||||||
FnName,
|
FnName,
|
||||||
OpenModule);
|
OpenModule);
|
||||||
return PF;
|
return PF;
|
||||||
}
|
}
|
||||||
@ -1027,11 +1027,11 @@ Value *VariableExprAST::Codegen() {
|
|||||||
Value *UnaryExprAST::Codegen() {
|
Value *UnaryExprAST::Codegen() {
|
||||||
Value *OperandV = Operand->Codegen();
|
Value *OperandV = Operand->Codegen();
|
||||||
if (OperandV == 0) return 0;
|
if (OperandV == 0) return 0;
|
||||||
|
|
||||||
Function *F = TheHelper->getFunction(MakeLegalFunctionName(std::string("unary")+Opcode));
|
Function *F = TheHelper->getFunction(MakeLegalFunctionName(std::string("unary")+Opcode));
|
||||||
if (F == 0)
|
if (F == 0)
|
||||||
return ErrorV("Unknown unary operator");
|
return ErrorV("Unknown unary operator");
|
||||||
|
|
||||||
return Builder.CreateCall(F, OperandV, "unop");
|
return Builder.CreateCall(F, OperandV, "unop");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1053,11 +1053,11 @@ Value *BinaryExprAST::Codegen() {
|
|||||||
Builder.CreateStore(Val, Variable);
|
Builder.CreateStore(Val, Variable);
|
||||||
return Val;
|
return Val;
|
||||||
}
|
}
|
||||||
|
|
||||||
Value *L = LHS->Codegen();
|
Value *L = LHS->Codegen();
|
||||||
Value *R = RHS->Codegen();
|
Value *R = RHS->Codegen();
|
||||||
if (L == 0 || R == 0) return 0;
|
if (L == 0 || R == 0) return 0;
|
||||||
|
|
||||||
switch (Op) {
|
switch (Op) {
|
||||||
case '+': return Builder.CreateFAdd(L, R, "addtmp");
|
case '+': return Builder.CreateFAdd(L, R, "addtmp");
|
||||||
case '-': return Builder.CreateFSub(L, R, "subtmp");
|
case '-': return Builder.CreateFSub(L, R, "subtmp");
|
||||||
@ -1070,12 +1070,12 @@ Value *BinaryExprAST::Codegen() {
|
|||||||
"booltmp");
|
"booltmp");
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If it wasn't a builtin binary operator, it must be a user defined one. Emit
|
// If it wasn't a builtin binary operator, it must be a user defined one. Emit
|
||||||
// a call to it.
|
// a call to it.
|
||||||
Function *F = TheHelper->getFunction(MakeLegalFunctionName(std::string("binary")+Op));
|
Function *F = TheHelper->getFunction(MakeLegalFunctionName(std::string("binary")+Op));
|
||||||
assert(F && "binary operator not found!");
|
assert(F && "binary operator not found!");
|
||||||
|
|
||||||
Value *Ops[] = { L, R };
|
Value *Ops[] = { L, R };
|
||||||
return Builder.CreateCall(F, Ops, "binop");
|
return Builder.CreateCall(F, Ops, "binop");
|
||||||
}
|
}
|
||||||
@ -1085,7 +1085,7 @@ Value *CallExprAST::Codegen() {
|
|||||||
Function *CalleeF = TheHelper->getFunction(Callee);
|
Function *CalleeF = TheHelper->getFunction(Callee);
|
||||||
if (CalleeF == 0)
|
if (CalleeF == 0)
|
||||||
return ErrorV("Unknown function referenced");
|
return ErrorV("Unknown function referenced");
|
||||||
|
|
||||||
// If argument mismatch error.
|
// If argument mismatch error.
|
||||||
if (CalleeF->arg_size() != Args.size())
|
if (CalleeF->arg_size() != Args.size())
|
||||||
return ErrorV("Incorrect # arguments passed");
|
return ErrorV("Incorrect # arguments passed");
|
||||||
@ -1095,56 +1095,56 @@ Value *CallExprAST::Codegen() {
|
|||||||
ArgsV.push_back(Args[i]->Codegen());
|
ArgsV.push_back(Args[i]->Codegen());
|
||||||
if (ArgsV.back() == 0) return 0;
|
if (ArgsV.back() == 0) return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Builder.CreateCall(CalleeF, ArgsV, "calltmp");
|
return Builder.CreateCall(CalleeF, ArgsV, "calltmp");
|
||||||
}
|
}
|
||||||
|
|
||||||
Value *IfExprAST::Codegen() {
|
Value *IfExprAST::Codegen() {
|
||||||
Value *CondV = Cond->Codegen();
|
Value *CondV = Cond->Codegen();
|
||||||
if (CondV == 0) return 0;
|
if (CondV == 0) return 0;
|
||||||
|
|
||||||
// Convert condition to a bool by comparing equal to 0.0.
|
// Convert condition to a bool by comparing equal to 0.0.
|
||||||
CondV = Builder.CreateFCmpONE(CondV,
|
CondV = Builder.CreateFCmpONE(CondV,
|
||||||
ConstantFP::get(getGlobalContext(), APFloat(0.0)),
|
ConstantFP::get(getGlobalContext(), APFloat(0.0)),
|
||||||
"ifcond");
|
"ifcond");
|
||||||
|
|
||||||
Function *TheFunction = Builder.GetInsertBlock()->getParent();
|
Function *TheFunction = Builder.GetInsertBlock()->getParent();
|
||||||
|
|
||||||
// Create blocks for the then and else cases. Insert the 'then' block at the
|
// Create blocks for the then and else cases. Insert the 'then' block at the
|
||||||
// end of the function.
|
// end of the function.
|
||||||
BasicBlock *ThenBB = BasicBlock::Create(getGlobalContext(), "then", TheFunction);
|
BasicBlock *ThenBB = BasicBlock::Create(getGlobalContext(), "then", TheFunction);
|
||||||
BasicBlock *ElseBB = BasicBlock::Create(getGlobalContext(), "else");
|
BasicBlock *ElseBB = BasicBlock::Create(getGlobalContext(), "else");
|
||||||
BasicBlock *MergeBB = BasicBlock::Create(getGlobalContext(), "ifcont");
|
BasicBlock *MergeBB = BasicBlock::Create(getGlobalContext(), "ifcont");
|
||||||
|
|
||||||
Builder.CreateCondBr(CondV, ThenBB, ElseBB);
|
Builder.CreateCondBr(CondV, ThenBB, ElseBB);
|
||||||
|
|
||||||
// Emit then value.
|
// Emit then value.
|
||||||
Builder.SetInsertPoint(ThenBB);
|
Builder.SetInsertPoint(ThenBB);
|
||||||
|
|
||||||
Value *ThenV = Then->Codegen();
|
Value *ThenV = Then->Codegen();
|
||||||
if (ThenV == 0) return 0;
|
if (ThenV == 0) return 0;
|
||||||
|
|
||||||
Builder.CreateBr(MergeBB);
|
Builder.CreateBr(MergeBB);
|
||||||
// Codegen of 'Then' can change the current block, update ThenBB for the PHI.
|
// Codegen of 'Then' can change the current block, update ThenBB for the PHI.
|
||||||
ThenBB = Builder.GetInsertBlock();
|
ThenBB = Builder.GetInsertBlock();
|
||||||
|
|
||||||
// Emit else block.
|
// Emit else block.
|
||||||
TheFunction->getBasicBlockList().push_back(ElseBB);
|
TheFunction->getBasicBlockList().push_back(ElseBB);
|
||||||
Builder.SetInsertPoint(ElseBB);
|
Builder.SetInsertPoint(ElseBB);
|
||||||
|
|
||||||
Value *ElseV = Else->Codegen();
|
Value *ElseV = Else->Codegen();
|
||||||
if (ElseV == 0) return 0;
|
if (ElseV == 0) return 0;
|
||||||
|
|
||||||
Builder.CreateBr(MergeBB);
|
Builder.CreateBr(MergeBB);
|
||||||
// Codegen of 'Else' can change the current block, update ElseBB for the PHI.
|
// Codegen of 'Else' can change the current block, update ElseBB for the PHI.
|
||||||
ElseBB = Builder.GetInsertBlock();
|
ElseBB = Builder.GetInsertBlock();
|
||||||
|
|
||||||
// Emit merge block.
|
// Emit merge block.
|
||||||
TheFunction->getBasicBlockList().push_back(MergeBB);
|
TheFunction->getBasicBlockList().push_back(MergeBB);
|
||||||
Builder.SetInsertPoint(MergeBB);
|
Builder.SetInsertPoint(MergeBB);
|
||||||
PHINode *PN = Builder.CreatePHI(Type::getDoubleTy(getGlobalContext()), 2,
|
PHINode *PN = Builder.CreatePHI(Type::getDoubleTy(getGlobalContext()), 2,
|
||||||
"iftmp");
|
"iftmp");
|
||||||
|
|
||||||
PN->addIncoming(ThenV, ThenBB);
|
PN->addIncoming(ThenV, ThenBB);
|
||||||
PN->addIncoming(ElseV, ElseBB);
|
PN->addIncoming(ElseV, ElseBB);
|
||||||
return PN;
|
return PN;
|
||||||
@ -1157,7 +1157,7 @@ Value *ForExprAST::Codegen() {
|
|||||||
// start = startexpr
|
// start = startexpr
|
||||||
// store start -> var
|
// store start -> var
|
||||||
// goto loop
|
// goto loop
|
||||||
// loop:
|
// loop:
|
||||||
// ...
|
// ...
|
||||||
// bodyexpr
|
// bodyexpr
|
||||||
// ...
|
// ...
|
||||||
@ -1170,40 +1170,40 @@ Value *ForExprAST::Codegen() {
|
|||||||
// store nextvar -> var
|
// store nextvar -> var
|
||||||
// br endcond, loop, endloop
|
// br endcond, loop, endloop
|
||||||
// outloop:
|
// outloop:
|
||||||
|
|
||||||
Function *TheFunction = Builder.GetInsertBlock()->getParent();
|
Function *TheFunction = Builder.GetInsertBlock()->getParent();
|
||||||
|
|
||||||
// Create an alloca for the variable in the entry block.
|
// Create an alloca for the variable in the entry block.
|
||||||
AllocaInst *Alloca = CreateEntryBlockAlloca(TheFunction, VarName);
|
AllocaInst *Alloca = CreateEntryBlockAlloca(TheFunction, VarName);
|
||||||
|
|
||||||
// Emit the start code first, without 'variable' in scope.
|
// Emit the start code first, without 'variable' in scope.
|
||||||
Value *StartVal = Start->Codegen();
|
Value *StartVal = Start->Codegen();
|
||||||
if (StartVal == 0) return 0;
|
if (StartVal == 0) return 0;
|
||||||
|
|
||||||
// Store the value into the alloca.
|
// Store the value into the alloca.
|
||||||
Builder.CreateStore(StartVal, Alloca);
|
Builder.CreateStore(StartVal, Alloca);
|
||||||
|
|
||||||
// Make the new basic block for the loop header, inserting after current
|
// Make the new basic block for the loop header, inserting after current
|
||||||
// block.
|
// block.
|
||||||
BasicBlock *LoopBB = BasicBlock::Create(getGlobalContext(), "loop", TheFunction);
|
BasicBlock *LoopBB = BasicBlock::Create(getGlobalContext(), "loop", TheFunction);
|
||||||
|
|
||||||
// Insert an explicit fall through from the current block to the LoopBB.
|
// Insert an explicit fall through from the current block to the LoopBB.
|
||||||
Builder.CreateBr(LoopBB);
|
Builder.CreateBr(LoopBB);
|
||||||
|
|
||||||
// Start insertion in LoopBB.
|
// Start insertion in LoopBB.
|
||||||
Builder.SetInsertPoint(LoopBB);
|
Builder.SetInsertPoint(LoopBB);
|
||||||
|
|
||||||
// Within the loop, the variable is defined equal to the PHI node. If it
|
// Within the loop, the variable is defined equal to the PHI node. If it
|
||||||
// shadows an existing variable, we have to restore it, so save it now.
|
// shadows an existing variable, we have to restore it, so save it now.
|
||||||
AllocaInst *OldVal = NamedValues[VarName];
|
AllocaInst *OldVal = NamedValues[VarName];
|
||||||
NamedValues[VarName] = Alloca;
|
NamedValues[VarName] = Alloca;
|
||||||
|
|
||||||
// Emit the body of the loop. This, like any other expr, can change the
|
// Emit the body of the loop. This, like any other expr, can change the
|
||||||
// current BB. Note that we ignore the value computed by the body, but don't
|
// current BB. Note that we ignore the value computed by the body, but don't
|
||||||
// allow an error.
|
// allow an error.
|
||||||
if (Body->Codegen() == 0)
|
if (Body->Codegen() == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// Emit the step value.
|
// Emit the step value.
|
||||||
Value *StepVal;
|
Value *StepVal;
|
||||||
if (Step) {
|
if (Step) {
|
||||||
@ -1213,52 +1213,52 @@ Value *ForExprAST::Codegen() {
|
|||||||
// If not specified, use 1.0.
|
// If not specified, use 1.0.
|
||||||
StepVal = ConstantFP::get(getGlobalContext(), APFloat(1.0));
|
StepVal = ConstantFP::get(getGlobalContext(), APFloat(1.0));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute the end condition.
|
// Compute the end condition.
|
||||||
Value *EndCond = End->Codegen();
|
Value *EndCond = End->Codegen();
|
||||||
if (EndCond == 0) return EndCond;
|
if (EndCond == 0) return EndCond;
|
||||||
|
|
||||||
// Reload, increment, and restore the alloca. This handles the case where
|
// Reload, increment, and restore the alloca. This handles the case where
|
||||||
// the body of the loop mutates the variable.
|
// the body of the loop mutates the variable.
|
||||||
Value *CurVar = Builder.CreateLoad(Alloca, VarName.c_str());
|
Value *CurVar = Builder.CreateLoad(Alloca, VarName.c_str());
|
||||||
Value *NextVar = Builder.CreateFAdd(CurVar, StepVal, "nextvar");
|
Value *NextVar = Builder.CreateFAdd(CurVar, StepVal, "nextvar");
|
||||||
Builder.CreateStore(NextVar, Alloca);
|
Builder.CreateStore(NextVar, Alloca);
|
||||||
|
|
||||||
// Convert condition to a bool by comparing equal to 0.0.
|
// Convert condition to a bool by comparing equal to 0.0.
|
||||||
EndCond = Builder.CreateFCmpONE(EndCond,
|
EndCond = Builder.CreateFCmpONE(EndCond,
|
||||||
ConstantFP::get(getGlobalContext(), APFloat(0.0)),
|
ConstantFP::get(getGlobalContext(), APFloat(0.0)),
|
||||||
"loopcond");
|
"loopcond");
|
||||||
|
|
||||||
// Create the "after loop" block and insert it.
|
// Create the "after loop" block and insert it.
|
||||||
BasicBlock *AfterBB = BasicBlock::Create(getGlobalContext(), "afterloop", TheFunction);
|
BasicBlock *AfterBB = BasicBlock::Create(getGlobalContext(), "afterloop", TheFunction);
|
||||||
|
|
||||||
// Insert the conditional branch into the end of LoopEndBB.
|
// Insert the conditional branch into the end of LoopEndBB.
|
||||||
Builder.CreateCondBr(EndCond, LoopBB, AfterBB);
|
Builder.CreateCondBr(EndCond, LoopBB, AfterBB);
|
||||||
|
|
||||||
// Any new code will be inserted in AfterBB.
|
// Any new code will be inserted in AfterBB.
|
||||||
Builder.SetInsertPoint(AfterBB);
|
Builder.SetInsertPoint(AfterBB);
|
||||||
|
|
||||||
// Restore the unshadowed variable.
|
// Restore the unshadowed variable.
|
||||||
if (OldVal)
|
if (OldVal)
|
||||||
NamedValues[VarName] = OldVal;
|
NamedValues[VarName] = OldVal;
|
||||||
else
|
else
|
||||||
NamedValues.erase(VarName);
|
NamedValues.erase(VarName);
|
||||||
|
|
||||||
|
|
||||||
// for expr always returns 0.0.
|
// for expr always returns 0.0.
|
||||||
return Constant::getNullValue(Type::getDoubleTy(getGlobalContext()));
|
return Constant::getNullValue(Type::getDoubleTy(getGlobalContext()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Value *VarExprAST::Codegen() {
|
Value *VarExprAST::Codegen() {
|
||||||
std::vector<AllocaInst *> OldBindings;
|
std::vector<AllocaInst *> OldBindings;
|
||||||
|
|
||||||
Function *TheFunction = Builder.GetInsertBlock()->getParent();
|
Function *TheFunction = Builder.GetInsertBlock()->getParent();
|
||||||
|
|
||||||
// Register all variables and emit their initializer.
|
// Register all variables and emit their initializer.
|
||||||
for (unsigned i = 0, e = VarNames.size(); i != e; ++i) {
|
for (unsigned i = 0, e = VarNames.size(); i != e; ++i) {
|
||||||
const std::string &VarName = VarNames[i].first;
|
const std::string &VarName = VarNames[i].first;
|
||||||
ExprAST *Init = VarNames[i].second;
|
ExprAST *Init = VarNames[i].second;
|
||||||
|
|
||||||
// Emit the initializer before adding the variable to scope, this prevents
|
// Emit the initializer before adding the variable to scope, this prevents
|
||||||
// the initializer from referencing the variable itself, and permits stuff
|
// the initializer from referencing the variable itself, and permits stuff
|
||||||
// like this:
|
// like this:
|
||||||
@ -1271,22 +1271,22 @@ Value *VarExprAST::Codegen() {
|
|||||||
} else { // If not specified, use 0.0.
|
} else { // If not specified, use 0.0.
|
||||||
InitVal = ConstantFP::get(getGlobalContext(), APFloat(0.0));
|
InitVal = ConstantFP::get(getGlobalContext(), APFloat(0.0));
|
||||||
}
|
}
|
||||||
|
|
||||||
AllocaInst *Alloca = CreateEntryBlockAlloca(TheFunction, VarName);
|
AllocaInst *Alloca = CreateEntryBlockAlloca(TheFunction, VarName);
|
||||||
Builder.CreateStore(InitVal, Alloca);
|
Builder.CreateStore(InitVal, Alloca);
|
||||||
|
|
||||||
// Remember the old variable binding so that we can restore the binding when
|
// Remember the old variable binding so that we can restore the binding when
|
||||||
// we unrecurse.
|
// we unrecurse.
|
||||||
OldBindings.push_back(NamedValues[VarName]);
|
OldBindings.push_back(NamedValues[VarName]);
|
||||||
|
|
||||||
// Remember this binding.
|
// Remember this binding.
|
||||||
NamedValues[VarName] = Alloca;
|
NamedValues[VarName] = Alloca;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Codegen the body, now that all vars are in scope.
|
// Codegen the body, now that all vars are in scope.
|
||||||
Value *BodyVal = Body->Codegen();
|
Value *BodyVal = Body->Codegen();
|
||||||
if (BodyVal == 0) return 0;
|
if (BodyVal == 0) return 0;
|
||||||
|
|
||||||
// Pop all our variables from scope.
|
// Pop all our variables from scope.
|
||||||
for (unsigned i = 0, e = VarNames.size(); i != e; ++i)
|
for (unsigned i = 0, e = VarNames.size(); i != e; ++i)
|
||||||
NamedValues[VarNames[i].first] = OldBindings[i];
|
NamedValues[VarNames[i].first] = OldBindings[i];
|
||||||
@ -1297,7 +1297,7 @@ Value *VarExprAST::Codegen() {
|
|||||||
|
|
||||||
Function *PrototypeAST::Codegen() {
|
Function *PrototypeAST::Codegen() {
|
||||||
// Make the function type: double(double,double) etc.
|
// Make the function type: double(double,double) etc.
|
||||||
std::vector<Type*> Doubles(Args.size(),
|
std::vector<Type*> Doubles(Args.size(),
|
||||||
Type::getDoubleTy(getGlobalContext()));
|
Type::getDoubleTy(getGlobalContext()));
|
||||||
FunctionType *FT = FunctionType::get(Type::getDoubleTy(getGlobalContext()),
|
FunctionType *FT = FunctionType::get(Type::getDoubleTy(getGlobalContext()),
|
||||||
Doubles, false);
|
Doubles, false);
|
||||||
@ -1314,26 +1314,26 @@ Function *PrototypeAST::Codegen() {
|
|||||||
// Delete the one we just made and get the existing one.
|
// Delete the one we just made and get the existing one.
|
||||||
F->eraseFromParent();
|
F->eraseFromParent();
|
||||||
F = M->getFunction(Name);
|
F = M->getFunction(Name);
|
||||||
|
|
||||||
// If F already has a body, reject this.
|
// If F already has a body, reject this.
|
||||||
if (!F->empty()) {
|
if (!F->empty()) {
|
||||||
ErrorF("redefinition of function");
|
ErrorF("redefinition of function");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If F took a different number of args, reject.
|
// If F took a different number of args, reject.
|
||||||
if (F->arg_size() != Args.size()) {
|
if (F->arg_size() != Args.size()) {
|
||||||
ErrorF("redefinition of function with different # args");
|
ErrorF("redefinition of function with different # args");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set names for all arguments.
|
// Set names for all arguments.
|
||||||
unsigned Idx = 0;
|
unsigned Idx = 0;
|
||||||
for (Function::arg_iterator AI = F->arg_begin(); Idx != Args.size();
|
for (Function::arg_iterator AI = F->arg_begin(); Idx != Args.size();
|
||||||
++AI, ++Idx)
|
++AI, ++Idx)
|
||||||
AI->setName(Args[Idx]);
|
AI->setName(Args[Idx]);
|
||||||
|
|
||||||
return F;
|
return F;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1355,19 +1355,19 @@ void PrototypeAST::CreateArgumentAllocas(Function *F) {
|
|||||||
|
|
||||||
Function *FunctionAST::Codegen() {
|
Function *FunctionAST::Codegen() {
|
||||||
NamedValues.clear();
|
NamedValues.clear();
|
||||||
|
|
||||||
Function *TheFunction = Proto->Codegen();
|
Function *TheFunction = Proto->Codegen();
|
||||||
if (TheFunction == 0)
|
if (TheFunction == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// If this is an operator, install it.
|
// If this is an operator, install it.
|
||||||
if (Proto->isBinaryOp())
|
if (Proto->isBinaryOp())
|
||||||
BinopPrecedence[Proto->getOperatorName()] = Proto->getBinaryPrecedence();
|
BinopPrecedence[Proto->getOperatorName()] = Proto->getBinaryPrecedence();
|
||||||
|
|
||||||
// Create a new basic block to start insertion into.
|
// Create a new basic block to start insertion into.
|
||||||
BasicBlock *BB = BasicBlock::Create(getGlobalContext(), "entry", TheFunction);
|
BasicBlock *BB = BasicBlock::Create(getGlobalContext(), "entry", TheFunction);
|
||||||
Builder.SetInsertPoint(BB);
|
Builder.SetInsertPoint(BB);
|
||||||
|
|
||||||
// Add all arguments to the symbol table and create their allocas.
|
// Add all arguments to the symbol table and create their allocas.
|
||||||
Proto->CreateArgumentAllocas(TheFunction);
|
Proto->CreateArgumentAllocas(TheFunction);
|
||||||
|
|
||||||
@ -1428,7 +1428,7 @@ static void HandleTopLevelExpression() {
|
|||||||
if (Function *LF = F->Codegen()) {
|
if (Function *LF = F->Codegen()) {
|
||||||
// JIT the function, returning a function pointer.
|
// JIT the function, returning a function pointer.
|
||||||
void *FPtr = TheHelper->getPointerToFunction(LF);
|
void *FPtr = TheHelper->getPointerToFunction(LF);
|
||||||
|
|
||||||
// Cast it to the right type (takes no arguments, returns a double) so we
|
// Cast it to the right type (takes no arguments, returns a double) so we
|
||||||
// can call it as a native function.
|
// can call it as a native function.
|
||||||
double (*FP)() = (double (*)())(intptr_t)FPtr;
|
double (*FP)() = (double (*)())(intptr_t)FPtr;
|
||||||
@ -1465,20 +1465,20 @@ static void MainLoop() {
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
/// putchard - putchar that takes a double and returns 0.
|
/// putchard - putchar that takes a double and returns 0.
|
||||||
extern "C"
|
extern "C"
|
||||||
double putchard(double X) {
|
double putchard(double X) {
|
||||||
putchar((char)X);
|
putchar((char)X);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// printd - printf that takes a double prints it as "%f\n", returning 0.
|
/// printd - printf that takes a double prints it as "%f\n", returning 0.
|
||||||
extern "C"
|
extern "C"
|
||||||
double printd(double X) {
|
double printd(double X) {
|
||||||
printf("%f", X);
|
printf("%f", X);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
double printlf() {
|
double printlf() {
|
||||||
printf("\n");
|
printf("\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -37,7 +37,7 @@ namespace {
|
|||||||
cl::value_desc("input IR file name"));
|
cl::value_desc("input IR file name"));
|
||||||
|
|
||||||
cl::opt<bool>
|
cl::opt<bool>
|
||||||
VerboseOutput("verbose",
|
VerboseOutput("verbose",
|
||||||
cl::desc("Enable verbose output (results, IR, etc.) to stderr"),
|
cl::desc("Enable verbose output (results, IR, etc.) to stderr"),
|
||||||
cl::init(false));
|
cl::init(false));
|
||||||
|
|
||||||
@ -830,8 +830,8 @@ private:
|
|||||||
|
|
||||||
class HelpingMemoryManager : public SectionMemoryManager
|
class HelpingMemoryManager : public SectionMemoryManager
|
||||||
{
|
{
|
||||||
HelpingMemoryManager(const HelpingMemoryManager&) LLVM_DELETED_FUNCTION;
|
HelpingMemoryManager(const HelpingMemoryManager&) = delete;
|
||||||
void operator=(const HelpingMemoryManager&) LLVM_DELETED_FUNCTION;
|
void operator=(const HelpingMemoryManager&) = delete;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
HelpingMemoryManager(MCJITHelper *Helper) : MasterHelper(Helper) {}
|
HelpingMemoryManager(MCJITHelper *Helper) : MasterHelper(Helper) {}
|
||||||
|
@ -32,14 +32,14 @@ enum Token {
|
|||||||
|
|
||||||
// primary
|
// primary
|
||||||
tok_identifier = -4, tok_number = -5,
|
tok_identifier = -4, tok_number = -5,
|
||||||
|
|
||||||
// control
|
// control
|
||||||
tok_if = -6, tok_then = -7, tok_else = -8,
|
tok_if = -6, tok_then = -7, tok_else = -8,
|
||||||
tok_for = -9, tok_in = -10,
|
tok_for = -9, tok_in = -10,
|
||||||
|
|
||||||
// operators
|
// operators
|
||||||
tok_binary = -11, tok_unary = -12,
|
tok_binary = -11, tok_unary = -12,
|
||||||
|
|
||||||
// var definition
|
// var definition
|
||||||
tok_var = -13
|
tok_var = -13
|
||||||
};
|
};
|
||||||
@ -88,11 +88,11 @@ static int gettok() {
|
|||||||
// Comment until end of line.
|
// Comment until end of line.
|
||||||
do LastChar = getchar();
|
do LastChar = getchar();
|
||||||
while (LastChar != EOF && LastChar != '\n' && LastChar != '\r');
|
while (LastChar != EOF && LastChar != '\n' && LastChar != '\r');
|
||||||
|
|
||||||
if (LastChar != EOF)
|
if (LastChar != EOF)
|
||||||
return gettok();
|
return gettok();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for end of file. Don't eat the EOF.
|
// Check for end of file. Don't eat the EOF.
|
||||||
if (LastChar == EOF)
|
if (LastChar == EOF)
|
||||||
return tok_eof;
|
return tok_eof;
|
||||||
@ -136,7 +136,7 @@ class UnaryExprAST : public ExprAST {
|
|||||||
char Opcode;
|
char Opcode;
|
||||||
ExprAST *Operand;
|
ExprAST *Operand;
|
||||||
public:
|
public:
|
||||||
UnaryExprAST(char opcode, ExprAST *operand)
|
UnaryExprAST(char opcode, ExprAST *operand)
|
||||||
: Opcode(opcode), Operand(operand) {}
|
: Opcode(opcode), Operand(operand) {}
|
||||||
virtual Value *Codegen();
|
virtual Value *Codegen();
|
||||||
};
|
};
|
||||||
@ -146,7 +146,7 @@ class BinaryExprAST : public ExprAST {
|
|||||||
char Op;
|
char Op;
|
||||||
ExprAST *LHS, *RHS;
|
ExprAST *LHS, *RHS;
|
||||||
public:
|
public:
|
||||||
BinaryExprAST(char op, ExprAST *lhs, ExprAST *rhs)
|
BinaryExprAST(char op, ExprAST *lhs, ExprAST *rhs)
|
||||||
: Op(op), LHS(lhs), RHS(rhs) {}
|
: Op(op), LHS(lhs), RHS(rhs) {}
|
||||||
virtual Value *Codegen();
|
virtual Value *Codegen();
|
||||||
};
|
};
|
||||||
@ -189,7 +189,7 @@ public:
|
|||||||
VarExprAST(const std::vector<std::pair<std::string, ExprAST*> > &varnames,
|
VarExprAST(const std::vector<std::pair<std::string, ExprAST*> > &varnames,
|
||||||
ExprAST *body)
|
ExprAST *body)
|
||||||
: VarNames(varnames), Body(body) {}
|
: VarNames(varnames), Body(body) {}
|
||||||
|
|
||||||
virtual Value *Codegen();
|
virtual Value *Codegen();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -204,19 +204,19 @@ public:
|
|||||||
PrototypeAST(const std::string &name, const std::vector<std::string> &args,
|
PrototypeAST(const std::string &name, const std::vector<std::string> &args,
|
||||||
bool isoperator = false, unsigned prec = 0)
|
bool isoperator = false, unsigned prec = 0)
|
||||||
: Name(name), Args(args), isOperator(isoperator), Precedence(prec) {}
|
: Name(name), Args(args), isOperator(isoperator), Precedence(prec) {}
|
||||||
|
|
||||||
bool isUnaryOp() const { return isOperator && Args.size() == 1; }
|
bool isUnaryOp() const { return isOperator && Args.size() == 1; }
|
||||||
bool isBinaryOp() const { return isOperator && Args.size() == 2; }
|
bool isBinaryOp() const { return isOperator && Args.size() == 2; }
|
||||||
|
|
||||||
char getOperatorName() const {
|
char getOperatorName() const {
|
||||||
assert(isUnaryOp() || isBinaryOp());
|
assert(isUnaryOp() || isBinaryOp());
|
||||||
return Name[Name.size()-1];
|
return Name[Name.size()-1];
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned getBinaryPrecedence() const { return Precedence; }
|
unsigned getBinaryPrecedence() const { return Precedence; }
|
||||||
|
|
||||||
Function *Codegen();
|
Function *Codegen();
|
||||||
|
|
||||||
void CreateArgumentAllocas(Function *F);
|
void CreateArgumentAllocas(Function *F);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -227,7 +227,7 @@ class FunctionAST {
|
|||||||
public:
|
public:
|
||||||
FunctionAST(PrototypeAST *proto, ExprAST *body)
|
FunctionAST(PrototypeAST *proto, ExprAST *body)
|
||||||
: Proto(proto), Body(body) {}
|
: Proto(proto), Body(body) {}
|
||||||
|
|
||||||
Function *Codegen();
|
Function *Codegen();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -251,7 +251,7 @@ static std::map<char, int> BinopPrecedence;
|
|||||||
static int GetTokPrecedence() {
|
static int GetTokPrecedence() {
|
||||||
if (!isascii(CurTok))
|
if (!isascii(CurTok))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
// Make sure it's a declared binop.
|
// Make sure it's a declared binop.
|
||||||
int TokPrec = BinopPrecedence[CurTok];
|
int TokPrec = BinopPrecedence[CurTok];
|
||||||
if (TokPrec <= 0) return -1;
|
if (TokPrec <= 0) return -1;
|
||||||
@ -270,12 +270,12 @@ static ExprAST *ParseExpression();
|
|||||||
/// ::= identifier '(' expression* ')'
|
/// ::= identifier '(' expression* ')'
|
||||||
static ExprAST *ParseIdentifierExpr() {
|
static ExprAST *ParseIdentifierExpr() {
|
||||||
std::string IdName = IdentifierStr;
|
std::string IdName = IdentifierStr;
|
||||||
|
|
||||||
getNextToken(); // eat identifier.
|
getNextToken(); // eat identifier.
|
||||||
|
|
||||||
if (CurTok != '(') // Simple variable ref.
|
if (CurTok != '(') // Simple variable ref.
|
||||||
return new VariableExprAST(IdName);
|
return new VariableExprAST(IdName);
|
||||||
|
|
||||||
// Call.
|
// Call.
|
||||||
getNextToken(); // eat (
|
getNextToken(); // eat (
|
||||||
std::vector<ExprAST*> Args;
|
std::vector<ExprAST*> Args;
|
||||||
@ -295,7 +295,7 @@ static ExprAST *ParseIdentifierExpr() {
|
|||||||
|
|
||||||
// Eat the ')'.
|
// Eat the ')'.
|
||||||
getNextToken();
|
getNextToken();
|
||||||
|
|
||||||
return new CallExprAST(IdName, Args);
|
return new CallExprAST(IdName, Args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -311,7 +311,7 @@ static ExprAST *ParseParenExpr() {
|
|||||||
getNextToken(); // eat (.
|
getNextToken(); // eat (.
|
||||||
ExprAST *V = ParseExpression();
|
ExprAST *V = ParseExpression();
|
||||||
if (!V) return 0;
|
if (!V) return 0;
|
||||||
|
|
||||||
if (CurTok != ')')
|
if (CurTok != ')')
|
||||||
return Error("expected ')'");
|
return Error("expected ')'");
|
||||||
getNextToken(); // eat ).
|
getNextToken(); // eat ).
|
||||||
@ -321,26 +321,26 @@ static ExprAST *ParseParenExpr() {
|
|||||||
/// ifexpr ::= 'if' expression 'then' expression 'else' expression
|
/// ifexpr ::= 'if' expression 'then' expression 'else' expression
|
||||||
static ExprAST *ParseIfExpr() {
|
static ExprAST *ParseIfExpr() {
|
||||||
getNextToken(); // eat the if.
|
getNextToken(); // eat the if.
|
||||||
|
|
||||||
// condition.
|
// condition.
|
||||||
ExprAST *Cond = ParseExpression();
|
ExprAST *Cond = ParseExpression();
|
||||||
if (!Cond) return 0;
|
if (!Cond) return 0;
|
||||||
|
|
||||||
if (CurTok != tok_then)
|
if (CurTok != tok_then)
|
||||||
return Error("expected then");
|
return Error("expected then");
|
||||||
getNextToken(); // eat the then
|
getNextToken(); // eat the then
|
||||||
|
|
||||||
ExprAST *Then = ParseExpression();
|
ExprAST *Then = ParseExpression();
|
||||||
if (Then == 0) return 0;
|
if (Then == 0) return 0;
|
||||||
|
|
||||||
if (CurTok != tok_else)
|
if (CurTok != tok_else)
|
||||||
return Error("expected else");
|
return Error("expected else");
|
||||||
|
|
||||||
getNextToken();
|
getNextToken();
|
||||||
|
|
||||||
ExprAST *Else = ParseExpression();
|
ExprAST *Else = ParseExpression();
|
||||||
if (!Else) return 0;
|
if (!Else) return 0;
|
||||||
|
|
||||||
return new IfExprAST(Cond, Then, Else);
|
return new IfExprAST(Cond, Then, Else);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -350,24 +350,24 @@ static ExprAST *ParseForExpr() {
|
|||||||
|
|
||||||
if (CurTok != tok_identifier)
|
if (CurTok != tok_identifier)
|
||||||
return Error("expected identifier after for");
|
return Error("expected identifier after for");
|
||||||
|
|
||||||
std::string IdName = IdentifierStr;
|
std::string IdName = IdentifierStr;
|
||||||
getNextToken(); // eat identifier.
|
getNextToken(); // eat identifier.
|
||||||
|
|
||||||
if (CurTok != '=')
|
if (CurTok != '=')
|
||||||
return Error("expected '=' after for");
|
return Error("expected '=' after for");
|
||||||
getNextToken(); // eat '='.
|
getNextToken(); // eat '='.
|
||||||
|
|
||||||
|
|
||||||
ExprAST *Start = ParseExpression();
|
ExprAST *Start = ParseExpression();
|
||||||
if (Start == 0) return 0;
|
if (Start == 0) return 0;
|
||||||
if (CurTok != ',')
|
if (CurTok != ',')
|
||||||
return Error("expected ',' after for start value");
|
return Error("expected ',' after for start value");
|
||||||
getNextToken();
|
getNextToken();
|
||||||
|
|
||||||
ExprAST *End = ParseExpression();
|
ExprAST *End = ParseExpression();
|
||||||
if (End == 0) return 0;
|
if (End == 0) return 0;
|
||||||
|
|
||||||
// The step value is optional.
|
// The step value is optional.
|
||||||
ExprAST *Step = 0;
|
ExprAST *Step = 0;
|
||||||
if (CurTok == ',') {
|
if (CurTok == ',') {
|
||||||
@ -375,18 +375,18 @@ static ExprAST *ParseForExpr() {
|
|||||||
Step = ParseExpression();
|
Step = ParseExpression();
|
||||||
if (Step == 0) return 0;
|
if (Step == 0) return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CurTok != tok_in)
|
if (CurTok != tok_in)
|
||||||
return Error("expected 'in' after for");
|
return Error("expected 'in' after for");
|
||||||
getNextToken(); // eat 'in'.
|
getNextToken(); // eat 'in'.
|
||||||
|
|
||||||
ExprAST *Body = ParseExpression();
|
ExprAST *Body = ParseExpression();
|
||||||
if (Body == 0) return 0;
|
if (Body == 0) return 0;
|
||||||
|
|
||||||
return new ForExprAST(IdName, Start, End, Step, Body);
|
return new ForExprAST(IdName, Start, End, Step, Body);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// varexpr ::= 'var' identifier ('=' expression)?
|
/// varexpr ::= 'var' identifier ('=' expression)?
|
||||||
// (',' identifier ('=' expression)?)* 'in' expression
|
// (',' identifier ('=' expression)?)* 'in' expression
|
||||||
static ExprAST *ParseVarExpr() {
|
static ExprAST *ParseVarExpr() {
|
||||||
getNextToken(); // eat the var.
|
getNextToken(); // eat the var.
|
||||||
@ -396,7 +396,7 @@ static ExprAST *ParseVarExpr() {
|
|||||||
// At least one variable name is required.
|
// At least one variable name is required.
|
||||||
if (CurTok != tok_identifier)
|
if (CurTok != tok_identifier)
|
||||||
return Error("expected identifier after var");
|
return Error("expected identifier after var");
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
std::string Name = IdentifierStr;
|
std::string Name = IdentifierStr;
|
||||||
getNextToken(); // eat identifier.
|
getNextToken(); // eat identifier.
|
||||||
@ -405,29 +405,29 @@ static ExprAST *ParseVarExpr() {
|
|||||||
ExprAST *Init = 0;
|
ExprAST *Init = 0;
|
||||||
if (CurTok == '=') {
|
if (CurTok == '=') {
|
||||||
getNextToken(); // eat the '='.
|
getNextToken(); // eat the '='.
|
||||||
|
|
||||||
Init = ParseExpression();
|
Init = ParseExpression();
|
||||||
if (Init == 0) return 0;
|
if (Init == 0) return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
VarNames.push_back(std::make_pair(Name, Init));
|
VarNames.push_back(std::make_pair(Name, Init));
|
||||||
|
|
||||||
// End of var list, exit loop.
|
// End of var list, exit loop.
|
||||||
if (CurTok != ',') break;
|
if (CurTok != ',') break;
|
||||||
getNextToken(); // eat the ','.
|
getNextToken(); // eat the ','.
|
||||||
|
|
||||||
if (CurTok != tok_identifier)
|
if (CurTok != tok_identifier)
|
||||||
return Error("expected identifier list after var");
|
return Error("expected identifier list after var");
|
||||||
}
|
}
|
||||||
|
|
||||||
// At this point, we have to have 'in'.
|
// At this point, we have to have 'in'.
|
||||||
if (CurTok != tok_in)
|
if (CurTok != tok_in)
|
||||||
return Error("expected 'in' keyword after 'var'");
|
return Error("expected 'in' keyword after 'var'");
|
||||||
getNextToken(); // eat 'in'.
|
getNextToken(); // eat 'in'.
|
||||||
|
|
||||||
ExprAST *Body = ParseExpression();
|
ExprAST *Body = ParseExpression();
|
||||||
if (Body == 0) return 0;
|
if (Body == 0) return 0;
|
||||||
|
|
||||||
return new VarExprAST(VarNames, Body);
|
return new VarExprAST(VarNames, Body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -457,7 +457,7 @@ static ExprAST *ParseUnary() {
|
|||||||
// If the current token is not an operator, it must be a primary expr.
|
// If the current token is not an operator, it must be a primary expr.
|
||||||
if (!isascii(CurTok) || CurTok == '(' || CurTok == ',')
|
if (!isascii(CurTok) || CurTok == '(' || CurTok == ',')
|
||||||
return ParsePrimary();
|
return ParsePrimary();
|
||||||
|
|
||||||
// If this is a unary operator, read it.
|
// If this is a unary operator, read it.
|
||||||
int Opc = CurTok;
|
int Opc = CurTok;
|
||||||
getNextToken();
|
getNextToken();
|
||||||
@ -472,20 +472,20 @@ static ExprAST *ParseBinOpRHS(int ExprPrec, ExprAST *LHS) {
|
|||||||
// If this is a binop, find its precedence.
|
// If this is a binop, find its precedence.
|
||||||
while (1) {
|
while (1) {
|
||||||
int TokPrec = GetTokPrecedence();
|
int TokPrec = GetTokPrecedence();
|
||||||
|
|
||||||
// If this is a binop that binds at least as tightly as the current binop,
|
// If this is a binop that binds at least as tightly as the current binop,
|
||||||
// consume it, otherwise we are done.
|
// consume it, otherwise we are done.
|
||||||
if (TokPrec < ExprPrec)
|
if (TokPrec < ExprPrec)
|
||||||
return LHS;
|
return LHS;
|
||||||
|
|
||||||
// Okay, we know this is a binop.
|
// Okay, we know this is a binop.
|
||||||
int BinOp = CurTok;
|
int BinOp = CurTok;
|
||||||
getNextToken(); // eat binop
|
getNextToken(); // eat binop
|
||||||
|
|
||||||
// Parse the unary expression after the binary operator.
|
// Parse the unary expression after the binary operator.
|
||||||
ExprAST *RHS = ParseUnary();
|
ExprAST *RHS = ParseUnary();
|
||||||
if (!RHS) return 0;
|
if (!RHS) return 0;
|
||||||
|
|
||||||
// If BinOp binds less tightly with RHS than the operator after RHS, let
|
// If BinOp binds less tightly with RHS than the operator after RHS, let
|
||||||
// the pending operator take RHS as its LHS.
|
// the pending operator take RHS as its LHS.
|
||||||
int NextPrec = GetTokPrecedence();
|
int NextPrec = GetTokPrecedence();
|
||||||
@ -493,7 +493,7 @@ static ExprAST *ParseBinOpRHS(int ExprPrec, ExprAST *LHS) {
|
|||||||
RHS = ParseBinOpRHS(TokPrec+1, RHS);
|
RHS = ParseBinOpRHS(TokPrec+1, RHS);
|
||||||
if (RHS == 0) return 0;
|
if (RHS == 0) return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Merge LHS/RHS.
|
// Merge LHS/RHS.
|
||||||
LHS = new BinaryExprAST(BinOp, LHS, RHS);
|
LHS = new BinaryExprAST(BinOp, LHS, RHS);
|
||||||
}
|
}
|
||||||
@ -505,7 +505,7 @@ static ExprAST *ParseBinOpRHS(int ExprPrec, ExprAST *LHS) {
|
|||||||
static ExprAST *ParseExpression() {
|
static ExprAST *ParseExpression() {
|
||||||
ExprAST *LHS = ParseUnary();
|
ExprAST *LHS = ParseUnary();
|
||||||
if (!LHS) return 0;
|
if (!LHS) return 0;
|
||||||
|
|
||||||
return ParseBinOpRHS(0, LHS);
|
return ParseBinOpRHS(0, LHS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -515,10 +515,10 @@ static ExprAST *ParseExpression() {
|
|||||||
/// ::= unary LETTER (id)
|
/// ::= unary LETTER (id)
|
||||||
static PrototypeAST *ParsePrototype() {
|
static PrototypeAST *ParsePrototype() {
|
||||||
std::string FnName;
|
std::string FnName;
|
||||||
|
|
||||||
unsigned Kind = 0; // 0 = identifier, 1 = unary, 2 = binary.
|
unsigned Kind = 0; // 0 = identifier, 1 = unary, 2 = binary.
|
||||||
unsigned BinaryPrecedence = 30;
|
unsigned BinaryPrecedence = 30;
|
||||||
|
|
||||||
switch (CurTok) {
|
switch (CurTok) {
|
||||||
default:
|
default:
|
||||||
return ErrorP("Expected function name in prototype");
|
return ErrorP("Expected function name in prototype");
|
||||||
@ -544,7 +544,7 @@ static PrototypeAST *ParsePrototype() {
|
|||||||
FnName += (char)CurTok;
|
FnName += (char)CurTok;
|
||||||
Kind = 2;
|
Kind = 2;
|
||||||
getNextToken();
|
getNextToken();
|
||||||
|
|
||||||
// Read the precedence if present.
|
// Read the precedence if present.
|
||||||
if (CurTok == tok_number) {
|
if (CurTok == tok_number) {
|
||||||
if (NumVal < 1 || NumVal > 100)
|
if (NumVal < 1 || NumVal > 100)
|
||||||
@ -554,23 +554,23 @@ static PrototypeAST *ParsePrototype() {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CurTok != '(')
|
if (CurTok != '(')
|
||||||
return ErrorP("Expected '(' in prototype");
|
return ErrorP("Expected '(' in prototype");
|
||||||
|
|
||||||
std::vector<std::string> ArgNames;
|
std::vector<std::string> ArgNames;
|
||||||
while (getNextToken() == tok_identifier)
|
while (getNextToken() == tok_identifier)
|
||||||
ArgNames.push_back(IdentifierStr);
|
ArgNames.push_back(IdentifierStr);
|
||||||
if (CurTok != ')')
|
if (CurTok != ')')
|
||||||
return ErrorP("Expected ')' in prototype");
|
return ErrorP("Expected ')' in prototype");
|
||||||
|
|
||||||
// success.
|
// success.
|
||||||
getNextToken(); // eat ')'.
|
getNextToken(); // eat ')'.
|
||||||
|
|
||||||
// Verify right number of names for operator.
|
// Verify right number of names for operator.
|
||||||
if (Kind && ArgNames.size() != Kind)
|
if (Kind && ArgNames.size() != Kind)
|
||||||
return ErrorP("Invalid number of operands for operator");
|
return ErrorP("Invalid number of operands for operator");
|
||||||
|
|
||||||
return new PrototypeAST(FnName, ArgNames, Kind != 0, BinaryPrecedence);
|
return new PrototypeAST(FnName, ArgNames, Kind != 0, BinaryPrecedence);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -670,14 +670,14 @@ private:
|
|||||||
|
|
||||||
class HelpingMemoryManager : public SectionMemoryManager
|
class HelpingMemoryManager : public SectionMemoryManager
|
||||||
{
|
{
|
||||||
HelpingMemoryManager(const HelpingMemoryManager&) LLVM_DELETED_FUNCTION;
|
HelpingMemoryManager(const HelpingMemoryManager&) = delete;
|
||||||
void operator=(const HelpingMemoryManager&) LLVM_DELETED_FUNCTION;
|
void operator=(const HelpingMemoryManager&) = delete;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
HelpingMemoryManager(MCJITHelper *Helper) : MasterHelper(Helper) {}
|
HelpingMemoryManager(MCJITHelper *Helper) : MasterHelper(Helper) {}
|
||||||
virtual ~HelpingMemoryManager() {}
|
virtual ~HelpingMemoryManager() {}
|
||||||
|
|
||||||
/// This method returns the address of the specified function.
|
/// This method returns the address of the specified function.
|
||||||
/// Our implementation will attempt to find functions in other
|
/// Our implementation will attempt to find functions in other
|
||||||
/// modules associated with the MCJITHelper to cross link functions
|
/// modules associated with the MCJITHelper to cross link functions
|
||||||
/// from one generated module to another.
|
/// from one generated module to another.
|
||||||
@ -739,9 +739,9 @@ Function *MCJITHelper::getFunction(const std::string FnName) {
|
|||||||
|
|
||||||
// If we don't have a prototype yet, create one.
|
// If we don't have a prototype yet, create one.
|
||||||
if (!PF)
|
if (!PF)
|
||||||
PF = Function::Create(F->getFunctionType(),
|
PF = Function::Create(F->getFunctionType(),
|
||||||
Function::ExternalLinkage,
|
Function::ExternalLinkage,
|
||||||
FnName,
|
FnName,
|
||||||
OpenModule);
|
OpenModule);
|
||||||
return PF;
|
return PF;
|
||||||
}
|
}
|
||||||
@ -885,11 +885,11 @@ Value *VariableExprAST::Codegen() {
|
|||||||
Value *UnaryExprAST::Codegen() {
|
Value *UnaryExprAST::Codegen() {
|
||||||
Value *OperandV = Operand->Codegen();
|
Value *OperandV = Operand->Codegen();
|
||||||
if (OperandV == 0) return 0;
|
if (OperandV == 0) return 0;
|
||||||
|
|
||||||
Function *F = TheHelper->getFunction(MakeLegalFunctionName(std::string("unary")+Opcode));
|
Function *F = TheHelper->getFunction(MakeLegalFunctionName(std::string("unary")+Opcode));
|
||||||
if (F == 0)
|
if (F == 0)
|
||||||
return ErrorV("Unknown unary operator");
|
return ErrorV("Unknown unary operator");
|
||||||
|
|
||||||
return Builder.CreateCall(F, OperandV, "unop");
|
return Builder.CreateCall(F, OperandV, "unop");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -911,11 +911,11 @@ Value *BinaryExprAST::Codegen() {
|
|||||||
Builder.CreateStore(Val, Variable);
|
Builder.CreateStore(Val, Variable);
|
||||||
return Val;
|
return Val;
|
||||||
}
|
}
|
||||||
|
|
||||||
Value *L = LHS->Codegen();
|
Value *L = LHS->Codegen();
|
||||||
Value *R = RHS->Codegen();
|
Value *R = RHS->Codegen();
|
||||||
if (L == 0 || R == 0) return 0;
|
if (L == 0 || R == 0) return 0;
|
||||||
|
|
||||||
switch (Op) {
|
switch (Op) {
|
||||||
case '+': return Builder.CreateFAdd(L, R, "addtmp");
|
case '+': return Builder.CreateFAdd(L, R, "addtmp");
|
||||||
case '-': return Builder.CreateFSub(L, R, "subtmp");
|
case '-': return Builder.CreateFSub(L, R, "subtmp");
|
||||||
@ -928,12 +928,12 @@ Value *BinaryExprAST::Codegen() {
|
|||||||
"booltmp");
|
"booltmp");
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If it wasn't a builtin binary operator, it must be a user defined one. Emit
|
// If it wasn't a builtin binary operator, it must be a user defined one. Emit
|
||||||
// a call to it.
|
// a call to it.
|
||||||
Function *F = TheHelper->getFunction(MakeLegalFunctionName(std::string("binary")+Op));
|
Function *F = TheHelper->getFunction(MakeLegalFunctionName(std::string("binary")+Op));
|
||||||
assert(F && "binary operator not found!");
|
assert(F && "binary operator not found!");
|
||||||
|
|
||||||
Value *Ops[] = { L, R };
|
Value *Ops[] = { L, R };
|
||||||
return Builder.CreateCall(F, Ops, "binop");
|
return Builder.CreateCall(F, Ops, "binop");
|
||||||
}
|
}
|
||||||
@ -943,7 +943,7 @@ Value *CallExprAST::Codegen() {
|
|||||||
Function *CalleeF = TheHelper->getFunction(Callee);
|
Function *CalleeF = TheHelper->getFunction(Callee);
|
||||||
if (CalleeF == 0)
|
if (CalleeF == 0)
|
||||||
return ErrorV("Unknown function referenced");
|
return ErrorV("Unknown function referenced");
|
||||||
|
|
||||||
// If argument mismatch error.
|
// If argument mismatch error.
|
||||||
if (CalleeF->arg_size() != Args.size())
|
if (CalleeF->arg_size() != Args.size())
|
||||||
return ErrorV("Incorrect # arguments passed");
|
return ErrorV("Incorrect # arguments passed");
|
||||||
@ -953,56 +953,56 @@ Value *CallExprAST::Codegen() {
|
|||||||
ArgsV.push_back(Args[i]->Codegen());
|
ArgsV.push_back(Args[i]->Codegen());
|
||||||
if (ArgsV.back() == 0) return 0;
|
if (ArgsV.back() == 0) return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Builder.CreateCall(CalleeF, ArgsV, "calltmp");
|
return Builder.CreateCall(CalleeF, ArgsV, "calltmp");
|
||||||
}
|
}
|
||||||
|
|
||||||
Value *IfExprAST::Codegen() {
|
Value *IfExprAST::Codegen() {
|
||||||
Value *CondV = Cond->Codegen();
|
Value *CondV = Cond->Codegen();
|
||||||
if (CondV == 0) return 0;
|
if (CondV == 0) return 0;
|
||||||
|
|
||||||
// Convert condition to a bool by comparing equal to 0.0.
|
// Convert condition to a bool by comparing equal to 0.0.
|
||||||
CondV = Builder.CreateFCmpONE(CondV,
|
CondV = Builder.CreateFCmpONE(CondV,
|
||||||
ConstantFP::get(getGlobalContext(), APFloat(0.0)),
|
ConstantFP::get(getGlobalContext(), APFloat(0.0)),
|
||||||
"ifcond");
|
"ifcond");
|
||||||
|
|
||||||
Function *TheFunction = Builder.GetInsertBlock()->getParent();
|
Function *TheFunction = Builder.GetInsertBlock()->getParent();
|
||||||
|
|
||||||
// Create blocks for the then and else cases. Insert the 'then' block at the
|
// Create blocks for the then and else cases. Insert the 'then' block at the
|
||||||
// end of the function.
|
// end of the function.
|
||||||
BasicBlock *ThenBB = BasicBlock::Create(getGlobalContext(), "then", TheFunction);
|
BasicBlock *ThenBB = BasicBlock::Create(getGlobalContext(), "then", TheFunction);
|
||||||
BasicBlock *ElseBB = BasicBlock::Create(getGlobalContext(), "else");
|
BasicBlock *ElseBB = BasicBlock::Create(getGlobalContext(), "else");
|
||||||
BasicBlock *MergeBB = BasicBlock::Create(getGlobalContext(), "ifcont");
|
BasicBlock *MergeBB = BasicBlock::Create(getGlobalContext(), "ifcont");
|
||||||
|
|
||||||
Builder.CreateCondBr(CondV, ThenBB, ElseBB);
|
Builder.CreateCondBr(CondV, ThenBB, ElseBB);
|
||||||
|
|
||||||
// Emit then value.
|
// Emit then value.
|
||||||
Builder.SetInsertPoint(ThenBB);
|
Builder.SetInsertPoint(ThenBB);
|
||||||
|
|
||||||
Value *ThenV = Then->Codegen();
|
Value *ThenV = Then->Codegen();
|
||||||
if (ThenV == 0) return 0;
|
if (ThenV == 0) return 0;
|
||||||
|
|
||||||
Builder.CreateBr(MergeBB);
|
Builder.CreateBr(MergeBB);
|
||||||
// Codegen of 'Then' can change the current block, update ThenBB for the PHI.
|
// Codegen of 'Then' can change the current block, update ThenBB for the PHI.
|
||||||
ThenBB = Builder.GetInsertBlock();
|
ThenBB = Builder.GetInsertBlock();
|
||||||
|
|
||||||
// Emit else block.
|
// Emit else block.
|
||||||
TheFunction->getBasicBlockList().push_back(ElseBB);
|
TheFunction->getBasicBlockList().push_back(ElseBB);
|
||||||
Builder.SetInsertPoint(ElseBB);
|
Builder.SetInsertPoint(ElseBB);
|
||||||
|
|
||||||
Value *ElseV = Else->Codegen();
|
Value *ElseV = Else->Codegen();
|
||||||
if (ElseV == 0) return 0;
|
if (ElseV == 0) return 0;
|
||||||
|
|
||||||
Builder.CreateBr(MergeBB);
|
Builder.CreateBr(MergeBB);
|
||||||
// Codegen of 'Else' can change the current block, update ElseBB for the PHI.
|
// Codegen of 'Else' can change the current block, update ElseBB for the PHI.
|
||||||
ElseBB = Builder.GetInsertBlock();
|
ElseBB = Builder.GetInsertBlock();
|
||||||
|
|
||||||
// Emit merge block.
|
// Emit merge block.
|
||||||
TheFunction->getBasicBlockList().push_back(MergeBB);
|
TheFunction->getBasicBlockList().push_back(MergeBB);
|
||||||
Builder.SetInsertPoint(MergeBB);
|
Builder.SetInsertPoint(MergeBB);
|
||||||
PHINode *PN = Builder.CreatePHI(Type::getDoubleTy(getGlobalContext()), 2,
|
PHINode *PN = Builder.CreatePHI(Type::getDoubleTy(getGlobalContext()), 2,
|
||||||
"iftmp");
|
"iftmp");
|
||||||
|
|
||||||
PN->addIncoming(ThenV, ThenBB);
|
PN->addIncoming(ThenV, ThenBB);
|
||||||
PN->addIncoming(ElseV, ElseBB);
|
PN->addIncoming(ElseV, ElseBB);
|
||||||
return PN;
|
return PN;
|
||||||
@ -1015,7 +1015,7 @@ Value *ForExprAST::Codegen() {
|
|||||||
// start = startexpr
|
// start = startexpr
|
||||||
// store start -> var
|
// store start -> var
|
||||||
// goto loop
|
// goto loop
|
||||||
// loop:
|
// loop:
|
||||||
// ...
|
// ...
|
||||||
// bodyexpr
|
// bodyexpr
|
||||||
// ...
|
// ...
|
||||||
@ -1028,40 +1028,40 @@ Value *ForExprAST::Codegen() {
|
|||||||
// store nextvar -> var
|
// store nextvar -> var
|
||||||
// br endcond, loop, endloop
|
// br endcond, loop, endloop
|
||||||
// outloop:
|
// outloop:
|
||||||
|
|
||||||
Function *TheFunction = Builder.GetInsertBlock()->getParent();
|
Function *TheFunction = Builder.GetInsertBlock()->getParent();
|
||||||
|
|
||||||
// Create an alloca for the variable in the entry block.
|
// Create an alloca for the variable in the entry block.
|
||||||
AllocaInst *Alloca = CreateEntryBlockAlloca(TheFunction, VarName);
|
AllocaInst *Alloca = CreateEntryBlockAlloca(TheFunction, VarName);
|
||||||
|
|
||||||
// Emit the start code first, without 'variable' in scope.
|
// Emit the start code first, without 'variable' in scope.
|
||||||
Value *StartVal = Start->Codegen();
|
Value *StartVal = Start->Codegen();
|
||||||
if (StartVal == 0) return 0;
|
if (StartVal == 0) return 0;
|
||||||
|
|
||||||
// Store the value into the alloca.
|
// Store the value into the alloca.
|
||||||
Builder.CreateStore(StartVal, Alloca);
|
Builder.CreateStore(StartVal, Alloca);
|
||||||
|
|
||||||
// Make the new basic block for the loop header, inserting after current
|
// Make the new basic block for the loop header, inserting after current
|
||||||
// block.
|
// block.
|
||||||
BasicBlock *LoopBB = BasicBlock::Create(getGlobalContext(), "loop", TheFunction);
|
BasicBlock *LoopBB = BasicBlock::Create(getGlobalContext(), "loop", TheFunction);
|
||||||
|
|
||||||
// Insert an explicit fall through from the current block to the LoopBB.
|
// Insert an explicit fall through from the current block to the LoopBB.
|
||||||
Builder.CreateBr(LoopBB);
|
Builder.CreateBr(LoopBB);
|
||||||
|
|
||||||
// Start insertion in LoopBB.
|
// Start insertion in LoopBB.
|
||||||
Builder.SetInsertPoint(LoopBB);
|
Builder.SetInsertPoint(LoopBB);
|
||||||
|
|
||||||
// Within the loop, the variable is defined equal to the PHI node. If it
|
// Within the loop, the variable is defined equal to the PHI node. If it
|
||||||
// shadows an existing variable, we have to restore it, so save it now.
|
// shadows an existing variable, we have to restore it, so save it now.
|
||||||
AllocaInst *OldVal = NamedValues[VarName];
|
AllocaInst *OldVal = NamedValues[VarName];
|
||||||
NamedValues[VarName] = Alloca;
|
NamedValues[VarName] = Alloca;
|
||||||
|
|
||||||
// Emit the body of the loop. This, like any other expr, can change the
|
// Emit the body of the loop. This, like any other expr, can change the
|
||||||
// current BB. Note that we ignore the value computed by the body, but don't
|
// current BB. Note that we ignore the value computed by the body, but don't
|
||||||
// allow an error.
|
// allow an error.
|
||||||
if (Body->Codegen() == 0)
|
if (Body->Codegen() == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// Emit the step value.
|
// Emit the step value.
|
||||||
Value *StepVal;
|
Value *StepVal;
|
||||||
if (Step) {
|
if (Step) {
|
||||||
@ -1071,52 +1071,52 @@ Value *ForExprAST::Codegen() {
|
|||||||
// If not specified, use 1.0.
|
// If not specified, use 1.0.
|
||||||
StepVal = ConstantFP::get(getGlobalContext(), APFloat(1.0));
|
StepVal = ConstantFP::get(getGlobalContext(), APFloat(1.0));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute the end condition.
|
// Compute the end condition.
|
||||||
Value *EndCond = End->Codegen();
|
Value *EndCond = End->Codegen();
|
||||||
if (EndCond == 0) return EndCond;
|
if (EndCond == 0) return EndCond;
|
||||||
|
|
||||||
// Reload, increment, and restore the alloca. This handles the case where
|
// Reload, increment, and restore the alloca. This handles the case where
|
||||||
// the body of the loop mutates the variable.
|
// the body of the loop mutates the variable.
|
||||||
Value *CurVar = Builder.CreateLoad(Alloca, VarName.c_str());
|
Value *CurVar = Builder.CreateLoad(Alloca, VarName.c_str());
|
||||||
Value *NextVar = Builder.CreateFAdd(CurVar, StepVal, "nextvar");
|
Value *NextVar = Builder.CreateFAdd(CurVar, StepVal, "nextvar");
|
||||||
Builder.CreateStore(NextVar, Alloca);
|
Builder.CreateStore(NextVar, Alloca);
|
||||||
|
|
||||||
// Convert condition to a bool by comparing equal to 0.0.
|
// Convert condition to a bool by comparing equal to 0.0.
|
||||||
EndCond = Builder.CreateFCmpONE(EndCond,
|
EndCond = Builder.CreateFCmpONE(EndCond,
|
||||||
ConstantFP::get(getGlobalContext(), APFloat(0.0)),
|
ConstantFP::get(getGlobalContext(), APFloat(0.0)),
|
||||||
"loopcond");
|
"loopcond");
|
||||||
|
|
||||||
// Create the "after loop" block and insert it.
|
// Create the "after loop" block and insert it.
|
||||||
BasicBlock *AfterBB = BasicBlock::Create(getGlobalContext(), "afterloop", TheFunction);
|
BasicBlock *AfterBB = BasicBlock::Create(getGlobalContext(), "afterloop", TheFunction);
|
||||||
|
|
||||||
// Insert the conditional branch into the end of LoopEndBB.
|
// Insert the conditional branch into the end of LoopEndBB.
|
||||||
Builder.CreateCondBr(EndCond, LoopBB, AfterBB);
|
Builder.CreateCondBr(EndCond, LoopBB, AfterBB);
|
||||||
|
|
||||||
// Any new code will be inserted in AfterBB.
|
// Any new code will be inserted in AfterBB.
|
||||||
Builder.SetInsertPoint(AfterBB);
|
Builder.SetInsertPoint(AfterBB);
|
||||||
|
|
||||||
// Restore the unshadowed variable.
|
// Restore the unshadowed variable.
|
||||||
if (OldVal)
|
if (OldVal)
|
||||||
NamedValues[VarName] = OldVal;
|
NamedValues[VarName] = OldVal;
|
||||||
else
|
else
|
||||||
NamedValues.erase(VarName);
|
NamedValues.erase(VarName);
|
||||||
|
|
||||||
|
|
||||||
// for expr always returns 0.0.
|
// for expr always returns 0.0.
|
||||||
return Constant::getNullValue(Type::getDoubleTy(getGlobalContext()));
|
return Constant::getNullValue(Type::getDoubleTy(getGlobalContext()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Value *VarExprAST::Codegen() {
|
Value *VarExprAST::Codegen() {
|
||||||
std::vector<AllocaInst *> OldBindings;
|
std::vector<AllocaInst *> OldBindings;
|
||||||
|
|
||||||
Function *TheFunction = Builder.GetInsertBlock()->getParent();
|
Function *TheFunction = Builder.GetInsertBlock()->getParent();
|
||||||
|
|
||||||
// Register all variables and emit their initializer.
|
// Register all variables and emit their initializer.
|
||||||
for (unsigned i = 0, e = VarNames.size(); i != e; ++i) {
|
for (unsigned i = 0, e = VarNames.size(); i != e; ++i) {
|
||||||
const std::string &VarName = VarNames[i].first;
|
const std::string &VarName = VarNames[i].first;
|
||||||
ExprAST *Init = VarNames[i].second;
|
ExprAST *Init = VarNames[i].second;
|
||||||
|
|
||||||
// Emit the initializer before adding the variable to scope, this prevents
|
// Emit the initializer before adding the variable to scope, this prevents
|
||||||
// the initializer from referencing the variable itself, and permits stuff
|
// the initializer from referencing the variable itself, and permits stuff
|
||||||
// like this:
|
// like this:
|
||||||
@ -1129,22 +1129,22 @@ Value *VarExprAST::Codegen() {
|
|||||||
} else { // If not specified, use 0.0.
|
} else { // If not specified, use 0.0.
|
||||||
InitVal = ConstantFP::get(getGlobalContext(), APFloat(0.0));
|
InitVal = ConstantFP::get(getGlobalContext(), APFloat(0.0));
|
||||||
}
|
}
|
||||||
|
|
||||||
AllocaInst *Alloca = CreateEntryBlockAlloca(TheFunction, VarName);
|
AllocaInst *Alloca = CreateEntryBlockAlloca(TheFunction, VarName);
|
||||||
Builder.CreateStore(InitVal, Alloca);
|
Builder.CreateStore(InitVal, Alloca);
|
||||||
|
|
||||||
// Remember the old variable binding so that we can restore the binding when
|
// Remember the old variable binding so that we can restore the binding when
|
||||||
// we unrecurse.
|
// we unrecurse.
|
||||||
OldBindings.push_back(NamedValues[VarName]);
|
OldBindings.push_back(NamedValues[VarName]);
|
||||||
|
|
||||||
// Remember this binding.
|
// Remember this binding.
|
||||||
NamedValues[VarName] = Alloca;
|
NamedValues[VarName] = Alloca;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Codegen the body, now that all vars are in scope.
|
// Codegen the body, now that all vars are in scope.
|
||||||
Value *BodyVal = Body->Codegen();
|
Value *BodyVal = Body->Codegen();
|
||||||
if (BodyVal == 0) return 0;
|
if (BodyVal == 0) return 0;
|
||||||
|
|
||||||
// Pop all our variables from scope.
|
// Pop all our variables from scope.
|
||||||
for (unsigned i = 0, e = VarNames.size(); i != e; ++i)
|
for (unsigned i = 0, e = VarNames.size(); i != e; ++i)
|
||||||
NamedValues[VarNames[i].first] = OldBindings[i];
|
NamedValues[VarNames[i].first] = OldBindings[i];
|
||||||
@ -1155,7 +1155,7 @@ Value *VarExprAST::Codegen() {
|
|||||||
|
|
||||||
Function *PrototypeAST::Codegen() {
|
Function *PrototypeAST::Codegen() {
|
||||||
// Make the function type: double(double,double) etc.
|
// Make the function type: double(double,double) etc.
|
||||||
std::vector<Type*> Doubles(Args.size(),
|
std::vector<Type*> Doubles(Args.size(),
|
||||||
Type::getDoubleTy(getGlobalContext()));
|
Type::getDoubleTy(getGlobalContext()));
|
||||||
FunctionType *FT = FunctionType::get(Type::getDoubleTy(getGlobalContext()),
|
FunctionType *FT = FunctionType::get(Type::getDoubleTy(getGlobalContext()),
|
||||||
Doubles, false);
|
Doubles, false);
|
||||||
@ -1172,26 +1172,26 @@ Function *PrototypeAST::Codegen() {
|
|||||||
// Delete the one we just made and get the existing one.
|
// Delete the one we just made and get the existing one.
|
||||||
F->eraseFromParent();
|
F->eraseFromParent();
|
||||||
F = M->getFunction(Name);
|
F = M->getFunction(Name);
|
||||||
|
|
||||||
// If F already has a body, reject this.
|
// If F already has a body, reject this.
|
||||||
if (!F->empty()) {
|
if (!F->empty()) {
|
||||||
ErrorF("redefinition of function");
|
ErrorF("redefinition of function");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If F took a different number of args, reject.
|
// If F took a different number of args, reject.
|
||||||
if (F->arg_size() != Args.size()) {
|
if (F->arg_size() != Args.size()) {
|
||||||
ErrorF("redefinition of function with different # args");
|
ErrorF("redefinition of function with different # args");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set names for all arguments.
|
// Set names for all arguments.
|
||||||
unsigned Idx = 0;
|
unsigned Idx = 0;
|
||||||
for (Function::arg_iterator AI = F->arg_begin(); Idx != Args.size();
|
for (Function::arg_iterator AI = F->arg_begin(); Idx != Args.size();
|
||||||
++AI, ++Idx)
|
++AI, ++Idx)
|
||||||
AI->setName(Args[Idx]);
|
AI->setName(Args[Idx]);
|
||||||
|
|
||||||
return F;
|
return F;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1213,19 +1213,19 @@ void PrototypeAST::CreateArgumentAllocas(Function *F) {
|
|||||||
|
|
||||||
Function *FunctionAST::Codegen() {
|
Function *FunctionAST::Codegen() {
|
||||||
NamedValues.clear();
|
NamedValues.clear();
|
||||||
|
|
||||||
Function *TheFunction = Proto->Codegen();
|
Function *TheFunction = Proto->Codegen();
|
||||||
if (TheFunction == 0)
|
if (TheFunction == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// If this is an operator, install it.
|
// If this is an operator, install it.
|
||||||
if (Proto->isBinaryOp())
|
if (Proto->isBinaryOp())
|
||||||
BinopPrecedence[Proto->getOperatorName()] = Proto->getBinaryPrecedence();
|
BinopPrecedence[Proto->getOperatorName()] = Proto->getBinaryPrecedence();
|
||||||
|
|
||||||
// Create a new basic block to start insertion into.
|
// Create a new basic block to start insertion into.
|
||||||
BasicBlock *BB = BasicBlock::Create(getGlobalContext(), "entry", TheFunction);
|
BasicBlock *BB = BasicBlock::Create(getGlobalContext(), "entry", TheFunction);
|
||||||
Builder.SetInsertPoint(BB);
|
Builder.SetInsertPoint(BB);
|
||||||
|
|
||||||
// Add all arguments to the symbol table and create their allocas.
|
// Add all arguments to the symbol table and create their allocas.
|
||||||
Proto->CreateArgumentAllocas(TheFunction);
|
Proto->CreateArgumentAllocas(TheFunction);
|
||||||
|
|
||||||
@ -1238,7 +1238,7 @@ Function *FunctionAST::Codegen() {
|
|||||||
|
|
||||||
return TheFunction;
|
return TheFunction;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Error reading body, remove function.
|
// Error reading body, remove function.
|
||||||
TheFunction->eraseFromParent();
|
TheFunction->eraseFromParent();
|
||||||
|
|
||||||
@ -1285,7 +1285,7 @@ static void HandleTopLevelExpression() {
|
|||||||
if (Function *LF = F->Codegen()) {
|
if (Function *LF = F->Codegen()) {
|
||||||
// JIT the function, returning a function pointer.
|
// JIT the function, returning a function pointer.
|
||||||
void *FPtr = TheHelper->getPointerToFunction(LF);
|
void *FPtr = TheHelper->getPointerToFunction(LF);
|
||||||
|
|
||||||
// Cast it to the right type (takes no arguments, returns a double) so we
|
// Cast it to the right type (takes no arguments, returns a double) so we
|
||||||
// can call it as a native function.
|
// can call it as a native function.
|
||||||
double (*FP)() = (double (*)())(intptr_t)FPtr;
|
double (*FP)() = (double (*)())(intptr_t)FPtr;
|
||||||
@ -1322,20 +1322,20 @@ static void MainLoop() {
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
/// putchard - putchar that takes a double and returns 0.
|
/// putchard - putchar that takes a double and returns 0.
|
||||||
extern "C"
|
extern "C"
|
||||||
double putchard(double X) {
|
double putchard(double X) {
|
||||||
putchar((char)X);
|
putchar((char)X);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// printd - printf that takes a double prints it as "%f\n", returning 0.
|
/// printd - printf that takes a double prints it as "%f\n", returning 0.
|
||||||
extern "C"
|
extern "C"
|
||||||
double printd(double X) {
|
double printd(double X) {
|
||||||
printf("%f", X);
|
printf("%f", X);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
double printlf() {
|
double printlf() {
|
||||||
printf("\n");
|
printf("\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -34,14 +34,14 @@ enum Token {
|
|||||||
|
|
||||||
// primary
|
// primary
|
||||||
tok_identifier = -4, tok_number = -5,
|
tok_identifier = -4, tok_number = -5,
|
||||||
|
|
||||||
// control
|
// control
|
||||||
tok_if = -6, tok_then = -7, tok_else = -8,
|
tok_if = -6, tok_then = -7, tok_else = -8,
|
||||||
tok_for = -9, tok_in = -10,
|
tok_for = -9, tok_in = -10,
|
||||||
|
|
||||||
// operators
|
// operators
|
||||||
tok_binary = -11, tok_unary = -12,
|
tok_binary = -11, tok_unary = -12,
|
||||||
|
|
||||||
// var definition
|
// var definition
|
||||||
tok_var = -13
|
tok_var = -13
|
||||||
};
|
};
|
||||||
@ -90,11 +90,11 @@ static int gettok() {
|
|||||||
// Comment until end of line.
|
// Comment until end of line.
|
||||||
do LastChar = getchar();
|
do LastChar = getchar();
|
||||||
while (LastChar != EOF && LastChar != '\n' && LastChar != '\r');
|
while (LastChar != EOF && LastChar != '\n' && LastChar != '\r');
|
||||||
|
|
||||||
if (LastChar != EOF)
|
if (LastChar != EOF)
|
||||||
return gettok();
|
return gettok();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for end of file. Don't eat the EOF.
|
// Check for end of file. Don't eat the EOF.
|
||||||
if (LastChar == EOF)
|
if (LastChar == EOF)
|
||||||
return tok_eof;
|
return tok_eof;
|
||||||
@ -138,7 +138,7 @@ class UnaryExprAST : public ExprAST {
|
|||||||
char Opcode;
|
char Opcode;
|
||||||
ExprAST *Operand;
|
ExprAST *Operand;
|
||||||
public:
|
public:
|
||||||
UnaryExprAST(char opcode, ExprAST *operand)
|
UnaryExprAST(char opcode, ExprAST *operand)
|
||||||
: Opcode(opcode), Operand(operand) {}
|
: Opcode(opcode), Operand(operand) {}
|
||||||
virtual Value *Codegen();
|
virtual Value *Codegen();
|
||||||
};
|
};
|
||||||
@ -148,7 +148,7 @@ class BinaryExprAST : public ExprAST {
|
|||||||
char Op;
|
char Op;
|
||||||
ExprAST *LHS, *RHS;
|
ExprAST *LHS, *RHS;
|
||||||
public:
|
public:
|
||||||
BinaryExprAST(char op, ExprAST *lhs, ExprAST *rhs)
|
BinaryExprAST(char op, ExprAST *lhs, ExprAST *rhs)
|
||||||
: Op(op), LHS(lhs), RHS(rhs) {}
|
: Op(op), LHS(lhs), RHS(rhs) {}
|
||||||
virtual Value *Codegen();
|
virtual Value *Codegen();
|
||||||
};
|
};
|
||||||
@ -191,7 +191,7 @@ public:
|
|||||||
VarExprAST(const std::vector<std::pair<std::string, ExprAST*> > &varnames,
|
VarExprAST(const std::vector<std::pair<std::string, ExprAST*> > &varnames,
|
||||||
ExprAST *body)
|
ExprAST *body)
|
||||||
: VarNames(varnames), Body(body) {}
|
: VarNames(varnames), Body(body) {}
|
||||||
|
|
||||||
virtual Value *Codegen();
|
virtual Value *Codegen();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -206,19 +206,19 @@ public:
|
|||||||
PrototypeAST(const std::string &name, const std::vector<std::string> &args,
|
PrototypeAST(const std::string &name, const std::vector<std::string> &args,
|
||||||
bool isoperator = false, unsigned prec = 0)
|
bool isoperator = false, unsigned prec = 0)
|
||||||
: Name(name), Args(args), isOperator(isoperator), Precedence(prec) {}
|
: Name(name), Args(args), isOperator(isoperator), Precedence(prec) {}
|
||||||
|
|
||||||
bool isUnaryOp() const { return isOperator && Args.size() == 1; }
|
bool isUnaryOp() const { return isOperator && Args.size() == 1; }
|
||||||
bool isBinaryOp() const { return isOperator && Args.size() == 2; }
|
bool isBinaryOp() const { return isOperator && Args.size() == 2; }
|
||||||
|
|
||||||
char getOperatorName() const {
|
char getOperatorName() const {
|
||||||
assert(isUnaryOp() || isBinaryOp());
|
assert(isUnaryOp() || isBinaryOp());
|
||||||
return Name[Name.size()-1];
|
return Name[Name.size()-1];
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned getBinaryPrecedence() const { return Precedence; }
|
unsigned getBinaryPrecedence() const { return Precedence; }
|
||||||
|
|
||||||
Function *Codegen();
|
Function *Codegen();
|
||||||
|
|
||||||
void CreateArgumentAllocas(Function *F);
|
void CreateArgumentAllocas(Function *F);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -229,7 +229,7 @@ class FunctionAST {
|
|||||||
public:
|
public:
|
||||||
FunctionAST(PrototypeAST *proto, ExprAST *body)
|
FunctionAST(PrototypeAST *proto, ExprAST *body)
|
||||||
: Proto(proto), Body(body) {}
|
: Proto(proto), Body(body) {}
|
||||||
|
|
||||||
Function *Codegen();
|
Function *Codegen();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -253,7 +253,7 @@ static std::map<char, int> BinopPrecedence;
|
|||||||
static int GetTokPrecedence() {
|
static int GetTokPrecedence() {
|
||||||
if (!isascii(CurTok))
|
if (!isascii(CurTok))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
// Make sure it's a declared binop.
|
// Make sure it's a declared binop.
|
||||||
int TokPrec = BinopPrecedence[CurTok];
|
int TokPrec = BinopPrecedence[CurTok];
|
||||||
if (TokPrec <= 0) return -1;
|
if (TokPrec <= 0) return -1;
|
||||||
@ -272,12 +272,12 @@ static ExprAST *ParseExpression();
|
|||||||
/// ::= identifier '(' expression* ')'
|
/// ::= identifier '(' expression* ')'
|
||||||
static ExprAST *ParseIdentifierExpr() {
|
static ExprAST *ParseIdentifierExpr() {
|
||||||
std::string IdName = IdentifierStr;
|
std::string IdName = IdentifierStr;
|
||||||
|
|
||||||
getNextToken(); // eat identifier.
|
getNextToken(); // eat identifier.
|
||||||
|
|
||||||
if (CurTok != '(') // Simple variable ref.
|
if (CurTok != '(') // Simple variable ref.
|
||||||
return new VariableExprAST(IdName);
|
return new VariableExprAST(IdName);
|
||||||
|
|
||||||
// Call.
|
// Call.
|
||||||
getNextToken(); // eat (
|
getNextToken(); // eat (
|
||||||
std::vector<ExprAST*> Args;
|
std::vector<ExprAST*> Args;
|
||||||
@ -297,7 +297,7 @@ static ExprAST *ParseIdentifierExpr() {
|
|||||||
|
|
||||||
// Eat the ')'.
|
// Eat the ')'.
|
||||||
getNextToken();
|
getNextToken();
|
||||||
|
|
||||||
return new CallExprAST(IdName, Args);
|
return new CallExprAST(IdName, Args);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -313,7 +313,7 @@ static ExprAST *ParseParenExpr() {
|
|||||||
getNextToken(); // eat (.
|
getNextToken(); // eat (.
|
||||||
ExprAST *V = ParseExpression();
|
ExprAST *V = ParseExpression();
|
||||||
if (!V) return 0;
|
if (!V) return 0;
|
||||||
|
|
||||||
if (CurTok != ')')
|
if (CurTok != ')')
|
||||||
return Error("expected ')'");
|
return Error("expected ')'");
|
||||||
getNextToken(); // eat ).
|
getNextToken(); // eat ).
|
||||||
@ -323,26 +323,26 @@ static ExprAST *ParseParenExpr() {
|
|||||||
/// ifexpr ::= 'if' expression 'then' expression 'else' expression
|
/// ifexpr ::= 'if' expression 'then' expression 'else' expression
|
||||||
static ExprAST *ParseIfExpr() {
|
static ExprAST *ParseIfExpr() {
|
||||||
getNextToken(); // eat the if.
|
getNextToken(); // eat the if.
|
||||||
|
|
||||||
// condition.
|
// condition.
|
||||||
ExprAST *Cond = ParseExpression();
|
ExprAST *Cond = ParseExpression();
|
||||||
if (!Cond) return 0;
|
if (!Cond) return 0;
|
||||||
|
|
||||||
if (CurTok != tok_then)
|
if (CurTok != tok_then)
|
||||||
return Error("expected then");
|
return Error("expected then");
|
||||||
getNextToken(); // eat the then
|
getNextToken(); // eat the then
|
||||||
|
|
||||||
ExprAST *Then = ParseExpression();
|
ExprAST *Then = ParseExpression();
|
||||||
if (Then == 0) return 0;
|
if (Then == 0) return 0;
|
||||||
|
|
||||||
if (CurTok != tok_else)
|
if (CurTok != tok_else)
|
||||||
return Error("expected else");
|
return Error("expected else");
|
||||||
|
|
||||||
getNextToken();
|
getNextToken();
|
||||||
|
|
||||||
ExprAST *Else = ParseExpression();
|
ExprAST *Else = ParseExpression();
|
||||||
if (!Else) return 0;
|
if (!Else) return 0;
|
||||||
|
|
||||||
return new IfExprAST(Cond, Then, Else);
|
return new IfExprAST(Cond, Then, Else);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -352,24 +352,24 @@ static ExprAST *ParseForExpr() {
|
|||||||
|
|
||||||
if (CurTok != tok_identifier)
|
if (CurTok != tok_identifier)
|
||||||
return Error("expected identifier after for");
|
return Error("expected identifier after for");
|
||||||
|
|
||||||
std::string IdName = IdentifierStr;
|
std::string IdName = IdentifierStr;
|
||||||
getNextToken(); // eat identifier.
|
getNextToken(); // eat identifier.
|
||||||
|
|
||||||
if (CurTok != '=')
|
if (CurTok != '=')
|
||||||
return Error("expected '=' after for");
|
return Error("expected '=' after for");
|
||||||
getNextToken(); // eat '='.
|
getNextToken(); // eat '='.
|
||||||
|
|
||||||
|
|
||||||
ExprAST *Start = ParseExpression();
|
ExprAST *Start = ParseExpression();
|
||||||
if (Start == 0) return 0;
|
if (Start == 0) return 0;
|
||||||
if (CurTok != ',')
|
if (CurTok != ',')
|
||||||
return Error("expected ',' after for start value");
|
return Error("expected ',' after for start value");
|
||||||
getNextToken();
|
getNextToken();
|
||||||
|
|
||||||
ExprAST *End = ParseExpression();
|
ExprAST *End = ParseExpression();
|
||||||
if (End == 0) return 0;
|
if (End == 0) return 0;
|
||||||
|
|
||||||
// The step value is optional.
|
// The step value is optional.
|
||||||
ExprAST *Step = 0;
|
ExprAST *Step = 0;
|
||||||
if (CurTok == ',') {
|
if (CurTok == ',') {
|
||||||
@ -377,18 +377,18 @@ static ExprAST *ParseForExpr() {
|
|||||||
Step = ParseExpression();
|
Step = ParseExpression();
|
||||||
if (Step == 0) return 0;
|
if (Step == 0) return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CurTok != tok_in)
|
if (CurTok != tok_in)
|
||||||
return Error("expected 'in' after for");
|
return Error("expected 'in' after for");
|
||||||
getNextToken(); // eat 'in'.
|
getNextToken(); // eat 'in'.
|
||||||
|
|
||||||
ExprAST *Body = ParseExpression();
|
ExprAST *Body = ParseExpression();
|
||||||
if (Body == 0) return 0;
|
if (Body == 0) return 0;
|
||||||
|
|
||||||
return new ForExprAST(IdName, Start, End, Step, Body);
|
return new ForExprAST(IdName, Start, End, Step, Body);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// varexpr ::= 'var' identifier ('=' expression)?
|
/// varexpr ::= 'var' identifier ('=' expression)?
|
||||||
// (',' identifier ('=' expression)?)* 'in' expression
|
// (',' identifier ('=' expression)?)* 'in' expression
|
||||||
static ExprAST *ParseVarExpr() {
|
static ExprAST *ParseVarExpr() {
|
||||||
getNextToken(); // eat the var.
|
getNextToken(); // eat the var.
|
||||||
@ -398,7 +398,7 @@ static ExprAST *ParseVarExpr() {
|
|||||||
// At least one variable name is required.
|
// At least one variable name is required.
|
||||||
if (CurTok != tok_identifier)
|
if (CurTok != tok_identifier)
|
||||||
return Error("expected identifier after var");
|
return Error("expected identifier after var");
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
std::string Name = IdentifierStr;
|
std::string Name = IdentifierStr;
|
||||||
getNextToken(); // eat identifier.
|
getNextToken(); // eat identifier.
|
||||||
@ -407,29 +407,29 @@ static ExprAST *ParseVarExpr() {
|
|||||||
ExprAST *Init = 0;
|
ExprAST *Init = 0;
|
||||||
if (CurTok == '=') {
|
if (CurTok == '=') {
|
||||||
getNextToken(); // eat the '='.
|
getNextToken(); // eat the '='.
|
||||||
|
|
||||||
Init = ParseExpression();
|
Init = ParseExpression();
|
||||||
if (Init == 0) return 0;
|
if (Init == 0) return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
VarNames.push_back(std::make_pair(Name, Init));
|
VarNames.push_back(std::make_pair(Name, Init));
|
||||||
|
|
||||||
// End of var list, exit loop.
|
// End of var list, exit loop.
|
||||||
if (CurTok != ',') break;
|
if (CurTok != ',') break;
|
||||||
getNextToken(); // eat the ','.
|
getNextToken(); // eat the ','.
|
||||||
|
|
||||||
if (CurTok != tok_identifier)
|
if (CurTok != tok_identifier)
|
||||||
return Error("expected identifier list after var");
|
return Error("expected identifier list after var");
|
||||||
}
|
}
|
||||||
|
|
||||||
// At this point, we have to have 'in'.
|
// At this point, we have to have 'in'.
|
||||||
if (CurTok != tok_in)
|
if (CurTok != tok_in)
|
||||||
return Error("expected 'in' keyword after 'var'");
|
return Error("expected 'in' keyword after 'var'");
|
||||||
getNextToken(); // eat 'in'.
|
getNextToken(); // eat 'in'.
|
||||||
|
|
||||||
ExprAST *Body = ParseExpression();
|
ExprAST *Body = ParseExpression();
|
||||||
if (Body == 0) return 0;
|
if (Body == 0) return 0;
|
||||||
|
|
||||||
return new VarExprAST(VarNames, Body);
|
return new VarExprAST(VarNames, Body);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -459,7 +459,7 @@ static ExprAST *ParseUnary() {
|
|||||||
// If the current token is not an operator, it must be a primary expr.
|
// If the current token is not an operator, it must be a primary expr.
|
||||||
if (!isascii(CurTok) || CurTok == '(' || CurTok == ',')
|
if (!isascii(CurTok) || CurTok == '(' || CurTok == ',')
|
||||||
return ParsePrimary();
|
return ParsePrimary();
|
||||||
|
|
||||||
// If this is a unary operator, read it.
|
// If this is a unary operator, read it.
|
||||||
int Opc = CurTok;
|
int Opc = CurTok;
|
||||||
getNextToken();
|
getNextToken();
|
||||||
@ -474,20 +474,20 @@ static ExprAST *ParseBinOpRHS(int ExprPrec, ExprAST *LHS) {
|
|||||||
// If this is a binop, find its precedence.
|
// If this is a binop, find its precedence.
|
||||||
while (1) {
|
while (1) {
|
||||||
int TokPrec = GetTokPrecedence();
|
int TokPrec = GetTokPrecedence();
|
||||||
|
|
||||||
// If this is a binop that binds at least as tightly as the current binop,
|
// If this is a binop that binds at least as tightly as the current binop,
|
||||||
// consume it, otherwise we are done.
|
// consume it, otherwise we are done.
|
||||||
if (TokPrec < ExprPrec)
|
if (TokPrec < ExprPrec)
|
||||||
return LHS;
|
return LHS;
|
||||||
|
|
||||||
// Okay, we know this is a binop.
|
// Okay, we know this is a binop.
|
||||||
int BinOp = CurTok;
|
int BinOp = CurTok;
|
||||||
getNextToken(); // eat binop
|
getNextToken(); // eat binop
|
||||||
|
|
||||||
// Parse the unary expression after the binary operator.
|
// Parse the unary expression after the binary operator.
|
||||||
ExprAST *RHS = ParseUnary();
|
ExprAST *RHS = ParseUnary();
|
||||||
if (!RHS) return 0;
|
if (!RHS) return 0;
|
||||||
|
|
||||||
// If BinOp binds less tightly with RHS than the operator after RHS, let
|
// If BinOp binds less tightly with RHS than the operator after RHS, let
|
||||||
// the pending operator take RHS as its LHS.
|
// the pending operator take RHS as its LHS.
|
||||||
int NextPrec = GetTokPrecedence();
|
int NextPrec = GetTokPrecedence();
|
||||||
@ -495,7 +495,7 @@ static ExprAST *ParseBinOpRHS(int ExprPrec, ExprAST *LHS) {
|
|||||||
RHS = ParseBinOpRHS(TokPrec+1, RHS);
|
RHS = ParseBinOpRHS(TokPrec+1, RHS);
|
||||||
if (RHS == 0) return 0;
|
if (RHS == 0) return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Merge LHS/RHS.
|
// Merge LHS/RHS.
|
||||||
LHS = new BinaryExprAST(BinOp, LHS, RHS);
|
LHS = new BinaryExprAST(BinOp, LHS, RHS);
|
||||||
}
|
}
|
||||||
@ -507,7 +507,7 @@ static ExprAST *ParseBinOpRHS(int ExprPrec, ExprAST *LHS) {
|
|||||||
static ExprAST *ParseExpression() {
|
static ExprAST *ParseExpression() {
|
||||||
ExprAST *LHS = ParseUnary();
|
ExprAST *LHS = ParseUnary();
|
||||||
if (!LHS) return 0;
|
if (!LHS) return 0;
|
||||||
|
|
||||||
return ParseBinOpRHS(0, LHS);
|
return ParseBinOpRHS(0, LHS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -517,10 +517,10 @@ static ExprAST *ParseExpression() {
|
|||||||
/// ::= unary LETTER (id)
|
/// ::= unary LETTER (id)
|
||||||
static PrototypeAST *ParsePrototype() {
|
static PrototypeAST *ParsePrototype() {
|
||||||
std::string FnName;
|
std::string FnName;
|
||||||
|
|
||||||
unsigned Kind = 0; // 0 = identifier, 1 = unary, 2 = binary.
|
unsigned Kind = 0; // 0 = identifier, 1 = unary, 2 = binary.
|
||||||
unsigned BinaryPrecedence = 30;
|
unsigned BinaryPrecedence = 30;
|
||||||
|
|
||||||
switch (CurTok) {
|
switch (CurTok) {
|
||||||
default:
|
default:
|
||||||
return ErrorP("Expected function name in prototype");
|
return ErrorP("Expected function name in prototype");
|
||||||
@ -546,7 +546,7 @@ static PrototypeAST *ParsePrototype() {
|
|||||||
FnName += (char)CurTok;
|
FnName += (char)CurTok;
|
||||||
Kind = 2;
|
Kind = 2;
|
||||||
getNextToken();
|
getNextToken();
|
||||||
|
|
||||||
// Read the precedence if present.
|
// Read the precedence if present.
|
||||||
if (CurTok == tok_number) {
|
if (CurTok == tok_number) {
|
||||||
if (NumVal < 1 || NumVal > 100)
|
if (NumVal < 1 || NumVal > 100)
|
||||||
@ -556,23 +556,23 @@ static PrototypeAST *ParsePrototype() {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CurTok != '(')
|
if (CurTok != '(')
|
||||||
return ErrorP("Expected '(' in prototype");
|
return ErrorP("Expected '(' in prototype");
|
||||||
|
|
||||||
std::vector<std::string> ArgNames;
|
std::vector<std::string> ArgNames;
|
||||||
while (getNextToken() == tok_identifier)
|
while (getNextToken() == tok_identifier)
|
||||||
ArgNames.push_back(IdentifierStr);
|
ArgNames.push_back(IdentifierStr);
|
||||||
if (CurTok != ')')
|
if (CurTok != ')')
|
||||||
return ErrorP("Expected ')' in prototype");
|
return ErrorP("Expected ')' in prototype");
|
||||||
|
|
||||||
// success.
|
// success.
|
||||||
getNextToken(); // eat ')'.
|
getNextToken(); // eat ')'.
|
||||||
|
|
||||||
// Verify right number of names for operator.
|
// Verify right number of names for operator.
|
||||||
if (Kind && ArgNames.size() != Kind)
|
if (Kind && ArgNames.size() != Kind)
|
||||||
return ErrorP("Invalid number of operands for operator");
|
return ErrorP("Invalid number of operands for operator");
|
||||||
|
|
||||||
return new PrototypeAST(FnName, ArgNames, Kind != 0, BinaryPrecedence);
|
return new PrototypeAST(FnName, ArgNames, Kind != 0, BinaryPrecedence);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -673,14 +673,14 @@ private:
|
|||||||
|
|
||||||
class HelpingMemoryManager : public SectionMemoryManager
|
class HelpingMemoryManager : public SectionMemoryManager
|
||||||
{
|
{
|
||||||
HelpingMemoryManager(const HelpingMemoryManager&) LLVM_DELETED_FUNCTION;
|
HelpingMemoryManager(const HelpingMemoryManager&) = delete;
|
||||||
void operator=(const HelpingMemoryManager&) LLVM_DELETED_FUNCTION;
|
void operator=(const HelpingMemoryManager&) = delete;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
HelpingMemoryManager(MCJITHelper *Helper) : MasterHelper(Helper) {}
|
HelpingMemoryManager(MCJITHelper *Helper) : MasterHelper(Helper) {}
|
||||||
virtual ~HelpingMemoryManager() {}
|
virtual ~HelpingMemoryManager() {}
|
||||||
|
|
||||||
/// This method returns the address of the specified function.
|
/// This method returns the address of the specified function.
|
||||||
/// Our implementation will attempt to find functions in other
|
/// Our implementation will attempt to find functions in other
|
||||||
/// modules associated with the MCJITHelper to cross link functions
|
/// modules associated with the MCJITHelper to cross link functions
|
||||||
/// from one generated module to another.
|
/// from one generated module to another.
|
||||||
@ -749,9 +749,9 @@ Function *MCJITHelper::getFunction(const std::string FnName) {
|
|||||||
|
|
||||||
// If we don't have a prototype yet, create one.
|
// If we don't have a prototype yet, create one.
|
||||||
if (!PF)
|
if (!PF)
|
||||||
PF = Function::Create(F->getFunctionType(),
|
PF = Function::Create(F->getFunctionType(),
|
||||||
Function::ExternalLinkage,
|
Function::ExternalLinkage,
|
||||||
FnName,
|
FnName,
|
||||||
OpenModule);
|
OpenModule);
|
||||||
return PF;
|
return PF;
|
||||||
}
|
}
|
||||||
@ -925,11 +925,11 @@ Value *VariableExprAST::Codegen() {
|
|||||||
Value *UnaryExprAST::Codegen() {
|
Value *UnaryExprAST::Codegen() {
|
||||||
Value *OperandV = Operand->Codegen();
|
Value *OperandV = Operand->Codegen();
|
||||||
if (OperandV == 0) return 0;
|
if (OperandV == 0) return 0;
|
||||||
|
|
||||||
Function *F = TheHelper->getFunction(MakeLegalFunctionName(std::string("unary")+Opcode));
|
Function *F = TheHelper->getFunction(MakeLegalFunctionName(std::string("unary")+Opcode));
|
||||||
if (F == 0)
|
if (F == 0)
|
||||||
return ErrorV("Unknown unary operator");
|
return ErrorV("Unknown unary operator");
|
||||||
|
|
||||||
return Builder.CreateCall(F, OperandV, "unop");
|
return Builder.CreateCall(F, OperandV, "unop");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -951,11 +951,11 @@ Value *BinaryExprAST::Codegen() {
|
|||||||
Builder.CreateStore(Val, Variable);
|
Builder.CreateStore(Val, Variable);
|
||||||
return Val;
|
return Val;
|
||||||
}
|
}
|
||||||
|
|
||||||
Value *L = LHS->Codegen();
|
Value *L = LHS->Codegen();
|
||||||
Value *R = RHS->Codegen();
|
Value *R = RHS->Codegen();
|
||||||
if (L == 0 || R == 0) return 0;
|
if (L == 0 || R == 0) return 0;
|
||||||
|
|
||||||
switch (Op) {
|
switch (Op) {
|
||||||
case '+': return Builder.CreateFAdd(L, R, "addtmp");
|
case '+': return Builder.CreateFAdd(L, R, "addtmp");
|
||||||
case '-': return Builder.CreateFSub(L, R, "subtmp");
|
case '-': return Builder.CreateFSub(L, R, "subtmp");
|
||||||
@ -968,12 +968,12 @@ Value *BinaryExprAST::Codegen() {
|
|||||||
"booltmp");
|
"booltmp");
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If it wasn't a builtin binary operator, it must be a user defined one. Emit
|
// If it wasn't a builtin binary operator, it must be a user defined one. Emit
|
||||||
// a call to it.
|
// a call to it.
|
||||||
Function *F = TheHelper->getFunction(MakeLegalFunctionName(std::string("binary")+Op));
|
Function *F = TheHelper->getFunction(MakeLegalFunctionName(std::string("binary")+Op));
|
||||||
assert(F && "binary operator not found!");
|
assert(F && "binary operator not found!");
|
||||||
|
|
||||||
Value *Ops[] = { L, R };
|
Value *Ops[] = { L, R };
|
||||||
return Builder.CreateCall(F, Ops, "binop");
|
return Builder.CreateCall(F, Ops, "binop");
|
||||||
}
|
}
|
||||||
@ -983,7 +983,7 @@ Value *CallExprAST::Codegen() {
|
|||||||
Function *CalleeF = TheHelper->getFunction(Callee);
|
Function *CalleeF = TheHelper->getFunction(Callee);
|
||||||
if (CalleeF == 0)
|
if (CalleeF == 0)
|
||||||
return ErrorV("Unknown function referenced");
|
return ErrorV("Unknown function referenced");
|
||||||
|
|
||||||
// If argument mismatch error.
|
// If argument mismatch error.
|
||||||
if (CalleeF->arg_size() != Args.size())
|
if (CalleeF->arg_size() != Args.size())
|
||||||
return ErrorV("Incorrect # arguments passed");
|
return ErrorV("Incorrect # arguments passed");
|
||||||
@ -993,56 +993,56 @@ Value *CallExprAST::Codegen() {
|
|||||||
ArgsV.push_back(Args[i]->Codegen());
|
ArgsV.push_back(Args[i]->Codegen());
|
||||||
if (ArgsV.back() == 0) return 0;
|
if (ArgsV.back() == 0) return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Builder.CreateCall(CalleeF, ArgsV, "calltmp");
|
return Builder.CreateCall(CalleeF, ArgsV, "calltmp");
|
||||||
}
|
}
|
||||||
|
|
||||||
Value *IfExprAST::Codegen() {
|
Value *IfExprAST::Codegen() {
|
||||||
Value *CondV = Cond->Codegen();
|
Value *CondV = Cond->Codegen();
|
||||||
if (CondV == 0) return 0;
|
if (CondV == 0) return 0;
|
||||||
|
|
||||||
// Convert condition to a bool by comparing equal to 0.0.
|
// Convert condition to a bool by comparing equal to 0.0.
|
||||||
CondV = Builder.CreateFCmpONE(CondV,
|
CondV = Builder.CreateFCmpONE(CondV,
|
||||||
ConstantFP::get(getGlobalContext(), APFloat(0.0)),
|
ConstantFP::get(getGlobalContext(), APFloat(0.0)),
|
||||||
"ifcond");
|
"ifcond");
|
||||||
|
|
||||||
Function *TheFunction = Builder.GetInsertBlock()->getParent();
|
Function *TheFunction = Builder.GetInsertBlock()->getParent();
|
||||||
|
|
||||||
// Create blocks for the then and else cases. Insert the 'then' block at the
|
// Create blocks for the then and else cases. Insert the 'then' block at the
|
||||||
// end of the function.
|
// end of the function.
|
||||||
BasicBlock *ThenBB = BasicBlock::Create(getGlobalContext(), "then", TheFunction);
|
BasicBlock *ThenBB = BasicBlock::Create(getGlobalContext(), "then", TheFunction);
|
||||||
BasicBlock *ElseBB = BasicBlock::Create(getGlobalContext(), "else");
|
BasicBlock *ElseBB = BasicBlock::Create(getGlobalContext(), "else");
|
||||||
BasicBlock *MergeBB = BasicBlock::Create(getGlobalContext(), "ifcont");
|
BasicBlock *MergeBB = BasicBlock::Create(getGlobalContext(), "ifcont");
|
||||||
|
|
||||||
Builder.CreateCondBr(CondV, ThenBB, ElseBB);
|
Builder.CreateCondBr(CondV, ThenBB, ElseBB);
|
||||||
|
|
||||||
// Emit then value.
|
// Emit then value.
|
||||||
Builder.SetInsertPoint(ThenBB);
|
Builder.SetInsertPoint(ThenBB);
|
||||||
|
|
||||||
Value *ThenV = Then->Codegen();
|
Value *ThenV = Then->Codegen();
|
||||||
if (ThenV == 0) return 0;
|
if (ThenV == 0) return 0;
|
||||||
|
|
||||||
Builder.CreateBr(MergeBB);
|
Builder.CreateBr(MergeBB);
|
||||||
// Codegen of 'Then' can change the current block, update ThenBB for the PHI.
|
// Codegen of 'Then' can change the current block, update ThenBB for the PHI.
|
||||||
ThenBB = Builder.GetInsertBlock();
|
ThenBB = Builder.GetInsertBlock();
|
||||||
|
|
||||||
// Emit else block.
|
// Emit else block.
|
||||||
TheFunction->getBasicBlockList().push_back(ElseBB);
|
TheFunction->getBasicBlockList().push_back(ElseBB);
|
||||||
Builder.SetInsertPoint(ElseBB);
|
Builder.SetInsertPoint(ElseBB);
|
||||||
|
|
||||||
Value *ElseV = Else->Codegen();
|
Value *ElseV = Else->Codegen();
|
||||||
if (ElseV == 0) return 0;
|
if (ElseV == 0) return 0;
|
||||||
|
|
||||||
Builder.CreateBr(MergeBB);
|
Builder.CreateBr(MergeBB);
|
||||||
// Codegen of 'Else' can change the current block, update ElseBB for the PHI.
|
// Codegen of 'Else' can change the current block, update ElseBB for the PHI.
|
||||||
ElseBB = Builder.GetInsertBlock();
|
ElseBB = Builder.GetInsertBlock();
|
||||||
|
|
||||||
// Emit merge block.
|
// Emit merge block.
|
||||||
TheFunction->getBasicBlockList().push_back(MergeBB);
|
TheFunction->getBasicBlockList().push_back(MergeBB);
|
||||||
Builder.SetInsertPoint(MergeBB);
|
Builder.SetInsertPoint(MergeBB);
|
||||||
PHINode *PN = Builder.CreatePHI(Type::getDoubleTy(getGlobalContext()), 2,
|
PHINode *PN = Builder.CreatePHI(Type::getDoubleTy(getGlobalContext()), 2,
|
||||||
"iftmp");
|
"iftmp");
|
||||||
|
|
||||||
PN->addIncoming(ThenV, ThenBB);
|
PN->addIncoming(ThenV, ThenBB);
|
||||||
PN->addIncoming(ElseV, ElseBB);
|
PN->addIncoming(ElseV, ElseBB);
|
||||||
return PN;
|
return PN;
|
||||||
@ -1055,7 +1055,7 @@ Value *ForExprAST::Codegen() {
|
|||||||
// start = startexpr
|
// start = startexpr
|
||||||
// store start -> var
|
// store start -> var
|
||||||
// goto loop
|
// goto loop
|
||||||
// loop:
|
// loop:
|
||||||
// ...
|
// ...
|
||||||
// bodyexpr
|
// bodyexpr
|
||||||
// ...
|
// ...
|
||||||
@ -1068,40 +1068,40 @@ Value *ForExprAST::Codegen() {
|
|||||||
// store nextvar -> var
|
// store nextvar -> var
|
||||||
// br endcond, loop, endloop
|
// br endcond, loop, endloop
|
||||||
// outloop:
|
// outloop:
|
||||||
|
|
||||||
Function *TheFunction = Builder.GetInsertBlock()->getParent();
|
Function *TheFunction = Builder.GetInsertBlock()->getParent();
|
||||||
|
|
||||||
// Create an alloca for the variable in the entry block.
|
// Create an alloca for the variable in the entry block.
|
||||||
AllocaInst *Alloca = CreateEntryBlockAlloca(TheFunction, VarName);
|
AllocaInst *Alloca = CreateEntryBlockAlloca(TheFunction, VarName);
|
||||||
|
|
||||||
// Emit the start code first, without 'variable' in scope.
|
// Emit the start code first, without 'variable' in scope.
|
||||||
Value *StartVal = Start->Codegen();
|
Value *StartVal = Start->Codegen();
|
||||||
if (StartVal == 0) return 0;
|
if (StartVal == 0) return 0;
|
||||||
|
|
||||||
// Store the value into the alloca.
|
// Store the value into the alloca.
|
||||||
Builder.CreateStore(StartVal, Alloca);
|
Builder.CreateStore(StartVal, Alloca);
|
||||||
|
|
||||||
// Make the new basic block for the loop header, inserting after current
|
// Make the new basic block for the loop header, inserting after current
|
||||||
// block.
|
// block.
|
||||||
BasicBlock *LoopBB = BasicBlock::Create(getGlobalContext(), "loop", TheFunction);
|
BasicBlock *LoopBB = BasicBlock::Create(getGlobalContext(), "loop", TheFunction);
|
||||||
|
|
||||||
// Insert an explicit fall through from the current block to the LoopBB.
|
// Insert an explicit fall through from the current block to the LoopBB.
|
||||||
Builder.CreateBr(LoopBB);
|
Builder.CreateBr(LoopBB);
|
||||||
|
|
||||||
// Start insertion in LoopBB.
|
// Start insertion in LoopBB.
|
||||||
Builder.SetInsertPoint(LoopBB);
|
Builder.SetInsertPoint(LoopBB);
|
||||||
|
|
||||||
// Within the loop, the variable is defined equal to the PHI node. If it
|
// Within the loop, the variable is defined equal to the PHI node. If it
|
||||||
// shadows an existing variable, we have to restore it, so save it now.
|
// shadows an existing variable, we have to restore it, so save it now.
|
||||||
AllocaInst *OldVal = NamedValues[VarName];
|
AllocaInst *OldVal = NamedValues[VarName];
|
||||||
NamedValues[VarName] = Alloca;
|
NamedValues[VarName] = Alloca;
|
||||||
|
|
||||||
// Emit the body of the loop. This, like any other expr, can change the
|
// Emit the body of the loop. This, like any other expr, can change the
|
||||||
// current BB. Note that we ignore the value computed by the body, but don't
|
// current BB. Note that we ignore the value computed by the body, but don't
|
||||||
// allow an error.
|
// allow an error.
|
||||||
if (Body->Codegen() == 0)
|
if (Body->Codegen() == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// Emit the step value.
|
// Emit the step value.
|
||||||
Value *StepVal;
|
Value *StepVal;
|
||||||
if (Step) {
|
if (Step) {
|
||||||
@ -1111,52 +1111,52 @@ Value *ForExprAST::Codegen() {
|
|||||||
// If not specified, use 1.0.
|
// If not specified, use 1.0.
|
||||||
StepVal = ConstantFP::get(getGlobalContext(), APFloat(1.0));
|
StepVal = ConstantFP::get(getGlobalContext(), APFloat(1.0));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compute the end condition.
|
// Compute the end condition.
|
||||||
Value *EndCond = End->Codegen();
|
Value *EndCond = End->Codegen();
|
||||||
if (EndCond == 0) return EndCond;
|
if (EndCond == 0) return EndCond;
|
||||||
|
|
||||||
// Reload, increment, and restore the alloca. This handles the case where
|
// Reload, increment, and restore the alloca. This handles the case where
|
||||||
// the body of the loop mutates the variable.
|
// the body of the loop mutates the variable.
|
||||||
Value *CurVar = Builder.CreateLoad(Alloca, VarName.c_str());
|
Value *CurVar = Builder.CreateLoad(Alloca, VarName.c_str());
|
||||||
Value *NextVar = Builder.CreateFAdd(CurVar, StepVal, "nextvar");
|
Value *NextVar = Builder.CreateFAdd(CurVar, StepVal, "nextvar");
|
||||||
Builder.CreateStore(NextVar, Alloca);
|
Builder.CreateStore(NextVar, Alloca);
|
||||||
|
|
||||||
// Convert condition to a bool by comparing equal to 0.0.
|
// Convert condition to a bool by comparing equal to 0.0.
|
||||||
EndCond = Builder.CreateFCmpONE(EndCond,
|
EndCond = Builder.CreateFCmpONE(EndCond,
|
||||||
ConstantFP::get(getGlobalContext(), APFloat(0.0)),
|
ConstantFP::get(getGlobalContext(), APFloat(0.0)),
|
||||||
"loopcond");
|
"loopcond");
|
||||||
|
|
||||||
// Create the "after loop" block and insert it.
|
// Create the "after loop" block and insert it.
|
||||||
BasicBlock *AfterBB = BasicBlock::Create(getGlobalContext(), "afterloop", TheFunction);
|
BasicBlock *AfterBB = BasicBlock::Create(getGlobalContext(), "afterloop", TheFunction);
|
||||||
|
|
||||||
// Insert the conditional branch into the end of LoopEndBB.
|
// Insert the conditional branch into the end of LoopEndBB.
|
||||||
Builder.CreateCondBr(EndCond, LoopBB, AfterBB);
|
Builder.CreateCondBr(EndCond, LoopBB, AfterBB);
|
||||||
|
|
||||||
// Any new code will be inserted in AfterBB.
|
// Any new code will be inserted in AfterBB.
|
||||||
Builder.SetInsertPoint(AfterBB);
|
Builder.SetInsertPoint(AfterBB);
|
||||||
|
|
||||||
// Restore the unshadowed variable.
|
// Restore the unshadowed variable.
|
||||||
if (OldVal)
|
if (OldVal)
|
||||||
NamedValues[VarName] = OldVal;
|
NamedValues[VarName] = OldVal;
|
||||||
else
|
else
|
||||||
NamedValues.erase(VarName);
|
NamedValues.erase(VarName);
|
||||||
|
|
||||||
|
|
||||||
// for expr always returns 0.0.
|
// for expr always returns 0.0.
|
||||||
return Constant::getNullValue(Type::getDoubleTy(getGlobalContext()));
|
return Constant::getNullValue(Type::getDoubleTy(getGlobalContext()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Value *VarExprAST::Codegen() {
|
Value *VarExprAST::Codegen() {
|
||||||
std::vector<AllocaInst *> OldBindings;
|
std::vector<AllocaInst *> OldBindings;
|
||||||
|
|
||||||
Function *TheFunction = Builder.GetInsertBlock()->getParent();
|
Function *TheFunction = Builder.GetInsertBlock()->getParent();
|
||||||
|
|
||||||
// Register all variables and emit their initializer.
|
// Register all variables and emit their initializer.
|
||||||
for (unsigned i = 0, e = VarNames.size(); i != e; ++i) {
|
for (unsigned i = 0, e = VarNames.size(); i != e; ++i) {
|
||||||
const std::string &VarName = VarNames[i].first;
|
const std::string &VarName = VarNames[i].first;
|
||||||
ExprAST *Init = VarNames[i].second;
|
ExprAST *Init = VarNames[i].second;
|
||||||
|
|
||||||
// Emit the initializer before adding the variable to scope, this prevents
|
// Emit the initializer before adding the variable to scope, this prevents
|
||||||
// the initializer from referencing the variable itself, and permits stuff
|
// the initializer from referencing the variable itself, and permits stuff
|
||||||
// like this:
|
// like this:
|
||||||
@ -1169,22 +1169,22 @@ Value *VarExprAST::Codegen() {
|
|||||||
} else { // If not specified, use 0.0.
|
} else { // If not specified, use 0.0.
|
||||||
InitVal = ConstantFP::get(getGlobalContext(), APFloat(0.0));
|
InitVal = ConstantFP::get(getGlobalContext(), APFloat(0.0));
|
||||||
}
|
}
|
||||||
|
|
||||||
AllocaInst *Alloca = CreateEntryBlockAlloca(TheFunction, VarName);
|
AllocaInst *Alloca = CreateEntryBlockAlloca(TheFunction, VarName);
|
||||||
Builder.CreateStore(InitVal, Alloca);
|
Builder.CreateStore(InitVal, Alloca);
|
||||||
|
|
||||||
// Remember the old variable binding so that we can restore the binding when
|
// Remember the old variable binding so that we can restore the binding when
|
||||||
// we unrecurse.
|
// we unrecurse.
|
||||||
OldBindings.push_back(NamedValues[VarName]);
|
OldBindings.push_back(NamedValues[VarName]);
|
||||||
|
|
||||||
// Remember this binding.
|
// Remember this binding.
|
||||||
NamedValues[VarName] = Alloca;
|
NamedValues[VarName] = Alloca;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Codegen the body, now that all vars are in scope.
|
// Codegen the body, now that all vars are in scope.
|
||||||
Value *BodyVal = Body->Codegen();
|
Value *BodyVal = Body->Codegen();
|
||||||
if (BodyVal == 0) return 0;
|
if (BodyVal == 0) return 0;
|
||||||
|
|
||||||
// Pop all our variables from scope.
|
// Pop all our variables from scope.
|
||||||
for (unsigned i = 0, e = VarNames.size(); i != e; ++i)
|
for (unsigned i = 0, e = VarNames.size(); i != e; ++i)
|
||||||
NamedValues[VarNames[i].first] = OldBindings[i];
|
NamedValues[VarNames[i].first] = OldBindings[i];
|
||||||
@ -1195,7 +1195,7 @@ Value *VarExprAST::Codegen() {
|
|||||||
|
|
||||||
Function *PrototypeAST::Codegen() {
|
Function *PrototypeAST::Codegen() {
|
||||||
// Make the function type: double(double,double) etc.
|
// Make the function type: double(double,double) etc.
|
||||||
std::vector<Type*> Doubles(Args.size(),
|
std::vector<Type*> Doubles(Args.size(),
|
||||||
Type::getDoubleTy(getGlobalContext()));
|
Type::getDoubleTy(getGlobalContext()));
|
||||||
FunctionType *FT = FunctionType::get(Type::getDoubleTy(getGlobalContext()),
|
FunctionType *FT = FunctionType::get(Type::getDoubleTy(getGlobalContext()),
|
||||||
Doubles, false);
|
Doubles, false);
|
||||||
@ -1212,26 +1212,26 @@ Function *PrototypeAST::Codegen() {
|
|||||||
// Delete the one we just made and get the existing one.
|
// Delete the one we just made and get the existing one.
|
||||||
F->eraseFromParent();
|
F->eraseFromParent();
|
||||||
F = M->getFunction(Name);
|
F = M->getFunction(Name);
|
||||||
|
|
||||||
// If F already has a body, reject this.
|
// If F already has a body, reject this.
|
||||||
if (!F->empty()) {
|
if (!F->empty()) {
|
||||||
ErrorF("redefinition of function");
|
ErrorF("redefinition of function");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// If F took a different number of args, reject.
|
// If F took a different number of args, reject.
|
||||||
if (F->arg_size() != Args.size()) {
|
if (F->arg_size() != Args.size()) {
|
||||||
ErrorF("redefinition of function with different # args");
|
ErrorF("redefinition of function with different # args");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set names for all arguments.
|
// Set names for all arguments.
|
||||||
unsigned Idx = 0;
|
unsigned Idx = 0;
|
||||||
for (Function::arg_iterator AI = F->arg_begin(); Idx != Args.size();
|
for (Function::arg_iterator AI = F->arg_begin(); Idx != Args.size();
|
||||||
++AI, ++Idx)
|
++AI, ++Idx)
|
||||||
AI->setName(Args[Idx]);
|
AI->setName(Args[Idx]);
|
||||||
|
|
||||||
return F;
|
return F;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1253,19 +1253,19 @@ void PrototypeAST::CreateArgumentAllocas(Function *F) {
|
|||||||
|
|
||||||
Function *FunctionAST::Codegen() {
|
Function *FunctionAST::Codegen() {
|
||||||
NamedValues.clear();
|
NamedValues.clear();
|
||||||
|
|
||||||
Function *TheFunction = Proto->Codegen();
|
Function *TheFunction = Proto->Codegen();
|
||||||
if (TheFunction == 0)
|
if (TheFunction == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// If this is an operator, install it.
|
// If this is an operator, install it.
|
||||||
if (Proto->isBinaryOp())
|
if (Proto->isBinaryOp())
|
||||||
BinopPrecedence[Proto->getOperatorName()] = Proto->getBinaryPrecedence();
|
BinopPrecedence[Proto->getOperatorName()] = Proto->getBinaryPrecedence();
|
||||||
|
|
||||||
// Create a new basic block to start insertion into.
|
// Create a new basic block to start insertion into.
|
||||||
BasicBlock *BB = BasicBlock::Create(getGlobalContext(), "entry", TheFunction);
|
BasicBlock *BB = BasicBlock::Create(getGlobalContext(), "entry", TheFunction);
|
||||||
Builder.SetInsertPoint(BB);
|
Builder.SetInsertPoint(BB);
|
||||||
|
|
||||||
// Add all arguments to the symbol table and create their allocas.
|
// Add all arguments to the symbol table and create their allocas.
|
||||||
Proto->CreateArgumentAllocas(TheFunction);
|
Proto->CreateArgumentAllocas(TheFunction);
|
||||||
|
|
||||||
@ -1326,7 +1326,7 @@ static void HandleTopLevelExpression() {
|
|||||||
if (Function *LF = F->Codegen()) {
|
if (Function *LF = F->Codegen()) {
|
||||||
// JIT the function, returning a function pointer.
|
// JIT the function, returning a function pointer.
|
||||||
void *FPtr = TheHelper->getPointerToFunction(LF);
|
void *FPtr = TheHelper->getPointerToFunction(LF);
|
||||||
|
|
||||||
// Cast it to the right type (takes no arguments, returns a double) so we
|
// Cast it to the right type (takes no arguments, returns a double) so we
|
||||||
// can call it as a native function.
|
// can call it as a native function.
|
||||||
double (*FP)() = (double (*)())(intptr_t)FPtr;
|
double (*FP)() = (double (*)())(intptr_t)FPtr;
|
||||||
@ -1363,20 +1363,20 @@ static void MainLoop() {
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
/// putchard - putchar that takes a double and returns 0.
|
/// putchard - putchar that takes a double and returns 0.
|
||||||
extern "C"
|
extern "C"
|
||||||
double putchard(double X) {
|
double putchard(double X) {
|
||||||
putchar((char)X);
|
putchar((char)X);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// printd - printf that takes a double prints it as "%f\n", returning 0.
|
/// printd - printf that takes a double prints it as "%f\n", returning 0.
|
||||||
extern "C"
|
extern "C"
|
||||||
double printd(double X) {
|
double printd(double X) {
|
||||||
printf("%f", X);
|
printf("%f", X);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
double printlf() {
|
double printlf() {
|
||||||
printf("\n");
|
printf("\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -376,7 +376,7 @@ public:
|
|||||||
/// The definition of equality is not straightforward for floating point, so
|
/// The definition of equality is not straightforward for floating point, so
|
||||||
/// we won't use operator==. Use one of the following, or write whatever it
|
/// we won't use operator==. Use one of the following, or write whatever it
|
||||||
/// is you really mean.
|
/// is you really mean.
|
||||||
bool operator==(const APFloat &) const LLVM_DELETED_FUNCTION;
|
bool operator==(const APFloat &) const = delete;
|
||||||
|
|
||||||
/// IEEE comparison with another floating point number (NaNs compare
|
/// IEEE comparison with another floating point number (NaNs compare
|
||||||
/// unordered, 0==-0).
|
/// unordered, 0==-0).
|
||||||
|
@ -33,8 +33,8 @@ class ImmutableListImpl : public FoldingSetNode {
|
|||||||
|
|
||||||
friend class ImmutableListFactory<T>;
|
friend class ImmutableListFactory<T>;
|
||||||
|
|
||||||
void operator=(const ImmutableListImpl&) LLVM_DELETED_FUNCTION;
|
void operator=(const ImmutableListImpl&) = delete;
|
||||||
ImmutableListImpl(const ImmutableListImpl&) LLVM_DELETED_FUNCTION;
|
ImmutableListImpl(const ImmutableListImpl&) = delete;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
const T& getHead() const { return Head; }
|
const T& getHead() const { return Head; }
|
||||||
|
@ -122,8 +122,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Factory(const Factory& RHS) LLVM_DELETED_FUNCTION;
|
Factory(const Factory& RHS) = delete;
|
||||||
void operator=(const Factory& RHS) LLVM_DELETED_FUNCTION;
|
void operator=(const Factory& RHS) = delete;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool contains(key_type_ref K) const {
|
bool contains(key_type_ref K) const {
|
||||||
|
@ -1014,8 +1014,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Factory(const Factory& RHS) LLVM_DELETED_FUNCTION;
|
Factory(const Factory& RHS) = delete;
|
||||||
void operator=(const Factory& RHS) LLVM_DELETED_FUNCTION;
|
void operator=(const Factory& RHS) = delete;
|
||||||
};
|
};
|
||||||
|
|
||||||
friend class Factory;
|
friend class Factory;
|
||||||
|
@ -340,7 +340,7 @@ make_unique(size_t n) {
|
|||||||
/// This function isn't used and is only here to provide better compile errors.
|
/// This function isn't used and is only here to provide better compile errors.
|
||||||
template <class T, class... Args>
|
template <class T, class... Args>
|
||||||
typename std::enable_if<std::extent<T>::value != 0>::type
|
typename std::enable_if<std::extent<T>::value != 0>::type
|
||||||
make_unique(Args &&...) LLVM_DELETED_FUNCTION;
|
make_unique(Args &&...) = delete;
|
||||||
|
|
||||||
struct FreeDeleter {
|
struct FreeDeleter {
|
||||||
void operator()(void* v) {
|
void operator()(void* v) {
|
||||||
|
@ -90,8 +90,8 @@ class ScopedHashTableScope {
|
|||||||
/// LastValInScope - This is the last value that was inserted for this scope
|
/// LastValInScope - This is the last value that was inserted for this scope
|
||||||
/// or null if none have been inserted yet.
|
/// or null if none have been inserted yet.
|
||||||
ScopedHashTableVal<K, V> *LastValInScope;
|
ScopedHashTableVal<K, V> *LastValInScope;
|
||||||
void operator=(ScopedHashTableScope&) LLVM_DELETED_FUNCTION;
|
void operator=(ScopedHashTableScope&) = delete;
|
||||||
ScopedHashTableScope(ScopedHashTableScope&) LLVM_DELETED_FUNCTION;
|
ScopedHashTableScope(ScopedHashTableScope&) = delete;
|
||||||
public:
|
public:
|
||||||
ScopedHashTableScope(ScopedHashTable<K, V, KInfo, AllocatorTy> &HT);
|
ScopedHashTableScope(ScopedHashTable<K, V, KInfo, AllocatorTy> &HT);
|
||||||
~ScopedHashTableScope();
|
~ScopedHashTableScope();
|
||||||
|
@ -132,7 +132,7 @@ private:
|
|||||||
/// Grow - Allocate a larger backing store for the buckets and move it over.
|
/// Grow - Allocate a larger backing store for the buckets and move it over.
|
||||||
void Grow(unsigned NewSize);
|
void Grow(unsigned NewSize);
|
||||||
|
|
||||||
void operator=(const SmallPtrSetImplBase &RHS) LLVM_DELETED_FUNCTION;
|
void operator=(const SmallPtrSetImplBase &RHS) = delete;
|
||||||
protected:
|
protected:
|
||||||
/// swap - Swaps the elements of two sets.
|
/// swap - Swaps the elements of two sets.
|
||||||
/// Note: This method assumes that both sets have the same small size.
|
/// Note: This method assumes that both sets have the same small size.
|
||||||
@ -242,7 +242,7 @@ template <typename PtrType>
|
|||||||
class SmallPtrSetImpl : public SmallPtrSetImplBase {
|
class SmallPtrSetImpl : public SmallPtrSetImplBase {
|
||||||
typedef PointerLikeTypeTraits<PtrType> PtrTraits;
|
typedef PointerLikeTypeTraits<PtrType> PtrTraits;
|
||||||
|
|
||||||
SmallPtrSetImpl(const SmallPtrSetImpl&) LLVM_DELETED_FUNCTION;
|
SmallPtrSetImpl(const SmallPtrSetImpl&) = delete;
|
||||||
protected:
|
protected:
|
||||||
// Constructors that forward to the base.
|
// Constructors that forward to the base.
|
||||||
SmallPtrSetImpl(const void **SmallStorage, const SmallPtrSetImpl &that)
|
SmallPtrSetImpl(const void **SmallStorage, const SmallPtrSetImpl &that)
|
||||||
|
@ -343,7 +343,7 @@ template <typename T>
|
|||||||
class SmallVectorImpl : public SmallVectorTemplateBase<T, isPodLike<T>::value> {
|
class SmallVectorImpl : public SmallVectorTemplateBase<T, isPodLike<T>::value> {
|
||||||
typedef SmallVectorTemplateBase<T, isPodLike<T>::value > SuperClass;
|
typedef SmallVectorTemplateBase<T, isPodLike<T>::value > SuperClass;
|
||||||
|
|
||||||
SmallVectorImpl(const SmallVectorImpl&) LLVM_DELETED_FUNCTION;
|
SmallVectorImpl(const SmallVectorImpl&) = delete;
|
||||||
public:
|
public:
|
||||||
typedef typename SuperClass::iterator iterator;
|
typedef typename SuperClass::iterator iterator;
|
||||||
typedef typename SuperClass::size_type size_type;
|
typedef typename SuperClass::size_type size_type;
|
||||||
|
@ -133,8 +133,8 @@ class SparseMultiSet {
|
|||||||
|
|
||||||
// Disable copy construction and assignment.
|
// Disable copy construction and assignment.
|
||||||
// This data structure is not meant to be used that way.
|
// This data structure is not meant to be used that way.
|
||||||
SparseMultiSet(const SparseMultiSet&) LLVM_DELETED_FUNCTION;
|
SparseMultiSet(const SparseMultiSet&) = delete;
|
||||||
SparseMultiSet &operator=(const SparseMultiSet&) LLVM_DELETED_FUNCTION;
|
SparseMultiSet &operator=(const SparseMultiSet&) = delete;
|
||||||
|
|
||||||
/// Whether the given entry is the head of the list. List heads's previous
|
/// Whether the given entry is the head of the list. List heads's previous
|
||||||
/// pointers are to the tail of the list, allowing for efficient access to the
|
/// pointers are to the tail of the list, allowing for efficient access to the
|
||||||
|
@ -133,8 +133,8 @@ class SparseSet {
|
|||||||
|
|
||||||
// Disable copy construction and assignment.
|
// Disable copy construction and assignment.
|
||||||
// This data structure is not meant to be used that way.
|
// This data structure is not meant to be used that way.
|
||||||
SparseSet(const SparseSet&) LLVM_DELETED_FUNCTION;
|
SparseSet(const SparseSet&) = delete;
|
||||||
SparseSet &operator=(const SparseSet&) LLVM_DELETED_FUNCTION;
|
SparseSet &operator=(const SparseSet&) = delete;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef ValueT value_type;
|
typedef ValueT value_type;
|
||||||
|
@ -111,7 +111,7 @@ public:
|
|||||||
/// and data.
|
/// and data.
|
||||||
template<typename ValueTy>
|
template<typename ValueTy>
|
||||||
class StringMapEntry : public StringMapEntryBase {
|
class StringMapEntry : public StringMapEntryBase {
|
||||||
StringMapEntry(StringMapEntry &E) LLVM_DELETED_FUNCTION;
|
StringMapEntry(StringMapEntry &E) = delete;
|
||||||
public:
|
public:
|
||||||
ValueTy second;
|
ValueTy second;
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ namespace llvm {
|
|||||||
|
|
||||||
/// Since the intended use of twines is as temporary objects, assignments
|
/// Since the intended use of twines is as temporary objects, assignments
|
||||||
/// when concatenating might cause undefined behavior or stack corruptions
|
/// when concatenating might cause undefined behavior or stack corruptions
|
||||||
Twine &operator=(const Twine &Other) LLVM_DELETED_FUNCTION;
|
Twine &operator=(const Twine &Other) = delete;
|
||||||
|
|
||||||
/// isNull - Check for the null twine.
|
/// isNull - Check for the null twine.
|
||||||
bool isNull() const {
|
bool isNull() const {
|
||||||
|
@ -237,14 +237,14 @@ public:
|
|||||||
// These are to catch errors when people try to use them as random access
|
// These are to catch errors when people try to use them as random access
|
||||||
// iterators.
|
// iterators.
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void operator-(int, ilist_iterator<T>) LLVM_DELETED_FUNCTION;
|
void operator-(int, ilist_iterator<T>) = delete;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void operator-(ilist_iterator<T>,int) LLVM_DELETED_FUNCTION;
|
void operator-(ilist_iterator<T>,int) = delete;
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void operator+(int, ilist_iterator<T>) LLVM_DELETED_FUNCTION;
|
void operator+(int, ilist_iterator<T>) = delete;
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void operator+(ilist_iterator<T>,int) LLVM_DELETED_FUNCTION;
|
void operator+(ilist_iterator<T>,int) = delete;
|
||||||
|
|
||||||
// operator!=/operator== - Allow mixed comparisons without dereferencing
|
// operator!=/operator== - Allow mixed comparisons without dereferencing
|
||||||
// the iterator, which could very likely be pointing to end().
|
// the iterator, which could very likely be pointing to end().
|
||||||
@ -332,8 +332,8 @@ class iplist : public Traits {
|
|||||||
|
|
||||||
// No fundamental reason why iplist can't be copyable, but the default
|
// No fundamental reason why iplist can't be copyable, but the default
|
||||||
// copy/copy-assign won't do.
|
// copy/copy-assign won't do.
|
||||||
iplist(const iplist &) LLVM_DELETED_FUNCTION;
|
iplist(const iplist &) = delete;
|
||||||
void operator=(const iplist &) LLVM_DELETED_FUNCTION;
|
void operator=(const iplist &) = delete;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef NodeTy *pointer;
|
typedef NodeTy *pointer;
|
||||||
|
@ -226,8 +226,8 @@ private:
|
|||||||
AccessTy(NoModRef), AliasTy(MustAlias), Volatile(false) {
|
AccessTy(NoModRef), AliasTy(MustAlias), Volatile(false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
AliasSet(const AliasSet &AS) LLVM_DELETED_FUNCTION;
|
AliasSet(const AliasSet &AS) = delete;
|
||||||
void operator=(const AliasSet &AS) LLVM_DELETED_FUNCTION;
|
void operator=(const AliasSet &AS) = delete;
|
||||||
|
|
||||||
PointerRec *getSomePointer() const {
|
PointerRec *getSomePointer() const {
|
||||||
return PtrList;
|
return PtrList;
|
||||||
|
@ -273,8 +273,8 @@ private:
|
|||||||
/// CalledFunctions array of this or other CallGraphNodes.
|
/// CalledFunctions array of this or other CallGraphNodes.
|
||||||
unsigned NumReferences;
|
unsigned NumReferences;
|
||||||
|
|
||||||
CallGraphNode(const CallGraphNode &) LLVM_DELETED_FUNCTION;
|
CallGraphNode(const CallGraphNode &) = delete;
|
||||||
void operator=(const CallGraphNode &) LLVM_DELETED_FUNCTION;
|
void operator=(const CallGraphNode &) = delete;
|
||||||
|
|
||||||
void DropRef() { --NumReferences; }
|
void DropRef() { --NumReferences; }
|
||||||
void AddRef() { ++NumReferences; }
|
void AddRef() { ++NumReferences; }
|
||||||
|
@ -278,8 +278,8 @@ namespace llvm {
|
|||||||
/// DependenceAnalysis - This class is the main dependence-analysis driver.
|
/// DependenceAnalysis - This class is the main dependence-analysis driver.
|
||||||
///
|
///
|
||||||
class DependenceAnalysis : public FunctionPass {
|
class DependenceAnalysis : public FunctionPass {
|
||||||
void operator=(const DependenceAnalysis &) LLVM_DELETED_FUNCTION;
|
void operator=(const DependenceAnalysis &) = delete;
|
||||||
DependenceAnalysis(const DependenceAnalysis &) LLVM_DELETED_FUNCTION;
|
DependenceAnalysis(const DependenceAnalysis &) = delete;
|
||||||
public:
|
public:
|
||||||
/// depends - Tests for a dependence between the Src and Dst instructions.
|
/// depends - Tests for a dependence between the Src and Dst instructions.
|
||||||
/// Returns NULL if no dependence; otherwise, returns a Dependence (or a
|
/// Returns NULL if no dependence; otherwise, returns a Dependence (or a
|
||||||
|
@ -33,8 +33,8 @@ class LazyValueInfo : public FunctionPass {
|
|||||||
class TargetLibraryInfo *TLI;
|
class TargetLibraryInfo *TLI;
|
||||||
DominatorTree *DT;
|
DominatorTree *DT;
|
||||||
void *PImpl;
|
void *PImpl;
|
||||||
LazyValueInfo(const LazyValueInfo&) LLVM_DELETED_FUNCTION;
|
LazyValueInfo(const LazyValueInfo&) = delete;
|
||||||
void operator=(const LazyValueInfo&) LLVM_DELETED_FUNCTION;
|
void operator=(const LazyValueInfo&) = delete;
|
||||||
public:
|
public:
|
||||||
static char ID;
|
static char ID;
|
||||||
LazyValueInfo() : FunctionPass(ID), PImpl(nullptr) {
|
LazyValueInfo() : FunctionPass(ID), PImpl(nullptr) {
|
||||||
|
@ -79,9 +79,9 @@ class LoopBase {
|
|||||||
|
|
||||||
SmallPtrSet<const BlockT*, 8> DenseBlockSet;
|
SmallPtrSet<const BlockT*, 8> DenseBlockSet;
|
||||||
|
|
||||||
LoopBase(const LoopBase<BlockT, LoopT> &) LLVM_DELETED_FUNCTION;
|
LoopBase(const LoopBase<BlockT, LoopT> &) = delete;
|
||||||
const LoopBase<BlockT, LoopT>&
|
const LoopBase<BlockT, LoopT>&
|
||||||
operator=(const LoopBase<BlockT, LoopT> &) LLVM_DELETED_FUNCTION;
|
operator=(const LoopBase<BlockT, LoopT> &) = delete;
|
||||||
public:
|
public:
|
||||||
/// Loop ctor - This creates an empty loop.
|
/// Loop ctor - This creates an empty loop.
|
||||||
LoopBase() : ParentLoop(nullptr) {}
|
LoopBase() : ParentLoop(nullptr) {}
|
||||||
@ -501,8 +501,8 @@ class LoopInfoBase {
|
|||||||
friend class LoopBase<BlockT, LoopT>;
|
friend class LoopBase<BlockT, LoopT>;
|
||||||
friend class LoopInfo;
|
friend class LoopInfo;
|
||||||
|
|
||||||
void operator=(const LoopInfoBase &) LLVM_DELETED_FUNCTION;
|
void operator=(const LoopInfoBase &) = delete;
|
||||||
LoopInfoBase(const LoopInfoBase &) LLVM_DELETED_FUNCTION;
|
LoopInfoBase(const LoopInfoBase &) = delete;
|
||||||
public:
|
public:
|
||||||
LoopInfoBase() { }
|
LoopInfoBase() { }
|
||||||
~LoopInfoBase() { releaseMemory(); }
|
~LoopInfoBase() { releaseMemory(); }
|
||||||
@ -651,8 +651,8 @@ class LoopInfo : public LoopInfoBase<BasicBlock, Loop> {
|
|||||||
|
|
||||||
friend class LoopBase<BasicBlock, Loop>;
|
friend class LoopBase<BasicBlock, Loop>;
|
||||||
|
|
||||||
void operator=(const LoopInfo &) LLVM_DELETED_FUNCTION;
|
void operator=(const LoopInfo &) = delete;
|
||||||
LoopInfo(const LoopInfo &) LLVM_DELETED_FUNCTION;
|
LoopInfo(const LoopInfo &) = delete;
|
||||||
public:
|
public:
|
||||||
LoopInfo() {}
|
LoopInfo() {}
|
||||||
|
|
||||||
|
@ -115,8 +115,8 @@ public:
|
|||||||
typedef typename Tr::RegionT RegionT;
|
typedef typename Tr::RegionT RegionT;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RegionNodeBase(const RegionNodeBase &) LLVM_DELETED_FUNCTION;
|
RegionNodeBase(const RegionNodeBase &) = delete;
|
||||||
const RegionNodeBase &operator=(const RegionNodeBase &) LLVM_DELETED_FUNCTION;
|
const RegionNodeBase &operator=(const RegionNodeBase &) = delete;
|
||||||
|
|
||||||
/// This is the entry basic block that starts this region node. If this is a
|
/// This is the entry basic block that starts this region node. If this is a
|
||||||
/// BasicBlock RegionNode, then entry is just the basic block, that this
|
/// BasicBlock RegionNode, then entry is just the basic block, that this
|
||||||
@ -261,8 +261,8 @@ class RegionBase : public RegionNodeBase<Tr> {
|
|||||||
typedef typename InvBlockTraits::ChildIteratorType PredIterTy;
|
typedef typename InvBlockTraits::ChildIteratorType PredIterTy;
|
||||||
|
|
||||||
friend class RegionInfoBase<Tr>;
|
friend class RegionInfoBase<Tr>;
|
||||||
RegionBase(const RegionBase &) LLVM_DELETED_FUNCTION;
|
RegionBase(const RegionBase &) = delete;
|
||||||
const RegionBase &operator=(const RegionBase &) LLVM_DELETED_FUNCTION;
|
const RegionBase &operator=(const RegionBase &) = delete;
|
||||||
|
|
||||||
// Information necessary to manage this Region.
|
// Information necessary to manage this Region.
|
||||||
RegionInfoT *RI;
|
RegionInfoT *RI;
|
||||||
@ -674,8 +674,8 @@ class RegionInfoBase {
|
|||||||
RegionInfoBase();
|
RegionInfoBase();
|
||||||
virtual ~RegionInfoBase();
|
virtual ~RegionInfoBase();
|
||||||
|
|
||||||
RegionInfoBase(const RegionInfoBase &) LLVM_DELETED_FUNCTION;
|
RegionInfoBase(const RegionInfoBase &) = delete;
|
||||||
const RegionInfoBase &operator=(const RegionInfoBase &) LLVM_DELETED_FUNCTION;
|
const RegionInfoBase &operator=(const RegionInfoBase &) = delete;
|
||||||
|
|
||||||
DomTreeT *DT;
|
DomTreeT *DT;
|
||||||
PostDomTreeT *PDT;
|
PostDomTreeT *PDT;
|
||||||
|
@ -71,8 +71,8 @@ namespace llvm {
|
|||||||
unsigned short SubclassData;
|
unsigned short SubclassData;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SCEV(const SCEV &) LLVM_DELETED_FUNCTION;
|
SCEV(const SCEV &) = delete;
|
||||||
void operator=(const SCEV &) LLVM_DELETED_FUNCTION;
|
void operator=(const SCEV &) = delete;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/// NoWrapFlags are bitfield indices into SubclassData.
|
/// NoWrapFlags are bitfield indices into SubclassData.
|
||||||
|
@ -131,8 +131,8 @@ class SparseSolver {
|
|||||||
typedef std::pair<BasicBlock*,BasicBlock*> Edge;
|
typedef std::pair<BasicBlock*,BasicBlock*> Edge;
|
||||||
std::set<Edge> KnownFeasibleEdges;
|
std::set<Edge> KnownFeasibleEdges;
|
||||||
|
|
||||||
SparseSolver(const SparseSolver&) LLVM_DELETED_FUNCTION;
|
SparseSolver(const SparseSolver&) = delete;
|
||||||
void operator=(const SparseSolver&) LLVM_DELETED_FUNCTION;
|
void operator=(const SparseSolver&) = delete;
|
||||||
public:
|
public:
|
||||||
explicit SparseSolver(AbstractLatticeFunction *Lattice)
|
explicit SparseSolver(AbstractLatticeFunction *Lattice)
|
||||||
: LatticeFunc(Lattice) {}
|
: LatticeFunc(Lattice) {}
|
||||||
|
@ -50,8 +50,8 @@ private:
|
|||||||
/// information in the BlockInfo block. Only llvm-bcanalyzer uses this.
|
/// information in the BlockInfo block. Only llvm-bcanalyzer uses this.
|
||||||
bool IgnoreBlockInfoNames;
|
bool IgnoreBlockInfoNames;
|
||||||
|
|
||||||
BitstreamReader(const BitstreamReader&) LLVM_DELETED_FUNCTION;
|
BitstreamReader(const BitstreamReader&) = delete;
|
||||||
void operator=(const BitstreamReader&) LLVM_DELETED_FUNCTION;
|
void operator=(const BitstreamReader&) = delete;
|
||||||
public:
|
public:
|
||||||
BitstreamReader() : IgnoreBlockInfoNames(true) {
|
BitstreamReader() : IgnoreBlockInfoNames(true) {
|
||||||
}
|
}
|
||||||
|
@ -44,8 +44,8 @@ protected:
|
|||||||
GCMetadataPrinter();
|
GCMetadataPrinter();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GCMetadataPrinter(const GCMetadataPrinter &) LLVM_DELETED_FUNCTION;
|
GCMetadataPrinter(const GCMetadataPrinter &) = delete;
|
||||||
GCMetadataPrinter &operator=(const GCMetadataPrinter &) LLVM_DELETED_FUNCTION;
|
GCMetadataPrinter &operator=(const GCMetadataPrinter &) = delete;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GCStrategy &getStrategy() { return *S; }
|
GCStrategy &getStrategy() { return *S; }
|
||||||
|
@ -745,7 +745,7 @@ namespace llvm {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LiveInterval& operator=(const LiveInterval& rhs) LLVM_DELETED_FUNCTION;
|
LiveInterval& operator=(const LiveInterval& rhs) = delete;
|
||||||
|
|
||||||
/// Appends @p Range to SubRanges list.
|
/// Appends @p Range to SubRanges list.
|
||||||
void appendSubRange(SubRange *Range) {
|
void appendSubRange(SubRange *Range) {
|
||||||
|
@ -179,8 +179,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Query(const Query&) LLVM_DELETED_FUNCTION;
|
Query(const Query&) = delete;
|
||||||
void operator=(const Query&) LLVM_DELETED_FUNCTION;
|
void operator=(const Query&) = delete;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Array of LiveIntervalUnions.
|
// Array of LiveIntervalUnions.
|
||||||
|
@ -44,8 +44,8 @@ class LivePhysRegs {
|
|||||||
const TargetRegisterInfo *TRI;
|
const TargetRegisterInfo *TRI;
|
||||||
SparseSet<unsigned> LiveRegs;
|
SparseSet<unsigned> LiveRegs;
|
||||||
|
|
||||||
LivePhysRegs(const LivePhysRegs&) LLVM_DELETED_FUNCTION;
|
LivePhysRegs(const LivePhysRegs&) = delete;
|
||||||
LivePhysRegs &operator=(const LivePhysRegs&) LLVM_DELETED_FUNCTION;
|
LivePhysRegs &operator=(const LivePhysRegs&) = delete;
|
||||||
public:
|
public:
|
||||||
/// \brief Constructs a new empty LivePhysRegs set.
|
/// \brief Constructs a new empty LivePhysRegs set.
|
||||||
LivePhysRegs() : TRI(nullptr), LiveRegs() {}
|
LivePhysRegs() : TRI(nullptr), LiveRegs() {}
|
||||||
|
@ -26,8 +26,8 @@ public:
|
|||||||
typedef DominanceFrontierBase<MachineBasicBlock>::iterator iterator;
|
typedef DominanceFrontierBase<MachineBasicBlock>::iterator iterator;
|
||||||
typedef DominanceFrontierBase<MachineBasicBlock>::const_iterator const_iterator;
|
typedef DominanceFrontierBase<MachineBasicBlock>::const_iterator const_iterator;
|
||||||
|
|
||||||
void operator=(const MachineDominanceFrontier &) LLVM_DELETED_FUNCTION;
|
void operator=(const MachineDominanceFrontier &) = delete;
|
||||||
MachineDominanceFrontier(const MachineDominanceFrontier &) LLVM_DELETED_FUNCTION;
|
MachineDominanceFrontier(const MachineDominanceFrontier &) = delete;
|
||||||
|
|
||||||
static char ID;
|
static char ID;
|
||||||
|
|
||||||
|
@ -145,8 +145,8 @@ class MachineFunction {
|
|||||||
/// True if the function includes any inline assembly.
|
/// True if the function includes any inline assembly.
|
||||||
bool HasInlineAsm;
|
bool HasInlineAsm;
|
||||||
|
|
||||||
MachineFunction(const MachineFunction &) LLVM_DELETED_FUNCTION;
|
MachineFunction(const MachineFunction &) = delete;
|
||||||
void operator=(const MachineFunction&) LLVM_DELETED_FUNCTION;
|
void operator=(const MachineFunction&) = delete;
|
||||||
public:
|
public:
|
||||||
MachineFunction(const Function *Fn, const TargetMachine &TM,
|
MachineFunction(const Function *Fn, const TargetMachine &TM,
|
||||||
unsigned FunctionNum, MachineModuleInfo &MMI);
|
unsigned FunctionNum, MachineModuleInfo &MMI);
|
||||||
|
@ -93,10 +93,10 @@ private:
|
|||||||
|
|
||||||
DebugLoc debugLoc; // Source line information.
|
DebugLoc debugLoc; // Source line information.
|
||||||
|
|
||||||
MachineInstr(const MachineInstr&) LLVM_DELETED_FUNCTION;
|
MachineInstr(const MachineInstr&) = delete;
|
||||||
void operator=(const MachineInstr&) LLVM_DELETED_FUNCTION;
|
void operator=(const MachineInstr&) = delete;
|
||||||
// Use MachineFunction::DeleteMachineInstr() instead.
|
// Use MachineFunction::DeleteMachineInstr() instead.
|
||||||
~MachineInstr() LLVM_DELETED_FUNCTION;
|
~MachineInstr() = delete;
|
||||||
|
|
||||||
// Intrusive list support
|
// Intrusive list support
|
||||||
friend struct ilist_traits<MachineInstr>;
|
friend struct ilist_traits<MachineInstr>;
|
||||||
|
@ -74,8 +74,8 @@ class MachineLoopInfo : public MachineFunctionPass {
|
|||||||
LoopInfoBase<MachineBasicBlock, MachineLoop> LI;
|
LoopInfoBase<MachineBasicBlock, MachineLoop> LI;
|
||||||
friend class LoopBase<MachineBasicBlock, MachineLoop>;
|
friend class LoopBase<MachineBasicBlock, MachineLoop>;
|
||||||
|
|
||||||
void operator=(const MachineLoopInfo &) LLVM_DELETED_FUNCTION;
|
void operator=(const MachineLoopInfo &) = delete;
|
||||||
MachineLoopInfo(const MachineLoopInfo &) LLVM_DELETED_FUNCTION;
|
MachineLoopInfo(const MachineLoopInfo &) = delete;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static char ID; // Pass identification, replacement for typeid
|
static char ID; // Pass identification, replacement for typeid
|
||||||
|
@ -123,8 +123,8 @@ private:
|
|||||||
/// second element.
|
/// second element.
|
||||||
std::vector<std::pair<unsigned, unsigned> > LiveIns;
|
std::vector<std::pair<unsigned, unsigned> > LiveIns;
|
||||||
|
|
||||||
MachineRegisterInfo(const MachineRegisterInfo&) LLVM_DELETED_FUNCTION;
|
MachineRegisterInfo(const MachineRegisterInfo&) = delete;
|
||||||
void operator=(const MachineRegisterInfo&) LLVM_DELETED_FUNCTION;
|
void operator=(const MachineRegisterInfo&) = delete;
|
||||||
public:
|
public:
|
||||||
explicit MachineRegisterInfo(const MachineFunction *MF);
|
explicit MachineRegisterInfo(const MachineFunction *MF);
|
||||||
|
|
||||||
|
@ -107,8 +107,8 @@ public:
|
|||||||
private:
|
private:
|
||||||
unsigned GetValueAtEndOfBlockInternal(MachineBasicBlock *BB);
|
unsigned GetValueAtEndOfBlockInternal(MachineBasicBlock *BB);
|
||||||
|
|
||||||
void operator=(const MachineSSAUpdater&) LLVM_DELETED_FUNCTION;
|
void operator=(const MachineSSAUpdater&) = delete;
|
||||||
MachineSSAUpdater(const MachineSSAUpdater&) LLVM_DELETED_FUNCTION;
|
MachineSSAUpdater(const MachineSSAUpdater&) = delete;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // End llvm namespace
|
} // End llvm namespace
|
||||||
|
@ -115,8 +115,8 @@ class SDDbgInfo {
|
|||||||
typedef DenseMap<const SDNode*, SmallVector<SDDbgValue*, 2> > DbgValMapType;
|
typedef DenseMap<const SDNode*, SmallVector<SDDbgValue*, 2> > DbgValMapType;
|
||||||
DbgValMapType DbgValMap;
|
DbgValMapType DbgValMap;
|
||||||
|
|
||||||
void operator=(const SDDbgInfo&) LLVM_DELETED_FUNCTION;
|
void operator=(const SDDbgInfo&) = delete;
|
||||||
SDDbgInfo(const SDDbgInfo&) LLVM_DELETED_FUNCTION;
|
SDDbgInfo(const SDDbgInfo&) = delete;
|
||||||
public:
|
public:
|
||||||
SDDbgInfo() {}
|
SDDbgInfo() {}
|
||||||
|
|
||||||
@ -262,8 +262,8 @@ private:
|
|||||||
DenseSet<SDNode *> &visited,
|
DenseSet<SDNode *> &visited,
|
||||||
int level, bool &printed);
|
int level, bool &printed);
|
||||||
|
|
||||||
void operator=(const SelectionDAG&) LLVM_DELETED_FUNCTION;
|
void operator=(const SelectionDAG&) = delete;
|
||||||
SelectionDAG(const SelectionDAG&) LLVM_DELETED_FUNCTION;
|
SelectionDAG(const SelectionDAG&) = delete;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit SelectionDAG(const TargetMachine &TM, llvm::CodeGenOpt::Level);
|
explicit SelectionDAG(const TargetMachine &TM, llvm::CodeGenOpt::Level);
|
||||||
|
@ -259,8 +259,8 @@ class SDUse {
|
|||||||
/// this operand.
|
/// this operand.
|
||||||
SDUse **Prev, *Next;
|
SDUse **Prev, *Next;
|
||||||
|
|
||||||
SDUse(const SDUse &U) LLVM_DELETED_FUNCTION;
|
SDUse(const SDUse &U) = delete;
|
||||||
void operator=(const SDUse &U) LLVM_DELETED_FUNCTION;
|
void operator=(const SDUse &U) = delete;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SDUse() : Val(), User(nullptr), Prev(nullptr), Next(nullptr) {}
|
SDUse() : Val(), User(nullptr), Prev(nullptr), Next(nullptr) {}
|
||||||
@ -1611,7 +1611,7 @@ public:
|
|||||||
/// BUILD_VECTORs.
|
/// BUILD_VECTORs.
|
||||||
class BuildVectorSDNode : public SDNode {
|
class BuildVectorSDNode : public SDNode {
|
||||||
// These are constructed as SDNodes and then cast to BuildVectorSDNodes.
|
// These are constructed as SDNodes and then cast to BuildVectorSDNodes.
|
||||||
explicit BuildVectorSDNode() LLVM_DELETED_FUNCTION;
|
explicit BuildVectorSDNode() = delete;
|
||||||
public:
|
public:
|
||||||
/// isConstantSplat - Check if this is a constant splat, and if so, find the
|
/// isConstantSplat - Check if this is a constant splat, and if so, find the
|
||||||
/// smallest element size that splats the vector. If MinSplatBits is
|
/// smallest element size that splats the vector. If MinSplatBits is
|
||||||
|
@ -63,8 +63,8 @@ namespace llvm {
|
|||||||
/// createSpillSlot - Allocate a spill slot for RC from MFI.
|
/// createSpillSlot - Allocate a spill slot for RC from MFI.
|
||||||
unsigned createSpillSlot(const TargetRegisterClass *RC);
|
unsigned createSpillSlot(const TargetRegisterClass *RC);
|
||||||
|
|
||||||
VirtRegMap(const VirtRegMap&) LLVM_DELETED_FUNCTION;
|
VirtRegMap(const VirtRegMap&) = delete;
|
||||||
void operator=(const VirtRegMap&) LLVM_DELETED_FUNCTION;
|
void operator=(const VirtRegMap&) = delete;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static char ID;
|
static char ID;
|
||||||
|
@ -44,8 +44,8 @@ class DWARFContext : public DIContext {
|
|||||||
std::unique_ptr<DWARFDebugAbbrev> AbbrevDWO;
|
std::unique_ptr<DWARFDebugAbbrev> AbbrevDWO;
|
||||||
std::unique_ptr<DWARFDebugLocDWO> LocDWO;
|
std::unique_ptr<DWARFDebugLocDWO> LocDWO;
|
||||||
|
|
||||||
DWARFContext(DWARFContext &) LLVM_DELETED_FUNCTION;
|
DWARFContext(DWARFContext &) = delete;
|
||||||
DWARFContext &operator=(DWARFContext &) LLVM_DELETED_FUNCTION;
|
DWARFContext &operator=(DWARFContext &) = delete;
|
||||||
|
|
||||||
/// Read compile units from the debug_info section (if necessary)
|
/// Read compile units from the debug_info section (if necessary)
|
||||||
/// and store them in CUs.
|
/// and store them in CUs.
|
||||||
|
@ -34,8 +34,8 @@ protected:
|
|||||||
/// had been provided by this instance. Higher level layers are responsible
|
/// had been provided by this instance. Higher level layers are responsible
|
||||||
/// for taking any action required to handle the missing symbols.
|
/// for taking any action required to handle the missing symbols.
|
||||||
class LinkedObjectSet {
|
class LinkedObjectSet {
|
||||||
LinkedObjectSet(const LinkedObjectSet&) LLVM_DELETED_FUNCTION;
|
LinkedObjectSet(const LinkedObjectSet&) = delete;
|
||||||
void operator=(const LinkedObjectSet&) LLVM_DELETED_FUNCTION;
|
void operator=(const LinkedObjectSet&) = delete;
|
||||||
public:
|
public:
|
||||||
LinkedObjectSet(std::unique_ptr<RTDyldMemoryManager> MM)
|
LinkedObjectSet(std::unique_ptr<RTDyldMemoryManager> MM)
|
||||||
: MM(std::move(MM)), RTDyld(llvm::make_unique<RuntimeDyld>(&*this->MM)),
|
: MM(std::move(MM)), RTDyld(llvm::make_unique<RuntimeDyld>(&*this->MM)),
|
||||||
|
@ -34,8 +34,8 @@ class ExecutionEngine;
|
|||||||
// FIXME: As the RuntimeDyld fills out, additional routines will be needed
|
// FIXME: As the RuntimeDyld fills out, additional routines will be needed
|
||||||
// for the varying types of objects to be allocated.
|
// for the varying types of objects to be allocated.
|
||||||
class RTDyldMemoryManager {
|
class RTDyldMemoryManager {
|
||||||
RTDyldMemoryManager(const RTDyldMemoryManager&) LLVM_DELETED_FUNCTION;
|
RTDyldMemoryManager(const RTDyldMemoryManager&) = delete;
|
||||||
void operator=(const RTDyldMemoryManager&) LLVM_DELETED_FUNCTION;
|
void operator=(const RTDyldMemoryManager&) = delete;
|
||||||
public:
|
public:
|
||||||
RTDyldMemoryManager() {}
|
RTDyldMemoryManager() {}
|
||||||
virtual ~RTDyldMemoryManager();
|
virtual ~RTDyldMemoryManager();
|
||||||
|
@ -32,8 +32,8 @@ class RuntimeDyldCheckerImpl;
|
|||||||
class RuntimeDyld {
|
class RuntimeDyld {
|
||||||
friend class RuntimeDyldCheckerImpl;
|
friend class RuntimeDyldCheckerImpl;
|
||||||
|
|
||||||
RuntimeDyld(const RuntimeDyld &) LLVM_DELETED_FUNCTION;
|
RuntimeDyld(const RuntimeDyld &) = delete;
|
||||||
void operator=(const RuntimeDyld &) LLVM_DELETED_FUNCTION;
|
void operator=(const RuntimeDyld &) = delete;
|
||||||
|
|
||||||
// RuntimeDyldImpl is the actual class. RuntimeDyld is just the public
|
// RuntimeDyldImpl is the actual class. RuntimeDyld is just the public
|
||||||
// interface.
|
// interface.
|
||||||
|
@ -35,8 +35,8 @@ namespace llvm {
|
|||||||
/// MCJIT::finalizeObject or by calling SectionMemoryManager::finalizeMemory
|
/// MCJIT::finalizeObject or by calling SectionMemoryManager::finalizeMemory
|
||||||
/// directly. Clients of MCJIT should call MCJIT::finalizeObject.
|
/// directly. Clients of MCJIT should call MCJIT::finalizeObject.
|
||||||
class SectionMemoryManager : public RTDyldMemoryManager {
|
class SectionMemoryManager : public RTDyldMemoryManager {
|
||||||
SectionMemoryManager(const SectionMemoryManager&) LLVM_DELETED_FUNCTION;
|
SectionMemoryManager(const SectionMemoryManager&) = delete;
|
||||||
void operator=(const SectionMemoryManager&) LLVM_DELETED_FUNCTION;
|
void operator=(const SectionMemoryManager&) = delete;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SectionMemoryManager() { }
|
SectionMemoryManager() { }
|
||||||
|
@ -82,8 +82,8 @@ private:
|
|||||||
void setParent(Function *parent);
|
void setParent(Function *parent);
|
||||||
friend class SymbolTableListTraits<BasicBlock, Function>;
|
friend class SymbolTableListTraits<BasicBlock, Function>;
|
||||||
|
|
||||||
BasicBlock(const BasicBlock &) LLVM_DELETED_FUNCTION;
|
BasicBlock(const BasicBlock &) = delete;
|
||||||
void operator=(const BasicBlock &) LLVM_DELETED_FUNCTION;
|
void operator=(const BasicBlock &) = delete;
|
||||||
|
|
||||||
/// \brief Constructor.
|
/// \brief Constructor.
|
||||||
///
|
///
|
||||||
|
@ -49,7 +49,7 @@ private:
|
|||||||
friend class Module;
|
friend class Module;
|
||||||
Comdat();
|
Comdat();
|
||||||
Comdat(SelectionKind SK, StringMapEntry<Comdat> *Name);
|
Comdat(SelectionKind SK, StringMapEntry<Comdat> *Name);
|
||||||
Comdat(const Comdat &) LLVM_DELETED_FUNCTION;
|
Comdat(const Comdat &) = delete;
|
||||||
|
|
||||||
// Points to the map in Module.
|
// Points to the map in Module.
|
||||||
StringMapEntry<Comdat> *Name;
|
StringMapEntry<Comdat> *Name;
|
||||||
|
@ -39,8 +39,8 @@ namespace llvm {
|
|||||||
/// don't have to worry about the lifetime of the objects.
|
/// don't have to worry about the lifetime of the objects.
|
||||||
/// @brief LLVM Constant Representation
|
/// @brief LLVM Constant Representation
|
||||||
class Constant : public User {
|
class Constant : public User {
|
||||||
void operator=(const Constant &) LLVM_DELETED_FUNCTION;
|
void operator=(const Constant &) = delete;
|
||||||
Constant(const Constant &) LLVM_DELETED_FUNCTION;
|
Constant(const Constant &) = delete;
|
||||||
void anchor() override;
|
void anchor() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -46,8 +46,8 @@ template <class ConstantClass> struct ConstantAggrKeyType;
|
|||||||
/// @brief Class for constant integers.
|
/// @brief Class for constant integers.
|
||||||
class ConstantInt : public Constant {
|
class ConstantInt : public Constant {
|
||||||
void anchor() override;
|
void anchor() override;
|
||||||
void *operator new(size_t, unsigned) LLVM_DELETED_FUNCTION;
|
void *operator new(size_t, unsigned) = delete;
|
||||||
ConstantInt(const ConstantInt &) LLVM_DELETED_FUNCTION;
|
ConstantInt(const ConstantInt &) = delete;
|
||||||
ConstantInt(IntegerType *Ty, const APInt& V);
|
ConstantInt(IntegerType *Ty, const APInt& V);
|
||||||
APInt Val;
|
APInt Val;
|
||||||
protected:
|
protected:
|
||||||
@ -228,8 +228,8 @@ public:
|
|||||||
class ConstantFP : public Constant {
|
class ConstantFP : public Constant {
|
||||||
APFloat Val;
|
APFloat Val;
|
||||||
void anchor() override;
|
void anchor() override;
|
||||||
void *operator new(size_t, unsigned) LLVM_DELETED_FUNCTION;
|
void *operator new(size_t, unsigned) = delete;
|
||||||
ConstantFP(const ConstantFP &) LLVM_DELETED_FUNCTION;
|
ConstantFP(const ConstantFP &) = delete;
|
||||||
friend class LLVMContextImpl;
|
friend class LLVMContextImpl;
|
||||||
protected:
|
protected:
|
||||||
ConstantFP(Type *Ty, const APFloat& V);
|
ConstantFP(Type *Ty, const APFloat& V);
|
||||||
@ -294,8 +294,8 @@ public:
|
|||||||
/// ConstantAggregateZero - All zero aggregate value
|
/// ConstantAggregateZero - All zero aggregate value
|
||||||
///
|
///
|
||||||
class ConstantAggregateZero : public Constant {
|
class ConstantAggregateZero : public Constant {
|
||||||
void *operator new(size_t, unsigned) LLVM_DELETED_FUNCTION;
|
void *operator new(size_t, unsigned) = delete;
|
||||||
ConstantAggregateZero(const ConstantAggregateZero &) LLVM_DELETED_FUNCTION;
|
ConstantAggregateZero(const ConstantAggregateZero &) = delete;
|
||||||
protected:
|
protected:
|
||||||
explicit ConstantAggregateZero(Type *ty)
|
explicit ConstantAggregateZero(Type *ty)
|
||||||
: Constant(ty, ConstantAggregateZeroVal, nullptr, 0) {}
|
: Constant(ty, ConstantAggregateZeroVal, nullptr, 0) {}
|
||||||
@ -338,7 +338,7 @@ public:
|
|||||||
///
|
///
|
||||||
class ConstantArray : public Constant {
|
class ConstantArray : public Constant {
|
||||||
friend struct ConstantAggrKeyType<ConstantArray>;
|
friend struct ConstantAggrKeyType<ConstantArray>;
|
||||||
ConstantArray(const ConstantArray &) LLVM_DELETED_FUNCTION;
|
ConstantArray(const ConstantArray &) = delete;
|
||||||
protected:
|
protected:
|
||||||
ConstantArray(ArrayType *T, ArrayRef<Constant *> Val);
|
ConstantArray(ArrayType *T, ArrayRef<Constant *> Val);
|
||||||
public:
|
public:
|
||||||
@ -380,7 +380,7 @@ DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ConstantArray, Constant)
|
|||||||
//
|
//
|
||||||
class ConstantStruct : public Constant {
|
class ConstantStruct : public Constant {
|
||||||
friend struct ConstantAggrKeyType<ConstantStruct>;
|
friend struct ConstantAggrKeyType<ConstantStruct>;
|
||||||
ConstantStruct(const ConstantStruct &) LLVM_DELETED_FUNCTION;
|
ConstantStruct(const ConstantStruct &) = delete;
|
||||||
protected:
|
protected:
|
||||||
ConstantStruct(StructType *T, ArrayRef<Constant *> Val);
|
ConstantStruct(StructType *T, ArrayRef<Constant *> Val);
|
||||||
public:
|
public:
|
||||||
@ -439,7 +439,7 @@ DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ConstantStruct, Constant)
|
|||||||
///
|
///
|
||||||
class ConstantVector : public Constant {
|
class ConstantVector : public Constant {
|
||||||
friend struct ConstantAggrKeyType<ConstantVector>;
|
friend struct ConstantAggrKeyType<ConstantVector>;
|
||||||
ConstantVector(const ConstantVector &) LLVM_DELETED_FUNCTION;
|
ConstantVector(const ConstantVector &) = delete;
|
||||||
protected:
|
protected:
|
||||||
ConstantVector(VectorType *T, ArrayRef<Constant *> Val);
|
ConstantVector(VectorType *T, ArrayRef<Constant *> Val);
|
||||||
public:
|
public:
|
||||||
@ -488,8 +488,8 @@ DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ConstantVector, Constant)
|
|||||||
/// ConstantPointerNull - a constant pointer value that points to null
|
/// ConstantPointerNull - a constant pointer value that points to null
|
||||||
///
|
///
|
||||||
class ConstantPointerNull : public Constant {
|
class ConstantPointerNull : public Constant {
|
||||||
void *operator new(size_t, unsigned) LLVM_DELETED_FUNCTION;
|
void *operator new(size_t, unsigned) = delete;
|
||||||
ConstantPointerNull(const ConstantPointerNull &) LLVM_DELETED_FUNCTION;
|
ConstantPointerNull(const ConstantPointerNull &) = delete;
|
||||||
protected:
|
protected:
|
||||||
explicit ConstantPointerNull(PointerType *T)
|
explicit ConstantPointerNull(PointerType *T)
|
||||||
: Constant(T,
|
: Constant(T,
|
||||||
@ -539,8 +539,8 @@ class ConstantDataSequential : public Constant {
|
|||||||
/// element array of i8, or a 1-element array of i32. They'll both end up in
|
/// element array of i8, or a 1-element array of i32. They'll both end up in
|
||||||
/// the same StringMap bucket, linked up.
|
/// the same StringMap bucket, linked up.
|
||||||
ConstantDataSequential *Next;
|
ConstantDataSequential *Next;
|
||||||
void *operator new(size_t, unsigned) LLVM_DELETED_FUNCTION;
|
void *operator new(size_t, unsigned) = delete;
|
||||||
ConstantDataSequential(const ConstantDataSequential &) LLVM_DELETED_FUNCTION;
|
ConstantDataSequential(const ConstantDataSequential &) = delete;
|
||||||
protected:
|
protected:
|
||||||
explicit ConstantDataSequential(Type *ty, ValueTy VT, const char *Data)
|
explicit ConstantDataSequential(Type *ty, ValueTy VT, const char *Data)
|
||||||
: Constant(ty, VT, nullptr, 0), DataElements(Data), Next(nullptr) {}
|
: Constant(ty, VT, nullptr, 0), DataElements(Data), Next(nullptr) {}
|
||||||
@ -650,8 +650,8 @@ private:
|
|||||||
/// operands because it stores all of the elements of the constant as densely
|
/// operands because it stores all of the elements of the constant as densely
|
||||||
/// packed data, instead of as Value*'s.
|
/// packed data, instead of as Value*'s.
|
||||||
class ConstantDataArray : public ConstantDataSequential {
|
class ConstantDataArray : public ConstantDataSequential {
|
||||||
void *operator new(size_t, unsigned) LLVM_DELETED_FUNCTION;
|
void *operator new(size_t, unsigned) = delete;
|
||||||
ConstantDataArray(const ConstantDataArray &) LLVM_DELETED_FUNCTION;
|
ConstantDataArray(const ConstantDataArray &) = delete;
|
||||||
void anchor() override;
|
void anchor() override;
|
||||||
friend class ConstantDataSequential;
|
friend class ConstantDataSequential;
|
||||||
explicit ConstantDataArray(Type *ty, const char *Data)
|
explicit ConstantDataArray(Type *ty, const char *Data)
|
||||||
@ -702,8 +702,8 @@ public:
|
|||||||
/// operands because it stores all of the elements of the constant as densely
|
/// operands because it stores all of the elements of the constant as densely
|
||||||
/// packed data, instead of as Value*'s.
|
/// packed data, instead of as Value*'s.
|
||||||
class ConstantDataVector : public ConstantDataSequential {
|
class ConstantDataVector : public ConstantDataSequential {
|
||||||
void *operator new(size_t, unsigned) LLVM_DELETED_FUNCTION;
|
void *operator new(size_t, unsigned) = delete;
|
||||||
ConstantDataVector(const ConstantDataVector &) LLVM_DELETED_FUNCTION;
|
ConstantDataVector(const ConstantDataVector &) = delete;
|
||||||
void anchor() override;
|
void anchor() override;
|
||||||
friend class ConstantDataSequential;
|
friend class ConstantDataSequential;
|
||||||
explicit ConstantDataVector(Type *ty, const char *Data)
|
explicit ConstantDataVector(Type *ty, const char *Data)
|
||||||
@ -753,7 +753,7 @@ public:
|
|||||||
/// BlockAddress - The address of a basic block.
|
/// BlockAddress - The address of a basic block.
|
||||||
///
|
///
|
||||||
class BlockAddress : public Constant {
|
class BlockAddress : public Constant {
|
||||||
void *operator new(size_t, unsigned) LLVM_DELETED_FUNCTION;
|
void *operator new(size_t, unsigned) = delete;
|
||||||
void *operator new(size_t s) { return User::operator new(s, 2); }
|
void *operator new(size_t s) { return User::operator new(s, 2); }
|
||||||
BlockAddress(Function *F, BasicBlock *BB);
|
BlockAddress(Function *F, BasicBlock *BB);
|
||||||
public:
|
public:
|
||||||
@ -1165,8 +1165,8 @@ DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ConstantExpr, Constant)
|
|||||||
/// LangRef.html#undefvalues for details.
|
/// LangRef.html#undefvalues for details.
|
||||||
///
|
///
|
||||||
class UndefValue : public Constant {
|
class UndefValue : public Constant {
|
||||||
void *operator new(size_t, unsigned) LLVM_DELETED_FUNCTION;
|
void *operator new(size_t, unsigned) = delete;
|
||||||
UndefValue(const UndefValue &) LLVM_DELETED_FUNCTION;
|
UndefValue(const UndefValue &) = delete;
|
||||||
protected:
|
protected:
|
||||||
explicit UndefValue(Type *T) : Constant(T, UndefValueVal, nullptr, 0) {}
|
explicit UndefValue(Type *T) : Constant(T, UndefValueVal, nullptr, 0) {}
|
||||||
protected:
|
protected:
|
||||||
|
@ -80,8 +80,8 @@ namespace llvm {
|
|||||||
/// Each subprogram's preserved local variables.
|
/// Each subprogram's preserved local variables.
|
||||||
DenseMap<MDNode *, std::vector<TrackingMDNodeRef>> PreservedVariables;
|
DenseMap<MDNode *, std::vector<TrackingMDNodeRef>> PreservedVariables;
|
||||||
|
|
||||||
DIBuilder(const DIBuilder &) LLVM_DELETED_FUNCTION;
|
DIBuilder(const DIBuilder &) = delete;
|
||||||
void operator=(const DIBuilder &) LLVM_DELETED_FUNCTION;
|
void operator=(const DIBuilder &) = delete;
|
||||||
|
|
||||||
/// \brief Create a temporary.
|
/// \brief Create a temporary.
|
||||||
///
|
///
|
||||||
|
@ -63,7 +63,7 @@ class MDLocation : public MDNode {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Disallow replacing operands.
|
// Disallow replacing operands.
|
||||||
void replaceOperandWith(unsigned I, Metadata *New) LLVM_DELETED_FUNCTION;
|
void replaceOperandWith(unsigned I, Metadata *New) = delete;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DEFINE_MDNODE_GET(MDLocation,
|
DEFINE_MDNODE_GET(MDLocation,
|
||||||
|
@ -94,8 +94,8 @@ public:
|
|||||||
/// FunctionType - Class to represent function types
|
/// FunctionType - Class to represent function types
|
||||||
///
|
///
|
||||||
class FunctionType : public Type {
|
class FunctionType : public Type {
|
||||||
FunctionType(const FunctionType &) LLVM_DELETED_FUNCTION;
|
FunctionType(const FunctionType &) = delete;
|
||||||
const FunctionType &operator=(const FunctionType &) LLVM_DELETED_FUNCTION;
|
const FunctionType &operator=(const FunctionType &) = delete;
|
||||||
FunctionType(Type *Result, ArrayRef<Type*> Params, bool IsVarArgs);
|
FunctionType(Type *Result, ArrayRef<Type*> Params, bool IsVarArgs);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -188,8 +188,8 @@ public:
|
|||||||
/// generator for a target expects).
|
/// generator for a target expects).
|
||||||
///
|
///
|
||||||
class StructType : public CompositeType {
|
class StructType : public CompositeType {
|
||||||
StructType(const StructType &) LLVM_DELETED_FUNCTION;
|
StructType(const StructType &) = delete;
|
||||||
const StructType &operator=(const StructType &) LLVM_DELETED_FUNCTION;
|
const StructType &operator=(const StructType &) = delete;
|
||||||
StructType(LLVMContext &C)
|
StructType(LLVMContext &C)
|
||||||
: CompositeType(C, StructTyID), SymbolTableEntry(nullptr) {}
|
: CompositeType(C, StructTyID), SymbolTableEntry(nullptr) {}
|
||||||
enum {
|
enum {
|
||||||
@ -308,8 +308,8 @@ public:
|
|||||||
///
|
///
|
||||||
class SequentialType : public CompositeType {
|
class SequentialType : public CompositeType {
|
||||||
Type *ContainedType; ///< Storage for the single contained type.
|
Type *ContainedType; ///< Storage for the single contained type.
|
||||||
SequentialType(const SequentialType &) LLVM_DELETED_FUNCTION;
|
SequentialType(const SequentialType &) = delete;
|
||||||
const SequentialType &operator=(const SequentialType &) LLVM_DELETED_FUNCTION;
|
const SequentialType &operator=(const SequentialType &) = delete;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
SequentialType(TypeID TID, Type *ElType)
|
SequentialType(TypeID TID, Type *ElType)
|
||||||
@ -335,8 +335,8 @@ public:
|
|||||||
class ArrayType : public SequentialType {
|
class ArrayType : public SequentialType {
|
||||||
uint64_t NumElements;
|
uint64_t NumElements;
|
||||||
|
|
||||||
ArrayType(const ArrayType &) LLVM_DELETED_FUNCTION;
|
ArrayType(const ArrayType &) = delete;
|
||||||
const ArrayType &operator=(const ArrayType &) LLVM_DELETED_FUNCTION;
|
const ArrayType &operator=(const ArrayType &) = delete;
|
||||||
ArrayType(Type *ElType, uint64_t NumEl);
|
ArrayType(Type *ElType, uint64_t NumEl);
|
||||||
public:
|
public:
|
||||||
/// ArrayType::get - This static method is the primary way to construct an
|
/// ArrayType::get - This static method is the primary way to construct an
|
||||||
@ -361,8 +361,8 @@ public:
|
|||||||
class VectorType : public SequentialType {
|
class VectorType : public SequentialType {
|
||||||
unsigned NumElements;
|
unsigned NumElements;
|
||||||
|
|
||||||
VectorType(const VectorType &) LLVM_DELETED_FUNCTION;
|
VectorType(const VectorType &) = delete;
|
||||||
const VectorType &operator=(const VectorType &) LLVM_DELETED_FUNCTION;
|
const VectorType &operator=(const VectorType &) = delete;
|
||||||
VectorType(Type *ElType, unsigned NumEl);
|
VectorType(Type *ElType, unsigned NumEl);
|
||||||
public:
|
public:
|
||||||
/// VectorType::get - This static method is the primary way to construct an
|
/// VectorType::get - This static method is the primary way to construct an
|
||||||
@ -446,8 +446,8 @@ public:
|
|||||||
/// PointerType - Class to represent pointers.
|
/// PointerType - Class to represent pointers.
|
||||||
///
|
///
|
||||||
class PointerType : public SequentialType {
|
class PointerType : public SequentialType {
|
||||||
PointerType(const PointerType &) LLVM_DELETED_FUNCTION;
|
PointerType(const PointerType &) = delete;
|
||||||
const PointerType &operator=(const PointerType &) LLVM_DELETED_FUNCTION;
|
const PointerType &operator=(const PointerType &) = delete;
|
||||||
explicit PointerType(Type *ElType, unsigned AddrSpace);
|
explicit PointerType(Type *ElType, unsigned AddrSpace);
|
||||||
public:
|
public:
|
||||||
/// PointerType::get - This constructs a pointer to an object of the specified
|
/// PointerType::get - This constructs a pointer to an object of the specified
|
||||||
|
@ -113,8 +113,8 @@ private:
|
|||||||
}
|
}
|
||||||
void BuildLazyArguments() const;
|
void BuildLazyArguments() const;
|
||||||
|
|
||||||
Function(const Function&) LLVM_DELETED_FUNCTION;
|
Function(const Function&) = delete;
|
||||||
void operator=(const Function&) LLVM_DELETED_FUNCTION;
|
void operator=(const Function&) = delete;
|
||||||
|
|
||||||
/// Do the actual lookup of an intrinsic ID when the query could not be
|
/// Do the actual lookup of an intrinsic ID when the query could not be
|
||||||
/// answered from the cache.
|
/// answered from the cache.
|
||||||
|
@ -28,8 +28,8 @@ template<typename ValueSubClass, typename ItemParentClass>
|
|||||||
|
|
||||||
class GlobalAlias : public GlobalValue, public ilist_node<GlobalAlias> {
|
class GlobalAlias : public GlobalValue, public ilist_node<GlobalAlias> {
|
||||||
friend class SymbolTableListTraits<GlobalAlias, Module>;
|
friend class SymbolTableListTraits<GlobalAlias, Module>;
|
||||||
void operator=(const GlobalAlias &) LLVM_DELETED_FUNCTION;
|
void operator=(const GlobalAlias &) = delete;
|
||||||
GlobalAlias(const GlobalAlias &) LLVM_DELETED_FUNCTION;
|
GlobalAlias(const GlobalAlias &) = delete;
|
||||||
|
|
||||||
void setParent(Module *parent);
|
void setParent(Module *parent);
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ class Comdat;
|
|||||||
class Module;
|
class Module;
|
||||||
|
|
||||||
class GlobalObject : public GlobalValue {
|
class GlobalObject : public GlobalValue {
|
||||||
GlobalObject(const GlobalObject &) LLVM_DELETED_FUNCTION;
|
GlobalObject(const GlobalObject &) = delete;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
GlobalObject(Type *Ty, ValueTy VTy, Use *Ops, unsigned NumOps,
|
GlobalObject(Type *Ty, ValueTy VTy, Use *Ops, unsigned NumOps,
|
||||||
|
@ -29,7 +29,7 @@ class PointerType;
|
|||||||
class Module;
|
class Module;
|
||||||
|
|
||||||
class GlobalValue : public Constant {
|
class GlobalValue : public Constant {
|
||||||
GlobalValue(const GlobalValue &) LLVM_DELETED_FUNCTION;
|
GlobalValue(const GlobalValue &) = delete;
|
||||||
public:
|
public:
|
||||||
/// @brief An enumeration for the kinds of linkage for global values.
|
/// @brief An enumeration for the kinds of linkage for global values.
|
||||||
enum LinkageTypes {
|
enum LinkageTypes {
|
||||||
|
@ -34,9 +34,9 @@ template<typename ValueSubClass, typename ItemParentClass>
|
|||||||
|
|
||||||
class GlobalVariable : public GlobalObject, public ilist_node<GlobalVariable> {
|
class GlobalVariable : public GlobalObject, public ilist_node<GlobalVariable> {
|
||||||
friend class SymbolTableListTraits<GlobalVariable, Module>;
|
friend class SymbolTableListTraits<GlobalVariable, Module>;
|
||||||
void *operator new(size_t, unsigned) LLVM_DELETED_FUNCTION;
|
void *operator new(size_t, unsigned) = delete;
|
||||||
void operator=(const GlobalVariable &) LLVM_DELETED_FUNCTION;
|
void operator=(const GlobalVariable &) = delete;
|
||||||
GlobalVariable(const GlobalVariable &) LLVM_DELETED_FUNCTION;
|
GlobalVariable(const GlobalVariable &) = delete;
|
||||||
|
|
||||||
void setParent(Module *parent);
|
void setParent(Module *parent);
|
||||||
|
|
||||||
|
@ -198,8 +198,8 @@ public:
|
|||||||
BasicBlock::iterator Point;
|
BasicBlock::iterator Point;
|
||||||
DebugLoc DbgLoc;
|
DebugLoc DbgLoc;
|
||||||
|
|
||||||
InsertPointGuard(const InsertPointGuard &) LLVM_DELETED_FUNCTION;
|
InsertPointGuard(const InsertPointGuard &) = delete;
|
||||||
InsertPointGuard &operator=(const InsertPointGuard &) LLVM_DELETED_FUNCTION;
|
InsertPointGuard &operator=(const InsertPointGuard &) = delete;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
InsertPointGuard(IRBuilderBase &B)
|
InsertPointGuard(IRBuilderBase &B)
|
||||||
@ -219,9 +219,9 @@ public:
|
|||||||
FastMathFlags FMF;
|
FastMathFlags FMF;
|
||||||
MDNode *FPMathTag;
|
MDNode *FPMathTag;
|
||||||
|
|
||||||
FastMathFlagGuard(const FastMathFlagGuard &) LLVM_DELETED_FUNCTION;
|
FastMathFlagGuard(const FastMathFlagGuard &) = delete;
|
||||||
FastMathFlagGuard &operator=(
|
FastMathFlagGuard &operator=(
|
||||||
const FastMathFlagGuard &) LLVM_DELETED_FUNCTION;
|
const FastMathFlagGuard &) = delete;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FastMathFlagGuard(IRBuilderBase &B)
|
FastMathFlagGuard(IRBuilderBase &B)
|
||||||
@ -1295,7 +1295,7 @@ private:
|
|||||||
// \brief Provided to resolve 'CreateIntCast(Ptr, Ptr, "...")', giving a
|
// \brief Provided to resolve 'CreateIntCast(Ptr, Ptr, "...")', giving a
|
||||||
// compile time error, instead of converting the string to bool for the
|
// compile time error, instead of converting the string to bool for the
|
||||||
// isSigned parameter.
|
// isSigned parameter.
|
||||||
Value *CreateIntCast(Value *, Type *, const char *) LLVM_DELETED_FUNCTION;
|
Value *CreateIntCast(Value *, Type *, const char *) = delete;
|
||||||
public:
|
public:
|
||||||
Value *CreateFPCast(Value *V, Type *DestTy, const Twine &Name = "") {
|
Value *CreateFPCast(Value *V, Type *DestTy, const Twine &Name = "") {
|
||||||
if (V->getType() == DestTy)
|
if (V->getType() == DestTy)
|
||||||
|
@ -40,8 +40,8 @@ private:
|
|||||||
friend struct InlineAsmKeyType;
|
friend struct InlineAsmKeyType;
|
||||||
friend class ConstantUniqueMap<InlineAsm>;
|
friend class ConstantUniqueMap<InlineAsm>;
|
||||||
|
|
||||||
InlineAsm(const InlineAsm &) LLVM_DELETED_FUNCTION;
|
InlineAsm(const InlineAsm &) = delete;
|
||||||
void operator=(const InlineAsm&) LLVM_DELETED_FUNCTION;
|
void operator=(const InlineAsm&) = delete;
|
||||||
|
|
||||||
std::string AsmString, Constraints;
|
std::string AsmString, Constraints;
|
||||||
bool HasSideEffects;
|
bool HasSideEffects;
|
||||||
|
@ -83,7 +83,7 @@ public:
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
class UnaryInstruction : public Instruction {
|
class UnaryInstruction : public Instruction {
|
||||||
void *operator new(size_t, unsigned) LLVM_DELETED_FUNCTION;
|
void *operator new(size_t, unsigned) = delete;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
UnaryInstruction(Type *Ty, unsigned iType, Value *V,
|
UnaryInstruction(Type *Ty, unsigned iType, Value *V,
|
||||||
@ -132,7 +132,7 @@ DEFINE_TRANSPARENT_OPERAND_ACCESSORS(UnaryInstruction, Value)
|
|||||||
//===----------------------------------------------------------------------===//
|
//===----------------------------------------------------------------------===//
|
||||||
|
|
||||||
class BinaryOperator : public Instruction {
|
class BinaryOperator : public Instruction {
|
||||||
void *operator new(size_t, unsigned) LLVM_DELETED_FUNCTION;
|
void *operator new(size_t, unsigned) = delete;
|
||||||
protected:
|
protected:
|
||||||
void init(BinaryOps iType);
|
void init(BinaryOps iType);
|
||||||
BinaryOperator(BinaryOps iType, Value *S1, Value *S2, Type *Ty,
|
BinaryOperator(BinaryOps iType, Value *S1, Value *S2, Type *Ty,
|
||||||
@ -674,8 +674,8 @@ public:
|
|||||||
/// This class is the base class for the comparison instructions.
|
/// This class is the base class for the comparison instructions.
|
||||||
/// @brief Abstract base class of comparison instructions.
|
/// @brief Abstract base class of comparison instructions.
|
||||||
class CmpInst : public Instruction {
|
class CmpInst : public Instruction {
|
||||||
void *operator new(size_t, unsigned) LLVM_DELETED_FUNCTION;
|
void *operator new(size_t, unsigned) = delete;
|
||||||
CmpInst() LLVM_DELETED_FUNCTION;
|
CmpInst() = delete;
|
||||||
protected:
|
protected:
|
||||||
CmpInst(Type *ty, Instruction::OtherOps op, unsigned short pred,
|
CmpInst(Type *ty, Instruction::OtherOps op, unsigned short pred,
|
||||||
Value *LHS, Value *RHS, const Twine &Name = "",
|
Value *LHS, Value *RHS, const Twine &Name = "",
|
||||||
|
@ -31,8 +31,8 @@ template<typename ValueSubClass, typename ItemParentClass>
|
|||||||
class SymbolTableListTraits;
|
class SymbolTableListTraits;
|
||||||
|
|
||||||
class Instruction : public User, public ilist_node<Instruction> {
|
class Instruction : public User, public ilist_node<Instruction> {
|
||||||
void operator=(const Instruction &) LLVM_DELETED_FUNCTION;
|
void operator=(const Instruction &) = delete;
|
||||||
Instruction(const Instruction &) LLVM_DELETED_FUNCTION;
|
Instruction(const Instruction &) = delete;
|
||||||
|
|
||||||
BasicBlock *Parent;
|
BasicBlock *Parent;
|
||||||
DebugLoc DbgLoc; // 'dbg' Metadata cache.
|
DebugLoc DbgLoc; // 'dbg' Metadata cache.
|
||||||
|
@ -285,7 +285,7 @@ private:
|
|||||||
/// StoreInst - an instruction for storing to memory
|
/// StoreInst - an instruction for storing to memory
|
||||||
///
|
///
|
||||||
class StoreInst : public Instruction {
|
class StoreInst : public Instruction {
|
||||||
void *operator new(size_t, unsigned) LLVM_DELETED_FUNCTION;
|
void *operator new(size_t, unsigned) = delete;
|
||||||
void AssertOK();
|
void AssertOK();
|
||||||
protected:
|
protected:
|
||||||
StoreInst *clone_impl() const override;
|
StoreInst *clone_impl() const override;
|
||||||
@ -411,7 +411,7 @@ DEFINE_TRANSPARENT_OPERAND_ACCESSORS(StoreInst, Value)
|
|||||||
/// FenceInst - an instruction for ordering other memory operations
|
/// FenceInst - an instruction for ordering other memory operations
|
||||||
///
|
///
|
||||||
class FenceInst : public Instruction {
|
class FenceInst : public Instruction {
|
||||||
void *operator new(size_t, unsigned) LLVM_DELETED_FUNCTION;
|
void *operator new(size_t, unsigned) = delete;
|
||||||
void Init(AtomicOrdering Ordering, SynchronizationScope SynchScope);
|
void Init(AtomicOrdering Ordering, SynchronizationScope SynchScope);
|
||||||
protected:
|
protected:
|
||||||
FenceInst *clone_impl() const override;
|
FenceInst *clone_impl() const override;
|
||||||
@ -478,7 +478,7 @@ private:
|
|||||||
/// there. Returns the value that was loaded.
|
/// there. Returns the value that was loaded.
|
||||||
///
|
///
|
||||||
class AtomicCmpXchgInst : public Instruction {
|
class AtomicCmpXchgInst : public Instruction {
|
||||||
void *operator new(size_t, unsigned) LLVM_DELETED_FUNCTION;
|
void *operator new(size_t, unsigned) = delete;
|
||||||
void Init(Value *Ptr, Value *Cmp, Value *NewVal,
|
void Init(Value *Ptr, Value *Cmp, Value *NewVal,
|
||||||
AtomicOrdering SuccessOrdering, AtomicOrdering FailureOrdering,
|
AtomicOrdering SuccessOrdering, AtomicOrdering FailureOrdering,
|
||||||
SynchronizationScope SynchScope);
|
SynchronizationScope SynchScope);
|
||||||
@ -634,7 +634,7 @@ DEFINE_TRANSPARENT_OPERAND_ACCESSORS(AtomicCmpXchgInst, Value)
|
|||||||
/// the old value.
|
/// the old value.
|
||||||
///
|
///
|
||||||
class AtomicRMWInst : public Instruction {
|
class AtomicRMWInst : public Instruction {
|
||||||
void *operator new(size_t, unsigned) LLVM_DELETED_FUNCTION;
|
void *operator new(size_t, unsigned) = delete;
|
||||||
protected:
|
protected:
|
||||||
AtomicRMWInst *clone_impl() const override;
|
AtomicRMWInst *clone_impl() const override;
|
||||||
public:
|
public:
|
||||||
@ -1961,7 +1961,7 @@ ExtractValueInst::ExtractValueInst(Value *Agg,
|
|||||||
class InsertValueInst : public Instruction {
|
class InsertValueInst : public Instruction {
|
||||||
SmallVector<unsigned, 4> Indices;
|
SmallVector<unsigned, 4> Indices;
|
||||||
|
|
||||||
void *operator new(size_t, unsigned) LLVM_DELETED_FUNCTION;
|
void *operator new(size_t, unsigned) = delete;
|
||||||
InsertValueInst(const InsertValueInst &IVI);
|
InsertValueInst(const InsertValueInst &IVI);
|
||||||
void init(Value *Agg, Value *Val, ArrayRef<unsigned> Idxs,
|
void init(Value *Agg, Value *Val, ArrayRef<unsigned> Idxs,
|
||||||
const Twine &NameStr);
|
const Twine &NameStr);
|
||||||
@ -2091,7 +2091,7 @@ DEFINE_TRANSPARENT_OPERAND_ACCESSORS(InsertValueInst, Value)
|
|||||||
// scientist's overactive imagination.
|
// scientist's overactive imagination.
|
||||||
//
|
//
|
||||||
class PHINode : public Instruction {
|
class PHINode : public Instruction {
|
||||||
void *operator new(size_t, unsigned) LLVM_DELETED_FUNCTION;
|
void *operator new(size_t, unsigned) = delete;
|
||||||
/// ReservedSpace - The number of operands actually allocated. NumOperands is
|
/// ReservedSpace - The number of operands actually allocated. NumOperands is
|
||||||
/// the number actually in use.
|
/// the number actually in use.
|
||||||
unsigned ReservedSpace;
|
unsigned ReservedSpace;
|
||||||
@ -2298,7 +2298,7 @@ class LandingPadInst : public Instruction {
|
|||||||
public:
|
public:
|
||||||
enum ClauseType { Catch, Filter };
|
enum ClauseType { Catch, Filter };
|
||||||
private:
|
private:
|
||||||
void *operator new(size_t, unsigned) LLVM_DELETED_FUNCTION;
|
void *operator new(size_t, unsigned) = delete;
|
||||||
// Allocate space for exactly zero operands.
|
// Allocate space for exactly zero operands.
|
||||||
void *operator new(size_t s) {
|
void *operator new(size_t s) {
|
||||||
return User::operator new(s, 0);
|
return User::operator new(s, 0);
|
||||||
@ -2565,7 +2565,7 @@ DEFINE_TRANSPARENT_OPERAND_ACCESSORS(BranchInst, Value)
|
|||||||
/// SwitchInst - Multiway switch
|
/// SwitchInst - Multiway switch
|
||||||
///
|
///
|
||||||
class SwitchInst : public TerminatorInst {
|
class SwitchInst : public TerminatorInst {
|
||||||
void *operator new(size_t, unsigned) LLVM_DELETED_FUNCTION;
|
void *operator new(size_t, unsigned) = delete;
|
||||||
unsigned ReservedSpace;
|
unsigned ReservedSpace;
|
||||||
// Operand[0] = Value to switch on
|
// Operand[0] = Value to switch on
|
||||||
// Operand[1] = Default basic block destination
|
// Operand[1] = Default basic block destination
|
||||||
@ -2874,7 +2874,7 @@ DEFINE_TRANSPARENT_OPERAND_ACCESSORS(SwitchInst, Value)
|
|||||||
/// IndirectBrInst - Indirect Branch Instruction.
|
/// IndirectBrInst - Indirect Branch Instruction.
|
||||||
///
|
///
|
||||||
class IndirectBrInst : public TerminatorInst {
|
class IndirectBrInst : public TerminatorInst {
|
||||||
void *operator new(size_t, unsigned) LLVM_DELETED_FUNCTION;
|
void *operator new(size_t, unsigned) = delete;
|
||||||
unsigned ReservedSpace;
|
unsigned ReservedSpace;
|
||||||
// Operand[0] = Value to switch on
|
// Operand[0] = Value to switch on
|
||||||
// Operand[1] = Default basic block destination
|
// Operand[1] = Default basic block destination
|
||||||
@ -3302,7 +3302,7 @@ DEFINE_TRANSPARENT_OPERAND_ACCESSORS(ResumeInst, Value)
|
|||||||
/// end of the block cannot be reached.
|
/// end of the block cannot be reached.
|
||||||
///
|
///
|
||||||
class UnreachableInst : public TerminatorInst {
|
class UnreachableInst : public TerminatorInst {
|
||||||
void *operator new(size_t, unsigned) LLVM_DELETED_FUNCTION;
|
void *operator new(size_t, unsigned) = delete;
|
||||||
protected:
|
protected:
|
||||||
UnreachableInst *clone_impl() const override;
|
UnreachableInst *clone_impl() const override;
|
||||||
|
|
||||||
|
@ -35,9 +35,9 @@ namespace llvm {
|
|||||||
/// functions. This allows the standard isa/dyncast/cast functionality to
|
/// functions. This allows the standard isa/dyncast/cast functionality to
|
||||||
/// work with calls to intrinsic functions.
|
/// work with calls to intrinsic functions.
|
||||||
class IntrinsicInst : public CallInst {
|
class IntrinsicInst : public CallInst {
|
||||||
IntrinsicInst() LLVM_DELETED_FUNCTION;
|
IntrinsicInst() = delete;
|
||||||
IntrinsicInst(const IntrinsicInst&) LLVM_DELETED_FUNCTION;
|
IntrinsicInst(const IntrinsicInst&) = delete;
|
||||||
void operator=(const IntrinsicInst&) LLVM_DELETED_FUNCTION;
|
void operator=(const IntrinsicInst&) = delete;
|
||||||
public:
|
public:
|
||||||
/// getIntrinsicID - Return the intrinsic ID of this intrinsic.
|
/// getIntrinsicID - Return the intrinsic ID of this intrinsic.
|
||||||
///
|
///
|
||||||
|
@ -176,8 +176,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LLVMContext(LLVMContext&) LLVM_DELETED_FUNCTION;
|
LLVMContext(LLVMContext&) = delete;
|
||||||
void operator=(LLVMContext&) LLVM_DELETED_FUNCTION;
|
void operator=(LLVMContext&) = delete;
|
||||||
|
|
||||||
/// addModule - Register a module as being instantiated in this context. If
|
/// addModule - Register a module as being instantiated in this context. If
|
||||||
/// the context is deleted, the module will be deleted as well.
|
/// the context is deleted, the module will be deleted as well.
|
||||||
|
@ -464,9 +464,9 @@ dyn_extract_or_null(Y &&MD) {
|
|||||||
class MDString : public Metadata {
|
class MDString : public Metadata {
|
||||||
friend class StringMapEntry<MDString>;
|
friend class StringMapEntry<MDString>;
|
||||||
|
|
||||||
MDString(const MDString &) LLVM_DELETED_FUNCTION;
|
MDString(const MDString &) = delete;
|
||||||
MDString &operator=(MDString &&) LLVM_DELETED_FUNCTION;
|
MDString &operator=(MDString &&) = delete;
|
||||||
MDString &operator=(const MDString &) LLVM_DELETED_FUNCTION;
|
MDString &operator=(const MDString &) = delete;
|
||||||
|
|
||||||
StringMapEntry<MDString> *Entry;
|
StringMapEntry<MDString> *Entry;
|
||||||
MDString() : Metadata(MDStringKind, Uniqued), Entry(nullptr) {}
|
MDString() : Metadata(MDStringKind, Uniqued), Entry(nullptr) {}
|
||||||
@ -551,10 +551,10 @@ struct DenseMapInfo<AAMDNodes> {
|
|||||||
///
|
///
|
||||||
/// In particular, this is used by \a MDNode.
|
/// In particular, this is used by \a MDNode.
|
||||||
class MDOperand {
|
class MDOperand {
|
||||||
MDOperand(MDOperand &&) LLVM_DELETED_FUNCTION;
|
MDOperand(MDOperand &&) = delete;
|
||||||
MDOperand(const MDOperand &) LLVM_DELETED_FUNCTION;
|
MDOperand(const MDOperand &) = delete;
|
||||||
MDOperand &operator=(MDOperand &&) LLVM_DELETED_FUNCTION;
|
MDOperand &operator=(MDOperand &&) = delete;
|
||||||
MDOperand &operator=(const MDOperand &) LLVM_DELETED_FUNCTION;
|
MDOperand &operator=(const MDOperand &) = delete;
|
||||||
|
|
||||||
Metadata *MD;
|
Metadata *MD;
|
||||||
|
|
||||||
@ -610,15 +610,12 @@ template <> struct simplify_type<const MDOperand> {
|
|||||||
class ContextAndReplaceableUses {
|
class ContextAndReplaceableUses {
|
||||||
PointerUnion<LLVMContext *, ReplaceableMetadataImpl *> Ptr;
|
PointerUnion<LLVMContext *, ReplaceableMetadataImpl *> Ptr;
|
||||||
|
|
||||||
ContextAndReplaceableUses() LLVM_DELETED_FUNCTION;
|
ContextAndReplaceableUses() = delete;
|
||||||
ContextAndReplaceableUses(ContextAndReplaceableUses &&)
|
ContextAndReplaceableUses(ContextAndReplaceableUses &&) = delete;
|
||||||
LLVM_DELETED_FUNCTION;
|
ContextAndReplaceableUses(const ContextAndReplaceableUses &) = delete;
|
||||||
ContextAndReplaceableUses(const ContextAndReplaceableUses &)
|
ContextAndReplaceableUses &operator=(ContextAndReplaceableUses &&) = delete;
|
||||||
LLVM_DELETED_FUNCTION;
|
|
||||||
ContextAndReplaceableUses &
|
ContextAndReplaceableUses &
|
||||||
operator=(ContextAndReplaceableUses &&) LLVM_DELETED_FUNCTION;
|
operator=(const ContextAndReplaceableUses &) = delete;
|
||||||
ContextAndReplaceableUses &
|
|
||||||
operator=(const ContextAndReplaceableUses &) LLVM_DELETED_FUNCTION;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ContextAndReplaceableUses(LLVMContext &Context) : Ptr(&Context) {}
|
ContextAndReplaceableUses(LLVMContext &Context) : Ptr(&Context) {}
|
||||||
@ -700,9 +697,9 @@ class MDNode : public Metadata {
|
|||||||
friend class ReplaceableMetadataImpl;
|
friend class ReplaceableMetadataImpl;
|
||||||
friend class LLVMContextImpl;
|
friend class LLVMContextImpl;
|
||||||
|
|
||||||
MDNode(const MDNode &) LLVM_DELETED_FUNCTION;
|
MDNode(const MDNode &) = delete;
|
||||||
void operator=(const MDNode &) LLVM_DELETED_FUNCTION;
|
void operator=(const MDNode &) = delete;
|
||||||
void *operator new(size_t) LLVM_DELETED_FUNCTION;
|
void *operator new(size_t) = delete;
|
||||||
|
|
||||||
unsigned NumOperands;
|
unsigned NumOperands;
|
||||||
unsigned NumUnresolved;
|
unsigned NumUnresolved;
|
||||||
@ -1011,7 +1008,7 @@ class NamedMDNode : public ilist_node<NamedMDNode> {
|
|||||||
friend struct ilist_traits<NamedMDNode>;
|
friend struct ilist_traits<NamedMDNode>;
|
||||||
friend class LLVMContextImpl;
|
friend class LLVMContextImpl;
|
||||||
friend class Module;
|
friend class Module;
|
||||||
NamedMDNode(const NamedMDNode &) LLVM_DELETED_FUNCTION;
|
NamedMDNode(const NamedMDNode &) = delete;
|
||||||
|
|
||||||
std::string Name;
|
std::string Name;
|
||||||
Module *Parent;
|
Module *Parent;
|
||||||
|
@ -34,12 +34,12 @@ class Operator : public User {
|
|||||||
private:
|
private:
|
||||||
// The Operator class is intended to be used as a utility, and is never itself
|
// The Operator class is intended to be used as a utility, and is never itself
|
||||||
// instantiated.
|
// instantiated.
|
||||||
void *operator new(size_t, unsigned) LLVM_DELETED_FUNCTION;
|
void *operator new(size_t, unsigned) = delete;
|
||||||
void *operator new(size_t s) LLVM_DELETED_FUNCTION;
|
void *operator new(size_t s) = delete;
|
||||||
Operator() LLVM_DELETED_FUNCTION;
|
Operator() = delete;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// NOTE: Cannot use LLVM_DELETED_FUNCTION because it's not legal to delete
|
// NOTE: Cannot use = delete because it's not legal to delete
|
||||||
// an overridden method that's not deleted in the base class. Cannot leave
|
// an overridden method that's not deleted in the base class. Cannot leave
|
||||||
// this unimplemented because that leads to an ODR-violation.
|
// this unimplemented because that leads to an ODR-violation.
|
||||||
~Operator();
|
~Operator();
|
||||||
|
@ -241,8 +241,8 @@ public:
|
|||||||
private:
|
private:
|
||||||
typedef detail::PassConcept<IRUnitT> PassConceptT;
|
typedef detail::PassConcept<IRUnitT> PassConceptT;
|
||||||
|
|
||||||
PassManager(const PassManager &) LLVM_DELETED_FUNCTION;
|
PassManager(const PassManager &) = delete;
|
||||||
PassManager &operator=(const PassManager &) LLVM_DELETED_FUNCTION;
|
PassManager &operator=(const PassManager &) = delete;
|
||||||
|
|
||||||
std::vector<std::unique_ptr<PassConceptT>> Passes;
|
std::vector<std::unique_ptr<PassConceptT>> Passes;
|
||||||
|
|
||||||
@ -281,9 +281,9 @@ template <typename DerivedT, typename IRUnitT> class AnalysisManagerBase {
|
|||||||
return static_cast<const DerivedT *>(this);
|
return static_cast<const DerivedT *>(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
AnalysisManagerBase(const AnalysisManagerBase &) LLVM_DELETED_FUNCTION;
|
AnalysisManagerBase(const AnalysisManagerBase &) = delete;
|
||||||
AnalysisManagerBase &
|
AnalysisManagerBase &
|
||||||
operator=(const AnalysisManagerBase &) LLVM_DELETED_FUNCTION;
|
operator=(const AnalysisManagerBase &) = delete;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
typedef detail::AnalysisResultConcept<IRUnitT> ResultConceptT;
|
typedef detail::AnalysisResultConcept<IRUnitT> ResultConceptT;
|
||||||
@ -453,8 +453,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AnalysisManager(const AnalysisManager &) LLVM_DELETED_FUNCTION;
|
AnalysisManager(const AnalysisManager &) = delete;
|
||||||
AnalysisManager &operator=(const AnalysisManager &) LLVM_DELETED_FUNCTION;
|
AnalysisManager &operator=(const AnalysisManager &) = delete;
|
||||||
|
|
||||||
/// \brief Get an analysis result, running the pass if necessary.
|
/// \brief Get an analysis result, running the pass if necessary.
|
||||||
ResultConceptT &getResultImpl(void *PassID, IRUnitT &IR) {
|
ResultConceptT &getResultImpl(void *PassID, IRUnitT &IR) {
|
||||||
|
@ -45,8 +45,8 @@ bool isGCResult(const ImmutableCallSite &CS);
|
|||||||
template <typename InstructionTy, typename ValueTy, typename CallSiteTy>
|
template <typename InstructionTy, typename ValueTy, typename CallSiteTy>
|
||||||
class StatepointBase {
|
class StatepointBase {
|
||||||
CallSiteTy StatepointCS;
|
CallSiteTy StatepointCS;
|
||||||
void *operator new(size_t, unsigned) LLVM_DELETED_FUNCTION;
|
void *operator new(size_t, unsigned) = delete;
|
||||||
void *operator new(size_t s) LLVM_DELETED_FUNCTION;
|
void *operator new(size_t s) = delete;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
explicit StatepointBase(InstructionTy *I) : StatepointCS(I) {
|
explicit StatepointBase(InstructionTy *I) : StatepointCS(I) {
|
||||||
|
@ -77,7 +77,7 @@ public:
|
|||||||
typedef PointerIntPair<User *, 1, unsigned> UserRef;
|
typedef PointerIntPair<User *, 1, unsigned> UserRef;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Use(const Use &U) LLVM_DELETED_FUNCTION;
|
Use(const Use &U) = delete;
|
||||||
|
|
||||||
/// Destructor - Only for zap()
|
/// Destructor - Only for zap()
|
||||||
~Use() {
|
~Use() {
|
||||||
|
@ -45,8 +45,8 @@ struct UseListOrder {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
UseListOrder(const UseListOrder &X) LLVM_DELETED_FUNCTION;
|
UseListOrder(const UseListOrder &X) = delete;
|
||||||
UseListOrder &operator=(const UseListOrder &X) LLVM_DELETED_FUNCTION;
|
UseListOrder &operator=(const UseListOrder &X) = delete;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector<UseListOrder> UseListOrderStack;
|
typedef std::vector<UseListOrder> UseListOrderStack;
|
||||||
|
@ -33,8 +33,8 @@ template <class>
|
|||||||
struct OperandTraits;
|
struct OperandTraits;
|
||||||
|
|
||||||
class User : public Value {
|
class User : public Value {
|
||||||
User(const User &) LLVM_DELETED_FUNCTION;
|
User(const User &) = delete;
|
||||||
void *operator new(size_t) LLVM_DELETED_FUNCTION;
|
void *operator new(size_t) = delete;
|
||||||
template <unsigned>
|
template <unsigned>
|
||||||
friend struct HungoffOperandTraits;
|
friend struct HungoffOperandTraits;
|
||||||
virtual void anchor();
|
virtual void anchor();
|
||||||
|
@ -180,8 +180,8 @@ private:
|
|||||||
Use &getUse() const { return *UI; }
|
Use &getUse() const { return *UI; }
|
||||||
};
|
};
|
||||||
|
|
||||||
void operator=(const Value &) LLVM_DELETED_FUNCTION;
|
void operator=(const Value &) = delete;
|
||||||
Value(const Value &) LLVM_DELETED_FUNCTION;
|
Value(const Value &) = delete;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Value(Type *Ty, unsigned scid);
|
Value(Type *Ty, unsigned scid);
|
||||||
|
@ -58,7 +58,7 @@ private:
|
|||||||
|
|
||||||
Value* V;
|
Value* V;
|
||||||
|
|
||||||
ValueHandleBase(const ValueHandleBase&) LLVM_DELETED_FUNCTION;
|
ValueHandleBase(const ValueHandleBase&) = delete;
|
||||||
public:
|
public:
|
||||||
explicit ValueHandleBase(HandleBaseKind Kind)
|
explicit ValueHandleBase(HandleBaseKind Kind)
|
||||||
: PrevPair(nullptr, Kind), Next(nullptr), V(nullptr) {}
|
: PrevPair(nullptr, Kind), Next(nullptr), V(nullptr) {}
|
||||||
|
@ -86,8 +86,8 @@ class ValueMap {
|
|||||||
MapT Map;
|
MapT Map;
|
||||||
std::unique_ptr<MDMapT> MDMap;
|
std::unique_ptr<MDMapT> MDMap;
|
||||||
ExtraData Data;
|
ExtraData Data;
|
||||||
ValueMap(const ValueMap&) LLVM_DELETED_FUNCTION;
|
ValueMap(const ValueMap&) = delete;
|
||||||
ValueMap& operator=(const ValueMap&) LLVM_DELETED_FUNCTION;
|
ValueMap& operator=(const ValueMap&) = delete;
|
||||||
public:
|
public:
|
||||||
typedef KeyT key_type;
|
typedef KeyT key_type;
|
||||||
typedef ValueT mapped_type;
|
typedef ValueT mapped_type;
|
||||||
|
@ -32,8 +32,8 @@ class raw_ostream;
|
|||||||
|
|
||||||
/// MCAsmBackend - Generic interface to target specific assembler backends.
|
/// MCAsmBackend - Generic interface to target specific assembler backends.
|
||||||
class MCAsmBackend {
|
class MCAsmBackend {
|
||||||
MCAsmBackend(const MCAsmBackend &) LLVM_DELETED_FUNCTION;
|
MCAsmBackend(const MCAsmBackend &) = delete;
|
||||||
void operator=(const MCAsmBackend &) LLVM_DELETED_FUNCTION;
|
void operator=(const MCAsmBackend &) = delete;
|
||||||
|
|
||||||
protected: // Can only create subclasses.
|
protected: // Can only create subclasses.
|
||||||
MCAsmBackend();
|
MCAsmBackend();
|
||||||
|
@ -47,8 +47,8 @@ class MCAsmBackend;
|
|||||||
class MCFragment : public ilist_node<MCFragment> {
|
class MCFragment : public ilist_node<MCFragment> {
|
||||||
friend class MCAsmLayout;
|
friend class MCAsmLayout;
|
||||||
|
|
||||||
MCFragment(const MCFragment&) LLVM_DELETED_FUNCTION;
|
MCFragment(const MCFragment&) = delete;
|
||||||
void operator=(const MCFragment&) LLVM_DELETED_FUNCTION;
|
void operator=(const MCFragment&) = delete;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum FragmentType {
|
enum FragmentType {
|
||||||
@ -563,8 +563,8 @@ public:
|
|||||||
class MCSectionData : public ilist_node<MCSectionData> {
|
class MCSectionData : public ilist_node<MCSectionData> {
|
||||||
friend class MCAsmLayout;
|
friend class MCAsmLayout;
|
||||||
|
|
||||||
MCSectionData(const MCSectionData&) LLVM_DELETED_FUNCTION;
|
MCSectionData(const MCSectionData&) = delete;
|
||||||
void operator=(const MCSectionData&) LLVM_DELETED_FUNCTION;
|
void operator=(const MCSectionData&) = delete;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef iplist<MCFragment> FragmentListType;
|
typedef iplist<MCFragment> FragmentListType;
|
||||||
@ -865,8 +865,8 @@ public:
|
|||||||
unsigned Update;
|
unsigned Update;
|
||||||
} VersionMinInfoType;
|
} VersionMinInfoType;
|
||||||
private:
|
private:
|
||||||
MCAssembler(const MCAssembler&) LLVM_DELETED_FUNCTION;
|
MCAssembler(const MCAssembler&) = delete;
|
||||||
void operator=(const MCAssembler&) LLVM_DELETED_FUNCTION;
|
void operator=(const MCAssembler&) = delete;
|
||||||
|
|
||||||
MCContext &Context;
|
MCContext &Context;
|
||||||
|
|
||||||
|
@ -22,8 +22,8 @@ template<typename T> class SmallVectorImpl;
|
|||||||
/// MCCodeEmitter - Generic instruction encoding interface.
|
/// MCCodeEmitter - Generic instruction encoding interface.
|
||||||
class MCCodeEmitter {
|
class MCCodeEmitter {
|
||||||
private:
|
private:
|
||||||
MCCodeEmitter(const MCCodeEmitter &) LLVM_DELETED_FUNCTION;
|
MCCodeEmitter(const MCCodeEmitter &) = delete;
|
||||||
void operator=(const MCCodeEmitter &) LLVM_DELETED_FUNCTION;
|
void operator=(const MCCodeEmitter &) = delete;
|
||||||
protected: // Can only create subclasses.
|
protected: // Can only create subclasses.
|
||||||
MCCodeEmitter();
|
MCCodeEmitter();
|
||||||
|
|
||||||
|
@ -47,8 +47,8 @@ namespace llvm {
|
|||||||
/// of the sections that it creates.
|
/// of the sections that it creates.
|
||||||
///
|
///
|
||||||
class MCContext {
|
class MCContext {
|
||||||
MCContext(const MCContext&) LLVM_DELETED_FUNCTION;
|
MCContext(const MCContext&) = delete;
|
||||||
MCContext &operator=(const MCContext&) LLVM_DELETED_FUNCTION;
|
MCContext &operator=(const MCContext&) = delete;
|
||||||
public:
|
public:
|
||||||
typedef StringMap<MCSymbol*, BumpPtrAllocator&> SymbolTable;
|
typedef StringMap<MCSymbol*, BumpPtrAllocator&> SymbolTable;
|
||||||
private:
|
private:
|
||||||
|
@ -44,8 +44,8 @@ public:
|
|||||||
private:
|
private:
|
||||||
ExprKind Kind;
|
ExprKind Kind;
|
||||||
|
|
||||||
MCExpr(const MCExpr&) LLVM_DELETED_FUNCTION;
|
MCExpr(const MCExpr&) = delete;
|
||||||
void operator=(const MCExpr&) LLVM_DELETED_FUNCTION;
|
void operator=(const MCExpr&) = delete;
|
||||||
|
|
||||||
bool EvaluateAsAbsolute(int64_t &Res, const MCAssembler *Asm,
|
bool EvaluateAsAbsolute(int64_t &Res, const MCAssembler *Asm,
|
||||||
const MCAsmLayout *Layout,
|
const MCAsmLayout *Layout,
|
||||||
|
@ -32,8 +32,8 @@ namespace llvm {
|
|||||||
MCLabel(unsigned instance)
|
MCLabel(unsigned instance)
|
||||||
: Instance(instance) {}
|
: Instance(instance) {}
|
||||||
|
|
||||||
MCLabel(const MCLabel&) LLVM_DELETED_FUNCTION;
|
MCLabel(const MCLabel&) = delete;
|
||||||
void operator=(const MCLabel&) LLVM_DELETED_FUNCTION;
|
void operator=(const MCLabel&) = delete;
|
||||||
public:
|
public:
|
||||||
/// getInstance - Get the current instance of this Directional Local Label.
|
/// getInstance - Get the current instance of this Directional Local Label.
|
||||||
unsigned getInstance() const { return Instance; }
|
unsigned getInstance() const { return Instance; }
|
||||||
|
@ -37,8 +37,8 @@ class MCValue;
|
|||||||
/// The object writer also contains a number of helper methods for writing
|
/// The object writer also contains a number of helper methods for writing
|
||||||
/// binary data to the output stream.
|
/// binary data to the output stream.
|
||||||
class MCObjectWriter {
|
class MCObjectWriter {
|
||||||
MCObjectWriter(const MCObjectWriter &) LLVM_DELETED_FUNCTION;
|
MCObjectWriter(const MCObjectWriter &) = delete;
|
||||||
void operator=(const MCObjectWriter &) LLVM_DELETED_FUNCTION;
|
void operator=(const MCObjectWriter &) = delete;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
raw_ostream &OS;
|
raw_ostream &OS;
|
||||||
|
@ -31,8 +31,8 @@ class AsmLexer : public MCAsmLexer {
|
|||||||
StringRef CurBuf;
|
StringRef CurBuf;
|
||||||
bool isAtStartOfLine;
|
bool isAtStartOfLine;
|
||||||
|
|
||||||
void operator=(const AsmLexer&) LLVM_DELETED_FUNCTION;
|
void operator=(const AsmLexer&) = delete;
|
||||||
AsmLexer(const AsmLexer&) LLVM_DELETED_FUNCTION;
|
AsmLexer(const AsmLexer&) = delete;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// LexToken - Read the next token and return its code.
|
/// LexToken - Read the next token and return its code.
|
||||||
|
@ -124,8 +124,8 @@ class MCAsmLexer {
|
|||||||
SMLoc ErrLoc;
|
SMLoc ErrLoc;
|
||||||
std::string Err;
|
std::string Err;
|
||||||
|
|
||||||
MCAsmLexer(const MCAsmLexer &) LLVM_DELETED_FUNCTION;
|
MCAsmLexer(const MCAsmLexer &) = delete;
|
||||||
void operator=(const MCAsmLexer &) LLVM_DELETED_FUNCTION;
|
void operator=(const MCAsmLexer &) = delete;
|
||||||
protected: // Can only create subclasses.
|
protected: // Can only create subclasses.
|
||||||
const char *TokStart;
|
const char *TokStart;
|
||||||
bool SkipSpace;
|
bool SkipSpace;
|
||||||
|
@ -68,8 +68,8 @@ public:
|
|||||||
ExtensionDirectiveHandler;
|
ExtensionDirectiveHandler;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MCAsmParser(const MCAsmParser &) LLVM_DELETED_FUNCTION;
|
MCAsmParser(const MCAsmParser &) = delete;
|
||||||
void operator=(const MCAsmParser &) LLVM_DELETED_FUNCTION;
|
void operator=(const MCAsmParser &) = delete;
|
||||||
|
|
||||||
MCTargetAsmParser *TargetParser;
|
MCTargetAsmParser *TargetParser;
|
||||||
|
|
||||||
|
@ -21,8 +21,8 @@ class Twine;
|
|||||||
/// which is implemented by target and object file assembly parser
|
/// which is implemented by target and object file assembly parser
|
||||||
/// implementations.
|
/// implementations.
|
||||||
class MCAsmParserExtension {
|
class MCAsmParserExtension {
|
||||||
MCAsmParserExtension(const MCAsmParserExtension &) LLVM_DELETED_FUNCTION;
|
MCAsmParserExtension(const MCAsmParserExtension &) = delete;
|
||||||
void operator=(const MCAsmParserExtension &) LLVM_DELETED_FUNCTION;
|
void operator=(const MCAsmParserExtension &) = delete;
|
||||||
|
|
||||||
MCAsmParser *Parser;
|
MCAsmParser *Parser;
|
||||||
|
|
||||||
|
@ -28,8 +28,8 @@ class MCContext;
|
|||||||
|
|
||||||
/// \brief Create MCExprs from relocations found in an object file.
|
/// \brief Create MCExprs from relocations found in an object file.
|
||||||
class MCRelocationInfo {
|
class MCRelocationInfo {
|
||||||
MCRelocationInfo(const MCRelocationInfo &) LLVM_DELETED_FUNCTION;
|
MCRelocationInfo(const MCRelocationInfo &) = delete;
|
||||||
void operator=(const MCRelocationInfo &) LLVM_DELETED_FUNCTION;
|
void operator=(const MCRelocationInfo &) = delete;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
MCContext &Ctx;
|
MCContext &Ctx;
|
||||||
|
@ -35,8 +35,8 @@ namespace llvm {
|
|||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MCSection(const MCSection&) LLVM_DELETED_FUNCTION;
|
MCSection(const MCSection&) = delete;
|
||||||
void operator=(const MCSection&) LLVM_DELETED_FUNCTION;
|
void operator=(const MCSection&) = delete;
|
||||||
protected:
|
protected:
|
||||||
MCSection(SectionVariant V, SectionKind K) : Variant(V), Kind(K) {}
|
MCSection(SectionVariant V, SectionKind K) : Variant(V), Kind(K) {}
|
||||||
SectionVariant Variant;
|
SectionVariant Variant;
|
||||||
|
@ -175,8 +175,8 @@ class MCStreamer {
|
|||||||
MCContext &Context;
|
MCContext &Context;
|
||||||
std::unique_ptr<MCTargetStreamer> TargetStreamer;
|
std::unique_ptr<MCTargetStreamer> TargetStreamer;
|
||||||
|
|
||||||
MCStreamer(const MCStreamer &) LLVM_DELETED_FUNCTION;
|
MCStreamer(const MCStreamer &) = delete;
|
||||||
MCStreamer &operator=(const MCStreamer &) LLVM_DELETED_FUNCTION;
|
MCStreamer &operator=(const MCStreamer &) = delete;
|
||||||
|
|
||||||
std::vector<MCDwarfFrameInfo> DwarfFrameInfos;
|
std::vector<MCDwarfFrameInfo> DwarfFrameInfos;
|
||||||
MCDwarfFrameInfo *getCurrentDwarfFrameInfo();
|
MCDwarfFrameInfo *getCurrentDwarfFrameInfo();
|
||||||
|
@ -66,8 +66,8 @@ namespace llvm {
|
|||||||
: Name(name), Section(nullptr), Value(nullptr),
|
: Name(name), Section(nullptr), Value(nullptr),
|
||||||
IsTemporary(isTemporary), IsRedefinable(false), IsUsed(false) {}
|
IsTemporary(isTemporary), IsRedefinable(false), IsUsed(false) {}
|
||||||
|
|
||||||
MCSymbol(const MCSymbol&) LLVM_DELETED_FUNCTION;
|
MCSymbol(const MCSymbol&) = delete;
|
||||||
void operator=(const MCSymbol&) LLVM_DELETED_FUNCTION;
|
void operator=(const MCSymbol&) = delete;
|
||||||
public:
|
public:
|
||||||
/// getName - Get the symbol name.
|
/// getName - Get the symbol name.
|
||||||
StringRef getName() const { return Name; }
|
StringRef getName() const { return Name; }
|
||||||
|
@ -38,8 +38,8 @@ class raw_ostream;
|
|||||||
/// operands are actually symbolizable, and in what way. I don't think this
|
/// operands are actually symbolizable, and in what way. I don't think this
|
||||||
/// information exists right now.
|
/// information exists right now.
|
||||||
class MCSymbolizer {
|
class MCSymbolizer {
|
||||||
MCSymbolizer(const MCSymbolizer &) LLVM_DELETED_FUNCTION;
|
MCSymbolizer(const MCSymbolizer &) = delete;
|
||||||
void operator=(const MCSymbolizer &) LLVM_DELETED_FUNCTION;
|
void operator=(const MCSymbolizer &) = delete;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
MCContext &Ctx;
|
MCContext &Ctx;
|
||||||
|
@ -91,8 +91,8 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MCTargetAsmParser(const MCTargetAsmParser &) LLVM_DELETED_FUNCTION;
|
MCTargetAsmParser(const MCTargetAsmParser &) = delete;
|
||||||
void operator=(const MCTargetAsmParser &) LLVM_DELETED_FUNCTION;
|
void operator=(const MCTargetAsmParser &) = delete;
|
||||||
protected: // Can only create subclasses.
|
protected: // Can only create subclasses.
|
||||||
MCTargetAsmParser();
|
MCTargetAsmParser();
|
||||||
|
|
||||||
|
@ -28,8 +28,8 @@ namespace object {
|
|||||||
|
|
||||||
class Binary {
|
class Binary {
|
||||||
private:
|
private:
|
||||||
Binary() LLVM_DELETED_FUNCTION;
|
Binary() = delete;
|
||||||
Binary(const Binary &other) LLVM_DELETED_FUNCTION;
|
Binary(const Binary &other) = delete;
|
||||||
|
|
||||||
unsigned int TypeID;
|
unsigned int TypeID;
|
||||||
|
|
||||||
|
@ -180,8 +180,8 @@ public:
|
|||||||
/// figures out which type to create.
|
/// figures out which type to create.
|
||||||
class ObjectFile : public SymbolicFile {
|
class ObjectFile : public SymbolicFile {
|
||||||
virtual void anchor();
|
virtual void anchor();
|
||||||
ObjectFile() LLVM_DELETED_FUNCTION;
|
ObjectFile() = delete;
|
||||||
ObjectFile(const ObjectFile &other) LLVM_DELETED_FUNCTION;
|
ObjectFile(const ObjectFile &other) = delete;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ObjectFile(unsigned int Type, MemoryBufferRef Source);
|
ObjectFile(unsigned int Type, MemoryBufferRef Source);
|
||||||
|
@ -29,8 +29,8 @@ class ArgList;
|
|||||||
/// The Arg class encodes just enough information to be able to
|
/// The Arg class encodes just enough information to be able to
|
||||||
/// derive the argument values efficiently.
|
/// derive the argument values efficiently.
|
||||||
class Arg {
|
class Arg {
|
||||||
Arg(const Arg &) LLVM_DELETED_FUNCTION;
|
Arg(const Arg &) = delete;
|
||||||
void operator=(const Arg &) LLVM_DELETED_FUNCTION;
|
void operator=(const Arg &) = delete;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// \brief The option this argument is an instance of.
|
/// \brief The option this argument is an instance of.
|
||||||
|
@ -91,8 +91,8 @@ public:
|
|||||||
/// and to iterate over groups of arguments.
|
/// and to iterate over groups of arguments.
|
||||||
class ArgList {
|
class ArgList {
|
||||||
private:
|
private:
|
||||||
ArgList(const ArgList &) LLVM_DELETED_FUNCTION;
|
ArgList(const ArgList &) = delete;
|
||||||
void operator=(const ArgList &) LLVM_DELETED_FUNCTION;
|
void operator=(const ArgList &) = delete;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
typedef SmallVector<Arg*, 16> arglist_type;
|
typedef SmallVector<Arg*, 16> arglist_type;
|
||||||
|
@ -21,7 +21,7 @@ namespace opt {
|
|||||||
unsigned ID;
|
unsigned ID;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit OptSpecifier(bool) LLVM_DELETED_FUNCTION;
|
explicit OptSpecifier(bool) = delete;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
OptSpecifier() : ID(0) {}
|
OptSpecifier() : ID(0) {}
|
||||||
|
@ -83,8 +83,8 @@ class Pass {
|
|||||||
AnalysisResolver *Resolver; // Used to resolve analysis
|
AnalysisResolver *Resolver; // Used to resolve analysis
|
||||||
const void *PassID;
|
const void *PassID;
|
||||||
PassKind Kind;
|
PassKind Kind;
|
||||||
void operator=(const Pass&) LLVM_DELETED_FUNCTION;
|
void operator=(const Pass&) = delete;
|
||||||
Pass(const Pass &) LLVM_DELETED_FUNCTION;
|
Pass(const Pass &) = delete;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit Pass(PassKind K, char &pid)
|
explicit Pass(PassKind K, char &pid)
|
||||||
|
@ -120,7 +120,7 @@ public:
|
|||||||
class PMDataManager;
|
class PMDataManager;
|
||||||
class AnalysisResolver {
|
class AnalysisResolver {
|
||||||
private:
|
private:
|
||||||
AnalysisResolver() LLVM_DELETED_FUNCTION;
|
AnalysisResolver() = delete;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit AnalysisResolver(PMDataManager &P) : PM(P) { }
|
explicit AnalysisResolver(PMDataManager &P) : PM(P) { }
|
||||||
|
@ -138,8 +138,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void operator=(const PassInfo &) LLVM_DELETED_FUNCTION;
|
void operator=(const PassInfo &) = delete;
|
||||||
PassInfo(const PassInfo &) LLVM_DELETED_FUNCTION;
|
PassInfo(const PassInfo &) = delete;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -90,10 +90,9 @@ protected:
|
|||||||
class RawCoverageFilenamesReader : public RawCoverageReader {
|
class RawCoverageFilenamesReader : public RawCoverageReader {
|
||||||
std::vector<StringRef> &Filenames;
|
std::vector<StringRef> &Filenames;
|
||||||
|
|
||||||
RawCoverageFilenamesReader(const RawCoverageFilenamesReader &)
|
RawCoverageFilenamesReader(const RawCoverageFilenamesReader &) = delete;
|
||||||
LLVM_DELETED_FUNCTION;
|
|
||||||
RawCoverageFilenamesReader &
|
RawCoverageFilenamesReader &
|
||||||
operator=(const RawCoverageFilenamesReader &) LLVM_DELETED_FUNCTION;
|
operator=(const RawCoverageFilenamesReader &) = delete;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RawCoverageFilenamesReader(StringRef Data, std::vector<StringRef> &Filenames)
|
RawCoverageFilenamesReader(StringRef Data, std::vector<StringRef> &Filenames)
|
||||||
@ -109,10 +108,9 @@ class RawCoverageMappingReader : public RawCoverageReader {
|
|||||||
std::vector<CounterExpression> &Expressions;
|
std::vector<CounterExpression> &Expressions;
|
||||||
std::vector<CounterMappingRegion> &MappingRegions;
|
std::vector<CounterMappingRegion> &MappingRegions;
|
||||||
|
|
||||||
RawCoverageMappingReader(const RawCoverageMappingReader &)
|
RawCoverageMappingReader(const RawCoverageMappingReader &) = delete;
|
||||||
LLVM_DELETED_FUNCTION;
|
|
||||||
RawCoverageMappingReader &
|
RawCoverageMappingReader &
|
||||||
operator=(const RawCoverageMappingReader &) LLVM_DELETED_FUNCTION;
|
operator=(const RawCoverageMappingReader &) = delete;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
RawCoverageMappingReader(StringRef MappingData,
|
RawCoverageMappingReader(StringRef MappingData,
|
||||||
@ -166,9 +164,9 @@ private:
|
|||||||
std::vector<CounterMappingRegion> MappingRegions;
|
std::vector<CounterMappingRegion> MappingRegions;
|
||||||
|
|
||||||
ObjectFileCoverageMappingReader(const ObjectFileCoverageMappingReader &)
|
ObjectFileCoverageMappingReader(const ObjectFileCoverageMappingReader &)
|
||||||
LLVM_DELETED_FUNCTION;
|
= delete;
|
||||||
ObjectFileCoverageMappingReader &
|
ObjectFileCoverageMappingReader &
|
||||||
operator=(const ObjectFileCoverageMappingReader &) LLVM_DELETED_FUNCTION;
|
operator=(const ObjectFileCoverageMappingReader &) = delete;
|
||||||
|
|
||||||
/// \brief Set the current error_code and return same.
|
/// \brief Set the current error_code and return same.
|
||||||
std::error_code error(std::error_code EC) {
|
std::error_code error(std::error_code EC) {
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user