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"
11 #include "llvm/Type.h"
13 AnnotationID CallArgsDescriptor::AID(AnnotationManager::
14 getID("CodeGen::CallArgsDescriptor"));
16 CallArgsDescriptor::CallArgsDescriptor(const CallInst* _callInstr,
17 TmpInstruction* _retAddrReg,
18 bool _isVarArgs, bool _noPrototype)
20 callInstr(_callInstr),
21 funcPtr(isa<Function>(_callInstr->getCalledValue())
22 ? NULL : _callInstr->getCalledValue()),
23 retAddrReg(_retAddrReg),
24 isVarArgs(_isVarArgs),
25 noPrototype(_noPrototype)
27 unsigned int numArgs = callInstr->getNumOperands();
28 argInfoVec.reserve(numArgs);
29 assert(callInstr->getOperand(0) == callInstr->getCalledValue()
30 && "Operand 0 is ignored in the loop below!");
31 for (unsigned int i=1; i < numArgs; ++i)
32 argInfoVec.push_back(CallArgInfo(callInstr->getOperand(i)));
37 CallArgsDescriptor::getReturnValue() const
39 return (callInstr->getType() == Type::VoidTy? NULL : callInstr);