This repository has been archived by the owner on Feb 5, 2019. It is now read-only.
forked from luqmana/llvm
-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from brson/fastcomp-squash
Squash of fastcomp commit 4105790
- Loading branch information
Showing
214 changed files
with
35,635 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -224,6 +224,7 @@ set(LLVM_ALL_TARGETS | |
ARM | ||
BPF | ||
Hexagon | ||
JSBackend # @LOCALMOD | ||
Mips | ||
MSP430 | ||
NVPTX | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
"1.36.9" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
//===-- NaCl.h - NaCl Analysis ---------------------------*- C++ -*-===// | ||
// | ||
// The LLVM Compiler Infrastructure | ||
// | ||
// This file is distributed under the University of Illinois Open Source | ||
// License. See LICENSE.TXT for details. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef LLVM_ANALYSIS_NACL_H | ||
#define LLVM_ANALYSIS_NACL_H | ||
|
||
#include "llvm/Support/CommandLine.h" | ||
#include "llvm/Support/ErrorHandling.h" | ||
#include "llvm/Support/raw_ostream.h" | ||
#include <string> | ||
|
||
namespace llvm { | ||
|
||
class FunctionPass; | ||
class ModulePass; | ||
extern cl::opt<bool> PNaClABIAllowDebugMetadata; | ||
|
||
class PNaClABIErrorReporter { | ||
PNaClABIErrorReporter(const PNaClABIErrorReporter&) = delete; | ||
void operator=(const PNaClABIErrorReporter&) = delete; | ||
public: | ||
PNaClABIErrorReporter() : ErrorCount(0), Errors(ErrorString), | ||
UseFatalErrors(true) {} | ||
~PNaClABIErrorReporter() {} | ||
// Return the number of verification errors from the last run. | ||
int getErrorCount() const { return ErrorCount; } | ||
// Print the error messages to O | ||
void printErrors(llvm::raw_ostream &O) { | ||
Errors.flush(); | ||
O << ErrorString; | ||
} | ||
// Increments the error count and returns an ostream to which the error | ||
// message can be streamed. | ||
raw_ostream &addError() { | ||
ErrorCount++; | ||
return Errors; | ||
} | ||
// Reset the error count and error messages. | ||
void reset() { | ||
ErrorCount = 0; | ||
Errors.flush(); | ||
ErrorString.clear(); | ||
} | ||
void setNonFatal() { | ||
UseFatalErrors = false; | ||
} | ||
void checkForFatalErrors() { | ||
if (UseFatalErrors && ErrorCount != 0) { | ||
printErrors(errs()); | ||
report_fatal_error("PNaCl ABI verification failed"); | ||
} | ||
} | ||
private: | ||
int ErrorCount; | ||
std::string ErrorString; | ||
raw_string_ostream Errors; | ||
bool UseFatalErrors; | ||
}; | ||
|
||
FunctionPass *createPNaClABIVerifyFunctionsPass( | ||
PNaClABIErrorReporter *Reporter); | ||
ModulePass *createPNaClABIVerifyModulePass(PNaClABIErrorReporter *Reporter, | ||
bool StreamingMode = false); | ||
|
||
} | ||
|
||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
//===-- llvm/IR/NaClAtomicIntrinsics.h - NaCl Atomic Intrinsics -*- C++ -*-===// | ||
// | ||
// The LLVM Compiler Infrastructure | ||
// | ||
// This file is distributed under the University of Illinois Open Source | ||
// License. See LICENSE.TXT for details. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This file describes atomic intrinsic functions that are specific to NaCl. | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
#ifndef LLVM_IR_NACL_ATOMIC_INTRINSICS_H | ||
#define LLVM_IR_NACL_ATOMIC_INTRINSICS_H | ||
|
||
#include "llvm/IR/Intrinsics.h" | ||
#include "llvm/Support/Compiler.h" | ||
#include <cstddef> | ||
|
||
namespace llvm { | ||
|
||
namespace NaCl { | ||
|
||
static const size_t NumAtomicIntrinsics = 6; | ||
static const size_t NumAtomicIntrinsicOverloadTypes = 4; | ||
static const size_t MaxAtomicIntrinsicsParameters = 5; | ||
|
||
/// Describe all the atomic intrinsics and their type signature. Most | ||
/// can be overloaded on a type. | ||
class AtomicIntrinsics { | ||
public: | ||
enum ParamType { | ||
NoP, /// No parameter. | ||
Int, /// Overloaded. | ||
Ptr, /// Overloaded. | ||
RMW, /// Atomic RMW operation type. | ||
Mem /// Memory order. | ||
}; | ||
|
||
struct AtomicIntrinsic { | ||
Type *OverloadedType; | ||
Intrinsic::ID ID; | ||
uint8_t Overloaded : 1; | ||
uint8_t NumParams : 7; | ||
uint8_t ParamType[MaxAtomicIntrinsicsParameters]; | ||
|
||
Function *getDeclaration(Module *M) const { | ||
// The atomic intrinsic can be overloaded on zero or one type, | ||
// which is needed to create the function's declaration. | ||
return Intrinsic::getDeclaration( | ||
M, ID, ArrayRef<Type *>(&OverloadedType, Overloaded ? 1 : 0)); | ||
} | ||
}; | ||
|
||
AtomicIntrinsics(LLVMContext &C); | ||
~AtomicIntrinsics() {} | ||
|
||
typedef ArrayRef<AtomicIntrinsic> View; | ||
|
||
/// Access all atomic intrinsics, which can then be iterated over. | ||
View allIntrinsicsAndOverloads() const; | ||
/// Access a particular atomic intrinsic. | ||
/// \returns 0 if no intrinsic was found. | ||
const AtomicIntrinsic *find(Intrinsic::ID ID, Type *OverloadedType) const; | ||
|
||
private: | ||
AtomicIntrinsic I[NumAtomicIntrinsics][NumAtomicIntrinsicOverloadTypes]; | ||
|
||
AtomicIntrinsics() = delete; | ||
AtomicIntrinsics(const AtomicIntrinsics &) = delete; | ||
AtomicIntrinsics &operator=(const AtomicIntrinsics &) = delete; | ||
}; | ||
|
||
/// Operations that can be represented by the @llvm.nacl.atomic.rmw | ||
/// intrinsic. | ||
/// | ||
/// Do not reorder these values: their order offers forward | ||
/// compatibility of bitcode targeted to NaCl. | ||
enum AtomicRMWOperation { | ||
AtomicInvalid = 0, // Invalid, keep first. | ||
AtomicAdd, | ||
AtomicSub, | ||
AtomicOr, | ||
AtomicAnd, | ||
AtomicXor, | ||
AtomicExchange, | ||
AtomicNum // Invalid, keep last. | ||
}; | ||
|
||
/// Memory orderings supported by C11/C++11. | ||
/// | ||
/// Do not reorder these values: their order offers forward | ||
/// compatibility of bitcode targeted to NaCl. | ||
enum MemoryOrder { | ||
MemoryOrderInvalid = 0, // Invalid, keep first. | ||
MemoryOrderRelaxed, | ||
MemoryOrderConsume, | ||
MemoryOrderAcquire, | ||
MemoryOrderRelease, | ||
MemoryOrderAcquireRelease, | ||
MemoryOrderSequentiallyConsistent, | ||
MemoryOrderNum // Invalid, keep last. | ||
}; | ||
|
||
} // End NaCl namespace | ||
|
||
} // End llvm namespace | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.