Chris Lattner | 035dfbe | 2002-08-09 20:08:06 +0000 | [diff] [blame] | 1 | //===-- MachineInstrAnnot.cpp ---------------------------------------------===// |
Vikram S. Adve | 7e684a9 | 2002-05-19 15:30:21 +0000 | [diff] [blame] | 2 | // |
Chris Lattner | 035dfbe | 2002-08-09 20:08:06 +0000 | [diff] [blame] | 3 | // This file defines Annotations used to pass information between code |
| 4 | // generation phases. |
Vikram S. Adve | 7e684a9 | 2002-05-19 15:30:21 +0000 | [diff] [blame] | 5 | // |
Chris Lattner | 035dfbe | 2002-08-09 20:08:06 +0000 | [diff] [blame] | 6 | //===----------------------------------------------------------------------===// |
Vikram S. Adve | 7e684a9 | 2002-05-19 15:30:21 +0000 | [diff] [blame] | 7 | |
| 8 | #include "llvm/CodeGen/MachineInstrAnnot.h" |
| 9 | #include "llvm/Annotation.h" |
| 10 | #include "llvm/iOther.h" |
Vikram S. Adve | 7e684a9 | 2002-05-19 15:30:21 +0000 | [diff] [blame] | 11 | |
| 12 | AnnotationID CallArgsDescriptor::AID(AnnotationManager:: |
| 13 | getID("CodeGen::CallArgsDescriptor")); |
| 14 | |
| 15 | CallArgsDescriptor::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. Adve | f425884 | 2002-09-28 17:03:54 +0000 | [diff] [blame] | 33 | |
| 34 | |
| 35 | const CallInst* |
| 36 | CallArgsDescriptor::getReturnValue() const |
| 37 | { |
| 38 | return (callInstr->getType() == Type::VoidTy? NULL : callInstr); |
| 39 | } |