forked from OSchip/llvm-project
[ms-inline asm] Add inputs and outputs to AST. No functional change.
llvm-svn: 162000
This commit is contained in:
parent
6ee44e1f03
commit
7dbef3e035
|
@ -1627,15 +1627,19 @@ class MSAsmStmt : public Stmt {
|
|||
bool IsVolatile;
|
||||
|
||||
unsigned NumAsmToks;
|
||||
unsigned NumInputs;
|
||||
unsigned NumOutputs;
|
||||
unsigned NumClobbers;
|
||||
|
||||
Token *AsmToks;
|
||||
IdentifierInfo **Names;
|
||||
Stmt **Exprs;
|
||||
StringRef *Clobbers;
|
||||
|
||||
public:
|
||||
MSAsmStmt(ASTContext &C, SourceLocation asmloc, SourceLocation lbraceloc,
|
||||
bool issimple, bool isvolatile, ArrayRef<Token> asmtoks,
|
||||
ArrayRef<IdentifierInfo*> inputs, ArrayRef<IdentifierInfo*> outputs,
|
||||
StringRef asmstr, ArrayRef<StringRef> clobbers,
|
||||
SourceLocation endloc);
|
||||
|
||||
|
|
|
@ -583,14 +583,23 @@ AsmStmt::AsmStmt(ASTContext &C, SourceLocation asmloc, bool issimple,
|
|||
std::copy(clobbers, clobbers + NumClobbers, Clobbers);
|
||||
}
|
||||
|
||||
MSAsmStmt::MSAsmStmt(ASTContext &C,
|
||||
SourceLocation asmloc, SourceLocation lbraceloc,
|
||||
bool issimple, bool isvolatile, ArrayRef<Token> asmtoks,
|
||||
StringRef asmstr, ArrayRef<StringRef> clobbers,
|
||||
SourceLocation endloc)
|
||||
MSAsmStmt::MSAsmStmt(ASTContext &C, SourceLocation asmloc,
|
||||
SourceLocation lbraceloc, bool issimple, bool isvolatile,
|
||||
ArrayRef<Token> asmtoks, ArrayRef<IdentifierInfo*> inputs,
|
||||
ArrayRef<IdentifierInfo*> outputs, StringRef asmstr,
|
||||
ArrayRef<StringRef> clobbers, SourceLocation endloc)
|
||||
: Stmt(MSAsmStmtClass), AsmLoc(asmloc), LBraceLoc(lbraceloc), EndLoc(endloc),
|
||||
AsmStr(asmstr.str()), IsSimple(issimple), IsVolatile(isvolatile),
|
||||
NumAsmToks(asmtoks.size()), NumClobbers(clobbers.size()) {
|
||||
NumAsmToks(asmtoks.size()), NumInputs(inputs.size()),
|
||||
NumOutputs(outputs.size()), NumClobbers(clobbers.size()) {
|
||||
|
||||
unsigned NumExprs = NumOutputs + NumInputs;
|
||||
|
||||
Names = new (C) IdentifierInfo*[NumExprs];
|
||||
for (unsigned i = 0, e = NumOutputs; i != e; ++i)
|
||||
Names[i] = outputs[i];
|
||||
for (unsigned i = NumOutputs, e = NumExprs; i != e; ++i)
|
||||
Names[i] = inputs[i];
|
||||
|
||||
AsmToks = new (C) Token[NumAsmToks];
|
||||
for (unsigned i = 0, e = NumAsmToks; i != e; ++i)
|
||||
|
|
|
@ -2880,14 +2880,16 @@ StmtResult Sema::ActOnMSAsmStmt(SourceLocation AsmLoc,
|
|||
Diag(AsmLoc, diag::warn_unsupported_msasm);
|
||||
SmallVector<StringRef,4> Clobbers;
|
||||
std::set<std::string> ClobberRegs;
|
||||
SmallVector<IdentifierInfo*, 4> Inputs;
|
||||
SmallVector<IdentifierInfo*, 4> Outputs;
|
||||
|
||||
// Empty asm statements don't need to instantiate the AsmParser, etc.
|
||||
if (AsmToks.empty()) {
|
||||
StringRef AsmString;
|
||||
MSAsmStmt *NS =
|
||||
new (Context) MSAsmStmt(Context, AsmLoc, LBraceLoc,
|
||||
/* IsSimple */ true, /* IsVolatile */ true,
|
||||
AsmToks, AsmString, Clobbers, EndLoc);
|
||||
new (Context) MSAsmStmt(Context, AsmLoc, LBraceLoc, /*IsSimple*/ true,
|
||||
/*IsVolatile*/ true, AsmToks, Inputs, Outputs,
|
||||
AsmString, Clobbers, EndLoc);
|
||||
return Owned(NS);
|
||||
}
|
||||
|
||||
|
@ -2905,9 +2907,9 @@ StmtResult Sema::ActOnMSAsmStmt(SourceLocation AsmLoc,
|
|||
// patchMSAsmStrings doesn't correctly patch non-simple asm statements.
|
||||
if (!IsSimple) {
|
||||
MSAsmStmt *NS =
|
||||
new (Context) MSAsmStmt(Context, AsmLoc, LBraceLoc,
|
||||
/* IsSimple */ true, /* IsVolatile */ true,
|
||||
AsmToks, AsmString, Clobbers, EndLoc);
|
||||
new (Context) MSAsmStmt(Context, AsmLoc, LBraceLoc, /*IsSimple*/ true,
|
||||
/*IsVolatile*/ true, AsmToks, Inputs, Outputs,
|
||||
AsmString, Clobbers, EndLoc);
|
||||
return Owned(NS);
|
||||
}
|
||||
|
||||
|
@ -2999,10 +3001,9 @@ StmtResult Sema::ActOnMSAsmStmt(SourceLocation AsmLoc,
|
|||
Clobbers.push_back(*I);
|
||||
|
||||
MSAsmStmt *NS =
|
||||
new (Context) MSAsmStmt(Context, AsmLoc, LBraceLoc,
|
||||
IsSimple, /* IsVolatile */ true,
|
||||
AsmToks, AsmString, Clobbers, EndLoc);
|
||||
|
||||
new (Context) MSAsmStmt(Context, AsmLoc, LBraceLoc, IsSimple,
|
||||
/*IsVolatile*/ true, AsmToks, Inputs, Outputs,
|
||||
AsmString, Clobbers, EndLoc);
|
||||
return Owned(NS);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue