aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Target/MSIL
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2010-06-07 19:05:06 +0000
committerBill Wendling <isanbard@gmail.com>2010-06-07 19:05:06 +0000
commit754655755def3e37bb2856467313c7fe0e577298 (patch)
treefcbdcb7e5e1adbd679c817a6699fe07866503b1e /lib/Target/MSIL
parentcb7f14742a0018d2661dac491e10dc05c4ba80c7 (diff)
downloadexternal_llvm-754655755def3e37bb2856467313c7fe0e577298.tar.gz
external_llvm-754655755def3e37bb2856467313c7fe0e577298.tar.bz2
external_llvm-754655755def3e37bb2856467313c7fe0e577298.zip
Create new accessors to get arguments for call/invoke instructions. It breaks
encapsulation to force the users of these classes to know about the internal data structure of the Operands structure. It also can lead to errors, like in the MSIL writer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@105539 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/MSIL')
-rw-r--r--lib/Target/MSIL/MSILWriter.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/Target/MSIL/MSILWriter.cpp b/lib/Target/MSIL/MSILWriter.cpp
index 3de173cc26..4b0aaa7c49 100644
--- a/lib/Target/MSIL/MSILWriter.cpp
+++ b/lib/Target/MSIL/MSILWriter.cpp
@@ -845,10 +845,11 @@ void MSILWriter::printCallInstruction(const Instruction* Inst) {
// Handle intrinsic function.
printIntrinsicCall(cast<IntrinsicInst>(Inst));
} else {
+ const CallInst *CI = cast<CallInst>(Inst);
// Load arguments to stack and call function.
- for (int I = 1, E = Inst->getNumOperands(); I!=E; ++I)
- printValueLoad(Inst->getOperand(I));
- printFunctionCall(Inst->getOperand(0),Inst);
+ for (int I = 0, E = CI->getNumArgOperands(); I!=E; ++I)
+ printValueLoad(CI->getArgOperand(I));
+ printFunctionCall(CI->getCalledFunction(), Inst);
}
}
@@ -1002,8 +1003,8 @@ void MSILWriter::printInvokeInstruction(const InvokeInst* Inst) {
std::string Label = "leave$normal_"+utostr(getUniqID());
Out << ".try {\n";
// Load arguments
- for (int I = 3, E = Inst->getNumOperands(); I!=E; ++I)
- printValueLoad(Inst->getOperand(I));
+ for (int I = 0, E = Inst->getNumArgOperands(); I!=E; ++I)
+ printValueLoad(Inst->getArgOperand(I));
// Print call instruction
printFunctionCall(Inst->getOperand(0),Inst);
// Save function result and leave "try" block