Σχεδίαση και Υλοποίηση ενός Optimization Pass στο LLVM για την Αναγνώριση Ιδιωμάτων Κώδικα

dc.contributor.advisorΒασιλάκης, Κωνσταντίνος
dc.contributor.advisorΔημητρουλάκος, Γρηγόριος
dc.contributor.authorΜότση, Πολυξένη
dc.contributor.committeeΤσελίκας, Νικόλαος
dc.contributor.departmentΤμήμα Πληροφορικής και Τηλεπικοινωνιώνel
dc.contributor.facultyΣχολή Οικονομίας και Τεχνολογίαςel
dc.contributor.masterΕπιστήμη Υπολογιστώνel
dc.date.accessioned2026-04-03T09:27:30Z
dc.date.available2026-04-03T09:27:30Z
dc.date.issued2026-03-13
dc.descriptionΜ.Δ.Ε. 114el
dc.description.abstractΗ σύγχρονη μεταγλώττιση βασίζεται στην ικανότητα των μεταγλωττιστών να μετασχηματίζουν κώδικα υψηλού επιπέδου σε αποδοτικές εντολές μηχανής. Ωστόσο, κατά τη διαδικασία μετάφρασης στην Ενδιάμεση Αναπαράσταση (Intermediate Representation - IR), η αρχική πρόθεση του προγραμματιστή συχνά συσκοτίζεται, οδηγώντας σε αυτό που ονομάζεται «Σημασιολογικό Χάσμα» (Semantic Gap). Πολύπλοκα μαθηματικά ιδιώματα υποβιβάζονται σε φλύαρες ακολουθίες γενικών εντολών, εμποδίζοντας την αξιοποίηση εξειδικευμένου υλικού. Η παρούσα διπλωματική εργασία αντιμετωπίζει αυτό το πρόβλημα μέσω της σχεδίασης και υλοποίησης του PatternSelectPass, ενός περάσματος βελτιστοποίησης (Optimization Pass) ενταγμένου στον Νέο Διαχειριστή Περασμάτων (New Pass Manager) του LLVM. Το προτεινόμενο εργαλείο χρησιμοποιεί προηγμένες τεχνικές ταύτισης προτύπων (pattern matching) για τον εντοπισμό επτά (7) κρίσιμων αριθμητικών ιδιωμάτων, συμπεριλαμβανομένων της Περιστροφής Bit (Rotate), της Καταμέτρησης Πληθυσμού (PopCount), της Ακέραιας Απόλυτης Τιμής (Abs) και των πράξεων Ελαχίστου/Μεγίστου (Min/Max). Μόλις αναγνωριστούν, αυτές οι ακολουθίες αντικαθίστανται αυτόματα από τις αντίστοιχες Εγγενείς Συναρτήσεις (Intrinsics) του LLVM. Η πειραματική αξιολόγηση σε στοχευμένα σενάρια ελέγχου κατέδειξε ότι το PatternSelectPass επιτυγχάνει μείωση του στατικού αριθμού εντολών κατά 52.9% σε σύγκριση με τον μη βελτιστοποιημένο κώδικα, ξεπερνώντας σε συγκεκριμένες περιπτώσεις ακόμη και τον καθιερωμένο βελτιστοποιητή InstCombine. Επιπλέον, η χρήση intrinsics οδηγεί σε σημαντική απλοποίηση του Γράφου Ροής Ελέγχου (Control Flow Graph), εξαλείφοντας περιττές διακλαδώσεις και προετοιμάζοντας το έδαφος για βέλτιστη παραγωγή κώδικα στο backend.el
dc.description.abstracttranslatedModern compilation relies on the ability of compilers to transform high-level code into efficient machine instructions. However, during the translation process to Intermediate Representation (IR), the programmer’s original intent is often obscured, leading to what is known as the "Semantic Gap". Complex mathematical idioms are lowered into verbose sequences of generic instructions, hindering the utilization of specialized hardware capabilities. This thesis addresses this problem through the design and implementation of PatternSelectPass, an optimization pass integrated into LLVM’s New Pass Manager. The proposed tool utilizes advanced pattern matching techniques to detect seven (7) critical arithmetic idioms, including Bitwise Rotate, Population Count, Integer Absolute Value, and Min/Max operations. Once recognized, these sequences are automatically replaced by the corresponding LLVM Intrinsics. Experimental evaluation on targeted test scenarios demonstrated that Pattern Select Pass achieves a 52.9% reduction in static instruction count compared to unoptimized code, outperforming in specific cases even the established InstCombine optimizer. Furthermore, the use of intrinsics leads to a significant simplification of the Control Flow Graph (CFG), eliminating unnecessary branches and paving the way for optimal code generation in the backend.el
dc.format.extent81el
dc.identifier.urihttps://amitos.library.uop.gr/handle/123456789/9921
dc.language.isoelel
dc.publisherΠανεπιστήμιο Πελοποννήσουel
dc.rightsΑναφορά Δημιουργού-Μη Εμπορική Χρήση-Όχι Παράγωγα Έργα 3.0 Ελλάδα*
dc.rightsΑναφορά Δημιουργού 3.0 Ελλάδα*
dc.rights.urihttp://creativecommons.org/licenses/by/3.0/gr/*
dc.subjectΒελτιστοποίηση μεταγλωττιστώνel
dc.subjectΣημασιολογίαel
dc.subjectΜεταγλωττιστές (προγράμματα υπολογιστών) — Σχεδίασηel
dc.subjectOptimizing compilersel
dc.subjectSemanticsel
dc.subjectCompilers(Computer software)-Designel
dc.subject.keywordLLVMel
dc.subject.keywordCompilerel
dc.subject.keywordPassel
dc.subject.keywordOptimization Passel
dc.titleΣχεδίαση και Υλοποίηση ενός Optimization Pass στο LLVM για την Αναγνώριση Ιδιωμάτων Κώδικαel
dc.title.alternativeDesign and Implementation of an LLVM Optimization Pass for Code Idiom Recognitionel
dc.typeΜεταπτυχιακή διπλωματική εργασίαel

Files

Original bundle

Now showing 1 - 1 of 1
Loading...
Thumbnail Image
Name:
Polyxeni Motsi - Design and Implementation of an LLVM Optimization Pass for Code Idiom Recognition.pdf
Size:
2.05 MB
Format:
Adobe Portable Document Format
Description:

License bundle

Now showing 1 - 1 of 1
Loading...
Thumbnail Image
Name:
license.txt
Size:
933 B
Format:
Item-specific license agreed upon to submission
Description: