diff options
author | Bill Wendling <isanbard@gmail.com> | 2010-06-07 19:05:06 +0000 |
---|---|---|
committer | Bill Wendling <isanbard@gmail.com> | 2010-06-07 19:05:06 +0000 |
commit | 22a5b298201d62daea3e06718469d8ad017895e1 (patch) | |
tree | fcbdcb7e5e1adbd679c817a6699fe07866503b1e /lib/Target/MSIL | |
parent | 6c8099243a0d8ff710e8f657628a8bea99b5dd07 (diff) | |
download | llvm-22a5b298201d62daea3e06718469d8ad017895e1.tar.gz llvm-22a5b298201d62daea3e06718469d8ad017895e1.tar.bz2 llvm-22a5b298201d62daea3e06718469d8ad017895e1.tar.xz |
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.cpp | 11 |
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 |