aboutsummaryrefslogtreecommitdiff
path: root/include/llvm
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm')
-rw-r--r--include/llvm/ADT/DenseMap.h2
-rw-r--r--include/llvm/Analysis/NaCl.h23
-rw-r--r--include/llvm/CodeGen/AsmPrinter.h25
-rw-r--r--include/llvm/CodeGen/CallingConvLower.h14
-rw-r--r--include/llvm/CodeGen/ISDOpcodes.h13
-rw-r--r--include/llvm/CodeGen/IntrinsicLowering.h14
-rw-r--r--include/llvm/CodeGen/JITCodeEmitter.h9
-rw-r--r--include/llvm/CodeGen/LexicalScopes.h6
-rw-r--r--include/llvm/CodeGen/MachineConstantPool.h11
-rw-r--r--include/llvm/CodeGen/MachineInstrBuilder.h15
-rw-r--r--include/llvm/CodeGen/MachineRelocation.h8
-rw-r--r--include/llvm/IR/GlobalValue.h20
-rw-r--r--include/llvm/IR/Intrinsics.td30
-rw-r--r--include/llvm/IR/Module.h87
-rw-r--r--include/llvm/IR/Value.h6
-rw-r--r--include/llvm/InitializePasses.h4
-rw-r--r--include/llvm/MC/MCAsmBackend.h11
-rw-r--r--include/llvm/MC/MCAsmInfo.h15
-rw-r--r--include/llvm/MC/MCELFObjectWriter.h6
-rw-r--r--include/llvm/Support/ELF.h1
-rw-r--r--include/llvm/Support/ValueHandle.h14
-rw-r--r--include/llvm/Support/support_macros.h25
-rw-r--r--include/llvm/Support/system_error.h2
-rw-r--r--include/llvm/Target/Target.td34
-rw-r--r--include/llvm/Target/TargetJITInfo.h19
-rw-r--r--include/llvm/Target/TargetLowering.h12
-rw-r--r--include/llvm/Target/TargetOpcodes.h9
-rw-r--r--include/llvm/Target/TargetOptions.h6
-rw-r--r--include/llvm/Transforms/NaCl.h23
-rw-r--r--include/llvm/Transforms/Scalar.h2
-rw-r--r--include/llvm/Wrap/BCHeaderField.h106
-rw-r--r--include/llvm/Wrap/bitcode_wrapperer.h192
-rw-r--r--include/llvm/Wrap/file_wrapper_input.h48
-rw-r--r--include/llvm/Wrap/file_wrapper_output.h34
-rw-r--r--include/llvm/Wrap/wrapper_input.h38
-rw-r--r--include/llvm/Wrap/wrapper_output.h34
36 files changed, 909 insertions, 9 deletions
diff --git a/include/llvm/ADT/DenseMap.h b/include/llvm/ADT/DenseMap.h
index 04912c703c..12cba08a61 100644
--- a/include/llvm/ADT/DenseMap.h
+++ b/include/llvm/ADT/DenseMap.h
@@ -159,7 +159,7 @@ public:
return std::make_pair(iterator(TheBucket, getBucketsEnd(), true), true);
}
-#ifdef LLVM_HAS_RVALUE_REFERENCES
+#if LLVM_HAS_RVALUE_REFERENCES
// Inserts key,value pair into the map if the key isn't already in the map.
// If the key is already in the map, it returns false and doesn't update the
// value.
diff --git a/include/llvm/Analysis/NaCl.h b/include/llvm/Analysis/NaCl.h
new file mode 100644
index 0000000000..5f8c534c6f
--- /dev/null
+++ b/include/llvm/Analysis/NaCl.h
@@ -0,0 +1,23 @@
+//===-- 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
+
+namespace llvm {
+
+class FunctionPass;
+class ModulePass;
+
+FunctionPass *createPNaClABIVerifyFunctionsPass();
+ModulePass *createPNaClABIVerifyModulePass();
+
+}
+
+#endif
diff --git a/include/llvm/CodeGen/AsmPrinter.h b/include/llvm/CodeGen/AsmPrinter.h
index e0a6e3f402..c6569d680e 100644
--- a/include/llvm/CodeGen/AsmPrinter.h
+++ b/include/llvm/CodeGen/AsmPrinter.h
@@ -94,6 +94,12 @@ namespace llvm {
/// default, this is equal to CurrentFnSym.
MCSymbol *CurrentFnSymForSize;
+ /// @LOCALMOD-BEGIN
+ /// Is the bitcode module a plain object? This is false
+ /// for shared (pso) and executable (pexe) files.
+ bool IsPlainObject;
+ /// @LOCALMOD-END
+
private:
// GCMetadataPrinters - The garbage collection metadata printer table.
void *GCMetadataPrinters; // Really a DenseMap.
@@ -240,6 +246,18 @@ namespace llvm {
// Targets can, or in the case of EmitInstruction, must implement these to
// customize output.
+ // @LOCALMOD-START
+ /// UseReadOnlyJumpTables - true if JumpTableInfo must be in rodata.
+ virtual bool UseReadOnlyJumpTables() const { return false; }
+ /// GetTargetBasicBlockAlign - the target alignment for basic blocks.
+ virtual unsigned GetTargetBasicBlockAlign() const { return 0; }
+ /// GetTargetLabelAlign - Get optional alignment for TargetOpcode
+ /// labels E.g., EH_LABEL.
+ virtual unsigned GetTargetLabelAlign(const MachineInstr *MI) const {
+ return 0;
+ }
+ // @LOCALMOD-END
+
/// EmitStartOfAsmFile - This virtual method can be overridden by targets
/// that want to emit something at the start of their file.
virtual void EmitStartOfAsmFile(Module &) {}
@@ -254,7 +272,12 @@ namespace llvm {
/// EmitFunctionBodyEnd - Targets can override this to emit stuff after
/// the last basic block in the function.
- virtual void EmitFunctionBodyEnd() {}
+ virtual void EmitFunctionBodyEnd() {
+ // @LOCALMOD-START
+ unsigned NextFunctionAlignment = GetTargetBasicBlockAlign();
+ if (NextFunctionAlignment) EmitAlignment(NextFunctionAlignment);
+ // @LOCALMOD-END
+ }
/// EmitInstruction - Targets should implement this to emit instructions.
virtual void EmitInstruction(const MachineInstr *) {
diff --git a/include/llvm/CodeGen/CallingConvLower.h b/include/llvm/CodeGen/CallingConvLower.h
index c035e0777c..1e9772a512 100644
--- a/include/llvm/CodeGen/CallingConvLower.h
+++ b/include/llvm/CodeGen/CallingConvLower.h
@@ -165,6 +165,7 @@ private:
SmallVector<uint32_t, 16> UsedRegs;
unsigned FirstByValReg;
bool FirstByValRegValid;
+ bool HasByValInRegPosition; // @LOCALMOD -- ARM only: see comment below.
protected:
ParmContext CallOrPrologue;
@@ -313,6 +314,19 @@ public:
void clearFirstByValReg() { FirstByValReg = 0; FirstByValRegValid = false; }
bool isFirstByValRegValid() const { return FirstByValRegValid; }
+ // @LOCALMOD-BEGIN
+ // We disabled the splitting of byval between registers and memory.
+ // This separate flag indicates that a byval existed. We cannot reuse
+ // isFirstByValRegValid() because that is already used by the broken
+ // mechanism of splitting between stack and regs. We should check
+ // again if this mechanism is still broken later, or try to fix that
+ // mechanism.
+ // NOTE: this is only for ARM, so should be refactored.
+ bool hasByValInRegPosition() const { return HasByValInRegPosition; }
+ void setHasByValInRegPosition() { HasByValInRegPosition = true; }
+ void clearHasByValInRegPosition() { HasByValInRegPosition = false; }
+ // @LOCALMOD-END
+
ParmContext getCallOrPrologue() const { return CallOrPrologue; }
private:
diff --git a/include/llvm/CodeGen/ISDOpcodes.h b/include/llvm/CodeGen/ISDOpcodes.h
index 5d0a3b4c70..47170e4e58 100644
--- a/include/llvm/CodeGen/ISDOpcodes.h
+++ b/include/llvm/CodeGen/ISDOpcodes.h
@@ -641,6 +641,19 @@ namespace ISD {
/// is the chain and the second operand is the alloca pointer.
LIFETIME_START, LIFETIME_END,
+ // @LOCALMOD-BEGIN
+ // NACL_* - Native Client instrinsics.
+ // NACL_READ_TP is a fast built-in version of NaCl's tls_get() IRT
+ // interface.
+ NACL_READ_TP,
+ // These correspond to functions in:
+ // native_client/src/untrusted/nacl/tls_params.h
+ NACL_TP_TLS_OFFSET,
+ NACL_TP_TDB_OFFSET,
+ // Expands to the target architecture enumeration value.
+ NACL_TARGET_ARCH,
+ // @LOCALMOD-END
+
/// BUILTIN_OP_END - This must be the last enum value in this list.
/// The target-specific pre-isel opcode values start here.
BUILTIN_OP_END
diff --git a/include/llvm/CodeGen/IntrinsicLowering.h b/include/llvm/CodeGen/IntrinsicLowering.h
index 68389dde49..686a9be529 100644
--- a/include/llvm/CodeGen/IntrinsicLowering.h
+++ b/include/llvm/CodeGen/IntrinsicLowering.h
@@ -16,6 +16,7 @@
#ifndef LLVM_CODEGEN_INTRINSICLOWERING_H
#define LLVM_CODEGEN_INTRINSICLOWERING_H
+#include "llvm/ADT/StringSet.h" // @LOCALMOD
#include "llvm/IR/Intrinsics.h"
namespace llvm {
@@ -26,12 +27,23 @@ namespace llvm {
class IntrinsicLowering {
const DataLayout& TD;
-
+ static StringSet<> FuncNames; // @LOCALMOD
+
bool Warned;
public:
explicit IntrinsicLowering(const DataLayout &td) :
TD(td), Warned(false) {}
+ /// @LOCALMOD-BEGIN
+ /// GetFuncNames - Get the names of all functions which may
+ /// be called by an intrinsic.
+ static const StringSet<> &GetFuncNames();
+
+ /// IsCalledByIntrinsic - Returns true if a function may be called
+ /// by an intrinsic.
+ static bool IsCalledByIntrinsic(const StringRef &FuncName);
+ /// @LOCALMOD-END
+
/// AddPrototypes - This method, if called, causes all of the prototypes
/// that might be needed by an intrinsic lowering implementation to be
/// inserted into the module specified.
diff --git a/include/llvm/CodeGen/JITCodeEmitter.h b/include/llvm/CodeGen/JITCodeEmitter.h
index 21a3f481a5..e14d04e422 100644
--- a/include/llvm/CodeGen/JITCodeEmitter.h
+++ b/include/llvm/CodeGen/JITCodeEmitter.h
@@ -290,7 +290,7 @@ public:
/// getCurrentPCOffset - Return the offset from the start of the emitted
/// buffer that we are currently writing to.
- uintptr_t getCurrentPCOffset() const {
+ virtual uintptr_t getCurrentPCOffset() const { // @LOCALMOD
return CurBufferPtr-BufferBegin;
}
@@ -335,6 +335,13 @@ public:
/// getLabelLocations - Return the label locations map of the label IDs to
/// their address.
virtual DenseMap<MCSymbol*, uintptr_t> *getLabelLocations() { return 0; }
+
+ // @LOCALMOD-START
+ virtual void beginBundleLock() {};
+ virtual void endBundleLock() {};
+ virtual void alignToBundleBeginning() {};
+ virtual void alignToBundleEnd() {};
+ // @LOCALMOD-END
};
} // End llvm namespace
diff --git a/include/llvm/CodeGen/LexicalScopes.h b/include/llvm/CodeGen/LexicalScopes.h
index 3cb6b4de2c..30f167d8f4 100644
--- a/include/llvm/CodeGen/LexicalScopes.h
+++ b/include/llvm/CodeGen/LexicalScopes.h
@@ -162,6 +162,12 @@ public:
#ifndef NDEBUG
IndentLevel = 0;
#endif
+ // @LOCALMOD-BEGIN -- Hack for bug
+ // http://code.google.com/p/nativeclient/issues/detail?id=2786
+ Desc.make_weak();
+ InlinedAtLocation.make_weak();
+ // @LOCALMOD-END
+
if (Parent)
Parent->addChild(this);
}
diff --git a/include/llvm/CodeGen/MachineConstantPool.h b/include/llvm/CodeGen/MachineConstantPool.h
index 8ed215d75b..827a9f81e8 100644
--- a/include/llvm/CodeGen/MachineConstantPool.h
+++ b/include/llvm/CodeGen/MachineConstantPool.h
@@ -57,6 +57,17 @@ public:
virtual void addSelectionDAGCSEId(FoldingSetNodeID &ID) = 0;
+ // @LOCALMOD-START
+ /// getJumpTableIndex - Check if this is a reference to a jump table.
+ /// If so, return a pointer to the jump table index value that is stored
+ /// in the constant pool, else return 0.
+ /// The default behavior is to indicate that the value is not a jump table
+ /// index. This is used by BranchFolder::runOnMachineFunction() and only in
+ /// conjunction with ARM targets
+ /// TODO: this should be cleaned up as it does tripple duty: tester, setter, getter
+ virtual unsigned *getJumpTableIndex() { return 0; }
+ // @LOCALMOD-END
+
/// print - Implement operator<<
virtual void print(raw_ostream &O) const = 0;
};
diff --git a/include/llvm/CodeGen/MachineInstrBuilder.h b/include/llvm/CodeGen/MachineInstrBuilder.h
index 92c8da991c..732958ed40 100644
--- a/include/llvm/CodeGen/MachineInstrBuilder.h
+++ b/include/llvm/CodeGen/MachineInstrBuilder.h
@@ -314,6 +314,21 @@ inline MachineInstrBuilder BuildMI(MachineBasicBlock &BB,
return BuildMI(BB, MII, DL, MCID);
}
+// @LOCALMOD-BEGIN
+/// BuildMI - This version of the builder inserts the newly-built
+/// instruction before the given position in the given MachineBasicBlock,
+/// does NOT take a destination register, and does not add implicit operands.
+///
+inline MachineInstrBuilder BuildMI_NoImp(MachineBasicBlock &BB,
+ MachineBasicBlock::iterator I,
+ DebugLoc DL,
+ const MCInstrDesc &MCID) {
+ MachineInstr *MI = BB.getParent()->CreateMachineInstr(MCID, DL, true);
+ BB.insert(I, MI);
+ return MachineInstrBuilder(*BB.getParent(), MI);
+}
+// @LOCALMOD-END
+
/// BuildMI - This version of the builder inserts the newly-built
/// instruction at the end of the given MachineBasicBlock, and does NOT take a
/// destination register.
diff --git a/include/llvm/CodeGen/MachineRelocation.h b/include/llvm/CodeGen/MachineRelocation.h
index 244b466e17..8d71930882 100644
--- a/include/llvm/CodeGen/MachineRelocation.h
+++ b/include/llvm/CodeGen/MachineRelocation.h
@@ -197,6 +197,14 @@ public:
return Offset;
}
+ // @LOCALMOD-START
+ /// setMachineCodeOffset() - Adjust the offset in the code buffer (this is
+ /// used when the instruction is moved after emission for bundle alignment)
+ void setMachineCodeOffset(intptr_t offset) {
+ Offset = offset;
+ }
+ // @LOCALMOD-END
+
/// getRelocationType - Return the target-specific relocation ID for this
/// relocation.
unsigned getRelocationType() const {
diff --git a/include/llvm/IR/GlobalValue.h b/include/llvm/IR/GlobalValue.h
index f398bc1b87..c87e7d06b3 100644
--- a/include/llvm/IR/GlobalValue.h
+++ b/include/llvm/IR/GlobalValue.h
@@ -76,6 +76,26 @@ public:
removeDeadConstantUsers(); // remove any dead constants using this.
}
+ // @LOCALMOD-BEGIN
+ /// Set the symbol version for this definition.
+ void setVersionDef(StringRef Version, bool IsDefault);
+
+ /// Set the symbol version and dynamic source file (soname)
+ /// for this exterally provided global.
+ void setNeeded(StringRef Version, StringRef DynFile);
+
+ /// Get the name of this symbol without the version suffix.
+ StringRef getUnversionedName() const;
+
+ /// Get the version of this symbol.
+ /// Returns an empty string if the symbol is unversioned.
+ StringRef getVersion() const;
+
+ /// Returns true if this is the default version of the symbol.
+ /// This may only be called if the symbol is versioned.
+ bool isDefaultVersion() const;
+ // @LOCALMOD-END
+
unsigned getAlignment() const {
return (1u << Alignment) >> 1;
}
diff --git a/include/llvm/IR/Intrinsics.td b/include/llvm/IR/Intrinsics.td
index e252664e45..3d85b2f89f 100644
--- a/include/llvm/IR/Intrinsics.td
+++ b/include/llvm/IR/Intrinsics.td
@@ -470,6 +470,36 @@ def int_convertus : Intrinsic<[llvm_anyint_ty],
def int_convertuu : Intrinsic<[llvm_anyint_ty],
[llvm_anyint_ty, llvm_i32_ty, llvm_i32_ty]>;
+// @LOCALMOD-BEGIN
+//===----------------------- Native Client Intrinsics ---------------------===//
+// TODO(sehr): conditionalize this on IsNaCl64 | IsNaCl32 | IsNaClArm.
+// The expansions of these are in lib/Target/X86/X86InstrNacl.{td, cpp} and
+// lib/Target/ARM/ARMInstrInfo.td.
+def int_nacl_setjmp : Intrinsic<[llvm_i32_ty], [llvm_ptr_ty, llvm_ptr_ty]>,
+ GCCBuiltin<"__builtin_nacl_setjmp">;
+def int_nacl_longjmp : Intrinsic<[], [llvm_ptr_ty, llvm_i32_ty]>,
+ GCCBuiltin<"__builtin_nacl_longjmp">;
+
+// Fast built-in version of NaCl's tls_get() IRT interface.
+def int_nacl_read_tp : Intrinsic<[llvm_ptr_ty], [], [IntrNoMem]>,
+ GCCBuiltin<"__builtin_nacl_read_tp">;
+
+// The following intrinsics provide target-specific implementations of
+// the interface in native_client/src/untrusted/nacl/tls_params.h.
+// The intrinsic names are basically the functions there without the
+// leading underscores.
+def int_nacl_tp_tls_offset : Intrinsic<[llvm_i32_ty], [llvm_i32_ty]>,
+ GCCBuiltin<"__builtin_nacl_tp_tls_offset">;
+def int_nacl_tp_tdb_offset : Intrinsic<[llvm_i32_ty], [llvm_i32_ty]>,
+ GCCBuiltin<"__builtin_nacl_tp_tdb_offset">;
+
+// The following intrinsic provides a target-specific constant value to
+// indicate the target platform compiled to. The enum values are enumerated
+// pnaclintrin.h.
+def int_nacl_target_arch : Intrinsic<[llvm_i32_ty], []>,
+ GCCBuiltin<"__builtin_nacl_target_arch">;
+// @LOCALMOD-END
+
//===----------------------------------------------------------------------===//
// Target-specific intrinsics
//===----------------------------------------------------------------------===//
diff --git a/include/llvm/IR/Module.h b/include/llvm/IR/Module.h
index f1290a7a28..a364e1a856 100644
--- a/include/llvm/IR/Module.h
+++ b/include/llvm/IR/Module.h
@@ -21,6 +21,7 @@
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/Metadata.h"
#include "llvm/Support/DataTypes.h"
+#include <vector> // @LOCALMOD
namespace llvm {
@@ -120,7 +121,10 @@ public:
typedef iplist<GlobalAlias> AliasListType;
/// The type for the list of named metadata.
typedef ilist<NamedMDNode> NamedMDListType;
-
+ // @LOCALMOD-BEGIN
+ /// The type for the list of dependent libraries.
+ typedef std::vector<std::string> LibraryListType;
+ // @LOCALMOD-END
/// The Global Variable iterator.
typedef GlobalListType::iterator global_iterator;
/// The Global Variable constant iterator.
@@ -140,7 +144,10 @@ public:
typedef NamedMDListType::iterator named_metadata_iterator;
/// The named metadata constant interators.
typedef NamedMDListType::const_iterator const_named_metadata_iterator;
-
+ // @LOCALMOD-BEGIN
+ /// The Library list iterator.
+ typedef LibraryListType::const_iterator lib_iterator;
+ // @LOCALMOD-END
/// An enumeration for describing the endianess of the target machine.
enum Endianness { AnyEndianness, LittleEndian, BigEndian };
@@ -180,6 +187,22 @@ public:
: Behavior(B), Key(K), Val(V) {}
};
+ /// @LOCALMOD-BEGIN
+ /// An enumeration for describing the module format
+ enum OutputFormat {
+ ObjectOutputFormat,
+ SharedOutputFormat,
+ ExecutableOutputFormat
+ };
+
+ /// A structure describing the symbols needed from an external file.
+ struct NeededRecord {
+ std::string DynFile; // Source file (soname)
+ std::vector<std::string> Symbols; // List of symbol names
+ // (with version suffix)
+ };
+ /// @LOCALMOD-END
+
/// @}
/// @name Member Variables
/// @{
@@ -189,6 +212,8 @@ private:
GlobalListType GlobalList; ///< The Global Variables in the module
FunctionListType FunctionList; ///< The Functions in the module
AliasListType AliasList; ///< The Aliases in the module
+ // @LOCALMOD
+ LibraryListType LibraryList; ///< The Libraries needed by the module
NamedMDListType NamedMDList; ///< The named metadata in the module
std::string GlobalScopeAsm; ///< Inline Asm at global scope.
ValueSymbolTable *ValSymTab; ///< Symbol table for values
@@ -196,6 +221,9 @@ private:
std::string ModuleID; ///< Human readable identifier for the module
std::string TargetTriple; ///< Platform target triple Module compiled on
std::string DataLayout; ///< Target data description
+ // @LOCALMOD-BEGIN
+ mutable std::string ModuleSOName; ///< Module SOName (for shared format)
+ // @LOCALMOD-END
void *NamedMDSymTab; ///< NamedMDNode names.
friend class Constant;
@@ -227,6 +255,24 @@ public:
/// @returns a string containing the target triple.
const std::string &getTargetTriple() const { return TargetTriple; }
+ // @LOCALMOD-BEGIN
+
+ /// Get the module format
+ /// @returns the module format
+ OutputFormat getOutputFormat() const;
+
+ /// Get the SOName of this module.
+ /// @returns a string containing the module soname
+ const std::string &getSOName() const;
+
+ /// Record the needed information for a global value.
+ /// This creates a needed record for DynFile, if one does not already exist.
+ void addNeededRecord(StringRef DynFile, GlobalValue *GV);
+
+ // Fill NeededOut with all needed records present in the module.
+ void getNeededRecords(std::vector<NeededRecord> *NeededOut) const;
+ // @LOCALMOD-END
+
/// Get the target endian information.
/// @returns Endianess - an enumeration for the endianess of the target
Endianness getEndianness() const;
@@ -256,6 +302,18 @@ public:
/// Set the target triple.
void setTargetTriple(StringRef T) { TargetTriple = T; }
+ /// @LOCALMOD-BEGIN
+
+ /// Set the module format
+ void setOutputFormat(OutputFormat F);
+
+ /// For modules with output format "shared", set the output soname.
+ void setSOName(StringRef Name);
+
+ /// Wrap a global symbol.
+ void wrapSymbol(StringRef SymName);
+ /// @LOCALMOD-END
+
/// Set the module-scope inline assembly blocks.
void setModuleInlineAsm(StringRef Asm) {
GlobalScopeAsm = Asm;
@@ -518,8 +576,28 @@ public:
const_iterator end () const { return FunctionList.end(); }
size_t size() const { return FunctionList.size(); }
bool empty() const { return FunctionList.empty(); }
+ // @LOCALMOD-BEGIN
+/// @}
+/// @name Dependent Library Iteration
+/// @{
+
+ /// @brief Get a constant iterator to beginning of dependent library list.
+ inline lib_iterator lib_begin() const { return LibraryList.begin(); }
+ /// @brief Get a constant iterator to end of dependent library list.
+ inline lib_iterator lib_end() const { return LibraryList.end(); }
+ /// @brief Returns the number of items in the list of libraries.
+ inline size_t lib_size() const { return LibraryList.size(); }
+ void convertMetadataToLibraryList();
+ void convertLibraryListToMetadata() const;
+ /// @brief Add a library to the list of dependent libraries
+ void addLibrary(StringRef Lib);
+ /// @brief Remove a library from the list of dependent libraries
+ void removeLibrary(StringRef Lib);
+ /// @brief Get all the libraries
+ inline const LibraryListType& getLibraries() const { return LibraryList; }
/// @}
+ // @LOCALMOD-END
/// @name Alias Iteration
/// @{
@@ -560,6 +638,11 @@ public:
/// Dump the module to stderr (for debugging).
void dump() const;
+ /// @LOCALMOD-BEGIN
+ /// Print the PNaCl metadata for the module.
+ void dumpMeta(raw_ostream &OS) const;
+ /// @LOCALMOD-END
+
/// This function causes all the subinstructions to "let go" of all references
/// that they are maintaining. This allows one to 'delete' a whole class at
/// a time, even though there may be circular references... first all
diff --git a/include/llvm/IR/Value.h b/include/llvm/IR/Value.h
index a4f78627a8..7ab72cf23b 100644
--- a/include/llvm/IR/Value.h
+++ b/include/llvm/IR/Value.h
@@ -105,6 +105,12 @@ public:
///
Type *getType() const { return VTy; }
+ // @LOCALMOD-START
+ // Currently only used for function type update during
+ // the NaCl calling convention rewrite pass
+ void setType(Type* t) { VTy = t; }
+ // @LOCALMOD-END
+
/// All values hold a context through their type.
LLVMContext &getContext() const;
diff --git a/include/llvm/InitializePasses.h b/include/llvm/InitializePasses.h
index 870c7c04ca..2dddc4cde0 100644
--- a/include/llvm/InitializePasses.h
+++ b/include/llvm/InitializePasses.h
@@ -270,6 +270,10 @@ void initializeFinalizeMachineBundlesPass(PassRegistry&);
void initializeLoopVectorizePass(PassRegistry&);
void initializeBBVectorizePass(PassRegistry&);
void initializeMachineFunctionPrinterPassPass(PassRegistry&);
+void initializeExpandCtorsPass(PassRegistry&); // @LOCALMOD
+void initializeExpandTlsPass(PassRegistry&); // @LOCALMOD
+void initializeExpandTlsConstantExprPass(PassRegistry&); // @LOCALMOD
+void initializeNaClCcRewritePass(PassRegistry&); // @LOCALMOD
}
#endif
diff --git a/include/llvm/MC/MCAsmBackend.h b/include/llvm/MC/MCAsmBackend.h
index 9a6b703408..685f2cb89f 100644
--- a/include/llvm/MC/MCAsmBackend.h
+++ b/include/llvm/MC/MCAsmBackend.h
@@ -25,6 +25,7 @@ class MCInst;
class MCRelaxableFragment;
class MCObjectWriter;
class MCSection;
+class MCStreamer;
class MCValue;
class raw_ostream;
@@ -160,6 +161,16 @@ public:
/// handleAssemblerFlag - Handle any target-specific assembler flags.
/// By default, do nothing.
virtual void handleAssemblerFlag(MCAssemblerFlag Flag) {}
+
+ // @LOCALMOD-BEGIN
+ /// CustomExpandInst -
+ /// If the MCInst instruction has a custom expansion, write it to the
+ /// MCStreamer 'Out'. This can be used to perform "last minute" rewrites of
+ /// MCInst instructions for emission.
+ virtual bool CustomExpandInst(const MCInst &Inst, MCStreamer &Out) const {
+ return false;
+ }
+ // @LOCALMOD-END
};
} // End llvm namespace
diff --git a/include/llvm/MC/MCAsmInfo.h b/include/llvm/MC/MCAsmInfo.h
index 97114bb034..e8f7f116fe 100644
--- a/include/llvm/MC/MCAsmInfo.h
+++ b/include/llvm/MC/MCAsmInfo.h
@@ -48,6 +48,14 @@ namespace llvm {
/// Default is 4.
unsigned PointerSize;
+ /// @LOCALMOD-BEGIN
+ /// TODO(pdox): Before upstreaming this, make sure every target backend
+ /// sets it correctly.
+ /// StackSlotSize - Stack slot size in bytes.
+ /// Default is 4.
+ unsigned StackSlotSize;
+ /// @LOCALMOD-END
+
/// IsLittleEndian - True if target is little endian.
/// Default is true.
bool IsLittleEndian;
@@ -343,6 +351,13 @@ namespace llvm {
return PointerSize;
}
+ /// @LOCALMOD-BEGIN
+ /// getStackSlotSize - Get the stack slot size in bytes.
+ unsigned getStackSlotSize() const {
+ return StackSlotSize;
+ }
+ /// @LOCALMOD-END
+
/// islittleendian - True if the target is little endian.
bool isLittleEndian() const {
return IsLittleEndian;
diff --git a/include/llvm/MC/MCELFObjectWriter.h b/include/llvm/MC/MCELFObjectWriter.h
index 38cdc7293b..9842f8aa45 100644
--- a/include/llvm/MC/MCELFObjectWriter.h
+++ b/include/llvm/MC/MCELFObjectW