1 //===-- MachineInstrAnnot.cpp ---------------------------------------------===//
3 // This file defines Annotations used to pass information between code
6 //===----------------------------------------------------------------------===//
8 #include "llvm/CodeGen/MachineInstrAnnot.h"
9 #include "llvm/Annotation.h"
10 #include "llvm/iOther.h"
12 AnnotationID CallArgsDescriptor::AID(AnnotationManager::
13 getID("CodeGen::CallArgsDescriptor"));
15 CallArgsDescriptor::CallArgsDescriptor(const CallInst* _callInstr,
16 TmpInstruction* _retAddrReg,
17 bool _isVarArgs, bool _noPrototype)
19 callInstr(_callInstr),
20 funcPtr(isa<Function>(_callInstr->getCalledValue())
21 ? NULL : _callInstr->getCalledValue()),
22 retAddrReg(_retAddrReg),
23 isVarArgs(_isVarArgs),
24 noPrototype(_noPrototype)
26 unsigned int numArgs = callInstr->getNumOperands();
27 argInfoVec.reserve(numArgs);
28 assert(callInstr->getOperand(0) == callInstr->getCalledValue()
29 && "Operand 0 is ignored in the loop below!");
30 for (unsigned int i=1; i < numArgs; ++i)
31 argInfoVec.push_back(CallArgInfo(callInstr->getOperand(i)));
36 CallArgsDescriptor::getReturnValue() const
38 return (callInstr->getType() == Type::VoidTy? NULL : callInstr);