Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(511)

Unified Diff: lib/Transforms/NaCl/ExpandTls.cpp

Issue 14643019: Use Intrinsic::getDeclaration to obtain the nacl_read_tp intrinsic (Closed) Base URL: http://git.chromium.org/native_client/pnacl-llvm.git@master
Patch Set: Updated description Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/llvm/IR/Intrinsics.td ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/Transforms/NaCl/ExpandTls.cpp
diff --git a/lib/Transforms/NaCl/ExpandTls.cpp b/lib/Transforms/NaCl/ExpandTls.cpp
index 53e1c92a969ca0aa1681a37327eabbfbfc157aec..19837f74487641ebda0e8f496ab9e190c8e77929 100644
--- a/lib/Transforms/NaCl/ExpandTls.cpp
+++ b/lib/Transforms/NaCl/ExpandTls.cpp
@@ -29,6 +29,7 @@
#include "llvm/IR/DataLayout.h"
#include "llvm/IR/DerivedTypes.h"
#include "llvm/IR/Instructions.h"
+#include "llvm/IR/Intrinsics.h"
#include "llvm/IR/Module.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Transforms/NaCl.h"
@@ -233,17 +234,7 @@ static PointerType *buildTlsTemplate(Module &M, std::vector<VarInfo> *TlsVars) {
static void rewriteTlsVars(Module &M, std::vector<VarInfo> *TlsVars,
PointerType *TemplatePtrType) {
// Set up the intrinsic that reads the thread pointer.
- Type *i8 = Type::getInt8Ty(M.getContext());
- FunctionType *ReadTpType = FunctionType::get(PointerType::get(i8, 0),
- /*isVarArg=*/false);
- AttrBuilder B;
- B.addAttribute(Attribute::ReadOnly);
- B.addAttribute(Attribute::NoUnwind);
- AttributeSet ReadTpAttrs = AttributeSet::get(
- M.getContext(), AttributeSet::FunctionIndex, B);
- Constant *ReadTpFunc = M.getOrInsertTargetIntrinsic("llvm.nacl.read.tp",
- ReadTpType,
- ReadTpAttrs);
+ Function *ReadTpFunc = Intrinsic::getDeclaration(&M, Intrinsic::nacl_read_tp);
for (std::vector<VarInfo>::iterator VarInfo = TlsVars->begin();
VarInfo != TlsVars->end();
« no previous file with comments | « include/llvm/IR/Intrinsics.td ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698