mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-27 14:24:40 +00:00
split code that doesn't need to be templated out of IRBuilder into a new
non-templated IRBuilderBase class. Move that large CreateGlobalString out of line, eliminating the need to #include GlobalVariable.h in IRBuilder.h git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@92227 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
31
lib/VMCore/IRBuilder.cpp
Normal file
31
lib/VMCore/IRBuilder.cpp
Normal file
@ -0,0 +1,31 @@
|
||||
//===---- IRBuilder.cpp - Builder for LLVM Instrs -------------------------===//
|
||||
//
|
||||
// The LLVM Compiler Infrastructure
|
||||
//
|
||||
// This file is distributed under the University of Illinois Open Source
|
||||
// License. See LICENSE.TXT for details.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// This file implements the IRBuilder class, which is used as a convenient way
|
||||
// to create LLVM instructions with a consistent and simplified interface.
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#include "llvm/Support/IRBuilder.h"
|
||||
#include "llvm/GlobalVariable.h"
|
||||
using namespace llvm;
|
||||
|
||||
/// CreateGlobalString - Make a new global variable with an initializer that
|
||||
/// has array of i8 type filled in the the nul terminated string value
|
||||
/// specified. If Name is specified, it is the name of the global variable
|
||||
/// created.
|
||||
Value *IRBuilderBase::CreateGlobalString(const char *Str, const Twine &Name) {
|
||||
Constant *StrConstant = ConstantArray::get(Context, Str, true);
|
||||
Module &M = *BB->getParent()->getParent();
|
||||
GlobalVariable *GV = new GlobalVariable(M, StrConstant->getType(),
|
||||
true, GlobalValue::InternalLinkage,
|
||||
StrConstant, "", 0, false);
|
||||
GV->setName(Name);
|
||||
return GV;
|
||||
}
|
Reference in New Issue
Block a user