[cfe-commits] r162403 - /cfe/trunk/lib/Sema/SemaStmtAsm.cpp
Chad Rosier
mcrosier at apple.com
Wed Aug 22 15:10:52 PDT 2012
Author: mcrosier
Date: Wed Aug 22 17:10:51 2012
New Revision: 162403
URL: http://llvm.org/viewvc/llvm-project?rev=162403&view=rev
Log:
[ms-inline asm] Refactor code so that we can begin computing the Inputs/Outputs.
No functional change intended.
Modified:
cfe/trunk/lib/Sema/SemaStmtAsm.cpp
Modified: cfe/trunk/lib/Sema/SemaStmtAsm.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaStmtAsm.cpp?rev=162403&r1=162402&r2=162403&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaStmtAsm.cpp (original)
+++ cfe/trunk/lib/Sema/SemaStmtAsm.cpp Wed Aug 22 17:10:51 2012
@@ -546,20 +546,28 @@
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;
- std::string Reg;
- llvm::raw_string_ostream OS(Reg);
- IP->printRegName(OS, Op.getReg());
-
- StringRef Clobber(OS.str());
- if (!Context.getTargetInfo().isValidClobber(Clobber))
- return StmtError(Diag(AsmLoc, diag::err_asm_unknown_register_name) <<
- Clobber);
- ClobberRegs.insert(Reg);
+ 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());
+
+ StringRef Clobber(OS.str());
+ if (!Context.getTargetInfo().isValidClobber(Clobber))
+ return StmtError(Diag(AsmLoc, diag::err_asm_unknown_register_name) <<
+ Clobber);
+ ClobberRegs.insert(Reg);
+ }
}
}
for (std::set<std::string>::iterator I = ClobberRegs.begin(),
More information about the cfe-commits
mailing list