blob: b4809a6be8071582a670122a3e9e288bd02caf05 [file] [log] [blame]
Chris Lattner035dfbe2002-08-09 20:08:06 +00001//===-- MachineInstrAnnot.cpp ---------------------------------------------===//
Vikram S. Adve7e684a92002-05-19 15:30:21 +00002//
Chris Lattner035dfbe2002-08-09 20:08:06 +00003// This file defines Annotations used to pass information between code
4// generation phases.
Vikram S. Adve7e684a92002-05-19 15:30:21 +00005//
Chris Lattner035dfbe2002-08-09 20:08:06 +00006//===----------------------------------------------------------------------===//
Vikram S. Adve7e684a92002-05-19 15:30:21 +00007
8#include "llvm/CodeGen/MachineInstrAnnot.h"
9#include "llvm/Annotation.h"
10#include "llvm/iOther.h"
Chris Lattner0be79c62002-10-28 02:28:39 +000011#include "llvm/Type.h"
Vikram S. Adve7e684a92002-05-19 15:30:21 +000012
13AnnotationID CallArgsDescriptor::AID(AnnotationManager::
14 getID("CodeGen::CallArgsDescriptor"));
15
16CallArgsDescriptor::CallArgsDescriptor(const CallInst* _callInstr,
17 TmpInstruction* _retAddrReg,
18 bool _isVarArgs, bool _noPrototype)
19 : Annotation(AID),
20 callInstr(_callInstr),
21 funcPtr(isa<Function>(_callInstr->getCalledValue())
22 ? NULL : _callInstr->getCalledValue()),
23 retAddrReg(_retAddrReg),
24 isVarArgs(_isVarArgs),
25 noPrototype(_noPrototype)
26{
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)));
33}
Vikram S. Advef4258842002-09-28 17:03:54 +000034
35
36const CallInst*
37CallArgsDescriptor::getReturnValue() const
38{
39 return (callInstr->getType() == Type::VoidTy? NULL : callInstr);
40}