LLVMCleanupPad = 65,
LLVMCatchEndPad = 66,
LLVMCleanupEndPad = 67
-
} LLVMOpcode;
typedef enum {
@see ManagedStatic */
void LLVMShutdown(void);
-
/*===-- Error handling ----------------------------------------------------===*/
char *LLVMCreateMessage(const char *Message);
LLVMTypeRef LLVMInt16TypeInContext(LLVMContextRef C);
LLVMTypeRef LLVMInt32TypeInContext(LLVMContextRef C);
LLVMTypeRef LLVMInt64TypeInContext(LLVMContextRef C);
+LLVMTypeRef LLVMInt128TypeInContext(LLVMContextRef C);
LLVMTypeRef LLVMIntTypeInContext(LLVMContextRef C, unsigned NumBits);
/**
LLVMTypeRef LLVMInt16Type(void);
LLVMTypeRef LLVMInt32Type(void);
LLVMTypeRef LLVMInt64Type(void);
+LLVMTypeRef LLVMInt128Type(void);
LLVMTypeRef LLVMIntType(unsigned NumBits);
unsigned LLVMGetIntTypeWidth(LLVMTypeRef IntegerTy);
* @}
*/
-
/**
* @defgroup LLVMCCoreTypeSequential Sequential Types
*
macro(InsertElementInst) \
macro(InsertValueInst) \
macro(LandingPadInst) \
- macro(CleanupPadInst) \
+ macro(CleanupPadInst) \
macro(PHINode) \
macro(SelectInst) \
macro(ShuffleVectorInst) \
macro(ResumeInst) \
macro(CleanupReturnInst) \
macro(CatchReturnInst) \
- macro(CatchPadInst) \
- macro(TerminatePadInst) \
- macro(CatchEndPadInst) \
+ macro(CatchPadInst) \
+ macro(TerminatePadInst) \
+ macro(CatchEndPadInst) \
macro(CleanupEndPadInst) \
macro(UnaryInstruction) \
macro(AllocaInst) \
#ifdef __cplusplus
}
-#endif /* !defined(__cplusplus) */
+#endif
-#endif /* !defined(LLVM_C_CORE_H) */
+#endif /* LLVM_C_CORE_H */
// sample profile data.
//
//===----------------------------------------------------------------------===//
+
#ifndef LLVM_PROFILEDATA_SAMPLEPROF_H_
#define LLVM_PROFILEDATA_SAMPLEPROF_H_
findFunctionSamplesAt(const CallsiteLocation &Loc) const {
auto iter = CallsiteSamples.find(Loc);
if (iter == CallsiteSamples.end()) {
- return NULL;
+ return nullptr;
} else {
return &iter->second;
}
CallsiteSampleMap CallsiteSamples;
};
-} // End namespace sampleprof
+} // end namespace sampleprof
-} // End namespace llvm
+} // end namespace llvm
#endif // LLVM_PROFILEDATA_SAMPLEPROF_H_
DIEs.Values.push_back(new (Allocator) HashDataContents(die, Flags));
}
-void DwarfAccelTable::ComputeBucketCount(void) {
+void DwarfAccelTable::ComputeBucketCount() {
// First get the number of unique hashes.
std::vector<uint32_t> uniques(Data.size());
for (size_t i = 0, e = Data.size(); i < e; ++i)
-//===- lib/MC/MCAsmStreamer.cpp - Text Assembly Output --------------------===//
+//===- lib/MC/MCAsmStreamer.cpp - Text Assembly Output ----------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
#include "llvm/Support/MathExtras.h"
#include "llvm/Support/Path.h"
#include <cctype>
+
using namespace llvm;
namespace {
OS << '"';
}
-
void MCAsmStreamer::EmitBytes(StringRef Data) {
assert(getCurrentSection().first &&
"Cannot emit contents before setting section!");
EmitEOL();
}
-
/// EmitFill - Emit NumBytes bytes worth of the value specified by
/// FillValue. This implements directives such as '.space'.
void MCAsmStreamer::EmitFill(uint64_t NumBytes, uint8_t FillValue) {
return false;
}
-
void MCAsmStreamer::EmitFileDirective(StringRef Filename) {
assert(MAI->hasSingleParameterDotFile());
OS << "\t.file\t";
EmitEOL();
}
-void MCAsmStreamer::EmitWinCFIEndProlog(void) {
+void MCAsmStreamer::EmitWinCFIEndProlog() {
MCStreamer::EmitWinCFIEndProlog();
OS << "\t.seh_endprologue";
#include "llvm/Config/config.h"
namespace llvm {
+
using namespace sys;
const TimeValue::SecondsType
const TimeValue::SecondsType
TimeValue::Win32ZeroTimeSeconds = -12591158400ULL;
-void
-TimeValue::normalize( void ) {
+void TimeValue::normalize() {
if ( nanos_ >= NANOSECONDS_PER_SECOND ) {
do {
seconds_++;
}
}
-}
+} // namespace llvm
/// Include the platform-specific portion of TimeValue class
#ifdef LLVM_ON_UNIX
-//===- InstCombineAddSub.cpp ----------------------------------------------===//
+//===- InstCombineAddSub.cpp ------------------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/GetElementPtrTypeIterator.h"
#include "llvm/IR/PatternMatch.h"
+
using namespace llvm;
using namespace PatternMatch;
private:
bool insaneIntVal(int V) { return V > 4 || V < -4; }
- APFloat *getFpValPtr(void)
+ APFloat *getFpValPtr()
{ return reinterpret_cast<APFloat*>(&FpValBuf.buffer[0]); }
- const APFloat *getFpValPtr(void) const
+ const APFloat *getFpValPtr() const
{ return reinterpret_cast<const APFloat*>(&FpValBuf.buffer[0]); }
- const APFloat &getFpVal(void) const {
+ const APFloat &getFpVal() const {
assert(IsFp && BufHasFpVal && "Incorret state");
return *getFpValPtr();
}
- APFloat &getFpVal(void) {
+ APFloat &getFpVal() {
assert(IsFp && BufHasFpVal && "Incorret state");
return *getFpValPtr();
}
// TODO: We should get rid of this function when APFloat can be constructed
// from an *SIGNED* integer.
APFloat createAPFloatFromInt(const fltSemantics &Sem, int Val);
- private:
+ private:
bool IsFp;
// True iff FpValBuf contains an instance of APFloat.
///
class FAddend {
public:
- FAddend() { Val = nullptr; }
+ FAddend() : Val(nullptr) {}
- Value *getSymVal (void) const { return Val; }
- const FAddendCoef &getCoef(void) const { return Coeff; }
+ Value *getSymVal() const { return Val; }
+ const FAddendCoef &getCoef() const { return Coeff; }
bool isConstant() const { return Val == nullptr; }
bool isZero() const { return Coeff.isZero(); }
InstCombiner::BuilderTy *Builder;
Instruction *Instr;
- private:
// Debugging stuff are clustered here.
#ifndef NDEBUG
unsigned CreateInstrNum;
void incCreateInstNum() {}
#endif
};
-}
+
+} // anonymous namespace
//===----------------------------------------------------------------------===//
//
}
Value *FAddCombine::simplifyFAdd(AddendVect& Addends, unsigned InstrQuota) {
-
unsigned AddendNum = Addends.size();
assert(AddendNum <= 4 && "Too many addends");
return Changed ? &I : nullptr;
}
-
/// Optimize pointer differences into the same array into a size. Consider:
/// &A[10] - &A[0]: we should compile this to "10". LHS/RHS are the pointer
/// operands to the ptrtoint instructions for the LHS/RHS of the subtract.
}
}
-
{
Value *Y;
// X-(X+Y) == -Y X-(Y+X) == -Y
// We use the initial-exec TLS model because we do not support the
// variable living anywhere other than in the main executable.
UnsafeStackPtr = new GlobalVariable(
- M, StackPtrTy, false, GlobalValue::ExternalLinkage, 0,
+ M, StackPtrTy, false, GlobalValue::ExternalLinkage, nullptr,
UnsafeStackPtrVar, nullptr, GlobalValue::InitialExecTLSModel);
} else {
// The variable exists, check its type and attributes.
public:
static char ID; // Pass identification, replacement for typeid
- explicit MergedLoadStoreMotion(void)
+ MergedLoadStoreMotion()
: FunctionPass(ID), MD(nullptr), MagicCompileTimeControl(250) {
initializeMergedLoadStoreMotionPass(*PassRegistry::getPassRegistry());
}
};
char MergedLoadStoreMotion::ID = 0;
-}
+} // anonymous namespace
///
/// \brief createMergedLoadStoreMotionPass - The public interface to this file.
-//===- RemoteTarget.cpp - LLVM Remote process JIT execution --------------===//
+//===- RemoteTarget.cpp - LLVM Remote process JIT execution -----*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
}
bool RemoteTarget::executeCode(uint64_t Address, int &RetVal) {
- int (*fn)(void) = (int(*)(void))Address;
+ int (*fn)() = (int(*)())Address;
RetVal = fn();
return true;
}
-//===-- llvm-mc.cpp - Machine Code Hacking Driver -------------------------===//
+//===-- llvm-mc.cpp - Machine Code Hacking Driver ---------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
#include "llvm/Support/TargetRegistry.h"
#include "llvm/Support/TargetSelect.h"
#include "llvm/Support/ToolOutputFile.h"
+
using namespace llvm;
static cl::opt<std::string>
}
static std::string DwarfDebugProducer;
-static void setDwarfDebugProducer(void) {
+static void setDwarfDebugProducer() {
if(!getenv("DEBUG_PRODUCER"))
return;
DwarfDebugProducer += getenv("DEBUG_PRODUCER");
-//===-- llvm-size.cpp - Print the size of each object section -------------===//
+//===-- llvm-size.cpp - Print the size of each object section ---*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
#include <algorithm>
#include <string>
#include <system_error>
+
using namespace llvm;
using namespace object;
}
/// @brief Return the printing format for the Radix.
-static const char *getRadixFmt(void) {
+static const char *getRadixFmt() {
switch (Radix) {
case octal:
return PRIo64;
-//===- MCJITMultipeModuleTest.cpp - Unit tests for the MCJIT-----*- C++ -*-===//
+//===- MCJITMultipeModuleTest.cpp - Unit tests for the MCJIT ----*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
uint64_t FBPtr = TheJIT->getFunctionAddress(FB->getName().str());
TheJIT->finalizeObject();
EXPECT_TRUE(0 != FBPtr);
- int32_t(*FuncPtr)(void) = (int32_t(*)(void))FBPtr;
+ int32_t(*FuncPtr)() = (int32_t(*)())FBPtr;
EXPECT_EQ(initialNum, FuncPtr())
<< "Invalid value for global returned from JITted function in module B";
uint64_t FAPtr = TheJIT->getFunctionAddress(FA->getName().str());
EXPECT_TRUE(0 != FAPtr);
- FuncPtr = (int32_t(*)(void))FAPtr;
+ FuncPtr = (int32_t(*)())FAPtr;
EXPECT_EQ(initialNum, FuncPtr())
<< "Invalid value for global returned from JITted function in module A";
}
class MCJITObjectCacheTest : public testing::Test, public MCJITTestBase {
protected:
-
enum {
OriginalRC = 6,
ReplacementRC = 7
EXPECT_TRUE(nullptr != vPtr)
<< "Unable to get pointer to main() from JIT";
- int (*FuncPtr)(void) = (int(*)(void))(intptr_t)vPtr;
+ int (*FuncPtr)() = (int(*)())(intptr_t)vPtr;
int returnCode = FuncPtr();
EXPECT_EQ(returnCode, ExpectedRC);
}
compileAndRun();
}
-
TEST_F(MCJITObjectCacheTest, VerifyBasicObjectCaching) {
SKIP_UNSUPPORTED_PLATFORM;
EXPECT_FALSE(Cache->wereDuplicatesInserted());
}
-} // Namespace
-
+} // end anonymous namespace
EXPECT_TRUE(0 != ptr)
<< "Unable to get pointer to main() from JIT";
- int (*FuncPtr)(void) = (int(*)(void))ptr;
+ int (*FuncPtr)() = (int(*)())ptr;
int returnCode = FuncPtr();
EXPECT_EQ(returnCode, rc);
}
uint64_t rgvPtr = TheJIT->getFunctionAddress(ReturnGlobal->getName().str());
EXPECT_TRUE(0 != rgvPtr);
- int32_t(*FuncPtr)(void) = (int32_t(*)(void))rgvPtr;
+ int32_t(*FuncPtr)() = (int32_t(*)())rgvPtr;
EXPECT_EQ(initialNum, FuncPtr())
<< "Invalid value for global returned from JITted function";
}
EXPECT_TRUE(0 != ptr)
<< "Unable to get pointer to outer function from JIT";
- int32_t(*FuncPtr)(void) = (int32_t(*)(void))ptr;
+ int32_t(*FuncPtr)() = (int32_t(*)())ptr;
EXPECT_EQ(innerRetVal, FuncPtr())
<< "Incorrect result returned from function";
}
class OrcCAPIExecutionTest : public testing::Test, public OrcExecutionTest {
protected:
-
std::unique_ptr<Module> createTestModule(const Triple &TT) {
ModuleBuilder MB(getGlobalContext(), TT.str(), "");
Function *TestFunc = MB.createFunctionDecl<int()>("testFunc");
return MB.takeModule();
}
- typedef int (*MainFnTy)(void);
+ typedef int (*MainFnTy)();
- static int myTestFuncImpl(void) {
+ static int myTestFuncImpl() {
return 42;
}
auto *ET = CCtx->APIExecTest;
CCtx->M = ET->createTestModule(ET->TM->getTargetTriple());
CCtx->H = LLVMOrcAddEagerlyCompiledIR(JITStack, wrap(CCtx->M.get()),
- myResolver, 0);
+ myResolver, nullptr);
CCtx->Compiled = true;
LLVMOrcTargetAddress MainAddr = LLVMOrcGetSymbolAddress(JITStack, "main");
LLVMOrcSetIndirectStubPointer(JITStack, "foo", MainAddr);
return MainAddr;
}
-
};
-char *OrcCAPIExecutionTest::testFuncName = 0;
+char *OrcCAPIExecutionTest::testFuncName = nullptr;
TEST_F(OrcCAPIExecutionTest, TestEagerIRCompilation) {
if (!TM)
LLVMOrcGetMangledSymbol(JIT, &testFuncName, "testFunc");
LLVMOrcModuleHandle H =
- LLVMOrcAddEagerlyCompiledIR(JIT, wrap(M.get()), myResolver, 0);
+ LLVMOrcAddEagerlyCompiledIR(JIT, wrap(M.get()), myResolver, nullptr);
MainFnTy MainFn = (MainFnTy)LLVMOrcGetSymbolAddress(JIT, "main");
int Result = MainFn();
EXPECT_EQ(Result, 42)
LLVMOrcGetMangledSymbol(JIT, &testFuncName, "testFunc");
LLVMOrcModuleHandle H =
- LLVMOrcAddLazilyCompiledIR(JIT, wrap(M.get()), myResolver, 0);
+ LLVMOrcAddLazilyCompiledIR(JIT, wrap(M.get()), myResolver, nullptr);
MainFnTy MainFn = (MainFnTy)LLVMOrcGetSymbolAddress(JIT, "main");
int Result = MainFn();
EXPECT_EQ(Result, 42)
LLVMOrcDisposeInstance(JIT);
}
-}
+} // namespace llvm
-//===- unittest/ProfileData/InstrProfTest.cpp -------------------------------=//
+//===- unittest/ProfileData/InstrProfTest.cpp -------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
InstrProfValueData VD0[] = {{(uint64_t) "callee1", 1},
{(uint64_t) "callee2", 2},
{(uint64_t) "callee3", 3}};
- Record1.addValueData(IPVK_IndirectCallTarget, 0, VD0, 3, 0);
+ Record1.addValueData(IPVK_IndirectCallTarget, 0, VD0, 3, nullptr);
// No valeu profile data at the second site.
- Record1.addValueData(IPVK_IndirectCallTarget, 1, 0, 0, 0);
+ Record1.addValueData(IPVK_IndirectCallTarget, 1, nullptr, 0, nullptr);
InstrProfValueData VD2[] = {{(uint64_t) "callee1", 1},
{(uint64_t) "callee2", 2}};
- Record1.addValueData(IPVK_IndirectCallTarget, 2, VD2, 2, 0);
+ Record1.addValueData(IPVK_IndirectCallTarget, 2, VD2, 2, nullptr);
InstrProfValueData VD3[] = {{(uint64_t) "callee1", 1}};
- Record1.addValueData(IPVK_IndirectCallTarget, 3, VD3, 1, 0);
+ Record1.addValueData(IPVK_IndirectCallTarget, 3, VD3, 1, nullptr);
Writer.addRecord(std::move(Record1));
Writer.addRecord(std::move(Record2));
{(uint64_t) "callee2", 2},
{(uint64_t) "callee3", 3},
{(uint64_t) "callee4", 4}};
- Record11.addValueData(IPVK_IndirectCallTarget, 0, VD0, 4, 0);
+ Record11.addValueData(IPVK_IndirectCallTarget, 0, VD0, 4, nullptr);
// No valeu profile data at the second site.
- Record11.addValueData(IPVK_IndirectCallTarget, 1, 0, 0, 0);
+ Record11.addValueData(IPVK_IndirectCallTarget, 1, nullptr, 0, nullptr);
InstrProfValueData VD2[] = {{(uint64_t) "callee1", 1},
{(uint64_t) "callee2", 2},
{(uint64_t) "callee3", 3}};
- Record11.addValueData(IPVK_IndirectCallTarget, 2, VD2, 3, 0);
+ Record11.addValueData(IPVK_IndirectCallTarget, 2, VD2, 3, nullptr);
InstrProfValueData VD3[] = {{(uint64_t) "callee1", 1}};
- Record11.addValueData(IPVK_IndirectCallTarget, 3, VD3, 1, 0);
+ Record11.addValueData(IPVK_IndirectCallTarget, 3, VD3, 1, nullptr);
InstrProfValueData VD4[] = {{(uint64_t) "callee1", 1},
{(uint64_t) "callee2", 2},
{(uint64_t) "callee3", 3}};
- Record11.addValueData(IPVK_IndirectCallTarget, 4, VD4, 3, 0);
+ Record11.addValueData(IPVK_IndirectCallTarget, 4, VD4, 3, nullptr);
// A differnt record for the same caller.
Record12.reserveSites(IPVK_IndirectCallTarget, 5);
InstrProfValueData VD02[] = {{(uint64_t) "callee2", 5},
{(uint64_t) "callee3", 3}};
- Record12.addValueData(IPVK_IndirectCallTarget, 0, VD02, 2, 0);
+ Record12.addValueData(IPVK_IndirectCallTarget, 0, VD02, 2, nullptr);
// No valeu profile data at the second site.
- Record12.addValueData(IPVK_IndirectCallTarget, 1, 0, 0, 0);
+ Record12.addValueData(IPVK_IndirectCallTarget, 1, nullptr, 0, nullptr);
InstrProfValueData VD22[] = {{(uint64_t) "callee2", 1},
{(uint64_t) "callee3", 3},
{(uint64_t) "callee4", 4}};
- Record12.addValueData(IPVK_IndirectCallTarget, 2, VD22, 3, 0);
+ Record12.addValueData(IPVK_IndirectCallTarget, 2, VD22, 3, nullptr);
- Record12.addValueData(IPVK_IndirectCallTarget, 3, 0, 0, 0);
+ Record12.addValueData(IPVK_IndirectCallTarget, 3, nullptr, 0, nullptr);
InstrProfValueData VD42[] = {{(uint64_t) "callee1", 1},
{(uint64_t) "callee2", 2},
{(uint64_t) "callee3", 3}};
- Record12.addValueData(IPVK_IndirectCallTarget, 4, VD42, 3, 0);
+ Record12.addValueData(IPVK_IndirectCallTarget, 4, VD42, 3, nullptr);
Writer.addRecord(std::move(Record11));
// Merge profile data.
PE = I->first.end(); PI != PE; ++PI) {
OS << "\"" << *PI << "\" COMMA ";
}
- OS << "0})\n";
+ OS << "nullptr})\n";
}
OS << "#undef COMMA\n";
- OS << "#endif\n\n";
+ OS << "#endif // PREFIX\n\n";
OS << "/////////\n";
OS << "// Groups\n\n";
OS << "OPTION(";
// The option prefix;
- OS << "0";
+ OS << "nullptr";
// The option string.
OS << ", \"" << R.getValueAsString("Name") << '"';
OS << "INVALID";
// The other option arguments (unused for groups).
- OS << ", INVALID, 0, 0, 0";
+ OS << ", INVALID, nullptr, 0, 0";
// The option help text.
if (!isa<UnsetInit>(R.getValueInit("HelpText"))) {
OS << " ";
write_cstring(OS, R.getValueAsString("HelpText"));
} else
- OS << ", 0";
+ OS << ", nullptr";
// The option meta-variable name (unused).
- OS << ", 0)\n";
+ OS << ", nullptr)\n";
}
OS << "\n";
OS << ", ";
std::vector<std::string> AliasArgs = R.getValueAsListOfStrings("AliasArgs");
if (AliasArgs.size() == 0) {
- OS << "0";
+ OS << "nullptr";
} else {
OS << "\"";
for (size_t i = 0, e = AliasArgs.size(); i != e; ++i)
OS << " ";
write_cstring(OS, R.getValueAsString("HelpText"));
} else
- OS << ", 0";
+ OS << ", nullptr";
// The option meta-variable name.
OS << ", ";
if (!isa<UnsetInit>(R.getValueInit("MetaVarName")))
write_cstring(OS, R.getValueAsString("MetaVarName"));
else
- OS << "0";
+ OS << "nullptr";
OS << ")\n";
}
- OS << "#endif\n";
+ OS << "#endif // OPTION\n";
}
} // end namespace llvm