[ms-inline asm] Refactor code so that we can begin computing the Inputs/Outputs.

No functional change intended.

llvm-svn: 162403
This commit is contained in:
Chad Rosier 2012-08-22 22:10:51 +00:00
parent df38adae0f
commit dc5311aab6
1 changed files with 19 additions and 11 deletions
clang/lib/Sema

View File

@ -546,11 +546,18 @@ StmtResult Sema::ActOnMSAsmStmt(SourceLocation AsmLoc,
TheTarget->createMCInstPrinter(1, *MAI, *MII, *MRI, *STI);
// Build the list of clobbers.
for (unsigned i = 0, e = Desc.getNumDefs(); i != e; ++i) {
const llvm::MCOperand &Op = Inst.getOperand(i);
if (!Op.isReg())
unsigned NumDefs = Desc.getNumDefs();
for (unsigned j = 0, e = Inst.getNumOperands(); j != e; ++j) {
const llvm::MCOperand &Op = Inst.getOperand(j);
// Immediate.
if (Op.isImm() || Op.isFPImm())
continue;
bool isDef = NumDefs && (j < NumDefs);
// Register/Clobber.
if (Op.isReg() && isDef) {
std::string Reg;
llvm::raw_string_ostream OS(Reg);
IP->printRegName(OS, Op.getReg());
@ -562,6 +569,7 @@ StmtResult Sema::ActOnMSAsmStmt(SourceLocation AsmLoc,
ClobberRegs.insert(Reg);
}
}
}
for (std::set<std::string>::iterator I = ClobberRegs.begin(),
E = ClobberRegs.end(); I != E; ++I)
Clobbers.push_back(*I);