[llvm-commits] [123566] Use getDeclaration to simplify code.
jlaskey at apple.com
jlaskey at apple.com
Wed Feb 7 17:49:59 PST 2007
Revision: 123566
Author: jlaskey
Date: 2007-02-07 17:49:59 -0800 (Wed, 07 Feb 2007)
Log Message:
-----------
Use getDeclaration to simplify code.
Modified Paths:
--------------
apple-local/branches/llvm/gcc/llvm-debug.cpp
Modified: apple-local/branches/llvm/gcc/llvm-debug.cpp
===================================================================
--- apple-local/branches/llvm/gcc/llvm-debug.cpp 2007-02-08 01:42:33 UTC (rev 123565)
+++ apple-local/branches/llvm/gcc/llvm-debug.cpp 2007-02-08 01:49:59 UTC (rev 123566)
@@ -31,6 +31,7 @@
#include "llvm/Constants.h"
#include "llvm/DerivedTypes.h"
#include "llvm/Instructions.h"
+#include "llvm/Intrinsics.h"
#include "llvm/Module.h"
#include "llvm/Support/Dwarf.h"
#include "llvm/Target/TargetMachine.h"
@@ -273,12 +274,8 @@
Subprogram->setIsDefinition(true);
// Lazily construct llvm.dbg.func.start.
- if (!FuncStartFn) {
- FuncStartFn =
- cast<Function>(M->getOrInsertFunction("llvm.dbg.func.start",
- Type::VoidTy,
- SR.getEmptyStructPtrType(), NULL));
- }
+ if (!FuncStartFn)
+ FuncStartFn = Intrinsic::getDeclaration(M, Intrinsic::dbg_func_start);
// Call llvm.dbg.func.start.
new CallInst(FuncStartFn, getCastValueFor(Subprogram), "", CurBB);
@@ -298,12 +295,8 @@
RegionStack.push_back(Block);
// Lazily construct llvm.dbg.region.start function.
- if (!RegionStartFn) {
- const PointerType *EmpPtr = SR.getEmptyStructPtrType();
- RegionStartFn =
- cast<Function>(M->getOrInsertFunction("llvm.dbg.region.start",
- Type::VoidTy, EmpPtr, NULL));
- }
+ if (!RegionStartFn)
+ RegionStartFn = Intrinsic::getDeclaration(M, Intrinsic::dbg_region_start);
// Call llvm.dbg.func.start.
new CallInst(RegionStartFn, getCastValueFor(Block), "", CurBB);
@@ -313,12 +306,8 @@
/// region - "llvm.dbg.region.end."
void DebugInfo::EmitRegionEnd(Function *Fn, BasicBlock *CurBB) {
// Lazily construct llvm.dbg.region.end function.
- if (!RegionEndFn) {
- const PointerType *EmpPtr = SR.getEmptyStructPtrType();
- RegionEndFn =
- cast<Function>(M->getOrInsertFunction("llvm.dbg.region.end", Type::VoidTy,
- EmpPtr, NULL));
- }
+ if (!RegionEndFn)
+ RegionEndFn = Intrinsic::getDeclaration(M, Intrinsic::dbg_region_end);
// Provide an region stop point.
EmitStopPoint(Fn, CurBB);
@@ -334,11 +323,8 @@
tree type, Value *AI, BasicBlock *CurBB) {
// Lazily construct llvm.dbg.declare function.
const PointerType *EmpPtr = SR.getEmptyStructPtrType();
- if (!DeclareFn) {
- DeclareFn =
- cast<Function>(M->getOrInsertFunction("llvm.dbg.declare",
- Type::VoidTy, EmpPtr, EmpPtr,NULL));
- }
+ if (!DeclareFn)
+ DeclareFn = Intrinsic::getDeclaration(M, Intrinsic::dbg_declare);
// Get type information.
CompileUnitDesc *Unit = getOrCreateCompileUnit(CurFullPath);
@@ -382,13 +368,8 @@
CompileUnitDesc *Unit = getOrCreateCompileUnit(CurFullPath);
// Lazily construct llvm.dbg.stoppoint function.
- if (!StopPointFn) {
- StopPointFn =
- cast<Function>(M->getOrInsertFunction("llvm.dbg.stoppoint",
- Type::VoidTy, Type::Int32Ty,
- Type::Int32Ty,
- SR.getEmptyStructPtrType(), NULL));
- }
+ if (!StopPointFn)
+ StopPointFn = Intrinsic::getDeclaration(M, Intrinsic::dbg_stoppoint);
// Invoke llvm.dbg.stoppoint
std::vector<Value*> Args;
More information about the llvm-commits
mailing list