1 //===-- InstrinsicInst.cpp - Intrinsic Instruction Wrappers -----*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file was developed by the LLVM research group and is distributed under
6 // the University of Illinois Open Source License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "llvm/IntrinsicInst.h"
12 #include "llvm/Constants.h"
13 #include "llvm/GlobalVariable.h"
17 //===----------------------------------------------------------------------===//
18 /// DbgInfoIntrinsic - This is the common base class for debug info intrinsics
21 static Value *CastOperand(Value *C) {
22 if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C))
23 if (CE->getOpcode() == Instruction::Cast)
24 return CE->getOperand(0);
28 Value *DbgInfoIntrinsic::StripCast(Value *C) {
29 if (Value *CO = CastOperand(C)) {
31 } else if (GlobalVariable *GV = dyn_cast<GlobalVariable>(C)) {
32 if (GV->hasInitializer())
33 if (Value *CO = CastOperand(GV->getInitializer()))
39 //===----------------------------------------------------------------------===//
40 /// DbgStopPointInst - This represents the llvm.dbg.stoppoint instruction.
43 std::string DbgStopPointInst::getFileName() const {
44 GlobalVariable *GV = cast<GlobalVariable>(getContext());
45 ConstantStruct *CS = cast<ConstantStruct>(GV->getInitializer());
46 return CS->getOperand(4)->getStringValue();
49 std::string DbgStopPointInst::getDirectory() const {
50 GlobalVariable *GV = cast<GlobalVariable>(getContext());
51 ConstantStruct *CS = cast<ConstantStruct>(GV->getInitializer());
52 return CS->getOperand(5)->getStringValue();
55 //===----------------------------------------------------------------------===//