blob: ef064450ed060925986c5c20224db433e5fcb55a [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"
Vikram S. Adve7e684a92002-05-19 15:30:21 +000011
12AnnotationID CallArgsDescriptor::AID(AnnotationManager::
13 getID("CodeGen::CallArgsDescriptor"));
14
15CallArgsDescriptor::CallArgsDescriptor(const CallInst* _callInstr,
16 TmpInstruction* _retAddrReg,
17 bool _isVarArgs, bool _noPrototype)
18 : Annotation(AID),
19 callInstr(_callInstr),
20 funcPtr(isa<Function>(_callInstr->getCalledValue())
21 ? NULL : _callInstr->getCalledValue()),
22 retAddrReg(_retAddrReg),
23 isVarArgs(_isVarArgs),
24 noPrototype(_noPrototype)
25{
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)));
32}
Vikram S. Advef4258842002-09-28 17:03:54 +000033
34
35const CallInst*
36CallArgsDescriptor::getReturnValue() const
37{
38 return (callInstr->getType() == Type::VoidTy? NULL : callInstr);
39}